Add an option to name records with current date and time
authorunc0rr
Sun, 09 Nov 2008 09:47:10 +0000
changeset 1487 b4cc59a6d50a
parent 1486 8fcc64446a97
child 1488 b9445e9159c9
Add an option to name records with current date and time
QTfrontend/gameuiconfig.cpp
QTfrontend/gameuiconfig.h
QTfrontend/hwform.cpp
QTfrontend/pages.cpp
QTfrontend/pages.h
--- a/QTfrontend/gameuiconfig.cpp	Sun Nov 09 07:58:56 2008 +0000
+++ b/QTfrontend/gameuiconfig.cpp	Sun Nov 09 09:47:10 2008 +0000
@@ -60,6 +60,7 @@
 	Form->ui.pageOptions->fpsedit->setValue(value("fps/interval", 27).toUInt());
 
 	Form->ui.pageOptions->CBAltDamage->setChecked(value("misc/altdamage", false).toBool());
+	Form->ui.pageOptions->CBNameWithDate->setChecked(value("misc/appendTimeToRecords", false).toBool());
 
 	depth = QApplication::desktop()->depth();
 	if (depth < 16) depth = 16;
@@ -109,6 +110,7 @@
 	setValue("fps/interval", Form->ui.pageOptions->fpsedit->value());
 
 	setValue("misc/altdamage", isAltDamageEnabled());
+	setValue("misc/appendTimeToRecords", appendDateTimeToRecordName());
 }
 
 QRect GameUIConfig::vid_Resolution()
@@ -150,7 +152,12 @@
 
 bool GameUIConfig::isAltDamageEnabled()
 {
-	return Form->ui.pageOptions->CBAltDamage->isChecked();;
+	return Form->ui.pageOptions->CBAltDamage->isChecked();
+}
+
+bool GameUIConfig::appendDateTimeToRecordName()
+{
+	return Form->ui.pageOptions->CBNameWithDate->isChecked();
 }
 
 quint8 GameUIConfig::timerInterval()
--- a/QTfrontend/gameuiconfig.h	Sun Nov 09 07:58:56 2008 +0000
+++ b/QTfrontend/gameuiconfig.h	Sun Nov 09 09:47:10 2008 +0000
@@ -39,6 +39,7 @@
 	bool isMusicEnabled();
 	bool isShowFPSEnabled();
 	bool isAltDamageEnabled();
+	bool appendDateTimeToRecordName();
 	quint8 timerInterval();
 	quint8 bitDepth();
 	QString netNick();
--- a/QTfrontend/hwform.cpp	Sun Nov 09 07:58:56 2008 +0000
+++ b/QTfrontend/hwform.cpp	Sun Nov 09 09:47:10 2008 +0000
@@ -697,17 +697,22 @@
 {
 	QString filename;
 	QByteArray demo = record;
+	QString recordFileName =
+			config->appendDateTimeToRecordName() ?
+				QDateTime::currentDateTime().toString(Qt::ISODate)
+				"LastRound";
+
 	if (isDemo)
 	{
 		demo.replace(QByteArray("\x02TL"), QByteArray("\x02TD"));
 		demo.replace(QByteArray("\x02TN"), QByteArray("\x02TD"));
 		demo.replace(QByteArray("\x02TS"), QByteArray("\x02TD"));
-		filename = cfgdir->absolutePath() + "/Demos/LastRound.hwd_" + *cProtoVer;
+		filename = cfgdir->absolutePath() + "/Demos/" + recordFileName + ".hwd_" + *cProtoVer;
 	} else
 	{
 		demo.replace(QByteArray("\x02TL"), QByteArray("\x02TS"));
 		demo.replace(QByteArray("\x02TN"), QByteArray("\x02TS"));
-		filename = cfgdir->absolutePath() + "/Saves/LastRound.hws_" + *cProtoVer;
+		filename = cfgdir->absolutePath() + "/Saves/" + recordFileName + ".hws_" + *cProtoVer;
 	}
 
 
--- a/QTfrontend/pages.cpp	Sun Nov 09 07:58:56 2008 +0000
+++ b/QTfrontend/pages.cpp	Sun Nov 09 09:47:10 2008 +0000
@@ -370,6 +370,10 @@
 	CBAltDamage->setText(QCheckBox::tr("Alternative damage show"));
 	GBAlayout->addWidget(CBAltDamage);
 
+	CBNameWithDate = new QCheckBox(AGGroupBox);
+	CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name"));
+	GBAlayout->addWidget(CBNameWithDate);
+
 	fpsedit = new FPSEdit(AGGroupBox);
 	GBAfpslayout->addWidget(fpsedit);
 
--- a/QTfrontend/pages.h	Sun Nov 09 07:58:56 2008 +0000
+++ b/QTfrontend/pages.h	Sun Nov 09 09:47:10 2008 +0000
@@ -205,6 +205,7 @@
 	QCheckBox *CBFrontendFullscreen;
 	QCheckBox *CBShowFPS;
 	QCheckBox *CBAltDamage;
+	QCheckBox *CBNameWithDate;
 	FPSEdit *fpsedit;
 	QPushButton *BtnSaveOptions;
 	QLabel *labelNN;