Commit 9caa92e7 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use Q_SIGNALS/Q_SLOTS/Q_EMIT instead of signals/slots/emit

GIT_SILENT
parent 0016cbf9
......@@ -44,6 +44,7 @@ include(ECMSetupVersion)
add_definitions(
-DQT_USE_QSTRINGBUILDER
-DQT_NO_FOREACH
-DQT_NO_KEYWORDS
)
add_subdirectory(sprites)
......
......@@ -229,7 +229,7 @@ void ConfigSetup::valueChanged(int ednum,int value)
case EditShipDamage:config.shipDamage=value;break;
case EditPowerupShieldAmount:config.powerupShieldAmount=value;break;
}
emit changed();
Q_EMIT changed();
}
}
......@@ -262,7 +262,7 @@ void ConfigSetup::valueChanged(int ednum,double value)
case EditPowerupLifeTime:config.powerupLifeTime=value;break;
case EditPowerupEnergyAmount:config.powerupEnergyAmount=value;break;
}
emit changed();
Q_EMIT changed();
}
}
......@@ -309,7 +309,7 @@ void ConfigSetup::configSelected(int num)
displayConfig(predefinedConfig[num]);
else
displayConfig(config);
emit changed();
Q_EMIT changed();
}
}
......@@ -440,7 +440,7 @@ void SettingsDialog::updateWidgets()
void SettingsDialog::updateSettings()
{
cs->updateSettings();
emit settingsUpdated();
Q_EMIT settingsUpdated();
}
bool SettingsDialog::hasChanged()
......
......@@ -41,10 +41,10 @@ public:
void updateWidgets();
void updateWidgetsDefault();
signals:
Q_SIGNALS:
void changed();
protected slots:
protected Q_SLOTS:
void configSelected(int num);
void sliderChanged(int val);
protected:
......@@ -97,10 +97,10 @@ public:
explicit SettingsDialog(SConfig *customConfig, QWidget *parent = nullptr, const char *name = nullptr);
~SettingsDialog() override;
signals:
Q_SIGNALS:
void settingsUpdated();
private slots:
private Q_SLOTS:
void updateWidgets() override;
void updateWidgetsDefault() override;
void updateSettings() override;
......
......@@ -367,7 +367,7 @@ void MyMainView::pause()
waitForStart=true;
QAbstractEventDispatcher::instance()->unregisterTimers(this);
emit setStatusText(i18n(" paused "), IDS_PAUSE);
Q_EMIT setStatusText(i18n(" paused "), IDS_PAUSE);
}
}
......@@ -375,8 +375,8 @@ void MyMainView::resume()
{
waitForStart=false;
timerID=startTimer(Options::refreshTime());
emit(setStatusText(QLatin1String( "" ),IDS_PAUSE));
emit(setStatusText(QLatin1String( "" ),IDS_MAIN));
Q_EMIT setStatusText(QLatin1String( "" ),IDS_PAUSE);
Q_EMIT setStatusText(QLatin1String( "" ),IDS_MAIN);
}
void MyMainView::start( )
......@@ -389,8 +389,8 @@ void MyMainView::start( )
{
waitForStart = false;
timerID=startTimer(Options::refreshTime());
emit(setStatusText(QLatin1String( "" ),IDS_PAUSE));
emit(setStatusText(QLatin1String( "" ),IDS_MAIN));
Q_EMIT setStatusText(QLatin1String( "" ),IDS_PAUSE);
Q_EMIT setStatusText(QLatin1String( "" ),IDS_MAIN);
pauseAction->setEnabled( true );
pauseAction->setChecked( false );
}
......@@ -488,8 +488,8 @@ void MyMainView::newRound()
ship[i]->setHitPoints(Options::startHitPoints(i));
ship[i]->stop(false);
ship[i]->setExplosion(-1);
emit(energy(i,(int)ship[i]->getEnergy()));
emit(hitPoints(i,ship[i]->getHitPoints()));
Q_EMIT energy(i,(int)ship[i]->getEnergy());
Q_EMIT hitPoints(i,ship[i]->getHitPoints());
bulletShot[i]=false;
qDeleteAll(*bullets[i]);
bullets[i]->clear();
......@@ -522,8 +522,8 @@ void MyMainView::newRound()
QString str = i18n("Press %1 to start",
actionCollection->action(QStringLiteral("game_start"))->shortcut().toString(QKeySequence::NativeText));
emit(setStatusText(str,IDS_MAIN));
emit(setStatusText( QLatin1String( "" ), IDS_PAUSE ));
Q_EMIT setStatusText(str,IDS_MAIN);
Q_EMIT setStatusText( QLatin1String( "" ), IDS_PAUSE );
stop( );
}
......@@ -533,7 +533,7 @@ void MyMainView::newGame()
for(i=0;i<2;i++)
{
ship[i]->setWins(0);
emit(wins(i,0));
Q_EMIT wins(i,0);
}
newRound();
}
......@@ -575,7 +575,7 @@ void MyMainView::timerEvent(QTimerEvent *event)
textSprite->setText(i18n("blue player won the round"));
w=ship[1]->getWins()+1;
ship[1]->setWins(w);
emit(wins(1,w));
Q_EMIT wins(1,w);
}
}
else
......@@ -583,14 +583,14 @@ void MyMainView::timerEvent(QTimerEvent *event)
textSprite->setText(i18n("red player won the round"));
w=ship[0]->getWins()+1;
ship[0]->setWins(w);
emit(wins(0,w));
Q_EMIT wins(0,w);
}
// must do this after setting text, because length is unknown until now
textSprite->setPos(QPointF((width()-textSprite->boundingRect().width()) / 2,height()/2-90));
QString str = i18n("Press %1 for new round",
actionCollection->action(QStringLiteral("game_start"))->shortcut().toString(QKeySequence::NativeText));
emit(setStatusText(str,IDS_MAIN));
Q_EMIT setStatusText(str,IDS_MAIN);
stop( );
}
}
......@@ -736,7 +736,7 @@ void MyMainView::moveShips()
}
ship[i]->setEnergy(en);
if(olde!=(int)en)
emit(energy(i,(int)en));
Q_EMIT energy(i,(int)en);
}
}
}
......@@ -910,7 +910,7 @@ void MyMainView::collisions()
if(ohp>0)
{
s->setHitPoints(ohp-hp-config.shipDamage);
emit(hitPoints(s->getPlayerNumber(),s->getHitPoints()));
Q_EMIT hitPoints(s->getPlayerNumber(),s->getHitPoints());
ndx[0]=((1-EPSILON)*ship[0]->xVelocity()+(1+EPSILON)*ship[1]->xVelocity())/2.0;
ndy[0]=((1-EPSILON)*ship[0]->yVelocity()+(1+EPSILON)*ship[1]->yVelocity())/2.0;
ndx[1]=((1-EPSILON)*ship[1]->xVelocity()+(1+EPSILON)*ship[0]->xVelocity())/2.0;
......@@ -1038,7 +1038,7 @@ void MyMainView::collisions()
{
hp=ship[pl]->getHitPoints();
if(hp!=oldhp[pl])
emit(hitPoints(pl,hp));
Q_EMIT hitPoints(pl,hp);
if((hp==0)&&(ship[pl]->getExplosion()<0))
{
op=(pl+1)%2;
......
......@@ -48,7 +48,7 @@ public:
static KToggleAction *pauseAction;
void setActionCollection(KActionCollection *a);
public slots:
public Q_SLOTS:
void newRound();
void newGame();
void togglePause( );
......@@ -60,7 +60,7 @@ public slots:
void closeSettings();
void readConfig();
void writeConfig();
signals:
Q_SIGNALS:
void hitPoints(int pn,int hp);
void energy(int pn,int en);
void wins(int pn,int w);
......
......@@ -29,7 +29,7 @@ class PlayerInfo:public QFrame
public:
explicit PlayerInfo(int pnr,QWidget *parent = nullptr);
static void loadPixmaps();
public slots:
public Q_SLOTS:
void setHitpoints(int h);
void setEnergy(int e);
void setWins(int w);
......
......@@ -32,7 +32,7 @@ public:
MyTopLevelWidget();
void start();
private slots:
private Q_SLOTS:
void setStatusText(const QString & text,int id);
void keySetup();
void energy(int pn,int en);
......
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