38 pageLayout->setColumnStretch(0, 1); |
38 pageLayout->setColumnStretch(0, 1); |
39 pageLayout->setColumnStretch(1, 2); |
39 pageLayout->setColumnStretch(1, 2); |
40 pageLayout->setColumnStretch(2, 1); |
40 pageLayout->setColumnStretch(2, 1); |
41 pageLayout->setRowStretch(2, 100); |
41 pageLayout->setRowStretch(2, 100); |
42 |
42 |
43 BtnPlayDemo = new QPushButton(this); |
|
44 BtnPlayDemo->setFont(*font14); |
|
45 BtnPlayDemo->setText(QPushButton::tr("Play demo")); |
|
46 pageLayout->addWidget(BtnPlayDemo, 3, 2); |
|
47 |
|
48 BtnRenameRecord = new QPushButton(this); |
43 BtnRenameRecord = new QPushButton(this); |
49 BtnRenameRecord->setText(QPushButton::tr("Rename")); |
44 BtnRenameRecord->setText(QPushButton::tr("Rename")); |
50 pageLayout->addWidget(BtnRenameRecord, 0, 2); |
45 pageLayout->addWidget(BtnRenameRecord, 0, 2); |
51 |
46 |
52 BtnRemoveRecord = new QPushButton(this); |
47 BtnRemoveRecord = new QPushButton(this); |
58 pageLayout->addWidget(DemosList, 0, 1, 3, 1); |
53 pageLayout->addWidget(DemosList, 0, 1, 3, 1); |
59 |
54 |
60 return pageLayout; |
55 return pageLayout; |
61 } |
56 } |
62 |
57 |
|
58 QLayout * PagePlayDemo::footerLayoutDefinition() |
|
59 { |
|
60 QHBoxLayout * bottomLayout = new QHBoxLayout(); |
|
61 |
|
62 BtnPlayDemo = addButton(tr("Play demo"), bottomLayout, 0, false, Qt::AlignBottom); |
|
63 const QIcon& lp = QIcon(":/res/Start.png"); |
|
64 QSize sz = lp.actualSize(QSize(65535, 65535)); |
|
65 BtnPlayDemo->setMinimumWidth(sz.width()); |
|
66 BtnPlayDemo->setIcon(lp); |
|
67 BtnPlayDemo->setFixedHeight(50); |
|
68 BtnPlayDemo->setIconSize(sz); |
|
69 BtnPlayDemo->setFlat(true); |
|
70 BtnPlayDemo->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); |
|
71 |
|
72 return bottomLayout; |
|
73 } |
|
74 |
63 void PagePlayDemo::connectSignals() |
75 void PagePlayDemo::connectSignals() |
64 { |
76 { |
65 connect(BtnRenameRecord, SIGNAL(clicked()), this, SLOT(renameRecord())); |
77 connect(BtnRenameRecord, SIGNAL(clicked()), this, SLOT(renameRecord())); |
66 connect(BtnRemoveRecord, SIGNAL(clicked()), this, SLOT(removeRecord())); |
78 connect(BtnRemoveRecord, SIGNAL(clicked()), this, SLOT(removeRecord())); |
67 connect(&DataManager::instance(), SIGNAL(updated()), this, SLOT(refresh())); |
79 connect(&DataManager::instance(), SIGNAL(updated()), this, SLOT(refresh())); |
83 if (rectype == RT_Demo) |
95 if (rectype == RT_Demo) |
84 { |
96 { |
85 dir.cd("Demos"); |
97 dir.cd("Demos"); |
86 extension = "hwd"; |
98 extension = "hwd"; |
87 BtnPlayDemo->setText(QPushButton::tr("Play demo")); |
99 BtnPlayDemo->setText(QPushButton::tr("Play demo")); |
|
100 BtnPlayDemo->setWhatsThis(tr("Play the selected demo")); |
88 } |
101 } |
89 else |
102 else |
90 { |
103 { |
91 dir.cd("Saves"); |
104 dir.cd("Saves"); |
92 extension = "hws"; |
105 extension = "hws"; |
93 BtnPlayDemo->setText(QPushButton::tr("Load")); |
106 BtnPlayDemo->setText(QPushButton::tr("Load")); |
|
107 BtnPlayDemo->setWhatsThis(tr("Load the selected game")); |
94 } |
108 } |
95 dir.setFilter(QDir::Files); |
109 dir.setFilter(QDir::Files); |
96 |
110 |
97 QStringList sl = dir.entryList(QStringList(QString("*.%2.%1").arg(extension, *cProtoVer))); |
111 QStringList sl = dir.entryList(QStringList(QString("*.%2.%1").arg(extension, *cProtoVer))); |
98 sl.replaceInStrings(QRegExp(QString("^(.*)\\.%2\\.%1$").arg(extension, *cProtoVer)), "\\1"); |
112 sl.replaceInStrings(QRegExp(QString("^(.*)\\.%2\\.%1$").arg(extension, *cProtoVer)), "\\1"); |