</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QLabel" name="startTitle">
+ <widget class="QLabel" name="title">
<property name="font">
<font>
<family>Sans Serif</family>
</font>
</property>
<property name="text">
- <string/>
+ <string>Choose a level collection:</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
return;
}
+ if (flowDir == DirPassed) {
+ flowTimer.stop();
+ emit levelPassed(flowScore);
+ }
+
if (flowDir == DirNone) {
// This square contained no pipe or an incompatible pipe. Get
// some more time, so that the user sees the failure before we
flowScore += 10;
if (flowDir == DirDone) {
+ // Again, give the user some time...
if (flowPreplaced < neededFlow) {
flowDir = DirFailed;
// TODO: indicate which pipes were missing
- flowTimer.setInterval(1000);
- }
- else {
- flowTimer.stop();
- emit levelPassed(flowScore);
}
+ else
+ flowDir = DirPassed;
+
+ flowTimer.setInterval(1000);
return;
}
void LevelSwitcher::chooseLevelCollection()
{
levelList->clear();
+ bool first = true;
foreach (const QString& collection, levelCollections) {
QListWidgetItem *newItem = new QListWidgetItem();
newItem->setText(collection);
levelList->addItem(newItem); // transfers ownership
+ if (first) {
+ levelList->setCurrentItem(newItem);
+ first = false;
+ }
}
levelWidget->show();
}
QString introText = gameData.readLine();
introText.replace("IMGDIR", IMGDIR);
+
+ // The start button might be connected to "chooseLevelCollection"
+ startButton->disconnect();
+ connect(startButton, SIGNAL(clicked()), this, SLOT(onStartClicked()));
startLabel->setText(introText);
startWidget->show();
}
else {
startTitle->setText(QString("All levels passed. Score: ") + QString::number(score));
startLabel->setText("Start a new game?");
- // TODO: go to the level set selection screen
+ startButton->disconnect();
+ connect(startButton, SIGNAL(clicked()), this, SLOT(chooseLevelCollection()));
level = 0;
startWidget->show();
}