QTfrontend/hwform.cpp
changeset 5252 ded882439548
parent 5238 46ddaf14509d
child 5255 947025eeb5dc
equal deleted inserted replaced
5251:f31d1073345e 5252:ded882439548
   180     connect(ui.pageOptions->BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam()));
   180     connect(ui.pageOptions->BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam()));
   181     connect(ui.pageOptions->BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam()));
   181     connect(ui.pageOptions->BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam()));
   182     connect(ui.pageOptions->BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(DeleteTeam()));
   182     connect(ui.pageOptions->BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(DeleteTeam()));
   183     connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), config, SLOT(SaveOptions()));
   183     connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), config, SLOT(SaveOptions()));
   184     connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), this, SLOT(GoBack()));
   184     connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), this, SLOT(GoBack()));
   185 #ifndef __APPLE__
       
   186     connect(ui.pageOptions->BtnAssociateFiles, SIGNAL(clicked()), this, SLOT(AssociateFiles()));
   185     connect(ui.pageOptions->BtnAssociateFiles, SIGNAL(clicked()), this, SLOT(AssociateFiles()));
   187 #endif
       
   188 
   186 
   189     connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon()));
   187     connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon()));
   190     connect(ui.pageOptions->WeaponNew, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon()));
   188     connect(ui.pageOptions->WeaponNew, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon()));
   191     connect(ui.pageOptions->WeaponDelete, SIGNAL(clicked()), this, SLOT(DeleteWeaponSet()));
   189     connect(ui.pageOptions->WeaponDelete, SIGNAL(clicked()), this, SLOT(DeleteWeaponSet()));
   192     connect(ui.pageOptions->SchemeEdit, SIGNAL(clicked()), this, SLOT(GoToEditScheme()));
   190     connect(ui.pageOptions->SchemeEdit, SIGNAL(clicked()), this, SLOT(GoToEditScheme()));
   711     {
   709     {
   712         QMessageBox::critical(this,
   710         QMessageBox::critical(this,
   713                 tr("Error"),
   711                 tr("Error"),
   714                 tr("Please select record from the list above"),
   712                 tr("Please select record from the list above"),
   715                 tr("OK"));
   713                 tr("OK"));
   716         return ;
   714         return;
   717     }
   715     }
   718     CreateGame(0, 0, 0);
   716     CreateGame(0, 0, 0);
   719     game->PlayDemo(curritem->data(Qt::UserRole).toString());
   717     game->PlayDemo(curritem->data(Qt::UserRole).toString());
       
   718 }
       
   719 
       
   720 void HWForm::PlayDemoQuick(const QString & demofilename)
       
   721 {
       
   722     CreateGame(0, 0, 0);
       
   723     game->PlayDemo(demofilename);
   720 }
   724 }
   721 
   725 
   722 void HWForm::NetConnectServer(const QString & host, quint16 port)
   726 void HWForm::NetConnectServer(const QString & host, quint16 port)
   723 {
   727 {
   724     _NetConnect(host, port, ui.pageOptions->editNetNick->text().trimmed());
   728     _NetConnect(host, port, ui.pageOptions->editNetNick->text().trimmed());
  1251     registry_hkcr.setValue("Hedgewars.Demo/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwdfile.ico\",0");
  1255     registry_hkcr.setValue("Hedgewars.Demo/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwdfile.ico\",0");
  1252     registry_hkcr.setValue("Hedgewars.Save/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwsfile.ico\",0");
  1256     registry_hkcr.setValue("Hedgewars.Save/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwsfile.ico\",0");
  1253     registry_hkcr.setValue("Hedgewars.Demo/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + cfgdir->absolutePath().replace("/","\\") + "\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\" --set-everything "+arguments);
  1257     registry_hkcr.setValue("Hedgewars.Demo/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + cfgdir->absolutePath().replace("/","\\") + "\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\" --set-everything "+arguments);
  1254     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + cfgdir->absolutePath().replace("/","\\") + "\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\" --set-everything "+arguments);
  1258     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + cfgdir->absolutePath().replace("/","\\") + "\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\" --set-everything "+arguments);
  1255 #elif defined __APPLE__
  1259 #elif defined __APPLE__
  1256     success = false;
  1260     // only useful when other apps have taken precedence over our file extensions and you want to reset it
  1257     // TODO; also enable button in pages.cpp and signal in hwform.cpp
  1261     system("defaults write com.apple.LaunchServices LSHandlers -array-add '<dict><key>LSHandlerContentTag</key><string>hwd</string><key>LSHandlerContentTagClass</key><string>public.filename-extension</string><key>LSHandlerRoleAll</key><string>org.hedgewars.desktop</string></dict>'");
       
  1262     system("defaults write com.apple.LaunchServices LSHandlers -array-add '<dict><key>LSHandlerContentTag</key><string>hws</string><key>LSHandlerContentTagClass</key><string>public.filename-extension</string><key>LSHandlerRoleAll</key><string>org.hedgewars.desktop</string></dict>'");
       
  1263     system("/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -domain local -domain system -domain user");
  1258 #else
  1264 #else
  1259     // this is a little silly due to all the system commands below anyway - just use mkdir -p ?  Does have the advantage of the alert I guess
  1265     // this is a little silly due to all the system commands below anyway - just use mkdir -p ?  Does have the advantage of the alert I guess
  1260     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local");
  1266     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local");
  1261     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share");
  1267     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share");
  1262     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/mime");
  1268     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/mime");