- Use current screen color depth in engine
authorunc0rr
Fri, 21 Sep 2007 19:18:06 +0000
changeset 603 d7877468653b
parent 602 f7628ebfccde
child 604 2f1165467a66
- Use current screen color depth in engine - Fix regexps
QTfrontend/game.cpp
QTfrontend/gameuiconfig.cpp
QTfrontend/gameuiconfig.h
QTfrontend/pages.cpp
QTfrontend/playrecordpage.cpp
--- a/QTfrontend/game.cpp	Fri Sep 21 18:55:44 2007 +0000
+++ b/QTfrontend/game.cpp	Fri Sep 21 19:18:06 2007 +0000
@@ -252,7 +252,7 @@
 	arguments << cfgdir->absolutePath();
 	arguments << QString::number(resolution.width());
 	arguments << QString::number(resolution.height());
-	arguments << "32"; // bpp
+	arguments << QString::number(config->bitDepth()); // bpp
 	arguments << QString("%1").arg(ipc_port);
 	arguments << (config->vid_Fullscreen() ? "1" : "0");
 	arguments << (config->isSoundEnabled() ? "1" : "0");
--- a/QTfrontend/gameuiconfig.cpp	Fri Sep 21 18:55:44 2007 +0000
+++ b/QTfrontend/gameuiconfig.cpp	Fri Sep 21 19:18:06 2007 +0000
@@ -19,6 +19,7 @@
 #include <QMessageBox>
 #include <QCheckBox>
 #include <QLineEdit>
+#include <QDesktopWidget>
 
 #include "gameuiconfig.h"
 #include "hwform.h"
@@ -44,6 +45,11 @@
 	Form->ui.pageOptions->fpsedit->setValue(value("fps/interval", 27).toUInt());
 
 	Form->ui.pageOptions->CBAltDamage->setChecked(value("misc/altdamage", false).toBool());
+
+	QDesktopWidget desktop;
+	depth = desktop.depth();
+	if (depth < 16) depth = 16;
+	else if (depth > 16) depth = 32;
 }
 
 QStringList GameUIConfig::GetTeamsList()
@@ -51,7 +57,7 @@
 	QStringList teamslist = cfgdir->entryList(QStringList("*.cfg"));
 	QStringList cleanedList;
 	for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
-	  QString tmpTeamStr=(*it).replace(QRegExp("^(.*).cfg$"), "\\1");
+	  QString tmpTeamStr=(*it).replace(QRegExp("^(.*)\\.cfg$"), "\\1");
 	  cleanedList.push_back(tmpTeamStr);
 	}
 	return cleanedList;
@@ -109,3 +115,8 @@
 {
 	return 35 - Form->ui.pageOptions->fpsedit->value();
 }
+
+quint8 GameUIConfig::bitDepth()
+{
+	return depth;
+}
--- a/QTfrontend/gameuiconfig.h	Fri Sep 21 18:55:44 2007 +0000
+++ b/QTfrontend/gameuiconfig.h	Fri Sep 21 19:18:06 2007 +0000
@@ -39,14 +39,14 @@
 	bool isShowFPSEnabled();
 	bool isAltDamageEnabled();
 	quint8 timerInterval();
-
-private slots:
+	quint8 bitDepth();
 
 public slots:
 	void SaveOptions();
 
 private:
 	HWForm * Form;
+	quint8 depth;
 };
 
 #endif
--- a/QTfrontend/pages.cpp	Fri Sep 21 18:55:44 2007 +0000
+++ b/QTfrontend/pages.cpp	Fri Sep 21 19:18:06 2007 +0000
@@ -261,12 +261,12 @@
 	tmpdir.cd("Forts");
 	tmpdir.setFilter(QDir::Files);
 
-	CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L.png"), "\\1"));
+	CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1"));
 	tmpdir.cd("../Graphics/Graves");
 	QStringList list = tmpdir.entryList(QStringList("*.png"));
 	for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
 	{
-		CBGrave->addItem((*it).replace(QRegExp("^(.*).png"), "\\1"));
+		CBGrave->addItem((*it).replace(QRegExp("^(.*)\\.png"), "\\1"));
 	}
 
 	connect(CBGrave, SIGNAL(activated(const QString &)), this, SLOT(CBGrave_activated(const QString &)));
--- a/QTfrontend/playrecordpage.cpp	Fri Sep 21 18:55:44 2007 +0000
+++ b/QTfrontend/playrecordpage.cpp	Fri Sep 21 19:18:06 2007 +0000
@@ -68,7 +68,7 @@
 	dir.setFilter(QDir::Files);
 
 	QStringList sl = dir.entryList(QStringList(QString("*.%1").arg(extension)));
-	sl.replaceInStrings(QRegExp(QString("^(.*).%1$").arg(extension)), "\\1");
+	sl.replaceInStrings(QRegExp(QString("^(.*)\\.%1$").arg(extension)), "\\1");
 
 	DemosList->clear();
 	DemosList->addItems(sl);