QTfrontend/hwform.cpp
changeset 2822 0533562bc3a4
parent 2821 67815ee123d7
child 2845 19db164dd20d
equal deleted inserted replaced
2821:67815ee123d7 2822:0533562bc3a4
    70 bool frontendEffects = true;
    70 bool frontendEffects = true;
    71 
    71 
    72 HWForm::HWForm(QWidget *parent)
    72 HWForm::HWForm(QWidget *parent)
    73   : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
    73   : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
    74 {
    74 {
       
    75 #ifdef USE_XFIRE
    75 	xfire_init();
    76 	xfire_init();
       
    77 #endif
    76     gameSettings = new QSettings(cfgdir->absolutePath() + "/hedgewars.ini", QSettings::IniFormat);
    78     gameSettings = new QSettings(cfgdir->absolutePath() + "/hedgewars.ini", QSettings::IniFormat);
    77     frontendEffects = gameSettings->value("video/frontendeffects", true).toBool();
    79     frontendEffects = gameSettings->value("video/frontendeffects", true).toBool();
    78 
    80 
    79 	ui.setupUi(this);
    81 	ui.setupUi(this);
    80 
    82 
   205 
   207 
   206 	PagesStack.push(ID_PAGE_MAIN);
   208 	PagesStack.push(ID_PAGE_MAIN);
   207 	GoBack();
   209 	GoBack();
   208 }
   210 }
   209 
   211 
       
   212 #ifdef USE_XFIRE
   210 void HWForm::updateXfire(void)
   213 void HWForm::updateXfire(void)
   211 {
   214 {
   212 //	xfire_setvalue(XFIRE_ROOM, "None");
       
   213 //	xfire_setvalue(XFIRE_GAMEMODE, "Multiplayer");
       
   214 //	xfire_setvalue(XFIRE_NICKNAME, ui.pageOptions->editNetNick->text().toAscii());
       
   215 //	if(!host.compare("netserver.hedgewars.org"))
       
   216 //		xfire_setvalue(XFIRE_SERVER, "Official server");
       
   217 //	else
       
   218 //		xfire_setvalue(XFIRE_SERVER, "Custom or local LAN server");
       
   219 	if(hwnet)
   215 	if(hwnet)
   220 	{
   216 	{
   221 		xfire_setvalue(XFIRE_SERVER, !hwnet->getHost().compare("netserver.hedgewars.org:46631") ? "Official server" : hwnet->getHost().toAscii());
   217 		xfire_setvalue(XFIRE_SERVER, !hwnet->getHost().compare("netserver.hedgewars.org:46631") ? "Official server" : hwnet->getHost().toAscii());
   222 		switch(hwnet->getClientState())
   218 		switch(hwnet->getClientState())
   223 		{
   219 		{
   251 		xfire_setvalue(XFIRE_ROOM, "-");
   247 		xfire_setvalue(XFIRE_ROOM, "-");
   252 		xfire_setvalue(XFIRE_SERVER, "-");
   248 		xfire_setvalue(XFIRE_SERVER, "-");
   253 	}
   249 	}
   254 	xfire_update();
   250 	xfire_update();
   255 }
   251 }
       
   252 #endif
   256 
   253 
   257 void HWForm::onFrontendFullscreen(bool value)
   254 void HWForm::onFrontendFullscreen(bool value)
   258 {
   255 {
   259   if (value)
   256   if (value)
   260     setWindowState(windowState() | Qt::WindowFullScreen);
   257     setWindowState(windowState() | Qt::WindowFullScreen);
   406 	GoToPage(ID_PAGE_ADMIN);
   403 	GoToPage(ID_PAGE_ADMIN);
   407 }
   404 }
   408 
   405 
   409 void HWForm::OnPageShown(quint8 id, quint8 lastid)
   406 void HWForm::OnPageShown(quint8 id, quint8 lastid)
   410 {
   407 {
       
   408 #ifdef USE_XFIRE
   411 	updateXfire();
   409 	updateXfire();
       
   410 #endif
   412 	if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETGAME) {
   411 	if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETGAME) {
   413 		QStringList tmNames = config->GetTeamsList();
   412 		QStringList tmNames = config->GetTeamsList();
   414 		TeamSelWidget* curTeamSelWidget;
   413 		TeamSelWidget* curTeamSelWidget;
   415 
   414 
   416 		if(id == ID_PAGE_MULTIPLAYER) {
   415 		if(id == ID_PAGE_MULTIPLAYER) {
   939 	game->StartNet();
   938 	game->StartNet();
   940 }
   939 }
   941 
   940 
   942 void HWForm::closeEvent(QCloseEvent *event)
   941 void HWForm::closeEvent(QCloseEvent *event)
   943 {
   942 {
       
   943 #ifdef USE_XFIRE
   944 	xfire_free();
   944 	xfire_free();
       
   945 #endif
   945 	config->SaveOptions();
   946 	config->SaveOptions();
   946 	event->accept();
   947 	event->accept();
   947 }
   948 }
   948 
   949 
   949 void HWForm::Music(bool checked)
   950 void HWForm::Music(bool checked)