QTfrontend/playrecordpage.cpp
changeset 579 94db15de0392
child 580 d3ebf84e9fad
equal deleted inserted replaced
578:6b0af3860192 579:94db15de0392
       
     1 /*
       
     2  * Hedgewars, a worms-like game
       
     3  * Copyright (c) 2006, 2007 Andrey Korotaev <unC0Rr@gmail.com>
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License as published by
       
     7  * the Free Software Foundation; version 2 of the License
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
       
    17  */
       
    18 
       
    19 #include <QFont>
       
    20 #include <QGridLayout>
       
    21 #include <QPushButton>
       
    22 #include <QListWidget>
       
    23 
       
    24 #include "hwconsts.h"
       
    25 #include "playrecordpage.h"
       
    26 
       
    27 PagePlayDemo::PagePlayDemo(QWidget* parent) : QWidget(parent)
       
    28 {
       
    29 	QFont * font14 = new QFont("MS Shell Dlg", 14);
       
    30 	QGridLayout * pageLayout = new QGridLayout(this);
       
    31 	pageLayout->setColumnStretch(0, 1);
       
    32 	pageLayout->setColumnStretch(1, 2);
       
    33 	pageLayout->setColumnStretch(2, 1);
       
    34 
       
    35 	BtnBack = new QPushButton(this);
       
    36 	BtnBack->setFont(*font14);
       
    37 	BtnBack->setText(QPushButton::tr("Back"));
       
    38 	pageLayout->addWidget(BtnBack, 1, 0);
       
    39 
       
    40 	BtnPlayDemo	= new QPushButton(this);
       
    41 	BtnPlayDemo->setGeometry(QRect(240,	330, 161, 41));
       
    42 	BtnPlayDemo->setFont(*font14);
       
    43 	BtnPlayDemo->setText(QPushButton::tr("Play demo"));
       
    44 	pageLayout->addWidget(BtnPlayDemo, 1, 2);
       
    45 
       
    46 	DemosList =	new QListWidget(this);
       
    47 	DemosList->setGeometry(QRect(170, 10, 311, 311));
       
    48 	pageLayout->addWidget(DemosList, 0, 1);
       
    49 }
       
    50 
       
    51 void PagePlayDemo::FillFromDir(QDir dir)
       
    52 {
       
    53 	dir.setFilter(QDir::Files);
       
    54 	DemosList->clear();
       
    55 	DemosList->addItems(dir.entryList(QStringList("*.hwd_" + *cProtoVer))
       
    56 			.replaceInStrings(QRegExp("^(.*).hwd_" + *cProtoVer + "$"), "\\1"));
       
    57 
       
    58 }
       
    59