QTfrontend/hwform.cpp
changeset 3937 494221b5950e
parent 3932 2fc211f60015
child 3940 cc29628976cc
equal deleted inserted replaced
3936:0b982d340633 3937:494221b5950e
    81     frontendEffects = gameSettings->value("frontend/effects", true).toBool();
    81     frontendEffects = gameSettings->value("frontend/effects", true).toBool();
    82     playerHash = QString(QCryptographicHash::hash(gameSettings->value("net/nick","").toString().toLatin1(), QCryptographicHash::Md5).toHex());
    82     playerHash = QString(QCryptographicHash::hash(gameSettings->value("net/nick","").toString().toLatin1(), QCryptographicHash::Md5).toHex());
    83 
    83 
    84     ui.setupUi(this);
    84     ui.setupUi(this);
    85     setMinimumSize(760, 580);
    85     setMinimumSize(760, 580);
    86 
    86     setFocusPolicy(Qt::StrongFocus);
    87     CustomizePalettes();
    87     CustomizePalettes();
    88 
    88 
    89     ui.pageOptions->CBResolution->addItems(sdli.getResolutions());
    89     ui.pageOptions->CBResolution->addItems(sdli.getResolutions());
    90 
    90 
    91     config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini");
    91     config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini");
    92 
    92 
    93     namegen = new HWNamegen();
    93     namegen = new HWNamegen();
    94 
    94 
    95 #ifdef __APPLE__
    95 #ifdef __APPLE__
    96         panel = new M3Panel;
    96     panel = new M3Panel;
    97 #ifdef SPARKLE_ENABLED
    97 #ifdef SPARKLE_ENABLED
    98         AutoUpdater* updater;
    98     AutoUpdater* updater;
    99         CocoaInitializer initializer;
    99     CocoaInitializer initializer;
   100         updater = new SparkleAutoUpdater(SPARKLE_APPCAST_URL);
   100     updater = new SparkleAutoUpdater(SPARKLE_APPCAST_URL);
   101     if(updater && config->isAutoUpdateEnabled())
   101     if (updater && config->isAutoUpdateEnabled())
   102             updater->checkForUpdates();
   102         updater->checkForUpdates();
   103 #endif
   103 #endif
   104 #endif
   104 #endif
   105 
   105 
   106     UpdateTeamsLists();
   106     UpdateTeamsLists();
   107     UpdateCampaignPage(0);
   107     UpdateCampaignPage(0);
   272   else {
   272   else {
   273     setWindowState(windowState() & !Qt::WindowFullScreen);
   273     setWindowState(windowState() & !Qt::WindowFullScreen);
   274   }
   274   }
   275 }
   275 }
   276 
   276 
       
   277 void HWForm::keyReleaseEvent(QKeyEvent *event)
       
   278 {
       
   279   if (event->key() == Qt::Key_Escape || event->key() == Qt::Key_Backspace)
       
   280     this->GoBack();
       
   281 }
       
   282 
   277 void HWForm::CustomizePalettes()
   283 void HWForm::CustomizePalettes()
   278 {
   284 {
   279     QList<QScrollBar *> allSBars = findChildren<QScrollBar *>();
   285     QList<QScrollBar *> allSBars = findChildren<QScrollBar *>();
   280     QPalette pal = palette();
   286     QPalette pal = palette();
   281     pal.setColor(QPalette::WindowText, QColor(0xff, 0xcc, 0x00));
   287     pal.setColor(QPalette::WindowText, QColor(0xff, 0xcc, 0x00));
   527 
   533 
   528 void HWForm::btnExitClicked()
   534 void HWForm::btnExitClicked()
   529 {
   535 {
   530     if (eggTimer.elapsed() < 3000){
   536     if (eggTimer.elapsed() < 3000){
   531 #ifdef __APPLE__
   537 #ifdef __APPLE__
   532                 panel->showInstallController();
   538         panel->showInstallController();
   533 #endif
   539 #endif
   534         close();
   540         close();
   535     }
   541     }
   536         else
   542     else
   537     {
   543     {
   538         QPushButton * btn = findChild<QPushButton *>("imageButt");
   544         QPushButton * btn = findChild<QPushButton *>("imageButt");
   539         if (btn)
   545         if (btn)
   540         {
   546         {
   541             btn->setIcon(QIcon(":/res/bonus.png"));
   547             btn->setIcon(QIcon(":/res/bonus.png"));
  1125     registry_hkcr.setValue("Hedgewars.Save/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwsfile.ico\",0");
  1131     registry_hkcr.setValue("Hedgewars.Save/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwsfile.ico\",0");
  1126     registry_hkcr.setValue("Hedgewars.Demo/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\"");
  1132     registry_hkcr.setValue("Hedgewars.Demo/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\"");
  1127     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\"");
  1133     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\"");
  1128     QMessageBox::information(0, "", QMessageBox::tr("All file associations have been set."));
  1134     QMessageBox::information(0, "", QMessageBox::tr("All file associations have been set."));
  1129 }
  1135 }
       
  1136