--- a/QTfrontend/hwform.cpp Mon Aug 20 17:49:39 2007 +0000
+++ b/QTfrontend/hwform.cpp Mon Aug 20 18:11:43 2007 +0000
@@ -156,7 +156,7 @@
QDir tmpdir;
tmpdir.cd(cfgdir->absolutePath());
tmpdir.cd("Saves");
- ui.pagePlayDemo->FillFromDir(tmpdir);
+ ui.pagePlayDemo->FillFromDir(tmpdir, "hws_" + *cProtoVer);
GoToPage(ID_PAGE_DEMOS);
}
@@ -166,7 +166,7 @@
QDir tmpdir;
tmpdir.cd(cfgdir->absolutePath());
tmpdir.cd("Demos");
- ui.pagePlayDemo->FillFromDir(tmpdir);
+ ui.pagePlayDemo->FillFromDir(tmpdir, "hwd_" + *cProtoVer);
GoToPage(ID_PAGE_DEMOS);
}
@@ -308,7 +308,7 @@
return ;
}
CreateGame(0, 0);
- game->PlayDemo(cfgdir->absolutePath() + "/Demos/" + curritem->text() + ".hwd_" + *cProtoVer);
+ game->PlayDemo(curritem->data(Qt::UserRole).toString());
}
void HWForm::NetConnectServer()
--- a/QTfrontend/playrecordpage.cpp Mon Aug 20 17:49:39 2007 +0000
+++ b/QTfrontend/playrecordpage.cpp Mon Aug 20 18:11:43 2007 +0000
@@ -48,12 +48,19 @@
pageLayout->addWidget(DemosList, 0, 1);
}
-void PagePlayDemo::FillFromDir(QDir dir)
+void PagePlayDemo::FillFromDir(QDir dir, const QString & extension)
{
dir.setFilter(QDir::Files);
+
+ QStringList sl = dir.entryList(QStringList(QString("*.%1").arg(extension)));
+ sl.replaceInStrings(QRegExp(QString("^(.*).%1$").arg(extension)), "\\1");
+
DemosList->clear();
- DemosList->addItems(dir.entryList(QStringList("*.hwd_" + *cProtoVer))
- .replaceInStrings(QRegExp("^(.*).hwd_" + *cProtoVer + "$"), "\\1"));
+ 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)));
+ }
}
--- a/QTfrontend/playrecordpage.h Mon Aug 20 17:49:39 2007 +0000
+++ b/QTfrontend/playrecordpage.h Mon Aug 20 18:11:43 2007 +0000
@@ -32,7 +32,7 @@
public:
PagePlayDemo(QWidget* parent = 0);
- void FillFromDir(QDir dir);
+ void FillFromDir(QDir dir, const QString & extension);
QPushButton *BtnBack;
QPushButton *BtnPlayDemo;