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

Make it compile with -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII

parent a515b959
......@@ -29,6 +29,7 @@ include(KDECMakeSettings)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
add_definitions(-DTRANSLATION_DOMAIN="kdiamond")
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
add_subdirectory(src)
......
......@@ -121,7 +121,7 @@ void KDiamond::GameState::setState(KDiamond::State state)
emit stateChanged(state);
if (state == KDiamond::Finished)
{
KNotification::event("gamefinished");
KNotification::event(QLatin1Literal("gamefinished"));
emit message(i18nc("Not meant like 'You have lost', more like 'Time is up'.", "Game over."));
}
}
......
......@@ -172,15 +172,15 @@ void Game::updateGraphics()
t.translate(leftOffset, 0).scale(diamondSize, diamondSize);
m_board->setTransform(t);
//render background
QPixmap pix = g_renderer->spritePixmap("kdiamond-background", sceneSize);
QPixmap pix = g_renderer->spritePixmap(QLatin1Literal("kdiamond-background"), sceneSize);
const KgTheme* theme = g_renderer->theme();
const bool hasBorder = theme->customData("HasBorder").toInt() > 0;
const bool hasBorder = theme->customData(QLatin1Literal("HasBorder")).toInt() > 0;
if (hasBorder)
{
const qreal borderPercentage = theme->customData("BorderPercentage").toFloat();
const qreal borderPercentage = theme->customData(QLatin1Literal("BorderPercentage")).toFloat();
const int padding = borderPercentage * boardSize;
const int boardBorderSize = 2 * padding + boardSize;
const QPixmap boardPix = g_renderer->spritePixmap("kdiamond-border", QSize(boardBorderSize, boardBorderSize));
const QPixmap boardPix = g_renderer->spritePixmap(QLatin1Literal("kdiamond-border"), QSize(boardBorderSize, boardBorderSize));
QPainter painter(&pix);
painter.drawPixmap(QPoint(leftOffset - padding, -padding), boardPix);
}
......@@ -267,7 +267,7 @@ void Game::timerEvent(QTimerEvent* event)
} //fall through
case KDiamond::RevokeSwapDiamondsJob:
//invoke movement
KNotification::event("move");
KNotification::event(QLatin1Literal("move"));
m_board->swapDiamonds(m_swappingDiamonds[0], m_swappingDiamonds[1]);
break;
case KDiamond::RemoveRowsJob: {
......@@ -294,7 +294,7 @@ void Game::timerEvent(QTimerEvent* event)
//report to Game
m_gameState->addPoints(diamondsToRemove.count());
//invoke remove animation, then fill gaps immediately after the animation
KNotification::event("remove");
KNotification::event(QLatin1Literal("remove"));
foreach (const QPoint& diamondPos, diamondsToRemove)
m_board->removeDiamond(diamondPos);
m_jobQueue.prepend(KDiamond::FillGapsJob);
......
......@@ -71,8 +71,8 @@ void KDiamond::InfoBar::updateRemainingTime(int remainingSeconds)
QString secondString = QString::number(seconds);
const QString minuteString = QString::number(minutes);
if (seconds < 10)
secondString.prepend(QChar('0'));
mTime->setText(i18n("Time left: %1", QString("%1:%2").arg(minuteString).arg(secondString)));
secondString.prepend(QLatin1Char('0'));
mTime->setText(i18n("Time left: %1", QString::fromLatin1("%1:%2").arg(minuteString).arg(secondString)));
//special treatment if game is finished
if (remainingSeconds == 0)
updateMoves(0);
......
......@@ -45,13 +45,13 @@ int main(int argc, char ** argv)
migrate.setUiFiles(QStringList() << QLatin1String("kdiamondui.rc"));
migrate.migrate();
KAboutData about("kdiamond", i18nc("The application's name", "KDiamond"), version, i18n(description),
KAboutLicense::GPL, i18n("(C) 2008-2010 Stefan Majewsky and others"), "http://games.kde.org/kdiamond" );
about.addAuthor(i18n("Stefan Majewsky"), i18n("Original author and current maintainer"), "majewsky@gmx.net");
about.addAuthor(i18n("Paul Bunbury"), i18n("Gameplay refinement"), "happysmileman@googlemail.com");
about.addCredit(i18n("Eugene Trounev"), i18n("Default theme"), "eugene.trounev@gmail.com");
about.addCredit(i18n("Felix Lemke"), i18n("Classic theme"), "lemke.felix@ages-skripte.org");
about.addCredit(i18n("Jeffrey Kelling"), i18n("Technical consultant"), "kelling.jeffrey@ages-skripte.org");
KAboutData about(QLatin1Literal("kdiamond"), i18nc("The application's name", "KDiamond"), QLatin1Literal(version), i18n(description),
KAboutLicense::GPL, i18n("(C) 2008-2010 Stefan Majewsky and others"), QLatin1Literal("http://games.kde.org/kdiamond") );
about.addAuthor(i18n("Stefan Majewsky"), i18n("Original author and current maintainer"), QLatin1Literal("majewsky@gmx.net"));
about.addAuthor(i18n("Paul Bunbury"), i18n("Gameplay refinement"), QLatin1Literal("happysmileman@googlemail.com"));
about.addCredit(i18n("Eugene Trounev"), i18n("Default theme"), QLatin1Literal("eugene.trounev@gmail.com"));
about.addCredit(i18n("Felix Lemke"), i18n("Classic theme"), QLatin1Literal("lemke.felix@ages-skripte.org"));
about.addCredit(i18n("Jeffrey Kelling"), i18n("Technical consultant"), QLatin1Literal("kelling.jeffrey@ages-skripte.org"));
QCommandLineParser parser;
KAboutData::setApplicationData(about);
parser.addVersionOption();
......@@ -61,13 +61,13 @@ int main(int argc, char ** argv)
about.processCommandLine(&parser);
//resource directory for KNewStuff2 (this call causes the directory to be created; its existence is necessary for the downloader)
QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "themes/";
QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/themes/");
Kg::difficulty()->addStandardLevelRange(
KgDifficultyLevel::VeryEasy,
KgDifficultyLevel::VeryHard
);
KDBusService service;
KDBusService service;
// see if we are starting with session management
if (app.isSessionRestored())
{
......
......@@ -138,7 +138,7 @@ void MainWindow::gameIsOver()
scoreInfo[KScoreDialog::Custom1] = m_gameState->mode() == KDiamond::UntimedGame ? i18n("Untimed") : i18n("Timed");
//report score
QPointer<KScoreDialog> dialog = new KScoreDialog(KScoreDialog::Name | KScoreDialog::Score, this);
dialog->addField(KScoreDialog::Custom1, i18n("Mode"), "mode");
dialog->addField(KScoreDialog::Custom1, i18n("Mode"), QLatin1Literal("mode"));
dialog->initFromDifficulty(Kg::difficulty());
dialog->addScore(scoreInfo);
dialog->exec();
......@@ -150,10 +150,10 @@ void MainWindow::showHighscores()
//pause game if necessary
m_gameState->setState(KDiamond::Paused);
if (m_gameState->state() != KDiamond::Finished)
actionCollection()->action("game_pause")->setChecked(true);
actionCollection()->action(QLatin1Literal("game_pause"))->setChecked(true);
//show dialog
QPointer<KScoreDialog> dialog = new KScoreDialog(KScoreDialog::Name | KScoreDialog::Score, this);
dialog->addField(KScoreDialog::Custom1, i18n("Mode"), "mode");
dialog->addField(KScoreDialog::Custom1, i18n("Mode"), QLatin1Literal("mode"));
dialog->initFromDifficulty(Kg::difficulty());
dialog->exec();
delete dialog;
......
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