summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2015-01-18 09:34:29 +0100
committerJakob Gruber <[email protected]>2015-07-15 11:23:16 +0200
commitacb39a68a4a5f7474c8b191613d71898cd6d3cd8 (patch)
tree2760091b59049c39c1595664f4a2792b0326bdaa
parent3e7038dc39325976e5e5dd0ab46022986b6b86ff (diff)
Port to QDialog
-rw-r--r--src/gui/mainwindow.cpp4
-rw-r--r--src/gui/selectboardwindow.cpp30
-rw-r--r--src/gui/selectboardwindow.h4
3 files changed, 27 insertions, 11 deletions
diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp
index 04097ad..867208f 100644
--- a/src/gui/mainwindow.cpp
+++ b/src/gui/mainwindow.cpp
@@ -25,10 +25,10 @@
#include <QPushButton>
#include <kactioncollection.h>
#include <klocalizedstring.h>
-#include <kmenubar.h>
+#include <qmenubar.h>
#include <kmessagebox.h>
#include <kstandardgameaction.h>
-#include <kstatusbar.h>
+#include <qstatusbar.h>
#include <ktogglefullscreenaction.h>
#include "selectboardwindow.h"
diff --git a/src/gui/selectboardwindow.cpp b/src/gui/selectboardwindow.cpp
index 16f6c35..fd074e6 100644
--- a/src/gui/selectboardwindow.cpp
+++ b/src/gui/selectboardwindow.cpp
@@ -22,6 +22,10 @@
#include <KLocalizedString>
#include <qpushbutton.h>
#include <qalgorithms.h>
+#include <KConfigGroup>
+#include <QVBoxLayout>
+#include <QDialogButtonBox>
+
#include "src/logic/elapsedtime.h"
#include "src/logic/levelloader.h"
@@ -157,13 +161,25 @@ void LevelTableModel::sort(int column, Qt::SortOrder order) {
}
SelectBoardWindow::SelectBoardWindow(QWidget *parent)
- : KDialog(parent)
+ : QDialog(parent)
{
setModal(true);
- setCaption(i18n("Level Selection"));
-
+ setWindowTitle(i18n("Level Selection"));
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ setLayout(mainLayout);
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
+ QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
+ okButton->setDefault(true);
+ okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ mainLayout->addWidget(buttonBox);
+
+ QWidget *mainWidget = new QWidget(this);
ui = new Ui::LevelSelectUi;
- ui->setupUi(mainWidget());
+ ui->setupUi(mainWidget);
+ mainLayout->addWidget(mainWidget);
+ mainLayout->addWidget(buttonBox);
m_levels = LevelLoader::load();
m_model = QSharedPointer<LevelTableModel>(new LevelTableModel(m_levels));
@@ -188,7 +204,7 @@ SelectBoardWindow::SelectBoardWindow(QWidget *parent)
ui->tableView->resizeRowsToContents();
if (m_levels.empty()) {
- button(KDialog::Ok)->setEnabled(false);
+ okButton->setEnabled(false);
} else {
resetSelection();
connect(ui->tableView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
@@ -203,12 +219,12 @@ SelectBoardWindow::SelectBoardWindow(QWidget *parent)
void SelectBoardWindow::showEvent(QShowEvent *event) {
updateDetails(selectedBoard());
- KDialog::showEvent(event);
+ QDialog::showEvent(event);
}
void SelectBoardWindow::resizeEvent(QResizeEvent *event) {
updateDetails(selectedBoard());
- KDialog::resizeEvent(event);
+ QDialog::resizeEvent(event);
}
SelectBoardWindow::~SelectBoardWindow() {
diff --git a/src/gui/selectboardwindow.h b/src/gui/selectboardwindow.h
index 6532ca2..8e94750 100644
--- a/src/gui/selectboardwindow.h
+++ b/src/gui/selectboardwindow.h
@@ -18,7 +18,7 @@
#ifndef SELECTBOARD_H
#define SELECTBOARD_H
-#include <kdialog.h>
+#include <QDialog>
#include <QSharedPointer>
#include "ui_selectboardwindow.h"
@@ -26,7 +26,7 @@
class Level;
class LevelTableModel;
-class SelectBoardWindow : public KDialog
+class SelectBoardWindow : public QDialog
{
Q_OBJECT
public: