diff --git a/kbblevelconfigurationwidget.cpp b/kbblevelconfigurationwidget.cpp index 8f6f389..85d5025 100644 --- a/kbblevelconfigurationwidget.cpp +++ b/kbblevelconfigurationwidget.cpp @@ -1,87 +1,87 @@ /* Copyright (c) 2006, 2007, Nicolas Roffet, This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include "kbblevelconfigurationwidget.h" #include #include #include #include "kbblevelconfigurationpreview.h" #include "kbbscalablegraphicwidget.h" #include "kbbthememanager.h" KBBLevelConfigurationWidget::KBBLevelConfigurationWidget(QWidget *parent, int c, int r, int b, KBBThemeManager* themeManager) : QWidget(parent) { QGridLayout *l = new QGridLayout(this); kcfg_balls = new KPluralHandlingSpinBox(this); - kcfg_balls->setObjectName( QLatin1String("kcfg_balls" )); + kcfg_balls->setObjectName( QStringLiteral("kcfg_balls" )); l->addWidget(kcfg_balls, 0, 0, 1, 2); kcfg_balls->setMinimum(1); kcfg_balls->setValue(b); kcfg_balls->setSuffix(ki18ncp("A number between 1 and 99 is displayed in front of it.", " ball", " balls")); connect(kcfg_balls, static_cast(&KPluralHandlingSpinBox::valueChanged), this, &KBBLevelConfigurationWidget::boxSizeChanged); kcfg_columns = new KPluralHandlingSpinBox(this); - kcfg_columns->setObjectName( QLatin1String("kcfg_columns" )); + kcfg_columns->setObjectName( QStringLiteral("kcfg_columns" )); l->addWidget(kcfg_columns, 1, 1); kcfg_columns->setMinimum(2); kcfg_columns->setMaximum(30); kcfg_columns->setValue(c); kcfg_columns->setSuffix(ki18ncp("A number between 2 and 30 is displayed in front of it.", " column", " columns")); connect(kcfg_columns, static_cast(&KPluralHandlingSpinBox::valueChanged), this, &KBBLevelConfigurationWidget::boxSizeChanged); kcfg_rows = new KPluralHandlingSpinBox(this); - kcfg_rows->setObjectName( QLatin1String("kcfg_rows" )); + kcfg_rows->setObjectName( QStringLiteral("kcfg_rows" )); l->addWidget(kcfg_rows, 2, 0); kcfg_rows->setMinimum(2); kcfg_rows->setMaximum(30); kcfg_rows->setValue(r); kcfg_rows->setSuffix(ki18ncp("A number between 2 and 30 is displayed in front of it.", " row", " rows")); connect(kcfg_rows, static_cast(&KPluralHandlingSpinBox::valueChanged), this, &KBBLevelConfigurationWidget::boxSizeChanged); m_view = new KBBLevelConfigurationPreview(this, themeManager); l->addWidget(m_view, 2, 1); boxSizeChanged(); } int KBBLevelConfigurationWidget::balls() const { return kcfg_balls->value(); } int KBBLevelConfigurationWidget::columns() const { return kcfg_columns->value(); } int KBBLevelConfigurationWidget::rows() const { return kcfg_rows->value(); } void KBBLevelConfigurationWidget::boxSizeChanged() { kcfg_balls->setMaximum(qMin(99, columns()*rows() - 1)); m_view->preview(balls(), columns(), rows()); } diff --git a/kbbmainwindow.cpp b/kbbmainwindow.cpp index 3feb3d3..b10808f 100644 --- a/kbbmainwindow.cpp +++ b/kbbmainwindow.cpp @@ -1,548 +1,548 @@ // // KBlackBox // // A simple game inspired by an emacs module // /*************************************************************************** * Copyright (c) 1999-2000, Robert Cimrman * * cimrman3@students.zcu.cz * * * * Copyright (c) 2007, Nicolas Roffet * * nicolas-kde@roffet.com * * * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * ***************************************************************************/ #include "kbbmainwindow.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "kbbgamedoc.h" #include "kbbgraphicsitemtutorialmarker.h" #include "kbblevelconfigurationwidget.h" #include "kbbprefs.h" #include "kbbscalablegraphicwidget.h" #include "kbbthememanager.h" #include "kbbtutorial.h" // // Constructor / Destructor // KBBMainWindow::KBBMainWindow() { m_boardEnabled = false; //Read configuration options m_customBallNumber = KBBPrefs::balls(); m_customColumns = KBBPrefs::columns(); m_customRows = KBBPrefs::rows(); // Status bar //QT5 statusBar()->insertPermanentItem("", SRUN, 1); //QT5 statusBar()->insertPermanentItem(i18n("Time: 00:00"), STIME, 1); //QT5 statusBar()->insertPermanentItem(i18n("Size: 00 x 00"), SSIZE); //QT5 statusBar()->setItemAlignment(SRUN, Qt::AlignLeft | Qt::AlignVCenter); // Difficulty Kg::difficulty()->addStandardLevelRange( KgDifficultyLevel::VeryEasy, KgDifficultyLevel::ExtremelyHard, KgDifficultyLevel::Medium //default ); Kg::difficulty()->addLevel(new KgDifficultyLevel( 1000, QByteArray("config"), i18nc("Difficulty level title", "Configurable") )); KgDifficultyGUI::init(this); - connect(Kg::difficulty(), SIGNAL(currentLevelChanged(const KgDifficultyLevel*)), SLOT(levelChanged())); + connect(Kg::difficulty(), &KgDifficulty::currentLevelChanged, this, &KBBMainWindow::levelChanged); // Menu "Game" KStandardGameAction::gameNew(this, SLOT(newGame()), actionCollection()); m_pauseAction = KStandardGameAction::pause(this, SLOT(pause(bool)), actionCollection()); - QAction* tutorial = actionCollection()->addAction( QLatin1String( "game_tutorial" )); + QAction* tutorial = actionCollection()->addAction( QStringLiteral( "game_tutorial" )); tutorial->setText(i18n("Start Tutorial")); - tutorial->setIcon(QIcon::fromTheme( QLatin1String( "footprint" ))); + tutorial->setIcon(QIcon::fromTheme( QStringLiteral( "footprint" ))); tutorial->setToolTip(i18n("Start tutorial")); tutorial->setWhatsThis(i18n("The tutorial is a fast, user friendly and interactive way to learn the rules of the game. Start it if you do not know them!")); connect(tutorial, &QAction::triggered, this, &KBBMainWindow::startTutorial); KStandardGameAction::quit(this, SLOT(close()), actionCollection()); - QAction* sandbox = actionCollection()->addAction( QLatin1String( "game_sandbox" )); + QAction* sandbox = actionCollection()->addAction( QStringLiteral( "game_sandbox" )); sandbox->setText(i18n("New Sandbox Game")); sandbox->setToolTip(i18n("Start a new sandbox game")); sandbox->setWhatsThis(i18n("

