Commit 1599b326 authored by Laurent Montel's avatar Laurent Montel 😁

Use new connect api + QStringLiteral

parent c918a367
......@@ -26,7 +26,7 @@
#include <KLocalizedString>
static QString chipPrefixString[2] = {QLatin1Literal("chip_bw"), QLatin1Literal("chip_color")};
static QString chipPrefixString[2] = {QStringLiteral("chip_bw"), QStringLiteral("chip_color")};
QString Utils::chipPrefixToString(ChipsPrefix prefix) {
return chipPrefixString[prefix];
......
......@@ -108,7 +108,7 @@ Score firstScore()
//-----------------------------------------------------------------------------
Manager::Manager(uint nbGameTypes, uint maxNbEntries)
{
QLoggingCategory::setFilterRules(QLatin1Literal("games.highscore.debug = true"));
QLoggingCategory::setFilterRules(QStringLiteral("games.highscore.debug = true"));
Q_ASSERT(nbGameTypes);
Q_ASSERT(maxNbEntries);
......@@ -234,10 +234,10 @@ Item *Manager::createItem(ItemType type)
void Manager::setScoreItem(uint worstScore, Item *item)
{
item->setDefaultValue(worstScore);
internal->scoreInfos().setItem(QLatin1String( "score" ), item);
internal->playerInfos().item(QLatin1String( "mean score" ))
internal->scoreInfos().setItem(QStringLiteral( "score" ), item);
internal->playerInfos().item(QStringLiteral( "mean score" ))
->item()->setDefaultValue(double(worstScore));
internal->playerInfos().item(QLatin1String( "best score" ))
internal->playerInfos().item(QStringLiteral( "best score" ))
->item()->setDefaultValue(worstScore);
}
......@@ -248,16 +248,16 @@ void Manager::addScoreItem(const QString &name, Item *item)
void Manager::setPlayerItem(PlayerItemType type, Item *item)
{
const Item *scoreItem = internal->scoreInfos().item(QLatin1String( "score" ))->item();
const Item *scoreItem = internal->scoreInfos().item(QStringLiteral( "score" ))->item();
uint def = scoreItem->defaultValue().toUInt();
QString name;
switch (type) {
case MeanScore:
name = QLatin1String( "mean score" );
name = QStringLiteral( "mean score" );
item->setDefaultValue(double(def));
break;
case BestScore:
name = QLatin1String( "best score" );
name = QStringLiteral( "best score" );
item->setDefaultValue(def);
break;
}
......@@ -266,7 +266,7 @@ void Manager::setPlayerItem(PlayerItemType type, Item *item)
QString Manager::gameTypeLabel(uint gameType, LabelType type) const
{
QLoggingCategory::setFilterRules(QLatin1Literal("games.highscore.debug = true"));
QLoggingCategory::setFilterRules(QStringLiteral("games.highscore.debug = true"));
if ( gameType!=0 )
{
......@@ -278,7 +278,7 @@ QString Manager::gameTypeLabel(uint gameType, LabelType type) const
case Icon:
case Standard:
case I18N: break;
case WW: return QLatin1String( "normal" );
case WW: return QStringLiteral( "normal" );
}
return QString();
}
......
......@@ -254,8 +254,8 @@ HighscoresDialog::HighscoresDialog(int rank, QWidget *parent)
connect(hsw, SIGNAL(tabChanged(int)), SLOT(tabChanged(int)));
}
connect(this, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)),
SLOT(highscorePageChanged(KPageWidgetItem*,KPageWidgetItem*)));
connect(this, &KPageDialog::currentPageChanged,
this, &HighscoresDialog::highscorePageChanged);
setCurrentPage(_pages[internal->gameType()]);
}
......@@ -440,10 +440,10 @@ ConfigDialog::ConfigDialog(QWidget *parent)
QLabel *label = new QLabel(i18n("Nickname:"), page);
pageTop->addWidget(label, 0, 0);
_nickname = new QLineEdit(page);
connect(_nickname, SIGNAL(textChanged(QString)),
SLOT(modifiedSlot()));
connect(_nickname, SIGNAL(textChanged(QString)),
SLOT(nickNameChanged(QString)));
connect(_nickname, &QLineEdit::textChanged,
this, &ConfigDialog::modifiedSlot);
connect(_nickname, &QLineEdit::textChanged,
this, &ConfigDialog::nickNameChanged);
_nickname->setMaxLength(16);
pageTop->addWidget(_nickname, 0, 1);
......@@ -451,16 +451,16 @@ ConfigDialog::ConfigDialog(QWidget *parent)
label = new QLabel(i18n("Comment:"), page);
pageTop->addWidget(label, 1, 0);
_comment = new QLineEdit(page);
connect(_comment, SIGNAL(textChanged(QString)),
SLOT(modifiedSlot()));
connect(_comment, &QLineEdit::textChanged,
this, &ConfigDialog::modifiedSlot);
_comment->setMaxLength(50);
pageTop->addWidget(_comment, 1, 1);
if (tab) {
_WWHEnabled
= new QCheckBox(i18n("World-wide highscores enabled"), page);
connect(_WWHEnabled, SIGNAL(toggled(bool)),
SLOT(modifiedSlot()));
connect(_WWHEnabled, &QAbstractButton::toggled,
this, &ConfigDialog::modifiedSlot);
pageTop->addWidget(_WWHEnabled, 2, 0, 1, 2 );
// advanced tab
......@@ -493,14 +493,14 @@ ConfigDialog::ConfigDialog(QWidget *parent)
_removeButton = new QPushButton(group);
KGuiItem::assign(_removeButton, gi);
groupLayout->addWidget(_removeButton, 2, 0);
connect(_removeButton, SIGNAL(clicked()), SLOT(removeSlot()));
connect(_removeButton, &QAbstractButton::clicked, this, &ConfigDialog::removeSlot);
}
buttonBox = new QDialogButtonBox(this);
buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
// TODO mapping for Apply button
pageTop->addWidget(buttonBox);
......@@ -630,8 +630,8 @@ AskNameDialog::AskNameDialog(QWidget *parent)
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
top->addWidget(buttonBox);
nameChanged(buttonBox);
......
This diff is collapsed.
......@@ -195,12 +195,12 @@ class PlayerInfos : public ItemArray
bool isNewPlayer() const { return _newPlayer; }
bool isOldLocalPlayer() const { return _oldLocalPlayer; }
uint nbEntries() const;
QString name() const { return item(QLatin1String( "name" ))->read(_id).toString(); }
QString name() const { return item(QStringLiteral( "name" ))->read(_id).toString(); }
bool isAnonymous() const;
QString prettyName() const { return prettyName(_id); }
QString prettyName(uint id) const { return item(QLatin1String( "name" ))->pretty(id); }
QString prettyName(uint id) const { return item(QStringLiteral( "name" ))->pretty(id); }
QString registeredName() const;
QString comment() const { return item(QLatin1String( "comment" ))->pretty(_id); }
QString comment() const { return item(QStringLiteral( "comment" ))->pretty(_id); }
bool isWWEnabled() const;
QString key() const;
uint id() const { return _id; }
......
......@@ -111,13 +111,13 @@ QString Item::pretty(uint, const QVariant &value) const
{
switch (_special) {
case ZeroNotDefined:
if ( value.toUInt()==0 ) return QLatin1String( "--" );
if ( value.toUInt()==0 ) return QStringLiteral( "--" );
break;
case NegativeNotDefined:
if ( value.toInt()<0 ) return QLatin1String( "--" );
if ( value.toInt()<0 ) return QStringLiteral( "--" );
break;
case DefaultNotDefined:
if ( value==_default ) return QLatin1String( "--" );
if ( value==_default ) return QStringLiteral( "--" );
break;
case Anonymous:
if ( value.toString()==QLatin1String( ItemContainer::ANONYMOUS ) )
......@@ -135,7 +135,7 @@ QString Item::pretty(uint, const QVariant &value) const
case MinuteTime:
return timeFormat(value.toUInt());
case DateTime:
if ( value.toDateTime().isNull() ) return QLatin1String( "--" );
if ( value.toDateTime().isNull() ) return QStringLiteral( "--" );
return QLocale().toString(value.toDateTime());
case NoSpecial:
break;
......@@ -208,11 +208,11 @@ void MultiplayerScores::clear()
Score score;
for (int i=0; i<_scores.size(); i++) {
_nbGames[i] = 0;
QVariant name = _scores[i].data(QLatin1String( "name" ));
QVariant name = _scores[i].data(QStringLiteral( "name" ));
_scores[i] = score;
_scores[i].setData(QLatin1String( "name" ), name);
_scores[i]._data[QLatin1String( "mean score" )] = double(0);
_scores[i]._data[QLatin1String( "nb won games" )] = uint(0);
_scores[i].setData(QStringLiteral( "name" ), name);
_scores[i]._data[QStringLiteral( "mean score" )] = double(0);
_scores[i]._data[QStringLiteral( "nb won games" )] = uint(0);
}
}
......@@ -225,26 +225,26 @@ void MultiplayerScores::setPlayerCount(uint nb)
void MultiplayerScores::setName(uint i, const QString &name)
{
_scores[i].setData(QLatin1String( "name" ), name);
_scores[i].setData(QStringLiteral( "name" ), name);
}
void MultiplayerScores::addScore(uint i, const Score &score)
{
QVariant name = _scores[i].data(QLatin1String( "name" ));
double mean = _scores[i].data(QLatin1String( "mean score" )).toDouble();
uint won = _scores[i].data(QLatin1String( "nb won games" )).toUInt();
QVariant name = _scores[i].data(QStringLiteral( "name" ));
double mean = _scores[i].data(QStringLiteral( "mean score" )).toDouble();
uint won = _scores[i].data(QStringLiteral( "nb won games" )).toUInt();
_scores[i] = score;
_scores[i].setData(QLatin1String( "name" ), name);
_scores[i].setData(QStringLiteral( "name" ), name);
_nbGames[i]++;
mean += (double(score.score()) - mean) / _nbGames[i];
_scores[i]._data[QLatin1String( "mean score" )] = mean;
_scores[i]._data[QStringLiteral( "mean score" )] = mean;
if ( score.type()==Won ) won++;
_scores[i]._data[QLatin1String( "nb won games" )] = won;
_scores[i]._data[QStringLiteral( "nb won games" )] = won;
}
void MultiplayerScores::show(QWidget *parent)
{
QLoggingCategory::setFilterRules(QLatin1Literal("games.highscore.debug = true"));
QLoggingCategory::setFilterRules(QStringLiteral("games.highscore.debug = true"));
// check consistency
if ( _nbGames.size()<2 )
......@@ -262,12 +262,12 @@ void MultiplayerScores::show(QWidget *parent)
// order the players according to the number of won games
QVector<Score> ordered;
for (int i=0; i<_scores.size(); i++) {
uint won = _scores[i].data(QLatin1String( "nb won games" )).toUInt();
double mean = _scores[i].data(QLatin1String( "mean score" )).toDouble();
uint won = _scores[i].data(QStringLiteral( "nb won games" )).toUInt();
double mean = _scores[i].data(QStringLiteral( "mean score" )).toDouble();
QVector<Score>::iterator it;
for(it = ordered.begin(); it!=ordered.end(); ++it) {
uint cwon = (*it).data(QLatin1String( "nb won games" )).toUInt();
double cmean = (*it).data(QLatin1String( "mean score" )).toDouble();
uint cwon = (*it).data(QStringLiteral( "nb won games" )).toUInt();
double cmean = (*it).data(QStringLiteral( "mean score" )).toDouble();
if ( won<cwon || (won==cwon && mean<cmean) ) {
ordered.insert(it, _scores[i]);
break;
......
......@@ -209,14 +209,14 @@ class KDEGAMES_EXPORT Score
*
* Equivalent to <pre>data("score").toUInt()</pre>.
*/
uint score() const { return data(QLatin1String("score")).toUInt(); }
uint score() const { return data(QStringLiteral("score")).toUInt(); }
/**
* Set the score value.
*
* Equivalent to <pre>setData("score", score)</pre>.
*/
void setScore(uint score) { setData(QLatin1String("score"), score); }
void setScore(uint score) { setData(QStringLiteral("score"), score); }
/**
* @return true if this is the worst possible score (ie the default
......
......@@ -45,7 +45,7 @@ PlayersCombo::PlayersCombo(QWidget *parent)
const PlayerInfos &p = internal->playerInfos();
for (uint i = 0; i<p.nbEntries(); i++)
addItem(p.prettyName(i));
addItem(QLatin1String("<") + i18n("all") + QLatin1Char( '>' ));
addItem(QStringLiteral("<") + i18n("all") + QLatin1Char( '>' ));
connect(this, static_cast<void (PlayersCombo::*)(int)>(&PlayersCombo::activated), this, &PlayersCombo::activatedSlot);
}
......@@ -98,7 +98,7 @@ void AdditionalTab::allSelected()
QString AdditionalTab::percent(uint n, uint total, bool withBraces)
{
if ( n==0 || total==0 ) return QString();
QString s = QString::fromLatin1( "%1%").arg(100.0 * n / total, 0, 'f', 1);
QString s = QStringLiteral( "%1%").arg(100.0 * n / total, 0, 'f', 1);
return (withBraces ? QLatin1Char('(') + s + QLatin1Char( ')' ) : s);
}
......@@ -120,7 +120,7 @@ const char *StatisticsTab::TREND_LABELS[Nb_Trends] = {
StatisticsTab::StatisticsTab(QWidget *parent)
: AdditionalTab(parent)
{
setObjectName( QLatin1String("statistics_tab" ));
setObjectName( QStringLiteral("statistics_tab" ));
// construct GUI
QVBoxLayout *top = static_cast<QVBoxLayout *>(layout());
......@@ -163,17 +163,17 @@ void StatisticsTab::load()
uint nb = pi.nbEntries();
_data.resize(nb+1);
for (int i=0; i<_data.size()-1; i++) {
_data[i].count[Total] = pi.item(QLatin1String( "nb games" ))->read(i).toUInt();
_data[i].count[Lost] = pi.item(QLatin1String( "nb lost games" ))->read(i).toUInt()
+ pi.item(QLatin1String( "nb black marks" ))->read(i).toUInt(); // legacy
_data[i].count[Draw] = pi.item(QLatin1String( "nb draw games" ))->read(i).toUInt();
_data[i].count[Total] = pi.item(QStringLiteral( "nb games" ))->read(i).toUInt();
_data[i].count[Lost] = pi.item(QStringLiteral( "nb lost games" ))->read(i).toUInt()
+ pi.item(QStringLiteral( "nb black marks" ))->read(i).toUInt(); // legacy
_data[i].count[Draw] = pi.item(QStringLiteral( "nb draw games" ))->read(i).toUInt();
_data[i].count[Won] = _data[i].count[Total] - _data[i].count[Lost]
- _data[i].count[Draw];
_data[i].trend[CurrentTrend] =
pi.item(QLatin1String( "current trend" ))->read(i).toInt();
_data[i].trend[WonTrend] = pi.item(QLatin1String( "max won trend" ))->read(i).toUInt();
pi.item(QStringLiteral( "current trend" ))->read(i).toInt();
_data[i].trend[WonTrend] = pi.item(QStringLiteral( "max won trend" ))->read(i).toUInt();
_data[i].trend[LostTrend] =
-(int)pi.item(QLatin1String( "max lost trend" ))->read(i).toUInt();
-(int)pi.item(QStringLiteral( "max lost trend" ))->read(i).toUInt();
}
for (int k=0; k<Nb_Counts; k++) _data[nb].count[k] = 0;
......@@ -216,7 +216,7 @@ void StatisticsTab::display(uint i)
HistogramTab::HistogramTab(QWidget *parent)
: AdditionalTab(parent)
{
setObjectName( QLatin1String("histogram_tab" ));
setObjectName( QStringLiteral("histogram_tab" ));
// construct GUI
QVBoxLayout *top = static_cast<QVBoxLayout *>(layout());
......@@ -237,13 +237,13 @@ HistogramTab::HistogramTab(QWidget *parent)
for (int i=0; i<4; i++) _list->headerItem()->setTextAlignment(i, Qt::AlignRight);
_list->headerItem()->setText(4,QString());
const Item *sitem = internal->scoreInfos().item(QLatin1String( "score" ))->item();
const Item *sitem = internal->scoreInfos().item(QStringLiteral( "score" ))->item();
const PlayerInfos &pi = internal->playerInfos();
const QVector<uint> &sh = pi.histogram();
for (int k=1; k<( int )pi.histoSize(); k++) {
QString s1 = sitem->pretty(0, sh[k-1]);
QString s2;
if ( k==sh.size() ) s2 = QLatin1String( "..." );
if ( k==sh.size() ) s2 = QStringLiteral( "..." );
else if ( sh[k]!=sh[k-1]+1 ) s2 = sitem->pretty(0, sh[k]);
QStringList items; items << s1 << s2;
(void)new QTreeWidgetItem(_list, items);
......
......@@ -95,7 +95,7 @@ void KReversiGame::makeMove(const KReversiMove &move)
turnChips(move);
m_delayTimer.singleShot(m_delay * (qMax(1, m_changedChips.count() - 1)), this, SLOT(onDelayTimer()));
m_delayTimer.singleShot(m_delay * (qMax(1, m_changedChips.count() - 1)), this, &KReversiGame::onDelayTimer);
emit boardChanged();
}
......
......@@ -30,15 +30,15 @@ KReversiView::KReversiView(KReversiGame* game, QWidget *parent, KgThemeProvider
m_showLastMove(false), m_showLegalMoves(false),
m_showLabels(false), m_provider(provider)
{
m_provider->setDeclarativeEngine(QLatin1Literal("themeProvider"), engine());
m_provider->setDeclarativeEngine(QStringLiteral("themeProvider"), engine());
qmlRegisterType<ColorScheme>("ColorScheme", 1, 0, "ColorScheme");
QString path = QStandardPaths::locate(QStandardPaths::DataLocation, QLatin1String("qml/Table.qml"));
QString path = QStandardPaths::locate(QStandardPaths::DataLocation, QStringLiteral("qml/Table.qml"));
setSource(QUrl::fromLocalFile(path));
m_qml_root = (QObject*) rootObject();
rootContext()->setContextProperty(QLatin1Literal("container"), this);
rootContext()->setContextProperty(QStringLiteral("container"), this);
connect(m_qml_root, SIGNAL(cellClicked(int,int)),
this, SLOT(onPlayerMove(int,int)));
......@@ -134,10 +134,10 @@ void KReversiView::updateBoard()
if (m_game) // showing empty board if has no game
switch (m_game->chipColorAt(KReversiMove(NoColor, i, j))) {
case Black:
new_state = QLatin1Literal("Black");
new_state = QStringLiteral("Black");
break;
case White:
new_state = QLatin1Literal("White");
new_state = QStringLiteral("White");
break;
case NoColor:
new_state = QString();
......
......@@ -44,19 +44,19 @@ int main(int argc, char **argv)
migrate.migrate();
KLocalizedString::setApplicationDomain("kreversi");
KAboutData aboutData(QLatin1Literal("kreversi"), i18n("KReversi"),
QLatin1Literal("2.1"), i18n(description), KAboutLicense::GPL,
KAboutData aboutData(QStringLiteral("kreversi"), i18n("KReversi"),
QStringLiteral("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"), 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.addAuthor(i18n("Mario Weilguni"), i18n("Original author"), QStringLiteral("mweilguni@sime.com"));
aboutData.addAuthor(i18n("Inge Wallin"), i18n("Original author"), QStringLiteral("inge@lysator.liu.se"));
aboutData.addAuthor(i18n("Dmitry Suzdalev"), i18n("Game rewrite for KDE4. Current maintainer."), QStringLiteral("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"), 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"));
aboutData.addCredit(i18n("Brian Croom"), i18n("Port rendering code to KGameRenderer"), QStringLiteral("brian.s.croom@gmail.com"));
aboutData.addCredit(i18n("Denis Kuplyakov"), i18n("Port rendering code to QML, redesign and a lot of improvements"), QStringLiteral("dener.kup@gmail.com"));
KAboutData::setApplicationData(aboutData);
......@@ -64,7 +64,7 @@ int main(int argc, char **argv)
KAboutData::setApplicationData(aboutData);
parser.addVersionOption();
parser.addHelpOption();
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("demo"), i18n("Start with demo game playing")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("demo"), i18n("Start with demo game playing")));
aboutData.setupCommandLine(&parser);
parser.process(application);
......@@ -74,7 +74,7 @@ int main(int argc, char **argv)
if (application.isSessionRestored()) {
RESTORE(KReversiMainWindow)
} else {
KReversiMainWindow *mainWin = new KReversiMainWindow(0, parser.isSet(QLatin1Literal("demo")));
KReversiMainWindow *mainWin = new KReversiMainWindow(0, parser.isSet(QStringLiteral("demo")));
mainWin->show();
}
......
......@@ -51,7 +51,7 @@ KReversiMainWindow::KReversiMainWindow(QWidget* parent, bool startDemo)
memset(m_player, 0, sizeof(m_player));
m_provider = new KgThemeProvider();
m_provider->discoverThemes("appdata", QLatin1String("pics"));
m_provider->discoverThemes("appdata", QStringLiteral("pics"));
common->setText(i18n("Press start game!"));
statusBar()->insertPermanentWidget(COMMON_STATUSBAR_ID, common);
......@@ -75,7 +75,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(QLatin1Literal("history_dock"));
m_historyDock->setObjectName(QStringLiteral("history_dock"));
m_historyDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
addDockWidget(Qt::RightDockWidgetArea, m_historyDock);
......@@ -120,18 +120,18 @@ void KReversiMainWindow::setupActionsInit()
m_hintAct->setEnabled(false);
// Last move
m_showLast = new KToggleAction(QIcon::fromTheme(QLatin1String("lastmoves")), i18n("Show Last Move"), this);
actionCollection()->addAction(QLatin1String("show_last_move"), m_showLast);
m_showLast = new KToggleAction(QIcon::fromTheme(QStringLiteral("lastmoves")), i18n("Show Last Move"), this);
actionCollection()->addAction(QStringLiteral("show_last_move"), m_showLast);
connect(m_showLast, &KToggleAction::triggered, m_view, &KReversiView::setShowLastMove);
// Legal moves
m_showLegal = new KToggleAction(QIcon::fromTheme(QLatin1String("legalmoves")), i18n("Show Legal Moves"), this);
actionCollection()->addAction(QLatin1String("show_legal_moves"), m_showLegal);
m_showLegal = new KToggleAction(QIcon::fromTheme(QStringLiteral("legalmoves")), i18n("Show Legal Moves"), this);
actionCollection()->addAction(QStringLiteral("show_legal_moves"), m_showLegal);
connect(m_showLegal, &KToggleAction::triggered, m_view, &KReversiView::setShowLegalMoves);
// Animation speed
m_animSpeedAct = new KSelectAction(i18n("Animation Speed"), this);
actionCollection()->addAction(QLatin1String("anim_speed"), m_animSpeedAct);
actionCollection()->addAction(QStringLiteral("anim_speed"), m_animSpeedAct);
QStringList acts;
acts << i18n("Slow") << i18n("Normal") << i18n("Fast");
......@@ -140,13 +140,13 @@ void KReversiMainWindow::setupActionsInit()
// Chip's color
m_coloredChipsAct = new KToggleAction(i18n("Use Colored Chips"), this);
actionCollection()->addAction(QLatin1String("use_colored_chips"), m_coloredChipsAct);
actionCollection()->addAction(QStringLiteral("use_colored_chips"), m_coloredChipsAct);
connect(m_coloredChipsAct, &KToggleAction::triggered, this, &KReversiMainWindow::slotUseColoredChips);
// Move history
// NOTE: read/write this from/to config file? Or not necessary?
m_showMovesAct = new KToggleAction(QIcon::fromTheme(QLatin1String("view-history")), i18n("Show Move History"), this);
actionCollection()->addAction(QLatin1String("show_moves"), m_showMovesAct);
m_showMovesAct = new KToggleAction(QIcon::fromTheme(QStringLiteral("view-history")), i18n("Show Move History"), this);
actionCollection()->addAction(QStringLiteral("show_moves"), m_showMovesAct);
connect(m_showMovesAct, &KToggleAction::triggered, this, &KReversiMainWindow::slotShowMovesHistory);
}
......@@ -298,7 +298,7 @@ void KReversiMainWindow::updateHistory()
m_historyView->clear();
for (int i = 0; i < history.size(); i++) {
QString numStr = QString::number(i + 1) + QLatin1String(". ");
QString numStr = QString::number(i + 1) + QStringLiteral(". ");
m_historyView->addItem(numStr + Utils::moveToString(history.at(i)));
}
......@@ -336,7 +336,7 @@ void KReversiMainWindow::showEvent(QShowEvent*)
qDebug() << "starting demo...";
startDemo();
} else if (m_firstShow) {
QTimer::singleShot(0, this, SLOT(slotNewGame()));
QTimer::singleShot(0, this, &KReversiMainWindow::slotNewGame);
}
m_firstShow = false;
}
......
......@@ -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(QLatin1Literal("computer")));
ui->whiteHuman->setIcon(QIcon::fromTheme(QLatin1Literal("user-identity")));
ui->whiteAI->setIcon(QIcon::fromTheme(QStringLiteral("computer")));
ui->whiteHuman->setIcon(QIcon::fromTheme(QStringLiteral("user-identity")));
ui->blackTypeGroup->setId(ui->blackHuman, GameStartInformation::Human);
ui->blackTypeGroup->setId(ui->blackAI, GameStartInformation::AI);
ui->blackAI->setIcon(QIcon::fromTheme(QLatin1Literal("computer")));
ui->blackHuman->setIcon(QIcon::fromTheme(QLatin1Literal("user-identity")));
ui->blackAI->setIcon(QIcon::fromTheme(QStringLiteral("computer")));
ui->blackHuman->setIcon(QIcon::fromTheme(QStringLiteral("user-identity")));
QList< const KgDifficultyLevel * > diffList = Kg::difficulty()->levels();
const QIcon icon = QIcon::fromTheme(QLatin1Literal("games-difficult"));
const QIcon icon = QIcon::fromTheme(QStringLiteral("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 + QLatin1String("_1"));
svgRenderer.render(painter, prefix + QStringLiteral("_1"));
delete painter;
painter = new QPainter(&whiteChip);
// TODO: get 12 from some global constant that is shared with QML
svgRenderer.render(painter, prefix + QLatin1String("_12"));
svgRenderer.render(painter, prefix + QStringLiteral("_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