Commit b5f51cbc authored by Andrius Štikonas's avatar Andrius Štikonas

Clean up unnecessary signals and slots in the headers.

Finish porting SIGNALS/SLOTS to the new syntax (except for KStandardGameAction).
parent b158b5ca
......@@ -352,7 +352,7 @@ NewGameDlg::NewGameDlg( QWidget *parent, Game *game)
PlayerGui *selectablePlayer = m_selectablePlayer[i];
QAction *action = m_playerTypeChooser->addAction(selectablePlayer->guiName());
menuMapper->setMapping(action, i);
connect(action, SIGNAL(triggered(bool)), menuMapper, SLOT(map()));
connect(action, &QAction::triggered, menuMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
}
connect(menuMapper, static_cast<void (QSignalMapper::*)(int)>(&QSignalMapper::mapped), this, &NewGameDlg::slotAddPlayer);
......
......@@ -53,15 +53,13 @@ public:
class NewGameDlg : public QDialog
{
Q_OBJECT
public:
NewGameDlg( QWidget *parent, Game *game);
~NewGameDlg();
void save();
protected slots:
protected:
void slotNewMap();
void slotUpdateNeutrals(int);
void slotAddPlayer(int);
......
......@@ -35,8 +35,6 @@ class Planet;
class Fleet : public QObject
{
Q_OBJECT
public:
explicit Fleet( long long initialShipCount );
......@@ -52,7 +50,6 @@ protected:
class AttackFleet : public Fleet
{
Q_OBJECT
public:
AttackFleet( Planet *src, Planet *dest, long long initialCount, int arrivalTurn );
......@@ -66,7 +63,7 @@ public:
class DefenseFleet : public Fleet
{
Q_OBJECT
public:
DefenseFleet( Planet *newHome, long long initialCount );
......@@ -78,7 +75,7 @@ public:
AttackFleet *spawnAttackFleet( Planet *destination, long long shipCount, int arrivalTurn );
Planet *home;
signals:
Q_SIGNALS:
void update();
};
......
......@@ -37,7 +37,7 @@ Game::Game(QObject *parent) :
m_map = new Map(10, 10);
m_gameMachine.addState(m_finalState);
m_neutral = new NeutralPlayer(this);
connect(&m_gameMachine, SIGNAL(finished()), this, SIGNAL(finished()));
connect(&m_gameMachine, &QStateMachine::finished, this, &Game::finished);
}
const QList<Planet*> Game::planets()
......
......@@ -84,7 +84,7 @@ public:
int turnCounter() const { return m_turnCounter; }
bool doFleetArrival (AttackFleet *fleet);
signals:
Q_SIGNALS:
void started();
void finished();
void waitingForPlayer(Player *player);
......@@ -98,9 +98,8 @@ private:
void makeKill(Fleet *fleet, Player *player);
public slots:
private slots:
private:
void newTurn() { m_turnCounter++; }
protected:
......
......@@ -81,7 +81,6 @@ public:
virtual ~GameView();
bool confirmNewGame();
public slots:
bool shutdownGame();
void planetSelected( Planet * );
void newShipCount();
......@@ -94,13 +93,12 @@ public slots:
void measureDistance();
void showFleets();
public slots:
void startNewGame();
void gameMsg(const KLocalizedString &msg, Player *player = 0,
Planet *planet = 0, Player *planetPlayer = 0);
void turnPreparation();
signals:
Q_SIGNALS:
void newGUIState( GUIState newState );
//***************************************************************
......@@ -110,10 +108,9 @@ protected:
void keyPressEvent( QKeyEvent * ) override;
void resizeEvent ( QResizeEvent * event ) override;
private slots:
private:
void gameOver();
private:
void changeGameView();
void cleanupGame();
......
......@@ -66,8 +66,8 @@ void LocalGame::buildMachine()
m_gameMachine.setInitialState(m_neutral);
connect(m_neutral, SIGNAL(donePlaying()), this, SLOT(playerIsDone()));
m_neutral->addTransition(m_neutral, SIGNAL(donePlaying()), m_players[0]);
connect(m_neutral, &NeutralPlayer::donePlaying, this, &LocalGame::playerIsDone);
m_neutral->addTransition(m_neutral, &NeutralPlayer::donePlaying, m_players[0]);
// Now add transitions
for (int i = 0 ; i < m_players.count() ; i++)
......@@ -81,8 +81,8 @@ void LocalGame::buildMachine()
//qDebug() << "Adding transition from "
//<< player->name() << " to " << nextPlayer->name();
player->addTransition(player, SIGNAL(donePlaying()), nextPlayer);
connect(player, SIGNAL(donePlaying()), this, SLOT(playerIsDone()));
player->addTransition(player, &Player::donePlaying, nextPlayer);
connect(player, &Player::donePlaying, this, &LocalGame::playerIsDone);
}
}
......
......@@ -24,18 +24,16 @@
class LocalGame : public Game
{
Q_OBJECT
public:
explicit LocalGame(QObject *parent = 0);
void start() override;
void stop() override;
signals:
public slots:
public:
void addPlayer(Player *player);
void playerIsDone();
protected:
void buildMachine() override;
};
......
......@@ -52,7 +52,7 @@ Map::resizeMap (int rowsCount, int columnsCount)
m_grid << QList<Sector>();
for (int col = 0; col < columnsCount; col++) {
m_grid[row] << Sector(this, Coordinate(row, col));
connect(&m_grid[row][col], SIGNAL(update()), this, SLOT(childSectorUpdate()));
connect(&m_grid[row][col], &Sector::update, this, &Map::childSectorUpdate);
}
}
}
......
......@@ -69,10 +69,10 @@ public:
const QList<Planet*> planets();
protected slots:
protected:
void childSectorUpdate();
signals:
Q_SIGNALS:
void update();
private:
......
......@@ -49,10 +49,10 @@ public:
void select ();
Sector *sector () { return m_sector; }
signals:
Q_SIGNALS:
void planetItemSelected (PlanetItem *);
private slots:
private:
void updatePlanet ();
void blinkPlanet ();
......
......@@ -98,10 +98,10 @@ class MapScene: public QGraphicsScene
void clearMap();
void mapUpdate();
signals:
Q_SIGNALS:
void planetSelected( Planet * );
private slots:
private:
void planetItemSelected (PlanetItem *);
private:
......
......@@ -28,7 +28,6 @@ class MapScene;
class MapView : public QGraphicsView
{
Q_OBJECT
public:
explicit MapView( MapScene* scene, QWidget *parent = 0 );
......
......@@ -48,7 +48,7 @@ public:
bool hasSelection() const { return (m_selection.x() >= 0) && (m_selection.x() < m_map->columns()) && (m_selection.y() >= 0) && (m_selection.y() < m_map->rows()); }
signals:
Q_SIGNALS:
void sectorSelected(const Coordinate &coord);
protected:
......
......@@ -73,7 +73,7 @@ public:
void turn(const GameOptions &);
//void select() { Q_ASSERT(false); }
signals:
Q_SIGNALS:
void update();
private:
......
......@@ -28,8 +28,6 @@
class AiBecai : public ComputerPlayer
{
Q_OBJECT
public:
explicit AiBecai(Game *game, const QString &newName, const QColor &color);
......@@ -37,11 +35,6 @@ public:
private:
int getMinimumDefenceFleetSize(Planet *planet, int minimumBaseDefenceFleetSize, double averageOwnKillPercentage, double averageOwnProduction);
signals:
public slots:
};
#endif // AI_BECAI_H
......@@ -23,8 +23,6 @@
class AiDefault : public ComputerPlayer
{
Q_OBJECT
protected:
enum AiLevel { Weak, Normal, Hard };
......@@ -36,10 +34,6 @@ protected:
void play() override;
signals:
public slots:
private:
AiLevel m_level;
};
......
......@@ -23,14 +23,9 @@
class AiDefaultHard : public AiDefault
{
Q_OBJECT
public:
explicit AiDefaultHard(Game *game, const QString &newName, const QColor &color);
signals:
public slots:
};
#endif // AI_DEFAULT_HARD_H
......@@ -23,14 +23,8 @@
class AiDefaultNormal : public AiDefault
{
Q_OBJECT
public:
explicit AiDefaultNormal(Game *game, const QString &newName, const QColor &color);
signals:
public slots:
};
#endif // AI_DEFAULT_NORMAL_H
......@@ -23,14 +23,8 @@
class AiDefaultWeak : public AiDefault
{
Q_OBJECT
public:
explicit AiDefaultWeak(Game *game, const QString &newName, const QColor &color);
signals:
public slots:
};
#endif // AI_DEFAULT_WEAK_H
......@@ -33,17 +33,11 @@
class AiExample : public ComputerPlayer
{
Q_OBJECT
public:
explicit AiExample(Game *game, const QString &newName, const QColor &color);
virtual void play();
signals:
public slots:
};
#endif // AI_EXAMPLE_H
......@@ -28,18 +28,11 @@
class ComputerPlayer : public Player
{
Q_OBJECT
protected:
explicit ComputerPlayer(Game *game, const QString &newName, const QColor &color);
bool isAiPlayer() override;
void play() override = 0;
signals:
public slots:
};
#endif // COMPUTERPLAYER_H
......@@ -34,10 +34,9 @@ public:
void play() override;
void done();
signals:
void canPlay();
public slots:
Q_SIGNALS:
void canPlay();
};
......
......@@ -34,7 +34,6 @@
class NeutralPlayer : public Player
{
Q_OBJECT
public:
explicit NeutralPlayer(Game *game);
......@@ -44,11 +43,6 @@ public:
protected:
void play() override;
signals:
public slots:
};
#endif // NEUTRALPLAYER_H
......@@ -82,13 +82,9 @@ protected:
void onExit (QEvent *event) override;
Game *m_game;
signals:
Q_SIGNALS:
void donePlaying();
public slots:
private slots:
private:
// Attack fleets sent by this player that are still moving
AttackFleetList m_attackList;
......
......@@ -32,18 +32,11 @@
class SpectatorPlayer : public LocalPlayer
{
Q_OBJECT
public:
explicit SpectatorPlayer(Game *game, const QString &newName, const QColor &color);
bool isDead() override;
bool isSpectator() override;
signals:
public slots:
};
#endif // SPECTATORPLAYER_H
......@@ -58,14 +58,12 @@ public:
void setPlanet( Planet *planet );
void removePlanet();
signals:
Q_SIGNALS:
void update();
protected slots:
protected:
void childPlanetUpdate( );
protected:
Map *m_map;
Coordinate m_coord;
Planet *m_planet; // a sector has 0 or 1 planets
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment