Commit 1021e2f8 authored by Laurent Montel's avatar Laurent Montel 😁

Make it compile with -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII"

parent 4330c947
......@@ -34,7 +34,8 @@ include(KDEInstallDirs)
include(KDECompilerSettings)
include(KDECMakeSettings)
include_directories(${KDEGAMES_INCLUDE_DIRS} ${KDEGAMES_INCLUDE_DIR}/highscore ${QDBUS_INCLUDE_DIRS})
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
add_subdirectory( pics )
add_subdirectory( sounds )
......
......@@ -26,7 +26,7 @@
#include <KLocalizedString>
static QString chipPrefixString[2] = {"chip_bw", "chip_color"};
static QString chipPrefixString[2] = {QLatin1Literal("chip_bw"), QLatin1Literal("chip_color")};
QString Utils::chipPrefixToString(ChipsPrefix prefix) {
return chipPrefixString[prefix];
......
......@@ -30,7 +30,7 @@ KReversiView::KReversiView(KReversiGame* game, QWidget *parent, KgThemeProvider
m_showLastMove(false), m_showLegalMoves(false),
m_showLabels(false), m_provider(provider)
{
m_provider->setDeclarativeEngine("themeProvider", engine());
m_provider->setDeclarativeEngine(QLatin1Literal("themeProvider"), engine());
qmlRegisterType<ColorScheme>("ColorScheme", 1, 0, "ColorScheme");
......@@ -38,7 +38,7 @@ KReversiView::KReversiView(KReversiGame* game, QWidget *parent, KgThemeProvider
setSource(QUrl::fromLocalFile(path));
m_qml_root = (QObject*) rootObject();
rootContext()->setContextProperty("container", this);
rootContext()->setContextProperty(QLatin1Literal("container"), this);
connect(m_qml_root, SIGNAL(cellClicked(int,int)),
this, SLOT(onPlayerMove(int,int)));
......@@ -130,17 +130,17 @@ void KReversiView::updateBoard()
for (int i = 0; i < 8; i++)
for (int j = 0; j < 8; j++) {
QString new_state = "";
QString new_state;
if (m_game) // showing empty board if has no game
switch (m_game->chipColorAt(KReversiMove(NoColor, i, j))) {
case Black:
new_state = "Black";
new_state = QLatin1Literal("Black");
break;
case White:
new_state = "White";
new_state = QLatin1Literal("White");
break;
case NoColor:
new_state = "";
new_state = QString();
break;
}
......@@ -180,7 +180,7 @@ void KReversiView::updateBoard()
QMetaObject::invokeMethod(m_qml_root, "setChipState",
Q_ARG(QVariant, m_hint.row),
Q_ARG(QVariant, m_hint.col),
Q_ARG(QVariant, "Black"));
Q_ARG(QVariant, QLatin1Literal("Black")));
QMetaObject::invokeMethod(m_qml_root, "setHint",
Q_ARG(QVariant, m_hint.row),
Q_ARG(QVariant, m_hint.col),
......
......@@ -43,19 +43,19 @@ int main(int argc, char **argv)
migrate.setUiFiles(QStringList() << QStringLiteral("kreversiui.rc"));
migrate.migrate();
KAboutData aboutData("kreversi", i18n("KReversi"),
"2.1", i18n(description), KAboutLicense::GPL,
KAboutData aboutData(QLatin1Literal("kreversi"), i18n("KReversi"),
QLatin1Literal("2.1"), i18n(description), KAboutLicense::GPL,
i18n("(c) 1997-2000, Mario Weilguni\n(c) 2004-2006, Inge Wallin\n(c) 2006, Dmitry Suzdalev"),
QString(), i18n("http://games.kde.org/kreversi"));
aboutData.addAuthor(i18n("Mario Weilguni"), i18n("Original author"), "mweilguni@sime.com");
aboutData.addAuthor(i18n("Inge Wallin"), i18n("Original author"), "inge@lysator.liu.se");
aboutData.addAuthor(i18n("Dmitry Suzdalev"), i18n("Game rewrite for KDE4. Current maintainer."), "dimsuz@gmail.com");
aboutData.addAuthor(i18n("Mario Weilguni"), i18n("Original author"), QLatin1Literal("mweilguni@sime.com"));
aboutData.addAuthor(i18n("Inge Wallin"), i18n("Original author"), QLatin1Literal("inge@lysator.liu.se"));
aboutData.addAuthor(i18n("Dmitry Suzdalev"), i18n("Game rewrite for KDE4. Current maintainer."), QLatin1Literal("dimsuz@gmail.com"));
aboutData.addCredit(i18n("Simon Hürlimann"), i18n("Action refactoring"));
aboutData.addCredit(i18n("Mats Luthman"), i18n("Game engine, ported from his JAVA applet."));
aboutData.addCredit(i18n("Arne Klaassen"), i18n("Original raytraced chips."));
aboutData.addCredit(i18n("Mauricio Piacentini"), i18n("Vector chips and background for KDE4."));
aboutData.addCredit(i18n("Brian Croom"), i18n("Port rendering code to KGameRenderer"), "brian.s.croom@gmail.com");
aboutData.addCredit(i18n("Denis Kuplyakov"), i18n("Port rendering code to QML, redesign and a lot of improvements"), "dener.kup@gmail.com");
aboutData.addCredit(i18n("Brian Croom"), i18n("Port rendering code to KGameRenderer"), QLatin1Literal("brian.s.croom@gmail.com"));
aboutData.addCredit(i18n("Denis Kuplyakov"), i18n("Port rendering code to QML, redesign and a lot of improvements"), QLatin1Literal("dener.kup@gmail.com"));
KAboutData::setApplicationData(aboutData);
......@@ -74,7 +74,7 @@ int main(int argc, char **argv)
if (application.isSessionRestored()) {
RESTORE(KReversiMainWindow)
} else {
KReversiMainWindow *mainWin = new KReversiMainWindow(0, parser.isSet("demo"));
KReversiMainWindow *mainWin = new KReversiMainWindow(0, parser.isSet(QLatin1Literal("demo")));
mainWin->show();
}
......
......@@ -74,7 +74,7 @@ KReversiMainWindow::KReversiMainWindow(QWidget* parent, bool startDemo)
m_historyView->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
m_historyDock = new QDockWidget(i18n("Move History"));
m_historyDock->setWidget(m_historyView);
m_historyDock->setObjectName("history_dock");
m_historyDock->setObjectName(QLatin1Literal("history_dock"));
m_historyDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
addDockWidget(Qt::RightDockWidgetArea, m_historyDock);
......
......@@ -70,16 +70,16 @@ StartGameDialog::StartGameDialog(QWidget *parent, KgThemeProvider *provider) :
ui->whiteTypeGroup->setId(ui->whiteHuman, GameStartInformation::Human);
ui->whiteTypeGroup->setId(ui->whiteAI, GameStartInformation::AI);
ui->whiteAI->setIcon(QIcon::fromTheme("computer"));
ui->whiteHuman->setIcon(QIcon::fromTheme("user-identity"));
ui->whiteAI->setIcon(QIcon::fromTheme(QLatin1Literal("computer")));
ui->whiteHuman->setIcon(QIcon::fromTheme(QLatin1Literal("user-identity")));
ui->blackTypeGroup->setId(ui->blackHuman, GameStartInformation::Human);
ui->blackTypeGroup->setId(ui->blackAI, GameStartInformation::AI);
ui->blackAI->setIcon(QIcon::fromTheme("computer"));
ui->blackHuman->setIcon(QIcon::fromTheme("user-identity"));
ui->blackAI->setIcon(QIcon::fromTheme(QLatin1Literal("computer")));
ui->blackHuman->setIcon(QIcon::fromTheme(QLatin1Literal("user-identity")));
QList< const KgDifficultyLevel * > diffList = Kg::difficulty()->levels();
const QIcon icon = QIcon::fromTheme("games-difficult");
const QIcon icon = QIcon::fromTheme(QLatin1Literal("games-difficult"));
for (int i = 0; i < diffList.size(); ++i) {
ui->blackSkill->addItem(icon, diffList.at(i)->title());
......@@ -115,12 +115,12 @@ void StartGameDialog::loadChipImages()
QPainter *painter = new QPainter(&blackChip);
QString prefix = Utils::chipPrefixToString(m_chipsPrefix);
svgRenderer.render(painter, prefix + "_1");
svgRenderer.render(painter, prefix + QLatin1String("_1"));
delete painter;
painter = new QPainter(&whiteChip);
// TODO: get 12 from some global constant that is shared with QML
svgRenderer.render(painter, prefix + "_12");
svgRenderer.render(painter, prefix + QLatin1String("_12"));
delete painter;
ui->blackLabel->setPixmap(blackChip);
......
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