QTfrontend/playrecordpage.cpp
changeset 581 909141b17f68
parent 580 d3ebf84e9fad
child 603 d7877468653b
equal deleted inserted replaced
580:d3ebf84e9fad 581:909141b17f68
    46 	DemosList =	new QListWidget(this);
    46 	DemosList =	new QListWidget(this);
    47 	DemosList->setGeometry(QRect(170, 10, 311, 311));
    47 	DemosList->setGeometry(QRect(170, 10, 311, 311));
    48 	pageLayout->addWidget(DemosList, 0, 1);
    48 	pageLayout->addWidget(DemosList, 0, 1);
    49 }
    49 }
    50 
    50 
    51 void PagePlayDemo::FillFromDir(QDir dir, const QString & extension)
    51 void PagePlayDemo::FillFromDir(RecordType rectype)
    52 {
    52 {
       
    53 	QDir dir;
       
    54 	QString extension;
       
    55 
       
    56 	dir.cd(cfgdir->absolutePath());
       
    57 	if (rectype == RT_Demo)
       
    58 	{
       
    59 		dir.cd("Demos");
       
    60 		extension = "hwd_" + *cProtoVer;
       
    61 		BtnPlayDemo->setText(QPushButton::tr("Play demo"));
       
    62 	} else
       
    63 	{
       
    64 		dir.cd("Saves");
       
    65 		extension = "hws_" + *cProtoVer;
       
    66 		BtnPlayDemo->setText(QPushButton::tr("Load"));
       
    67 	}
    53 	dir.setFilter(QDir::Files);
    68 	dir.setFilter(QDir::Files);
    54 
    69 
    55 	QStringList sl = dir.entryList(QStringList(QString("*.%1").arg(extension)));
    70 	QStringList sl = dir.entryList(QStringList(QString("*.%1").arg(extension)));
    56 	sl.replaceInStrings(QRegExp(QString("^(.*).%1$").arg(extension)), "\\1");
    71 	sl.replaceInStrings(QRegExp(QString("^(.*).%1$").arg(extension)), "\\1");
    57 
    72