From ecaf25ead60c6adde20af8bed5b8457f45aae445 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Wed, 29 Jan 2020 23:48:35 +0500 Subject: [PATCH] perf: Fix all clazy qstring-allocation warnings (#903) --- src/app/main.cpp | 4 +- .../qt/element/bookmark/QtBookmark.cpp | 32 +-- .../element/bookmark/QtBookmarkCategory.cpp | 20 +- .../qt/element/button/QtHelpButton.cpp | 6 +- .../qt/element/button/QtHoverButton.cpp | 2 +- .../qt/element/button/QtIconButton.cpp | 2 +- .../qt/element/button/QtIconStateButton.cpp | 4 +- src/lib_gui/qt/element/code/QtCodeArea.cpp | 2 +- src/lib_gui/qt/element/code/QtCodeField.cpp | 10 +- src/lib_gui/qt/element/code/QtCodeFile.cpp | 2 +- .../qt/element/code/QtCodeFileList.cpp | 6 +- .../qt/element/code/QtCodeFileSingle.cpp | 6 +- .../qt/element/code/QtCodeFileTitleBar.cpp | 34 +-- .../qt/element/code/QtCodeFileTitleButton.cpp | 14 +- .../qt/element/code/QtCodeNavigator.cpp | 36 +-- src/lib_gui/qt/element/code/QtCodeSnippet.cpp | 6 +- src/lib_gui/qt/element/dialog/QtListBox.cpp | 16 +- .../qt/element/dialog/QtListBoxItem.cpp | 2 +- .../qt/element/dialog/QtLocationPicker.cpp | 8 +- .../qt/element/dialog/QtNewsWidget.cpp | 32 +-- .../qt/element/dialog/QtPathListBox.cpp | 4 +- .../qt/element/dialog/QtPathListBoxItem.cpp | 6 +- src/lib_gui/qt/element/dialog/QtTextEdit.cpp | 2 +- .../element/dialog/QtUpdateCheckerWidget.cpp | 16 +- .../qt/element/history/QtHistoryList.cpp | 11 +- src/lib_gui/qt/element/history/QtUndoRedo.cpp | 14 +- .../element/search/QtAutocompletionList.cpp | 22 +- .../qt/element/search/QtScreenSearchBox.cpp | 26 +- src/lib_gui/qt/element/search/QtSearchBar.cpp | 14 +- .../qt/element/search/QtSearchBarButton.cpp | 2 +- .../qt/element/search/QtSmartSearchBox.cpp | 10 +- .../qt/graphics/base/QtGraphicsView.cpp | 88 +++---- src/lib_gui/qt/graphics/graph/QtGraphNode.cpp | 3 +- .../qt/graphics/graph/QtGraphNodeBundle.cpp | 2 +- src/lib_gui/qt/network/QtUpdateChecker.cpp | 18 +- .../qt/project_wizard/QtProjectWizard.cpp | 46 ++-- .../project_wizard/QtProjectWizardWindow.cpp | 2 +- .../content/QtProjectWizardContent.cpp | 12 +- .../QtProjectWizardContentCustomCommand.cpp | 12 +- .../QtProjectWizardContentExtensions.cpp | 6 +- .../QtProjectWizardContentPreferences.cpp | 245 +++++++++--------- .../QtProjectWizardContentProjectData.cpp | 24 +- .../content/QtProjectWizardContentSelect.cpp | 19 +- .../QtProjectWizardContentSourceGroupData.cpp | 12 +- ...rojectWizardContentSourceGroupInfoText.cpp | 2 +- .../QtProjectWizardContentUnloadable.cpp | 2 +- .../paths/QtProjectWizardContentPaths.cpp | 12 +- .../QtProjectWizardContentPathsExclude.cpp | 2 +- .../QtProjectWizardContentPathsSource.cpp | 12 +- src/lib_gui/qt/utility/QtFileDialog.cpp | 8 +- .../utility/QtFilesAndDirectoriesDialog.cpp | 2 +- src/lib_gui/qt/utility/QtHighlighter.cpp | 8 +- src/lib_gui/qt/view/QtBookmarkButtonsView.cpp | 20 +- src/lib_gui/qt/view/QtCustomTrailView.cpp | 74 +++--- src/lib_gui/qt/view/QtDialogView.cpp | 2 +- src/lib_gui/qt/view/QtErrorView.cpp | 53 ++-- src/lib_gui/qt/view/QtGraphView.cpp | 76 +++--- src/lib_gui/qt/view/QtGraphViewStyleImpl.cpp | 2 +- src/lib_gui/qt/view/QtRefreshView.cpp | 6 +- src/lib_gui/qt/view/QtScreenSearchView.cpp | 2 +- src/lib_gui/qt/view/QtStatusView.cpp | 15 +- src/lib_gui/qt/view/QtTabbedView.cpp | 6 +- src/lib_gui/qt/view/QtTabsView.cpp | 24 +- src/lib_gui/qt/window/QtAbout.cpp | 16 +- src/lib_gui/qt/window/QtBookmarkBrowser.cpp | 30 +-- src/lib_gui/qt/window/QtBookmarkCreator.cpp | 33 +-- src/lib_gui/qt/window/QtIndexingDialog.cpp | 14 +- src/lib_gui/qt/window/QtIndexingDialog.h | 2 +- .../qt/window/QtIndexingProgressDialog.cpp | 16 +- .../qt/window/QtIndexingReportDialog.cpp | 37 +-- .../qt/window/QtIndexingStartDialog.cpp | 24 +- src/lib_gui/qt/window/QtKeyboardShortcuts.cpp | 136 +++++----- .../qt/window/QtKnownProgressDialog.cpp | 6 +- src/lib_gui/qt/window/QtLicenseWindow.cpp | 8 +- src/lib_gui/qt/window/QtMainWindow.cpp | 44 ++-- src/lib_gui/qt/window/QtPathListDialog.cpp | 6 +- src/lib_gui/qt/window/QtPreferencesWindow.cpp | 4 +- src/lib_gui/qt/window/QtProgressBarDialog.cpp | 10 +- src/lib_gui/qt/window/QtSelectPathsDialog.cpp | 26 +- src/lib_gui/qt/window/QtStartScreen.cpp | 42 +-- src/lib_gui/qt/window/QtTextEditDialog.cpp | 12 +- .../qt/window/QtUnknownProgressDialog.cpp | 6 +- src/lib_gui/qt/window/QtWindow.cpp | 22 +- src/lib_gui/qt/window/QtWindowBase.cpp | 2 +- src/lib_gui/utility/utilityApp.cpp | 9 +- 85 files changed, 853 insertions(+), 840 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index a6f96797..3e145428 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -95,14 +95,14 @@ void addLanguagePackages() int main(int argc, char *argv[]) { - QCoreApplication::addLibraryPath("."); + QCoreApplication::addLibraryPath(QStringLiteral(".")); if (utility::getOsType() == OS_LINUX && std::getenv("SOURCETRAIL_VIA_SCRIPT") == nullptr) { std::cout << "ERROR: Please run Sourcetrail via the Sourcetrail.sh script!" << std::endl; } - QApplication::setApplicationName("Sourcetrail"); + QApplication::setApplicationName(QStringLiteral("Sourcetrail")); if (utility::getOsType() != OS_LINUX) { diff --git a/src/lib_gui/qt/element/bookmark/QtBookmark.cpp b/src/lib_gui/qt/element/bookmark/QtBookmark.cpp index 18781896..bd22a169 100644 --- a/src/lib_gui/qt/element/bookmark/QtBookmark.cpp +++ b/src/lib_gui/qt/element/bookmark/QtBookmark.cpp @@ -16,7 +16,7 @@ QtBookmark::QtBookmark(ControllerProxy* controllerProxy) , m_hovered(false) , m_ignoreNextResize(false) { - setObjectName("bookmark"); + setObjectName(QStringLiteral("bookmark")); QVBoxLayout* layout = new QVBoxLayout(); layout->setSpacing(0); @@ -30,14 +30,14 @@ QtBookmark::QtBookmark(ControllerProxy* controllerProxy) buttonsLayout->setAlignment(Qt::AlignTop); m_activateButton = new QPushButton(); - m_activateButton->setObjectName("activate_button"); - m_activateButton->setToolTip("Activate bookmark"); + m_activateButton->setObjectName(QStringLiteral("activate_button")); + m_activateButton->setToolTip(QStringLiteral("Activate bookmark")); m_activateButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); buttonsLayout->addWidget(m_activateButton); m_toggleCommentButton = new QPushButton(); - m_toggleCommentButton->setObjectName("comment_button"); - m_toggleCommentButton->setToolTip("Show Comment"); + m_toggleCommentButton->setObjectName(QStringLiteral("comment_button")); + m_toggleCommentButton->setToolTip(QStringLiteral("Show Comment")); m_toggleCommentButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); m_toggleCommentButton->setIconSize(QSize(20, 20)); utility::setWidgetRetainsSpaceWhenHidden(m_toggleCommentButton); @@ -47,12 +47,12 @@ QtBookmark::QtBookmark(ControllerProxy* controllerProxy) buttonsLayout->addStretch(); m_dateLabel = new QLabel(); - m_dateLabel->setObjectName("date_label"); + m_dateLabel->setObjectName(QStringLiteral("date_label")); buttonsLayout->addWidget(m_dateLabel); m_editButton = new QPushButton(); - m_editButton->setObjectName("edit_button"); - m_editButton->setToolTip("Edit bookmark"); + m_editButton->setObjectName(QStringLiteral("edit_button")); + m_editButton->setToolTip(QStringLiteral("Edit bookmark")); m_editButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); m_editButton->setIconSize(QSize(20, 20)); m_editButton->setIcon(QPixmap(QString::fromStdWString( @@ -62,8 +62,8 @@ QtBookmark::QtBookmark(ControllerProxy* controllerProxy) buttonsLayout->addWidget(m_editButton); m_deleteButton = new QPushButton(); - m_deleteButton->setObjectName("delete_button"); - m_deleteButton->setToolTip("Delete bookmark"); + m_deleteButton->setObjectName(QStringLiteral("delete_button")); + m_deleteButton->setToolTip(QStringLiteral("Delete bookmark")); m_deleteButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); m_deleteButton->setIconSize(QSize(20, 20)); m_deleteButton->setIcon(QPixmap( @@ -76,8 +76,8 @@ QtBookmark::QtBookmark(ControllerProxy* controllerProxy) layout->addLayout(buttonsLayout); - m_comment = new QLabel(""); - m_comment->setObjectName("bookmark_comment"); + m_comment = new QLabel(QLatin1String("")); + m_comment->setObjectName(QStringLiteral("bookmark_comment")); m_comment->setWordWrap(true); m_comment->hide(); layout->addWidget(m_comment); @@ -212,10 +212,10 @@ void QtBookmark::editClicked() void QtBookmark::deleteClicked() { QMessageBox msgBox; - msgBox.setText("Delete Bookmark"); - msgBox.setInformativeText("Do you really want to delete this bookmark?"); - msgBox.addButton("Delete", QMessageBox::ButtonRole::YesRole); - msgBox.addButton("Keep", QMessageBox::ButtonRole::NoRole); + msgBox.setText(QStringLiteral("Delete Bookmark")); + msgBox.setInformativeText(QStringLiteral("Do you really want to delete this bookmark?")); + msgBox.addButton(QStringLiteral("Delete"), QMessageBox::ButtonRole::YesRole); + msgBox.addButton(QStringLiteral("Keep"), QMessageBox::ButtonRole::NoRole); msgBox.setIcon(QMessageBox::Icon::Question); int ret = msgBox.exec(); diff --git a/src/lib_gui/qt/element/bookmark/QtBookmarkCategory.cpp b/src/lib_gui/qt/element/bookmark/QtBookmarkCategory.cpp index ca1bf16e..1deda78c 100644 --- a/src/lib_gui/qt/element/bookmark/QtBookmarkCategory.cpp +++ b/src/lib_gui/qt/element/bookmark/QtBookmarkCategory.cpp @@ -12,7 +12,7 @@ QtBookmarkCategory::QtBookmarkCategory(ControllerProxy* controllerProxy) : m_controllerProxy(controllerProxy), m_id(0) { - setObjectName("bookmark_category"); + setObjectName(QStringLiteral("bookmark_category")); QHBoxLayout* layout = new QHBoxLayout(); layout->setSpacing(0); @@ -21,8 +21,8 @@ QtBookmarkCategory::QtBookmarkCategory(ControllerProxy* cont setLayout(layout); m_expandButton = new QPushButton(); - m_expandButton->setObjectName("category_expand_button"); - m_expandButton->setToolTip("Show/Hide bookmarks in this category"); + m_expandButton->setObjectName(QStringLiteral("category_expand_button")); + m_expandButton->setToolTip(QStringLiteral("Show/Hide bookmarks in this category")); m_expandButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); m_expandButton->setIcon(QPixmap(QString::fromStdWString( ResourcePaths::getGuiPath().concatenate(L"bookmark_view/images/arrow_down.png").wstr()))); @@ -32,14 +32,14 @@ QtBookmarkCategory::QtBookmarkCategory(ControllerProxy* cont connect(m_expandButton, &QPushButton::clicked, this, &QtBookmarkCategory::expandClicked); m_name = new QLabel(); - m_name->setObjectName("category_name"); + m_name->setObjectName(QStringLiteral("category_name")); layout->addWidget(m_name); layout->addStretch(); m_deleteButton = new QPushButton(); - m_deleteButton->setObjectName("category_delete_button"); - m_deleteButton->setToolTip("Delete this Bookmark Category and the containing Bookmarks"); + m_deleteButton->setObjectName(QStringLiteral("category_delete_button")); + m_deleteButton->setToolTip(QStringLiteral("Delete this Bookmark Category and the containing Bookmarks")); m_deleteButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); m_deleteButton->setIconSize(QSize(20, 20)); m_deleteButton->setIcon(QPixmap( @@ -121,11 +121,11 @@ void QtBookmarkCategory::leaveEvent(QEvent* event) void QtBookmarkCategory::deleteClicked() { QMessageBox msgBox; - msgBox.setText("Delete Category"); + msgBox.setText(QStringLiteral("Delete Category")); msgBox.setInformativeText( - "Do you really want to delete this category AND all containing bookmarks?"); - msgBox.addButton("Delete", QMessageBox::ButtonRole::YesRole); - msgBox.addButton("Keep", QMessageBox::ButtonRole::NoRole); + QStringLiteral("Do you really want to delete this category AND all containing bookmarks?")); + msgBox.addButton(QStringLiteral("Delete"), QMessageBox::ButtonRole::YesRole); + msgBox.addButton(QStringLiteral("Keep"), QMessageBox::ButtonRole::NoRole); msgBox.setIcon(QMessageBox::Icon::Question); int ret = msgBox.exec(); diff --git a/src/lib_gui/qt/element/button/QtHelpButton.cpp b/src/lib_gui/qt/element/button/QtHelpButton.cpp index 048b334b..d239610b 100644 --- a/src/lib_gui/qt/element/button/QtHelpButton.cpp +++ b/src/lib_gui/qt/element/button/QtHelpButton.cpp @@ -16,9 +16,9 @@ QtHelpButton::QtHelpButton(const QString& helpTitle, const QString& helpText, QW setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac setMouseTracking(true); - setToolTip("help"); + setToolTip(QStringLiteral("help")); setIconSize(QSize(16, 16)); - setObjectName("helpButton"); + setObjectName(QStringLiteral("helpButton")); leaveEvent(nullptr); @@ -28,7 +28,7 @@ QtHelpButton::QtHelpButton(const QString& helpTitle, const QString& helpText, QW void QtHelpButton::handleHelpPress() { QMessageBox msgBox; - msgBox.setWindowTitle("Sourcetrail"); + msgBox.setWindowTitle(QStringLiteral("Sourcetrail")); msgBox.setIcon(QMessageBox::Information); msgBox.setText("" + m_helpTitle + ""); msgBox.setInformativeText(m_helpText); diff --git a/src/lib_gui/qt/element/button/QtHoverButton.cpp b/src/lib_gui/qt/element/button/QtHoverButton.cpp index 0b54e5ca..7cbd5570 100644 --- a/src/lib_gui/qt/element/button/QtHoverButton.cpp +++ b/src/lib_gui/qt/element/button/QtHoverButton.cpp @@ -1,6 +1,6 @@ #include "QtHoverButton.h" -QtHoverButton::QtHoverButton(QWidget* parent): QPushButton("", parent) +QtHoverButton::QtHoverButton(QWidget* parent): QPushButton(QLatin1String(""), parent) { setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac setMouseTracking(true); diff --git a/src/lib_gui/qt/element/button/QtIconButton.cpp b/src/lib_gui/qt/element/button/QtIconButton.cpp index 68c950ea..b9910668 100644 --- a/src/lib_gui/qt/element/button/QtIconButton.cpp +++ b/src/lib_gui/qt/element/button/QtIconButton.cpp @@ -5,7 +5,7 @@ #include "utilityQt.h" QtIconButton::QtIconButton(const FilePath& iconPath, const FilePath& hoveredIconPath, QWidget* parent) - : QPushButton("", parent) + : QPushButton(QLatin1String(""), parent) , m_iconPath(iconPath) , m_hoveredIconPath(hoveredIconPath) , m_color(Qt::transparent) diff --git a/src/lib_gui/qt/element/button/QtIconStateButton.cpp b/src/lib_gui/qt/element/button/QtIconStateButton.cpp index 94485e19..164bf43f 100644 --- a/src/lib_gui/qt/element/button/QtIconStateButton.cpp +++ b/src/lib_gui/qt/element/button/QtIconStateButton.cpp @@ -4,13 +4,13 @@ #include "utilityQt.h" -QtIconStateButton::QtIconStateButton(QWidget* parent): QPushButton("", parent) +QtIconStateButton::QtIconStateButton(QWidget* parent): QPushButton(QLatin1String(""), parent) { setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac setMouseTracking(true); - setObjectName("iconStateButton"); + setObjectName(QStringLiteral("iconStateButton")); leaveEvent(nullptr); } diff --git a/src/lib_gui/qt/element/code/QtCodeArea.cpp b/src/lib_gui/qt/element/code/QtCodeArea.cpp index 8df1a44d..9f9066e3 100644 --- a/src/lib_gui/qt/element/code/QtCodeArea.cpp +++ b/src/lib_gui/qt/element/code/QtCodeArea.cpp @@ -55,7 +55,7 @@ bool MouseWheelOverScrollbarFilter::eventFilter(QObject* obj, QEvent* event) QtLineNumberArea::QtLineNumberArea(QtCodeArea* codeArea): QWidget(codeArea), m_codeArea(codeArea) { - setObjectName("line_number_area"); + setObjectName(QStringLiteral("line_number_area")); } QtLineNumberArea::~QtLineNumberArea() {} diff --git a/src/lib_gui/qt/element/code/QtCodeField.cpp b/src/lib_gui/qt/element/code/QtCodeField.cpp index 1e3237df..de17f193 100644 --- a/src/lib_gui/qt/element/code/QtCodeField.cpp +++ b/src/lib_gui/qt/element/code/QtCodeField.cpp @@ -40,7 +40,7 @@ QtCodeField::QtCodeField( { TRACE(); - setObjectName("code_area"); + setObjectName(QStringLiteral("code_area")); setReadOnly(true); setFrameStyle(QFrame::NoFrame); setLineWrapMode(QPlainTextEdit::NoWrap); @@ -96,9 +96,9 @@ QtCodeField::QtCodeField( setFont(font); setTabStopWidth(appSettings->getCodeTabWidth() * fontMetrics().width('9')); - m_openInTabAction = new QAction("Open in New Tab", this); - m_openInTabAction->setStatusTip("Opens the node in a new tab"); - m_openInTabAction->setToolTip("Opens the node in a new tab"); + m_openInTabAction = new QAction(QStringLiteral("Open in New Tab"), this); + m_openInTabAction->setStatusTip(QStringLiteral("Opens the node in a new tab")); + m_openInTabAction->setToolTip(QStringLiteral("Opens the node in a new tab")); m_openInTabAction->setEnabled(false); connect(m_openInTabAction, &QAction::triggered, this, &QtCodeField::openInTab); } @@ -771,7 +771,7 @@ void QtCodeField::createMultibyteCharacterLocationCache(const QString& code) QTextCodec* codec = QTextCodec::codecForName( ApplicationSettings::getInstance()->getTextEncoding().c_str()); - for (const QString& line: code.split("\n")) + for (const QString& line: code.split(QStringLiteral("\n"))) { std::vector> columnsToOffsets; for (int i = 0; i < line.size(); i++) diff --git a/src/lib_gui/qt/element/code/QtCodeFile.cpp b/src/lib_gui/qt/element/code/QtCodeFile.cpp index fd36f075..9addddbb 100644 --- a/src/lib_gui/qt/element/code/QtCodeFile.cpp +++ b/src/lib_gui/qt/element/code/QtCodeFile.cpp @@ -13,7 +13,7 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeNavigator* navigator, bool isFirst) : QFrame(), m_navigator(navigator), m_filePath(filePath), m_isWholeFile(false) { - setObjectName("code_file"); + setObjectName(QStringLiteral("code_file")); setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed); QVBoxLayout* layout = new QVBoxLayout(this); diff --git a/src/lib_gui/qt/element/code/QtCodeFileList.cpp b/src/lib_gui/qt/element/code/QtCodeFileList.cpp index e2cb39b3..d05c4b95 100644 --- a/src/lib_gui/qt/element/code/QtCodeFileList.cpp +++ b/src/lib_gui/qt/element/code/QtCodeFileList.cpp @@ -25,11 +25,11 @@ QtCodeFileList::QtCodeFileList(QtCodeNavigator* navigator) { m_scrollArea = new QScrollArea(); - m_scrollArea->setObjectName("code_container"); + m_scrollArea->setObjectName(QStringLiteral("code_container")); m_scrollArea->setWidgetResizable(true); m_filesArea = new QFrame(); - m_filesArea->setObjectName("code_file_list"); + m_filesArea->setObjectName(QStringLiteral("code_file_list")); QVBoxLayout* innerLayout = new QVBoxLayout(); innerLayout->setSpacing(0); @@ -53,7 +53,7 @@ QtCodeFileList::QtCodeFileList(QtCodeNavigator* navigator) } else { - m_lastSnippetScrollBar->setObjectName("last_scroll_bar"); + m_lastSnippetScrollBar->setObjectName(QStringLiteral("last_scroll_bar")); } m_lastSnippetScrollBar->hide(); diff --git a/src/lib_gui/qt/element/code/QtCodeFileSingle.cpp b/src/lib_gui/qt/element/code/QtCodeFileSingle.cpp index c64614b4..f3979128 100644 --- a/src/lib_gui/qt/element/code/QtCodeFileSingle.cpp +++ b/src/lib_gui/qt/element/code/QtCodeFileSingle.cpp @@ -19,20 +19,20 @@ QtCodeFileSingle::QtCodeFileSingle(QtCodeNavigator* navigator, QWidget* parent) : m_navigator(navigator), m_area(nullptr) { - setObjectName("code_container"); + setObjectName(QStringLiteral("code_container")); setLayout(new QVBoxLayout(this)); layout()->setContentsMargins(0, 0, 0, 0); layout()->setSpacing(0); m_titleBar = new QtCodeFileTitleBar(this, false, true); - m_titleBar->setObjectName("title_bar_single"); + m_titleBar->setObjectName(QStringLiteral("title_bar_single")); layout()->addWidget(m_titleBar); connect(m_titleBar, &QtCodeFileTitleBar::snippet, this, &QtCodeFileSingle::clickedSnippetButton); m_areaWrapper = new QWidget(); - m_areaWrapper->setObjectName("code_file_single"); + m_areaWrapper->setObjectName(QStringLiteral("code_file_single")); m_areaWrapper->setSizePolicy( m_areaWrapper->sizePolicy().horizontalPolicy(), QSizePolicy::Expanding); m_areaWrapper->setLayout(new QVBoxLayout()); diff --git a/src/lib_gui/qt/element/code/QtCodeFileTitleBar.cpp b/src/lib_gui/qt/element/code/QtCodeFileTitleBar.cpp index ce4e2669..9d6e91c4 100644 --- a/src/lib_gui/qt/element/code/QtCodeFileTitleBar.cpp +++ b/src/lib_gui/qt/element/code/QtCodeFileTitleBar.cpp @@ -14,7 +14,7 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool isSingle) : QtHoverButton(parent) { - setObjectName("title_bar"); + setObjectName(QStringLiteral("title_bar")); setProperty("hovering", isHovering); setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac @@ -32,17 +32,17 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is FilePath imageDir = ResourcePaths::getGuiPath().concatenate(L"code_view/images/"); m_expandButton = new QtSelfRefreshIconButton( - "", imageDir.getConcatenated(L"snippet_arrow_right.png"), "code/file/title", this); + QLatin1String(""), imageDir.getConcatenated(L"snippet_arrow_right.png"), "code/file/title", this); m_collapseButton = new QtSelfRefreshIconButton( - "", imageDir.getConcatenated(L"snippet_arrow_down.png"), "code/file/title", this); + QLatin1String(""), imageDir.getConcatenated(L"snippet_arrow_down.png"), "code/file/title", this); - m_expandButton->setToolTip("expand"); - m_collapseButton->setToolTip("collapse"); + m_expandButton->setToolTip(QStringLiteral("expand")); + m_collapseButton->setToolTip(QStringLiteral("collapse")); for (QtSelfRefreshIconButton* button: {m_expandButton, m_collapseButton}) { button->setIconSize(QSize(9, 9)); - button->setObjectName("expand_button"); + button->setObjectName(QStringLiteral("expand_button")); titleLayout->addWidget(button); } @@ -66,15 +66,15 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is setMinimumHeight(m_titleButton->height() + 4); m_referenceCount = new QLabel(this); - m_referenceCount->setObjectName("references_label"); + m_referenceCount->setObjectName(QStringLiteral("references_label")); m_referenceCount->hide(); titleLayout->addWidget(m_referenceCount); titleLayout->addStretch(3); - m_showErrorsButton = new QPushButton("show errors"); - m_showErrorsButton->setObjectName("screen_button"); - m_showErrorsButton->setToolTip("Show all errors causing this file to be incomplete"); + m_showErrorsButton = new QPushButton(QStringLiteral("show errors")); + m_showErrorsButton->setObjectName(QStringLiteral("screen_button")); + m_showErrorsButton->setToolTip(QStringLiteral("Show all errors causing this file to be incomplete")); m_showErrorsButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac m_showErrorsButton->hide(); titleLayout->addWidget(m_showErrorsButton); @@ -94,7 +94,7 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is inactiveColor); m_snippetButton->addState( QtIconStateButton::STATE_DISABLED, imageDir.getConcatenated(L"snippet_inactive.png")); - m_snippetButton->setToolTip("show snippets"); + m_snippetButton->setToolTip(QStringLiteral("show snippets")); m_maximizeButton = new QtIconStateButton(this); m_maximizeButton->addState( @@ -105,12 +105,12 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is inactiveColor); m_maximizeButton->addState( QtIconStateButton::STATE_DISABLED, imageDir.getConcatenated(L"maximize_inactive.png")); - m_maximizeButton->setToolTip("maximize"); + m_maximizeButton->setToolTip(QStringLiteral("maximize")); for (QtIconStateButton* button: {m_snippetButton, m_maximizeButton}) { button->setIconSize(QSize(16, 16)); - button->setObjectName("file_button"); + button->setObjectName(QStringLiteral("file_button")); button->setEnabled(false); titleLayout->addWidget(button); } @@ -160,18 +160,18 @@ void QtCodeFileTitleBar::updateRefCount(int refCount, bool hasErrors, size_t fat { if (refCount > 0) { - QString label = hasErrors ? "error" : "reference"; + QString label = hasErrors ? QStringLiteral("error") : QStringLiteral("reference"); if (refCount > 1) { - label += "s"; + label += QChar('s'); } if (fatalErrorCount > 0) { - label += " (" + QString::number(fatalErrorCount) + " fatal)"; + label += QStringLiteral(" (") + QString::number(fatalErrorCount) + QStringLiteral(" fatal)"); } - QString text = QString::number(refCount) + " " + label; + QString text = QString::number(refCount) + QChar(' ') + label; if (text != m_referenceCount->text()) { m_referenceCount->setText(text); diff --git a/src/lib_gui/qt/element/code/QtCodeFileTitleButton.cpp b/src/lib_gui/qt/element/code/QtCodeFileTitleButton.cpp index e71224fc..5d678c1d 100644 --- a/src/lib_gui/qt/element/code/QtCodeFileTitleButton.cpp +++ b/src/lib_gui/qt/element/code/QtCodeFileTitleButton.cpp @@ -17,11 +17,11 @@ #include "QtContextMenu.h" QtCodeFileTitleButton::QtCodeFileTitleButton(QWidget* parent) - : QtSelfRefreshIconButton("", FilePath(), "code/file/title", parent) + : QtSelfRefreshIconButton(QLatin1String(""), FilePath(), "code/file/title", parent) , m_isComplete(true) , m_isIndexed(true) { - setObjectName("title_button"); + setObjectName(QStringLiteral("title_button")); minimumSizeHint(); // force font loading setFixedHeight(std::max(fontMetrics().height() * 1.2, 28.0)); @@ -31,9 +31,9 @@ QtCodeFileTitleButton::QtCodeFileTitleButton(QWidget* parent) connect(this, &QtCodeFileTitleButton::clicked, this, &QtCodeFileTitleButton::clickedTitle); - m_openInTabAction = new QAction("Open in New Tab", this); - m_openInTabAction->setStatusTip("Opens the file in a new tab"); - m_openInTabAction->setToolTip("Opens the file in a new tab"); + m_openInTabAction = new QAction(QStringLiteral("Open in New Tab"), this); + m_openInTabAction->setStatusTip(QStringLiteral("Opens the file in a new tab")); + m_openInTabAction->setToolTip(QStringLiteral("Opens the file in a new tab")); m_openInTabAction->setEnabled(false); connect(m_openInTabAction, &QAction::triggered, this, &QtCodeFileTitleButton::openInTab); } @@ -65,7 +65,7 @@ void QtCodeFileTitleButton::setProject(const std::wstring& name) m_filePath = FilePath(); setText(QString::fromStdWString(name)); - setToolTip("edit project"); + setToolTip(QStringLiteral("edit project")); updateIcon(); } @@ -273,6 +273,6 @@ void QtCodeFileTitleButton::updateHatching() } else { - setStyleSheet(""); + setStyleSheet(QLatin1String("")); } } diff --git a/src/lib_gui/qt/element/code/QtCodeNavigator.cpp b/src/lib_gui/qt/element/code/QtCodeNavigator.cpp index aeff5c5c..51cac598 100644 --- a/src/lib_gui/qt/element/code/QtCodeNavigator.cpp +++ b/src/lib_gui/qt/element/code/QtCodeNavigator.cpp @@ -35,7 +35,7 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent) { QWidget* navigation = new QWidget(); - navigation->setObjectName("code_navigation"); + navigation->setObjectName(QStringLiteral("code_navigation")); QHBoxLayout* navLayout = new QHBoxLayout(); navLayout->setSpacing(2); @@ -47,11 +47,11 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent) m_nextReferenceButton = new QtSearchBarButton( ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_down.png"), true); - m_prevReferenceButton->setObjectName("reference_button_previous"); - m_nextReferenceButton->setObjectName("reference_button_next"); + m_prevReferenceButton->setObjectName(QStringLiteral("reference_button_previous")); + m_nextReferenceButton->setObjectName(QStringLiteral("reference_button_next")); - m_prevReferenceButton->setToolTip("previous reference"); - m_nextReferenceButton->setToolTip("next reference"); + m_prevReferenceButton->setToolTip(QStringLiteral("previous reference")); + m_nextReferenceButton->setToolTip(QStringLiteral("next reference")); m_prevReferenceButton->setIconSize(QSize(12, 12)); m_nextReferenceButton->setIconSize(QSize(12, 12)); @@ -65,8 +65,8 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent) m_nextReferenceButton, &QPushButton::clicked, this, &QtCodeNavigator::nextReference); // m_refLabel = new QLabel("0 files | 0 references"); - m_refLabel = new QLabel("0 references"); - m_refLabel->setObjectName("references_label"); + m_refLabel = new QLabel(QStringLiteral("0 references")); + m_refLabel->setObjectName(QStringLiteral("references_label")); navLayout->addWidget(m_refLabel); navLayout->addStretch(); @@ -78,11 +78,11 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent) m_nextLocalReferenceButton = new QtSearchBarButton( ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_down.png"), true); - m_prevLocalReferenceButton->setObjectName("local_reference_button_previous"); - m_nextLocalReferenceButton->setObjectName("local_reference_button_next"); + m_prevLocalReferenceButton->setObjectName(QStringLiteral("local_reference_button_previous")); + m_nextLocalReferenceButton->setObjectName(QStringLiteral("local_reference_button_next")); - m_prevLocalReferenceButton->setToolTip("previous local reference"); - m_nextLocalReferenceButton->setToolTip("next local reference"); + m_prevLocalReferenceButton->setToolTip(QStringLiteral("previous local reference")); + m_nextLocalReferenceButton->setToolTip(QStringLiteral("next local reference")); m_prevLocalReferenceButton->setIconSize(QSize(12, 12)); m_nextLocalReferenceButton->setIconSize(QSize(12, 12)); @@ -101,8 +101,8 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent) this, &QtCodeNavigator::nextLocalReference); - m_localRefLabel = new QLabel("0/0 local references"); - m_localRefLabel->setObjectName("references_label"); + m_localRefLabel = new QLabel(QStringLiteral("0/0 local references")); + m_localRefLabel->setObjectName(QStringLiteral("references_label")); navLayout->addWidget(m_localRefLabel); navLayout->addStretch(); @@ -121,11 +121,11 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent) m_fileButton = new QtSearchBarButton( ResourcePaths::getGuiPath().concatenate(L"code_view/images/file.png"), true); - m_listButton->setObjectName("mode_button_list"); - m_fileButton->setObjectName("mode_button_single"); + m_listButton->setObjectName(QStringLiteral("mode_button_list")); + m_fileButton->setObjectName(QStringLiteral("mode_button_single")); - m_listButton->setToolTip("snippet list mode"); - m_fileButton->setToolTip("single file mode"); + m_listButton->setToolTip(QStringLiteral("snippet list mode")); + m_fileButton->setToolTip(QStringLiteral("single file mode")); m_listButton->setCheckable(true); m_fileButton->setCheckable(true); @@ -149,7 +149,7 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent) m_separatorLine = new QFrame(); m_separatorLine->setFrameShape(QFrame::HLine); m_separatorLine->setFrameShadow(QFrame::Plain); - m_separatorLine->setObjectName("separator_line"); + m_separatorLine->setObjectName(QStringLiteral("separator_line")); m_separatorLine->setFixedHeight(1); m_separatorLine->hide(); layout->addWidget(m_separatorLine); diff --git a/src/lib_gui/qt/element/code/QtCodeSnippet.cpp b/src/lib_gui/qt/element/code/QtCodeSnippet.cpp index 168d0baf..3ec5f794 100644 --- a/src/lib_gui/qt/element/code/QtCodeSnippet.cpp +++ b/src/lib_gui/qt/element/code/QtCodeSnippet.cpp @@ -22,7 +22,7 @@ QtCodeSnippet::QtCodeSnippet(const CodeSnippetParams& params, QtCodeNavigator* n , m_footer(nullptr) , m_codeArea(nullptr) { - setObjectName("code_snippet"); + setObjectName(QStringLiteral("code_snippet")); QVBoxLayout* layout = new QVBoxLayout(this); layout->setMargin(0); @@ -189,13 +189,13 @@ QPushButton* QtCodeSnippet::createScopeLine(QBoxLayout* layout) layout->addLayout(lineLayout); QPushButton* dots = new QPushButton(this); - dots->setObjectName("dots"); + dots->setObjectName(QStringLiteral("dots")); dots->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac lineLayout->addWidget(dots); m_dots.push_back(dots); QPushButton* line = new QPushButton(this); - line->setObjectName("scope_name"); + line->setObjectName(QStringLiteral("scope_name")); line->minimumSizeHint(); // force font loading line->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac line->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); diff --git a/src/lib_gui/qt/element/dialog/QtListBox.cpp b/src/lib_gui/qt/element/dialog/QtListBox.cpp index b755847a..a13d6c8c 100644 --- a/src/lib_gui/qt/element/dialog/QtListBox.cpp +++ b/src/lib_gui/qt/element/dialog/QtListBox.cpp @@ -19,7 +19,7 @@ QtListBox::QtListBox(QWidget* parent, const QString& listName): QFrame(parent), layout->setAlignment(Qt::AlignTop); m_list = new QtListWidget(this); - m_list->setObjectName("list"); + m_list->setObjectName(QStringLiteral("list")); m_list->setAttribute(Qt::WA_MacShowFocusRect, 0); connect(m_list, &QListWidget::doubleClicked, this, &QtListBox::doubleClicked); @@ -28,7 +28,7 @@ QtListBox::QtListBox(QWidget* parent, const QString& listName): QFrame(parent), layout->addWidget(m_list, 5); QWidget* buttonContainer = new QWidget(this); - buttonContainer->setObjectName("bar"); + buttonContainer->setObjectName(QStringLiteral("bar")); QHBoxLayout* barLayout = new QHBoxLayout(); barLayout->setContentsMargins(8, 4, 8, 2); @@ -38,16 +38,16 @@ QtListBox::QtListBox(QWidget* parent, const QString& listName): QFrame(parent), ResourcePaths::getGuiPath().concatenate(L"window/plus.png"), ResourcePaths::getGuiPath().concatenate(L"window/plus_hover.png")); m_addButton->setIconSize(QSize(16, 16)); - m_addButton->setObjectName("plusButton"); - m_addButton->setToolTip("add line"); + m_addButton->setObjectName(QStringLiteral("plusButton")); + m_addButton->setToolTip(QStringLiteral("add line")); barLayout->addWidget(m_addButton); m_removeButton = new QtIconButton( ResourcePaths::getGuiPath().concatenate(L"window/minus.png"), ResourcePaths::getGuiPath().concatenate(L"window/minus_hover.png")); m_removeButton->setIconSize(QSize(16, 16)); - m_removeButton->setObjectName("minusButton"); - m_removeButton->setToolTip("remove line"); + m_removeButton->setObjectName(QStringLiteral("minusButton")); + m_removeButton->setToolTip(QStringLiteral("remove line")); barLayout->addWidget(m_removeButton); barLayout->addStretch(); @@ -58,8 +58,8 @@ QtListBox::QtListBox(QWidget* parent, const QString& listName): QFrame(parent), QPushButton* editButton = new QtIconButton( ResourcePaths::getGuiPath().concatenate(L"code_view/images/edit.png"), FilePath()); editButton->setIconSize(QSize(16, 16)); - editButton->setObjectName("editButton"); - editButton->setToolTip("edit plain text"); + editButton->setObjectName(QStringLiteral("editButton")); + editButton->setToolTip(QStringLiteral("edit plain text")); barLayout->addWidget(editButton); buttonContainer->setLayout(barLayout); diff --git a/src/lib_gui/qt/element/dialog/QtListBoxItem.cpp b/src/lib_gui/qt/element/dialog/QtListBoxItem.cpp index 458adf91..39da9283 100644 --- a/src/lib_gui/qt/element/dialog/QtListBoxItem.cpp +++ b/src/lib_gui/qt/element/dialog/QtListBoxItem.cpp @@ -22,7 +22,7 @@ QtListBoxItem::QtListBoxItem(QListWidgetItem* item, QWidget* parent) m_data = new QtLineEdit(this); m_data->setAttribute(Qt::WA_MacShowFocusRect, 0); m_data->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - m_data->setObjectName("field"); + m_data->setObjectName(QStringLiteral("field")); m_data->setAcceptDrops(false); layout->addWidget(m_data); diff --git a/src/lib_gui/qt/element/dialog/QtLocationPicker.cpp b/src/lib_gui/qt/element/dialog/QtLocationPicker.cpp index f0fc8660..dbcf2890 100644 --- a/src/lib_gui/qt/element/dialog/QtLocationPicker.cpp +++ b/src/lib_gui/qt/element/dialog/QtLocationPicker.cpp @@ -13,7 +13,7 @@ QtLocationPicker::QtLocationPicker(QWidget* parent): QWidget(parent), m_pickDirectory(false) { - setObjectName("picker"); + setObjectName(QStringLiteral("picker")); QBoxLayout* layout = new QHBoxLayout(); layout->setSpacing(0); @@ -22,7 +22,7 @@ QtLocationPicker::QtLocationPicker(QWidget* parent): QWidget(parent), m_pickDire m_data = new QtLineEdit(this); m_data->setAttribute(Qt::WA_MacShowFocusRect, 0); - m_data->setObjectName("locationField"); + m_data->setObjectName(QStringLiteral("locationField")); connect(m_data, &QtLineEdit::textChanged, this, &QtLocationPicker::onDataTextChanged); layout->addWidget(m_data); @@ -30,8 +30,8 @@ QtLocationPicker::QtLocationPicker(QWidget* parent): QWidget(parent), m_pickDire ResourcePaths::getGuiPath().concatenate(L"window/dots.png"), ResourcePaths::getGuiPath().concatenate(L"window/dots_hover.png")); m_button->setIconSize(QSize(16, 16)); - m_button->setObjectName("dotsButton"); - m_button->setToolTip("pick file"); + m_button->setObjectName(QStringLiteral("dotsButton")); + m_button->setToolTip(QStringLiteral("pick file")); connect(m_button, &QPushButton::clicked, this, &QtLocationPicker::onHandleButtonPressed); layout->addWidget(m_button); diff --git a/src/lib_gui/qt/element/dialog/QtNewsWidget.cpp b/src/lib_gui/qt/element/dialog/QtNewsWidget.cpp index 52219a2f..554963ab 100644 --- a/src/lib_gui/qt/element/dialog/QtNewsWidget.cpp +++ b/src/lib_gui/qt/element/dialog/QtNewsWidget.cpp @@ -20,17 +20,17 @@ QtNewsWidget::QtNewsWidget(QWidget* parent): QWidget(parent) layout->setSpacing(0); m_text = new QtTextEdit(); - m_text->setObjectName("textField"); + m_text->setObjectName(QStringLiteral("textField")); m_text->setReadOnly(true); m_text->setTabStopWidth(8 * m_text->fontMetrics().width('9')); m_text->setViewportMargins(6, 4, 16, 4); m_text->setOpenExternalLinks(true); layout->addWidget(m_text); - QString placeholder = "No news available"; + QString placeholder = QStringLiteral("No news available"); if (!ApplicationSettings::getInstance()->getAutomaticUpdateCheck()) { - placeholder += "\n(Enable update check to fetch)"; + placeholder += QLatin1String("\n(Enable update check to fetch)"); } m_text->setPlaceholderText(placeholder); @@ -73,14 +73,14 @@ void QtNewsWidget::updateNews() std::string newsRaw = appSettings->getUpdateNews(); if (!newsRaw.size()) { - setNews(""); + setNews(QLatin1String("")); return; } if (TimeStamp::now().deltaHours(appSettings->getLastUpdateCheck()) >= 120) { LOG_INFO_STREAM(<< "Ignore news string, because older than 5 days."); - setNews(""); + setNews(QLatin1String("")); return; } @@ -93,7 +93,7 @@ void QtNewsWidget::updateNews() LOG_ERROR_STREAM( << "News string couldn't be parsed as JSON: " << error.errorString().toStdString() << "\nJSON: " << newsRaw); - setNews(""); + setNews(QLatin1String("")); return; } @@ -108,25 +108,25 @@ void QtNewsWidget::updateNews() itemNum++; QJsonObject newsItem = value.toObject(); - int version = newsItem.value("version").toInt(); + int version = newsItem.value(QStringLiteral("version")).toInt(); if (version > supportedNewsItemVersion) { LOG_INFO_STREAM(<< "News item " << itemNum << " version " << version << " is not supported."); continue; } - if (!checkConditions(newsItem.value("conditions").toObject())) + if (!checkConditions(newsItem.value(QStringLiteral("conditions")).toObject())) { LOG_INFO_STREAM(<< "News item " << itemNum << " conditions failed."); continue; } - processFlags(newsItem.value("flags").toObject()); - setNews(newsItem.value("content").toString()); + processFlags(newsItem.value(QStringLiteral("flags")).toObject()); + setNews(newsItem.value(QStringLiteral("content")).toString()); return; } - setNews(""); + setNews(QLatin1String("")); } void QtNewsWidget::resetFlags() @@ -155,7 +155,7 @@ bool QtNewsWidget::checkConditions(const QJsonObject& conditions) const // min_version { - QString minVersionString = conditions.value("min_version").toString(); + QString minVersionString = conditions.value(QStringLiteral("min_version")).toString(); if (!minVersionString.isEmpty()) { Version minVersion = Version::fromString(minVersionString.toStdString()); @@ -169,7 +169,7 @@ bool QtNewsWidget::checkConditions(const QJsonObject& conditions) const // max_version { - QString maxVersionString = conditions.value("max_version").toString(); + QString maxVersionString = conditions.value(QStringLiteral("max_version")).toString(); if (!maxVersionString.isEmpty()) { Version maxVersion = Version::fromString(maxVersionString.toStdString()); @@ -183,7 +183,7 @@ bool QtNewsWidget::checkConditions(const QJsonObject& conditions) const // OS { - QJsonArray osStrings = conditions.value("os").toArray(); + QJsonArray osStrings = conditions.value(QStringLiteral("os")).toArray(); if (!osStrings.isEmpty()) { QString osString = QString::fromStdString(utility::getOsTypeString()); @@ -197,7 +197,7 @@ bool QtNewsWidget::checkConditions(const QJsonObject& conditions) const // weekday { - QJsonArray weekdayStrings = conditions.value("weekday").toArray(); + QJsonArray weekdayStrings = conditions.value(QStringLiteral("weekday")).toArray(); if (!weekdayStrings.isEmpty()) { QString weekdayString = QString::fromStdString(TimeStamp::now().dayOfWeekShort()); @@ -221,7 +221,7 @@ void QtNewsWidget::processFlags(const QJsonObject& flags) // important { - bool important = flags.value("important").toBool(); + bool important = flags.value(QStringLiteral("important")).toBool(); if (important) { LOG_INFO_STREAM(<< "Flag important enabled."); diff --git a/src/lib_gui/qt/element/dialog/QtPathListBox.cpp b/src/lib_gui/qt/element/dialog/QtPathListBox.cpp index 290143b8..a0b2fddd 100644 --- a/src/lib_gui/qt/element/dialog/QtPathListBox.cpp +++ b/src/lib_gui/qt/element/dialog/QtPathListBox.cpp @@ -11,9 +11,9 @@ QtPathListBox::QtPathListBox(QWidget* parent, const QString& listName, SelectionPolicyType selectionPolicy) : QtListBox(parent, listName), m_selectionPolicy(selectionPolicy) { - QLabel* dropInfoText = new QLabel("Drop Files & Folders"); + QLabel* dropInfoText = new QLabel(QStringLiteral("Drop Files & Folders")); dropInfoText->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - dropInfoText->setObjectName("dropInfo"); + dropInfoText->setObjectName(QStringLiteral("dropInfo")); dropInfoText->setAlignment(Qt::AlignRight); addWidgetToBar(dropInfoText); diff --git a/src/lib_gui/qt/element/dialog/QtPathListBoxItem.cpp b/src/lib_gui/qt/element/dialog/QtPathListBoxItem.cpp index 1d2d8184..21d90f56 100644 --- a/src/lib_gui/qt/element/dialog/QtPathListBoxItem.cpp +++ b/src/lib_gui/qt/element/dialog/QtPathListBoxItem.cpp @@ -17,7 +17,7 @@ QtPathListBoxItem::QtPathListBoxItem(QtPathListBox* listBox, QListWidgetItem* it ResourcePaths::getGuiPath().concatenate(L"window/dots.png"), ResourcePaths::getGuiPath().concatenate(L"window/dots_hover.png")); m_button->setIconSize(QSize(16, 16)); - m_button->setObjectName("dotsButton"); + m_button->setObjectName(QStringLiteral("dotsButton")); layout()->addWidget(m_button); connect(m_button, &QPushButton::clicked, this, &QtPathListBoxItem::handleButtonPress); @@ -37,10 +37,10 @@ void QtPathListBoxItem::handleButtonPress() switch (m_listBox->getSelectionPolicy()) { case QtPathListBox::SELECTION_POLICY_FILES_ONLY: - list.append(QtFileDialog::getOpenFileName(this, "Select Directory", path, "")); + list.append(QtFileDialog::getOpenFileName(this, QStringLiteral("Select Directory"), path, QLatin1String(""))); break; case QtPathListBox::SELECTION_POLICY_DIRECTORIES_ONLY: - list.append(QtFileDialog::getExistingDirectory(this, "Select Directory", path)); + list.append(QtFileDialog::getExistingDirectory(this, QStringLiteral("Select Directory"), path)); break; case QtPathListBox::SELECTION_POLICY_FILES_AND_DIRECTORIES: list = QtFileDialog::getFileNamesAndDirectories(this, path); diff --git a/src/lib_gui/qt/element/dialog/QtTextEdit.cpp b/src/lib_gui/qt/element/dialog/QtTextEdit.cpp index ebd434c7..de8c865f 100644 --- a/src/lib_gui/qt/element/dialog/QtTextEdit.cpp +++ b/src/lib_gui/qt/element/dialog/QtTextEdit.cpp @@ -2,7 +2,7 @@ QtTextEdit::QtTextEdit(QWidget* parent): QTextBrowser(parent) { - document()->setDefaultStyleSheet("a { color: #007AC2; }"); + document()->setDefaultStyleSheet(QStringLiteral("a { color: #007AC2; }")); } void QtTextEdit::setViewportMargins(int left, int top, int right, int bottom) diff --git a/src/lib_gui/qt/element/dialog/QtUpdateCheckerWidget.cpp b/src/lib_gui/qt/element/dialog/QtUpdateCheckerWidget.cpp index 0ece2a39..6502eb0e 100644 --- a/src/lib_gui/qt/element/dialog/QtUpdateCheckerWidget.cpp +++ b/src/lib_gui/qt/element/dialog/QtUpdateCheckerWidget.cpp @@ -19,8 +19,8 @@ QtUpdateCheckerWidget::QtUpdateCheckerWidget(QWidget* parent) layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); - m_button = new QPushButton("check for new version"); - m_button->setObjectName("updateButton"); + m_button = new QPushButton(QStringLiteral("check for new version")); + m_button->setObjectName(QStringLiteral("updateButton")); m_button->setCursor(Qt::PointingHandCursor); layout->addWidget(m_button); @@ -28,7 +28,7 @@ QtUpdateCheckerWidget::QtUpdateCheckerWidget(QWidget* parent) { if (QtUpdateChecker::needsAutomaticCheck()) { - m_button->setText("checking for update..."); + m_button->setText(QStringLiteral("checking for update...")); m_button->setEnabled(false); std::shared_ptr deleteCheck = m_deleteCheck; @@ -52,7 +52,7 @@ QtUpdateCheckerWidget::QtUpdateCheckerWidget(QWidget* parent) } else { - m_button->setText("up-to-date"); + m_button->setText(QStringLiteral("up-to-date")); m_button->setEnabled(false); } } @@ -70,7 +70,7 @@ QtUpdateCheckerWidget::~QtUpdateCheckerWidget() void QtUpdateCheckerWidget::checkUpdate(bool force) { - m_button->setText("checking for update..."); + m_button->setText(QStringLiteral("checking for update...")); m_button->setEnabled(false); std::shared_ptr deleteCheck = m_deleteCheck; @@ -83,11 +83,11 @@ void QtUpdateCheckerWidget::checkUpdate(bool force) if (!result.success) { - m_button->setText("update check failed"); + m_button->setText(QStringLiteral("update check failed")); } else if (result.url.isEmpty()) { - m_button->setText("up-to-date"); + m_button->setText(QStringLiteral("up-to-date")); } else { @@ -100,7 +100,7 @@ void QtUpdateCheckerWidget::checkUpdate(bool force) void QtUpdateCheckerWidget::setDownloadUrl(QString url) { - m_button->setText("new version available"); + m_button->setText(QStringLiteral("new version available")); m_button->disconnect(); connect(m_button, &QPushButton::clicked, this, [url]() { QDesktopServices::openUrl(QUrl(url, QUrl::TolerantMode)); diff --git a/src/lib_gui/qt/element/history/QtHistoryList.cpp b/src/lib_gui/qt/element/history/QtHistoryList.cpp index 32b4c157..8a8e2630 100644 --- a/src/lib_gui/qt/element/history/QtHistoryList.cpp +++ b/src/lib_gui/qt/element/history/QtHistoryList.cpp @@ -29,7 +29,8 @@ QtHistoryItem::QtHistoryItem(const SearchMatch& match, size_t index, bool isCurr m_name = new QLabel(QString::fromStdWString(name), this); m_name->setAttribute(Qt::WA_MacShowFocusRect, 0); m_name->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - m_name->setObjectName(isCurrent ? "history_item_current" : "history_item"); + m_name->setObjectName(isCurrent ? + QStringLiteral("history_item_current") : QStringLiteral("history_item")); m_name->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); layout->addWidget(m_name); @@ -95,7 +96,7 @@ void QtHistoryItem::enterEvent(QEvent* event) css << "QWidget { background-color:" << m_indicatorHoverColor << ";}"; m_indicator->setStyleSheet(css.str().c_str()); - if (m_name->objectName() != "history_item") + if (m_name->objectName() != QLatin1String("history_item")) { return; } @@ -113,7 +114,7 @@ void QtHistoryItem::leaveEvent(QEvent* event) css << "QWidget { background-color:" << m_indicatorColor << ";}"; m_indicator->setStyleSheet(css.str().c_str()); - if (m_name->objectName() != "history_item") + if (m_name->objectName() != QLatin1String("history_item")) { return; } @@ -146,10 +147,10 @@ QtHistoryList::QtHistoryList(const std::vector& history, size_t cur : m_currentIndex(currentIndex) { setWindowFlags(Qt::Popup); - setObjectName("history"); + setObjectName(QStringLiteral("history")); m_list = new QtHistoryListWidget(this); - m_list->setObjectName("history_list"); + m_list->setObjectName(QStringLiteral("history_list")); m_list->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); m_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); diff --git a/src/lib_gui/qt/element/history/QtUndoRedo.cpp b/src/lib_gui/qt/element/history/QtUndoRedo.cpp index 0b349b87..2ea1e6b4 100644 --- a/src/lib_gui/qt/element/history/QtUndoRedo.cpp +++ b/src/lib_gui/qt/element/history/QtUndoRedo.cpp @@ -14,24 +14,24 @@ QtUndoRedo::QtUndoRedo() : m_pressed(false), m_historyList(nullptr), m_historyHiddenAt(TimeStamp::now()) { - setObjectName("undo_redo_bar"); + setObjectName(QStringLiteral("undo_redo_bar")); m_undoButton = new QtSearchBarButton( ResourcePaths::getGuiPath().concatenate(L"undoredo_view/images/arrow_left.png")); - m_undoButton->setObjectName("undo_button"); - m_undoButton->setToolTip("back"); + m_undoButton->setObjectName(QStringLiteral("undo_button")); + m_undoButton->setToolTip(QStringLiteral("back")); m_undoButton->setEnabled(false); m_historyButton = new QtSearchBarButton( ResourcePaths::getGuiPath().concatenate(L"undoredo_view/images/history.png")); - m_historyButton->setObjectName("history_button"); - m_historyButton->setToolTip("history"); + m_historyButton->setObjectName(QStringLiteral("history_button")); + m_historyButton->setToolTip(QStringLiteral("history")); m_historyButton->setEnabled(false); m_redoButton = new QtSearchBarButton( ResourcePaths::getGuiPath().concatenate(L"undoredo_view/images/arrow_right.png")); - m_redoButton->setObjectName("redo_button"); - m_redoButton->setToolTip("forward"); + m_redoButton->setObjectName(QStringLiteral("redo_button")); + m_redoButton->setToolTip(QStringLiteral("forward")); m_redoButton->setEnabled(false); QBoxLayout* layout = new QHBoxLayout(); diff --git a/src/lib_gui/qt/element/search/QtAutocompletionList.cpp b/src/lib_gui/qt/element/search/QtAutocompletionList.cpp index 6b7538c5..25aa23e8 100644 --- a/src/lib_gui/qt/element/search/QtAutocompletionList.cpp +++ b/src/lib_gui/qt/element/search/QtAutocompletionList.cpp @@ -145,7 +145,7 @@ void QtAutocompletionDelegate::paint( QColor fillColor(0xFF, 0xFF, 0xFF); QColor textColor(0, 0, 0); - if (type.size() && type != "command" && type != "filter") + if (type.size() && type != QLatin1String("command") && type != QLatin1String("filter")) { const GraphViewStyle::NodeColor& nodeColor = GraphViewStyle::getNodeColor( nodeType.getUnderscoredTypeString(), false); @@ -177,7 +177,7 @@ void QtAutocompletionDelegate::paint( painter->fillRect(option.rect, backgroundColor); // draw highlights at indices - QString highlightText(text.size(), ' '); + QString highlightText(text.size(), QChar(' ')); if (!indices.empty()) { for (int i = 0; i < indices.size(); i++) @@ -196,7 +196,7 @@ void QtAutocompletionDelegate::paint( painter->fillRect(rect, fillColor); highlightText[idx] = text.at(idx); - text[idx] = ' '; + text[idx] = QChar(' '); } } else @@ -228,7 +228,7 @@ void QtAutocompletionDelegate::paint( painter->setFont(m_font2); - QString highlightSubtext(subtext.size(), ' '); + QString highlightSubtext(subtext.size(), QChar(' ')); if (indices.size()) { for (int i = 0; i < indices.size(); i++) @@ -247,7 +247,7 @@ void QtAutocompletionDelegate::paint( painter->fillRect(rect, fillColor); highlightSubtext[idx] = subtext.at(idx); - subtext[idx] = ' '; + subtext[idx] = QChar(' '); } } @@ -317,7 +317,7 @@ void QtAutocompletionDelegate::calculateCharSizes(QFont font) m_font1 = font; QFontMetrics metrics1(font); - m_charWidth1 = metrics1.width( + m_charWidth1 = metrics1.width(QStringLiteral( "---------------------------------------------------------------------------" "-------------------------" "---------------------------------------------------------------------------" @@ -327,7 +327,7 @@ void QtAutocompletionDelegate::calculateCharSizes(QFont font) "---------------------------------------------------------------------------" "-------------------------" "---------------------------------------------------------------------------" - "-------------------------") / + "-------------------------")) / 500.0f; m_charHeight1 = metrics1.height(); @@ -335,7 +335,7 @@ void QtAutocompletionDelegate::calculateCharSizes(QFont font) m_font2 = font; QFontMetrics metrics2(font); - m_charWidth2 = metrics2.width( + m_charWidth2 = metrics2.width(QStringLiteral( "---------------------------------------------------------------------------" "-------------------------" "---------------------------------------------------------------------------" @@ -345,7 +345,7 @@ void QtAutocompletionDelegate::calculateCharSizes(QFont font) "---------------------------------------------------------------------------" "-------------------------" "---------------------------------------------------------------------------" - "-------------------------") / + "-------------------------")) / 500.0f; m_charHeight2 = metrics2.height(); @@ -370,7 +370,7 @@ QtAutocompletionList::QtAutocompletionList(QWidget* parent): QCompleter(parent) QListView* list = new QListView(parent); list->setItemDelegateForColumn(0, m_delegate.get()); - list->setObjectName("search_box_popup"); + list->setObjectName(QStringLiteral("search_box_popup")); list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); list->setUniformItemSizes(true); setPopup(list); @@ -378,7 +378,7 @@ QtAutocompletionList::QtAutocompletionList(QWidget* parent): QCompleter(parent) setCaseSensitivity(Qt::CaseInsensitive); setCompletionMode(QCompleter::UnfilteredPopupCompletion); setModelSorting(QCompleter::UnsortedModel); - setCompletionPrefix(""); + setCompletionPrefix(QLatin1String("")); setMaxVisibleItems(8); } diff --git a/src/lib_gui/qt/element/search/QtScreenSearchBox.cpp b/src/lib_gui/qt/element/search/QtScreenSearchBox.cpp index 29d0e4ab..81b55666 100644 --- a/src/lib_gui/qt/element/search/QtScreenSearchBox.cpp +++ b/src/lib_gui/qt/element/search/QtScreenSearchBox.cpp @@ -32,7 +32,7 @@ QtScreenSearchBox::QtScreenSearchBox( ControllerProxy* controllerProxy, QWidget* parent) : QFrame(parent), m_controllerProxy(controllerProxy) { - setObjectName("screen_search_box"); + setObjectName(QStringLiteral("screen_search_box")); QHBoxLayout* layout = new QHBoxLayout(); layout->setContentsMargins(0, 0, 0, 0); @@ -42,17 +42,17 @@ QtScreenSearchBox::QtScreenSearchBox( // search field { m_searchButton = new QtSelfRefreshIconButton( - "", + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"search_view/images/search.png"), "screen_search/button"); - m_searchButton->setObjectName("search_button"); + m_searchButton->setObjectName(QStringLiteral("search_button")); m_searchButton->setIconSize(QSize(12, 12)); layout->addWidget(m_searchButton); connect(m_searchButton, &QPushButton::clicked, this, &QtScreenSearchBox::setFocus); m_searchBox = new QLineEdit(this); - m_searchBox->setObjectName("search_box"); + m_searchBox->setObjectName(QStringLiteral("search_box")); m_searchBox->setAttribute(Qt::WA_MacShowFocusRect, 0); // remove blue focus box on Mac layout->addWidget(m_searchBox); @@ -68,7 +68,7 @@ QtScreenSearchBox::QtScreenSearchBox( { m_matchLabel = new QPushButton(); m_matchLabel->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - m_matchLabel->setObjectName("match_label"); + m_matchLabel->setObjectName(QStringLiteral("match_label")); layout->addWidget(m_matchLabel); connect(m_matchLabel, &QPushButton::clicked, this, &QtScreenSearchBox::setFocus); @@ -77,16 +77,16 @@ QtScreenSearchBox::QtScreenSearchBox( // buttons { m_prevButton = new QtSelfRefreshIconButton( - "", + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_left.png"), "screen_search/button"); m_nextButton = new QtSelfRefreshIconButton( - "", + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_right.png"), "screen_search/button"); - m_prevButton->setObjectName("prev_button"); - m_nextButton->setObjectName("next_button"); + m_prevButton->setObjectName(QStringLiteral("prev_button")); + m_nextButton->setObjectName(QStringLiteral("next_button")); m_prevButton->setIconSize(QSize(12, 12)); m_nextButton->setIconSize(QSize(12, 12)); @@ -108,10 +108,10 @@ QtScreenSearchBox::QtScreenSearchBox( // buttons { m_closeButton = new QtSelfRefreshIconButton( - "", + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"screen_search_view/images/close.png"), "screen_search/button"); - m_closeButton->setObjectName("close_button"); + m_closeButton->setObjectName(QStringLiteral("close_button")); m_closeButton->setIconSize(QSize(15, 15)); layout->addWidget(m_closeButton); @@ -151,7 +151,7 @@ void QtScreenSearchBox::addResponder(const std::string& name) } QCheckBox* box = new QCheckBox(name.c_str()); - box->setObjectName("filter_checkbox"); + box->setObjectName(QStringLiteral("filter_checkbox")); box->setChecked(true); m_checkBoxes.emplace(name, box); m_checkboxLayout->addWidget(box); @@ -231,7 +231,7 @@ void QtScreenSearchBox::updateMatchLabel() text += QString::number(m_matchCount) + " match"; if (m_matchCount != 1) { - text += "es"; + text += QLatin1String("es"); } m_matchLabel->setText(text); diff --git a/src/lib_gui/qt/element/search/QtSearchBar.cpp b/src/lib_gui/qt/element/search/QtSearchBar.cpp index 1cfa5cac..bd988cd7 100644 --- a/src/lib_gui/qt/element/search/QtSearchBar.cpp +++ b/src/lib_gui/qt/element/search/QtSearchBar.cpp @@ -12,7 +12,7 @@ QtSearchBar::QtSearchBar() { - setObjectName("search_bar"); + setObjectName(QStringLiteral("search_bar")); QBoxLayout* layout = new QHBoxLayout(); layout->setSpacing(0); @@ -22,13 +22,13 @@ QtSearchBar::QtSearchBar() m_homeButton = new QtSearchBarButton( ResourcePaths::getGuiPath().concatenate(L"search_view/images/home.png")); - m_homeButton->setObjectName("home_button"); - m_homeButton->setToolTip("to overview"); + m_homeButton->setObjectName(QStringLiteral("home_button")); + m_homeButton->setToolTip(QStringLiteral("to overview")); layout->addWidget(m_homeButton); connect(m_homeButton, &QPushButton::clicked, this, &QtSearchBar::homeButtonClicked); m_searchBoxContainer = new QWidget(this); - m_searchBoxContainer->setObjectName("search_box_container"); + m_searchBoxContainer->setObjectName(QStringLiteral("search_box_container")); m_searchBoxContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); layout->addWidget(m_searchBoxContainer); @@ -36,7 +36,7 @@ QtSearchBar::QtSearchBar() innerLayout->setContentsMargins(12, 3, 5, 2); m_searchBoxContainer->setLayout(innerLayout); - m_searchBox = new QtSmartSearchBox("Search", true, m_searchBoxContainer); + m_searchBox = new QtSmartSearchBox(QStringLiteral("Search"), true, m_searchBoxContainer); m_searchBox->setMinimumWidth(100); m_searchBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); innerLayout->addWidget(m_searchBox); @@ -48,8 +48,8 @@ QtSearchBar::QtSearchBar() m_searchButton = new QtSearchBarButton( ResourcePaths::getGuiPath().concatenate(L"search_view/images/search.png")); - m_searchButton->setObjectName("search_button"); - m_searchButton->setToolTip("search"); + m_searchButton->setObjectName(QStringLiteral("search_button")); + m_searchButton->setToolTip(QStringLiteral("search")); layout->addWidget(m_searchButton); connect(m_searchButton, &QPushButton::clicked, m_searchBox, &QtSmartSearchBox::startSearch); diff --git a/src/lib_gui/qt/element/search/QtSearchBarButton.cpp b/src/lib_gui/qt/element/search/QtSearchBarButton.cpp index 86270132..133b1ea3 100644 --- a/src/lib_gui/qt/element/search/QtSearchBarButton.cpp +++ b/src/lib_gui/qt/element/search/QtSearchBarButton.cpp @@ -3,7 +3,7 @@ #include "ApplicationSettings.h" QtSearchBarButton::QtSearchBarButton(const FilePath& iconPath, bool small, QWidget* parent) - : QtSelfRefreshIconButton("", iconPath, "search/button", parent), m_small(small) + : QtSelfRefreshIconButton(QLatin1String(""), iconPath, "search/button", parent), m_small(small) { refresh(); } diff --git a/src/lib_gui/qt/element/search/QtSmartSearchBox.cpp b/src/lib_gui/qt/element/search/QtSmartSearchBox.cpp index 449a89c3..82fc1661 100644 --- a/src/lib_gui/qt/element/search/QtSmartSearchBox.cpp +++ b/src/lib_gui/qt/element/search/QtSmartSearchBox.cpp @@ -78,12 +78,12 @@ QtSmartSearchBox::QtSmartSearchBox(const QString& placeholder, bool supportsFull , m_mousePressed(false) , m_ignoreNextMousePress(false) { - setObjectName("search_box"); + setObjectName(QStringLiteral("search_box")); setAttribute(Qt::WA_MacShowFocusRect, 0); // remove blue focus box on Mac m_highlightRect = new QWidget(this); m_highlightRect->setGeometry(0, 0, 0, 0); - m_highlightRect->setObjectName("search_box_highlight"); + m_highlightRect->setObjectName(QStringLiteral("search_box_highlight")); connect(this, &QtSmartSearchBox::textEdited, this, &QtSmartSearchBox::onTextEdited); connect(this, &QtSmartSearchBox::textChanged, this, &QtSmartSearchBox::onTextChanged); @@ -232,7 +232,7 @@ void QtSmartSearchBox::focusInEvent(QFocusEvent* event) if (text().size() == 1 && text().startsWith(SearchMatch::FULLTEXT_SEARCH_CHARACTER)) { - setEditText(""); + setEditText(QLatin1String("")); } else { @@ -1044,13 +1044,13 @@ void QtSmartSearchBox::updatePlaceholder() } else { - setPlaceholderText(""); + setPlaceholderText(QLatin1String("")); } } void QtSmartSearchBox::clearLineEdit() { - setEditText(""); + setEditText(QLatin1String("")); hideAutoCompletions(); } diff --git a/src/lib_gui/qt/graphics/base/QtGraphicsView.cpp b/src/lib_gui/qt/graphics/base/QtGraphicsView.cpp index 443e1fde..09f13592 100644 --- a/src/lib_gui/qt/graphics/base/QtGraphicsView.cpp +++ b/src/lib_gui/qt/graphics/base/QtGraphicsView.cpp @@ -42,7 +42,7 @@ QtGraphicsView::QtGraphicsView(QWidget* parent) , m_zoomInButtonSpeed(20.0f) , m_zoomOutButtonSpeed(-20.0f) { - QString modifierName = utility::getOsType() == OS_MAC ? "Cmd" : "Ctrl"; + QString modifierName = utility::getOsType() == OS_MAC ? QStringLiteral("Cmd") : QStringLiteral("Ctrl"); setTransformationAnchor(QGraphicsView::AnchorUnderMouse); @@ -56,93 +56,93 @@ QtGraphicsView::QtGraphicsView(QWidget* parent) m_zoomLabelTimer = std::make_shared(this); connect(m_zoomLabelTimer.get(), &QTimer::timeout, this, &QtGraphicsView::hideZoomLabel); - m_openInTabAction = new QAction("Open in New Tab", this); - m_openInTabAction->setStatusTip("Open this node in a new tab"); - m_openInTabAction->setToolTip("Open this node in a new tab"); + m_openInTabAction = new QAction(QStringLiteral("Open in New Tab"), this); + m_openInTabAction->setStatusTip(QStringLiteral("Open this node in a new tab")); + m_openInTabAction->setToolTip(QStringLiteral("Open this node in a new tab")); connect(m_openInTabAction, &QAction::triggered, this, &QtGraphicsView::openInTab); - m_copyNodeNameAction = new QAction("Copy Name", this); - m_copyNodeNameAction->setStatusTip("Copies the name of this node to the clipboard"); - m_copyNodeNameAction->setToolTip("Copies the name of this node to the clipboard"); + m_copyNodeNameAction = new QAction(QStringLiteral("Copy Name"), this); + m_copyNodeNameAction->setStatusTip(QStringLiteral("Copies the name of this node to the clipboard")); + m_copyNodeNameAction->setToolTip(QStringLiteral("Copies the name of this node to the clipboard")); connect(m_copyNodeNameAction, &QAction::triggered, this, &QtGraphicsView::copyNodeName); - m_collapseAction = new QAction("Collapse Node (Shift + Left Click)", this); - m_collapseAction->setStatusTip("Hide the unconnected members of the node"); - m_collapseAction->setToolTip("Hide the unconnected members of the node"); + m_collapseAction = new QAction(QStringLiteral("Collapse Node (Shift + Left Click)"), this); + m_collapseAction->setStatusTip(QStringLiteral("Hide the unconnected members of the node")); + m_collapseAction->setToolTip(QStringLiteral("Hide the unconnected members of the node")); connect(m_collapseAction, &QAction::triggered, this, &QtGraphicsView::collapseNode); - m_expandAction = new QAction("Expand Node (Shift + Left Click)", this); - m_expandAction->setStatusTip("Show unconnected members of the node"); - m_expandAction->setToolTip("Show unconnected members of the node"); + m_expandAction = new QAction(QStringLiteral("Expand Node (Shift + Left Click)"), this); + m_expandAction->setStatusTip(QStringLiteral("Show unconnected members of the node")); + m_expandAction->setToolTip(QStringLiteral("Show unconnected members of the node")); connect(m_expandAction, &QAction::triggered, this, &QtGraphicsView::expandNode); - m_showInIDEAction = new QAction("Show Definition in IDE (Ctrl + Left Click)", this); + m_showInIDEAction = new QAction(QStringLiteral("Show Definition in IDE (Ctrl + Left Click)"), this); #if defined(Q_OS_MAC) m_showInIDEAction->setText("Show Definition in IDE (Cmd + Left Click)"); #endif - m_showInIDEAction->setStatusTip("Show definition of this symbol in the IDE (via plug-in)"); - m_showInIDEAction->setToolTip("Show definition of this symbol in the IDE (via plug-in)"); + m_showInIDEAction->setStatusTip(QStringLiteral("Show definition of this symbol in the IDE (via plug-in)")); + m_showInIDEAction->setToolTip(QStringLiteral("Show definition of this symbol in the IDE (via plug-in)")); connect(m_showInIDEAction, &QAction::triggered, this, &QtGraphicsView::showInIDE); - m_showDefinitionAction = new QAction("Show Definition (Ctrl + Alt + Left Click)", this); + m_showDefinitionAction = new QAction(QStringLiteral("Show Definition (Ctrl + Alt + Left Click)"), this); #if defined(Q_OS_MAC) m_showDefinitionAction->setText("Show Definition (Cmd + Alt + Left Click)"); #endif - m_showDefinitionAction->setStatusTip("Show definition of this symbol in the code"); - m_showDefinitionAction->setToolTip("Show definition of this symbol in the code"); + m_showDefinitionAction->setStatusTip(QStringLiteral("Show definition of this symbol in the code")); + m_showDefinitionAction->setToolTip(QStringLiteral("Show definition of this symbol in the code")); connect(m_showDefinitionAction, &QAction::triggered, this, &QtGraphicsView::showDefinition); - m_hideNodeAction = new QAction("Hide Node (Alt + Left Click)", this); - m_hideNodeAction->setStatusTip("Hide the node from this graph"); - m_hideNodeAction->setToolTip("Hide the node from this graph"); + m_hideNodeAction = new QAction(QStringLiteral("Hide Node (Alt + Left Click)"), this); + m_hideNodeAction->setStatusTip(QStringLiteral("Hide the node from this graph")); + m_hideNodeAction->setToolTip(QStringLiteral("Hide the node from this graph")); connect(m_hideNodeAction, &QAction::triggered, this, &QtGraphicsView::hideNode); - m_hideEdgeAction = new QAction("Hide Edge (Alt + Left Click)", this); - m_hideEdgeAction->setStatusTip("Hide the edge from this graph"); - m_hideEdgeAction->setToolTip("Hide the edge from this graph"); + m_hideEdgeAction = new QAction(QStringLiteral("Hide Edge (Alt + Left Click)"), this); + m_hideEdgeAction->setStatusTip(QStringLiteral("Hide the edge from this graph")); + m_hideEdgeAction->setToolTip(QStringLiteral("Hide the edge from this graph")); connect(m_hideEdgeAction, &QAction::triggered, this, &QtGraphicsView::hideEdge); - m_bookmarkNodeAction = new QAction("Bookmark Node", this); - m_bookmarkNodeAction->setStatusTip("Create a bookmark for this node"); - m_bookmarkNodeAction->setToolTip("Create a bookmark for this node"); + m_bookmarkNodeAction = new QAction(QStringLiteral("Bookmark Node"), this); + m_bookmarkNodeAction->setStatusTip(QStringLiteral("Create a bookmark for this node")); + m_bookmarkNodeAction->setToolTip(QStringLiteral("Create a bookmark for this node")); connect(m_bookmarkNodeAction, &QAction::triggered, this, &QtGraphicsView::bookmarkNode); - m_exportGraphAction = new QAction("Save as Image", this); - m_exportGraphAction->setStatusTip("Save this graph as image file"); - m_exportGraphAction->setToolTip("Save this graph as image file"); + m_exportGraphAction = new QAction(QStringLiteral("Save as Image"), this); + m_exportGraphAction->setStatusTip(QStringLiteral("Save this graph as image file")); + m_exportGraphAction->setToolTip(QStringLiteral("Save this graph as image file")); connect(m_exportGraphAction, &QAction::triggered, this, &QtGraphicsView::exportGraph); m_zoomState = new QPushButton(this); - m_zoomState->setObjectName("zoom_state"); + m_zoomState->setObjectName(QStringLiteral("zoom_state")); m_zoomState->hide(); m_zoomInButton = new QtSelfRefreshIconButton( - "", + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"graph_view/images/zoom_in.png"), "search/button", this); - m_zoomInButton->setObjectName("zoom_in_button"); + m_zoomInButton->setObjectName(QStringLiteral("zoom_in_button")); m_zoomInButton->setAutoRepeat(true); m_zoomInButton->setToolTip("zoom in (" + modifierName + " + Mousewheel forward)"); connect(m_zoomInButton, &QPushButton::pressed, this, &QtGraphicsView::zoomInPressed); m_zoomOutButton = new QtSelfRefreshIconButton( - "", + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"graph_view/images/zoom_out.png"), "search/button", this); - m_zoomOutButton->setObjectName("zoom_out_button"); + m_zoomOutButton->setObjectName(QStringLiteral("zoom_out_button")); m_zoomOutButton->setAutoRepeat(true); m_zoomOutButton->setToolTip("zoom out (" + modifierName + " + Mousewheel back)"); connect(m_zoomOutButton, &QPushButton::pressed, this, &QtGraphicsView::zoomOutPressed); m_legendButton = new QtSelfRefreshIconButton( - "", + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"graph_view/images/legend.png"), "search/button", this); - m_legendButton->setObjectName("legend_button"); - m_legendButton->setToolTip("show legend"); + m_legendButton->setObjectName(QStringLiteral("legend_button")); + m_legendButton->setToolTip(QStringLiteral("show legend")); connect(m_legendButton, &QPushButton::clicked, this, &QtGraphicsView::legendClicked); } @@ -553,14 +553,14 @@ void QtGraphicsView::openInTab() void QtGraphicsView::exportGraph() { - const QString exportNotice = "Exported from Sourcetrail"; + const QString exportNotice = QStringLiteral("Exported from Sourcetrail"); const int margin = 10; FilePath filePath(QtFileDialog::showSaveFileDialog( nullptr, - "Save image", + QStringLiteral("Save image"), FilePath(), - "PNG (*.png);;JPEG (*.JPEG);;BMP Files (*.bmp);;SVG (*.svg)") + QStringLiteral("PNG (*.png);;JPEG (*.JPEG);;BMP Files (*.bmp);;SVG (*.svg)")) .toStdWString()); @@ -571,13 +571,13 @@ void QtGraphicsView::exportGraph() svgGen.setSize(scene()->sceneRect().size().toSize()); svgGen.setViewBox(QRect(QPoint(0, 0), scene()->sceneRect().size().toSize())); svgGen.setTitle(QString::fromStdWString(filePath.withoutExtension().fileName())); - svgGen.setDescription(QString("Graph exported from Sourcetrail") + QChar(0x00AE)); + svgGen.setDescription(QStringLiteral("Graph exported from Sourcetrail") + QChar(0x00AE)); QPainter painter(&svgGen); scene()->render(&painter); { - QFont font("Fira Sans, sans-serif"); + QFont font(QStringLiteral("Fira Sans, sans-serif")); font.setPixelSize(8); painter.setFont(font); } diff --git a/src/lib_gui/qt/graphics/graph/QtGraphNode.cpp b/src/lib_gui/qt/graphics/graph/QtGraphNode.cpp index 4fb2bf3a..8cef70cb 100644 --- a/src/lib_gui/qt/graphics/graph/QtGraphNode.cpp +++ b/src/lib_gui/qt/graphics/graph/QtGraphNode.cpp @@ -607,7 +607,8 @@ void QtGraphNode::setStyle(const GraphViewStyle::NodeStyle& style) m_matchText->setPos( style.iconOffset.x + style.iconSize + style.textOffset.x, style.textOffset.y); - float charWidth = QFontMetrics(font).width("QtGraphNode::QtGraphNode::QtGraphNode") / 37.0f; + float charWidth = QFontMetrics(font).width( + QStringLiteral("QtGraphNode::QtGraphNode::QtGraphNode")) / 37.0f; float charHeight = QFontMetrics(font).height(); m_matchRect->setRect( style.iconOffset.x + style.iconSize + style.textOffset.x + m_matchPos * charWidth, diff --git a/src/lib_gui/qt/graphics/graph/QtGraphNodeBundle.cpp b/src/lib_gui/qt/graphics/graph/QtGraphNodeBundle.cpp index af77b53c..b8f5a502 100644 --- a/src/lib_gui/qt/graphics/graph/QtGraphNodeBundle.cpp +++ b/src/lib_gui/qt/graphics/graph/QtGraphNodeBundle.cpp @@ -18,7 +18,7 @@ QtGraphNodeBundle::QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type this->setAcceptHoverEvents(true); - this->setToolTip("bundle"); + this->setToolTip(QStringLiteral("bundle")); } QtGraphNodeBundle::~QtGraphNodeBundle() {} diff --git a/src/lib_gui/qt/network/QtUpdateChecker.cpp b/src/lib_gui/qt/network/QtUpdateChecker.cpp index 6f78e6b7..be9fda4a 100644 --- a/src/lib_gui/qt/network/QtUpdateChecker.cpp +++ b/src/lib_gui/qt/network/QtUpdateChecker.cpp @@ -37,7 +37,7 @@ void QtUpdateChecker::check(bool force, std::function callback) appSettings->setUpdateDownloadUrl(""); appSettings->save(); - QString urlString = "https://www.sourcetrail.com/api/v2/versions/latest"; + QString urlString = QStringLiteral("https://www.sourcetrail.com/api/v2/versions/latest"); // OS std::string osString = utility::getOsTypeString(); @@ -53,7 +53,7 @@ void QtUpdateChecker::check(bool force, std::function callback) urlString += ("&version=" + Version::getApplicationVersion().toDisplayString()).c_str(); // license - urlString += "&license=free"; // options: test, private, commercial + urlString += QLatin1String("&license=free"); // options: test, private, commercial // user token std::string token = appSettings->getUserToken(); @@ -87,7 +87,7 @@ void QtUpdateChecker::check(bool force, std::function callback) break; } - QString news = doc.object().find("news")->toString(); + QString news = doc.object().find(QStringLiteral("news"))->toString(); if (news.toStdString() != appSettings->getUpdateNews()) { appSettings->setUpdateNews(news.toStdString()); @@ -95,8 +95,8 @@ void QtUpdateChecker::check(bool force, std::function callback) } - QString version = doc.object().find("version")->toString(); - QString url = doc.object().find("url")->toString(); + QString version = doc.object().find(QStringLiteral("version"))->toString(); + QString url = doc.object().find(QStringLiteral("url"))->toString(); Version updateVersion = Version::fromString(version.toStdString()); if (!updateVersion.isValid()) @@ -126,13 +126,13 @@ void QtUpdateChecker::check(bool force, std::function callback) } QMessageBox msgBox; - msgBox.setText("Update Check"); + msgBox.setText(QStringLiteral("Update Check")); msgBox.setInformativeText( "Sourcetrail " + version + " is available for download: " + url + ""); - msgBox.addButton("Close", QMessageBox::ButtonRole::NoRole); - msgBox.addButton("Skip this Version", QMessageBox::ButtonRole::NoRole); - QPushButton* but = msgBox.addButton("Download", QMessageBox::ButtonRole::YesRole); + msgBox.addButton(QStringLiteral("Close"), QMessageBox::ButtonRole::NoRole); + msgBox.addButton(QStringLiteral("Skip this Version"), QMessageBox::ButtonRole::NoRole); + QPushButton* but = msgBox.addButton(QStringLiteral("Download"), QMessageBox::ButtonRole::YesRole); msgBox.setDefaultButton(but); int val = msgBox.exec(); diff --git a/src/lib_gui/qt/project_wizard/QtProjectWizard.cpp b/src/lib_gui/qt/project_wizard/QtProjectWizard.cpp index 7964a900..5557f215 100644 --- a/src/lib_gui/qt/project_wizard/QtProjectWizard.cpp +++ b/src/lib_gui/qt/project_wizard/QtProjectWizard.cpp @@ -633,7 +633,7 @@ void QtProjectWizard::populateWindow(QWidget* widget) { QWidget* menu = new QWidget(); - menu->setObjectName("project_menu"); + menu->setObjectName(QStringLiteral("project_menu")); menu->setFixedWidth(200); layout->addWidget(menu); @@ -641,13 +641,13 @@ void QtProjectWizard::populateWindow(QWidget* widget) menuLayout->setContentsMargins(0, 0, 0, 0); menuLayout->setSpacing(0); - m_generalButton = new QPushButton("General"); - m_generalButton->setObjectName("general_button"); + m_generalButton = new QPushButton(QStringLiteral("General")); + m_generalButton->setObjectName(QStringLiteral("general_button")); m_generalButton->setCheckable(true); connect(m_generalButton, &QPushButton::clicked, this, &QtProjectWizard::generalButtonClicked); menuLayout->addWidget(m_generalButton); - QLabel* sourceGroupLabel = new QLabel("Source Groups:"); + QLabel* sourceGroupLabel = new QLabel(QStringLiteral("Source Groups:")); menuLayout->addWidget(sourceGroupLabel); m_sourceGroupList = new QListWidget(); @@ -679,13 +679,13 @@ void QtProjectWizard::populateWindow(QWidget* widget) m_removeButton->setIconSize(QSize(20, 20)); m_duplicateButton->setIconSize(QSize(20, 20)); - addButton->setToolTip("Add Source Group"); - m_removeButton->setToolTip("Remove Source Group"); - m_duplicateButton->setToolTip("Copy Source Group"); + addButton->setToolTip(QStringLiteral("Add Source Group")); + m_removeButton->setToolTip(QStringLiteral("Remove Source Group")); + m_duplicateButton->setToolTip(QStringLiteral("Copy Source Group")); - addButton->setObjectName("action_button"); - m_removeButton->setObjectName("action_button"); - m_duplicateButton->setObjectName("action_button"); + addButton->setObjectName(QStringLiteral("action_button")); + m_removeButton->setObjectName(QStringLiteral("action_button")); + m_duplicateButton->setObjectName(QStringLiteral("action_button")); m_removeButton->setEnabled(false); m_duplicateButton->setEnabled(false); @@ -718,11 +718,11 @@ void QtProjectWizard::populateWindow(QWidget* widget) layout->addSpacing(10); m_contentWidget = new QWidget(); - m_contentWidget->setObjectName("form"); + m_contentWidget->setObjectName(QStringLiteral("form")); QScrollArea* scrollArea = new QScrollArea(); scrollArea->setFrameShadow(QFrame::Plain); - scrollArea->setObjectName("formArea"); + scrollArea->setObjectName(QStringLiteral("formArea")); scrollArea->setWidgetResizable(true); scrollArea->setWidget(m_contentWidget); @@ -735,18 +735,18 @@ void QtProjectWizard::windowReady() { if (m_editing) { - updateTitle("Edit Project"); - updateNextButton("Save"); + updateTitle(QStringLiteral("Edit Project")); + updateNextButton(QStringLiteral("Save")); } else { - updateTitle("New Project"); - updateNextButton("Create"); + updateTitle(QStringLiteral("New Project")); + updateNextButton(QStringLiteral("Create")); setNextEnabled(false); } - updateSubTitle("Overview"); - updatePreviousButton("Add Source Group"); + updateSubTitle(QStringLiteral("Overview")); + updatePreviousButton(QStringLiteral("Add Source Group")); connect(this, &QtProjectWizard::previous, this, &QtProjectWizard::newSourceGroup); connect(this, &QtProjectWizard::next, this, &QtProjectWizard::createProject); @@ -1021,10 +1021,10 @@ void QtProjectWizard::removeSelectedSourceGroup() } QMessageBox msgBox; - msgBox.setText("Remove Source Group"); - msgBox.setInformativeText("Do you really want to remove this source group from the project?"); - msgBox.addButton("Yes", QMessageBox::ButtonRole::YesRole); - msgBox.addButton("No", QMessageBox::ButtonRole::NoRole); + msgBox.setText(QStringLiteral("Remove Source Group")); + msgBox.setInformativeText(QStringLiteral("Do you really want to remove this source group from the project?")); + msgBox.addButton(QStringLiteral("Yes"), QMessageBox::ButtonRole::YesRole); + msgBox.addButton(QStringLiteral("No"), QMessageBox::ButtonRole::NoRole); msgBox.setIcon(QMessageBox::Icon::Question); int ret = msgBox.exec(); @@ -1162,7 +1162,7 @@ void QtProjectWizard::newSourceGroup() window->show(); window->setNextEnabled(false); window->setPreviousEnabled(false); - window->updateSubTitle("Type Selection"); + window->updateSubTitle(QStringLiteral("Type Selection")); } void QtProjectWizard::selectedProjectType(SourceGroupType sourceGroupType) diff --git a/src/lib_gui/qt/project_wizard/QtProjectWizardWindow.cpp b/src/lib_gui/qt/project_wizard/QtProjectWizardWindow.cpp index 50e08749..482f9507 100644 --- a/src/lib_gui/qt/project_wizard/QtProjectWizardWindow.cpp +++ b/src/lib_gui/qt/project_wizard/QtProjectWizardWindow.cpp @@ -80,7 +80,7 @@ void QtProjectWizardWindow::populateWindow(QWidget* widget) void QtProjectWizardWindow::windowReady() { - updateTitle("NEW SOURCE GROUP"); + updateTitle(QStringLiteral("NEW SOURCE GROUP")); m_content->windowReady(); } diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContent.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContent.cpp index 9e2e2c1c..9d082f81 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContent.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContent.cpp @@ -40,12 +40,12 @@ std::vector QtProjectWizardContent::getFilePaths() const QString QtProjectWizardContent::getFileNamesTitle() const { - return "File List"; + return QStringLiteral("File List"); } QString QtProjectWizardContent::getFileNamesDescription() const { - return "files"; + return QStringLiteral("files"); } bool QtProjectWizardContent::isInForm() const @@ -62,7 +62,7 @@ QLabel* QtProjectWizardContent::createFormLabel(QString name) const { QLabel* label = new QLabel(name); label->setAlignment(Qt::AlignRight | Qt::AlignVCenter); - label->setObjectName("label"); + label->setObjectName(QStringLiteral("label")); label->setWordWrap(true); return label; } @@ -70,7 +70,7 @@ QLabel* QtProjectWizardContent::createFormLabel(QString name) const QLabel* QtProjectWizardContent::createFormTitle(QString name) const { QLabel* label = new QLabel(name); - label->setObjectName("titleLabel"); + label->setObjectName(QStringLiteral("titleLabel")); label->setWordWrap(true); return label; } @@ -78,7 +78,7 @@ QLabel* QtProjectWizardContent::createFormTitle(QString name) const QToolButton* QtProjectWizardContent::createSourceGroupButton(QString name, QString iconPath) const { QToolButton* button = new QToolButton(); - button->setObjectName("sourceGroupButton"); + button->setObjectName(QStringLiteral("sourceGroupButton")); button->setText(name); button->setIcon(QPixmap(iconPath)); button->setIconSize(QSize(64, 64)); @@ -98,7 +98,7 @@ QtHelpButton* QtProjectWizardContent::addHelpButton( QPushButton* QtProjectWizardContent::addFilesButton(QString name, QGridLayout* layout, int row) const { QPushButton* button = new QPushButton(name); - button->setObjectName("windowButton"); + button->setObjectName(QStringLiteral("windowButton")); button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac if (layout) { diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentCustomCommand.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentCustomCommand.cpp index f50de726..b92e6102 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentCustomCommand.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentCustomCommand.cpp @@ -24,9 +24,9 @@ void QtProjectWizardContentCustomCommand::populate(QGridLayout* layout, int& row row++; } - QLabel* nameLabel = createFormLabel("Custom Command"); + QLabel* nameLabel = createFormLabel(QStringLiteral("Custom Command")); addHelpButton( - "Custom Command", + QStringLiteral("Custom Command"), "

Specify the commandline call that will be executed for each source file in this Source " "Group. " "You can use the following variables, %{SOURCE_FILE_PATH} is mandatory.

" @@ -47,9 +47,9 @@ void QtProjectWizardContentCustomCommand::populate(QGridLayout* layout, int& row row); m_customCommand = new QLineEdit(); - m_customCommand->setObjectName("name"); + m_customCommand->setObjectName(QStringLiteral("name")); m_customCommand->setAttribute(Qt::WA_MacShowFocusRect, 0); - m_runInParallel = new QCheckBox("Run in Parallel"); + m_runInParallel = new QCheckBox(QStringLiteral("Run in Parallel")); layout->setRowMinimumHeight(row, 30); @@ -84,7 +84,7 @@ bool QtProjectWizardContentCustomCommand::check() if (m_customCommand->text().isEmpty()) { QMessageBox msgBox; - msgBox.setText("Please enter a custom command."); + msgBox.setText(QStringLiteral("Please enter a custom command.")); msgBox.exec(); return false; } @@ -92,7 +92,7 @@ bool QtProjectWizardContentCustomCommand::check() if (m_customCommand->text().toStdWString().find(L"%{SOURCE_FILE_PATH}") == std::wstring::npos) { QMessageBox msgBox; - msgBox.setText("The variable %{SOURCE_FILE_PATH} is missing in the custom command."); + msgBox.setText(QStringLiteral("The variable %{SOURCE_FILE_PATH} is missing in the custom command.")); msgBox.exec(); return false; } diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentExtensions.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentExtensions.cpp index adbe7672..cf3e800d 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentExtensions.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentExtensions.cpp @@ -13,12 +13,12 @@ QtProjectWizardContentExtensions::QtProjectWizardContentExtensions( void QtProjectWizardContentExtensions::populate(QGridLayout* layout, int& row) { - QLabel* sourceLabel = createFormLabel("Source File Extensions"); + QLabel* sourceLabel = createFormLabel(QStringLiteral("Source File Extensions")); layout->addWidget(sourceLabel, row, QtProjectWizardWindow::FRONT_COL, Qt::AlignTop); addHelpButton( - "Source File Extensions", - "Define extensions for source files including the dot (e.g. .cpp or .java)", + QStringLiteral("Source File Extensions"), + QStringLiteral("Define extensions for source files including the dot (e.g. .cpp or .java)"), layout, row); diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp index 978cb0b7..546ed26d 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp @@ -42,13 +42,13 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) ApplicationSettings* appSettings = ApplicationSettings::getInstance().get(); // ui - addTitle("USER INTERFACE", layout, row); + addTitle(QStringLiteral("USER INTERFACE"), layout, row); // font face m_fontFacePlaceHolder = new QtComboBoxPlaceHolder(); m_fontFace = new QFontComboBox(); m_fontFace->setEditable(false); - addLabelAndWidget("Font Face", m_fontFacePlaceHolder, layout, row); + addLabelAndWidget(QStringLiteral("Font Face"), m_fontFacePlaceHolder, layout, row); int rowNum = row; connect(m_fontFacePlaceHolder, &QtComboBoxPlaceHolder::opened, [this, rowNum, layout]() { @@ -67,20 +67,20 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) // font size m_fontSize = addComboBox( - "Font Size", appSettings->getFontSizeMin(), appSettings->getFontSizeMax(), "", layout, row); + QStringLiteral("Font Size"), appSettings->getFontSizeMin(), appSettings->getFontSizeMax(), QLatin1String(""), layout, row); // tab width - m_tabWidth = addComboBox("Tab Width", 1, 16, "", layout, row); + m_tabWidth = addComboBox(QStringLiteral("Tab Width"), 1, 16, QLatin1String(""), layout, row); // text encoding - m_textEncoding = addComboBox("Text Encoding", "", layout, row); + m_textEncoding = addComboBox(QStringLiteral("Text Encoding"), QLatin1String(""), layout, row); for (int mib: QTextCodec::availableMibs()) { m_textEncoding->addItem(QTextCodec::codecForMib(mib)->name()); } // color scheme - m_colorSchemes = addComboBox("Color Scheme", "", layout, row); + m_colorSchemes = addComboBox(QStringLiteral("Color Scheme"), QLatin1String(""), layout, row); for (size_t i = 0; i < m_colorSchemePaths.size(); i++) { m_colorSchemes->insertItem( @@ -94,26 +94,26 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) // animations m_useAnimations = addCheckBox( - "Animations", - "Enable animations", - "

Enable animations throughout the user interface.

", + QStringLiteral("Animations"), + QStringLiteral("Enable animations"), + QStringLiteral("

Enable animations throughout the user interface.

"), layout, row); // built-in types m_showBuiltinTypes = addCheckBox( - "Built-in Types", - "Show built-in types in graph when referenced", - "

Enable display of referenced built-in types in the graph view.

", + QStringLiteral("Built-in Types"), + QStringLiteral("Show built-in types in graph when referenced"), + QStringLiteral("

Enable display of referenced built-in types in the graph view.

"), layout, row); // directory in code m_showDirectoryInCode = addCheckBox( - "Directory in File Title", - "Show directory of file in code title", - "

Enable display of the parent directory of a code file relative to the project " - "file.

", + QStringLiteral("Directory in File Title"), + QStringLiteral("Show directory of file in code title"), + QStringLiteral("

Enable display of the parent directory of a code file relative to the project " + "file.

"), layout, row); layout->setRowMinimumHeight(row - 1, 30); @@ -125,29 +125,29 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) if (utility::getOsType() == OS_LINUX) { // screen - addTitle("SCREEN", layout, row); + addTitle(QStringLiteral("SCREEN"), layout, row); - QLabel* hint = new QLabel(""); - hint->setStyleSheet("color: grey"); + QLabel* hint = new QLabel(QStringLiteral("")); + hint->setStyleSheet(QStringLiteral("color: grey")); layout->addWidget(hint, row - 1, QtProjectWizardWindow::BACK_COL, Qt::AlignRight); // auto scaling - m_screenAutoScalingInfoLabel = new QLabel(""); + m_screenAutoScalingInfoLabel = new QLabel(QLatin1String("")); m_screenAutoScaling = addComboBoxWithWidgets( - "Auto Scaling to DPI", - "

Define if automatic scaling to screen DPI resolution is active. " + QStringLiteral("Auto Scaling to DPI"), + QStringLiteral("

Define if automatic scaling to screen DPI resolution is active. " "This setting manipulates the environment flag QT_AUTO_SCREEN_SCALE_FACTOR of the Qt " "framework " "(http://doc.qt.io/qt-5/highdpi.html). " "Choose 'system' to stick to the setting of your current environment.

" - "

Changes to this setting require a restart of the application to take effect.

", + "

Changes to this setting require a restart of the application to take effect.

"), {m_screenAutoScalingInfoLabel}, layout, row); - m_screenAutoScaling->addItem("system", -1); - m_screenAutoScaling->addItem("off", 0); - m_screenAutoScaling->addItem("on", 1); + m_screenAutoScaling->addItem(QStringLiteral("system"), -1); + m_screenAutoScaling->addItem(QStringLiteral("off"), 0); + m_screenAutoScaling->addItem(QStringLiteral("on"), 1); connect( m_screenAutoScaling, static_cast(&QComboBox::activated), @@ -155,30 +155,30 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) &QtProjectWizardContentPreferences::uiAutoScalingChanges); // scale factor - m_screenScaleFactorInfoLabel = new QLabel(""); + m_screenScaleFactorInfoLabel = new QLabel(QLatin1String("")); m_screenScaleFactor = addComboBoxWithWidgets( - "Scale Factor", - "

Define a screen scale factor for the user interface of the application. " + QStringLiteral("Scale Factor"), + QStringLiteral("

Define a screen scale factor for the user interface of the application. " "This setting manipulates the environment flag QT_SCALE_FACTOR of the Qt framework " "(http://doc.qt.io/qt-5/highdpi.html). " "Choose 'system' to stick to the setting of your current environment.

" - "

Changes to this setting require a restart of the application to take effect.

", + "

Changes to this setting require a restart of the application to take effect.

"), {m_screenScaleFactorInfoLabel}, layout, row); - m_screenScaleFactor->addItem("system", -1.0); - m_screenScaleFactor->addItem("25%", 0.25); - m_screenScaleFactor->addItem("50%", 0.5); - m_screenScaleFactor->addItem("75%", 0.75); - m_screenScaleFactor->addItem("100%", 1.0); - m_screenScaleFactor->addItem("125%", 1.25); - m_screenScaleFactor->addItem("150%", 1.5); - m_screenScaleFactor->addItem("175%", 1.75); - m_screenScaleFactor->addItem("200%", 2.0); - m_screenScaleFactor->addItem("250%", 2.5); - m_screenScaleFactor->addItem("300%", 3.0); - m_screenScaleFactor->addItem("400%", 4.0); + m_screenScaleFactor->addItem(QStringLiteral("system"), -1.0); + m_screenScaleFactor->addItem(QStringLiteral("25%"), 0.25); + m_screenScaleFactor->addItem(QStringLiteral("50%"), 0.5); + m_screenScaleFactor->addItem(QStringLiteral("75%"), 0.75); + m_screenScaleFactor->addItem(QStringLiteral("100%"), 1.0); + m_screenScaleFactor->addItem(QStringLiteral("125%"), 1.25); + m_screenScaleFactor->addItem(QStringLiteral("150%"), 1.5); + m_screenScaleFactor->addItem(QStringLiteral("175%"), 1.75); + m_screenScaleFactor->addItem(QStringLiteral("200%"), 2.0); + m_screenScaleFactor->addItem(QStringLiteral("250%"), 2.5); + m_screenScaleFactor->addItem(QStringLiteral("300%"), 3.0); + m_screenScaleFactor->addItem(QStringLiteral("400%"), 4.0); connect( m_screenScaleFactor, static_cast(&QComboBox::activated), @@ -189,37 +189,37 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) } // Controls - addTitle("CONTROLS", layout, row); + addTitle(QStringLiteral("CONTROLS"), layout, row); // scroll speed m_scrollSpeed = addLineEdit( - "Scroll Speed", - "

Set a multiplier for the in app scroll speed.

" + QStringLiteral("Scroll Speed"), + QStringLiteral("

Set a multiplier for the in app scroll speed.

" "

A value between 0 and 1 results in slower scrolling while a value higher than 1 " - "increases scroll speed.

", + "increases scroll speed.

"), layout, row); // graph zooming - QString modifierName = utility::getOsType() == OS_MAC ? "Cmd" : "Ctrl"; + QString modifierName = utility::getOsType() == OS_MAC ? QStringLiteral("Cmd") : QStringLiteral("Ctrl"); m_graphZooming = addCheckBox( - "Graph Zoom", - "Zoom graph on mouse wheel", - "

Enable graph zoom using mouse wheel only, instead of using " + modifierName + - " + Mouse Wheel.

", + QStringLiteral("Graph Zoom"), + QStringLiteral("Zoom graph on mouse wheel"), + QStringLiteral("

Enable graph zoom using mouse wheel only, instead of using ") + modifierName + + QStringLiteral(" + Mouse Wheel.

"), layout, row); addGap(layout, row); // output - addTitle("OUTPUT", layout, row); + addTitle(QStringLiteral("OUTPUT"), layout, row); // logging m_loggingEnabled = addCheckBox( - "Logging", - "Enable console and file logging", - "

Show logs in the console and save this information in files.

", + QStringLiteral("Logging"), + QStringLiteral("Enable console and file logging"), + QStringLiteral("

Show logs in the console and save this information in files.

"), layout, row); connect( @@ -229,67 +229,66 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) &QtProjectWizardContentPreferences::loggingEnabledChanged); m_verboseIndexerLoggingEnabled = addCheckBox( - "Indexer Logging", - "Enable verbose indexer logging", - "

Enable additional logs of abstract syntax tree traversal during indexing. This " + QStringLiteral("Indexer Logging"), + QStringLiteral("Enable verbose indexer logging"), + QStringLiteral("

Enable additional logs of abstract syntax tree traversal during indexing. This " "information can help " "tracking down crashes that occurr during indexing.

" - "

Warning: This slows down indexing performance a lot.

", + "

Warning: This slows down indexing performance a lot.

"), layout, row); addGap(layout, row); // Network - addTitle("NETWORK", layout, row); + addTitle(QStringLiteral("NETWORK"), layout, row); // Update check m_automaticUpdateCheck = addCheckBox( - "Automatic
Update Check", - "Check automatically for updates", - "

Automatically connects to the Sourcetrail server once a day to check if a new release " - "is " - "available.

" + QStringLiteral("Automatic
Update Check"), + QStringLiteral("Check automatically for updates"), + QStringLiteral("

Automatically connects to the Sourcetrail server once a day to check " + "if a new release is available.

" "

Note: No personally identifiable information will be transmitted to conduct this " - "check.

", + "check.

"), layout, row); addGap(layout, row); // Plugins - addTitle("PLUGIN", layout, row); + addTitle(QStringLiteral("PLUGIN"), layout, row); // Sourcetrail port m_sourcetrailPort = addLineEdit( - "Sourcetrail Port", - "

Port number that Sourcetrail uses to listen for incoming messages from plugins.

", + QStringLiteral("Sourcetrail Port"), + QStringLiteral("

Port number that Sourcetrail uses to listen for incoming messages from plugins.

"), layout, row); // Sourcetrail port m_pluginPort = addLineEdit( - "Plugin Port", - "

Port number that Sourcetrail uses to sends outgoing messages to plugins.

", + QStringLiteral("Plugin Port"), + QStringLiteral("

Port number that Sourcetrail uses to sends outgoing messages to plugins.

"), layout, row); addGap(layout, row); // indexing - addTitle("INDEXING", layout, row); + addTitle(QStringLiteral("INDEXING"), layout, row); // indexer threads - m_threadsInfoLabel = new QLabel(""); + m_threadsInfoLabel = new QLabel(QLatin1String("")); utility::setWidgetRetainsSpaceWhenHidden(m_threadsInfoLabel); m_threads = addComboBoxWithWidgets( - "Indexer Threads", + QStringLiteral("Indexer Threads"), 0, 24, - "

Set the number of threads used to work on indexing your project in parallel.

", + QStringLiteral("

Set the number of threads used to work on indexing your project in parallel.

"), {m_threadsInfoLabel}, layout, row); - m_threads->setItemText(0, "default"); + m_threads->setItemText(0, QStringLiteral("default")); connect( m_threads, static_cast(&QComboBox::activated), @@ -298,11 +297,11 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) // multi process indexing m_multiProcessIndexing = addCheckBox( - "Multi Process
C/C++ Indexing", - "Run C/C++ indexer threads in different process", - "

Enable C/C++ indexer threads to run in different process.

" + QStringLiteral("Multi Process
C/C++ Indexing"), + QStringLiteral("Run C/C++ indexer threads in different process"), + QStringLiteral("

Enable C/C++ indexer threads to run in different process.

" "

This prevents the application from crashing due to unforseen exceptions while " - "indexing.

", + "indexing.

"), layout, row); @@ -310,7 +309,7 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) // Java - addTitle("JAVA", layout, row); + addTitle(QStringLiteral("JAVA"), layout, row); { // jvm library path @@ -319,16 +318,16 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) switch (utility::getOsType()) { case OS_WINDOWS: - m_javaPath->setFileFilter("JVM Library (jvm.dll)"); - m_javaPath->setPlaceholderText("/bin/client/jvm.dll"); + m_javaPath->setFileFilter(QStringLiteral("JVM Library (jvm.dll)")); + m_javaPath->setPlaceholderText(QStringLiteral("/bin/client/jvm.dll")); break; case OS_MAC: - m_javaPath->setFileFilter("JLI or JVM Library (libjli.dylib libjvm.dylib)"); - m_javaPath->setPlaceholderText("/Contents/Home/jre/lib/jli/libjli.dylib"); + m_javaPath->setFileFilter(QStringLiteral("JLI or JVM Library (libjli.dylib libjvm.dylib)")); + m_javaPath->setPlaceholderText(QStringLiteral("/Contents/Home/jre/lib/jli/libjli.dylib")); break; case OS_LINUX: - m_javaPath->setFileFilter("JVM Library (libjvm.so)"); - m_javaPath->setPlaceholderText("/bin//server/libjvm.so"); + m_javaPath->setFileFilter(QStringLiteral("JVM Library (libjvm.so)")); + m_javaPath->setPlaceholderText(QStringLiteral("/bin//server/libjvm.so")); break; default: LOG_WARNING("No placeholders and filters set for Java path selection"); @@ -346,7 +345,7 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) const std::string javaVersionString = javaArchitectureString + " Java 8"; addHelpButton( - "Java Path", + QStringLiteral("Java Path"), ("

Only required for indexing Java projects.

" "

Provide the location of the jvm library inside the installation of your " + javaVersionString + @@ -364,15 +363,15 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) { // JRE System Library - const QString title = "JRE System Library"; + const QString title = QStringLiteral("JRE System Library"); QLabel* label = createFormLabel(title); layout->addWidget(label, row, QtProjectWizardWindow::FRONT_COL, Qt::AlignTop); addHelpButton( - "JRE System Library", - "

Only required for indexing Java projects.

" + QStringLiteral("JRE System Library"), + QStringLiteral("

Only required for indexing Java projects.

" "

Add the jar files of your JRE System Library. These jars can be found inside your " - "JRE install directory.

", + "JRE install directory.

"), layout, row); @@ -391,22 +390,22 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) if (QSysInfo::windowsVersion() != QSysInfo::WV_None) { - m_mavenPath->setFileFilter("Maven command (mvn.cmd)"); - m_mavenPath->setPlaceholderText("/bin/mvn.cmd"); + m_mavenPath->setFileFilter(QStringLiteral("Maven command (mvn.cmd)")); + m_mavenPath->setPlaceholderText(QStringLiteral("/bin/mvn.cmd")); } else { - m_mavenPath->setFileFilter("Maven command (mvn)"); - m_mavenPath->setPlaceholderText("/mvn"); + m_mavenPath->setFileFilter(QStringLiteral("Maven command (mvn)")); + m_mavenPath->setPlaceholderText(QStringLiteral("/mvn")); } - addLabelAndWidget("Maven Path", m_mavenPath, layout, row); + addLabelAndWidget(QStringLiteral("Maven Path"), m_mavenPath, layout, row); addHelpButton( - "Maven Path", - "

Only required for indexing projects using Maven.

" + QStringLiteral("Maven Path"), + QStringLiteral("

Only required for indexing projects using Maven.

" "

Provide the location of your installed Maven executable. You can also use the auto " - "detection below.

", + "detection below.

"), layout, row); row++; @@ -418,25 +417,25 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) addGap(layout, row); - addTitle("Python", layout, row); + addTitle(QStringLiteral("Python"), layout, row); m_pythonPostProcessing = addCheckBox( - "Post Processing", - "Add ambiguous edges for unsolved references (recommended)", - "

Enable a post processing step to solve unsolved references after the indexing is done. " + QStringLiteral("Post Processing"), + QStringLiteral("Add ambiguous edges for unsolved references (recommended)"), + QStringLiteral("

Enable a post processing step to solve unsolved references after the indexing is done. " "

" "

These references will be marked \"ambiguous\" to indicate that some of these edges may " "never " "be encountered during runtime of the indexed code because the post processing only relies " "on " - "symbol names and types.

", + "symbol names and types.

"), layout, row); addGap(layout, row); - addTitle("C/C++", layout, row); + addTitle(QStringLiteral("C/C++"), layout, row); } void QtProjectWizardContentPreferences::load() @@ -647,16 +646,17 @@ void QtProjectWizardContentPreferences::uiAutoScalingChanges(int index) if (index == 0) { QString autoScale(qgetenv("QT_AUTO_SCREEN_SCALE_FACTOR_SOURCETRAIL")); - if (autoScale == "1") + if (autoScale == QLatin1String("1")) { - autoScale = "on"; + autoScale = QStringLiteral("on"); } else { - autoScale = "off"; + autoScale = QStringLiteral("off"); } - m_screenAutoScalingInfoLabel->setText("detected: '" + autoScale + "'"); + m_screenAutoScalingInfoLabel->setText( + QStringLiteral("detected: '") + autoScale + QStringLiteral("'")); m_screenAutoScalingInfoLabel->show(); } else @@ -669,7 +669,7 @@ void QtProjectWizardContentPreferences::uiScaleFactorChanges(int index) { if (index == 0) { - QString scale = "100"; + QString scale = QStringLiteral("100"); bool ok; double scaleFactor = qgetenv("QT_SCALE_FACTOR_SOURCETRAIL").toDouble(&ok); if (ok) @@ -677,7 +677,8 @@ void QtProjectWizardContentPreferences::uiScaleFactorChanges(int index) scale = QString::number(int(scaleFactor * 100)); } - m_screenScaleFactorInfoLabel->setText("detected: '" + scale + "%'"); + m_screenScaleFactorInfoLabel->setText( + QStringLiteral("detected: '") + scale + QStringLiteral("%'")); m_screenScaleFactorInfoLabel->show(); } else @@ -694,7 +695,7 @@ void QtProjectWizardContentPreferences::addJavaPathDetection(QGridLayout* layout return; } - QLabel* label = new QLabel("Auto detection from:"); + QLabel* label = new QLabel(QStringLiteral("Auto detection from:")); m_javaPathDetectorBox = new QComboBox(); @@ -703,8 +704,8 @@ void QtProjectWizardContentPreferences::addJavaPathDetection(QGridLayout* layout m_javaPathDetectorBox->addItem(detectorName.c_str()); } - QPushButton* button = new QPushButton("detect"); - button->setObjectName("windowButton"); + QPushButton* button = new QPushButton(QStringLiteral("detect")); + button->setObjectName(QStringLiteral("windowButton")); connect( button, &QPushButton::clicked, @@ -734,7 +735,7 @@ void QtProjectWizardContentPreferences::addJreSystemLibraryPathsDetection(QGridL return; } - QLabel* label = new QLabel("Auto detection from:"); + QLabel* label = new QLabel(QStringLiteral("Auto detection from:")); m_jreSystemLibraryPathsDetectorBox = new QComboBox(); @@ -743,8 +744,8 @@ void QtProjectWizardContentPreferences::addJreSystemLibraryPathsDetection(QGridL m_jreSystemLibraryPathsDetectorBox->addItem(detectorName.c_str()); } - QPushButton* button = new QPushButton("detect"); - button->setObjectName("windowButton"); + QPushButton* button = new QPushButton(QStringLiteral("detect")); + button->setObjectName(QStringLiteral("windowButton")); connect( button, &QPushButton::clicked, @@ -773,7 +774,7 @@ void QtProjectWizardContentPreferences::addMavenPathDetection(QGridLayout* layou return; } - QLabel* label = new QLabel("Auto detection from:"); + QLabel* label = new QLabel(QStringLiteral("Auto detection from:")); m_mavenPathDetectorBox = new QComboBox(); @@ -782,8 +783,8 @@ void QtProjectWizardContentPreferences::addMavenPathDetection(QGridLayout* layou m_mavenPathDetectorBox->addItem(detectorName.c_str()); } - QPushButton* button = new QPushButton("detect"); - button->setObjectName("windowButton"); + QPushButton* button = new QPushButton(QStringLiteral("detect")); + button->setObjectName(QStringLiteral("windowButton")); connect( button, &QPushButton::clicked, @@ -935,7 +936,7 @@ QLineEdit* QtProjectWizardContentPreferences::addLineEdit( QString label, QString helpText, QGridLayout* layout, int& row) { QLineEdit* lineEdit = new QLineEdit(this); - lineEdit->setObjectName("name"); + lineEdit->setObjectName(QStringLiteral("name")); lineEdit->setAttribute(Qt::WA_MacShowFocusRect, 0); addLabelAndWidget(label, lineEdit, layout, row); diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentProjectData.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentProjectData.cpp index fa6e8fd4..3d59ea60 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentProjectData.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentProjectData.cpp @@ -27,9 +27,9 @@ void QtProjectWizardContentProjectData::populate(QGridLayout* layout, int& row) row++; } - QLabel* nameLabel = createFormLabel("Sourcetrail Project Name"); + QLabel* nameLabel = createFormLabel(QStringLiteral("Sourcetrail Project Name")); m_projectName = new QLineEdit(); - m_projectName->setObjectName("name"); + m_projectName->setObjectName(QStringLiteral("name")); m_projectName->setAttribute(Qt::WA_MacShowFocusRect, 0); m_projectName->setEnabled(!m_disableNameEditing); connect( @@ -43,7 +43,7 @@ void QtProjectWizardContentProjectData::populate(QGridLayout* layout, int& row) layout->setRowMinimumHeight(row, 30); row++; - QLabel* locationLabel = createFormLabel("Sourcetrail Project Location"); + QLabel* locationLabel = createFormLabel(QStringLiteral("Sourcetrail Project Location")); m_projectFileLocation = new QtLocationPicker(this); m_projectFileLocation->setPickDirectory(true); m_projectFileLocation->setEnabled(!m_disableNameEditing); @@ -51,8 +51,8 @@ void QtProjectWizardContentProjectData::populate(QGridLayout* layout, int& row) layout->addWidget(locationLabel, row, QtProjectWizardWindow::FRONT_COL, Qt::AlignRight); layout->addWidget(m_projectFileLocation, row, QtProjectWizardWindow::BACK_COL, Qt::AlignTop); addHelpButton( - "Sourcetrail Project Location", - "The directory the Sourcetrail project file (.srctrlprj) will be saved to.", + QStringLiteral("Sourcetrail Project Location"), + QStringLiteral("The directory the Sourcetrail project file (.srctrlprj) will be saved to."), layout, row); layout->setRowMinimumHeight(row, 30); @@ -84,7 +84,7 @@ bool QtProjectWizardContentProjectData::check() if (m_projectName->text().isEmpty()) { QMessageBox msgBox; - msgBox.setText("Please enter a project name."); + msgBox.setText(QStringLiteral("Please enter a project name.")); msgBox.exec(); return false; } @@ -102,7 +102,7 @@ bool QtProjectWizardContentProjectData::check() if (m_projectFileLocation->getText().isEmpty()) { QMessageBox msgBox; - msgBox.setText("Please define the location for the Sourcetrail project file."); + msgBox.setText(QStringLiteral("Please define the location for the Sourcetrail project file.")); msgBox.exec(); return false; } @@ -140,9 +140,9 @@ bool QtProjectWizardContentProjectData::check() { QMessageBox msgBox; msgBox.setText( - "The specified location does not exist. Do you want to create the directory?"); - msgBox.addButton("Abort", QMessageBox::ButtonRole::NoRole); - QPushButton* createButton = msgBox.addButton("Create", QMessageBox::ButtonRole::YesRole); + QStringLiteral("The specified location does not exist. Do you want to create the directory?")); + msgBox.addButton(QStringLiteral("Abort"), QMessageBox::ButtonRole::NoRole); + QPushButton* createButton = msgBox.addButton(QStringLiteral("Create"), QMessageBox::ButtonRole::YesRole); msgBox.setDefaultButton(createButton); msgBox.setIcon(QMessageBox::Icon::Question); int ret = msgBox.exec(); @@ -163,8 +163,8 @@ void QtProjectWizardContentProjectData::onProjectNameEdited(QString text) { const int cursorPosition = m_projectName->cursorPosition(); - QRegularExpression regex("[^A-Za-z0-9_.-]"); - text.replace(regex, "_"); + QRegularExpression regex(QStringLiteral("[^A-Za-z0-9_.-]")); + text.replace(regex, QStringLiteral("_")); m_projectName->setText(text); m_projectName->setCursorPosition(cursorPosition); diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSelect.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSelect.cpp index e9c2ea5e..12640f35 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSelect.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSelect.cpp @@ -152,7 +152,7 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row) for (auto& it: sourceGroupInfos) { QPushButton* b = new QPushButton(languageTypeToString(it.first).c_str(), this); - b->setObjectName("menuButton"); + b->setObjectName(QStringLiteral("menuButton")); b->setCheckable(true); b->setProperty("language_type", it.first); m_languages->addButton(b); @@ -194,7 +194,8 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row) m_window->setNextEnabled(false); m_title->setText("Source Group Types - " + m_languages->checkedButton()->text()); - m_description->setText(hasRecommeded ? "* recommended" : ""); + m_description->setText(hasRecommeded ? + QStringLiteral("* recommended") : QLatin1String("")); }); QtFlowLayout* flayout = new QtFlowLayout(10, 0, 0); @@ -220,7 +221,7 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row) if (sourceGroupIt.recommended) { - b->setStyleSheet("font-weight: bold"); + b->setStyleSheet(QStringLiteral("font-weight: bold")); } b->setProperty("source_group_type", int(sourceGroupIt.type)); @@ -257,14 +258,14 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row) containerLayout->setContentsMargins(0, 0, 0, 0); QFrame* groupContainer = new QFrame(); - groupContainer->setObjectName("sourceGroupContainer"); + groupContainer->setObjectName(QStringLiteral("sourceGroupContainer")); groupContainer->setLayout(flayout); containerLayout->addWidget(groupContainer, 0); - m_description = new QLabel(" \n \n"); + m_description = new QLabel(QStringLiteral(" \n \n")); m_description->setWordWrap(true); m_description->setOpenExternalLinks(true); - m_description->setObjectName("sourceGroupDescription"); + m_description->setObjectName(QStringLiteral("sourceGroupDescription")); m_description->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse); m_description->setMinimumHeight(80); containerLayout->addWidget(m_description, 0); @@ -272,8 +273,8 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row) container->setLayout(containerLayout); layout->addWidget(container, 0, QtProjectWizardWindow::BACK_COL); - m_title = new QLabel("Source Group Types"); - m_title->setObjectName("sourceGroupTitle"); + m_title = new QLabel(QStringLiteral("Source Group Types")); + m_title->setObjectName(QStringLiteral("sourceGroupTitle")); layout->addWidget(m_title, 0, QtProjectWizardWindow::BACK_COL, Qt::AlignLeft | Qt::AlignTop); @@ -321,7 +322,7 @@ bool QtProjectWizardContentSelect::check() if (!sourceGroupChosen) { QMessageBox msgBox; - msgBox.setText("Please choose a method of creating a new Source Group."); + msgBox.setText(QStringLiteral("Please choose a method of creating a new Source Group.")); msgBox.exec(); return false; } diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSourceGroupData.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSourceGroupData.cpp index e489c187..e800b696 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSourceGroupData.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSourceGroupData.cpp @@ -15,24 +15,24 @@ QtProjectWizardContentSourceGroupData::QtProjectWizardContentSourceGroupData( void QtProjectWizardContentSourceGroupData::populate(QGridLayout* layout, int& row) { m_name = new QLineEdit(); - m_name->setObjectName("name"); + m_name->setObjectName(QStringLiteral("name")); m_name->setAttribute(Qt::WA_MacShowFocusRect, 0); connect(m_name, &QLineEdit::textEdited, this, &QtProjectWizardContentSourceGroupData::editedName); layout->addWidget( - createFormLabel("Source Group Name"), row, QtProjectWizardWindow::FRONT_COL, Qt::AlignRight); + createFormLabel(QStringLiteral("Source Group Name")), row, QtProjectWizardWindow::FRONT_COL, Qt::AlignRight); layout->addWidget(m_name, row, QtProjectWizardWindow::BACK_COL); row++; - m_status = new QCheckBox("active"); + m_status = new QCheckBox(QStringLiteral("active")); connect( m_status, &QCheckBox::toggled, this, &QtProjectWizardContentSourceGroupData::changedStatus); layout->addWidget( - createFormLabel("Status"), row, QtProjectWizardWindow::FRONT_COL, Qt::AlignRight); + createFormLabel(QStringLiteral("Status")), row, QtProjectWizardWindow::FRONT_COL, Qt::AlignRight); layout->addWidget(m_status, row, QtProjectWizardWindow::BACK_COL); addHelpButton( - "Status", + QStringLiteral("Status"), "

Only source files of active Source Groups will be processed during indexing. " "Inactive Source Groups will be ignored or cleared from the index.

Use this setting " "to temporarily " @@ -63,7 +63,7 @@ bool QtProjectWizardContentSourceGroupData::check() if (m_name->text().isEmpty()) { QMessageBox msgBox; - msgBox.setText("Please enter a source group name."); + msgBox.setText(QStringLiteral("Please enter a source group name.")); msgBox.exec(); return false; } diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSourceGroupInfoText.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSourceGroupInfoText.cpp index 08f14a07..babab833 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSourceGroupInfoText.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSourceGroupInfoText.cpp @@ -30,7 +30,7 @@ void QtProjectWizardContentSourceGroupInfoText::populate(QGridLayout* layout, in "

Hint: If your project contains source code for multiple build targets, you can " "add all of those source " "files with one single source group as long as they all share the same parameters.

"); - infoLabel->setObjectName("info"); + infoLabel->setObjectName(QStringLiteral("info")); infoLabel->setWordWrap(true); layoutHorz->addWidget(infoLabel); diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentUnloadable.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentUnloadable.cpp index 5ce35132..3762255a 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentUnloadable.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentUnloadable.cpp @@ -32,7 +32,7 @@ void QtProjectWizardContentUnloadable::populate(QGridLayout* layout, int& row) QLabel* infoLabel = new QLabel(QString::fromStdString( "

The type \"" + m_settings->getTypeString() + "\" of the selected Source Group is not supportetd by this version of Sourcetrail.

")); - infoLabel->setObjectName("info"); + infoLabel->setObjectName(QStringLiteral("info")); infoLabel->setWordWrap(true); layoutHorz->addWidget(infoLabel); diff --git a/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPaths.cpp b/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPaths.cpp index 497e5391..a7cb923b 100644 --- a/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPaths.cpp +++ b/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPaths.cpp @@ -93,10 +93,10 @@ bool QtProjectWizardContentPaths::check() "remove them before continuing?") .arg(m_titleString)); msgBox.setDetailedText(missingPaths); - QPushButton* removeButton = msgBox.addButton("Remove", QMessageBox::YesRole); - QPushButton* keepButton = msgBox.addButton("Keep", QMessageBox::ButtonRole::NoRole); + QPushButton* removeButton = msgBox.addButton(QStringLiteral("Remove"), QMessageBox::YesRole); + QPushButton* keepButton = msgBox.addButton(QStringLiteral("Keep"), QMessageBox::ButtonRole::NoRole); QPushButton* cancelButton = msgBox.addButton( - "Cancel", QMessageBox::ButtonRole::RejectRole); + QStringLiteral("Cancel"), QMessageBox::ButtonRole::RejectRole); msgBox.exec(); @@ -136,7 +136,7 @@ void QtProjectWizardContentPaths::addDetection(QGridLayout* layout, int row) return; } - QLabel* label = new QLabel("Auto detection from:"); + QLabel* label = new QLabel(QStringLiteral("Auto detection from:")); m_detectorBox = new QComboBox(); @@ -145,8 +145,8 @@ void QtProjectWizardContentPaths::addDetection(QGridLayout* layout, int row) m_detectorBox->addItem(detectorName.c_str()); } - QPushButton* button = new QPushButton("detect"); - button->setObjectName("windowButton"); + QPushButton* button = new QPushButton(QStringLiteral("detect")); + button->setObjectName(QStringLiteral("windowButton")); connect(button, &QPushButton::clicked, this, &QtProjectWizardContentPaths::detectionClicked); QHBoxLayout* hlayout = new QHBoxLayout(); diff --git a/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsExclude.cpp b/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsExclude.cpp index 2482c159..85594df8 100644 --- a/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsExclude.cpp +++ b/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsExclude.cpp @@ -10,7 +10,7 @@ QtProjectWizardContentPathsExclude::QtProjectWizardContentPathsExclude( : QtProjectWizardContentPaths( settings, window, QtPathListBox::SELECTION_POLICY_FILES_AND_DIRECTORIES, false) { - setTitleString("Excluded Files & Directories"); + setTitleString(QStringLiteral("Excluded Files & Directories")); setHelpString( "

These paths define the files and directories that will be left out from indexing.

" "

Hints:" diff --git a/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsSource.cpp b/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsSource.cpp index cbf81240..00705c49 100644 --- a/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsSource.cpp +++ b/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsSource.cpp @@ -28,10 +28,10 @@ QtProjectWizardContentPathsSource::QtProjectWizardContentPathsSource( : QtProjectWizardContentPaths( settings, window, QtPathListBox::SELECTION_POLICY_FILES_AND_DIRECTORIES) { - m_showFilesString = "show files"; + m_showFilesString = QStringLiteral("show files"); - setTitleString("Files & Directories to Index"); - setHelpString( + setTitleString(QStringLiteral("Files & Directories to Index")); + setHelpString(QStringLiteral( "These paths define the files and directories that will be indexed by Sourcetrail. Provide " "a directory to recursively " "add all contained source and header files.
" @@ -40,7 +40,7 @@ QtProjectWizardContentPathsSource::QtProjectWizardContentPathsSource( "kept at a different location, " "you will also need to add that directory.
" "
" - "You can make use of environment variables with ${ENV_VAR}."); + "You can make use of environment variables with ${ENV_VAR}.")); } void QtProjectWizardContentPathsSource::load() @@ -102,10 +102,10 @@ std::vector QtProjectWizardContentPathsSource::getFilePaths() const QString QtProjectWizardContentPathsSource::getFileNamesTitle() const { - return "Indexed Files"; + return QStringLiteral("Indexed Files"); } QString QtProjectWizardContentPathsSource::getFileNamesDescription() const { - return " files will be indexed."; + return QStringLiteral(" files will be indexed."); } diff --git a/src/lib_gui/qt/utility/QtFileDialog.cpp b/src/lib_gui/qt/utility/QtFileDialog.cpp index d6a3028a..835c34b0 100644 --- a/src/lib_gui/qt/utility/QtFileDialog.cpp +++ b/src/lib_gui/qt/utility/QtFileDialog.cpp @@ -22,7 +22,7 @@ QStringList QtFileDialog::getFileNamesAndDirectories(QWidget* parent, const File dialog->setDirectory(dir); } - QListView* l = dialog->findChild("listView"); + QListView* l = dialog->findChild(QStringLiteral("listView")); if (l) { l->setSelectionMode(QAbstractItemView::ExtendedSelection); @@ -73,8 +73,8 @@ QString QtFileDialog::showSaveFileDialog( dialog.setWindowModality(Qt::WindowModal); } - QRegExp filter_regex(QLatin1String("(?:^\\*\\.(?!.*\\()|\\(\\*\\.)(\\w+)")); - QStringList filters = filter.split(QLatin1String(";;")); + QRegExp filter_regex(QStringLiteral("(?:^\\*\\.(?!.*\\()|\\(\\*\\.)(\\w+)")); + QStringList filters = filter.split(QStringLiteral(";;")); if (!filters.isEmpty()) { @@ -93,7 +93,7 @@ QString QtFileDialog::showSaveFileDialog( if (filter_regex.indexIn(dialog.selectedNameFilter()) != -1) { QString extension = filter_regex.cap(1); - file_name += QLatin1String(".") + extension; + file_name += QStringLiteral(".") + extension; } } return file_name; diff --git a/src/lib_gui/qt/utility/QtFilesAndDirectoriesDialog.cpp b/src/lib_gui/qt/utility/QtFilesAndDirectoriesDialog.cpp index 6fbb4cb9..d3e4854e 100644 --- a/src/lib_gui/qt/utility/QtFilesAndDirectoriesDialog.cpp +++ b/src/lib_gui/qt/utility/QtFilesAndDirectoriesDialog.cpp @@ -13,7 +13,7 @@ QtFilesAndDirectoriesDialog::QtFilesAndDirectoriesDialog(QWidget* parent): QFile setOption(QFileDialog::DontUseNativeDialog, true); for (QPushButton* button: findChildren()) { - if (button->text().toLower().contains("open") || button->text().toLower().contains("choose")) + if (button->text().toLower().contains(QLatin1String("open")) || button->text().toLower().contains(QLatin1String("choose"))) { button->installEventFilter(this); button->disconnect(SIGNAL(clicked())); diff --git a/src/lib_gui/qt/utility/QtHighlighter.cpp b/src/lib_gui/qt/utility/QtHighlighter.cpp index b977be1b..82398751 100644 --- a/src/lib_gui/qt/utility/QtHighlighter.cpp +++ b/src/lib_gui/qt/utility/QtHighlighter.cpp @@ -119,11 +119,11 @@ void QtHighlighter::loadHighlightingRules() QJsonObject ruleObj = value.toObject(); HighlightType type = highlightTypeFromString( - ruleObj.value("type").toString().toStdString()); + ruleObj.value(QStringLiteral("type")).toString().toStdString()); - bool priority = ruleObj.value("priority").toBool(); + bool priority = ruleObj.value(QStringLiteral("priority")).toBool(); - QJsonArray patterns = ruleObj.value("patterns").toArray(); + QJsonArray patterns = ruleObj.value(QStringLiteral("patterns")).toArray(); for (QJsonValueRef pattern: patterns) { if (pattern.isString()) @@ -132,7 +132,7 @@ void QtHighlighter::loadHighlightingRules() } } - QJsonObject range = ruleObj.value("range").toObject(); + QJsonObject range = ruleObj.value(QStringLiteral("range")).toObject(); if (!range.empty()) { rules.push_back(HighlightingRule( diff --git a/src/lib_gui/qt/view/QtBookmarkButtonsView.cpp b/src/lib_gui/qt/view/QtBookmarkButtonsView.cpp index e18f9b67..1de8abf3 100644 --- a/src/lib_gui/qt/view/QtBookmarkButtonsView.cpp +++ b/src/lib_gui/qt/view/QtBookmarkButtonsView.cpp @@ -18,7 +18,7 @@ QtBookmarkButtonsView::QtBookmarkButtonsView(ViewLayout* viewLayout) : BookmarkButtonsView(viewLayout), m_createButtonState(MessageBookmarkButtonState::CANNOT_CREATE) { m_widget = new QFrame(); - m_widget->setObjectName("bookmark_bar"); + m_widget->setObjectName(QStringLiteral("bookmark_bar")); QBoxLayout* layout = new QHBoxLayout(); layout->setSpacing(0); @@ -28,8 +28,8 @@ QtBookmarkButtonsView::QtBookmarkButtonsView(ViewLayout* viewLayout) m_createBookmarkButton = new QtSearchBarButton( ResourcePaths::getGuiPath().concatenate(L"bookmark_view/images/edit_bookmark_icon.png")); - m_createBookmarkButton->setObjectName("bookmark_button"); - m_createBookmarkButton->setToolTip("create a bookmark for the active symbol"); + m_createBookmarkButton->setObjectName(QStringLiteral("bookmark_button")); + m_createBookmarkButton->setToolTip(QStringLiteral("create a bookmark for the active symbol")); m_createBookmarkButton->setEnabled(false); layout->addWidget(m_createBookmarkButton); @@ -41,8 +41,8 @@ QtBookmarkButtonsView::QtBookmarkButtonsView(ViewLayout* viewLayout) m_showBookmarksButton = new QtSearchBarButton( ResourcePaths::getGuiPath().concatenate(L"bookmark_view/images/bookmark_list_icon.png")); - m_showBookmarksButton->setObjectName("show_bookmark_button"); - m_showBookmarksButton->setToolTip("Show bookmarks"); + m_showBookmarksButton->setObjectName(QStringLiteral("show_bookmark_button")); + m_showBookmarksButton->setToolTip(QStringLiteral("Show bookmarks")); layout->addWidget(m_showBookmarksButton); connect( @@ -105,11 +105,11 @@ void QtBookmarkButtonsView::createBookmarkClicked() else if (m_createButtonState == MessageBookmarkButtonState::ALREADY_CREATED) { QMessageBox msgBox; - msgBox.setText("Edit Bookmark"); - msgBox.setInformativeText("Do you want to edit or delete the bookmark for this symbol?"); - msgBox.addButton("Edit", QMessageBox::ButtonRole::YesRole); - msgBox.addButton("Delete", QMessageBox::ButtonRole::NoRole); - QPushButton* cancelButton = msgBox.addButton("Cancel", QMessageBox::ButtonRole::RejectRole); + msgBox.setText(QStringLiteral("Edit Bookmark")); + msgBox.setInformativeText(QStringLiteral("Do you want to edit or delete the bookmark for this symbol?")); + msgBox.addButton(QStringLiteral("Edit"), QMessageBox::ButtonRole::YesRole); + msgBox.addButton(QStringLiteral("Delete"), QMessageBox::ButtonRole::NoRole); + QPushButton* cancelButton = msgBox.addButton(QStringLiteral("Cancel"), QMessageBox::ButtonRole::RejectRole); msgBox.setDefaultButton(cancelButton); msgBox.setIcon(QMessageBox::Icon::Question); int ret = msgBox.exec(); diff --git a/src/lib_gui/qt/view/QtCustomTrailView.cpp b/src/lib_gui/qt/view/QtCustomTrailView.cpp index 0a0da8a7..6d98ac11 100644 --- a/src/lib_gui/qt/view/QtCustomTrailView.cpp +++ b/src/lib_gui/qt/view/QtCustomTrailView.cpp @@ -24,7 +24,7 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout) , CustomTrailView(nullptr) , m_controllerProxy(this, TabId::app()) { - setWindowTitle("Custom Trail"); + setWindowTitle(QStringLiteral("Custom Trail")); setWindowFlags(Qt::Window); QGridLayout* mainLayout = new QGridLayout(); @@ -40,13 +40,13 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout) QWidget* panelC2 = new QWidget(); QWidget* panelD = new QWidget(); - panelA1->setObjectName("panelA"); - panelA2->setObjectName("panelA"); - panelB1->setObjectName("panelB"); - panelB2->setObjectName("panelB"); - panelC1->setObjectName("panelA"); - panelC2->setObjectName("panelA"); - panelD->setObjectName("panelB2"); + panelA1->setObjectName(QStringLiteral("panelA")); + panelA2->setObjectName(QStringLiteral("panelA")); + panelB1->setObjectName(QStringLiteral("panelB")); + panelB2->setObjectName(QStringLiteral("panelB")); + panelC1->setObjectName(QStringLiteral("panelA")); + panelC2->setObjectName(QStringLiteral("panelA")); + panelD->setObjectName(QStringLiteral("panelB2")); mainLayout->addWidget(panelA1, 0, 0); mainLayout->addWidget(panelA2, 0, 1); @@ -62,10 +62,10 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout) hLayout->setContentsMargins(25, 10, 10, 10); panelA1->setLayout(hLayout); - m_searchBoxFrom = new QtSmartSearchBox("Start Symbol", false); - m_searchBoxTo = new QtSmartSearchBox("Target Symbol", false); + m_searchBoxFrom = new QtSmartSearchBox(QStringLiteral("Start Symbol"), false); + m_searchBoxTo = new QtSmartSearchBox(QStringLiteral("Target Symbol"), false); - hLayout->addWidget(new QLabel("From:")); + hLayout->addWidget(new QLabel(QStringLiteral("From:"))); hLayout->addWidget(createSearchBox(m_searchBoxFrom)); hLayout->addSpacing(15); @@ -130,11 +130,11 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout) hLayout->setContentsMargins(25, 10, 10, 10); panelB1->setLayout(hLayout); - hLayout->addWidget(new QLabel("Max Depth:")); + hLayout->addWidget(new QLabel(QStringLiteral("Max Depth:"))); m_slider = new QSlider(Qt::Horizontal); - m_slider->setObjectName("depth_slider"); - m_slider->setToolTip("adjust graph depth"); + m_slider->setObjectName(QStringLiteral("depth_slider")); + m_slider->setToolTip(QStringLiteral("adjust graph depth")); m_slider->setMinimum(1); m_slider->setMaximum(51); m_slider->setMinimumWidth(150); @@ -149,7 +149,7 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout) connect(m_slider, &QSlider::valueChanged, [this, valueLabel](int) { if (m_slider->value() == m_slider->maximum()) { - valueLabel->setText("inf"); + valueLabel->setText(QStringLiteral("inf")); } else { @@ -167,12 +167,12 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout) hLayout->setSpacing(15); panelB2->setLayout(hLayout); - m_horizontalButton = new QRadioButton("Horizontal"); - m_verticalButton = new QRadioButton("Vertical"); + m_horizontalButton = new QRadioButton(QStringLiteral("Horizontal")); + m_verticalButton = new QRadioButton(QStringLiteral("Vertical")); m_horizontalButton->setChecked(true); - hLayout->addWidget(new QLabel("Layout Direction:")); + hLayout->addWidget(new QLabel(QStringLiteral("Layout Direction:"))); hLayout->addWidget(m_horizontalButton); hLayout->addWidget(m_verticalButton); @@ -219,7 +219,7 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout) QColor(scheme->getNodeTypeColor(t, "fill", ColorScheme::FOCUS).c_str())); } - QVBoxLayout* filterLayout = addFilters("Nodes:", nodeFilters, nodeColors, &m_nodeFilters, 11); + QVBoxLayout* filterLayout = addFilters(QStringLiteral("Nodes:"), nodeFilters, nodeColors, &m_nodeFilters, 11); filterLayout->setContentsMargins(25, 10, 25, 10); panelC1->setLayout(filterLayout); } @@ -255,24 +255,24 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout) edgeColors.push_back(QColor(scheme->getEdgeTypeColor(t, ColorScheme::FOCUS).c_str())); } - QVBoxLayout* filterLayout = addFilters("Edges:", edgeFilters, edgeColors, &m_edgeFilters, 5); + QVBoxLayout* filterLayout = addFilters(QStringLiteral("Edges:"), edgeFilters, edgeColors, &m_edgeFilters, 5); filterLayout->setContentsMargins(10, 10, 25, 10); panelC2->setLayout(filterLayout); } // controls { - QPushButton* cancelButton = new QPushButton("Cancel"); - QPushButton* searchButton = new QPushButton("Search"); + QPushButton* cancelButton = new QPushButton(QStringLiteral("Cancel")); + QPushButton* searchButton = new QPushButton(QStringLiteral("Search")); - cancelButton->setObjectName("button"); - searchButton->setObjectName("button"); + cancelButton->setObjectName(QStringLiteral("button")); + searchButton->setObjectName(QStringLiteral("button")); cancelButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac searchButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac m_errorLabel = new QLabel(); - m_errorLabel->setObjectName("error"); + m_errorLabel->setObjectName(QStringLiteral("error")); QHBoxLayout* hLayout = new QHBoxLayout(); hLayout->setContentsMargins(25, 15, 25, 15); @@ -289,7 +289,7 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout) if (m_searchBoxFrom->getMatches().size() == 0 || m_searchBoxFrom->getMatches().front().tokenIds.size() == 0) { - setError("No 'Start Symbol' symbol found."); + setError(QStringLiteral("No 'Start Symbol' symbol found.")); return; } @@ -309,7 +309,7 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout) } else { - setError("No 'Target Symbol' symbol found."); + setError(QStringLiteral("No 'Target Symbol' symbol found.")); return; } } @@ -319,13 +319,13 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout) if (!nodeTypes) { - setError("No 'Nodes' selected."); + setError(QStringLiteral("No 'Nodes' selected.")); return; } if (!edgeTypes) { - setError("No 'Edges' selected."); + setError(QStringLiteral("No 'Edges' selected.")); return; } @@ -340,7 +340,7 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout) m_controllerProxy.executeAsTaskWithArgs(&CustomTrailController::activateTrail, message); - setError(""); + setError(QLatin1String("")); hide(); }); @@ -464,7 +464,7 @@ void QtCustomTrailView::updateStyleSheet() QWidget* QtCustomTrailView::createSearchBox(QtSmartSearchBox* searchBox) const { QWidget* searchBoxContainer = new QWidget(); - searchBoxContainer->setObjectName("search_box_container"); + searchBoxContainer->setObjectName(QStringLiteral("search_box_container")); searchBoxContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); searchBox->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Maximum); @@ -516,7 +516,7 @@ QVBoxLayout* QtCustomTrailView::addFilters( if (checkBoxes == &m_nodeFilters) { - m_nodeNonIndexed = new QCheckBox("non-indexed"); + m_nodeNonIndexed = new QCheckBox(QStringLiteral("non-indexed")); m_nodeNonIndexed->setChecked(true); checkBoxes->push_back(m_nodeNonIndexed); @@ -525,7 +525,7 @@ QVBoxLayout* QtCustomTrailView::addFilters( } else if (checkBoxes == &m_edgeFilters) { - m_edgeMember = new QCheckBox("member"); + m_edgeMember = new QCheckBox(QStringLiteral("member")); m_edgeMember->setChecked(true); checkBoxes->push_back(m_edgeMember); @@ -546,11 +546,11 @@ QHBoxLayout* QtCustomTrailView::addCheckButtons(const std::vector& c { QHBoxLayout* buttonLayout = new QHBoxLayout(); - QPushButton* checkButton = new QPushButton("Check All"); - QPushButton* uncheckButton = new QPushButton("Uncheck All"); + QPushButton* checkButton = new QPushButton(QStringLiteral("Check All")); + QPushButton* uncheckButton = new QPushButton(QStringLiteral("Uncheck All")); - checkButton->setObjectName("button_small"); - uncheckButton->setObjectName("button_small"); + checkButton->setObjectName(QStringLiteral("button_small")); + uncheckButton->setObjectName(QStringLiteral("button_small")); buttonLayout->addWidget(checkButton); buttonLayout->addWidget(uncheckButton); diff --git a/src/lib_gui/qt/view/QtDialogView.cpp b/src/lib_gui/qt/view/QtDialogView.cpp index d8d58314..45ecbb1a 100644 --- a/src/lib_gui/qt/view/QtDialogView.cpp +++ b/src/lib_gui/qt/view/QtDialogView.cpp @@ -249,7 +249,7 @@ void QtDialogView::updateCustomIndexingDialog( m_windowStack.getTopWindow()); if (window) { - window->updateTitle("Executing Commands"); + window->updateTitle(QStringLiteral("Executing Commands")); } }); } diff --git a/src/lib_gui/qt/view/QtErrorView.cpp b/src/lib_gui/qt/view/QtErrorView.cpp index bbc6e5c3..94578961 100644 --- a/src/lib_gui/qt/view/QtErrorView.cpp +++ b/src/lib_gui/qt/view/QtErrorView.cpp @@ -57,13 +57,13 @@ QtErrorView::QtErrorView(ViewLayout* viewLayout) m_table->setColumnHidden(Column::ID, true); QStringList headers; - headers << "ID" - << "Type" - << "Message" - << "File" - << "Line" - << "Indexed" - << "Translation Unit"; + headers << QStringLiteral("ID") + << QStringLiteral("Type") + << QStringLiteral("Message") + << QStringLiteral("File") + << QStringLiteral("Line") + << QStringLiteral("Indexed") + << QStringLiteral("Translation Unit"); m_model->setHorizontalHeaderLabels(headers); connect(m_table, &QTableView::clicked, [=](const QModelIndex& index) { @@ -88,16 +88,16 @@ QtErrorView::QtErrorView(ViewLayout* viewLayout) checkboxes->setSpacing(0); { - m_showFatals = createFilterCheckbox("Fatals", m_errorFilter.fatal, checkboxes); - m_showErrors = createFilterCheckbox("Errors", m_errorFilter.error, checkboxes); + m_showFatals = createFilterCheckbox(QStringLiteral("Fatals"), m_errorFilter.fatal, checkboxes); + m_showErrors = createFilterCheckbox(QStringLiteral("Errors"), m_errorFilter.error, checkboxes); m_showNonIndexedFatals = createFilterCheckbox( - "Fatals in non-indexed files", m_errorFilter.unindexedFatal, checkboxes); + QStringLiteral("Fatals in non-indexed files"), m_errorFilter.unindexedFatal, checkboxes); m_showNonIndexedErrors = createFilterCheckbox( - "Errors in non-indexed files", m_errorFilter.unindexedError, checkboxes); + QStringLiteral("Errors in non-indexed files"), m_errorFilter.unindexedError, checkboxes); m_helpButton = new QtHelpButton( - "Fixing Errors", - "Please read this if your project is showing errors after indexing.
" + QStringLiteral("Fixing Errors"), + QStringLiteral("Please read this if your project is showing errors after indexing.
" "There are different types of errors:" "

    " "
  • Fatals cause the indexer to stop. All or big parts of indexed information " @@ -121,22 +121,22 @@ QtErrorView::QtErrorView(ViewLayout* viewLayout) "
" "You should be able to find information about errors you are not familiar with online. " "Double click " - "an error message in the table to select it for copying.
"); - m_helpButton->setObjectName("help_button"); + "an error message in the table to select it for copying.
")); + m_helpButton->setObjectName(QStringLiteral("help_button")); checkboxes->addWidget(m_helpButton); } checkboxes->addStretch(); { - m_allLabel = new QLabel(""); + m_allLabel = new QLabel(QLatin1String("")); checkboxes->addWidget(m_allLabel); m_allLabel->hide(); checkboxes->addSpacing(5); - m_allButton = new QPushButton(""); - m_allButton->setObjectName("screen_button"); + m_allButton = new QPushButton(QLatin1String("")); + m_allButton->setObjectName(QStringLiteral("screen_button")); connect(m_allButton, &QPushButton::clicked, [=]() { m_errorFilter.limit = 0; errorFilterChanged(); @@ -144,7 +144,7 @@ QtErrorView::QtErrorView(ViewLayout* viewLayout) checkboxes->addWidget(m_allButton); m_allButton->hide(); - m_errorLabel = new QLabel(""); + m_errorLabel = new QLabel(QLatin1String("")); checkboxes->addWidget(m_errorLabel); } @@ -152,11 +152,11 @@ QtErrorView::QtErrorView(ViewLayout* viewLayout) { m_editButton = new QtSelfRefreshIconButton( - "Edit Project", + QStringLiteral("Edit Project"), ResourcePaths::getGuiPath().concatenate(L"code_view/images/edit.png"), "window/button"); - m_editButton->setObjectName("screen_button"); - m_editButton->setToolTip("edit project"); + m_editButton->setObjectName(QStringLiteral("screen_button")); + m_editButton->setToolTip(QStringLiteral("edit project")); connect(m_editButton, &QPushButton::clicked, []() { MessageProjectEdit().dispatch(); }); checkboxes->addWidget(m_editButton); @@ -222,7 +222,7 @@ void QtErrorView::addErrors( m_errorLabel->setText( "displaying " + QString::number(errorCount.total) + " error" + (errorCount.total != 1 ? "s" : "") + - (errorCount.fatal > 0 ? " (" + QString::number(errorCount.fatal) + " fatal)" : "") + + (errorCount.fatal > 0 ? " (" + QString::number(errorCount.fatal) + " fatal)" : QLatin1String("")) + ""); }); } @@ -279,6 +279,7 @@ void QtErrorView::setErrorFilter(const ErrorFilter& filter) void QtErrorView::errorFilterChanged(int i) { + Q_UNUSED(i) m_table->selectionModel()->clearSelection(); m_errorFilter.error = m_showErrors->isChecked(); @@ -327,7 +328,8 @@ void QtErrorView::addErrorToTable(const ErrorInfo& error) item->setData(QVariant(qlonglong(error.id)), Qt::DisplayRole); m_model->setItem(rowNumber, Column::ID, item); - m_model->setItem(rowNumber, Column::TYPE, new QStandardItem(error.fatal ? "FATAL" : "ERROR")); + m_model->setItem(rowNumber, Column::TYPE, new QStandardItem(error.fatal ? + QStringLiteral("FATAL") : QStringLiteral("ERROR"))); if (error.fatal) { m_model->item(rowNumber, Column::TYPE)->setForeground(QBrush(Qt::red)); @@ -345,7 +347,8 @@ void QtErrorView::addErrorToTable(const ErrorInfo& error) item->setData(QVariant(qlonglong(error.lineNumber)), Qt::DisplayRole); m_model->setItem(rowNumber, Column::LINE, item); - m_model->setItem(rowNumber, Column::INDEXED, new QStandardItem(error.indexed ? "yes" : "no")); + m_model->setItem(rowNumber, Column::INDEXED, new QStandardItem(error.indexed ? + QStringLiteral("yes") : QStringLiteral("no"))); m_model->setItem( rowNumber, diff --git a/src/lib_gui/qt/view/QtGraphView.cpp b/src/lib_gui/qt/view/QtGraphView.cpp index e047102e..d5c99260 100644 --- a/src/lib_gui/qt/view/QtGraphView.cpp +++ b/src/lib_gui/qt/view/QtGraphView.cpp @@ -80,11 +80,11 @@ QtGraphView::QtGraphView(ViewLayout* viewLayout) { m_expandButton = new QtSelfRefreshIconButton( - "", + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"graph_view/images/graph.png"), "search/button"); - m_expandButton->setObjectName("expand_button"); - m_expandButton->setToolTip("show trail controls"); + m_expandButton->setObjectName(QStringLiteral("expand_button")); + m_expandButton->setToolTip(QStringLiteral("show trail controls")); m_expandButton->setIconSize(QSize(16, 16)); m_expandButton->setGeometry(0, 0, 26, 26); connect(m_expandButton, &QPushButton::clicked, this, &QtGraphView::clickedExpand); @@ -97,44 +97,44 @@ QtGraphView::QtGraphView(ViewLayout* viewLayout) stack->addWidget(ui); m_collapseButton = new QtSelfRefreshIconButton( - "", + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"graph_view/images/graph_arrow.png"), "search/button", ui); - m_collapseButton->setObjectName("collapse_button"); - m_collapseButton->setToolTip("hide trail controls"); + m_collapseButton->setObjectName(QStringLiteral("collapse_button")); + m_collapseButton->setToolTip(QStringLiteral("hide trail controls")); m_collapseButton->setIconSize(QSize(16, 16)); connect(m_collapseButton, &QPushButton::clicked, this, &QtGraphView::clickedCollapse); - m_customTrailButton = new QtSelfRefreshIconButton("", FilePath(), "search/button", ui); - m_customTrailButton->setObjectName("trail_button"); + m_customTrailButton = new QtSelfRefreshIconButton(QLatin1String(""), FilePath(), "search/button", ui); + m_customTrailButton->setObjectName(QStringLiteral("trail_button")); m_customTrailButton->setIconSize(QSize(16, 16)); - m_customTrailButton->setToolTip("custom trail"); + m_customTrailButton->setToolTip(QStringLiteral("custom trail")); m_customTrailButton->setIconPath( ResourcePaths::getGuiPath().concatenate(L"graph_view/images/graph_custom.png")); connect( m_customTrailButton, &QPushButton::clicked, this, &QtGraphView::clickedCustomTrail); - m_forwardTrailButton = new QtSelfRefreshIconButton("", FilePath(), "search/button", ui); - m_forwardTrailButton->setObjectName("trail_button"); + m_forwardTrailButton = new QtSelfRefreshIconButton(QLatin1String(""), FilePath(), "search/button", ui); + m_forwardTrailButton->setObjectName(QStringLiteral("trail_button")); m_forwardTrailButton->setIconSize(QSize(16, 16)); connect( m_forwardTrailButton, &QPushButton::clicked, this, &QtGraphView::clickedForwardTrail); - m_backwardTrailButton = new QtSelfRefreshIconButton("", FilePath(), "search/button", ui); - m_backwardTrailButton->setObjectName("trail_button"); + m_backwardTrailButton = new QtSelfRefreshIconButton(QLatin1String(""), FilePath(), "search/button", ui); + m_backwardTrailButton->setObjectName(QStringLiteral("trail_button")); m_backwardTrailButton->setIconSize(QSize(16, 16)); connect( m_backwardTrailButton, &QPushButton::clicked, this, &QtGraphView::clickedBackwardTrail); m_trailDepthLabel = new QLabel(ui); - m_trailDepthLabel->setObjectName("depth_label"); - m_trailDepthLabel->setToolTip("adjust trail depth"); + m_trailDepthLabel->setObjectName(QStringLiteral("depth_label")); + m_trailDepthLabel->setToolTip(QStringLiteral("adjust trail depth")); m_trailDepthLabel->setAlignment(Qt::AlignCenter); m_trailDepthSlider = new QSlider(Qt::Vertical, ui); - m_trailDepthSlider->setObjectName("depth_slider"); - m_trailDepthSlider->setToolTip("adjust trail depth"); + m_trailDepthSlider->setObjectName(QStringLiteral("depth_slider")); + m_trailDepthSlider->setToolTip(QStringLiteral("adjust trail depth")); m_trailDepthSlider->setMinimum(1); m_trailDepthSlider->setMaximum(26); m_trailDepthSlider->setValue(5); @@ -171,19 +171,19 @@ QtGraphView::QtGraphView(ViewLayout* viewLayout) // group controls { m_groupFileButton = new QtSelfRefreshIconButton( - "", + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"graph_view/images/file.png"), "search/button"); m_groupNamespaceButton = new QtSelfRefreshIconButton( - "", + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"graph_view/images/group_namespace.png"), "search/button"); - m_groupFileButton->setObjectName("group_right_button"); - m_groupNamespaceButton->setObjectName("group_left_button"); + m_groupFileButton->setObjectName(QStringLiteral("group_right_button")); + m_groupNamespaceButton->setObjectName(QStringLiteral("group_left_button")); - m_groupFileButton->setToolTip("group by file"); - m_groupNamespaceButton->setToolTip("group by package/namespace/module"); + m_groupFileButton->setToolTip(QStringLiteral("group by file")); + m_groupNamespaceButton->setToolTip(QStringLiteral("group by package/namespace/module")); m_groupFileButton->setCheckable(true); m_groupNamespaceButton->setCheckable(true); @@ -702,7 +702,7 @@ void QtGraphView::trailDepthChanged(int) { if (m_trailDepthSlider->value() == m_trailDepthSlider->maximum()) { - m_trailDepthLabel->setText("inf"); + m_trailDepthLabel->setText(QStringLiteral("inf")); } else { @@ -849,26 +849,26 @@ void QtGraphView::updateTrailButtons() if (message.edgeTypes & Edge::EDGE_CALL) { - m_backwardTrailButton->setToolTip("show caller graph"); - m_forwardTrailButton->setToolTip("show callee graph"); + m_backwardTrailButton->setToolTip(QStringLiteral("show caller graph")); + m_forwardTrailButton->setToolTip(QStringLiteral("show callee graph")); } else if (message.edgeTypes & Edge::EDGE_INHERITANCE) { - m_backwardTrailButton->setToolTip("show base hierarchy"); - m_forwardTrailButton->setToolTip("show derived hierarchy"); + m_backwardTrailButton->setToolTip(QStringLiteral("show base hierarchy")); + m_forwardTrailButton->setToolTip(QStringLiteral("show derived hierarchy")); backwardImagePath = L"graph_up.png"; forwardImagePath = L"graph_down.png"; } else if (message.edgeTypes & Edge::EDGE_INCLUDE) { - m_backwardTrailButton->setToolTip("show including files hierarchy"); - m_forwardTrailButton->setToolTip("show included files hierarchy"); + m_backwardTrailButton->setToolTip(QStringLiteral("show including files hierarchy")); + m_forwardTrailButton->setToolTip(QStringLiteral("show included files hierarchy")); } else { - m_backwardTrailButton->setToolTip("no trail for active symbol"); - m_forwardTrailButton->setToolTip("no trail for active symbol"); + m_backwardTrailButton->setToolTip(QStringLiteral("no trail for active symbol")); + m_forwardTrailButton->setToolTip(QStringLiteral("no trail for active symbol")); } m_forwardTrailButton->setIconPath( @@ -945,7 +945,7 @@ QtGraphicsView* QtGraphView::getView() const { QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this); - QtGraphicsView* view = widget->findChild(""); + QtGraphicsView* view = widget->findChild(QLatin1String("")); if (!view) { @@ -1308,7 +1308,7 @@ void QtGraphView::createTransition() for (QtGraphNode* node: vanishingNodes) { - QPropertyAnimation* anim = new QPropertyAnimation(node, "opacity"); + QPropertyAnimation* anim = new QPropertyAnimation(node, QByteArrayLiteral("opacity")); anim->setDuration(300); anim->setStartValue(1.0f); anim->setEndValue(0.0f); @@ -1318,7 +1318,7 @@ void QtGraphView::createTransition() for (QtGraphEdge* edge: m_oldEdges) { - QPropertyAnimation* anim = new QPropertyAnimation(edge, "opacity"); + QPropertyAnimation* anim = new QPropertyAnimation(edge, QByteArrayLiteral("opacity")); anim->setDuration(150); anim->setStartValue(1.0f); anim->setEndValue(0.0f); @@ -1338,7 +1338,7 @@ void QtGraphView::createTransition() QtGraphNode* newNode = p.first; QtGraphNode* oldNode = p.second; - QPropertyAnimation* anim = new QPropertyAnimation(oldNode, "pos"); + QPropertyAnimation* anim = new QPropertyAnimation(oldNode, QByteArrayLiteral("pos")); anim->setDuration(300); anim->setStartValue(oldNode->pos()); anim->setEndValue(newNode->pos()); @@ -1349,7 +1349,7 @@ void QtGraphView::createTransition() connect(anim, &QPropertyAnimation::finished, oldNode, &QtGraphNode::hideNode); newNode->hide(); - anim = new QPropertyAnimation(oldNode, "size"); + anim = new QPropertyAnimation(oldNode, QByteArrayLiteral("size")); anim->setDuration(300); anim->setStartValue(oldNode->size()); anim->setEndValue(newNode->size()); @@ -1363,7 +1363,7 @@ void QtGraphView::createTransition() } } - QPropertyAnimation* anim = new QPropertyAnimation(view, "sceneRect"); + QPropertyAnimation* anim = new QPropertyAnimation(view, QByteArrayLiteral("sceneRect")); anim->setStartValue(view->sceneRect()); anim->setEndValue(getSceneRect(m_nodes)); diff --git a/src/lib_gui/qt/view/QtGraphViewStyleImpl.cpp b/src/lib_gui/qt/view/QtGraphViewStyleImpl.cpp index 058f7753..022c3d13 100644 --- a/src/lib_gui/qt/view/QtGraphViewStyleImpl.cpp +++ b/src/lib_gui/qt/view/QtGraphViewStyleImpl.cpp @@ -9,7 +9,7 @@ float QtGraphViewStyleImpl::getCharWidth(const std::string& fontName, size_t fontSize) { return QFontMetrics(getFontForStyleType(fontName, fontSize)) - .width("QtGraphNode::QtGraphNode::QtGraphNode") / + .width(QStringLiteral("QtGraphNode::QtGraphNode::QtGraphNode")) / 37.0f; } diff --git a/src/lib_gui/qt/view/QtRefreshView.cpp b/src/lib_gui/qt/view/QtRefreshView.cpp index b2039ea2..edb3c076 100644 --- a/src/lib_gui/qt/view/QtRefreshView.cpp +++ b/src/lib_gui/qt/view/QtRefreshView.cpp @@ -14,7 +14,7 @@ QtRefreshView::QtRefreshView(ViewLayout* viewLayout): RefreshView(viewLayout) { m_widget = new QFrame(); - m_widget->setObjectName("refresh_bar"); + m_widget->setObjectName(QStringLiteral("refresh_bar")); QBoxLayout* layout = new QHBoxLayout(); layout->setSpacing(0); @@ -23,8 +23,8 @@ QtRefreshView::QtRefreshView(ViewLayout* viewLayout): RefreshView(viewLayout) QtSearchBarButton* refreshButton = new QtSearchBarButton( ResourcePaths::getGuiPath().concatenate(L"refresh_view/images/refresh.png")); - refreshButton->setObjectName("refresh_button"); - refreshButton->setToolTip("refresh"); + refreshButton->setObjectName(QStringLiteral("refresh_button")); + refreshButton->setToolTip(QStringLiteral("refresh")); m_widget->connect(refreshButton, &QPushButton::clicked, []() { MessageIndexingShowDialog().dispatch(); MessageRefresh().dispatch(); diff --git a/src/lib_gui/qt/view/QtScreenSearchView.cpp b/src/lib_gui/qt/view/QtScreenSearchView.cpp index 66c5b6cc..6a60f785 100644 --- a/src/lib_gui/qt/view/QtScreenSearchView.cpp +++ b/src/lib_gui/qt/view/QtScreenSearchView.cpp @@ -16,7 +16,7 @@ QtScreenSearchView::QtScreenSearchView(ViewLayout* viewLayout) m_widget = new QtScreenSearchBox(&m_controllerProxy); m_bar = new QToolBar(); - m_bar->setObjectName("screen_search_bar"); + m_bar->setObjectName(QStringLiteral("screen_search_bar")); m_bar->setMovable(false); m_bar->addWidget(m_widget); diff --git a/src/lib_gui/qt/view/QtStatusView.cpp b/src/lib_gui/qt/view/QtStatusView.cpp index f0fb2fea..003e874d 100644 --- a/src/lib_gui/qt/view/QtStatusView.cpp +++ b/src/lib_gui/qt/view/QtStatusView.cpp @@ -34,8 +34,8 @@ QtStatusView::QtStatusView(ViewLayout* viewLayout): StatusView(viewLayout) // m_table->setColumnWidth(STATUSVIEW_COLUMN::STATUS, 150); QStringList headers; - headers << "Type" - << "Message"; + headers << QStringLiteral("Type") + << QStringLiteral("Message"); m_model->setHorizontalHeaderLabels(headers); layout->addWidget(m_table); @@ -46,13 +46,13 @@ QtStatusView::QtStatusView(ViewLayout* viewLayout): StatusView(viewLayout) filters->setSpacing(25); const StatusFilter filter = ApplicationSettings::getInstance()->getStatusFilter(); - m_showInfo = createFilterCheckbox("Info", filters, filter & StatusType::STATUS_INFO); - m_showErrors = createFilterCheckbox("Error", filters, filter & StatusType::STATUS_ERROR); + m_showInfo = createFilterCheckbox(QStringLiteral("Info"), filters, filter & StatusType::STATUS_INFO); + m_showErrors = createFilterCheckbox(QStringLiteral("Error"), filters, filter & StatusType::STATUS_ERROR); filters->addStretch(); - QPushButton* clearButton = new QPushButton("Clear Table"); - clearButton->setObjectName("screen_button"); + QPushButton* clearButton = new QPushButton(QStringLiteral("Clear Table")); + clearButton->setObjectName(QStringLiteral("screen_button")); connect(clearButton, &QPushButton::clicked, [=]() { MessageClearStatusView().dispatch(); }); filters->addWidget(clearButton); @@ -107,7 +107,8 @@ void QtStatusView::addStatus(const std::vector& status) m_model->insertRow(rowNumber); } - QString statusType = (s.type == StatusType::STATUS_ERROR ? "ERROR" : "INFO"); + QString statusType = (s.type == StatusType::STATUS_ERROR ? + QStringLiteral("ERROR") : QStringLiteral("INFO")); m_model->setItem(rowNumber, STATUSVIEW_COLUMN::TYPE, new QStandardItem(statusType)); m_model->setItem( rowNumber, diff --git a/src/lib_gui/qt/view/QtTabbedView.cpp b/src/lib_gui/qt/view/QtTabbedView.cpp index d0752d59..f7c65b34 100644 --- a/src/lib_gui/qt/view/QtTabbedView.cpp +++ b/src/lib_gui/qt/view/QtTabbedView.cpp @@ -27,12 +27,12 @@ QtTabbedView::QtTabbedView(ViewLayout* viewLayout, const std::string& name) layout->addWidget(m_widget); m_closeButton = new QtSelfRefreshIconButton( - "", + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"screen_search_view/images/close.png"), "screen_search/button", widget); m_closeButton->setIconSize(QSize(15, 15)); - m_closeButton->setStyleSheet("background: transparent; border: none;"); + m_closeButton->setStyleSheet(QStringLiteral("background: transparent; border: none;")); widget->connect(m_closeButton, &QPushButton::clicked, [this]() { hideView(this); }); m_widget->tabBar()->installEventFilter(this); @@ -49,7 +49,7 @@ void QtTabbedView::refreshView() void QtTabbedView::addViewWidget(View* view) { QWidget* tabWidget = QtViewWidgetWrapper::getWidgetOfView(view); - tabWidget->setObjectName("tab_content"); + tabWidget->setObjectName(QStringLiteral("tab_content")); m_widget->addTab(tabWidget, view->getName().c_str()); setStyleSheet(); diff --git a/src/lib_gui/qt/view/QtTabsView.cpp b/src/lib_gui/qt/view/QtTabsView.cpp index 2f30d316..01602b74 100644 --- a/src/lib_gui/qt/view/QtTabsView.cpp +++ b/src/lib_gui/qt/view/QtTabsView.cpp @@ -27,7 +27,7 @@ QtTabsView::QtTabsView(ViewLayout* viewLayout) QWidget* front = new QWidget(); front->setMinimumWidth(5); - front->setObjectName("side_area"); + front->setObjectName(QStringLiteral("side_area")); layout->addWidget(front); m_tabBar = new QtTabBar(); @@ -40,12 +40,12 @@ QtTabsView::QtTabsView(ViewLayout* viewLayout) connect(m_tabBar, &QTabBar::currentChanged, this, &QtTabsView::changedTab); QPushButton* addButton = new QtSelfRefreshIconButton( - "", ResourcePaths::getGuiPath().concatenate(L"tabs_view/images/add.png"), "tab/bar/button"); - addButton->setObjectName("add_button"); + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"tabs_view/images/add.png"), "tab/bar/button"); + addButton->setObjectName(QStringLiteral("add_button")); addButton->setIconSize(QSize(14, 14)); QWidget* back = new QWidget(); - back->setObjectName("side_area"); + back->setObjectName(QStringLiteral("side_area")); QHBoxLayout* backLayout = new QHBoxLayout(back); backLayout->setContentsMargins(3, 0, 5, 0); backLayout->setSpacing(0); @@ -141,11 +141,11 @@ void QtTabsView::insertTab(bool showTab, SearchMatch match) m_insertedTabCount++; int idx = match.isValid() ? m_tabBar->currentIndex() + m_insertedTabCount : m_tabBar->count() + 1; - idx = m_tabBar->insertTab(idx, " Empty Tab "); + idx = m_tabBar->insertTab(idx, QStringLiteral(" Empty Tab ")); m_tabBar->setTabData(idx, QVariant(tabId)); QPushButton* typeCircle = new QPushButton(); - typeCircle->setObjectName("type_circle"); + typeCircle->setObjectName(QStringLiteral("type_circle")); m_tabBar->setTabButton(idx, QTabBar::LeftSide, typeCircle); connect(typeCircle, &QPushButton::clicked, [tabId, this]() { @@ -160,10 +160,10 @@ void QtTabsView::insertTab(bool showTab, SearchMatch match) }); QPushButton* closeButton = new QtSelfRefreshIconButton( - "", + QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"tabs_view/images/close.png"), "tab/bar/button"); - closeButton->setObjectName("close_button"); + closeButton->setObjectName(QStringLiteral("close_button")); closeButton->setIconSize(QSize(10, 10)); m_tabBar->setTabButton(idx, QTabBar::RightSide, closeButton); @@ -257,10 +257,10 @@ void QtTabsView::setTabState(int idx, const std::vector& matches) m_tabBar->setTabText(idx, ' ' + QString::fromStdWString(name) + ' '); m_tabBar->tabButton(idx, QTabBar::LeftSide) ->setStyleSheet( - "#type_circle { background-color: " + QString::fromStdString(color) + - "; } " - "#type_circle[selected=true] { background-color: " + - QString::fromStdString(activeColor) + "; } "); + QStringLiteral("#type_circle { background-color: ") + QString::fromStdString(color) + + QStringLiteral("; } " + "#type_circle[selected=true] { background-color: ") + + QString::fromStdString(activeColor) + QStringLiteral("; } ")); } void QtTabsView::setStyleSheet() diff --git a/src/lib_gui/qt/window/QtAbout.cpp b/src/lib_gui/qt/window/QtAbout.cpp index d66dad4e..86c13665 100644 --- a/src/lib_gui/qt/window/QtAbout.cpp +++ b/src/lib_gui/qt/window/QtAbout.cpp @@ -68,42 +68,42 @@ void QtAbout::setupAbout() windowLayout->addLayout(layoutHorz1); QLabel* companyLabel = new QLabel( - "Coati Software KG
" + QStringLiteral("Coati Software KG
" "Jakob-Haringer-Straße 1/127
" "5020 Salzburg
" "Austria
" "support@sourcetrail.com
" "sourcetrail.com"); + "white;\">sourcetrail.com")); companyLabel->setOpenExternalLinks(true); layoutHorz1->addWidget(companyLabel); layoutHorz1->addSpacing(120); QLabel* developerLabel = new QLabel( - "

" + QStringLiteral("

" "Team:
" "Manuel Dobusch
" "Eberhard Gräther
" "Malte Langkabel
" "Viktoria Pfausler
" - "Andreas Stallinger
"); - developerLabel->setObjectName("small"); + "Andreas Stallinger
")); + developerLabel->setObjectName(QStringLiteral("small")); layoutHorz1->addWidget(developerLabel); } windowLayout->addStretch(); QLabel* acknowledgementsLabel = new QLabel( - "Acknowledgements:
" + QStringLiteral("Acknowledgements:
" "Sourcetrail (aka Coati) 0.1 was created in the context of education at " "Salzburg University " "of Applied Sciences.
" "Coati Software KG is member of Startup Salzburg.
" "The development of Sourcetrail was funded by aws."); - acknowledgementsLabel->setObjectName("small"); + "white;\">aws.")); + acknowledgementsLabel->setObjectName(QStringLiteral("small")); acknowledgementsLabel->setWordWrap(true); acknowledgementsLabel->setOpenExternalLinks(true); windowLayout->addWidget(acknowledgementsLabel); diff --git a/src/lib_gui/qt/window/QtBookmarkBrowser.cpp b/src/lib_gui/qt/window/QtBookmarkBrowser.cpp index 0a66e03f..0b2d16dc 100644 --- a/src/lib_gui/qt/window/QtBookmarkBrowser.cpp +++ b/src/lib_gui/qt/window/QtBookmarkBrowser.cpp @@ -27,7 +27,7 @@ void QtBookmarkBrowser::setupBookmarkBrowser() .c_str()); m_headerBackground = new QWidget(m_window); - m_headerBackground->setObjectName("header_background"); + m_headerBackground->setObjectName(QStringLiteral("header_background")); m_headerBackground->setGeometry(0, 0, 0, 0); m_headerBackground->lower(); @@ -46,21 +46,21 @@ void QtBookmarkBrowser::setupBookmarkBrowser() headerLayout->addStrut(150); - QLabel* title = new QLabel("Bookmarks"); - title->setObjectName("title"); + QLabel* title = new QLabel(QStringLiteral("Bookmarks")); + title->setObjectName(QStringLiteral("title")); headerLayout->addWidget(title); headerLayout->addSpacing(40); - QLabel* filterLabel = new QLabel("Show:"); - filterLabel->setObjectName("filter_label"); + QLabel* filterLabel = new QLabel(QStringLiteral("Show:")); + filterLabel->setObjectName(QStringLiteral("filter_label")); headerLayout->addWidget(filterLabel); m_filterComboBox = new QComboBox(); - m_filterComboBox->addItem("All"); - m_filterComboBox->addItem("Nodes"); - m_filterComboBox->addItem("Edges"); - m_filterComboBox->setObjectName("filter_box"); + m_filterComboBox->addItem(QStringLiteral("All")); + m_filterComboBox->addItem(QStringLiteral("Nodes")); + m_filterComboBox->addItem(QStringLiteral("Edges")); + m_filterComboBox->setObjectName(QStringLiteral("filter_box")); headerLayout->addWidget(m_filterComboBox); connect( @@ -71,8 +71,8 @@ void QtBookmarkBrowser::setupBookmarkBrowser() headerLayout->addSpacing(40); - QLabel* orderLabel = new QLabel("Sort by:"); - orderLabel->setObjectName("order_label"); + QLabel* orderLabel = new QLabel(QStringLiteral("Sort by:")); + orderLabel->setObjectName(QStringLiteral("order_label")); headerLayout->addWidget(orderLabel); m_orderNames.push_back("Name asc."); @@ -86,7 +86,7 @@ void QtBookmarkBrowser::setupBookmarkBrowser() m_orderComboBox->addItem(m_orderNames[2].c_str()); m_orderComboBox->addItem(m_orderNames[3].c_str()); m_orderComboBox->setCurrentIndex(3); - m_orderComboBox->setObjectName("order_box"); + m_orderComboBox->setObjectName(QStringLiteral("order_box")); headerLayout->addWidget(m_orderComboBox); connect( @@ -104,12 +104,12 @@ void QtBookmarkBrowser::setupBookmarkBrowser() layout->addLayout(bodyLayout); m_bookmarkTree = new QTreeWidget(); - m_bookmarkTree->setObjectName("bookmark_tree"); + m_bookmarkTree->setObjectName(QStringLiteral("bookmark_tree")); m_bookmarkTree->setAttribute(Qt::WA_MacShowFocusRect, 0); m_bookmarkTree->setSelectionMode(QAbstractItemView::SelectionMode::NoSelection); m_bookmarkTree->header()->close(); m_bookmarkTree->setIndentation(0); - m_bookmarkTree->setHeaderLabel("Bookmarks"); + m_bookmarkTree->setHeaderLabel(QStringLiteral("Bookmarks")); connect(m_bookmarkTree, &QTreeWidget::itemClicked, this, &QtBookmarkBrowser::treeItemClicked); @@ -122,7 +122,7 @@ void QtBookmarkBrowser::setupBookmarkBrowser() bodyLayout->addLayout(buttonLayout); setPreviousVisible(false); setCloseVisible(false); - updateNextButton("Close"); + updateNextButton(QStringLiteral("Close")); } } diff --git a/src/lib_gui/qt/window/QtBookmarkCreator.cpp b/src/lib_gui/qt/window/QtBookmarkCreator.cpp index 4a1cb221..aa64a882 100644 --- a/src/lib_gui/qt/window/QtBookmarkCreator.cpp +++ b/src/lib_gui/qt/window/QtBookmarkCreator.cpp @@ -29,8 +29,9 @@ void QtBookmarkCreator::setupBookmarkCreator() { // title - QLabel* title = new QLabel(m_editBookmarkId ? "Edit Bookmark" : "Create Bookmark"); - title->setObjectName("creator_title_label"); + QLabel* title = new QLabel(m_editBookmarkId ? + QStringLiteral("Edit Bookmark") : QStringLiteral("Create Bookmark")); + title->setObjectName(QStringLiteral("creator_title_label")); mainLayout->addWidget(title); } @@ -39,13 +40,13 @@ void QtBookmarkCreator::setupBookmarkCreator() { // name - QLabel* nameLabel = new QLabel("Name"); - nameLabel->setObjectName("creator_label"); + QLabel* nameLabel = new QLabel(QStringLiteral("Name")); + nameLabel->setObjectName(QStringLiteral("creator_label")); layout->addWidget(nameLabel); m_displayName = new QLineEdit(); - m_displayName->setObjectName("creator_name_edit"); - m_displayName->setPlaceholderText("Name"); + m_displayName->setObjectName(QStringLiteral("creator_name_edit")); + m_displayName->setPlaceholderText(QStringLiteral("Name")); m_displayName->setAttribute(Qt::WA_MacShowFocusRect, 0); layout->addWidget(m_displayName); @@ -56,13 +57,13 @@ void QtBookmarkCreator::setupBookmarkCreator() { // comment - QLabel* commentLabel = new QLabel("Comment"); - commentLabel->setObjectName("creator_label"); + QLabel* commentLabel = new QLabel(QStringLiteral("Comment")); + commentLabel->setObjectName(QStringLiteral("creator_label")); layout->addWidget(commentLabel); m_commentBox = new QTextEdit(); - m_commentBox->setObjectName("creator_comment_box"); - m_commentBox->setPlaceholderText("Comment"); + m_commentBox->setObjectName(QStringLiteral("creator_comment_box")); + m_commentBox->setPlaceholderText(QStringLiteral("Comment")); layout->addWidget(m_commentBox); layout->addSpacing(15); @@ -70,15 +71,15 @@ void QtBookmarkCreator::setupBookmarkCreator() { // category - QLabel* categoryLabel = new QLabel("Choose or Create Category"); - categoryLabel->setObjectName("creator_label"); + QLabel* categoryLabel = new QLabel(QStringLiteral("Choose or Create Category")); + categoryLabel->setObjectName(QStringLiteral("creator_label")); layout->addWidget(categoryLabel); m_categoryBox = new QComboBox(); - m_categoryBox->setObjectName("creator_category_box"); - m_categoryBox->addItem(""); + m_categoryBox->setObjectName(QStringLiteral("creator_category_box")); + m_categoryBox->addItem(QLatin1String("")); m_categoryBox->setEditable(true); - m_categoryBox->lineEdit()->setPlaceholderText("Category"); + m_categoryBox->lineEdit()->setPlaceholderText(QStringLiteral("Category")); m_categoryBox->setInsertPolicy(QComboBox::InsertPolicy::InsertAtTop); layout->addWidget(m_categoryBox); @@ -88,7 +89,7 @@ void QtBookmarkCreator::setupBookmarkCreator() { layout->addLayout(createButtons()); setPreviousVisible(false); - updateNextButton(m_editBookmarkId ? "Save" : "Create"); + updateNextButton(m_editBookmarkId ? QStringLiteral("Save") : QStringLiteral("Create")); } mainLayout->addLayout(layout); diff --git a/src/lib_gui/qt/window/QtIndexingDialog.cpp b/src/lib_gui/qt/window/QtIndexingDialog.cpp index 975c593d..1ab79f9c 100644 --- a/src/lib_gui/qt/window/QtIndexingDialog.cpp +++ b/src/lib_gui/qt/window/QtIndexingDialog.cpp @@ -9,10 +9,10 @@ #include "ResourcePaths.h" #include "utilityQt.h" -QLabel* QtIndexingDialog::createTitleLabel(QString title, QBoxLayout* layout) +QLabel* QtIndexingDialog::createTitleLabel(const QString &title, QBoxLayout* layout) { QLabel* label = new QLabel(title); - label->setObjectName("title"); + label->setObjectName(QStringLiteral("title")); label->setAlignment(Qt::AlignRight | Qt::AlignBottom); if (layout) @@ -26,7 +26,7 @@ QLabel* QtIndexingDialog::createTitleLabel(QString title, QBoxLayout* layout) QLabel* QtIndexingDialog::createMessageLabel(QBoxLayout* layout) { QLabel* label = new QLabel(); - label->setObjectName("message"); + label->setObjectName(QStringLiteral("message")); label->setAlignment(Qt::AlignRight); label->setWordWrap(true); layout->addWidget(label); @@ -41,14 +41,14 @@ QWidget* QtIndexingDialog::createErrorWidget(QBoxLayout* layout) errorLayout->setSpacing(5); QPushButton* errorCount = new QPushButton(); - errorCount->setObjectName("errorCount"); + errorCount->setObjectName(QStringLiteral("errorCount")); errorCount->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac errorCount->setIcon(QPixmap(QString::fromStdWString( ResourcePaths::getGuiPath().concatenate(L"indexing_dialog/error.png").wstr()))); errorLayout->addWidget(errorCount); - QtHelpButton* helpButton = new QtHelpButton("aaa", "bbb"); + QtHelpButton* helpButton = new QtHelpButton(QStringLiteral("aaa"), QStringLiteral("bbb")); helpButton->setColor(Qt::white); helpButton->disconnect(); @@ -82,10 +82,10 @@ QtIndexingDialog::QtIndexingDialog(bool isSubWindow, QWidget* parent) { m_window->setStyleSheet( m_window->styleSheet() + - "#window { " + QStringLiteral("#window { " "background: #2E3C86;" "border: none;" - "}"); + "}")); setStyleSheet( (utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"window/window.css")) + diff --git a/src/lib_gui/qt/window/QtIndexingDialog.h b/src/lib_gui/qt/window/QtIndexingDialog.h index 2fe95c58..627fff69 100644 --- a/src/lib_gui/qt/window/QtIndexingDialog.h +++ b/src/lib_gui/qt/window/QtIndexingDialog.h @@ -19,7 +19,7 @@ class QtIndexingDialog: public QtWindowBase protected: static QBoxLayout* createLayout(QWidget* parent); - static QLabel* createTitleLabel(QString title, QBoxLayout* layout); + static QLabel* createTitleLabel(const QString &title, QBoxLayout* layout); static QLabel* createMessageLabel(QBoxLayout* layout); static QWidget* createErrorWidget(QBoxLayout* layout); static QLabel* createFlagLabel(QWidget* parent); diff --git a/src/lib_gui/qt/window/QtIndexingProgressDialog.cpp b/src/lib_gui/qt/window/QtIndexingProgressDialog.cpp index 50abe4b5..de2c000c 100644 --- a/src/lib_gui/qt/window/QtIndexingProgressDialog.cpp +++ b/src/lib_gui/qt/window/QtIndexingProgressDialog.cpp @@ -10,10 +10,10 @@ QtIndexingProgressDialog::QtIndexingProgressDialog(bool hideable, QWidget* paren { setSizeGripStyle(false); - updateTitle("Indexing Files"); + updateTitle(QStringLiteral("Indexing Files")); m_filePathLabel = new QLabel(); - m_filePathLabel->setObjectName("filePath"); + m_filePathLabel->setObjectName(QStringLiteral("filePath")); m_filePathLabel->setAlignment(Qt::AlignRight); m_layout->addWidget(m_filePathLabel); @@ -25,15 +25,15 @@ QtIndexingProgressDialog::QtIndexingProgressDialog(bool hideable, QWidget* paren { QHBoxLayout* buttons = new QHBoxLayout(); - QPushButton* stopButton = new QPushButton("Stop"); - stopButton->setObjectName("windowButton"); + QPushButton* stopButton = new QPushButton(QStringLiteral("Stop")); + stopButton->setObjectName(QStringLiteral("windowButton")); connect(stopButton, &QPushButton::clicked, this, &QtIndexingProgressDialog::onStopPressed); buttons->addWidget(stopButton); buttons->addStretch(); - QPushButton* hideButton = new QPushButton("Hide"); - hideButton->setObjectName("windowButton"); + QPushButton* hideButton = new QPushButton(QStringLiteral("Hide")); + hideButton->setObjectName(QStringLiteral("windowButton")); hideButton->setDefault(true); connect(hideButton, &QPushButton::clicked, this, &QtIndexingProgressDialog::onHidePressed); buttons->addWidget(hideButton); @@ -78,7 +78,7 @@ void QtIndexingProgressDialog::updateErrorCount(size_t errorCount, size_t fatalC QString str = QString::number(errorCount) + " Error"; if (errorCount > 1) { - str += "s"; + str += QLatin1String("s"); } if (fatalCount) @@ -86,7 +86,7 @@ void QtIndexingProgressDialog::updateErrorCount(size_t errorCount, size_t fatalC str += " (" + QString::number(fatalCount) + " Fatal)"; } - QPushButton* errorCount = m_errorWidget->findChild("errorCount"); + QPushButton* errorCount = m_errorWidget->findChild(QStringLiteral("errorCount")); errorCount->setText(str); m_errorWidget->show(); diff --git a/src/lib_gui/qt/window/QtIndexingReportDialog.cpp b/src/lib_gui/qt/window/QtIndexingReportDialog.cpp index 45028296..1ecaa617 100644 --- a/src/lib_gui/qt/window/QtIndexingReportDialog.cpp +++ b/src/lib_gui/qt/window/QtIndexingReportDialog.cpp @@ -23,30 +23,30 @@ QtIndexingReportDialog::QtIndexingReportDialog( if (interrupted) { - QtIndexingDialog::createTitleLabel("Interrupted Indexing", m_layout); + QtIndexingDialog::createTitleLabel(QStringLiteral("Interrupted Indexing"), m_layout); } else if (shallow) { - QtIndexingDialog::createTitleLabel("Finished Shallow Indexing", m_layout); + QtIndexingDialog::createTitleLabel(QStringLiteral("Finished Shallow Indexing"), m_layout); } else { - QtIndexingDialog::createTitleLabel("Finished Indexing", m_layout); + QtIndexingDialog::createTitleLabel(QStringLiteral("Finished Indexing"), m_layout); } m_layout->addSpacing(5); QtIndexingDialog::createMessageLabel(m_layout)->setText( - "Source files indexed: " + QString::number(indexedFileCount) + "/" + + QStringLiteral("Source files indexed: ") + QString::number(indexedFileCount) + "/" + QString::number(totalIndexedFileCount)); QtIndexingDialog::createMessageLabel(m_layout)->setText( - "Total files completed: " + QString::number(completedFileCount) + "/" + + QStringLiteral("Total files completed: ") + QString::number(completedFileCount) + "/" + QString::number(totalFileCount)); m_layout->addSpacing(12); QtIndexingDialog::createMessageLabel(m_layout)->setText( - "Time: " + QString::fromStdString(TimeStamp::secondsToString(time))); + QStringLiteral("Time: ") + QString::fromStdString(TimeStamp::secondsToString(time))); m_layout->addSpacing(12); m_errorWidget = QtIndexingDialog::createErrorWidget(m_layout); @@ -55,9 +55,9 @@ QtIndexingReportDialog::QtIndexingReportDialog( if (shallow) { - createMessageLabel(m_layout)->setText( + createMessageLabel(m_layout)->setText(QStringLiteral( "You can now browse your project while running a second pass for in-depth " - "indexing!"); + "indexing!")); m_layout->addSpacing(12); } @@ -65,16 +65,16 @@ QtIndexingReportDialog::QtIndexingReportDialog( QHBoxLayout* buttons = new QHBoxLayout(); if (interrupted) { - QPushButton* discardButton = new QPushButton("Discard"); - discardButton->setObjectName("windowButton"); + QPushButton* discardButton = new QPushButton(QStringLiteral("Discard")); + discardButton->setObjectName(QStringLiteral("windowButton")); connect( discardButton, &QPushButton::clicked, this, &QtIndexingReportDialog::onDiscardPressed); buttons->addWidget(discardButton); } else if (shallow) { - QPushButton* startInDepthButton = new QPushButton("Start In-Depth Indexing"); - startInDepthButton->setObjectName("windowButton"); + QPushButton* startInDepthButton = new QPushButton(QStringLiteral("Start In-Depth Indexing")); + startInDepthButton->setObjectName(QStringLiteral("windowButton")); connect( startInDepthButton, &QPushButton::clicked, @@ -86,8 +86,9 @@ QtIndexingReportDialog::QtIndexingReportDialog( buttons->addStretch(); QPushButton* confirmButton = new QPushButton( - interrupted ? "Keep" : (shallow ? "Later" : "OK")); - confirmButton->setObjectName("windowButton"); + interrupted ? QStringLiteral("Keep") : + (shallow ? QStringLiteral("Later") : QStringLiteral("OK"))); + confirmButton->setObjectName(QStringLiteral("windowButton")); confirmButton->setDefault(true); connect( confirmButton, &QPushButton::clicked, this, &QtIndexingReportDialog::onConfirmPressed); @@ -113,18 +114,18 @@ void QtIndexingReportDialog::updateErrorCount(size_t errorCount, size_t fatalCou { if (m_errorWidget && errorCount) { - QString str = QString::number(errorCount) + " Error"; + QString str = QString::number(errorCount) + QStringLiteral(" Error"); if (errorCount > 1) { - str += "s"; + str += QStringLiteral("s"); } if (fatalCount) { - str += " (" + QString::number(fatalCount) + " Fatal)"; + str += QStringLiteral(" (") + QString::number(fatalCount) + QStringLiteral(" Fatal)"); } - QPushButton* errorCount = m_errorWidget->findChild("errorCount"); + QPushButton* errorCount = m_errorWidget->findChild(QStringLiteral("errorCount")); errorCount->setText(str); m_errorWidget->show(); diff --git a/src/lib_gui/qt/window/QtIndexingStartDialog.cpp b/src/lib_gui/qt/window/QtIndexingStartDialog.cpp index d95ad2b5..56fc5ddf 100644 --- a/src/lib_gui/qt/window/QtIndexingStartDialog.cpp +++ b/src/lib_gui/qt/window/QtIndexingStartDialog.cpp @@ -17,7 +17,7 @@ QtIndexingStartDialog::QtIndexingStartDialog( { setSizeGripStyle(false); - QtIndexingDialog::createTitleLabel("Start Indexing", m_layout); + QtIndexingDialog::createTitleLabel(QStringLiteral("Start Indexing"), m_layout); m_layout->addSpacing(5); m_clearLabel = QtIndexingDialog::createMessageLabel(m_layout); @@ -38,11 +38,11 @@ QtIndexingStartDialog::QtIndexingStartDialog( modeTitleLayout->setSpacing(7); QLabel* modeLabel = QtIndexingDialog::createMessageLabel(modeTitleLayout); - modeLabel->setText("Mode:"); + modeLabel->setText(QStringLiteral("Mode:")); modeLabel->setAlignment(Qt::AlignLeft); QtHelpButton* helpButton = new QtHelpButton( - "Indexing Modes", + QStringLiteral("Indexing Modes"), QString("Updated files: Reindexes all files that were modified since the last " "indexing, all new files and all files depending " "on those.

" @@ -67,10 +67,10 @@ QtIndexingStartDialog::QtIndexingStartDialog( modeLayout->addLayout(modeTitleLayout); modeLayout->addSpacing(5); - m_refreshModeButtons.emplace(REFRESH_UPDATED_FILES, new QRadioButton("Updated files")); + m_refreshModeButtons.emplace(REFRESH_UPDATED_FILES, new QRadioButton(QStringLiteral("Updated files"))); m_refreshModeButtons.emplace( - REFRESH_UPDATED_AND_INCOMPLETE_FILES, new QRadioButton("Incomplete && updated files")); - m_refreshModeButtons.emplace(REFRESH_ALL_FILES, new QRadioButton("All files")); + REFRESH_UPDATED_AND_INCOMPLETE_FILES, new QRadioButton(QStringLiteral("Incomplete && updated files"))); + m_refreshModeButtons.emplace(REFRESH_ALL_FILES, new QRadioButton(QStringLiteral("All files"))); std::function func = [=](bool checked) { if (!checked) @@ -91,7 +91,7 @@ QtIndexingStartDialog::QtIndexingStartDialog( for (auto p: m_refreshModeButtons) { QRadioButton* button = p.second; - button->setObjectName("option"); + button->setObjectName(QStringLiteral("option")); button->setEnabled(false); if (p.first == initialMode) { @@ -108,7 +108,7 @@ QtIndexingStartDialog::QtIndexingStartDialog( if (enabledShallowOption) { - QCheckBox* shallowIndexingCheckBox = new QCheckBox("Shallow Python Indexing"); + QCheckBox* shallowIndexingCheckBox = new QCheckBox(QStringLiteral("Shallow Python Indexing")); connect(shallowIndexingCheckBox, &QCheckBox::toggled, [=]() { emit setShallowIndexing(shallowIndexingCheckBox->isChecked()); }); @@ -123,15 +123,15 @@ QtIndexingStartDialog::QtIndexingStartDialog( { QHBoxLayout* buttons = new QHBoxLayout(); - QPushButton* cancelButton = new QPushButton("Cancel"); - cancelButton->setObjectName("windowButton"); + QPushButton* cancelButton = new QPushButton(QStringLiteral("Cancel")); + cancelButton->setObjectName(QStringLiteral("windowButton")); connect(cancelButton, &QPushButton::clicked, this, &QtIndexingStartDialog::onCancelPressed); buttons->addWidget(cancelButton); buttons->addStretch(); - QPushButton* startButton = new QPushButton("Start"); - startButton->setObjectName("windowButton"); + QPushButton* startButton = new QPushButton(QStringLiteral("Start")); + startButton->setObjectName(QStringLiteral("windowButton")); startButton->setDefault(true); connect(startButton, &QPushButton::clicked, this, &QtIndexingStartDialog::onStartPressed); buttons->addWidget(startButton); diff --git a/src/lib_gui/qt/window/QtKeyboardShortcuts.cpp b/src/lib_gui/qt/window/QtKeyboardShortcuts.cpp index 27e17c60..2964cadf 100644 --- a/src/lib_gui/qt/window/QtKeyboardShortcuts.cpp +++ b/src/lib_gui/qt/window/QtKeyboardShortcuts.cpp @@ -38,8 +38,8 @@ void QtKeyboardShortcuts::populateWindow(QWidget* widget) QVBoxLayout* layout = new QVBoxLayout(widget); QLabel* generelLabel = new QLabel(this); - generelLabel->setObjectName("general_label"); - generelLabel->setText("General Shortcuts"); + generelLabel->setObjectName(QStringLiteral("general_label")); + generelLabel->setText(QStringLiteral("General Shortcuts")); layout->addWidget(generelLabel); layout->addWidget(createGenerelShortcutsTable()); @@ -47,8 +47,8 @@ void QtKeyboardShortcuts::populateWindow(QWidget* widget) layout->addSpacing(20); QLabel* codeLabel = new QLabel(this); - codeLabel->setObjectName("code_label"); - codeLabel->setText("Code View Shortcuts"); + codeLabel->setObjectName(QStringLiteral("code_label")); + codeLabel->setText(QStringLiteral("Code View Shortcuts")); layout->addWidget(codeLabel); layout->addWidget(createCodeViewShortcutsTable()); @@ -56,8 +56,8 @@ void QtKeyboardShortcuts::populateWindow(QWidget* widget) layout->addSpacing(20); QLabel* graphLabel = new QLabel(this); - graphLabel->setObjectName("graph_label"); - graphLabel->setText("Graph View Shortcuts"); + graphLabel->setObjectName(QStringLiteral("graph_label")); + graphLabel->setText(QStringLiteral("Graph View Shortcuts")); layout->addWidget(graphLabel); layout->addWidget(createGraphViewShortcutsTable()); @@ -71,8 +71,8 @@ void QtKeyboardShortcuts::populateWindow(QWidget* widget) void QtKeyboardShortcuts::windowReady() { - updateTitle("Keyboard Shortcuts"); - updateCloseButton("Close"); + updateTitle(QStringLiteral("Keyboard Shortcuts")); + updateCloseButton(QStringLiteral("Close")); setNextVisible(false); setPreviousVisible(false); @@ -98,8 +98,8 @@ QtShortcutTable* QtKeyboardShortcuts::createTableWidget(const std::string& objec table->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); table->setColumnCount(2); - table->setHorizontalHeaderItem(0, new QTableWidgetItem("Command")); - table->setHorizontalHeaderItem(1, new QTableWidgetItem("Shortcut")); + table->setHorizontalHeaderItem(0, new QTableWidgetItem(QStringLiteral("Command"))); + table->setHorizontalHeaderItem(1, new QTableWidgetItem(QStringLiteral("Shortcut"))); return table; } @@ -110,24 +110,24 @@ QTableWidget* QtKeyboardShortcuts::createGenerelShortcutsTable() table->setRowCount(17); - table->setItem(0, 0, new QTableWidgetItem("Larger Font")); - table->setItem(1, 0, new QTableWidgetItem("Smaller Font")); - table->setItem(2, 0, new QTableWidgetItem("Reset Font Size")); - table->setItem(3, 0, new QTableWidgetItem("Back")); - table->setItem(4, 0, new QTableWidgetItem("Forward")); - table->setItem(5, 0, new QTableWidgetItem("Refresh")); - table->setItem(6, 0, new QTableWidgetItem("Full Refresh")); - table->setItem(7, 0, new QTableWidgetItem("Find Symbol")); - table->setItem(8, 0, new QTableWidgetItem("Find Text")); - table->setItem(9, 0, new QTableWidgetItem("Find On-Screen")); - table->setItem(10, 0, new QTableWidgetItem("New Project")); - table->setItem(11, 0, new QTableWidgetItem("Open Project")); - table->setItem(12, 0, new QTableWidgetItem("Close Window")); - table->setItem(13, 0, new QTableWidgetItem("Hide Window")); - table->setItem(14, 0, new QTableWidgetItem("To Overview")); - table->setItem(15, 0, new QTableWidgetItem("Preferences")); - table->setItem(16, 0, new QTableWidgetItem("Bookmark Active Symbol")); - table->setItem(17, 0, new QTableWidgetItem("Bookmark Manager")); + table->setItem(0, 0, new QTableWidgetItem(QStringLiteral("Larger Font"))); + table->setItem(1, 0, new QTableWidgetItem(QStringLiteral("Smaller Font"))); + table->setItem(2, 0, new QTableWidgetItem(QStringLiteral("Reset Font Size"))); + table->setItem(3, 0, new QTableWidgetItem(QStringLiteral("Back"))); + table->setItem(4, 0, new QTableWidgetItem(QStringLiteral("Forward"))); + table->setItem(5, 0, new QTableWidgetItem(QStringLiteral("Refresh"))); + table->setItem(6, 0, new QTableWidgetItem(QStringLiteral("Full Refresh"))); + table->setItem(7, 0, new QTableWidgetItem(QStringLiteral("Find Symbol"))); + table->setItem(8, 0, new QTableWidgetItem(QStringLiteral("Find Text"))); + table->setItem(9, 0, new QTableWidgetItem(QStringLiteral("Find On-Screen"))); + table->setItem(10, 0, new QTableWidgetItem(QStringLiteral("New Project"))); + table->setItem(11, 0, new QTableWidgetItem(QStringLiteral("Open Project"))); + table->setItem(12, 0, new QTableWidgetItem(QStringLiteral("Close Window"))); + table->setItem(13, 0, new QTableWidgetItem(QStringLiteral("Hide Window"))); + table->setItem(14, 0, new QTableWidgetItem(QStringLiteral("To Overview"))); + table->setItem(15, 0, new QTableWidgetItem(QStringLiteral("Preferences"))); + table->setItem(16, 0, new QTableWidgetItem(QStringLiteral("Bookmark Active Symbol"))); + table->setItem(17, 0, new QTableWidgetItem(QStringLiteral("Bookmark Manager"))); #if defined(Q_OS_MAC) table->setItem(0, 1, new QTableWidgetItem("Cmd + +")); @@ -149,28 +149,28 @@ QTableWidget* QtKeyboardShortcuts::createGenerelShortcutsTable() table->setItem(16, 1, new QTableWidgetItem("Cmd + S")); table->setItem(17, 1, new QTableWidgetItem("Cmd + B")); #else - table->setItem(0, 1, new QTableWidgetItem("Ctrl + +")); - table->setItem(1, 1, new QTableWidgetItem("Ctrl + -")); - table->setItem(2, 1, new QTableWidgetItem("Ctrl + 0")); - table->setItem(3, 1, new QTableWidgetItem("Ctrl + Z | Backspace")); - table->setItem(4, 1, new QTableWidgetItem("Ctrl + Shift + Z")); - table->setItem(5, 1, new QTableWidgetItem("F5")); - table->setItem(6, 1, new QTableWidgetItem("Shift + F5")); - table->setItem(7, 1, new QTableWidgetItem("Ctrl + F")); - table->setItem(8, 1, new QTableWidgetItem("Ctrl + Shift + F")); - table->setItem(9, 1, new QTableWidgetItem("Ctrl + D | /")); - table->setItem(10, 1, new QTableWidgetItem("Ctrl + N")); - table->setItem(11, 1, new QTableWidgetItem("Ctrl + O")); + table->setItem(0, 1, new QTableWidgetItem(QStringLiteral("Ctrl + +"))); + table->setItem(1, 1, new QTableWidgetItem(QStringLiteral("Ctrl + -"))); + table->setItem(2, 1, new QTableWidgetItem(QStringLiteral("Ctrl + 0"))); + table->setItem(3, 1, new QTableWidgetItem(QStringLiteral("Ctrl + Z | Backspace"))); + table->setItem(4, 1, new QTableWidgetItem(QStringLiteral("Ctrl + Shift + Z"))); + table->setItem(5, 1, new QTableWidgetItem(QStringLiteral("F5"))); + table->setItem(6, 1, new QTableWidgetItem(QStringLiteral("Shift + F5"))); + table->setItem(7, 1, new QTableWidgetItem(QStringLiteral("Ctrl + F"))); + table->setItem(8, 1, new QTableWidgetItem(QStringLiteral("Ctrl + Shift + F"))); + table->setItem(9, 1, new QTableWidgetItem(QStringLiteral("Ctrl + D | /"))); + table->setItem(10, 1, new QTableWidgetItem(QStringLiteral("Ctrl + N"))); + table->setItem(11, 1, new QTableWidgetItem(QStringLiteral("Ctrl + O"))); # if defined(Q_OS_WIN32) table->setItem(12, 1, new QTableWidgetItem("Alt + F4")); # else - table->setItem(12, 1, new QTableWidgetItem("Ctrl + W")); + table->setItem(12, 1, new QTableWidgetItem(QStringLiteral("Ctrl + W"))); # endif - table->setItem(13, 1, new QTableWidgetItem("")); - table->setItem(14, 1, new QTableWidgetItem("Ctrl + Home")); - table->setItem(15, 1, new QTableWidgetItem("Ctrl + ,")); - table->setItem(16, 1, new QTableWidgetItem("Ctrl + S")); - table->setItem(17, 1, new QTableWidgetItem("Ctrl + B")); + table->setItem(13, 1, new QTableWidgetItem(QLatin1String(""))); + table->setItem(14, 1, new QTableWidgetItem(QStringLiteral("Ctrl + Home"))); + table->setItem(15, 1, new QTableWidgetItem(QStringLiteral("Ctrl + ,"))); + table->setItem(16, 1, new QTableWidgetItem(QStringLiteral("Ctrl + S"))); + table->setItem(17, 1, new QTableWidgetItem(QStringLiteral("Ctrl + B"))); #endif table->updateSize(); @@ -183,10 +183,10 @@ QTableWidget* QtKeyboardShortcuts::createCodeViewShortcutsTable() QtShortcutTable* table = createTableWidget("table_code"); table->setRowCount(4); - table->setItem(0, 0, new QTableWidgetItem("Next Reference")); - table->setItem(1, 0, new QTableWidgetItem("Previous Reference")); - table->setItem(2, 0, new QTableWidgetItem("Next Local Reference")); - table->setItem(3, 0, new QTableWidgetItem("Previous Local Reference")); + table->setItem(0, 0, new QTableWidgetItem(QStringLiteral("Next Reference"))); + table->setItem(1, 0, new QTableWidgetItem(QStringLiteral("Previous Reference"))); + table->setItem(2, 0, new QTableWidgetItem(QStringLiteral("Next Local Reference"))); + table->setItem(3, 0, new QTableWidgetItem(QStringLiteral("Previous Local Reference"))); #if defined(Q_OS_MAC) table->setItem(0, 1, new QTableWidgetItem("Cmd + G")); @@ -194,10 +194,10 @@ QTableWidget* QtKeyboardShortcuts::createCodeViewShortcutsTable() table->setItem(2, 1, new QTableWidgetItem("Cmd + T")); table->setItem(3, 1, new QTableWidgetItem("Cmd + Shift + T")); #else - table->setItem(0, 1, new QTableWidgetItem("Ctrl + G")); - table->setItem(1, 1, new QTableWidgetItem("Ctrl + Shift + G")); - table->setItem(2, 1, new QTableWidgetItem("Ctrl + T")); - table->setItem(3, 1, new QTableWidgetItem("Ctrl + Shift + T")); + table->setItem(0, 1, new QTableWidgetItem(QStringLiteral("Ctrl + G"))); + table->setItem(1, 1, new QTableWidgetItem(QStringLiteral("Ctrl + Shift + G"))); + table->setItem(2, 1, new QTableWidgetItem(QStringLiteral("Ctrl + T"))); + table->setItem(3, 1, new QTableWidgetItem(QStringLiteral("Ctrl + Shift + T"))); #endif table->updateSize(); @@ -210,26 +210,26 @@ QTableWidget* QtKeyboardShortcuts::createGraphViewShortcutsTable() QtShortcutTable* table = createTableWidget("table_graph"); table->setRowCount(7); - table->setItem(0, 0, new QTableWidgetItem("Pan left")); - table->setItem(1, 0, new QTableWidgetItem("Pan right")); - table->setItem(2, 0, new QTableWidgetItem("Pan up")); - table->setItem(3, 0, new QTableWidgetItem("Pan down")); - table->setItem(4, 0, new QTableWidgetItem("Zoom in")); - table->setItem(5, 0, new QTableWidgetItem("Zoom out")); - table->setItem(6, 0, new QTableWidgetItem("Reset Zoom")); + table->setItem(0, 0, new QTableWidgetItem(QStringLiteral("Pan left"))); + table->setItem(1, 0, new QTableWidgetItem(QStringLiteral("Pan right"))); + table->setItem(2, 0, new QTableWidgetItem(QStringLiteral("Pan up"))); + table->setItem(3, 0, new QTableWidgetItem(QStringLiteral("Pan down"))); + table->setItem(4, 0, new QTableWidgetItem(QStringLiteral("Zoom in"))); + table->setItem(5, 0, new QTableWidgetItem(QStringLiteral("Zoom out"))); + table->setItem(6, 0, new QTableWidgetItem(QStringLiteral("Reset Zoom"))); - table->setItem(0, 1, new QTableWidgetItem("A")); - table->setItem(1, 1, new QTableWidgetItem("D")); - table->setItem(2, 1, new QTableWidgetItem("W")); - table->setItem(3, 1, new QTableWidgetItem("S")); + table->setItem(0, 1, new QTableWidgetItem(QStringLiteral("A"))); + table->setItem(1, 1, new QTableWidgetItem(QStringLiteral("D"))); + table->setItem(2, 1, new QTableWidgetItem(QStringLiteral("W"))); + table->setItem(3, 1, new QTableWidgetItem(QStringLiteral("S"))); #if defined(Q_OS_MAC) table->setItem(4, 1, new QTableWidgetItem("Shift + W | Cmd + Mousewheel up")); table->setItem(5, 1, new QTableWidgetItem("Shift + S | Cmd + Mousewheel down")); #else - table->setItem(4, 1, new QTableWidgetItem("Shift + W | Ctrl + Mousewheel up")); - table->setItem(5, 1, new QTableWidgetItem("Shift + S | Ctrl + Mousewheel down")); + table->setItem(4, 1, new QTableWidgetItem(QStringLiteral("Shift + W | Ctrl + Mousewheel up"))); + table->setItem(5, 1, new QTableWidgetItem(QStringLiteral("Shift + S | Ctrl + Mousewheel down"))); #endif - table->setItem(6, 1, new QTableWidgetItem("0")); + table->setItem(6, 1, new QTableWidgetItem(QStringLiteral("0"))); table->updateSize(); diff --git a/src/lib_gui/qt/window/QtKnownProgressDialog.cpp b/src/lib_gui/qt/window/QtKnownProgressDialog.cpp index 5fc531be..c1db135c 100644 --- a/src/lib_gui/qt/window/QtKnownProgressDialog.cpp +++ b/src/lib_gui/qt/window/QtKnownProgressDialog.cpp @@ -7,7 +7,7 @@ QtKnownProgressDialog::QtKnownProgressDialog(bool hideable, QWidget* parent) { setSizeGripStyle(false); - updateTitle("Progress"); + updateTitle(QStringLiteral("Progress")); m_layout->addStretch(); @@ -16,8 +16,8 @@ QtKnownProgressDialog::QtKnownProgressDialog(bool hideable, QWidget* parent) QHBoxLayout* buttons = new QHBoxLayout(); buttons->addStretch(); - QPushButton* hideButton = new QPushButton("Hide"); - hideButton->setObjectName("windowButton"); + QPushButton* hideButton = new QPushButton(QStringLiteral("Hide")); + hideButton->setObjectName(QStringLiteral("windowButton")); hideButton->setDefault(true); connect(hideButton, &QPushButton::clicked, this, &QtKnownProgressDialog::onHidePressed); buttons->addWidget(hideButton); diff --git a/src/lib_gui/qt/window/QtLicenseWindow.cpp b/src/lib_gui/qt/window/QtLicenseWindow.cpp index 50f66335..696c80d9 100644 --- a/src/lib_gui/qt/window/QtLicenseWindow.cpp +++ b/src/lib_gui/qt/window/QtLicenseWindow.cpp @@ -46,11 +46,11 @@ void QtLicenseWindow::populateWindow(QWidget* widget) layout->addSpacing(30); - QLabel* header3rdParties = new QLabel( + QLabel* header3rdParties = new QLabel(QStringLiteral( "Copyrights and Licenses for Third Party Software Distributed with Sourcetrail:
" "Sourcetaril contains code written by the following third parties that have
" - "additional or alternate copyrights, licenses, and/or restrictions:"); + "additional or alternate copyrights, licenses, and/or restrictions:")); layout->addWidget(header3rdParties); layout->addSpacing(30); @@ -87,8 +87,8 @@ void QtLicenseWindow::populateWindow(QWidget* widget) void QtLicenseWindow::windowReady() { - updateTitle("License"); - updateCloseButton("Close"); + updateTitle(QStringLiteral("License")); + updateCloseButton(QStringLiteral("Close")); setNextVisible(false); setPreviousVisible(false); diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index f54453a3..e1530cc0 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -115,7 +115,7 @@ QtMainWindow::QtMainWindow() , m_showDockWidgetTitleBars(true) , m_windowStack(this) { - setObjectName("QtMainWindow"); + setObjectName(QStringLiteral("QtMainWindow")); setCentralWidget(nullptr); setDockNestingEnabled(true); @@ -167,13 +167,13 @@ QtMainWindow::~QtMainWindow() void QtMainWindow::addView(View* view) { const QString name = QString::fromStdString(view->getName()); - if (name == "Tabs") + if (name == QLatin1String("Tabs")) { QToolBar* toolBar = new QToolBar(); toolBar->setObjectName("Tool" + name); toolBar->setMovable(false); toolBar->setFloatable(false); - toolBar->setStyleSheet("* { margin: 0; }"); + toolBar->setStyleSheet(QStringLiteral("* { margin: 0; }")); toolBar->addWidget(QtViewWidgetWrapper::getWidgetOfView(view)); addToolBar(toolBar); return; @@ -189,7 +189,7 @@ void QtMainWindow::addView(View* view) layout->addWidget(QtViewWidgetWrapper::getWidgetOfView(view)); // Disable un-intended vertical growth of search widget - if (name == "Search") + if (name == QLatin1String("Search")) { dock->setSizePolicy(dock->sizePolicy().horizontalPolicy(), QSizePolicy::Fixed); } @@ -222,7 +222,7 @@ void QtMainWindow::addView(View* view) void QtMainWindow::overrideView(View* view) { const QString name = QString::fromStdString(view->getName()); - if (name == "Tabs") + if (name == QLatin1String("Tabs")) { return; } @@ -299,14 +299,14 @@ void QtMainWindow::loadLayout() QSettings settings( QString::fromStdWString(UserPaths::getWindowSettingsPath().wstr()), QSettings::IniFormat); - settings.beginGroup("MainWindow"); - resize(settings.value("size", QSize(600, 400)).toSize()); - move(settings.value("position", QPoint(200, 200)).toPoint()); - if (settings.value("maximized", false).toBool()) + settings.beginGroup(QStringLiteral("MainWindow")); + resize(settings.value(QStringLiteral("size"), QSize(600, 400)).toSize()); + move(settings.value(QStringLiteral("position"), QPoint(200, 200)).toPoint()); + if (settings.value(QStringLiteral("maximized"), false).toBool()) { showMaximized(); } - setShowDockWidgetTitleBars(settings.value("showTitleBars", true).toBool()); + setShowDockWidgetTitleBars(settings.value(QStringLiteral("showTitleBars"), true).toBool()); settings.endGroup(); loadDockWidgetLayout(); } @@ -315,7 +315,7 @@ void QtMainWindow::loadDockWidgetLayout() { QSettings settings( QString::fromStdWString(UserPaths::getWindowSettingsPath().wstr()), QSettings::IniFormat); - this->restoreState(settings.value("DOCK_LOCATIONS").toByteArray()); + this->restoreState(settings.value(QStringLiteral("DOCK_LOCATIONS")).toByteArray()); for (DockWidget dock: m_dockWidgets) { @@ -336,17 +336,17 @@ void QtMainWindow::saveLayout() QSettings settings( QString::fromStdWString(UserPaths::getWindowSettingsPath().wstr()), QSettings::IniFormat); - settings.beginGroup("MainWindow"); - settings.setValue("maximized", isMaximized()); + settings.beginGroup(QStringLiteral("MainWindow")); + settings.setValue(QStringLiteral("maximized"), isMaximized()); if (!isMaximized()) { - settings.setValue("size", size()); - settings.setValue("position", pos()); + settings.setValue(QStringLiteral("size"), size()); + settings.setValue(QStringLiteral("position"), pos()); } - settings.setValue("showTitleBars", m_showDockWidgetTitleBars); + settings.setValue(QStringLiteral("showTitleBars"), m_showDockWidgetTitleBars); settings.endGroup(); - settings.setValue("DOCK_LOCATIONS", this->saveState()); + settings.setValue(QStringLiteral("DOCK_LOCATIONS"), this->saveState()); } void QtMainWindow::updateHistoryMenu(std::shared_ptr message) @@ -504,7 +504,7 @@ void QtMainWindow::openSettings() void QtMainWindow::showDocumentation() { - QDesktopServices::openUrl(QUrl("https://sourcetrail.com/documentation/")); + QDesktopServices::openUrl(QUrl(QStringLiteral("https://sourcetrail.com/documentation/"))); } void QtMainWindow::showKeyboardShortcuts() @@ -521,12 +521,12 @@ void QtMainWindow::showErrorHelpMessage() void QtMainWindow::showChangelog() { QDesktopServices::openUrl( - QUrl("https://github.com/CoatiSoftware/Sourcetrail/blob/master/CHANGELOG.md")); + QUrl(QStringLiteral("https://github.com/CoatiSoftware/Sourcetrail/blob/master/CHANGELOG.md"))); } void QtMainWindow::showBugtracker() { - QDesktopServices::openUrl(QUrl("https://github.com/CoatiSoftware/Sourcetrail/issues")); + QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/CoatiSoftware/Sourcetrail/issues"))); } void QtMainWindow::showLicenses() @@ -608,7 +608,7 @@ void QtMainWindow::newProjectFromCDB(const FilePath& filePath) void QtMainWindow::openProject() { QString fileName = QtFileDialog::getOpenFileName( - this, tr("Open File"), FilePath(), "Sourcetrail Project Files (*.srctrlprj)"); + this, tr("Open File"), FilePath(), QStringLiteral("Sourcetrail Project Files (*.srctrlprj)")); if (!fileName.isEmpty()) { @@ -963,7 +963,7 @@ void QtMainWindow::setupViewMenu() menu->addAction(tr("Show Start Window"), this, &QtMainWindow::showStartScreen); - m_showTitleBarsAction = new QAction("Show Title Bars", this); + m_showTitleBarsAction = new QAction(QStringLiteral("Show Title Bars"), this); m_showTitleBarsAction->setCheckable(true); m_showTitleBarsAction->setChecked(m_showDockWidgetTitleBars); connect( diff --git a/src/lib_gui/qt/window/QtPathListDialog.cpp b/src/lib_gui/qt/window/QtPathListDialog.cpp index 4cb1f77b..bf314d19 100644 --- a/src/lib_gui/qt/window/QtPathListDialog.cpp +++ b/src/lib_gui/qt/window/QtPathListDialog.cpp @@ -40,7 +40,7 @@ void QtPathListDialog::populateWindow(QWidget* widget) layout->setContentsMargins(0, 0, 0, 0); QLabel* description = new QLabel(m_description); - description->setObjectName("description"); + description->setObjectName(QStringLiteral("description")); description->setWordWrap(true); layout->addWidget(description); @@ -55,8 +55,8 @@ void QtPathListDialog::populateWindow(QWidget* widget) void QtPathListDialog::windowReady() { - updateNextButton("Save"); - updateCloseButton("Cancel"); + updateNextButton(QStringLiteral("Save")); + updateCloseButton(QStringLiteral("Cancel")); setPreviousVisible(false); diff --git a/src/lib_gui/qt/window/QtPreferencesWindow.cpp b/src/lib_gui/qt/window/QtPreferencesWindow.cpp index 46d60701..c1bb89fc 100644 --- a/src/lib_gui/qt/window/QtPreferencesWindow.cpp +++ b/src/lib_gui/qt/window/QtPreferencesWindow.cpp @@ -52,8 +52,8 @@ void QtPreferencesWindow::windowReady() { QtProjectWizardWindow::windowReady(); - updateTitle("PREFERENCES"); - updateNextButton("Save"); + updateTitle(QStringLiteral("PREFERENCES")); + updateNextButton(QStringLiteral("Save")); setPreviousVisible(false); loadContent(); diff --git a/src/lib_gui/qt/window/QtProgressBarDialog.cpp b/src/lib_gui/qt/window/QtProgressBarDialog.cpp index 2f420362..c8794d47 100644 --- a/src/lib_gui/qt/window/QtProgressBarDialog.cpp +++ b/src/lib_gui/qt/window/QtProgressBarDialog.cpp @@ -8,7 +8,7 @@ QtProgressBarDialog::QtProgressBarDialog(float topRatio, bool hideable, QWidget* : QtIndexingDialog(true, parent), m_title(nullptr), m_topRatio(topRatio) { m_top = new QWidget(m_window); - m_top->setObjectName("topHalf"); + m_top->setObjectName(QStringLiteral("topHalf")); m_top->setGeometry(0, 0, 0, 0); m_top->show(); m_top->lower(); @@ -16,13 +16,13 @@ QtProgressBarDialog::QtProgressBarDialog(float topRatio, bool hideable, QWidget* m_progressBar = new QtProgressBar(m_window); m_progressBar->setGeometry(0, 0, 0, 0); - m_title = new QLabel("", this); - m_title->setObjectName("title"); + m_title = new QLabel(QLatin1String(""), this); + m_title->setObjectName(QStringLiteral("title")); m_title->setAlignment(Qt::AlignRight | Qt::AlignBottom); m_title->show(); - m_percentLabel = new QLabel("0% Progress"); - m_percentLabel->setObjectName("percent"); + m_percentLabel = new QLabel(QStringLiteral("0% Progress")); + m_percentLabel->setObjectName(QStringLiteral("percent")); m_layout->addWidget(m_percentLabel, 0, Qt::AlignRight); m_messageLabel = QtIndexingDialog::createMessageLabel(m_layout); diff --git a/src/lib_gui/qt/window/QtSelectPathsDialog.cpp b/src/lib_gui/qt/window/QtSelectPathsDialog.cpp index 195202e6..5ed29a79 100644 --- a/src/lib_gui/qt/window/QtSelectPathsDialog.cpp +++ b/src/lib_gui/qt/window/QtSelectPathsDialog.cpp @@ -58,7 +58,7 @@ void QtSelectPathsDialog::setPathsList( if (!s.exists()) { item->setTextColor(Qt::red); - item->setToolTip("Path does not exist"); + item->setToolTip(QStringLiteral("Path does not exist")); item->setFlags(item->flags() & ~Qt::ItemIsEnabled); item->setCheckState(Qt::Unchecked); } @@ -83,12 +83,12 @@ void QtSelectPathsDialog::populateWindow(QWidget* widget) layout->setContentsMargins(0, 0, 0, 0); QLabel* description = new QLabel(m_description); - description->setObjectName("description"); + description->setObjectName(QStringLiteral("description")); description->setWordWrap(true); layout->addWidget(description); m_list = new QListWidget(); - m_list->setObjectName("pathList"); + m_list->setObjectName(QStringLiteral("pathList")); m_list->setEditTriggers(QAbstractItemView::NoEditTriggers); m_list->setSelectionMode(QAbstractItemView::ExtendedSelection); m_list->setAttribute(Qt::WA_MacShowFocusRect, 0); @@ -97,8 +97,8 @@ void QtSelectPathsDialog::populateWindow(QWidget* widget) QHBoxLayout* buttonLayout = new QHBoxLayout(); buttonLayout->setContentsMargins(0, 0, 0, 0); - QPushButton* checkAllButton = new QPushButton("check all"); - checkAllButton->setObjectName("windowButton"); + QPushButton* checkAllButton = new QPushButton(QStringLiteral("check all")); + checkAllButton->setObjectName(QStringLiteral("windowButton")); connect(checkAllButton, &QPushButton::clicked, [=]() { m_list->selectAll(); checkSelected(true); @@ -106,8 +106,8 @@ void QtSelectPathsDialog::populateWindow(QWidget* widget) }); buttonLayout->addWidget(checkAllButton); - QPushButton* unCheckAllButton = new QPushButton("uncheck all"); - unCheckAllButton->setObjectName("windowButton"); + QPushButton* unCheckAllButton = new QPushButton(QStringLiteral("uncheck all")); + unCheckAllButton->setObjectName(QStringLiteral("windowButton")); connect(unCheckAllButton, &QPushButton::clicked, [=]() { m_list->selectAll(); checkSelected(false); @@ -115,13 +115,13 @@ void QtSelectPathsDialog::populateWindow(QWidget* widget) }); buttonLayout->addWidget(unCheckAllButton); - QPushButton* checkSelectedButton = new QPushButton("check selected"); - checkSelectedButton->setObjectName("windowButton"); + QPushButton* checkSelectedButton = new QPushButton(QStringLiteral("check selected")); + checkSelectedButton->setObjectName(QStringLiteral("windowButton")); connect(checkSelectedButton, &QPushButton::clicked, [=]() { checkSelected(true); }); buttonLayout->addWidget(checkSelectedButton); - QPushButton* unCheckSelectedButton = new QPushButton("uncheck selected"); - unCheckSelectedButton->setObjectName("windowButton"); + QPushButton* unCheckSelectedButton = new QPushButton(QStringLiteral("uncheck selected")); + unCheckSelectedButton->setObjectName(QStringLiteral("windowButton")); connect(unCheckSelectedButton, &QPushButton::clicked, [=]() { checkSelected(false); }); buttonLayout->addWidget(unCheckSelectedButton); @@ -132,8 +132,8 @@ void QtSelectPathsDialog::populateWindow(QWidget* widget) void QtSelectPathsDialog::windowReady() { - updateNextButton("Save"); - updateCloseButton("Cancel"); + updateNextButton(QStringLiteral("Save")); + updateCloseButton(QStringLiteral("Cancel")); setPreviousVisible(false); diff --git a/src/lib_gui/qt/window/QtStartScreen.cpp b/src/lib_gui/qt/window/QtStartScreen.cpp index b05c9589..5622fdc6 100644 --- a/src/lib_gui/qt/window/QtStartScreen.cpp +++ b/src/lib_gui/qt/window/QtStartScreen.cpp @@ -50,13 +50,13 @@ void QtRecentProjectButton::handleButtonClick() else { QMessageBox msgBox; - msgBox.setText("Missing Project File"); + msgBox.setText(QStringLiteral("Missing Project File")); msgBox.setInformativeText(QString::fromStdWString( L"

Couldn't find \"" + m_projectFilePath.wstr() + L"\" on your filesystem.

Do you want to remove it from recent project " L"list?

")); - msgBox.addButton("Remove", QMessageBox::ButtonRole::YesRole); - msgBox.addButton("Keep", QMessageBox::ButtonRole::NoRole); + msgBox.addButton(QStringLiteral("Remove"), QMessageBox::ButtonRole::YesRole); + msgBox.addButton(QStringLiteral("Keep"), QMessageBox::ButtonRole::NoRole); msgBox.setIcon(QMessageBox::Icon::Question); int ret = msgBox.exec(); @@ -148,7 +148,7 @@ void QtStartScreen::updateButtons() &QtRecentProjectButton::handleButtonClick); if (button->projectExists()) { - button->setObjectName("recentButton"); + button->setObjectName(QStringLiteral("recentButton")); connect( button, &QtRecentProjectButton::clicked, this, &QtStartScreen::handleRecentButton); } @@ -156,7 +156,7 @@ void QtStartScreen::updateButtons() { connect( button, &QtRecentProjectButton::updateButtons, this, &QtStartScreen::updateButtons); - button->setObjectName("recentButtonMissing"); + button->setObjectName(QStringLiteral("recentButtonMissing")); } } else @@ -188,7 +188,7 @@ void QtStartScreen::setupStartScreen() QLabel* versionLabel = new QLabel( ("Version " + Version::getApplicationVersion().toDisplayString()).c_str(), this); - versionLabel->setObjectName("boldLabel"); + versionLabel->setObjectName(QStringLiteral("boldLabel")); col->addWidget(versionLabel); QtUpdateCheckerWidget* checker = new QtUpdateCheckerWidget(this); @@ -196,35 +196,35 @@ void QtStartScreen::setupStartScreen() col->addSpacing(15); - QPushButton* githubButton = new QPushButton("Contribute on GitHub", this); + QPushButton* githubButton = new QPushButton(QStringLiteral("Contribute on GitHub"), this); githubButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - githubButton->setObjectName("infoButton"); + githubButton->setObjectName(QStringLiteral("infoButton")); githubButton->setIcon(m_githubIcon); githubButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); connect(githubButton, &QPushButton::clicked, []() { QDesktopServices::openUrl( - QUrl("https://github.com/CoatiSoftware/Sourcetrail", QUrl::TolerantMode)); + QUrl(QStringLiteral("https://github.com/CoatiSoftware/Sourcetrail"), QUrl::TolerantMode)); }); col->addWidget(githubButton); col->addSpacing(8); // QPushButton* patreonButton = new QPushButton("Support on Patreon", this); - QPushButton* patreonButton = new QPushButton("Become a Patron", this); + QPushButton* patreonButton = new QPushButton(QStringLiteral("Become a Patron"), this); patreonButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - patreonButton->setObjectName("infoButton"); + patreonButton->setObjectName(QStringLiteral("infoButton")); patreonButton->setIcon(m_patreonIcon); patreonButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); connect(patreonButton, &QPushButton::clicked, []() { - QDesktopServices::openUrl(QUrl("https://www.patreon.com/sourcetrail", QUrl::TolerantMode)); + QDesktopServices::openUrl(QUrl(QStringLiteral("https://www.patreon.com/sourcetrail"), QUrl::TolerantMode)); }); col->addWidget(patreonButton); col->addSpacing(15); { - QLabel* newsHeader = new QLabel("News:"); - newsHeader->setObjectName("boldLabel"); + QLabel* newsHeader = new QLabel(QStringLiteral("News:")); + newsHeader->setObjectName(QStringLiteral("boldLabel")); col->addWidget(newsHeader); QtNewsWidget* newsWidget = new QtNewsWidget(this); @@ -237,9 +237,9 @@ void QtStartScreen::setupStartScreen() col->addSpacing(35); col->addStretch(); - QPushButton* newProjectButton = new QPushButton("New Project", this); + QPushButton* newProjectButton = new QPushButton(QStringLiteral("New Project"), this); newProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - newProjectButton->setObjectName("projectButton"); + newProjectButton->setObjectName(QStringLiteral("projectButton")); newProjectButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); connect( newProjectButton, &QPushButton::clicked, this, &QtStartScreen::handleNewProjectButton); @@ -247,9 +247,9 @@ void QtStartScreen::setupStartScreen() col->addSpacing(8); - QPushButton* openProjectButton = new QPushButton("Open Project", this); + QPushButton* openProjectButton = new QPushButton(QStringLiteral("Open Project"), this); openProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - openProjectButton->setObjectName("projectButton"); + openProjectButton->setObjectName(QStringLiteral("projectButton")); openProjectButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); connect( openProjectButton, &QPushButton::clicked, this, &QtStartScreen::handleOpenProjectButton); @@ -262,8 +262,8 @@ void QtStartScreen::setupStartScreen() QVBoxLayout* col = new QVBoxLayout(); layout->addLayout(col, 1); - QLabel* recentProjectsLabel = new QLabel("Recent Projects: ", this); - recentProjectsLabel->setObjectName("titleLabel"); + QLabel* recentProjectsLabel = new QLabel(QStringLiteral("Recent Projects: "), this); + recentProjectsLabel->setObjectName(QStringLiteral("titleLabel")); col->addWidget(recentProjectsLabel); col->addSpacing(20); @@ -275,7 +275,7 @@ void QtStartScreen::setupStartScreen() button->setIcon(m_projectIcon); button->setIconSize(QSize(30, 30)); button->setMinimumSize(button->fontMetrics().width(button->text()) + 45, 40); - button->setObjectName("recentButtonMissing"); + button->setObjectName(QStringLiteral("recentButtonMissing")); button->minimumSizeHint(); // force font loading m_recentProjectsButtons.push_back(button); col->addWidget(button); diff --git a/src/lib_gui/qt/window/QtTextEditDialog.cpp b/src/lib_gui/qt/window/QtTextEditDialog.cpp index 303afe08..6f666df3 100644 --- a/src/lib_gui/qt/window/QtTextEditDialog.cpp +++ b/src/lib_gui/qt/window/QtTextEditDialog.cpp @@ -29,11 +29,11 @@ void QtTextEditDialog::setReadOnly(bool readOnly) if (readOnly) { - updateNextButton("OK"); + updateNextButton(QStringLiteral("OK")); } else { - updateNextButton("Save"); + updateNextButton(QStringLiteral("Save")); } } @@ -43,12 +43,12 @@ void QtTextEditDialog::populateWindow(QWidget* widget) layout->setContentsMargins(0, 0, 0, 0); QLabel* description = new QLabel(m_description); - description->setObjectName("description"); + description->setObjectName(QStringLiteral("description")); description->setWordWrap(true); layout->addWidget(description); m_text = new QPlainTextEdit(); - m_text->setObjectName("textField"); + m_text->setObjectName(QStringLiteral("textField")); m_text->setLineWrapMode(QPlainTextEdit::NoWrap); m_text->setTabStopWidth(8 * m_text->fontMetrics().width('9')); layout->addWidget(m_text); @@ -58,8 +58,8 @@ void QtTextEditDialog::populateWindow(QWidget* widget) void QtTextEditDialog::windowReady() { - updateNextButton("Save"); - updateCloseButton("Cancel"); + updateNextButton(QStringLiteral("Save")); + updateCloseButton(QStringLiteral("Cancel")); setPreviousVisible(false); diff --git a/src/lib_gui/qt/window/QtUnknownProgressDialog.cpp b/src/lib_gui/qt/window/QtUnknownProgressDialog.cpp index a6794380..1528f225 100644 --- a/src/lib_gui/qt/window/QtUnknownProgressDialog.cpp +++ b/src/lib_gui/qt/window/QtUnknownProgressDialog.cpp @@ -7,7 +7,7 @@ QtUnknownProgressDialog::QtUnknownProgressDialog(bool hideable, QWidget* parent) { setSizeGripStyle(false); - updateTitle("Status"); + updateTitle(QStringLiteral("Status")); m_layout->addStretch(); @@ -16,8 +16,8 @@ QtUnknownProgressDialog::QtUnknownProgressDialog(bool hideable, QWidget* parent) QHBoxLayout* buttons = new QHBoxLayout(); buttons->addStretch(); - QPushButton* hideButton = new QPushButton("Hide"); - hideButton->setObjectName("windowButton"); + QPushButton* hideButton = new QPushButton(QStringLiteral("Hide")); + hideButton->setObjectName(QStringLiteral("windowButton")); hideButton->setDefault(true); connect(hideButton, &QPushButton::clicked, this, &QtUnknownProgressDialog::onHidePressed); buttons->addWidget(hideButton); diff --git a/src/lib_gui/qt/window/QtWindow.cpp b/src/lib_gui/qt/window/QtWindow.cpp index fe8b0088..a3ebb941 100644 --- a/src/lib_gui/qt/window/QtWindow.cpp +++ b/src/lib_gui/qt/window/QtWindow.cpp @@ -35,13 +35,13 @@ void QtWindow::setup() hlayout->setContentsMargins(0, 0, 0, 0); m_title = new QLabel(); - m_title->setObjectName("title"); + m_title->setObjectName(QStringLiteral("title")); hlayout->addWidget(m_title); hlayout->addStretch(); m_subTitle = new QLabel(); - m_subTitle->setObjectName("subTitle"); + m_subTitle->setObjectName(QStringLiteral("subTitle")); hlayout->addWidget(m_subTitle); layout->addLayout(hlayout); @@ -50,13 +50,13 @@ void QtWindow::setup() layout->addSpacing(10); QWidget* contentWidget = new QWidget(); - contentWidget->setObjectName("form"); + contentWidget->setObjectName(QStringLiteral("form")); populateWindow(contentWidget); QScrollArea* scrollArea = new QScrollArea(); scrollArea->setFrameShadow(QFrame::Plain); - scrollArea->setObjectName("formArea"); + scrollArea->setObjectName(QStringLiteral("formArea")); scrollArea->setWidgetResizable(true); scrollArea->setWidget(contentWidget); @@ -69,7 +69,7 @@ void QtWindow::setup() } else { - scrollArea->setObjectName("scrollArea"); + scrollArea->setObjectName(QStringLiteral("scrollArea")); } QHBoxLayout* buttonLayout = createButtons(); @@ -361,16 +361,16 @@ void QtWindow::addLogo() QHBoxLayout* QtWindow::createButtons() { - m_nextButton = new QPushButton("Next"); - m_nextButton->setObjectName("windowButton"); + m_nextButton = new QPushButton(QStringLiteral("Next")); + m_nextButton->setObjectName(QStringLiteral("windowButton")); connect(m_nextButton, &QPushButton::clicked, this, &QtWindow::handleNextPress); - m_previousButton = new QPushButton("Previous"); - m_previousButton->setObjectName("windowButton"); + m_previousButton = new QPushButton(QStringLiteral("Previous")); + m_previousButton->setObjectName(QStringLiteral("windowButton")); connect(m_previousButton, &QPushButton::clicked, this, &QtWindow::handlePreviousPress); - m_closeButton = new QPushButton("Cancel"); - m_closeButton->setObjectName("windowButton"); + m_closeButton = new QPushButton(QStringLiteral("Cancel")); + m_closeButton->setObjectName(QStringLiteral("windowButton")); connect(m_closeButton, &QPushButton::clicked, this, &QtWindow::handleClosePress); QHBoxLayout* buttons = new QHBoxLayout(); diff --git a/src/lib_gui/qt/window/QtWindowBase.cpp b/src/lib_gui/qt/window/QtWindowBase.cpp index 9bc9b416..f89b26ea 100644 --- a/src/lib_gui/qt/window/QtWindowBase.cpp +++ b/src/lib_gui/qt/window/QtWindowBase.cpp @@ -28,7 +28,7 @@ QtWindowBase::QtWindowBase(bool isSubWindow, QWidget* parent) } m_window = new QWidget(this); - m_window->setObjectName("window"); + m_window->setObjectName(QStringLiteral("window")); QVBoxLayout* layout = new QVBoxLayout(m_window); layout->setSpacing(0); diff --git a/src/lib_gui/utility/utilityApp.cpp b/src/lib_gui/utility/utilityApp.cpp index 4c70a593..af515f00 100644 --- a/src/lib_gui/utility/utilityApp.cpp +++ b/src/lib_gui/utility/utilityApp.cpp @@ -70,7 +70,8 @@ std::pair utility::executeProcess( QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QStringList envlist = env.toStringList(); envlist.replaceInStrings( - QRegularExpression("^(?i)PATH=(.*)"), "PATH=/opt/local/bin:/usr/local/bin:$HOME/bin:\\1"); + QRegularExpression(QStringLiteral("^(?i)PATH=(.*)")), + QStringLiteral("PATH=/opt/local/bin:/usr/local/bin:$HOME/bin:\\1")); process.setEnvironment(envlist); { @@ -108,7 +109,8 @@ std::string utility::executeProcessUntilNoOutput( QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QStringList envlist = env.toStringList(); envlist.replaceInStrings( - QRegularExpression("^(?i)PATH=(.*)"), "PATH=/opt/local/bin:/usr/local/bin:$HOME/bin:\\1"); + QRegularExpression(QStringLiteral("^(?i)PATH=(.*)")), + QStringLiteral("PATH=/opt/local/bin:/usr/local/bin:$HOME/bin:\\1")); process.setEnvironment(envlist); { @@ -209,7 +211,8 @@ int utility::executeProcessAndGetExitCode( QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QStringList envlist = env.toStringList(); envlist.replaceInStrings( - QRegularExpression("^(?i)PATH=(.*)"), "PATH=/opt/local/bin:/usr/local/bin:$HOME/bin:\\1"); + QRegularExpression(QStringLiteral("^(?i)PATH=(.*)")), + QStringLiteral("PATH=/opt/local/bin:/usr/local/bin:$HOME/bin:\\1")); process.setEnvironment(envlist); {