QTfrontend/playrecordpage.cpp
changeset 2742 21c0d2e69753
parent 2631 163b0128bd21
child 2948 3f21a9dc93d0
--- a/QTfrontend/playrecordpage.cpp	Wed Feb 03 04:18:28 2010 +0000
+++ b/QTfrontend/playrecordpage.cpp	Wed Feb 03 13:02:28 2010 +0000
@@ -71,25 +71,26 @@
 	if (rectype == RT_Demo)
 	{
 		dir.cd("Demos");
-		extension = "hwd_" + *cProtoVer;
+		extension = "hwd";
 		BtnPlayDemo->setText(QPushButton::tr("Play demo"));
 	} else
 	{
 		dir.cd("Saves");
-		extension = "hws_" + *cProtoVer;
+		extension = "hws";
 		BtnPlayDemo->setText(QPushButton::tr("Load"));
 	}
 	dir.setFilter(QDir::Files);
 
-	QStringList sl = dir.entryList(QStringList(QString("*.%1").arg(extension)));
-	sl.replaceInStrings(QRegExp(QString("^(.*)\\.%1$").arg(extension)), "\\1");
+	QStringList sl = dir.entryList(QStringList(QString("*.%2.%1").arg(extension, *cProtoVer)));
+	sl.replaceInStrings(QRegExp(QString("^(.*)\\.%2\\.%1$").arg(extension, *cProtoVer)), "\\1");
 
 	DemosList->clear();
 	DemosList->addItems(sl);
 
 	for (int i = 0; i < DemosList->count(); ++i)
 	{
-		DemosList->item(i)->setData(Qt::UserRole, dir.absoluteFilePath(QString("%1.%2").arg(sl[i], extension)));
+		DemosList->item(i)->setData(Qt::UserRole, dir.absoluteFilePath(QString("%1.%3.%2").arg(sl[i], extension, *cProtoVer)));
+		DemosList->item(i)->setIcon(recType == RT_Demo ? QIcon(":/res/file_demo.png") : QIcon(":/res/file_save.png"));
 	}
 }
 
@@ -110,13 +111,14 @@
 
 	bool ok;
 
-	QString newname = QInputDialog::getText(this, tr("Rename dialog"), tr("Enter new file name:"), QLineEdit::Normal, finfo.completeBaseName(), &ok);
+	QString newname = QInputDialog::getText(this, tr("Rename dialog"), tr("Enter new file name:"), QLineEdit::Normal, finfo.completeBaseName().replace("." + *cProtoVer, ""), &ok);
 
 	if(ok && newname.size())
 	{
-		QString newfullname = QString("%1/%2.%3")
+		QString newfullname = QString("%1/%2.%3.%4")
 		                              .arg(finfo.absolutePath())
 		                              .arg(newname)
+									  .arg(*cProtoVer)
 		                              .arg(finfo.suffix());
 
 		ok = rfile.rename(newfullname);
@@ -140,8 +142,6 @@
 	}
 	QFile rfile(curritem->data(Qt::UserRole).toString());
 
-	QFileInfo finfo(rfile);
-
 	bool ok;
 
 	ok = rfile.remove();