In a sandbox game, the solution is displayed at the beginning of the game. This is useful to understand the game principles.

However: after a while, it is not really fun and you should try to start a real game!

")); connect(sandbox, &QAction::triggered, this, &KBBMainWindow::startSandbox); KStandardGameAction::highscores(this, SLOT(showHighscores()), actionCollection()); // Menu "Move" - m_doneAction = actionCollection()->addAction( QLatin1String( "move_done" )); + m_doneAction = actionCollection()->addAction( QStringLiteral( "move_done" )); m_doneAction->setText(i18nc("This is the last action of a game to check the result, when the user is done.", "Done!")); m_doneAction->setWhatsThis(i18n("
  • First, you have to place all the balls on the black box. To guess the correct positions of the balls and see how they interact with laser beams, you should use the lasers that are positioned around the black box.
  • When you think you are done, you should click here.

Note that it is only possible to click here if you have placed the correct number of balls.

")); - m_doneAction->setIcon(QIcon::fromTheme( QLatin1String( "dialog-ok" ))); + m_doneAction->setIcon(QIcon::fromTheme( QStringLiteral( "dialog-ok" ))); connect(m_doneAction, &QAction::triggered, this, &KBBMainWindow::done); m_solveAction = KStandardGameAction::solve(this, SLOT(solve()), actionCollection()); m_solveAction->setToolTip(i18n("Give up the game")); m_solveAction->setWhatsThis(i18n("

Choose \"Solve\" if you want to give up the current game. The solution will be displayed.

If you placed all the balls and do not want to give up, choose \"Done!\".

