Commit 83ad8110 authored by Laurent Montel's avatar Laurent Montel 😁

Use new connect api + QStringLiteral

parent 084d34ef
......@@ -69,7 +69,7 @@ App::App(QWidget *parent)
m_board(nullptr)
{
m_board = new Board(this);
m_board->setObjectName(QLatin1String("board"));
m_board->setObjectName(QStringLiteral("board"));
setCentralWidget(m_board);
......@@ -111,9 +111,9 @@ void App::setupActions()
KStandardGameAction::redo(this, SLOT(redo()), actionCollection());
KStandardGameAction::hint(this, SLOT(hint()), actionCollection());
KToggleAction *soundAction = new KToggleAction(QIcon::fromTheme(QLatin1String("speaker")), i18n("Play Sounds"), this);
KToggleAction *soundAction = new KToggleAction(QIcon::fromTheme(QStringLiteral("speaker")), i18n("Play Sounds"), this);
soundAction->setChecked(Prefs::sounds());
actionCollection()->addAction(QLatin1String("sounds"), soundAction);
actionCollection()->addAction(QStringLiteral("sounds"), soundAction);
connect(soundAction, &KToggleAction::triggered, m_board, &Board::setSoundsEnabled);
// Settings
......@@ -247,14 +247,14 @@ void App::slotEndOfGame()
scoreInfo[KScoreDialog::Time] = timeString;
KScoreDialog scoreDialog(KScoreDialog::Name | KScoreDialog::Time | KScoreDialog::Score, this);
scoreDialog.addField(KScoreDialog::Custom1, i18n("Gravity"), QLatin1Literal("gravity"));
scoreDialog.addField(KScoreDialog::Custom1, i18n("Gravity"), QStringLiteral("gravity"));
// FIXME: This is bad, because the translated words are stored in the highscores and thus switching the language makes ugly things (schwarzer)
if (m_board->gravityFlag()) {
scoreInfo[KScoreDialog::Custom1] = i18n("Yes");
} else {
scoreInfo[KScoreDialog::Custom1] = i18n("No");
}
scoreDialog.setConfigGroup(QString::fromLatin1("%1x%2").arg(sizeX[Prefs::size()]).arg(sizeY[Prefs::size()]));
scoreDialog.setConfigGroup(QStringLiteral("%1x%2").arg(sizeX[Prefs::size()]).arg(sizeY[Prefs::size()]));
if (m_board->hasCheated()) {
QString message = i18n("\nYou could have been in the highscores\nif you did not use Undo or Hint.\nTry without them next time.");
......@@ -355,7 +355,7 @@ void App::setCheatModeEnabled(bool enabled)
void App::showHighscores()
{
KScoreDialog scoreDialog(KScoreDialog::Name | KScoreDialog::Time, this);
scoreDialog.addField(KScoreDialog::Custom1, i18n("Gravity"), QLatin1Literal("gravity"));
scoreDialog.addField(KScoreDialog::Custom1, i18n("Gravity"), QStringLiteral("gravity"));
scoreDialog.exec();
}
......@@ -366,13 +366,13 @@ void App::keyBindings()
void App::showSettingsDialog()
{
if (KConfigDialog::showDialog(QLatin1Literal("settings"))) {
if (KConfigDialog::showDialog(QStringLiteral("settings"))) {
return;
}
//Use the classes exposed by LibKmahjongg for our configuration dialog
KMahjonggConfigDialog *dialog = new KMahjonggConfigDialog(this, QLatin1Literal("settings"), Prefs::self());
dialog->addPage(new Settings(0), i18n("General"), QLatin1Literal("games-config-options"));
KMahjonggConfigDialog *dialog = new KMahjonggConfigDialog(this, QStringLiteral("settings"), Prefs::self());
dialog->addPage(new Settings(0), i18n("General"), QStringLiteral("games-config-options"));
dialog->addTilesetPage();
dialog->addBackgroundPage();
//dialog->setHelp(QString(), "kshisen");
......
......@@ -76,8 +76,8 @@ Board::Board(QWidget *parent)
m_gravityFlag(true), m_solvableFlag(false), m_chineseStyleFlag(false), m_tilesCanSlideFlag(false),
m_highlightedTile(-1),
m_paintConnection(false), m_paintPossibleMoves(false), m_paintInProgress(false),
m_soundPick(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("sounds/kshisen/tile-touch.ogg"))),
m_soundFall(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("sounds/kshisen/tile-fall-tile.ogg")))
m_soundPick(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("sounds/kshisen/tile-touch.ogg"))),
m_soundFall(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("sounds/kshisen/tile-fall-tile.ogg")))
{
m_tileRemove1.first = -1;
......@@ -706,7 +706,7 @@ void Board::paintEvent(QPaintEvent *e)
++pt1;
++pt2;
}
QTimer::singleShot(delay(), this, SLOT(undrawConnection()));
QTimer::singleShot(delay(), this, &Board::undrawConnection);
m_paintConnection = false;
}
if (m_paintPossibleMoves) {
......
......@@ -38,21 +38,21 @@ int main(int argc, char **argv)
QApplication a(argc, argv);
// Migrate pre-existing (4.x) configuration
Kdelibs4ConfigMigrator migrate(QLatin1String("kshisen"));
migrate.setConfigFiles(QStringList() << QLatin1String("kshisenrc"));
migrate.setUiFiles(QStringList() << QLatin1String("kshisenui.rc"));
Kdelibs4ConfigMigrator migrate(QStringLiteral("kshisen"));
migrate.setConfigFiles(QStringList() << QStringLiteral("kshisenrc"));
migrate.setUiFiles(QStringList() << QStringLiteral("kshisenui.rc"));
migrate.migrate();
KAboutData aboutData(QLatin1Literal("kshisen"), i18n("Shisen-Sho"),
QLatin1String(KSHISEN_VERSION " #" KSHISEN_COMMIT), i18n(description), KAboutLicense::GPL,
KAboutData aboutData(QStringLiteral("kshisen"), i18n("Shisen-Sho"),
QStringLiteral(KSHISEN_VERSION " #" KSHISEN_COMMIT), i18n(description), KAboutLicense::GPL,
i18n("(c) 1997, Mario Weilguni"));
aboutData.setHomepage(QLatin1Literal("http://games.kde.org/kshisen"));
aboutData.addAuthor(i18n("Frederik Schwarzer"), i18n("Current Maintainer"), QLatin1Literal("schwarzer@kde.org"));
aboutData.addAuthor(i18n("Dave Corrie"), i18n("Former Maintainer"), QLatin1Literal("kde@davecorrie.com"));
aboutData.addAuthor(i18n("Mario Weilguni"), i18n("Original Author"), QLatin1Literal("mweilguni@sime.com"));
aboutData.addCredit(i18n("Mauricio Piacentini"), i18n("KMahjonggLib integration for KDE4"), QLatin1Literal("mauricio@tabuleiro.com"));
aboutData.addCredit(i18n("Jason Lane"), i18n("Added 'tiles removed' counter<br/>Tile smooth-scaling and window resizing"), QLatin1Literal("jglane@btopenworld.com"));
aboutData.setHomepage(QStringLiteral("http://games.kde.org/kshisen"));
aboutData.addAuthor(i18n("Frederik Schwarzer"), i18n("Current Maintainer"), QStringLiteral("schwarzer@kde.org"));
aboutData.addAuthor(i18n("Dave Corrie"), i18n("Former Maintainer"), QStringLiteral("kde@davecorrie.com"));
aboutData.addAuthor(i18n("Mario Weilguni"), i18n("Original Author"), QStringLiteral("mweilguni@sime.com"));
aboutData.addCredit(i18n("Mauricio Piacentini"), i18n("KMahjonggLib integration for KDE4"), QStringLiteral("mauricio@tabuleiro.com"));
aboutData.addCredit(i18n("Jason Lane"), i18n("Added 'tiles removed' counter<br/>Tile smooth-scaling and window resizing"), QStringLiteral("jglane@btopenworld.com"));
aboutData.addCredit(i18n("Thanks also to everyone who should be listed here but is not!"));
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
......@@ -62,7 +62,7 @@ int main(int argc, char **argv)
parser.process(a);
aboutData.processCommandLine(&parser);
a.setWindowIcon(QIcon::fromTheme(QLatin1String("kshisen")));
a.setWindowIcon(QIcon::fromTheme(QStringLiteral("kshisen")));
KDBusService service;
......
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