summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrius ┼átikonas <[email protected]>2017-04-21 17:25:51 +0100
committerAndrius ┼átikonas <[email protected]>2017-04-21 17:25:51 +0100
commit83f632df17af4fb71cafaafaa0641d7260b11c45 (patch)
tree2db8860ba7f5b1a2e0aee9cc728a38c251fd345c
parent063acd55431d039376180a0d7a3455f12052ec90 (diff)
Convert to new Qt5 signal/slot syntax.
-rw-r--r--CMakeLists.txt2
-rw-r--r--dialogs/fleetdlg.cc4
-rw-r--r--dialogs/newgamedlg.cc33
-rw-r--r--dialogs/scoredlg.cc4
-rw-r--r--gameview.cc2
-rw-r--r--map/mapitems.cc4
-rw-r--r--map/mapscene.cc3
-rw-r--r--minimapview.cc2
8 files changed, 28 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f7184de..a47a23f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,7 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
GuiAddons
I18n
XmlGui
+ WidgetsAddons
)
find_package(KF5DocTools ${KF5_MIN_VERSION})
@@ -104,6 +105,7 @@ target_link_libraries(konquest
KF5::GuiAddons
KF5::I18n
KF5::XmlGui
+ KF5::WidgetsAddons
KF5KDEGames
)
diff --git a/dialogs/fleetdlg.cc b/dialogs/fleetdlg.cc
index 7b630c9..10fabce 100644
--- a/dialogs/fleetdlg.cc
+++ b/dialogs/fleetdlg.cc
@@ -53,8 +53,8 @@ FleetDlg::FleetDlg( QWidget *parent,
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()));
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &FleetDlg::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &FleetDlg::reject);
setupTable();
update();
diff --git a/dialogs/newgamedlg.cc b/dialogs/newgamedlg.cc
index dd53f3f..a65121e 100644
--- a/dialogs/newgamedlg.cc
+++ b/dialogs/newgamedlg.cc
@@ -334,8 +334,8 @@ NewGameDlg::NewGameDlg( QWidget *parent, Game *game)
mainLayout->addWidget(mainWidget);
okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &NewGameDlg::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &NewGameDlg::reject);
m_selectablePlayer.push_back(new LocalPlayerGui());
m_selectablePlayer.push_back(new SpectatorPlayerGui());
@@ -356,13 +356,12 @@ NewGameDlg::NewGameDlg( QWidget *parent, Game *game)
menuMapper->setMapping(action, i);
connect(action, SIGNAL(triggered(bool)), menuMapper, SLOT(map()));
}
- connect(menuMapper, SIGNAL(mapped(int)), this, SLOT(slotAddPlayer(int)));
+ connect(menuMapper, static_cast<void (QSignalMapper::*)(int)>(&QSignalMapper::mapped), this, &NewGameDlg::slotAddPlayer);
m_w = new NewGameDlgUI(this);
m_w->map->setMap(m_game->map());
- connect(m_w->map, SIGNAL(sectorSelected(Coordinate)),
- this, SLOT(slotUpdateSelection(Coordinate)));
+ connect(m_w->map, &MiniMapView::sectorSelected, this, &NewGameDlg::slotUpdateSelection);
playersListModel *model = new playersListModel(this, m_game, m_selectablePlayer);
@@ -371,15 +370,15 @@ NewGameDlg::NewGameDlg( QWidget *parent, Game *game)
m_w->playerList->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
m_w->addPlayerButton->setMenu(m_playerTypeChooser);
- connect(m_w->neutralPlanetsSB, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateNeutrals(int)));
- connect(m_w->widthSB, SIGNAL(valueChanged(int)), this, SLOT(slotNewMap()));
- connect(m_w->heightSB, SIGNAL(valueChanged(int)), this, SLOT(slotNewMap()));
- connect(m_w->randomizeMap, SIGNAL(clicked()), this, SLOT(slotNewMap()));
- connect(m_w->removePlayerButton, SIGNAL(clicked()), this, SLOT(slotRemovePlayer()));
+ connect(m_w->neutralPlanetsSB, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &NewGameDlg::slotUpdateNeutrals);
+ connect(m_w->widthSB, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &NewGameDlg::slotNewMap);
+ connect(m_w->heightSB, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &NewGameDlg::slotNewMap);
+ connect(m_w->randomizeMap, &QPushButton::clicked, this, &NewGameDlg::slotNewMap);
+ connect(m_w->removePlayerButton, &QPushButton::clicked, this, &NewGameDlg::slotRemovePlayer);
- connect(m_w->OwnerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(slotNewOwner(int)));
- connect(m_w->KillPercentageSB, SIGNAL(valueChanged(double)), this, SLOT(slotNewKillPercentage(double)));
- connect(m_w->ProductionSB, SIGNAL(valueChanged(int)), this, SLOT(slotNewProduction(int)));
+ connect(m_w->OwnerCB, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &NewGameDlg::slotNewOwner);
+ connect(m_w->KillPercentageSB, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, &NewGameDlg::slotNewKillPercentage);
+ connect(m_w->ProductionSB, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &NewGameDlg::slotNewProduction);
init();
@@ -506,7 +505,7 @@ NewGameDlg::slotUpdateSelection(const Coordinate &coord)
m_w->KillPercentageSB->setEnabled(hasPlanet);
m_w->ProductionSB->setEnabled(hasPlanet);
- disconnect(m_w->OwnerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(slotNewOwner(int)));
+ disconnect(m_w->OwnerCB, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &NewGameDlg::slotNewOwner);
if (hasPlanet) {
Planet *planet = sector->planet();
@@ -525,7 +524,7 @@ NewGameDlg::slotUpdateSelection(const Coordinate &coord)
m_w->OwnerCB->setCurrentIndex(0);
}
- connect(m_w->OwnerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(slotNewOwner(int)));
+ connect(m_w->OwnerCB, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &NewGameDlg::slotNewOwner);
}
@@ -621,9 +620,9 @@ NewGameDlg::slotNewMap()
// make sure we have space for neutrals
int maxneutrals = m_w->heightSB->value()*m_w->widthSB->value() - m_game->players().count();
if(m_w->neutralPlanetsSB->value() > maxneutrals) {
- disconnect(m_w->neutralPlanetsSB, SIGNAL(valueChanged(int)), this, SLOT(slotNewMap()));
+ disconnect(m_w->neutralPlanetsSB, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &NewGameDlg::slotNewMap);
m_w->neutralPlanetsSB->setValue(maxneutrals);
- connect(m_w->neutralPlanetsSB, SIGNAL(valueChanged(int)), this, SLOT(slotNewMap()));
+ connect(m_w->neutralPlanetsSB, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &NewGameDlg::slotNewMap);
}
// make the planets
diff --git a/dialogs/scoredlg.cc b/dialogs/scoredlg.cc
index c9daccb..ed23ebb 100644
--- a/dialogs/scoredlg.cc
+++ b/dialogs/scoredlg.cc
@@ -44,8 +44,8 @@ ScoreDlg::ScoreDlg( QWidget *parent, const QString& title, QList<Player *> playe
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()));
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &ScoreDlg::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &ScoreDlg::reject);
m_standingsWidget = new StandingsWidget(this, players);
mainLayout->addWidget(m_standingsWidget );
diff --git a/gameview.cc b/gameview.cc
index 671f33f..672f1fe 100644
--- a/gameview.cc
+++ b/gameview.cc
@@ -34,6 +34,8 @@
#include <QIntValidator>
#include <QDebug>
+#include <KMessageBox>
+
#include "players/player.h"
#include "players/localplayer.h"
#include "images.h"
diff --git a/map/mapitems.cc b/map/mapitems.cc
index 6832bb1..966a746 100644
--- a/map/mapitems.cc
+++ b/map/mapitems.cc
@@ -55,8 +55,8 @@ PlanetItem::PlanetItem (MapScene *scene, Sector *sector, Game *game)
setAcceptHoverEvents(true);
m_blinkTimer = new QTimer(this);
- connect(m_blinkTimer, SIGNAL(timeout()), this, SLOT(blinkPlanet()));
- connect(m_sector, SIGNAL(update()), this, SLOT(updatePlanet()));
+ connect(m_blinkTimer, &QTimer::timeout, this, &PlanetItem::blinkPlanet);
+ connect(m_sector, &Sector::update, this, &PlanetItem::updatePlanet);
}
diff --git a/map/mapscene.cc b/map/mapscene.cc
index fd9531d..8c1fcae 100644
--- a/map/mapscene.cc
+++ b/map/mapscene.cc
@@ -105,8 +105,7 @@ MapScene::mapUpdate()
sector = map()->sector(Coordinate(j, i));
if (sector->hasPlanet()) {
PlanetItem *item = new PlanetItem(this, sector, m_game);
- connect(item, SIGNAL(planetItemSelected (PlanetItem *)),
- this, SLOT(planetItemSelected (PlanetItem *)));
+ connect(item, &PlanetItem::planetItemSelected, this, &MapScene::planetItemSelected);
item->setZValue(1.0);
addItem(item);
m_planetItems.append(item);
diff --git a/minimapview.cc b/minimapview.cc
index 40ceebb..84139c7 100644
--- a/minimapview.cc
+++ b/minimapview.cc
@@ -54,7 +54,7 @@ void
MiniMapView::setMap(Map *map)
{
m_map = map;
- connect(m_map, SIGNAL(update()), this, SLOT(update()));
+ connect(m_map, &Map::update, this, static_cast<void (QWidget::*)(void)>(&QWidget::update));
}