summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNemanja Hirsl <[email protected]>2015-03-15 17:51:46 +0100
committerNemanja Hirsl <[email protected]>2015-03-15 17:51:46 +0100
commitdf5971aff780c03358831a62c46b8eb69e374470 (patch)
treef45849d316638fb945e9effab0a146c96b7c0370
parent6f0decb7772d98b7e223c6c79b8987270a1fc5bd (diff)
Replace KDialog with QDialog (frameworks)
REVIEW:122963
-rw-r--r--ksirk/Dialogs/InvasionSlider.cpp21
-rw-r--r--ksirk/Dialogs/InvasionSlider.h4
-rw-r--r--ksirk/kgamewin.cpp11
-rw-r--r--ksirk/kgamewin.h4
-rw-r--r--ksirkskineditor/mainwindow.cpp1
-rw-r--r--ksirkskineditor/mainwindow.h1
6 files changed, 24 insertions, 18 deletions
diff --git a/ksirk/Dialogs/InvasionSlider.cpp b/ksirk/Dialogs/InvasionSlider.cpp
index f15dfbd..041992f 100644
--- a/ksirk/Dialogs/InvasionSlider.cpp
+++ b/ksirk/Dialogs/InvasionSlider.cpp
@@ -80,7 +80,7 @@
#include <KToolBar>
#include <QAction>
#include <QSvgRenderer>
-#include <KDialog>
+#include <QDialog>
#include <KAboutData>
#include <sys/utsname.h>
@@ -104,13 +104,16 @@ InvasionSlider::InvasionSlider(KGameWindow* game, GameLogic::Country * attack, G
m_nbLArmies = new QLabel(QString::number(m_nbLArmy));
m_nbRArmies = new QLabel(QString::number(m_nbRArmy));
+ QVBoxLayout* dialogLayout = new QVBoxLayout(this);
+ QDialogButtonBox* buttonBox = NULL;
+
if (invasionType == Invasion)
{
- setButtons( KDialog::Ok );
+ buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
}
else if (invasionType == Moving)
{
- setButtons( KDialog::Cancel | KDialog::Ok );
+ buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
}
QWidget* widget = new QWidget(this);
@@ -171,15 +174,17 @@ InvasionSlider::InvasionSlider(KGameWindow* game, GameLogic::Country * attack, G
//val->setText(QString::number(invadeSlide->value()));
connect(m_invadeSlide,SIGNAL(valueChanged(int)),this,SLOT(slideMove(int)));
connect(m_invadeSlide,SIGNAL(sliderReleased()),this,SLOT(slideReleased()));
- connect(this,SIGNAL(okClicked()),this,SLOT(slideClose()));
+ connect(buttonBox,SIGNAL(accepted()),this,SLOT(slideClose()));
if (invasionType == Moving)
{
- connect(this,SIGNAL(cancelClicked()),this,SLOT(slideCancel()));
+ connect(buttonBox,SIGNAL(rejected()),this,SLOT(slideCancel()));
}
- setMainWidget(widget);
-
widget->setLayout(wSlideLayout);
+
+ dialogLayout->addWidget(widget);
+ if (buttonBox)
+ dialogLayout->addWidget(buttonBox);
setWindowModality(Qt::ApplicationModal);
}
@@ -215,11 +220,13 @@ void InvasionSlider::slideClose()
m_game->automaton()->currentPlayerPlayed(true);
QPointF point;
m_game->automaton()->gameEvent("actionNextPlayer", point);
+ accept();
}
void InvasionSlider::slideCancel()
{
kDebug() << "Move cancel";
+ reject();
}
} // closing namespace Ksirk
diff --git a/ksirk/Dialogs/InvasionSlider.h b/ksirk/Dialogs/InvasionSlider.h
index 11646e3..e9f941b 100644
--- a/ksirk/Dialogs/InvasionSlider.h
+++ b/ksirk/Dialogs/InvasionSlider.h
@@ -19,7 +19,7 @@
#ifndef INVASIONSLIDER_H
#define INVASIONSLIDER_H
-#include <KDialog>
+#include <QDialog>
class QLabel;
class QSlider;
@@ -37,7 +37,7 @@ namespace GameLogic
* @author Gael de Chalendar (aka Kleag)
* @version $Id: kgamewin.h 243 2007-02-24 00:22:58Z kleag $
*/
-class InvasionSlider: public KDialog
+class InvasionSlider: public QDialog
{
Q_OBJECT
diff --git a/ksirk/kgamewin.cpp b/ksirk/kgamewin.cpp
index a86d344..50795e0 100644
--- a/ksirk/kgamewin.cpp
+++ b/ksirk/kgamewin.cpp
@@ -83,7 +83,8 @@
#include <KToolBar>
#include <QAction>
#include <QSvgRenderer>
-#include <KDialog>
+#include <QDialog>
+#include <QVBoxLayout>
#include <KAboutData>
#include <QIcon>
#define USE_UNSTABLE_LIBKDEGAMESPRIVATE_API
@@ -1230,12 +1231,11 @@ void KGameWindow::createDefenseDialog()
{
kDebug();
// Create Window Dialog
- m_defenseDialog = new KDialog ();
- m_defenseDialog->setButtons( KDialog::None );
+ m_defenseDialog = new QDialog ();
QWidget* widget = new QWidget(m_defenseDialog);
QGridLayout * mainLayout = new QGridLayout(widget);
-
+
// Create the differents layout for buttons and label
QGridLayout * bottomLayout = new QGridLayout();
QGridLayout * topLayout = new QGridLayout();
@@ -1279,7 +1279,8 @@ void KGameWindow::createDefenseDialog()
connect(def2, SIGNAL(clicked()), this, SLOT(slotWindowDef2()));
connect(defAuto, SIGNAL(clicked()), this, SLOT(slotDefAuto()));
- m_defenseDialog->setMainWidget(widget);
+ QVBoxLayout *dialogLayout = new QVBoxLayout(m_defenseDialog);
+ dialogLayout->addWidget(widget);
}
void KGameWindow::displayDefenseWindow()
diff --git a/ksirk/kgamewin.h b/ksirk/kgamewin.h
index 61af3ee..b3dadb7 100644
--- a/ksirk/kgamewin.h
+++ b/ksirk/kgamewin.h
@@ -60,7 +60,7 @@ class NewGameSetup;
class QAction;
class KGameChat;
class KGamePopupItem;
-class KDialog;
+class QDialog;
class QAction;
class QEvent;
@@ -1077,7 +1077,7 @@ private: // Private members
GameLogic::Country* m_mouseLocalisation;
- KDialog * m_defenseDialog;
+ QDialog * m_defenseDialog;
// components that will be re-used of the chat
QPixmap m_upChatFloatPix;
diff --git a/ksirkskineditor/mainwindow.cpp b/ksirkskineditor/mainwindow.cpp
index 65c199e..e876b84 100644
--- a/ksirkskineditor/mainwindow.cpp
+++ b/ksirkskineditor/mainwindow.cpp
@@ -68,7 +68,6 @@
#include <KToolBar>
#include <QAction>
#include <QSvgRenderer>
-#include <KDialog>
#include <KAboutApplicationDialog>
#include <KRecentFilesAction>
diff --git a/ksirkskineditor/mainwindow.h b/ksirkskineditor/mainwindow.h
index 22f1b5c..c778c60 100644
--- a/ksirkskineditor/mainwindow.h
+++ b/ksirkskineditor/mainwindow.h
@@ -45,7 +45,6 @@
class QAction;
class KToolBar;
-class KDialog;
class KRecentFilesAction;
class QEvent;