Commit def0f6a7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some clazy warning

parent b8e4cbe4
......@@ -416,12 +416,12 @@ SettingsDialog::SettingsDialog(SConfig *customConfig, QWidget *parent, const cha
: KConfigDialog( parent,QLatin1String( name ), Options::self())
{
General *general = new General();
addPage(general, i18nc("general settings","General"), QLatin1String( "games-config-options" ), i18n("General Settings"));
addPage(general, i18nc("general settings","General"), QStringLiteral( "games-config-options" ), i18n("General Settings"));
cs = new ConfigSetup(customConfig);
addPage(cs, i18nc("game settings","Game"),QLatin1String( "games-config-custom" ), i18n("Game Settings"));
addPage(cs, i18nc("game settings","Game"),QStringLiteral( "games-config-custom" ), i18n("Game Settings"));
connect(cs, &ConfigSetup::changed, this, &SettingsDialog::updateButtons);
setHelp(QLatin1String( "options-configurations" ), QLatin1String( "kspaceduel" ));
setHelp(QStringLiteral( "options-configurations" ), QStringLiteral( "kspaceduel" ));
// resize(600,400);
}
......
......@@ -35,11 +35,11 @@ int main(int argc,char **argv)
KLocalizedString::setApplicationDomain("kspaceduel");
KAboutData aboutData( "kspaceduel", i18n("KSpaceDuel"),
KAboutData aboutData( QStringLiteral("kspaceduel"), i18n("KSpaceDuel"),
KSPACEDUEL_VERSION, i18n(description), KAboutLicense::GPL,
i18n("(c) 1998-2001, Andreas Zehender"), "http://games.kde.org/kspaceduel" );
aboutData.addAuthor(i18n("Andreas Zehender"),i18n("Original Program"), "az@azweb.de");
aboutData.addAuthor(i18n("Branan Riley"),i18n("SVG Renderer"), "branan@gmail.com");
i18n("(c) 1998-2001, Andreas Zehender"), QStringLiteral("http://games.kde.org/kspaceduel") );
aboutData.addAuthor(i18n("Andreas Zehender"),i18n("Original Program"), QStringLiteral("az@azweb.de"));
aboutData.addAuthor(i18n("Branan Riley"),i18n("SVG Renderer"), QStringLiteral("branan@gmail.com"));
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
KCrash::initialize();
......
......@@ -64,7 +64,7 @@ MyMainView::MyMainView(QWidget *parent)
int i,p;
setMinimumSize(600,400);
random.setSeed(0);
QPixmap backgr(QStandardPaths::locate(QStandardPaths::DataLocation, QLatin1String(MV_BACKGROUND)));
QPixmap backgr(QStandardPaths::locate(QStandardPaths::DataLocation, QStringLiteral(MV_BACKGROUND)));
field.setBackgroundBrush(QBrush(backgr));
view.setCacheMode(QGraphicsView::CacheBackground);
......@@ -84,20 +84,20 @@ MyMainView::MyMainView(QWidget *parent)
minePut[p]=false;
}
svgrender = new QSvgRenderer(QStandardPaths::locate(QStandardPaths::DataLocation, QLatin1String(MV_SVG_FILE)));
svgrender = new QSvgRenderer(QStandardPaths::locate(QStandardPaths::DataLocation, QStringLiteral(MV_SVG_FILE)));
sun=new SunSprite(svgrender,QLatin1String( MV_SUN ));
sun=new SunSprite(svgrender,QStringLiteral( MV_SUN ));
field.addItem(sun);
sun->setPos(QPointF(width()/2-1-(sun->width()/2),
height()/2-1-(sun->height()/2)));
powerupelements[0] = QLatin1String( MV_POWERMINE );
powerupelements[1] = QLatin1String( MV_POWERBULLET );
powerupelements[2] = QLatin1String( MV_POWERSHIELD );
powerupelements[3] = QLatin1String( MV_POWERENERGY );
powerupelements[0] = QStringLiteral( MV_POWERMINE );
powerupelements[1] = QStringLiteral( MV_POWERBULLET );
powerupelements[2] = QStringLiteral( MV_POWERSHIELD );
powerupelements[3] = QStringLiteral( MV_POWERENERGY );
ship[0]=new ShipSprite(svgrender, QLatin1String( MV_SHIP1 ), 0);
ship[1]=new ShipSprite(svgrender, QLatin1String( MV_SHIP2 ), 1);
ship[0]=new ShipSprite(svgrender, QStringLiteral( MV_SHIP1 ), 0);
ship[1]=new ShipSprite(svgrender, QStringLiteral( MV_SHIP2 ), 1);
field.addItem(ship[0]);
field.addItem(ship[1]);
......@@ -300,29 +300,29 @@ void MyMainView::keyPressEvent(QKeyEvent *ev)
// if-statement kept for historical reasons, maybe not needed anymore
if ( ((gameEnd>0.0) || (gameEnd<=-2.0)) && (!waitForStart) )
{
if(actionCollection->action(QLatin1String( "P1KeyLeft" ))->shortcuts().contains(ev->key()))
if(actionCollection->action(QStringLiteral( "P1KeyLeft" ))->shortcuts().contains(ev->key()))
playerKeyPressed[0][PlayerKeyLeft]=true;
else if(actionCollection->action(QLatin1String( "P2KeyLeft" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P2KeyLeft" ))->shortcuts().contains(ev->key()))
playerKeyPressed[1][PlayerKeyLeft]=true;
else if(actionCollection->action(QLatin1String( "P1KeyRight" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P1KeyRight" ))->shortcuts().contains(ev->key()))
playerKeyPressed[0][PlayerKeyRight]=true;
else if(actionCollection->action(QLatin1String( "P2KeyRight" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P2KeyRight" ))->shortcuts().contains(ev->key()))
playerKeyPressed[1][PlayerKeyRight]=true;
else if(actionCollection->action(QLatin1String( "P1KeyAcc" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P1KeyAcc" ))->shortcuts().contains(ev->key()))
playerKeyPressed[0][PlayerKeyAcc]=true;
else if(actionCollection->action(QLatin1String( "P2KeyAcc" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P2KeyAcc" ))->shortcuts().contains(ev->key()))
playerKeyPressed[1][PlayerKeyAcc]=true;
else if(actionCollection->action(QLatin1String( "P1Shot" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P1Shot" ))->shortcuts().contains(ev->key()))
playerKeyPressed[0][PlayerKeyShot]=true;
else if(actionCollection->action(QLatin1String( "P2Shot" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P2Shot" ))->shortcuts().contains(ev->key()))
playerKeyPressed[1][PlayerKeyShot]=true;
else if(actionCollection->action(QLatin1String( "P1Mine" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P1Mine" ))->shortcuts().contains(ev->key()))
playerKeyPressed[0][PlayerKeyMine]=true;
else if(actionCollection->action(QLatin1String( "P2Mine" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P2Mine" ))->shortcuts().contains(ev->key()))
playerKeyPressed[1][PlayerKeyMine]=true;
else
ev->ignore();
......@@ -331,29 +331,29 @@ void MyMainView::keyPressEvent(QKeyEvent *ev)
void MyMainView::keyReleaseEvent(QKeyEvent *ev)
{
if(actionCollection->action(QLatin1String( "P1KeyLeft" ))->shortcuts().contains(ev->key()))
if(actionCollection->action(QStringLiteral( "P1KeyLeft" ))->shortcuts().contains(ev->key()))
playerKeyPressed[0][PlayerKeyLeft]=false;
else if(actionCollection->action(QLatin1String( "P2KeyLeft" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P2KeyLeft" ))->shortcuts().contains(ev->key()))
playerKeyPressed[1][PlayerKeyLeft]=false;
else if(actionCollection->action(QLatin1String( "P1KeyRight" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P1KeyRight" ))->shortcuts().contains(ev->key()))
playerKeyPressed[0][PlayerKeyRight]=false;
else if(actionCollection->action(QLatin1String( "P2KeyRight" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P2KeyRight" ))->shortcuts().contains(ev->key()))
playerKeyPressed[1][PlayerKeyRight]=false;
else if(actionCollection->action(QLatin1String( "P1KeyAcc" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P1KeyAcc" ))->shortcuts().contains(ev->key()))
playerKeyPressed[0][PlayerKeyAcc]=false;
else if(actionCollection->action(QLatin1String( "P2KeyAcc" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P2KeyAcc" ))->shortcuts().contains(ev->key()))
playerKeyPressed[1][PlayerKeyAcc]=false;
else if(actionCollection->action(QLatin1String( "P1Shot" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P1Shot" ))->shortcuts().contains(ev->key()))
playerKeyPressed[0][PlayerKeyShot]=false;
else if(actionCollection->action(QLatin1String( "P2Shot" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P2Shot" ))->shortcuts().contains(ev->key()))
playerKeyPressed[1][PlayerKeyShot]=false;
else if(actionCollection->action(QLatin1String( "P1Mine" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P1Mine" ))->shortcuts().contains(ev->key()))
playerKeyPressed[0][PlayerKeyMine]=false;
else if(actionCollection->action(QLatin1String( "P2Mine" ))->shortcuts().contains(ev->key()))
else if(actionCollection->action(QStringLiteral( "P2Mine" ))->shortcuts().contains(ev->key()))
playerKeyPressed[1][PlayerKeyMine]=false;
else
ev->ignore();
......@@ -521,7 +521,7 @@ void MyMainView::newRound()
//field.update();
QString str = i18n("Press %1 to start",
actionCollection->action("game_start")->shortcut().toString(QKeySequence::NativeText));
actionCollection->action(QStringLiteral("game_start"))->shortcut().toString(QKeySequence::NativeText));
emit(setStatusText(str,IDS_MAIN));
emit(setStatusText( QLatin1String( "" ), IDS_PAUSE ));
stop( );
......@@ -589,7 +589,7 @@ void MyMainView::timerEvent(QTimerEvent *event)
textSprite->setPos(QPointF((width()-textSprite->boundingRect().width()) / 2,height()/2-90));
QString str = i18n("Press %1 for new round",
actionCollection->action("game_start")->shortcut().toString(QKeySequence::NativeText));
actionCollection->action(QStringLiteral("game_start"))->shortcut().toString(QKeySequence::NativeText));
emit(setStatusText(str,IDS_MAIN));
stop( );
}
......@@ -689,10 +689,10 @@ void MyMainView::moveShips()
ship[i]->bullet(config.bulletReloadTime);
en-=config.shotEnergyNeed;
if(i)
bullet=new BulletSprite(svgrender, QLatin1String( MV_BULLET2 ), i,
bullet=new BulletSprite(svgrender, QStringLiteral( MV_BULLET2 ), i,
config.bulletLifeTime);
else
bullet=new BulletSprite(svgrender, QLatin1String( MV_BULLET1 ), i,
bullet=new BulletSprite(svgrender, QStringLiteral( MV_BULLET1 ), i,
config.bulletLifeTime);
field.addItem(bullet);
QPointF p;
......@@ -1064,7 +1064,7 @@ void MyMainView::gameSetup()
if(!waitForStart)
pause();
if (KConfigDialog::showDialog( QLatin1String( "settings" )))
if (KConfigDialog::showDialog( QStringLiteral( "settings" )))
return;
SettingsDialog *settings=new SettingsDialog(&customConfig,this,"settings");
......
......@@ -26,12 +26,12 @@ QPixmap* PlayerInfo::pplayer[6];
void PlayerInfo::loadPixmaps()
{
pplayer[0] = new QPixmap(QIcon::fromTheme( QLatin1String( "battery-discharging-100" )).pixmap(32,32));
pplayer[1] = new QPixmap(QIcon::fromTheme( QLatin1String( "battery-discharging-080" )).pixmap(32,32));
pplayer[2] = new QPixmap(QIcon::fromTheme( QLatin1String( "battery-discharging-060" )).pixmap(32,32));
pplayer[3] = new QPixmap(QIcon::fromTheme( QLatin1String( "battery-discharging-040" )).pixmap(32,32));
pplayer[4] = new QPixmap(QIcon::fromTheme( QLatin1String( "battery-discharging-020" )).pixmap(32,32));
pplayer[5] = new QPixmap(QIcon::fromTheme( QLatin1String( "battery-discharging-000" )).pixmap(32,32));
pplayer[0] = new QPixmap(QIcon::fromTheme( QStringLiteral( "battery-discharging-100" )).pixmap(32,32));
pplayer[1] = new QPixmap(QIcon::fromTheme( QStringLiteral( "battery-discharging-080" )).pixmap(32,32));
pplayer[2] = new QPixmap(QIcon::fromTheme( QStringLiteral( "battery-discharging-060" )).pixmap(32,32));
pplayer[3] = new QPixmap(QIcon::fromTheme( QStringLiteral( "battery-discharging-040" )).pixmap(32,32));
pplayer[4] = new QPixmap(QIcon::fromTheme( QStringLiteral( "battery-discharging-020" )).pixmap(32,32));
pplayer[5] = new QPixmap(QIcon::fromTheme( QStringLiteral( "battery-discharging-000" )).pixmap(32,32));
}
PlayerInfo::PlayerInfo(int pnr,QWidget *parent)
......@@ -73,8 +73,8 @@ PlayerInfo::PlayerInfo(int pnr,QWidget *parent)
lplayer.setPixmap(*(pplayer[0]));
currentPixmap=0;
//lenergy.setPixmap(QPixmap(QStandardPaths::locate(QStandardPaths::DataLocation, "sprites/playerinfo/energy.png")));
lenergy.setPixmap(QIcon::fromTheme( QLatin1String( "battery" )).pixmap(32,32));;
lwins.setPixmap(QPixmap(QStandardPaths::locate(QStandardPaths::DataLocation, QLatin1String( "sprites/playerinfo/win.png" ))));
lenergy.setPixmap(QIcon::fromTheme( QStringLiteral( "battery" )).pixmap(32,32));;
lwins.setPixmap(QPixmap(QStandardPaths::locate(QStandardPaths::DataLocation, QStringLiteral( "sprites/playerinfo/win.png" ))));
hitpoints.setGeometry(9,45,26,26);
energy.setGeometry(9,120,26,26);
......
......@@ -90,8 +90,8 @@ void MyTopLevelWidget::setupActions()
KStandardGameAction::gameNew(playfield, SLOT(newGame()), actionCollection());
KStandardGameAction::quit(this, SLOT(close()), actionCollection());
QAction * newRoundAct = actionCollection()->addAction( QLatin1String( "new_round" ) );
newRoundAct->setIcon( QIcon::fromTheme( QLatin1String( "preferences-desktop-notification-bell" )) );
QAction * newRoundAct = actionCollection()->addAction( QStringLiteral( "new_round" ) );
newRoundAct->setIcon( QIcon::fromTheme( QStringLiteral( "preferences-desktop-notification-bell" )) );
newRoundAct->setText( i18n( "&New Round" ) );
actionCollection()->setDefaultShortcut(newRoundAct, Qt::CTRL + Qt::Key_R);
connect( newRoundAct, &QAction::triggered, playfield, &MyMainView::newRound );
......@@ -99,7 +99,7 @@ void MyTopLevelWidget::setupActions()
MyMainView::pauseAction =
KStandardGameAction::pause(playfield, SLOT(togglePause()), actionCollection());
MyMainView::pauseAction->setChecked( false );
QAction *gameStart = actionCollection()->addAction( QLatin1String( "game_start" ) );
QAction *gameStart = actionCollection()->addAction( QStringLiteral( "game_start" ) );
gameStart->setText( i18nc( "start game","Start" ) );
connect(gameStart, &QAction::triggered, playfield, &MyMainView::start);
actionCollection()->setDefaultShortcut(gameStart, Qt::Key_Space);
......@@ -112,44 +112,44 @@ void MyTopLevelWidget::setupActions()
#warning assuming this is not necessary anymore
#endif
// actionCollection()->setAutoConnectShortcuts(false);
ac = actionCollection()->addAction( QLatin1String( "P1KeyLeft" ));
ac = actionCollection()->addAction( QStringLiteral( "P1KeyLeft" ));
ac->setText(i18n("Player 1 Rotate Left"));
actionCollection()->setDefaultShortcut(ac, Qt::Key_S);
ac->setEnabled( false );
ac = actionCollection()->addAction( QLatin1String( "P1KeyRight" ));
ac = actionCollection()->addAction( QStringLiteral( "P1KeyRight" ));
ac->setText(i18n("Player 1 Rotate Right"));
actionCollection()->setDefaultShortcut(ac, Qt::Key_F);
ac->setEnabled( false );
ac = actionCollection()->addAction( QLatin1String( "P1KeyAcc" ));
ac = actionCollection()->addAction( QStringLiteral( "P1KeyAcc" ));
ac->setText(i18n("Player 1 Accelerate"));
actionCollection()->setDefaultShortcut(ac, Qt::Key_E);
ac->setEnabled( false );
ac = actionCollection()->addAction( QLatin1String( "P1Shot" ));
ac = actionCollection()->addAction( QStringLiteral( "P1Shot" ));
ac->setText(i18n("Player 1 Shot"));
actionCollection()->setDefaultShortcut(ac, Qt::Key_D);
ac->setEnabled( false );
ac = actionCollection()->addAction( QLatin1String( "P1Mine" ));
ac = actionCollection()->addAction( QStringLiteral( "P1Mine" ));
ac->setText(i18n("Player 1 Mine"));
actionCollection()->setDefaultShortcut(ac, Qt::Key_A);
ac->setEnabled( false );
ac = actionCollection()->addAction( QLatin1String( "P2KeyLeft" ));
ac = actionCollection()->addAction( QStringLiteral( "P2KeyLeft" ));
ac->setText(i18n("Player 2 Rotate Left"));
actionCollection()->setDefaultShortcut(ac, Qt::Key_Left);
ac->setEnabled( false );
ac = actionCollection()->addAction( QLatin1String( "P2KeyRight" ));
ac = actionCollection()->addAction( QStringLiteral( "P2KeyRight" ));
ac->setText(i18n("Player 2 Rotate Right"));
actionCollection()->setDefaultShortcut(ac, Qt::Key_Right);
ac->setEnabled( false );
ac = actionCollection()->addAction( QLatin1String( "P2KeyAcc" ));
ac = actionCollection()->addAction( QStringLiteral( "P2KeyAcc" ));
ac->setText(i18n("Player 2 Accelerate"));
actionCollection()->setDefaultShortcut(ac, Qt::Key_Up);
ac->setEnabled( false );
ac = actionCollection()->addAction( QLatin1String( "P2Shot" ));
ac = actionCollection()->addAction( QStringLiteral( "P2Shot" ));
ac->setText(i18n("Player 2 Shot"));
actionCollection()->setDefaultShortcut(ac, Qt::Key_Down);
ac->setEnabled( false );
ac = actionCollection()->addAction( QLatin1String( "P2Mine" ));
ac = actionCollection()->addAction( QStringLiteral( "P2Mine" ));
ac->setText(i18n("Player 2 Mine"));
actionCollection()->setDefaultShortcut(ac, Qt::Key_Insert);
ac->setEnabled( false );
......
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