Commit bbfca8e3 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Use QStringLiteral where appropriate

parent 72a13fdd
......@@ -56,19 +56,19 @@ const qreal pieceZValue = 1.0;
const qreal legalMarkerZValue = 3.0;
const qreal dragZValue = 4.0;
const QString backgroundKey = QLatin1String ( "Background" );
const QString whiteTileKey = QLatin1String ( "WhiteTile" );
const QString blackTileKey = QLatin1String ( "BlackTile" );
const QString legalMarkerKey = QLatin1String ( "Marker" );
const QString motionMarkerKey = QLatin1String ( "Motion" );
const QString dangerMarkerKey = QLatin1String ( "Danger" );
const QString tbBorderKey = QLatin1String ( "TopBottomBorder" );
const QString lrBorderKey = QLatin1String ( "LeftRightBorder" );
const QString whiteLettersKey = QLatin1String ( "WhiteLetters" );
const QString blackLettersKey = QLatin1String ( "BlackLetters" );
const QString whiteNumbersKey = QLatin1String ( "WhiteNumbers" );
const QString blackNumbersKey = QLatin1String ( "BlackNumbers" );
const QString backgroundKey = QStringLiteral ( "Background" );
const QString whiteTileKey = QStringLiteral ( "WhiteTile" );
const QString blackTileKey = QStringLiteral ( "BlackTile" );
const QString legalMarkerKey = QStringLiteral ( "Marker" );
const QString motionMarkerKey = QStringLiteral ( "Motion" );
const QString dangerMarkerKey = QStringLiteral ( "Danger" );
const QString tbBorderKey = QStringLiteral ( "TopBottomBorder" );
const QString lrBorderKey = QStringLiteral ( "LeftRightBorder" );
const QString whiteLettersKey = QStringLiteral ( "WhiteLetters" );
const QString blackLettersKey = QStringLiteral ( "BlackLetters" );
const QString whiteNumbersKey = QStringLiteral ( "WhiteNumbers" );
const QString blackNumbersKey = QStringLiteral ( "BlackNumbers" );
Board::Board(KgThemeProvider* provider, QObject* parent) : QGraphicsScene(parent),
m_rules(nullptr),
......
......@@ -39,7 +39,7 @@ Clock::Clock(QWidget* parent) : QWidget(parent),
m_repaintCache(RepaintNone),
m_verticalTranslation(0.) {
m_theme->setImagePath(QLatin1String("widgets/clock") );
m_theme->setImagePath(QStringLiteral("widgets/clock") );
m_theme->setContainsMultipleImages(true);
}
......@@ -144,18 +144,18 @@ void Clock::paintInterface(QPainter *p, const QRect &rect) {
facePainter.setRenderHint(QPainter::SmoothPixmapTransform);
glassPainter.setRenderHint(QPainter::SmoothPixmapTransform);
m_theme->paint(&facePainter, m_faceCache.rect(), QLatin1String("ClockFace") );
m_theme->paint(&facePainter, m_faceCache.rect(), QStringLiteral("ClockFace") );
glassPainter.save();
QRectF elementRect = QRectF(QPointF(0, 0), m_theme->elementSize(QLatin1String("HandCenterScrew")));
QRectF elementRect = QRectF(QPointF(0, 0), m_theme->elementSize(QStringLiteral("HandCenterScrew")));
glassPainter.translate(faceRect.width() / 2 - elementRect.width() / 2, faceRect.height() / 2 - elementRect.height() / 2);
m_theme->paint(&glassPainter, elementRect, QLatin1String("HandCenterScrew"));
m_theme->paint(&glassPainter, elementRect, QStringLiteral("HandCenterScrew"));
glassPainter.restore();
m_theme->paint(&glassPainter, faceRect, QLatin1String("Glass"));
m_theme->paint(&glassPainter, faceRect, QStringLiteral("Glass"));
// get vertical translation, see drawHand() for more details
m_verticalTranslation = m_theme->elementRect(QLatin1String("ClockFace")).center().y();
m_verticalTranslation = m_theme->elementRect(QStringLiteral("ClockFace")).center().y();
}
// paint hour and minute hands cache
......@@ -166,8 +166,8 @@ void Clock::paintInterface(QPainter *p, const QRect &rect) {
handsPainter.drawPixmap(faceRect, m_faceCache, faceRect);
handsPainter.setRenderHint(QPainter::SmoothPixmapTransform);
drawHand(&handsPainter, faceRect, m_verticalTranslation, hours, QLatin1String("Hour"));
drawHand(&handsPainter, faceRect, m_verticalTranslation, minutes, QLatin1String("Minute"));
drawHand(&handsPainter, faceRect, m_verticalTranslation, hours, QStringLiteral("Hour"));
drawHand(&handsPainter, faceRect, m_verticalTranslation, minutes, QStringLiteral("Minute"));
}
// reset repaint cache flag
......@@ -183,7 +183,7 @@ void Clock::paintInterface(QPainter *p, const QRect &rect) {
p->drawPixmap(targetRect, m_handsCache, faceRect);
if (m_showSecondHand) {
p->setRenderHint(QPainter::SmoothPixmapTransform);
drawHand(p, targetRect, m_verticalTranslation, seconds, QLatin1String("Second"));
drawHand(p, targetRect, m_verticalTranslation, seconds, QStringLiteral("Second"));
}
p->drawPixmap(targetRect, m_glassCache, faceRect);
}
......
......@@ -94,7 +94,7 @@ void ClockWidget::setTimeLimit ( Color color, const QTime& time ) {
void ClockWidget::updateTimeFormat() {
if ( m_timeLimit[White] > QTime(1,0) || m_timeLimit[Black] > QTime(1,0) )
m_timeFormat = QLatin1String("h:mm:ss");
m_timeFormat = QStringLiteral("h:mm:ss");
else
m_timeFormat = QLatin1String("mm:ss");
m_timeFormat = QStringLiteral("mm:ss");
}
......@@ -25,7 +25,7 @@
#include <QDebug>
namespace Knights {
const QString Pos::rowNames = QString::fromLatin1 ( "abcdefgh" );
const QString Pos::rowNames = QStringLiteral ( "abcdefgh" );
QChar Pos::row ( int num ) {
......
......@@ -62,9 +62,9 @@ const QString EngineConfiguration::toString() const {
EngineSettings::EngineSettings(QWidget* parent, Qt::WindowFlags f) : QWidget(parent, f), ui(new Ui::EngineSettings) {
ui->setupUi(this);
ui->autoDetectButton->setIcon( QIcon::fromTheme(QLatin1String("tools-wizard")) );
ui->addButton->setIcon( QIcon::fromTheme(QLatin1String("list-add")) );
ui->removeButton->setIcon( QIcon::fromTheme(QLatin1String("list-remove")) );
ui->autoDetectButton->setIcon( QIcon::fromTheme(QStringLiteral("tools-wizard")) );
ui->addButton->setIcon( QIcon::fromTheme(QStringLiteral("list-add")) );
ui->removeButton->setIcon( QIcon::fromTheme(QStringLiteral("list-remove")) );
//add saved engines
int row = 0;
......@@ -129,42 +129,42 @@ void EngineSettings::autoDetectEngines() {
//keep the order within the three string lists in sync
QStringList names;
names << QLatin1String("GNU Chess");
names << QLatin1String("Crafty");
names << QLatin1String("Stockfish");
names << QLatin1String("Stockfish v1.4");
names << QLatin1String("Stockfish v1.6");
names << QLatin1String("Stockfish v1.7");
names << QLatin1String("Stockfish v1.8");
names << QLatin1String("Stockfish v1.9");
names << QLatin1String("Stockfish v2.0");
names << QLatin1String("Sjeng");
names << QLatin1String("Phalanx");
names << QLatin1String("Fruit");
names << QLatin1String("Fruit v2.1");
names << QLatin1String("TogaII");
names << QLatin1String("TogaII v.1.4.2");
names << QLatin1String("Glaurung");
names << QLatin1String("HoiChess");
names << QStringLiteral("GNU Chess");
names << QStringLiteral("Crafty");
names << QStringLiteral("Stockfish");
names << QStringLiteral("Stockfish v1.4");
names << QStringLiteral("Stockfish v1.6");
names << QStringLiteral("Stockfish v1.7");
names << QStringLiteral("Stockfish v1.8");
names << QStringLiteral("Stockfish v1.9");
names << QStringLiteral("Stockfish v2.0");
names << QStringLiteral("Sjeng");
names << QStringLiteral("Phalanx");
names << QStringLiteral("Fruit");
names << QStringLiteral("Fruit v2.1");
names << QStringLiteral("TogaII");
names << QStringLiteral("TogaII v.1.4.2");
names << QStringLiteral("Glaurung");
names << QStringLiteral("HoiChess");
QStringList commands;
commands << QLatin1String("gnuchess");
commands << QLatin1String("crafty");
commands << QLatin1String("stockfish");
commands << QLatin1String("stockfish14");
commands << QLatin1String("stockfish16");
commands << QLatin1String("stockfish17");
commands << QLatin1String("stockfish18");
commands << QLatin1String("stockfish19");
commands << QLatin1String("stockfish20");
commands << QLatin1String("sjeng");
commands << QLatin1String("phalanx");
commands << QLatin1String("fruit");
commands << QLatin1String("fruit21");
commands << QLatin1String("toga2");
commands << QLatin1String("togaII-142"); //openSUSE naming convention
commands << QLatin1String("glaurung");
commands << QLatin1String("hoichess");
commands << QStringLiteral("gnuchess");
commands << QStringLiteral("crafty");
commands << QStringLiteral("stockfish");
commands << QStringLiteral("stockfish14");
commands << QStringLiteral("stockfish16");
commands << QStringLiteral("stockfish17");
commands << QStringLiteral("stockfish18");
commands << QStringLiteral("stockfish19");
commands << QStringLiteral("stockfish20");
commands << QStringLiteral("sjeng");
commands << QStringLiteral("phalanx");
commands << QStringLiteral("fruit");
commands << QStringLiteral("fruit21");
commands << QStringLiteral("toga2");
commands << QStringLiteral("togaII-142"); //openSUSE naming convention
commands << QStringLiteral("glaurung");
commands << QStringLiteral("hoichess");
QVector<EngineConfiguration::Interface> interfaces;
interfaces << EngineConfiguration::XBoard; //gnuchess
......@@ -209,14 +209,14 @@ void EngineSettings::autoDetectEngines() {
item->setFlags(item->flags() & (~Qt::ItemIsEditable));
//interface
const QString interface = (interfaces.at(i) == EngineConfiguration::XBoard) ? QLatin1String("XBoard") : QLatin1String("UCI");
const QString interface = (interfaces.at(i) == EngineConfiguration::XBoard) ? QStringLiteral("XBoard") : QStringLiteral("UCI");
item = new QTableWidgetItem(interface);
ui->tableWidget->setItem(row, ProtocolColumn, item);
item->setFlags(item->flags() & (~Qt::ItemIsEditable));
//icon
QLabel* label = new QLabel(this);
label->setPixmap( QIcon::fromTheme(QLatin1String("dialog-ok")).pixmap(32, 32) );
label->setPixmap( QIcon::fromTheme(QStringLiteral("dialog-ok")).pixmap(32, 32) );
ui->tableWidget->setCellWidget(row, InstalledColumn, label);
}
}
......
......@@ -33,8 +33,8 @@ using namespace Knights;
ExternalControl::ExternalControl(QObject* parent) : QObject(parent) {
connect(Manager::self(), &Manager::pieceMoved, this, &ExternalControl::slotMoveMade);
new KnightsAdaptor(this);
qCDebug(LOG_KNIGHTS) << QDBusConnection::sessionBus().registerObject(QLatin1String("/Knights"), this);
qCDebug(LOG_KNIGHTS) << QDBusConnection::sessionBus().registerService(QLatin1String("org.kde.Knights"));
qCDebug(LOG_KNIGHTS) << QDBusConnection::sessionBus().registerObject(QStringLiteral("/Knights"), this);
qCDebug(LOG_KNIGHTS) << QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.Knights"));
}
ExternalControl::~ExternalControl() = default;
......
......@@ -52,8 +52,8 @@ GameDialog::GameDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f),
QFrame* mainFrame = new QFrame(this);
ui->setupUi(mainFrame);
ui->pbPlayer1Engine->setIcon(QIcon::fromTheme(QLatin1String("configure")));
ui->pbPlayer2Engine->setIcon(QIcon::fromTheme(QLatin1String("configure")));
ui->pbPlayer1Engine->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
ui->pbPlayer2Engine->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
ui->cbTimeControl->setChecked(Settings::timeEnabled());
ui->sbTimeLimit->setValue(Settings::timeLimit());
ui->sbTimeIncrement->setValue(Settings::timeIncrement());
......
......@@ -116,11 +116,11 @@ GameManagerPrivate::GameManagerPrivate()
initComplete(false),
loading(false) {
const QDir dir = QStandardPaths::locate(QStandardPaths::AppDataLocation, QLatin1String("sounds"), QStandardPaths::LocateDirectory);
captureWhiteSound = std::unique_ptr<KgSound>( new KgSound(dir.filePath(QLatin1String("capture_white.ogg"))) );
captureBlackSound = std::unique_ptr<KgSound>( new KgSound(dir.filePath(QLatin1String("capture_black.ogg"))) );
moveWhiteSound = std::unique_ptr<KgSound>( new KgSound(dir.filePath(QLatin1String("move_white.ogg"))) ) ;
moveBlackSound = std::unique_ptr<KgSound>( new KgSound(dir.filePath(QLatin1String("move_black.ogg"))) );
const QDir dir = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("sounds"), QStandardPaths::LocateDirectory);
captureWhiteSound = std::unique_ptr<KgSound>( new KgSound(dir.filePath(QStringLiteral("capture_white.ogg"))) );
captureBlackSound = std::unique_ptr<KgSound>( new KgSound(dir.filePath(QStringLiteral("capture_black.ogg"))) );
moveWhiteSound = std::unique_ptr<KgSound>( new KgSound(dir.filePath(QStringLiteral("move_white.ogg"))) ) ;
moveBlackSound = std::unique_ptr<KgSound>( new KgSound(dir.filePath(QStringLiteral("move_black.ogg"))) );
}
int GameManagerPrivate::nextOfferId() {
......@@ -867,7 +867,7 @@ void Manager::saveGameHistoryAs(const QString& filename) {
stream << "[Event \"Casual Game\"]" << "\n";
stream << "[Site \"?\"]" << "\n";
stream << "[Date \"" << QDate::currentDate().toString( QLatin1String("yyyy.MM.dd") ) << "\"]" << "\n";
stream << "[Date \"" << QDate::currentDate().toString( QStringLiteral("yyyy.MM.dd") ) << "\"]" << "\n";
stream << "[Round \"-\"]" << "\n";
stream << "[White \"" << Protocol::white()->playerName() << "\"]" << "\n";
stream << "[Black \"" << Protocol::black()->playerName() << "\"]" << "\n";
......
......@@ -111,7 +111,7 @@ MainWindow::MainWindow() : KXmlGuiWindow(),
connect(Manager::self(), &Manager::winnerNotify, this, &MainWindow::gameOver);
connect(qApp, &QGuiApplication::lastWindowClosed, this, &MainWindow::exitKnights);
m_themeProvider->discoverThemes("appdata", QLatin1String("themes"));
m_themeProvider->discoverThemes("appdata", QStringLiteral("themes"));
m_view->drawBoard(m_themeProvider);
}
......@@ -139,7 +139,7 @@ void MainWindow::activePlayerChanged() {
void MainWindow::setupDocks() {
// clock dock
m_clockDock = new QDockWidget(i18n("Clock"), this);
m_clockDock->setObjectName(QLatin1String("ClockDockWidget")); // for QMainWindow::saveState()
m_clockDock->setObjectName(QStringLiteral("ClockDockWidget")); // for QMainWindow::saveState()
m_playerClock = new ClockWidget(this);
m_clockDock->setWidget(m_playerClock);
m_clockDock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
......@@ -149,25 +149,25 @@ void MainWindow::setupDocks() {
// console dock for black
m_bconsoleDock = new QDockWidget();
m_bconsoleDock->setObjectName(QLatin1String("BlackConsoleDockWidget"));
m_bconsoleDock->setObjectName(QStringLiteral("BlackConsoleDockWidget"));
m_bconsoleDock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
addDockWidget(Qt::LeftDockWidgetArea, m_bconsoleDock);
// console dock for white
m_wconsoleDock = new QDockWidget();
m_wconsoleDock->setObjectName(QLatin1String("WhiteConsoleDockWidget"));
m_wconsoleDock->setObjectName(QStringLiteral("WhiteConsoleDockWidget"));
m_wconsoleDock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
addDockWidget(Qt::LeftDockWidgetArea, m_wconsoleDock);
// chat dock
m_chatDock = new QDockWidget();
m_chatDock->setObjectName(QLatin1String("ChatDockWidget"));
m_chatDock->setObjectName(QStringLiteral("ChatDockWidget"));
m_chatDock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
addDockWidget(Qt::LeftDockWidgetArea, m_chatDock);
// history dock
m_historyDock = new QDockWidget();
m_historyDock->setObjectName(QLatin1String("HistoryDockWidget"));
m_historyDock->setObjectName(QStringLiteral("HistoryDockWidget"));
m_historyDock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
m_historyDock->setWindowTitle(i18n("Move History"));
m_historyDock->setWidget(new HistoryWidget);
......@@ -187,72 +187,72 @@ void MainWindow::setupActions() {
m_saveAsAction->setEnabled(false);
KStandardGameAction::load(this, SLOT(fileLoad()), actionCollection());
m_resignAction = actionCollection()->addAction(QLatin1String("resign"), this, SLOT(resign()));
m_resignAction = actionCollection()->addAction(QStringLiteral("resign"), this, SLOT(resign()));
m_resignAction->setText(i18n("Resign"));
m_resignAction->setToolTip(i18n("Admit your inevitable defeat"));
m_resignAction->setIcon(QIcon::fromTheme(QLatin1String("flag-red")));
m_resignAction->setIcon(QIcon::fromTheme(QStringLiteral("flag-red")));
m_resignAction->setEnabled(false);
m_undoAction = actionCollection()->addAction(QLatin1String("move_undo"), this, SLOT(undo()));
m_undoAction = actionCollection()->addAction(QStringLiteral("move_undo"), this, SLOT(undo()));
m_undoAction->setText(i18n("Undo"));
m_undoAction->setToolTip(i18n("Take back your last move"));
m_undoAction->setIcon(QIcon::fromTheme(QLatin1String("edit-undo")));
m_undoAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo")));
connect(Manager::self(), &Manager::undoPossible, m_undoAction, &QAction::setEnabled);
m_undoAction->setEnabled(false);
m_redoAction = actionCollection()->addAction(QLatin1String("move_redo"), this, SLOT(redo()));
m_redoAction = actionCollection()->addAction(QStringLiteral("move_redo"), this, SLOT(redo()));
m_redoAction->setText(i18n("Redo"));
m_redoAction->setToolTip(i18n("Repeat your last move"));
m_redoAction->setIcon(QIcon::fromTheme(QLatin1String("edit-redo")));
m_redoAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-redo")));
connect(Manager::self(), &Manager::redoPossible, m_redoAction, &QAction::setEnabled);
m_redoAction->setEnabled(false);
m_redoAction->setVisible(false);
m_drawAction = actionCollection()->addAction(QLatin1String("propose_draw"), Manager::self(), SLOT(offerDraw()));
m_drawAction = actionCollection()->addAction(QStringLiteral("propose_draw"), Manager::self(), SLOT(offerDraw()));
m_drawAction->setText(i18n("Offer &Draw"));
m_drawAction->setToolTip(i18n("Offer a draw to your opponent"));
m_drawAction->setIcon(QIcon::fromTheme(QLatin1String("flag-blue")));
m_drawAction->setIcon(QIcon::fromTheme(QStringLiteral("flag-blue")));
m_drawAction->setEnabled(false);
m_adjournAction = actionCollection()->addAction(QLatin1String("adjourn"), Manager::self(), SLOT(adjourn()));
m_adjournAction = actionCollection()->addAction(QStringLiteral("adjourn"), Manager::self(), SLOT(adjourn()));
m_adjournAction->setText(i18n("Adjourn"));
m_adjournAction->setToolTip(i18n("Continue this game at a later time"));
m_adjournAction->setIcon(QIcon::fromTheme(QLatin1String("document-save")));
m_adjournAction->setIcon(QIcon::fromTheme(QStringLiteral("document-save")));
m_adjournAction->setEnabled(false);
QAction* abortAction = actionCollection()->addAction(QLatin1String("abort"), Manager::self(), SLOT(abort()));
QAction* abortAction = actionCollection()->addAction(QStringLiteral("abort"), Manager::self(), SLOT(abort()));
abortAction->setText(i18n("Abort"));
abortAction->setToolTip(i18n("End the game immediately"));
abortAction->setIcon(QIcon::fromTheme(QLatin1String("dialog-cancel")));
abortAction->setIcon(QIcon::fromTheme(QStringLiteral("dialog-cancel")));
abortAction->setEnabled(false);
KToggleAction* clockAction = new KToggleAction(QIcon::fromTheme(QLatin1String("clock")), i18n("Show Clock"), actionCollection());
actionCollection()->addAction(QLatin1String("show_clock"), clockAction);
KToggleAction* clockAction = new KToggleAction(QIcon::fromTheme(QStringLiteral("clock")), i18n("Show Clock"), actionCollection());
actionCollection()->addAction(QStringLiteral("show_clock"), clockAction);
connect(clockAction, &KToggleAction::triggered, m_clockDock, &QDockWidget::setVisible);
connect(clockAction, &KToggleAction::triggered, this, &MainWindow::setShowClockSetting);
clockAction->setVisible(false);
KToggleAction* historyAction = new KToggleAction(QIcon::fromTheme(QLatin1String("view-history")), i18n("Show History"), actionCollection());
actionCollection()->addAction(QLatin1String("show_history"), historyAction);
KToggleAction* historyAction = new KToggleAction(QIcon::fromTheme(QStringLiteral("view-history")), i18n("Show History"), actionCollection());
actionCollection()->addAction(QStringLiteral("show_history"), historyAction);
connect(historyAction, &KToggleAction::triggered, m_historyDock, &QDockWidget::setVisible);
connect(historyAction, &KToggleAction::triggered, this, &MainWindow::setShowHistorySetting);
historyAction->setVisible(true);
historyAction->setChecked(Settings::showHistory());
KToggleAction* wconsoleAction = new KToggleAction(QIcon::fromTheme(QLatin1String("utilities-terminal")), i18n("Show White Console"), actionCollection());
actionCollection()->addAction(QLatin1String("show_console_white"), wconsoleAction);
KToggleAction* wconsoleAction = new KToggleAction(QIcon::fromTheme(QStringLiteral("utilities-terminal")), i18n("Show White Console"), actionCollection());
actionCollection()->addAction(QStringLiteral("show_console_white"), wconsoleAction);
connect(wconsoleAction, &KToggleAction::triggered, m_wconsoleDock, &QDockWidget::setVisible);
connect(wconsoleAction, &KToggleAction::triggered, this, &MainWindow::setShowConsoleSetting);
wconsoleAction->setVisible(false);
KToggleAction* bconsoleAction = new KToggleAction(QIcon::fromTheme(QLatin1String("utilities-terminal")), i18n("Show Black Console"), actionCollection());
actionCollection()->addAction(QLatin1String("show_console_black"), bconsoleAction);
KToggleAction* bconsoleAction = new KToggleAction(QIcon::fromTheme(QStringLiteral("utilities-terminal")), i18n("Show Black Console"), actionCollection());
actionCollection()->addAction(QStringLiteral("show_console_black"), bconsoleAction);
connect(bconsoleAction, &KToggleAction::triggered, m_bconsoleDock, &QDockWidget::setVisible);
connect(bconsoleAction, &KToggleAction::triggered, this, &MainWindow::setShowConsoleSetting);
bconsoleAction->setVisible(false);
KToggleAction* chatAction = new KToggleAction(QIcon::fromTheme(QLatin1String("meeting-attending")), i18n("Show Chat"), actionCollection());
actionCollection()->addAction(QLatin1String("show_chat"), chatAction);
KToggleAction* chatAction = new KToggleAction(QIcon::fromTheme(QStringLiteral("meeting-attending")), i18n("Show Chat"), actionCollection());
actionCollection()->addAction(QStringLiteral("show_chat"), chatAction);
connect(chatAction, &KToggleAction::triggered, m_chatDock, &QDockWidget::setVisible);
connect(chatAction, &KToggleAction::triggered, this, &MainWindow::setShowChatSetting);
chatAction->setVisible(false);
......@@ -324,7 +324,7 @@ void MainWindow::protocolInitSuccesful() {
// show clock dock widget if timer active and configuration file entry has visible = true
bool showClock = false;
if(Manager::self()->timeControlEnabled(White) || Manager::self()->timeControlEnabled(Black)) {
actionCollection()->action(QLatin1String("show_clock"))->setVisible(true);
actionCollection()->action(QStringLiteral("show_clock"))->setVisible(true);
m_playerClock->setPlayerName(White, Protocol::white()->playerName());
m_playerClock->setPlayerName(Black, Protocol::black()->playerName());
m_playerClock->setTimeLimit(White, Manager::self()->timeLimit(White));
......@@ -332,12 +332,12 @@ void MainWindow::protocolInitSuccesful() {
showClock = Settings::showClock();
}
m_clockDock->setVisible(showClock);
actionCollection()->action(QLatin1String("show_clock"))->setChecked(showClock);
actionCollection()->action(QStringLiteral("show_clock"))->setChecked(showClock);
//history dock
bool showHistory = Settings::showHistory();
m_historyDock->setVisible(showHistory);
actionCollection()->action(QLatin1String("show_history"))->setChecked(showHistory);
actionCollection()->action(QStringLiteral("show_history"))->setChecked(showHistory);
if ( !(Protocol::white()->supportedFeatures() & Protocol::Undo &&
Protocol::black()->supportedFeatures() & Protocol::Undo) ) {
......@@ -367,9 +367,9 @@ void MainWindow::protocolInitSuccesful() {
// show console action button if protocol allows a console
// show console dock widget if protocol allows and configuration file entry has visible = true
// finally, hide any dock widget not needed - in case it is still active from previous game
actionCollection()->action(QLatin1String("show_console_white"))->setVisible(false);
actionCollection()->action(QLatin1String("show_console_black"))->setVisible(false);
actionCollection()->action(QLatin1String("show_chat"))->setVisible(false);
actionCollection()->action(QStringLiteral("show_console_white"))->setVisible(false);
actionCollection()->action(QStringLiteral("show_console_black"))->setVisible(false);
actionCollection()->action(QStringLiteral("show_chat"))->setVisible(false);
QList<Protocol::ToolWidgetData> list;
list << Protocol::black()->toolWidgets();
list << Protocol::white()->toolWidgets();
......@@ -379,24 +379,24 @@ void MainWindow::protocolInitSuccesful() {
if(data.owner == White) {
m_wconsoleDock->setWindowTitle(data.title);
m_wconsoleDock->setWidget(data.widget);
actionCollection()->action(QLatin1String("show_console_white"))->setVisible(true);
actionCollection()->action(QStringLiteral("show_console_white"))->setVisible(true);
if(Settings::showConsole()) {
m_wconsoleDock->setVisible(true);
actionCollection()->action(QLatin1String("show_console_white"))->setChecked(true);
actionCollection()->action(QStringLiteral("show_console_white"))->setChecked(true);
} else {
m_wconsoleDock->setVisible(false);
actionCollection()->action(QLatin1String("show_console_white"))->setChecked(false);
actionCollection()->action(QStringLiteral("show_console_white"))->setChecked(false);
}
} else {
m_bconsoleDock->setWindowTitle(data.title);
m_bconsoleDock->setWidget(data.widget);
actionCollection()->action(QLatin1String("show_console_black"))->setVisible(true);
actionCollection()->action(QStringLiteral("show_console_black"))->setVisible(true);
if(Settings::showConsole()) {
m_bconsoleDock->setVisible(true);
actionCollection()->action(QLatin1String("show_console_black"))->setChecked(true);
actionCollection()->action(QStringLiteral("show_console_black"))->setChecked(true);
} else {
m_bconsoleDock->setVisible(false);
actionCollection()->action(QLatin1String("show_console_black"))->setChecked(false);
actionCollection()->action(QStringLiteral("show_console_black"))->setChecked(false);
}
}
break;
......@@ -404,13 +404,13 @@ void MainWindow::protocolInitSuccesful() {
case Protocol::ChatToolWidget:
m_chatDock->setWindowTitle(data.title);
m_chatDock->setWidget(data.widget);
actionCollection()->action(QLatin1String("show_chat"))->setVisible(true);
actionCollection()->action(QStringLiteral("show_chat"))->setVisible(true);
if(Settings::showChat()) {
m_chatDock->setVisible(true);
actionCollection()->action(QLatin1String("show_chat"))->setChecked(true);
actionCollection()->action(QStringLiteral("show_chat"))->setChecked(true);
} else {
m_chatDock->setVisible(false);
actionCollection()->action(QLatin1String("show_chat"))->setChecked(false);
actionCollection()->action(QStringLiteral("show_chat"))->setChecked(false);
}
break;
......@@ -418,11 +418,11 @@ void MainWindow::protocolInitSuccesful() {
break;
}
}
if(!actionCollection()->action(QLatin1String("show_console_white"))->isVisible())
if(!actionCollection()->action(QStringLiteral("show_console_white"))->isVisible())
m_wconsoleDock->hide();
if(!actionCollection()->action(QLatin1String("show_console_black"))->isVisible())
if(!actionCollection()->action(QStringLiteral("show_console_black"))->isVisible())
m_bconsoleDock->hide();
if(!actionCollection()->action(QLatin1String("show_chat"))->isVisible())
if(!actionCollection()->action(QStringLiteral("show_chat"))->isVisible())
m_chatDock->hide();
Manager::self()->startGame();
......@@ -450,17 +450,17 @@ void MainWindow::protocolError(Protocol::ErrorCode errorCode, const QString& err
}
void MainWindow::optionsPreferences() {
if(KConfigDialog::showDialog(QLatin1String("settings")))
if(KConfigDialog::showDialog(QStringLiteral("settings")))
return;
KConfigDialog *dialog = new KConfigDialog(this, QLatin1String("settings"), Settings::self());
KConfigDialog *dialog = new KConfigDialog(this, QStringLiteral("settings"), Settings::self());
QWidget *generalSettingsDlg = new QWidget;
ui_prefs_base.setupUi(generalSettingsDlg);
dialog->addPage(generalSettingsDlg, i18n("General"), QLatin1String("games-config-options"));
dialog->addPage(generalSettingsDlg, i18n("General"), QStringLiteral("games-config-options"));
connect(dialog, &KConfigDialog::settingsChanged, m_view, &KnightsView::settingsChanged);
EngineSettings* engineSettings = new EngineSettings(this);
dialog->addPage(engineSettings, i18n("Computer Engines"), QLatin1String("computer"));
dialog->addPage(engineSettings, i18n("Computer Engines"), QStringLiteral("computer"));
connect(dialog, &KConfigDialog::accepted, engineSettings, &EngineSettings::save);
//FIXME: the accessibility page doesn't seem to be used at the moment.
......@@ -470,7 +470,7 @@ void MainWindow::optionsPreferences() {
// dialog->addPage(accessDlg, i18n("Accessibility"), QLatin1String("preferences-desktop-accessibility"));
QWidget* themeDlg = new KgThemeSelector(m_themeProvider, KgThemeSelector::EnableNewStuffDownload, dialog);
dialog->addPage(themeDlg, i18n("Theme"), QLatin1String("games-config-theme"));
dialog->addPage(themeDlg, i18n("Theme"), QStringLiteral("games-config-theme"));
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
......@@ -590,9 +590,9 @@ void MainWindow::setShowHistorySetting(bool value) {
}
void MainWindow::setShowConsoleSetting() {
if((actionCollection()->action(QLatin1String("show_console_white"))->isChecked()) && (actionCollection()->action(QLatin1String("show_console_white"))->isVisible()))
if((actionCollection()->action(QStringLiteral("show_console_white"))->isChecked()) && (actionCollection()->action(QStringLiteral("show_console_white"))->isVisible()))
Settings::setShowConsole(true);
else if((actionCollection()->action(QLatin1String("show_console_black"))->isChecked()) && (actionCollection()->action(QLatin1String("show_console_black"))->isVisible()))
else if((actionCollection()->action(QStringLiteral("show_console_black"))->isChecked()) && (actionCollection()->action(QStringLiteral("show_console_black"))->isVisible()))
Settings::setShowConsole(true);
else
Settings::setShowConsole(false);
......
......@@ -32,10 +32,10 @@ OfferWidget::OfferWidget(const Knights::Offer& offer, QWidget* parent, Qt::Windo
offerId = offer.id;
if ( offer.action != ActionNone ) {
QAction* action;
action = new QAction( QIcon::fromTheme(QLatin1String("dialog-ok")), i18n("Accept"), this );
action = new QAction( QIcon::fromTheme(QStringLiteral("dialog-ok")), i18n("Accept"), this );
connect ( action, &QAction::triggered, this, &OfferWidget::acceptClicked );
addAction(action);
action = new QAction( QIcon::fromTheme(QLatin1String("edit-delete")), i18n("Decline"), this );
action = new QAction( QIcon::fromTheme(QStringLiteral("edit-delete")), i18n("Decline"), this );
connect ( action, &QAction::triggered, this, &OfferWidget::declineClicked );
addAction ( action );
}
......
......@@ -50,7 +50,7 @@ ChatWidget::ChatWidget ( QWidget* parent, Qt::WindowFlags f ) : QWidget ( parent
ui->setupUi(this);
connect ( ui->sendButton, &QPushButton::clicked, this, &ChatWidget::sendButtonClicked );
ui->sendButton->setIcon( QIcon::fromTheme(QLatin1String("mail-send")) );
ui->sendButton->setIcon( QIcon::fromTheme(QStringLiteral("mail-send")) );
m_terminal = new Terminal;
ui->consoleLayout->addWidget(m_terminal);
......@@ -87,7 +87,7 @@ void ChatWidget::addText ( const QString& text, ChatWidget::MessageType type ) {
cursor.setCharFormat( format );
cursor.insertText( text );
}
cursor.insertText(QLatin1String("\n"));
cursor.insertText(QStringLiteral("\n"));
}
void ChatWidget::addText ( const QByteArray& text, ChatWidget::MessageType type )