aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/coreplugin/mainwindow.cpp
diff options
context:
space:
mode:
authorTim Jenßen <tim.jenssen@qt.io>2023-03-26 15:58:49 +0200
committerTim Jenßen <tim.jenssen@qt.io>2023-03-26 16:26:18 +0200
commitfeabda3aa78b7861ae03f1cc2296e8adf34ba038 (patch)
tree9bc06c7eeb6fca92e8cdd273908f7350260a8cb8 /src/plugins/coreplugin/mainwindow.cpp
parent359ea5d55a9452d70c20754c2380b1bf1c704c04 (diff)
parentf7639f458a4b87263e96de70f26554a660148bc3 (diff)
Merge remote-tracking branch 'origin/10.0' into qds/dev
bigger conflicts resolved at: src/plugins/qmldesigner/CMakeLists.txt src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp Change-Id: I08e2a109d8e37cbd77225129854e9e633725bfc7
Diffstat (limited to 'src/plugins/coreplugin/mainwindow.cpp')
-rw-r--r--src/plugins/coreplugin/mainwindow.cpp200
1 files changed, 97 insertions, 103 deletions
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp
index 4e9449e4bf..168fff9220 100644
--- a/src/plugins/coreplugin/mainwindow.cpp
+++ b/src/plugins/coreplugin/mainwindow.cpp
@@ -1,19 +1,33 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "mainwindow.h"
+#include "actionmanager/actioncontainer.h"
+#include "actionmanager/actionmanager.h"
+#include "actionmanager/command.h"
#include "coreicons.h"
#include "coreplugintr.h"
+#include "dialogs/externaltoolconfig.h"
+#include "dialogs/shortcutsettings.h"
#include "documentmanager.h"
+#include "editormanager/documentmodel_p.h"
+#include "editormanager/editormanager.h"
+#include "editormanager/editormanager_p.h"
+#include "editormanager/ieditor.h"
#include "editormanager/ieditorfactory.h"
#include "editormanager/systemeditor.h"
#include "externaltoolmanager.h"
#include "fancytabwidget.h"
+#include "fileutils.h"
+#include "find/basetextfind.h"
+#include "findplaceholder.h"
#include "generalsettings.h"
#include "helpmanager.h"
#include "icore.h"
#include "idocumentfactory.h"
+#include "inavigationwidgetfactory.h"
+#include "iwizardfactory.h"
#include "jsexpander.h"
#include "loggingviewer.h"
#include "manhattanstyle.h"
@@ -23,7 +37,10 @@
#include "navigationwidget.h"
#include "outputpanemanager.h"
#include "plugindialog.h"
+#include "progressmanager/progressmanager_p.h"
+#include "progressmanager/progressview.h"
#include "rightpane.h"
+#include "settingsdatabase.h"
#include "statusbarmanager.h"
#include "systemsettings.h"
#include "vcsmanager.h"
@@ -31,25 +48,9 @@
#include "windowsupport.h"
#include <app/app_version.h>
-#include <coreplugin/actionmanager/actioncontainer.h>
-#include <coreplugin/actionmanager/actionmanager.h>
-#include <coreplugin/actionmanager/actionmanager_p.h>
-#include <coreplugin/actionmanager/command.h>
-#include <coreplugin/dialogs/externaltoolconfig.h>
-#include <coreplugin/dialogs/shortcutsettings.h>
-#include <coreplugin/editormanager/documentmodel_p.h>
-#include <coreplugin/editormanager/editormanager.h>
-#include <coreplugin/editormanager/editormanager_p.h>
-#include <coreplugin/editormanager/ieditor.h>
-#include <coreplugin/fileutils.h>
-#include <coreplugin/find/basetextfind.h>
-#include <coreplugin/findplaceholder.h>
-#include <coreplugin/inavigationwidgetfactory.h>
-#include <coreplugin/iwizardfactory.h>
-#include <coreplugin/progressmanager/progressmanager_p.h>
-#include <coreplugin/progressmanager/progressview.h>
-#include <coreplugin/settingsdatabase.h>
+
#include <extensionsystem/pluginmanager.h>
+
#include <utils/algorithm.h>
#include <utils/fsengine/fileiconprovider.h>
#include <utils/fsengine/fsengine.h>
@@ -108,7 +109,6 @@ static const char askBeforeExitKey[] = "AskBeforeExit";
static const char windowGeometryKey[] = "WindowGeometry";
static const char windowStateKey[] = "WindowState";
static const char modeSelectorLayoutKey[] = "ModeSelectorLayout";
-static const char openFromDeviceDialogKey[] = "OpenFromDeviceDialog";
static const bool askBeforeExitDefault = false;
@@ -385,8 +385,8 @@ void MainWindow::closeEvent(QCloseEvent *event)
if (m_askConfirmationBeforeExit &&
(QMessageBox::question(this,
- tr("Exit %1?").arg(Constants::IDE_DISPLAY_NAME),
- tr("Exit %1?").arg(Constants::IDE_DISPLAY_NAME),
+ Tr::tr("Exit %1?").arg(Constants::IDE_DISPLAY_NAME),
+ Tr::tr("Exit %1?").arg(Constants::IDE_DISPLAY_NAME),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No)
== QMessageBox::No)) {
@@ -471,7 +471,7 @@ void MainWindow::registerDefaultContainers()
// File Menu
ActionContainer *filemenu = ActionManager::createMenu(Constants::M_FILE);
menubar->addMenu(filemenu, Constants::G_FILE);
- filemenu->menu()->setTitle(tr("&File"));
+ filemenu->menu()->setTitle(Tr::tr("&File"));
filemenu->appendGroup(Constants::G_FILE_NEW);
filemenu->appendGroup(Constants::G_FILE_OPEN);
filemenu->appendGroup(Constants::G_FILE_PROJECT);
@@ -486,7 +486,7 @@ void MainWindow::registerDefaultContainers()
// Edit Menu
ActionContainer *medit = ActionManager::createMenu(Constants::M_EDIT);
menubar->addMenu(medit, Constants::G_EDIT);
- medit->menu()->setTitle(tr("&Edit"));
+ medit->menu()->setTitle(Tr::tr("&Edit"));
medit->appendGroup(Constants::G_EDIT_UNDOREDO);
medit->appendGroup(Constants::G_EDIT_COPYPASTE);
medit->appendGroup(Constants::G_EDIT_SELECTALL);
@@ -496,7 +496,7 @@ void MainWindow::registerDefaultContainers()
ActionContainer *mview = ActionManager::createMenu(Constants::M_VIEW);
menubar->addMenu(mview, Constants::G_VIEW);
- mview->menu()->setTitle(tr("&View"));
+ mview->menu()->setTitle(Tr::tr("&View"));
mview->appendGroup(Constants::G_VIEW_VIEWS);
mview->appendGroup(Constants::G_VIEW_PANES);
@@ -506,12 +506,12 @@ void MainWindow::registerDefaultContainers()
if (!hideToolsMenu())
menubar->addMenu(ac, Constants::G_TOOLS);
- ac->menu()->setTitle(tr("&Tools"));
+ ac->menu()->setTitle(Tr::tr("&Tools"));
// Window Menu
ActionContainer *mwindow = ActionManager::createMenu(Constants::M_WINDOW);
menubar->addMenu(mwindow, Constants::G_WINDOW);
- mwindow->menu()->setTitle(tr("&Window"));
+ mwindow->menu()->setTitle(Tr::tr("&Window"));
mwindow->appendGroup(Constants::G_WINDOW_SIZE);
mwindow->appendGroup(Constants::G_WINDOW_SPLIT);
mwindow->appendGroup(Constants::G_WINDOW_NAVIGATE);
@@ -521,7 +521,7 @@ void MainWindow::registerDefaultContainers()
// Help Menu
ac = ActionManager::createMenu(Constants::M_HELP);
menubar->addMenu(ac, Constants::G_HELP);
- ac->menu()->setTitle(tr("&Help"));
+ ac->menu()->setTitle(Tr::tr("&Help"));
Theme::setHelpMenu(ac->menu());
ac->appendGroup(Constants::G_HELP_HELP);
ac->appendGroup(Constants::G_HELP_SUPPORT);
@@ -562,7 +562,7 @@ void MainWindow::registerDefaultActions()
// Return to editor shortcut: Note this requires Qt to fix up
// handling of shortcut overrides in menus, item views, combos....
- m_focusToEditor = new QAction(tr("Return to Editor"), this);
+ m_focusToEditor = new QAction(Tr::tr("Return to Editor"), this);
Command *cmd = ActionManager::registerAction(m_focusToEditor, Constants::S_RETURNTOEDITOR);
cmd->setDefaultKeySequence(QKeySequence(Qt::Key_Escape));
connect(m_focusToEditor, &QAction::triggered, this, &MainWindow::setFocusToEditor);
@@ -570,14 +570,14 @@ void MainWindow::registerDefaultActions()
// New File Action
QIcon icon = QIcon::fromTheme(QLatin1String("document-new"), Utils::Icons::NEWFILE.icon());
- m_newAction = new QAction(icon, tr("&New Project..."), this);
+ m_newAction = new QAction(icon, Tr::tr("&New Project..."), this);
cmd = ActionManager::registerAction(m_newAction, Constants::NEW);
cmd->setDefaultKeySequence(QKeySequence("Ctrl+Shift+N"));
mfile->addAction(cmd, Constants::G_FILE_NEW);
- connect(m_newAction, &QAction::triggered, this, []() {
+ connect(m_newAction, &QAction::triggered, this, [] {
if (!ICore::isNewItemDialogRunning()) {
ICore::showNewItemDialog(
- tr("New Project", "Title of dialog"),
+ Tr::tr("New Project", "Title of dialog"),
Utils::filtered(Core::IWizardFactory::allWizardFactories(),
Utils::equal(&Core::IWizardFactory::kind,
Core::IWizardFactory::ProjectWizard)),
@@ -587,13 +587,13 @@ void MainWindow::registerDefaultActions()
}
});
- auto action = new QAction(icon, tr("New File..."), this);
+ auto action = new QAction(icon, Tr::tr("New File..."), this);
cmd = ActionManager::registerAction(action, Constants::NEW_FILE);
cmd->setDefaultKeySequence(QKeySequence::New);
mfile->addAction(cmd, Constants::G_FILE_NEW);
- connect(action, &QAction::triggered, this, []() {
+ connect(action, &QAction::triggered, this, [] {
if (!ICore::isNewItemDialogRunning()) {
- ICore::showNewItemDialog(tr("New File", "Title of dialog"),
+ ICore::showNewItemDialog(Tr::tr("New File", "Title of dialog"),
Utils::filtered(Core::IWizardFactory::allWizardFactories(),
Utils::equal(&Core::IWizardFactory::kind,
Core::IWizardFactory::FileWizard)),
@@ -605,14 +605,14 @@ void MainWindow::registerDefaultActions()
// Open Action
icon = QIcon::fromTheme(QLatin1String("document-open"), Utils::Icons::OPENFILE.icon());
- m_openAction = new QAction(icon, tr("&Open File or Project..."), this);
+ m_openAction = new QAction(icon, Tr::tr("&Open File or Project..."), this);
cmd = ActionManager::registerAction(m_openAction, Constants::OPEN);
cmd->setDefaultKeySequence(QKeySequence::Open);
mfile->addAction(cmd, Constants::G_FILE_OPEN);
connect(m_openAction, &QAction::triggered, this, &MainWindow::openFile);
// Open With Action
- m_openWithAction = new QAction(tr("Open File &With..."), this);
+ m_openWithAction = new QAction(Tr::tr("Open File &With..."), this);
cmd = ActionManager::registerAction(m_openWithAction, Constants::OPEN_WITH);
mfile->addAction(cmd, Constants::G_FILE_OPEN);
connect(m_openWithAction, &QAction::triggered, this, &MainWindow::openFileWith);
@@ -628,27 +628,27 @@ void MainWindow::registerDefaultActions()
// File->Recent Files Menu
ActionContainer *ac = ActionManager::createMenu(Constants::M_FILE_RECENTFILES);
mfile->addMenu(ac, Constants::G_FILE_OPEN);
- ac->menu()->setTitle(tr("Recent &Files"));
+ ac->menu()->setTitle(Tr::tr("Recent &Files"));
ac->setOnAllDisabledBehavior(ActionContainer::Show);
// Save Action
icon = QIcon::fromTheme(QLatin1String("document-save"), Utils::Icons::SAVEFILE.icon());
- QAction *tmpaction = new QAction(icon, EditorManager::tr("&Save"), this);
+ QAction *tmpaction = new QAction(icon, Tr::tr("&Save"), this);
tmpaction->setEnabled(false);
cmd = ActionManager::registerAction(tmpaction, Constants::SAVE);
cmd->setDefaultKeySequence(QKeySequence::Save);
cmd->setAttribute(Command::CA_UpdateText);
- cmd->setDescription(tr("Save"));
+ cmd->setDescription(Tr::tr("Save"));
mfile->addAction(cmd, Constants::G_FILE_SAVE);
// Save As Action
icon = QIcon::fromTheme(QLatin1String("document-save-as"));
- tmpaction = new QAction(icon, EditorManager::tr("Save &As..."), this);
+ tmpaction = new QAction(icon, Tr::tr("Save &As..."), this);
tmpaction->setEnabled(false);
cmd = ActionManager::registerAction(tmpaction, Constants::SAVEAS);
- cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Ctrl+Shift+S") : QString()));
+ cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Ctrl+Shift+S") : QString()));
cmd->setAttribute(Command::CA_UpdateText);
- cmd->setDescription(tr("Save As..."));
+ cmd->setDescription(Tr::tr("Save As..."));
mfile->addAction(cmd, Constants::G_FILE_SAVE);
// SaveAll Action
@@ -656,7 +656,7 @@ void MainWindow::registerDefaultActions()
// Print Action
icon = QIcon::fromTheme(QLatin1String("document-print"));
- tmpaction = new QAction(icon, tr("&Print..."), this);
+ tmpaction = new QAction(icon, Tr::tr("&Print..."), this);
tmpaction->setEnabled(false);
cmd = ActionManager::registerAction(tmpaction, Constants::PRINT);
cmd->setDefaultKeySequence(QKeySequence::Print);
@@ -664,36 +664,36 @@ void MainWindow::registerDefaultActions()
// Exit Action
icon = QIcon::fromTheme(QLatin1String("application-exit"));
- m_exitAction = new QAction(icon, tr("E&xit"), this);
+ m_exitAction = new QAction(icon, Tr::tr("E&xit"), this);
m_exitAction->setMenuRole(QAction::QuitRole);
cmd = ActionManager::registerAction(m_exitAction, Constants::EXIT);
- cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Q")));
+ cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Q")));
mfile->addAction(cmd, Constants::G_FILE_OTHER);
connect(m_exitAction, &QAction::triggered, this, &MainWindow::exit);
// Undo Action
icon = QIcon::fromTheme(QLatin1String("edit-undo"), Utils::Icons::UNDO.icon());
- tmpaction = new QAction(icon, tr("&Undo"), this);
+ tmpaction = new QAction(icon, Tr::tr("&Undo"), this);
cmd = ActionManager::registerAction(tmpaction, Constants::UNDO);
cmd->setDefaultKeySequence(QKeySequence::Undo);
cmd->setAttribute(Command::CA_UpdateText);
- cmd->setDescription(tr("Undo"));
+ cmd->setDescription(Tr::tr("Undo"));
medit->addAction(cmd, Constants::G_EDIT_UNDOREDO);
tmpaction->setEnabled(false);
// Redo Action
icon = QIcon::fromTheme(QLatin1String("edit-redo"), Utils::Icons::REDO.icon());
- tmpaction = new QAction(icon, tr("&Redo"), this);
+ tmpaction = new QAction(icon, Tr::tr("&Redo"), this);
cmd = ActionManager::registerAction(tmpaction, Constants::REDO);
cmd->setDefaultKeySequence(QKeySequence::Redo);
cmd->setAttribute(Command::CA_UpdateText);
- cmd->setDescription(tr("Redo"));
+ cmd->setDescription(Tr::tr("Redo"));
medit->addAction(cmd, Constants::G_EDIT_UNDOREDO);
tmpaction->setEnabled(false);
// Cut Action
icon = QIcon::fromTheme(QLatin1String("edit-cut"), Utils::Icons::CUT.icon());
- tmpaction = new QAction(icon, tr("Cu&t"), this);
+ tmpaction = new QAction(icon, Tr::tr("Cu&t"), this);
cmd = ActionManager::registerAction(tmpaction, Constants::CUT);
cmd->setDefaultKeySequence(QKeySequence::Cut);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
@@ -701,7 +701,7 @@ void MainWindow::registerDefaultActions()
// Copy Action
icon = QIcon::fromTheme(QLatin1String("edit-copy"), Utils::Icons::COPY.icon());
- tmpaction = new QAction(icon, tr("&Copy"), this);
+ tmpaction = new QAction(icon, Tr::tr("&Copy"), this);
cmd = ActionManager::registerAction(tmpaction, Constants::COPY);
cmd->setDefaultKeySequence(QKeySequence::Copy);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
@@ -709,7 +709,7 @@ void MainWindow::registerDefaultActions()
// Paste Action
icon = QIcon::fromTheme(QLatin1String("edit-paste"), Utils::Icons::PASTE.icon());
- tmpaction = new QAction(icon, tr("&Paste"), this);
+ tmpaction = new QAction(icon, Tr::tr("&Paste"), this);
cmd = ActionManager::registerAction(tmpaction, Constants::PASTE);
cmd->setDefaultKeySequence(QKeySequence::Paste);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
@@ -717,7 +717,7 @@ void MainWindow::registerDefaultActions()
// Select All
icon = QIcon::fromTheme(QLatin1String("edit-select-all"));
- tmpaction = new QAction(icon, tr("Select &All"), this);
+ tmpaction = new QAction(icon, Tr::tr("Select &All"), this);
cmd = ActionManager::registerAction(tmpaction, Constants::SELECTALL);
cmd->setDefaultKeySequence(QKeySequence::SelectAll);
medit->addAction(cmd, Constants::G_EDIT_SELECTALL);
@@ -725,46 +725,46 @@ void MainWindow::registerDefaultActions()
// Goto Action
icon = QIcon::fromTheme(QLatin1String("go-jump"));
- tmpaction = new QAction(icon, tr("&Go to Line..."), this);
+ tmpaction = new QAction(icon, Tr::tr("&Go to Line..."), this);
cmd = ActionManager::registerAction(tmpaction, Constants::GOTO);
- cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+L")));
+ cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+L")));
medit->addAction(cmd, Constants::G_EDIT_OTHER);
tmpaction->setEnabled(false);
// Zoom In Action
icon = QIcon::hasThemeIcon("zoom-in") ? QIcon::fromTheme("zoom-in")
: Utils::Icons::ZOOMIN_TOOLBAR.icon();
- tmpaction = new QAction(icon, tr("Zoom In"), this);
+ tmpaction = new QAction(icon, Tr::tr("Zoom In"), this);
cmd = ActionManager::registerAction(tmpaction, Constants::ZOOM_IN);
- cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl++")));
+ cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl++")));
tmpaction->setEnabled(false);
// Zoom Out Action
icon = QIcon::hasThemeIcon("zoom-out") ? QIcon::fromTheme("zoom-out")
: Utils::Icons::ZOOMOUT_TOOLBAR.icon();
- tmpaction = new QAction(icon, tr("Zoom Out"), this);
+ tmpaction = new QAction(icon, Tr::tr("Zoom Out"), this);
cmd = ActionManager::registerAction(tmpaction, Constants::ZOOM_OUT);
if (useMacShortcuts)
- cmd->setDefaultKeySequences({QKeySequence(tr("Ctrl+-")), QKeySequence(tr("Ctrl+Shift+-"))});
+ cmd->setDefaultKeySequences({QKeySequence(Tr::tr("Ctrl+-")), QKeySequence(Tr::tr("Ctrl+Shift+-"))});
else
- cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+-")));
+ cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+-")));
tmpaction->setEnabled(false);
// Zoom Reset Action
icon = QIcon::hasThemeIcon("zoom-original") ? QIcon::fromTheme("zoom-original")
: Utils::Icons::EYE_OPEN_TOOLBAR.icon();
- tmpaction = new QAction(icon, tr("Original Size"), this);
+ tmpaction = new QAction(icon, Tr::tr("Original Size"), this);
cmd = ActionManager::registerAction(tmpaction, Constants::ZOOM_RESET);
- cmd->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+0") : tr("Ctrl+0")));
+ cmd->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+0") : Tr::tr("Ctrl+0")));
tmpaction->setEnabled(false);
// Debug Qt Creator menu
mtools->appendGroup(Constants::G_TOOLS_DEBUG);
ActionContainer *mtoolsdebug = ActionManager::createMenu(Constants::M_TOOLS_DEBUG);
- mtoolsdebug->menu()->setTitle(tr("Debug %1").arg(Constants::IDE_DISPLAY_NAME));
+ mtoolsdebug->menu()->setTitle(Tr::tr("Debug %1").arg(Constants::IDE_DISPLAY_NAME));
mtools->addMenu(mtoolsdebug, Constants::G_TOOLS_DEBUG);
- m_loggerAction = new QAction(tr("Show Logs..."), this);
+ m_loggerAction = new QAction(Tr::tr("Show Logs..."), this);
cmd = ActionManager::registerAction(m_loggerAction, Constants::LOGGER);
mtoolsdebug->addAction(cmd);
connect(m_loggerAction, &QAction::triggered, this, [] { LoggingViewer::showLoggingView(); });
@@ -773,7 +773,7 @@ void MainWindow::registerDefaultActions()
medit->appendGroup(Constants::G_EDIT_PREFERENCES);
medit->addSeparator(Constants::G_EDIT_PREFERENCES);
- m_optionsAction = new QAction(tr("Pr&eferences..."), this);
+ m_optionsAction = new QAction(Tr::tr("Pr&eferences..."), this);
m_optionsAction->setMenuRole(QAction::PreferencesRole);
cmd = ActionManager::registerAction(m_optionsAction, Constants::OPTIONS);
cmd->setDefaultKeySequence(QKeySequence::Preferences);
@@ -784,25 +784,25 @@ void MainWindow::registerDefaultActions()
if (useMacShortcuts) {
// Minimize Action
- QAction *minimizeAction = new QAction(tr("Minimize"), this);
+ QAction *minimizeAction = new QAction(Tr::tr("Minimize"), this);
minimizeAction->setEnabled(false); // actual implementation in WindowSupport
cmd = ActionManager::registerAction(minimizeAction, Constants::MINIMIZE_WINDOW);
- cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M")));
+ cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+M")));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
// Zoom Action
- QAction *zoomAction = new QAction(tr("Zoom"), this);
+ QAction *zoomAction = new QAction(Tr::tr("Zoom"), this);
zoomAction->setEnabled(false); // actual implementation in WindowSupport
cmd = ActionManager::registerAction(zoomAction, Constants::ZOOM_WINDOW);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
}
// Full Screen Action
- QAction *toggleFullScreenAction = new QAction(tr("Full Screen"), this);
+ QAction *toggleFullScreenAction = new QAction(Tr::tr("Full Screen"), this);
toggleFullScreenAction->setCheckable(!HostOsInfo::isMacHost());
toggleFullScreenAction->setEnabled(false); // actual implementation in WindowSupport
cmd = ActionManager::registerAction(toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN);
- cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11")));
+ cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Ctrl+Meta+F") : Tr::tr("Ctrl+Shift+F11")));
if (HostOsInfo::isMacHost())
cmd->setAttribute(Command::CA_UpdateText);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
@@ -810,10 +810,10 @@ void MainWindow::registerDefaultActions()
if (useMacShortcuts) {
mwindow->addSeparator(Constants::G_WINDOW_SIZE);
- QAction *closeAction = new QAction(tr("Close Window"), this);
+ QAction *closeAction = new QAction(Tr::tr("Close Window"), this);
closeAction->setEnabled(false);
cmd = ActionManager::registerAction(closeAction, Constants::CLOSE_WINDOW);
- cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Meta+W")));
+ cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Meta+W")));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
mwindow->addSeparator(Constants::G_WINDOW_SIZE);
@@ -826,7 +826,7 @@ void MainWindow::registerDefaultActions()
m_toggleLeftSideBarAction->setCheckable(true);
cmd = ActionManager::registerAction(m_toggleLeftSideBarAction, Constants::TOGGLE_LEFT_SIDEBAR);
cmd->setAttribute(Command::CA_UpdateText);
- cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Ctrl+0") : tr("Alt+0")));
+ cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Ctrl+0") : Tr::tr("Alt+0")));
connect(m_toggleLeftSideBarAction, &QAction::triggered,
this, [this](bool visible) { setSidebarVisible(visible, Side::Left); });
ProxyAction *toggleLeftSideBarProxyAction =
@@ -842,7 +842,7 @@ void MainWindow::registerDefaultActions()
m_toggleRightSideBarAction->setCheckable(true);
cmd = ActionManager::registerAction(m_toggleRightSideBarAction, Constants::TOGGLE_RIGHT_SIDEBAR);
cmd->setAttribute(Command::CA_UpdateText);
- cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Ctrl+Shift+0") : tr("Alt+Shift+0")));
+ cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Ctrl+Shift+0") : Tr::tr("Alt+Shift+0")));
connect(m_toggleRightSideBarAction, &QAction::triggered,
this, [this](bool visible) { setSidebarVisible(visible, Side::Right); });
ProxyAction *toggleRightSideBarProxyAction =
@@ -856,7 +856,7 @@ void MainWindow::registerDefaultActions()
// Window->Views
ActionContainer *mviews = ActionManager::createMenu(Constants::M_VIEW_VIEWS);
mview->addMenu(mviews, Constants::G_VIEW_VIEWS);
- mviews->menu()->setTitle(tr("&Views"));
+ mviews->menu()->setTitle(Tr::tr("&Views"));
// "Help" separators
mhelp->addSeparator(Constants::G_HELP_SUPPORT);
@@ -866,9 +866,9 @@ void MainWindow::registerDefaultActions()
// About IDE Action
icon = QIcon::fromTheme(QLatin1String("help-about"));
if (HostOsInfo::isMacHost())
- tmpaction = new QAction(icon, tr("About &%1").arg(Constants::IDE_DISPLAY_NAME), this); // it's convention not to add dots to the about menu
+ tmpaction = new QAction(icon, Tr::tr("About &%1").arg(Constants::IDE_DISPLAY_NAME), this); // it's convention not to add dots to the about menu
else
- tmpaction = new QAction(icon, tr("About &%1...").arg(Constants::IDE_DISPLAY_NAME), this);
+ tmpaction = new QAction(icon, Tr::tr("About &%1...").arg(Constants::IDE_DISPLAY_NAME), this);
tmpaction->setMenuRole(QAction::AboutRole);
cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_QTCREATOR);
mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
@@ -876,21 +876,21 @@ void MainWindow::registerDefaultActions()
connect(tmpaction, &QAction::triggered, this, &MainWindow::aboutQtCreator);
//About Plugins Action
- tmpaction = new QAction(tr("About &Plugins..."), this);
+ tmpaction = new QAction(Tr::tr("About &Plugins..."), this);
tmpaction->setMenuRole(QAction::ApplicationSpecificRole);
cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_PLUGINS);
mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
tmpaction->setEnabled(true);
connect(tmpaction, &QAction::triggered, this, &MainWindow::aboutPlugins);
// About Qt Action
- // tmpaction = new QAction(tr("About &Qt..."), this);
+ // tmpaction = new QAction(Tr::tr("About &Qt..."), this);
// cmd = ActionManager::registerAction(tmpaction, Constants:: ABOUT_QT);
// mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
// tmpaction->setEnabled(true);
// connect(tmpaction, &QAction::triggered, qApp, &QApplication::aboutQt);
// Change Log Action
- tmpaction = new QAction(tr("Change Log..."), this);
+ tmpaction = new QAction(Tr::tr("Change Log..."), this);
tmpaction->setMenuRole(QAction::ApplicationSpecificRole);
cmd = ActionManager::registerAction(tmpaction, Constants::CHANGE_LOG);
mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
@@ -898,7 +898,7 @@ void MainWindow::registerDefaultActions()
connect(tmpaction, &QAction::triggered, this, &MainWindow::changeLog);
// Contact
- tmpaction = new QAction(tr("Contact..."), this);
+ tmpaction = new QAction(Tr::tr("Contact..."), this);
cmd = ActionManager::registerAction(tmpaction, "QtCreator.Contact");
mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
tmpaction->setEnabled(true);
@@ -918,7 +918,7 @@ void MainWindow::registerModeSelectorStyleActions()
ActionContainer *mview = ActionManager::actionContainer(Constants::M_VIEW);
// Cycle Mode Selector Styles
- m_cycleModeSelectorStyleAction = new QAction(tr("Cycle Mode Selector Styles"), this);
+ m_cycleModeSelectorStyleAction = new QAction(Tr::tr("Cycle Mode Selector Styles"), this);
ActionManager::registerAction(m_cycleModeSelectorStyleAction, Constants::CYCLE_MODE_SELECTOR_STYLE);
connect(m_cycleModeSelectorStyleAction, &QAction::triggered, this, [this] {
ModeManager::cycleModeStyle();
@@ -929,19 +929,19 @@ void MainWindow::registerModeSelectorStyleActions()
ActionContainer *mmodeLayouts = ActionManager::createMenu(Constants::M_VIEW_MODESTYLES);
mview->addMenu(mmodeLayouts, Constants::G_VIEW_VIEWS);
QMenu *styleMenu = mmodeLayouts->menu();
- styleMenu->setTitle(tr("Mode Selector Style"));
+ styleMenu->setTitle(Tr::tr("Mode Selector Style"));
auto *stylesGroup = new QActionGroup(styleMenu);
stylesGroup->setExclusive(true);
- m_setModeSelectorStyleIconsAndTextAction = stylesGroup->addAction(tr("Icons and Text"));
+ m_setModeSelectorStyleIconsAndTextAction = stylesGroup->addAction(Tr::tr("Icons and Text"));
connect(m_setModeSelectorStyleIconsAndTextAction, &QAction::triggered,
[] { ModeManager::setModeStyle(ModeManager::Style::IconsAndText); });
m_setModeSelectorStyleIconsAndTextAction->setCheckable(true);
- m_setModeSelectorStyleIconsOnlyAction = stylesGroup->addAction(tr("Icons Only"));
+ m_setModeSelectorStyleIconsOnlyAction = stylesGroup->addAction(Tr::tr("Icons Only"));
connect(m_setModeSelectorStyleIconsOnlyAction, &QAction::triggered,
[] { ModeManager::setModeStyle(ModeManager::Style::IconsOnly); });
m_setModeSelectorStyleIconsOnlyAction->setCheckable(true);
- m_setModeSelectorStyleHiddenAction = stylesGroup->addAction(tr("Hidden"));
+ m_setModeSelectorStyleHiddenAction = stylesGroup->addAction(Tr::tr("Hidden"));
connect(m_setModeSelectorStyleHiddenAction, &QAction::triggered,
[] { ModeManager::setModeStyle(ModeManager::Style::Hidden); });
m_setModeSelectorStyleHiddenAction->setCheckable(true);
@@ -981,21 +981,15 @@ static IDocumentFactory *findDocumentFactory(const QList<IDocumentFactory*> &fil
*/
IDocument *MainWindow::openFiles(const FilePaths &filePaths,
ICore::OpenFilesFlags flags,
- const QString &workingDirectory)
+ const FilePath &workingDirectory)
{
const QList<IDocumentFactory*> documentFactories = IDocumentFactory::allDocumentFactories();
IDocument *res = nullptr;
- const QString workingDirBase = workingDirectory.isEmpty() ? QDir::currentPath() : workingDirectory;
+ const FilePath workingDirBase =
+ workingDirectory.isEmpty() ? FilePath::currentWorkingPath() : workingDirectory;
for (const FilePath &filePath : filePaths) {
- const FilePath workingDir = filePath.withNewPath(workingDirBase);
- FilePath absoluteFilePath;
- if (filePath.isAbsolutePath()) {
- absoluteFilePath = filePath;
- } else {
- QTC_CHECK(!filePath.needsDevice());
- absoluteFilePath = FilePath::fromString(workingDirBase).resolvePath(filePath.path());
- }
+ const FilePath absoluteFilePath = workingDirBase.resolvePath(filePath);
if (IDocumentFactory *documentFactory = findDocumentFactory(documentFactories, filePath)) {
IDocument *document = documentFactory->open(absoluteFilePath);
if (!document) {
@@ -1014,7 +1008,7 @@ IDocument *MainWindow::openFiles(const FilePaths &filePaths,
emFlags |= EditorManager::SwitchSplitIfAlreadyVisible;
IEditor *editor = nullptr;
if (flags & ICore::CanContainLineAndColumnNumbers) {
- const Link &link = Link::fromFilePath(absoluteFilePath, true);
+ const Link &link = Link::fromString(absoluteFilePath.toString(), true);
editor = EditorManager::openEditorAt(link, {}, emFlags);
} else {
editor = EditorManager::openEditor(absoluteFilePath, {}, emFlags);
@@ -1478,7 +1472,7 @@ void MainWindow::changeLog()
versionCombo->addItem(f.first.toString());
dialog = new LogDialog(ICore::dialogParent());
auto versionLayout = new QHBoxLayout;
- versionLayout->addWidget(new QLabel(tr("Version:")));
+ versionLayout->addWidget(new QLabel(Tr::tr("Version:")));
versionLayout->addWidget(versionCombo);
versionLayout->addStretch(1);
auto showInExplorer = new QPushButton(FileUtils::msgGraphicalShellAction());
@@ -1510,7 +1504,7 @@ void MainWindow::changeLog()
dialogLayout->addWidget(buttonBox);
dialog->setLayout(dialogLayout);
dialog->resize(700, 600);
- dialog->setWindowTitle(tr("Change Log"));
+ dialog->setWindowTitle(Tr::tr("Change Log"));
dialog->setAttribute(Qt::WA_DeleteOnClose);
ICore::registerWindow(dialog, Context("CorePlugin.VersionDialog"));
@@ -1540,7 +1534,7 @@ void MainWindow::changeLog()
connect(versionCombo, &QComboBox::currentIndexChanged, textEdit, showLog);
showLog(versionCombo->currentIndex());
- connect(showInExplorer, &QPushButton::clicked, [versionCombo, versionedFiles] {
+ connect(showInExplorer, &QPushButton::clicked, this, [versionCombo, versionedFiles] {
const int index = versionCombo->currentIndex();
if (index >= 0 && index < versionedFiles.size())
FileUtils::showInGraphicalShell(ICore::dialogParent(), versionedFiles.at(index).second);
@@ -1553,8 +1547,8 @@ void MainWindow::changeLog()
void MainWindow::contact()
{
- QMessageBox dlg(QMessageBox::Information, tr("Contact"),
- tr("<p>Qt Creator developers can be reached at the Qt Creator mailing list:</p>"
+ QMessageBox dlg(QMessageBox::Information, Tr::tr("Contact"),
+ Tr::tr("<p>Qt Creator developers can be reached at the Qt Creator mailing list:</p>"
"%1"
"<p>or the #qt-creator channel on Libera.Chat IRC:</p>"
"%2"