")); // Menu "Settings" KStandardAction::preferences(this, SLOT(settingsDialog()), actionCollection()); - m_toggleCursorAction = actionCollection()->addAction( QLatin1String( "toggle_cursor" )); + m_toggleCursorAction = actionCollection()->addAction( QStringLiteral( "toggle_cursor" )); m_toggleCursorAction->setText(i18n("Enable highlight under mouse")); m_toggleCursorAction->setCheckable(true); const KConfigGroup group = KSharedConfig::openConfig()->group("default"); m_toggleCursorAction->setChecked(group.readEntry("highlight_enabled", true)); connect(m_toggleCursorAction, &QAction::triggered, this, &KBBMainWindow::toggleCursor); // Theme manager QString svgzFile = KBBPrefs::theme(); if (!QFile(svgzFile).exists()) - svgzFile = QStandardPaths::locate(QStandardPaths::AppDataLocation, QLatin1Literal("pics/kblackbox.svgz")); + svgzFile = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("pics/kblackbox.svgz")); m_themeManager = new KBBThemeManager(svgzFile); // Tutorial widget m_tutorial = new KBBTutorial(this); // Board m_gameDoc = new KBBGameDoc(this, m_tutorial); connect(m_gameDoc, &KBBGameDoc::updateStats, this, &KBBMainWindow::updateStats); connect(m_gameDoc, &KBBGameDoc::isRunning, this, &KBBMainWindow::setRunning); // Game widget m_gameWidget = new KBBScalableGraphicWidget(m_gameDoc, m_themeManager, m_doneAction); m_tutorial->setGameWidget(m_gameWidget, new KBBGraphicsItemTutorialMarker(m_gameWidget, m_themeManager, KBBTutorial::COLUMNS, KBBTutorial::ROWS)); // Central Widget m_centralWidget = new QWidget(this); QHBoxLayout *widgetLayout = new QHBoxLayout(); widgetLayout->setContentsMargins(0, 0, 0, 0); m_centralWidget->setLayout(widgetLayout); widgetLayout->addWidget(m_gameWidget); widgetLayout->addWidget(m_tutorial); setCentralWidget(m_centralWidget); // Keyboard only - QAction * action = actionCollection()->addAction( QLatin1String( "move_down" ) ); + QAction * action = actionCollection()->addAction( QStringLiteral( "move_down" ) ); action->setText( i18n("Move Down") ); connect(action, &QAction::triggered, m_gameWidget, &KBBScalableGraphicWidget::keyboardMoveDown); actionCollection()->setDefaultShortcut(action, Qt::Key_Down); addAction(action); - action = actionCollection()->addAction( QLatin1String( "move_up" ) ); + action = actionCollection()->addAction( QStringLiteral( "move_up" ) ); action->setText( i18n("Move Up") ); connect(action, &QAction::triggered, m_gameWidget, &KBBScalableGraphicWidget::keyboardMoveUp); actionCollection()->setDefaultShortcut(action,Qt::Key_Up); addAction(action); - action = actionCollection()->addAction( QLatin1String( "move_left" ) ); + action = actionCollection()->addAction( QStringLiteral( "move_left" ) ); action->setText( i18n("Move Left") ); connect(action, &QAction::triggered, m_gameWidget, &KBBScalableGraphicWidget::keyboardMoveLeft); actionCollection()->setDefaultShortcut(action, Qt::Key_Left); addAction(action); - action = actionCollection()->addAction( QLatin1String( "move_right" ) ); + action = actionCollection()->addAction( QStringLiteral( "move_right" ) ); action->setText( i18n("Move Right") ); connect(action, &QAction::triggered, m_gameWidget, &KBBScalableGraphicWidget::keyboardMoveRight); actionCollection()->setDefaultShortcut(action, Qt::Key_Right); addAction(action); - action = actionCollection()->addAction( QLatin1String( "switch_ball" )); + action = actionCollection()->addAction( QStringLiteral( "switch_ball" )); action->setText(i18n("Switch Ball or Shoot Laser")); connect(action, &QAction::triggered, m_gameWidget, &KBBScalableGraphicWidget::keyboardEnter); actionCollection()->setDefaultShortcut(action, Qt::Key_Return); addAction(action); - action = actionCollection()->addAction( QLatin1String( "switch_marker" )); + action = actionCollection()->addAction( QStringLiteral( "switch_marker" )); action->setText(i18n("Switch Marker")); connect(action, &QAction::triggered, m_gameWidget, &KBBScalableGraphicWidget::keyboardSpace); actionCollection()->setDefaultShortcut(action, Qt::Key_Space); addAction(action); m_gameClock = new KGameClock(this, KGameClock::MinSecOnly); connect(m_gameClock, &KGameClock::timeChanged, this, &KBBMainWindow::updateStats); connect(m_gameClock, &KGameClock::timeChanged, m_gameDoc, &KBBGameDoc::timeChanged); levelChanged(); setupGUI(); if (m_toggleCursorAction->isChecked()) toggleCursor(); // start a new game startGame(false); } KBBMainWindow::~KBBMainWindow() { KBBPrefs::self()->save(); delete m_gameWidget; delete m_themeManager; } // // Public slots // void KBBMainWindow::levelChanged() { KgDifficultyLevel::StandardLevel level = Kg::difficultyLevel(); switch(level) { case KgDifficultyLevel::VeryEasy: m_ballNumber = 2; m_columns = 6; m_rows = 6; break; case KgDifficultyLevel::Easy: default: m_ballNumber = 4; m_columns = 8; m_rows = 8; level = KgDifficultyLevel::Medium; break; case KgDifficultyLevel::Medium: m_ballNumber = 6; m_columns = 10; m_rows = 10; break; case KgDifficultyLevel::Hard: m_ballNumber = 8; m_columns = 12; m_rows = 12; break; case KgDifficultyLevel::VeryHard: m_ballNumber = 11; m_columns = 14; m_rows = 10; break; case KgDifficultyLevel::ExtremelyHard: m_ballNumber = 15; m_columns = 20; m_rows = 12; break; case KgDifficultyLevel::Custom: m_gameWidget->popupText(i18nc("The text may not be too wide. So please use some HTML-BR-tags to have something more or less as wide as in english. Thanks!", "Note: You can change
the parameters of
custom games in the
Settings dialog.")); break; } m_level = level; startGame(m_sandboxMode); } void KBBMainWindow::setRunning(bool r) { // Difficulty Kg::difficulty()->setGameRunning(r); // Clock if (r) { m_gameClock->resume(); m_gameDoc->timeChanged(); // It's important to end the current seconde before pausing so that the player cannot cheat with pause. } else m_gameClock->pause(); // Pause m_pauseAction->setEnabled(r); } void KBBMainWindow::updateStats() { int ballsLeftToPlace = m_gameDoc->numberOfBallsToPlace() - m_gameDoc->numberOfBallsPlaced(); m_doneAction->setEnabled(m_solveAction->isEnabled() && (ballsLeftToPlace==0)); if (ballsLeftToPlace<0) m_doneAction->setToolTip(i18np("First, you need to remove 1 ball from the black box.", "First, you need to remove %1 balls from the black box.", -ballsLeftToPlace)); else if (ballsLeftToPlace==0) { m_doneAction->setToolTip(i18n("To check if you successfully guessed the ball positions, click here!")); } else if (ballsLeftToPlace>0) { m_doneAction->setToolTip(i18np("You need to place 1 more ball on the black box.", "You need to place %1 more balls on the black box.", ballsLeftToPlace)); } if (!m_boardEnabled) m_doneAction->setToolTip(i18n("Game over.")); if (m_pauseAction->isChecked()) m_doneAction->setToolTip(i18n("Game paused.")); // Status bar if (m_tutorial->isVisible()) { //QT5 statusBar()->changeItem(i18n("Tutorial"), SRUN ); } if (!m_tutorial->isVisible()) { if (m_boardEnabled) { if (ballsLeftToPlace<0) { //QT5 statusBar()->changeItem((i18np("1 ball too many!", "%1 balls too many!", -ballsLeftToPlace)), SRUN); } else if (ballsLeftToPlace==0) { //QT5 statusBar()->changeItem(i18n("No more balls to place"), SRUN); } else if (ballsLeftToPlace>0) { //QT5 statusBar()->changeItem(i18np("1 ball to place", "%1 balls to place", ballsLeftToPlace), SRUN); } } else { //QT5 statusBar()->changeItem(i18n("Game over"), SRUN ); } } //QT5 statusBar()->changeItem(i18n("Time: %1", m_gameClock->timeString()), STIME); //QT5 statusBar()->changeItem( i18n("Size: %1 x %2", m_gameDoc->columns(), m_gameDoc->rows()), SSIZE ); // 2. Info Widget m_gameWidget->setScore(m_gameDoc->score()); } // // Private slots // void KBBMainWindow::done() { if (m_tutorial->isVisible() && !m_tutorial->maySolve()) { KMessageBox::sorry(this, i18n("Clicking on \"Done!\" is the normal way to check the positions of the balls at the end of the game. However, it is not possible in the tutorial to end the game before you reached the last step.\nPlease first finish the tutorial."), i18n("Check positions")); } else { solving(); const int score = m_gameDoc->score(); QString s; if (score <= (m_ballNumber*35)) { s = i18nc("The text may not be too wide. So please use some HTML-BR-tags to have something more or less as wide as in english. Thanks!", "Your final score is: %1.
You did really well!", score); if (m_sandboxMode) - s += QString::fromLatin1("

") + i18nc("The text may not be too wide. So please use some HTML-BR-tags to have something more or less as wide as in english. Thanks!", "But it does not count
because it is the sandbox!"); + s += QLatin1String("

") + i18nc("The text may not be too wide. So please use some HTML-BR-tags to have something more or less as wide as in english. Thanks!", "But it does not count
because it is the sandbox!"); } else s = i18nc("The text may not be too wide. So please use some HTML-BR-tags to have something more or less as wide as in english. Thanks!", "Your final score is: %1.
I guess you need more practice.", score); if ((!m_tutorial->isVisible()) && (!m_sandboxMode) && (Kg::difficultyLevel() != KgDifficultyLevel::Custom) && (score scoreDialog = new KScoreDialog(KScoreDialog::Score | KScoreDialog::Name, this); scoreDialog->initFromDifficulty(Kg::difficulty()); KScoreDialog::FieldInfo scoreInfo; scoreInfo[KScoreDialog::Score].setNum(score); if(scoreDialog->addScore(scoreInfo, KScoreDialog::LessIsMore) != 0) scoreDialog->exec(); delete scoreDialog; } m_gameWidget->popupText(s); } } void KBBMainWindow::newGame() { if (mayAbortGame()) startGame(false); } void KBBMainWindow::pause(bool state) { if (state) { m_gameClock->pause(); m_gameWidget->popupText(i18n("Game paused.
Press \"%1\" to resume.", m_pauseAction->shortcut().toString(QKeySequence::NativeText)), 0); } else { m_gameClock->resume(); m_gameWidget->popupText(QString()); } m_solveAction->setEnabled(!state); updateStats(); m_gameWidget->setPause(state); } void KBBMainWindow::settingsChanged() { m_customBallNumber = m_levelConfig->balls(); m_customColumns = m_levelConfig->columns(); m_customRows = m_levelConfig->rows(); if (m_level==KgDifficultyLevel::Custom) { bool mayRestart = true; if (m_gameDoc->gameReallyStarted()) if (KMessageBox::questionYesNo(this, i18n("Do you want to cancel the current custom game and start a new one with the new parameters?"), QString(), KGuiItem(i18n("Start new game"))) == KMessageBox::No) mayRestart = false; if (mayRestart) startGame(m_sandboxMode); } } void KBBMainWindow::settingsDialog() { - if (!KConfigDialog::showDialog(QLatin1Literal("settings"))) { - KConfigDialog *dialog = new KConfigDialog(this, QLatin1Literal("settings"), KBBPrefs::self()); + if (!KConfigDialog::showDialog(QStringLiteral("settings"))) { + KConfigDialog *dialog = new KConfigDialog(this, QStringLiteral("settings"), KBBPrefs::self()); m_levelConfig = new KBBLevelConfigurationWidget(dialog, m_customBallNumber, m_customColumns, m_customRows, m_themeManager); - dialog->addPage(m_levelConfig, i18n("Custom Game"), QLatin1Literal("games-config-custom")); + dialog->addPage(m_levelConfig, i18n("Custom Game"), QStringLiteral("games-config-custom")); connect(dialog, &KConfigDialog::settingsChanged, this, &KBBMainWindow::settingsChanged); //QT5 dialog->setHelp(QString(), "kblackbox"); dialog->show(); } } void KBBMainWindow::showHighscores() { KScoreDialog scoreDialog(KScoreDialog::Score | KScoreDialog::Name, this); scoreDialog.initFromDifficulty(Kg::difficulty()); scoreDialog.exec(); } void KBBMainWindow::solve() { if (m_tutorial->isVisible() && !m_tutorial->maySolve()) { KMessageBox::sorry(this, i18n("Sorry, you may not give up during the tutorial."), i18n("Solve")); } else { if (m_gameDoc->numberOfBallsToPlace()==m_gameDoc->numberOfBallsPlaced()) { if (KMessageBox::warningContinueCancel(this, i18n("You placed all the balls. Great!\nYou should now click on \"Done!\" to end the game and check if you guessed correctly.\nSo, do you really want to give up this game?"), QString(), KGuiItem(i18n("Give up"))) == KMessageBox::Continue) solving(); } else if (KMessageBox::warningContinueCancel(this, i18np("You should place %1 ball!\n", "You should place %1 balls!\n", m_gameDoc->numberOfBallsToPlace()) + i18np("You have placed %1.\n", "You have placed %1.\n", m_gameDoc->numberOfBallsPlaced()) + i18n("Do you really want to give up this game?"), QString(), KGuiItem(i18n("Give up"))) == KMessageBox::Continue) solving(); } } void KBBMainWindow::startSandbox() { if (mayAbortGame()) { startGame(true); m_gameWidget->popupText(i18nc("The text may not be too wide. So please use some HTML-BR-tags to have something more or less as wide as in english. Thanks!", "Note: In the sandbox mode,
the solution is already displayed.
Have fun!")); } } void KBBMainWindow::startTutorial() { if (mayAbortGame()) { m_gameDoc->startTutorial(); m_solveAction->setEnabled(true); m_pauseAction->setChecked(false); Kg::difficulty()->setEditable(false); // Reset clock but don't start it yet. m_gameClock->restart(); m_gameClock->pause(); updateStats(); } } void KBBMainWindow::toggleCursor() { m_gameWidget->toggleCursor(); KConfigGroup group = KSharedConfig::openConfig()->group("default"); group.writeEntry("highlight_enabled", m_toggleCursorAction->isChecked()); } // // Private // bool KBBMainWindow::mayAbortGame() { bool mayAbort = true; if (m_gameDoc->gameReallyStarted()) mayAbort = ( KMessageBox::warningContinueCancel(0, i18n("This will be the end of the current game!"), QString(), KGuiItem(i18n("Start new game"))) == KMessageBox::Continue ); return mayAbort; } void KBBMainWindow::solving() { m_boardEnabled = false; m_solveAction->setEnabled(false); m_doneAction->setEnabled(false); m_gameDoc->gameOver(); m_gameWidget->solve(false); updateStats(); } void KBBMainWindow::startGame(bool sandboxMode) { if (m_level==KgDifficultyLevel::Custom) { m_ballNumber = m_customBallNumber; m_columns = m_customColumns; m_rows = m_customRows; } m_boardEnabled = true; m_sandboxMode = sandboxMode; m_solveAction->setEnabled(true); m_pauseAction->setChecked(false); Kg::difficulty()->setEditable(true); m_tutorial->hide(); m_gameDoc->newGame(m_ballNumber, m_columns, m_rows); m_gameWidget->newGame(m_columns, m_rows, m_ballNumber); if (m_sandboxMode) m_gameWidget->solve(true); // Reset clock but don't start it yet. m_gameClock->restart(); m_gameClock->pause(); updateStats(); } diff --git a/kbbthememanager.cpp b/kbbthememanager.cpp index b01bff2..01ddfa5 100644 --- a/kbbthememanager.cpp +++ b/kbbthememanager.cpp @@ -1,231 +1,231 @@ // // KBlackBox // // A simple game inspired by an emacs module // /*************************************************************************** * Copyright (c) 2007, Nicolas Roffet * * nicolas-kde@roffet.com * * * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * ***************************************************************************/ #include "kbbthememanager.h" #include #include #include #include #include #include #include "kbbscalablegraphicwidget.h" // // Constructor / Destructor // KBBThemeManager::KBBThemeManager(const QString &svgzFileName) { // 1. for SVG items m_svgRenderer.load(svgzFileName); // 2. for non SVG items QFile svgzFile(svgzFileName); - QIODevice *f = KFilterDev::device(&svgzFile, QString::fromLatin1("application/x-gzip"), false); + QIODevice *f = KFilterDev::device(&svgzFile, QStringLiteral("application/x-gzip"), false); if (f) { QDomDocument doc; if (doc.setContent(f,true)) { m_root = doc.documentElement(); } delete f; } } // // Public // QColor KBBThemeManager::color(const KBBScalableGraphicWidget::itemType itemType) { - return QColor(value(itemType, QLatin1Literal("stroke"))); + return QColor(value(itemType, QStringLiteral("stroke"))); } QString KBBThemeManager::elementId(const KBBScalableGraphicWidget::itemType itemType) { QString eId; switch (itemType) { case KBBScalableGraphicWidget::background: - eId = QLatin1Literal("background"); + eId = QStringLiteral("background"); break; case KBBScalableGraphicWidget::blackbox: - eId = QLatin1Literal("blackbox"); + eId = QStringLiteral("blackbox"); break; case KBBScalableGraphicWidget::blackboxGrid: - eId = QLatin1Literal("blackbox_grid"); + eId = QStringLiteral("blackbox_grid"); break; case KBBScalableGraphicWidget::cursor: - eId = QLatin1Literal("cursor"); + eId = QStringLiteral("cursor"); break; case KBBScalableGraphicWidget::informationBackground: - eId = QLatin1Literal("information_background"); + eId = QStringLiteral("information_background"); break; case KBBScalableGraphicWidget::interactionInfoDeflection: - eId = QLatin1Literal("interaction_info_deflection"); + eId = QStringLiteral("interaction_info_deflection"); break; case KBBScalableGraphicWidget::interactionInfoHit: - eId = QLatin1Literal("interaction_info_hit"); + eId = QStringLiteral("interaction_info_hit"); break; case KBBScalableGraphicWidget::interactionInfoNothing: - eId = QLatin1Literal("interaction_info_nothing"); + eId = QStringLiteral("interaction_info_nothing"); break; case KBBScalableGraphicWidget::interactionInfoReflection: - eId = QLatin1Literal("interaction_info_reflection"); + eId = QStringLiteral("interaction_info_reflection"); break; case KBBScalableGraphicWidget::interactionInfoReflectionSym: - eId = QLatin1Literal("interaction_info_reflection_sym"); + eId = QStringLiteral("interaction_info_reflection_sym"); break; case KBBScalableGraphicWidget::laser0: - eId = QLatin1Literal("laser_0"); + eId = QStringLiteral("laser_0"); break; case KBBScalableGraphicWidget::laser90: - eId = QLatin1Literal("laser_90"); + eId = QStringLiteral("laser_90"); break; case KBBScalableGraphicWidget::laser180: - eId = QLatin1Literal("laser_180"); + eId = QStringLiteral("laser_180"); break; case KBBScalableGraphicWidget::laser270: - eId = QLatin1Literal("laser_270"); + eId = QStringLiteral("laser_270"); break; case KBBScalableGraphicWidget::markerNothing: - eId = QLatin1Literal("marker_nothing"); + eId = QStringLiteral("marker_nothing"); break; case KBBScalableGraphicWidget::playerBall: - eId = QLatin1Literal("player_ball"); + eId = QStringLiteral("player_ball"); break; case KBBScalableGraphicWidget::playerRay: - eId = QLatin1Literal("player_ray"); + eId = QStringLiteral("player_ray"); break; case KBBScalableGraphicWidget::resultBackground: - eId = QLatin1Literal("result_background"); + eId = QStringLiteral("result_background"); break; case KBBScalableGraphicWidget::resultBackgroundHighlight: - eId = QLatin1Literal("result_background_highlight"); + eId = QStringLiteral("result_background_highlight"); break; case KBBScalableGraphicWidget::resultHit: - eId = QLatin1Literal("result_hit"); + eId = QStringLiteral("result_hit"); break; case KBBScalableGraphicWidget::resultReflection: - eId = QLatin1Literal("result_reflection"); + eId = QStringLiteral("result_reflection"); break; case KBBScalableGraphicWidget::rightPlayerBall: - eId = QLatin1Literal("right_player_ball"); + eId = QStringLiteral("right_player_ball"); break; case KBBScalableGraphicWidget::solutionBall: - eId = QLatin1Literal("solution_ball"); + eId = QStringLiteral("solution_ball"); break; case KBBScalableGraphicWidget::solutionRay: - eId = QLatin1Literal("solution_ray"); + eId = QStringLiteral("solution_ray"); break; case KBBScalableGraphicWidget::tutorialMarker: - eId = QLatin1Literal("tutorial_marker"); + eId = QStringLiteral("tutorial_marker"); break; case KBBScalableGraphicWidget::unsureBall: - eId = QLatin1Literal("unsure_ball"); + eId = QStringLiteral("unsure_ball"); break; case KBBScalableGraphicWidget::wrongPlayerBall: - eId = QLatin1Literal("wrong_player_ball"); + eId = QStringLiteral("wrong_player_ball"); break; default: - eId = QLatin1Literal("none"); + eId = QStringLiteral("none"); break; } return eId; } Qt::PenStyle KBBThemeManager::style(const KBBScalableGraphicWidget::itemType itemType) { - if (value(itemType, QLatin1Literal("stroke-dasharray"))==QLatin1String("none")) { + if (value(itemType, QStringLiteral("stroke-dasharray"))==QLatin1String("none")) { return Qt::SolidLine; } else return Qt::DotLine; } QSvgRenderer* KBBThemeManager::svgRenderer() { return &m_svgRenderer; } qreal KBBThemeManager::width(const KBBScalableGraphicWidget::itemType itemType) { - return value(itemType, QLatin1Literal("stroke-width")).toFloat(); + return value(itemType, QStringLiteral("stroke-width")).toFloat(); } int KBBThemeManager::zValue(const KBBScalableGraphicWidget::itemType itemType) { return itemType; } // // Private // QString KBBThemeManager::value(const KBBScalableGraphicWidget::itemType itemType, const QString &styleElement) { const QString id = elementId(itemType); QString style; QString v; QDomNode node = m_root.firstChild(); while(!node.isNull()) { - if (node.toElement().attribute(QLatin1Literal("id")) == id) - style = node.toElement().attribute(QLatin1Literal("style")); + if (node.toElement().attribute(QStringLiteral("id")) == id) + style = node.toElement().attribute(QStringLiteral("style")); node = node.nextSibling(); } QStringList styleList = style.split(QLatin1Char(';')); for (int i = 0; i < styleList.size(); i++) { styleList.replace(i, styleList.at(i).trimmed()); if (styleList.at(i).startsWith(styleElement + QLatin1Char(':'))) { QString s = styleList.at(i); v = s.right(s.length()-styleElement.length()-1); } } return v; } diff --git a/kbbtutorial.cpp b/kbbtutorial.cpp index 2c1ff67..276fd4e 100644 --- a/kbbtutorial.cpp +++ b/kbbtutorial.cpp @@ -1,315 +1,315 @@ // // KBlackBox // // A simple game inspired by an emacs module // /*************************************************************************** * Copyright (c) 2007, Nicolas Roffet * * nicolas-kde@roffet.com * * * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * ***************************************************************************/ #include "kbbtutorial.h" #include #include #include #include #include #include #include #include #include #include #include "kbbgraphicsitemtutorialmarker.h" #include "kbbscalablegraphicwidget.h" // // Constructor / Destructor // KBBTutorial::KBBTutorial(QWidget* parent) : QGroupBox(i18n("Tutorial"), parent) { m_marker = 0; m_gameWidget = 0; setMinimumSize(QSize(WIDTH, WIDTH)); setFixedWidth(WIDTH); QVBoxLayout *tutorialLayout = new QVBoxLayout(); setLayout(tutorialLayout); setFlat(true); m_progression = new QProgressBar(this); m_progression->setTextVisible(true); - m_progression->setFormat(QLatin1Literal("%v / %m")); + m_progression->setFormat(QStringLiteral("%v / %m")); m_progression->setMinimum(FIRST_STEP-1); m_progression->setMaximum(LAST_STEP); m_progression->setWhatsThis(i18n("Displays the progress of the tutorial.")); tutorialLayout->addWidget(m_progression); m_title = new QLabel(this); tutorialLayout->addWidget(m_title, 0, Qt::AlignHCenter); m_explanation = new KTextEdit(this); m_explanation->setReadOnly(true); m_explanation->setFrameStyle(QFrame::NoFrame); m_explanation->setAlignment(Qt::AlignJustify); tutorialLayout->addWidget(m_explanation); tutorialLayout->addStretch(); QHBoxLayout *actionLayout = new QHBoxLayout(); tutorialLayout->addLayout(actionLayout); QLabel* iconLabel = new QLabel(this); iconLabel->setFixedSize(24, 24); - iconLabel->setPixmap(QIcon::fromTheme( QLatin1String( "go-next" )).pixmap(24, 24)); + iconLabel->setPixmap(QIcon::fromTheme( QStringLiteral( "go-next" )).pixmap(24, 24)); actionLayout->addWidget(iconLabel, 0, Qt::AlignVCenter); m_playerAction = new QLabel(this); m_playerAction->setWhatsThis(i18n("Describes what you should do to reach the next tutorial step.")); m_playerAction->setAlignment(Qt::AlignLeft); m_playerAction->setWordWrap(true); m_playerAction->setFrameStyle(QFrame::StyledPanel); - m_playerAction->setStyleSheet(QLatin1Literal("border-style: none")); + m_playerAction->setStyleSheet(QStringLiteral("border-style: none")); actionLayout->addWidget(m_playerAction, 0, Qt::AlignVCenter); QHBoxLayout *buttonLayout = new QHBoxLayout(); tutorialLayout->addLayout(buttonLayout); - m_buttonPrevious = new QPushButton(QIcon::fromTheme( QLatin1String( "go-previous") ), i18nc("Previous tutorial step", "&Previous"), this); + m_buttonPrevious = new QPushButton(QIcon::fromTheme( QStringLiteral( "go-previous") ), i18nc("Previous tutorial step", "&Previous"), this); m_buttonPrevious->setWhatsThis(i18n("Go back to the previous tutorial step.")); connect(m_buttonPrevious, &QPushButton::clicked, this, &KBBTutorial::previousStep); buttonLayout->addWidget(m_buttonPrevious); - m_buttonNext = new QPushButton(QIcon::fromTheme( QLatin1String( "go-next")) , i18nc("Next tutorial step", "&Next"), this); + m_buttonNext = new QPushButton(QIcon::fromTheme( QStringLiteral( "go-next")) , i18nc("Next tutorial step", "&Next"), this); m_buttonNext->setWhatsThis(i18n("Go to the next tutorial step.")); connect(m_buttonNext, &QPushButton::clicked, this, &KBBTutorial::nextStep); m_buttonNext->setDefault(true); buttonLayout->addWidget(m_buttonNext); } // // Public // void KBBTutorial::hideEvent(QHideEvent*) { showMarker(MAY_NOT_USE); } bool KBBTutorial::maySolve() { return m_step==LAST_STEP; } bool KBBTutorial::mayShootRay(const int incomingPosition) { if (m_step==LAST_STEP) return true; else if (incomingPosition==m_laserToUse) { nextStep(); return true; } else { // Highlight m_playerAction to show what the player has to do - m_playerAction->setStyleSheet(QLatin1Literal("color: black; background-color: #de0000")); - QTimer::singleShot(HIGHLIGHT_TIME, this, SLOT(restoreStyle())); + m_playerAction->setStyleSheet(QStringLiteral("color: black; background-color: #de0000")); + QTimer::singleShot(HIGHLIGHT_TIME, this, &KBBTutorial::restoreStyle); return false; } } void KBBTutorial::setGameWidget(KBBScalableGraphicWidget* gameWidget, KBBGraphicsItemTutorialMarker* marker) { m_gameWidget = gameWidget; m_marker = marker; } void KBBTutorial::setStep(const int step) { Q_ASSERT((step>=FIRST_STEP) && (step<=LAST_STEP)); Q_ASSERT(m_gameWidget!=0); m_step = step; setNewStepMaxAllowed(m_step); if (m_step!=LAST_STEP) m_gameWidget->removeAllBalls(); switch (m_step) { case FIRST_STEP: m_gameWidget->newGame(KBBTutorial::COLUMNS, KBBTutorial::ROWS, KBBTutorial::BALLS); setTexts(i18n("Welcome!"), i18n("This tutorial will teach you how to play KBlackBox, using a simple example.

We are playing with a square black box of 6 columns and 6 rows. It has 3 balls hidden inside it and 24 laser probes around it.

The goal is to find the positions of the balls."), i18n("Click on \"Next\"")); m_laserToUse = MAY_NOT_USE; setNewStepMaxAllowed(FIRST_STEP+1); break; case FIRST_STEP+1: setTexts(i18n("Black box principles"), i18n("The balls are not visible, but we can shoot laser beams into the box at different entry points and observe if the laser beams leave the box, and if they do, where they come out.

The laser beams interact with the balls in various ways."), i18n("Please click on the marked laser to shoot a beam into the black box.")); m_laserToUse = 0; m_gameWidget->drawRay(0); break; case FIRST_STEP+2: setTexts(i18n("No interaction"), i18n("If a laser beam does not interact with any ball in the black box, it comes out at the point opposite the entry point.

Example: Suppose we have 3 balls in the box as shown. They will not affect laser beam \"1\".

As the game progresses, each pair of entry/exit points is marked with a different number."), i18n("Now shoot the marked laser to discover the first kind of interaction.")); m_laserToUse = 4; m_gameWidget->addBallUnsure(8); m_gameWidget->addBallUnsure(27); m_gameWidget->addBallUnsure(34); m_gameWidget->drawRay(0); break; case FIRST_STEP+3: setTexts(i18n("Hit"), i18n("A direct impact on a ball is called a \"hit\". A beam that hits a ball does not emerge from the black box.

Example: The beam might have hit a ball at the position shown, but the exact position of the hit is not certain: There are many other possibilities."), i18n("Shoot the marked laser to discover the second kind of interaction.")); m_laserToUse = 22; m_gameWidget->addBallUnsure(28); m_gameWidget->drawRay(4); break; case FIRST_STEP+4: setTexts(i18n("Simple deflection"), i18n("The interaction of a beam that does not actually hit a ball, but aims to one side of it, is called a \"deflection\". The angle of deflection of the beam is always 90 degrees.

Example: The ball shown would deflect beam \"2\" upward, as shown, but this is not the only possibility."), i18n("Click on \"Next\" to see another combination of ball positions that deflects the laser beam as shown.")); m_laserToUse = MAY_NOT_USE; setNewStepMaxAllowed(FIRST_STEP+5); m_gameWidget->addBallUnsure(16); m_gameWidget->drawRay(22); break; case FIRST_STEP+5: setTexts(i18n("Several deflections"), i18n("As you can see, interactions in the black box can be quite complicated!
A laser beam entering and exiting at the positions \"2\" might have been deflected by this configuration of 3 balls."), i18n("Shoot the marked laser to discover another kind of result.")); m_laserToUse = 19; m_gameWidget->addBallUnsure(5); m_gameWidget->addBallUnsure(26); m_gameWidget->addBallUnsure(29); m_gameWidget->drawRay(22); break; case FIRST_STEP+6: setTexts(i18n("Reflection"), i18n("If the laser beam leaves the black box at the entry point, it has been reflected backward inside the black box.

Example: We have placed 2 balls for you in a configuration that would lead to such a reflection."), i18n("Shoot the marked laser to see another backward reflection case.")); m_laserToUse = 15; m_gameWidget->addBallUnsure(22); m_gameWidget->addBallUnsure(34); m_gameWidget->drawRay(19); break; case FIRST_STEP+7: setTexts(i18n("Special reflection"), i18n("If a ball is at the edge of the box (with no other ball nearby), a beam which is aimed into the black box directly beside it causes a backward reflection.

Example: The configuration shown can cause a backward reflection."), i18n("Nearly done. Click on \"Next\".")); m_laserToUse = MAY_NOT_USE; setNewStepMaxAllowed(FIRST_STEP+8); m_gameWidget->addBallUnsure(33); m_gameWidget->drawRay(15); break; case FIRST_STEP+8: setTexts(i18n("Marker for \"free position\""), i18n("We are sure there are no balls in the first 2 columns. If there were any, the beam entering at position \"1\" would hit a ball or be deflected by a ball in column 2. You can mark a \"free position\" with a right mouse click (see also keyboard shortcuts).

Example: There are 12 markers in the first 2 columns."), i18n("Click on \"Next\".")); m_laserToUse = MAY_NOT_USE; setNewStepMaxAllowed(FIRST_STEP+9); for (int i=0;iaddMarkerNothing(i*COLUMNS); m_gameWidget->addMarkerNothing(i*COLUMNS+1); } break; case FIRST_STEP+9: setTexts(i18n("Marking balls"), i18n("When you have worked out where a ball is, please use the left mouse button to mark it. To remove a ball mark, use the left mouse button again. Last tip: If you are not sure about a position, you can use a right click on a ball to mark it as \"unsure\". (See also keyboard shortcuts.)

Example: We marked one position as sure, the other one as unsure."), i18n("Click on \"Next\".")); m_laserToUse = MAY_NOT_USE; setNewStepMaxAllowed(FIRST_STEP+10); m_gameWidget->addBall(33); m_gameWidget->addBallUnsure(35); break; case FIRST_STEP+10: setTexts(i18n("Let us play!"), i18n("Congratulations! You now know all the rules for KBlackBox.

You can start to play. Try to finish this tutorial game by yourself!

Tip: We have sent in enough beams to deduce the positions of the 3 balls with certainty. Of course, you can use some more shots if needed."), i18n("Finish placing the balls and click on \"Done!\" when you are done!")); m_laserToUse = MAY_NOT_USE; setNewStepMaxAllowed(FIRST_STEP+9); break; } m_buttonPrevious->setEnabled(m_step!=FIRST_STEP); m_buttonNext->setEnabled(m_stepsetValue(m_step); showMarker(m_laserToUse); } void KBBTutorial::start() { m_stepMaxAllowed = 0; show(); } // // Private slots // void KBBTutorial::nextStep() { setStep(m_step+1); } void KBBTutorial::previousStep() { setStep(m_step-1); } void KBBTutorial::restoreStyle() { - m_playerAction->setStyleSheet(QLatin1Literal("color: palette(text); background-color: palette(window)")); + m_playerAction->setStyleSheet(QStringLiteral("color: palette(text); background-color: palette(window)")); } // // Private // void KBBTutorial::setNewStepMaxAllowed(const int newStepMax) { if (m_step>m_stepMaxAllowed) m_stepMaxAllowed = m_step; if (newStepMax>m_stepMaxAllowed) m_stepMaxAllowed = newStepMax; } void KBBTutorial::setTexts(const QString &title, const QString &text, const QString &action) { m_title->setText(QLatin1String("") + title + QLatin1String("")); m_explanation->setText(QLatin1String("") + text + QLatin1String("")); m_playerAction->setText(QLatin1String("") + action + QLatin1String("")); } void KBBTutorial::showMarker(const int laserPosition) const { Q_ASSERT(m_marker!=0); if (laserPosition==MAY_NOT_USE) m_marker->hide(); else { m_marker->setBorderPosition(laserPosition); m_marker->show(); } } diff --git a/main.cpp b/main.cpp index cac93d8..db1f585 100644 --- a/main.cpp +++ b/main.cpp @@ -1,78 +1,78 @@ // // KBlackBox // // A simple game inspired by an emacs module // /*************************************************************************** * Copyright (c) 1999-2000, Robert Cimrman * * cimrman3@students.zcu.cz * * * * Copyright (c) 2007, Nicolas Roffet * * nicolas-kde@roffet.com * * * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * ***************************************************************************/ #include #include #include #include #include #include #include "kbbmainwindow.h" #include int main( int argc, char **argv ) { QApplication application(argc, argv); Kdelibs4ConfigMigrator migrate(QStringLiteral("kblackbox")); migrate.setConfigFiles(QStringList() << QStringLiteral("kblackboxrc")); migrate.setUiFiles(QStringList() << QStringLiteral("kblackboxui.rc")); migrate.migrate(); KLocalizedString::setApplicationDomain("kblackbox"); - KAboutData aboutData( QLatin1String("kblackbox"), i18n("KBlackBox"), QLatin1String("0.5.0"), i18n("Find the balls hidden in the black box by shooting laser beams!"), KAboutLicense::GPL, i18n("(c) 2007, Nicolas Roffet\n(c) 1999-2000, Robert Cimrman")); - aboutData.addAuthor(i18n("Nicolas Roffet"),i18n("Developer of version 0.4."), QLatin1String("nicolas-kde@roffet.com")); - aboutData.addAuthor(i18n("Robert Cimrman"),i18n("Original developer"), QLatin1String("cimrman3@students.zcu.cz")); - aboutData.addCredit(i18n("Johann Ollivier Lapeyre"), i18n("Artist"), QLatin1String("johann.ollivierlapeyre@gmail.com")); - aboutData.setHomepage(QLatin1String("http://games.kde.org/kblackbox")); + KAboutData aboutData( QStringLiteral("kblackbox"), i18n("KBlackBox"), QStringLiteral("0.5.0"), i18n("Find the balls hidden in the black box by shooting laser beams!"), KAboutLicense::GPL, i18n("(c) 2007, Nicolas Roffet\n(c) 1999-2000, Robert Cimrman")); + aboutData.addAuthor(i18n("Nicolas Roffet"),i18n("Developer of version 0.4."), QStringLiteral("nicolas-kde@roffet.com")); + aboutData.addAuthor(i18n("Robert Cimrman"),i18n("Original developer"), QStringLiteral("cimrman3@students.zcu.cz")); + aboutData.addCredit(i18n("Johann Ollivier Lapeyre"), i18n("Artist"), QStringLiteral("johann.ollivierlapeyre@gmail.com")); + aboutData.setHomepage(QStringLiteral("http://games.kde.org/kblackbox")); QCommandLineParser parser; KAboutData::setApplicationData(aboutData); KCrash::initialize(); aboutData.setupCommandLine(&parser); parser.process(application); aboutData.processCommandLine(&parser); KDBusService service; application.setWindowIcon(QIcon::fromTheme(QStringLiteral("kblackbox"))); if (application.isSessionRestored()) kRestoreMainWindows(); else { KBBMainWindow *mainWindow = new KBBMainWindow; mainWindow->show(); } return application.exec(); }