diff --git a/src/ViewContainer.cpp b/src/ViewContainer.cpp index ab5de535e..62b357e8b 100644 --- a/src/ViewContainer.cpp +++ b/src/ViewContainer.cpp @@ -425,11 +425,11 @@ void TabbedViewContainer::setStyleSheet(const QString& styleSheet) void TabbedViewContainer::navigationTextModeChanged(bool useTextWidth) { if (useTextWidth) { - _tabBar->setStyleSheet("QTabBar::tab { }"); + _tabBar->setStyleSheet(QStringLiteral("QTabBar::tab { }")); _tabBar->setExpanding(false); _tabBar->setElideMode(Qt::ElideNone); } else { - _tabBar->setStyleSheet("QTabBar::tab { min-width: 2em; max-width: 25em }"); + _tabBar->setStyleSheet(QStringLiteral("QTabBar::tab { min-width: 2em; max-width: 25em }")); _tabBar->setExpanding(true); _tabBar->setElideMode(Qt::ElideLeft); } @@ -695,7 +695,7 @@ void TabbedViewContainer::updateTitle(ViewProperties* item) _tabBar->setTabToolTip(index , tabText); // To avoid having & replaced with _ (shortcut indicator) - tabText.replace('&', "&&"); + tabText.replace(QLatin1Char('&'), QLatin1String("&&")); _tabBar->setTabText(index , tabText); } } diff --git a/src/ViewContainerTabBar.cpp b/src/ViewContainerTabBar.cpp index 8538ca77d..14157f31c 100644 --- a/src/ViewContainerTabBar.cpp +++ b/src/ViewContainerTabBar.cpp @@ -173,7 +173,7 @@ void ViewContainerTabBar::setDropIndicator(int index, bool drawDisabled) } QIcon::Mode drawMode = drawDisabled ? QIcon::Disabled : QIcon::Normal; - const QString iconName = north ? "arrow-up" : "arrow-down"; + const QString iconName = north ? QStringLiteral("arrow-up") : QStringLiteral("arrow-down"); _dropIndicator->setPixmap(QIcon::fromTheme(iconName).pixmap(ARROW_SIZE, ARROW_SIZE, drawMode)); _drawIndicatorDisabled = drawDisabled; } diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index e2cc18519..a4bc8b42e 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -145,20 +145,20 @@ void ViewManager::setupActions() i18nc("@action:inmenu", "Split View Left/Right"), this); collection->setDefaultShortcut(splitLeftRightAction, Konsole::ACCEL + Qt::Key_ParenLeft); - collection->addAction("split-view-left-right", splitLeftRightAction); + collection->addAction(QStringLiteral("split-view-left-right"), splitLeftRightAction); connect(splitLeftRightAction , &QAction::triggered , this , &Konsole::ViewManager::splitLeftRight); QAction* splitTopBottomAction = new QAction(QIcon::fromTheme(QStringLiteral("view-split-top-bottom")) , i18nc("@action:inmenu", "Split View Top/Bottom"), this); collection->setDefaultShortcut(splitTopBottomAction, Konsole::ACCEL + Qt::Key_ParenRight); - collection->addAction("split-view-top-bottom", splitTopBottomAction); + collection->addAction(QStringLiteral("split-view-top-bottom"), splitTopBottomAction); connect(splitTopBottomAction , &QAction::triggered , this , &Konsole::ViewManager::splitTopBottom); QAction* closeActiveAction = new QAction(i18nc("@action:inmenu Close Active View", "Close Active") , this); closeActiveAction->setIcon(QIcon::fromTheme(QStringLiteral("view-close"))); collection->setDefaultShortcut(closeActiveAction, Konsole::ACCEL + Qt::SHIFT + Qt::Key_X); closeActiveAction->setEnabled(false); - collection->addAction("close-active-view", closeActiveAction); + collection->addAction(QStringLiteral("close-active-view"), closeActiveAction); connect(closeActiveAction , &QAction::triggered , this , &Konsole::ViewManager::closeActiveContainer); multiViewOnlyActions << closeActiveAction; @@ -166,7 +166,7 @@ void ViewManager::setupActions() QAction* closeOtherAction = new QAction(i18nc("@action:inmenu Close Other Views", "Close Others") , this); collection->setDefaultShortcut(closeOtherAction, Konsole::ACCEL + Qt::SHIFT + Qt::Key_O); closeOtherAction->setEnabled(false); - collection->addAction("close-other-views", closeOtherAction); + collection->addAction(QStringLiteral("close-other-views"), closeOtherAction); connect(closeOtherAction , &QAction::triggered , this , &Konsole::ViewManager::closeOtherContainers); multiViewOnlyActions << closeOtherAction; @@ -175,7 +175,7 @@ void ViewManager::setupActions() QAction* expandActiveAction = new QAction(i18nc("@action:inmenu", "Expand View") , this); collection->setDefaultShortcut(expandActiveAction, Konsole::ACCEL + Qt::SHIFT + Qt::Key_BracketRight); expandActiveAction->setEnabled(false); - collection->addAction("expand-active-view", expandActiveAction); + collection->addAction(QStringLiteral("expand-active-view"), expandActiveAction); connect(expandActiveAction , &QAction::triggered , this , &Konsole::ViewManager::expandActiveContainer); multiViewOnlyActions << expandActiveAction; @@ -183,13 +183,13 @@ void ViewManager::setupActions() QAction* shrinkActiveAction = new QAction(i18nc("@action:inmenu", "Shrink View") , this); collection->setDefaultShortcut(shrinkActiveAction, Konsole::ACCEL + Qt::SHIFT + Qt::Key_BracketLeft); shrinkActiveAction->setEnabled(false); - collection->addAction("shrink-active-view", shrinkActiveAction); + collection->addAction(QStringLiteral("shrink-active-view"), shrinkActiveAction); connect(shrinkActiveAction , &QAction::triggered , this , &Konsole::ViewManager::shrinkActiveContainer); multiViewOnlyActions << shrinkActiveAction; #if defined(ENABLE_DETACHING) - QAction* detachViewAction = collection->addAction("detach-view"); + QAction* detachViewAction = collection->addAction(QStringLiteral("detach-view")); detachViewAction->setIcon(QIcon::fromTheme(QStringLiteral("tab-detach"))); detachViewAction->setText(i18nc("@action:inmenu", "D&etach Current Tab")); // Ctrl+Shift+D is not used as a shortcut by default because it is too close @@ -201,12 +201,12 @@ void ViewManager::setupActions() #endif // Next / Previous View , Next Container - collection->addAction("next-view", nextViewAction); - collection->addAction("previous-view", previousViewAction); - collection->addAction("last-tab", lastViewAction); - collection->addAction("next-container", nextContainerAction); - collection->addAction("move-view-left", moveViewLeftAction); - collection->addAction("move-view-right", moveViewRightAction); + collection->addAction(QStringLiteral("next-view"), nextViewAction); + collection->addAction(QStringLiteral("previous-view"), previousViewAction); + collection->addAction(QStringLiteral("last-tab"), lastViewAction); + collection->addAction(QStringLiteral("next-container"), nextContainerAction); + collection->addAction(QStringLiteral("move-view-left"), moveViewLeftAction); + collection->addAction(QStringLiteral("move-view-right"), moveViewRightAction); // Switch to tab N shortcuts const int SWITCH_TO_TAB_COUNT = 19; @@ -216,7 +216,7 @@ void ViewManager::setupActions() QAction* switchToTabAction = new QAction(i18nc("@action Shortcut entry", "Switch to Tab %1", i + 1), this); switchToTabMapper->setMapping(switchToTabAction, i); connect(switchToTabAction, &QAction::triggered, switchToTabMapper, static_cast(&QSignalMapper::map)); - collection->addAction(QString("switch-to-tab-%1").arg(i), switchToTabAction); + collection->addAction(QStringLiteral("switch-to-tab-%1").arg(i), switchToTabAction); } foreach(QAction* action, multiViewOnlyActions) { @@ -275,7 +275,7 @@ void ViewManager::updateDetachViewState() auto activeContainer = _viewSplitter->activeContainer(); const bool shouldEnable = splitView || ((activeContainer != nullptr) && activeContainer->views().count() >= 2); - QAction* detachAction = _actionCollection->action("detach-view"); + QAction* detachAction = _actionCollection->action(QStringLiteral("detach-view")); if ((detachAction != nullptr) && shouldEnable != detachAction->isEnabled()) detachAction->setEnabled(shouldEnable); @@ -690,28 +690,28 @@ void ViewManager::setNavigationMethod(NavigationMethod method) const bool enable = (_navigationMethod != NoNavigation); QAction* action; - action = collection->action("next-view"); + action = collection->action(QStringLiteral("next-view")); if (action != nullptr) action->setEnabled(enable); - action = collection->action("previous-view"); + action = collection->action(QStringLiteral("previous-view")); if (action != nullptr) action->setEnabled(enable); - action = collection->action("last-tab"); + action = collection->action(QStringLiteral("last-tab")); if (action != nullptr) action->setEnabled(enable); - action = collection->action("split-view-left-right"); + action = collection->action(QStringLiteral("split-view-left-right")); if (action != nullptr) action->setEnabled(enable); - action = collection->action("split-view-top-bottom"); + action = collection->action(QStringLiteral("split-view-top-bottom")); if (action != nullptr) action->setEnabled(enable); - action = collection->action("rename-session"); + action = collection->action(QStringLiteral("rename-session")); if (action != nullptr) action->setEnabled(enable); - action = collection->action("move-view-left"); + action = collection->action(QStringLiteral("move-view-left")); if (action != nullptr) action->setEnabled(enable); - action = collection->action("move-view-right"); + action = collection->action(QStringLiteral("move-view-right")); if (action != nullptr) action->setEnabled(enable); } diff --git a/src/ViewProperties.cpp b/src/ViewProperties.cpp index 219653079..b054e54fa 100644 --- a/src/ViewProperties.cpp +++ b/src/ViewProperties.cpp @@ -23,7 +23,7 @@ using Konsole::ViewProperties; QHash ViewProperties::_viewProperties; -QString ViewProperties::_mimeType = "application/x-konsole-view-id"; +QString ViewProperties::_mimeType = QStringLiteral("application/x-konsole-view-id"); ViewProperties::ViewProperties(QObject* parent) : QObject(parent)