QTfrontend/gameuiconfig.cpp
changeset 127 ca70467bd0a8
parent 111 30ca06092a64
child 140 50ccde437ea1
--- a/QTfrontend/gameuiconfig.cpp	Sun Aug 27 12:41:27 2006 +0000
+++ b/QTfrontend/gameuiconfig.cpp	Sun Aug 27 13:16:40 2006 +0000
@@ -77,6 +77,19 @@
 		}
 		settings.close();
 	}
+
+	QFile themesfile(datadir->absolutePath() + "/Themes/themes.cfg");
+	if (themesfile.open(QIODevice::ReadOnly)) {
+		QTextStream stream(&themesfile);
+		QString str;
+		while (!stream.atEnd())
+		{
+			Themes << stream.readLine();
+		}
+		themesfile.close();
+	} else {
+		QMessageBox::critical(0, "Error", "Cannot access themes.cfg", "OK");
+	}
 }
 
 QStringList GameUIConfig::GetTeamsList()
@@ -120,3 +133,8 @@
 {
 	return Form->ui.pageOptions->CBEnableSound->isChecked();
 }
+
+QString GameUIConfig::GetRandomTheme()
+{
+	return (Themes.size() > 0) ? Themes[rand() % Themes.size()] : QString("steel");
+}