QTfrontend/gameuiconfig.cpp
changeset 127 ca70467bd0a8
parent 111 30ca06092a64
child 140 50ccde437ea1
equal deleted inserted replaced
126:93df479aa1b9 127:ca70467bd0a8
    75 				Form->ui.pageNet->editIP->setText(str.mid(3));
    75 				Form->ui.pageNet->editIP->setText(str.mid(3));
    76 			}
    76 			}
    77 		}
    77 		}
    78 		settings.close();
    78 		settings.close();
    79 	}
    79 	}
       
    80 
       
    81 	QFile themesfile(datadir->absolutePath() + "/Themes/themes.cfg");
       
    82 	if (themesfile.open(QIODevice::ReadOnly)) {
       
    83 		QTextStream stream(&themesfile);
       
    84 		QString str;
       
    85 		while (!stream.atEnd())
       
    86 		{
       
    87 			Themes << stream.readLine();
       
    88 		}
       
    89 		themesfile.close();
       
    90 	} else {
       
    91 		QMessageBox::critical(0, "Error", "Cannot access themes.cfg", "OK");
       
    92 	}
    80 }
    93 }
    81 
    94 
    82 QStringList GameUIConfig::GetTeamsList()
    95 QStringList GameUIConfig::GetTeamsList()
    83 {
    96 {
    84 	return cfgdir->entryList(QStringList("*.cfg"));
    97 	return cfgdir->entryList(QStringList("*.cfg"));
   118 
   131 
   119 bool GameUIConfig::isSoundEnabled()
   132 bool GameUIConfig::isSoundEnabled()
   120 {
   133 {
   121 	return Form->ui.pageOptions->CBEnableSound->isChecked();
   134 	return Form->ui.pageOptions->CBEnableSound->isChecked();
   122 }
   135 }
       
   136 
       
   137 QString GameUIConfig::GetRandomTheme()
       
   138 {
       
   139 	return (Themes.size() > 0) ? Themes[rand() % Themes.size()] : QString("steel");
       
   140 }