forked from qt-creator/qt-creator
CorePlugin: Pass context object to lambda connections
Remove some unneeded lambda () brackets. Change-Id: Id664cfc3b46685f63fb205beaf16a7c271ad95d9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -525,10 +525,10 @@ QAction *Command::touchBarAction() const
|
|||||||
void Command::augmentActionWithShortcutToolTip(QAction *a) const
|
void Command::augmentActionWithShortcutToolTip(QAction *a) const
|
||||||
{
|
{
|
||||||
a->setToolTip(stringWithAppendedShortcut(a->text()));
|
a->setToolTip(stringWithAppendedShortcut(a->text()));
|
||||||
QObject::connect(this, &Command::keySequenceChanged, a, [this, a]() {
|
QObject::connect(this, &Command::keySequenceChanged, a, [this, a] {
|
||||||
a->setToolTip(stringWithAppendedShortcut(a->text()));
|
a->setToolTip(stringWithAppendedShortcut(a->text()));
|
||||||
});
|
});
|
||||||
QObject::connect(a, &QAction::changed, this, [this, a]() {
|
QObject::connect(a, &QAction::changed, this, [this, a] {
|
||||||
a->setToolTip(stringWithAppendedShortcut(a->text()));
|
a->setToolTip(stringWithAppendedShortcut(a->text()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -171,52 +171,52 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
|
|
||||||
MacroExpander *expander = Utils::globalMacroExpander();
|
MacroExpander *expander = Utils::globalMacroExpander();
|
||||||
expander->registerVariable("CurrentDate:ISO", tr("The current date (ISO)."),
|
expander->registerVariable("CurrentDate:ISO", tr("The current date (ISO)."),
|
||||||
[]() { return QDate::currentDate().toString(Qt::ISODate); });
|
[] { return QDate::currentDate().toString(Qt::ISODate); });
|
||||||
expander->registerVariable("CurrentTime:ISO", tr("The current time (ISO)."),
|
expander->registerVariable("CurrentTime:ISO", tr("The current time (ISO)."),
|
||||||
[]() { return QTime::currentTime().toString(Qt::ISODate); });
|
[] { return QTime::currentTime().toString(Qt::ISODate); });
|
||||||
expander->registerVariable("CurrentDate:RFC", tr("The current date (RFC2822)."),
|
expander->registerVariable("CurrentDate:RFC", tr("The current date (RFC2822)."),
|
||||||
[]() { return QDate::currentDate().toString(Qt::RFC2822Date); });
|
[] { return QDate::currentDate().toString(Qt::RFC2822Date); });
|
||||||
expander->registerVariable("CurrentTime:RFC", tr("The current time (RFC2822)."),
|
expander->registerVariable("CurrentTime:RFC", tr("The current time (RFC2822)."),
|
||||||
[]() { return QTime::currentTime().toString(Qt::RFC2822Date); });
|
[] { return QTime::currentTime().toString(Qt::RFC2822Date); });
|
||||||
expander->registerVariable("CurrentDate:Locale", tr("The current date (Locale)."),
|
expander->registerVariable("CurrentDate:Locale", tr("The current date (Locale)."),
|
||||||
[]() { return QLocale::system()
|
[] { return QLocale::system()
|
||||||
.toString(QDate::currentDate(), QLocale::ShortFormat); });
|
.toString(QDate::currentDate(), QLocale::ShortFormat); });
|
||||||
expander->registerVariable("CurrentTime:Locale", tr("The current time (Locale)."),
|
expander->registerVariable("CurrentTime:Locale", tr("The current time (Locale)."),
|
||||||
[]() { return QLocale::system()
|
[] { return QLocale::system()
|
||||||
.toString(QTime::currentTime(), QLocale::ShortFormat); });
|
.toString(QTime::currentTime(), QLocale::ShortFormat); });
|
||||||
expander->registerVariable("Config:DefaultProjectDirectory", tr("The configured default directory for projects."),
|
expander->registerVariable("Config:DefaultProjectDirectory", tr("The configured default directory for projects."),
|
||||||
[]() { return DocumentManager::projectsDirectory().toString(); });
|
[] { return DocumentManager::projectsDirectory().toString(); });
|
||||||
expander->registerVariable("Config:LastFileDialogDirectory", tr("The directory last visited in a file dialog."),
|
expander->registerVariable("Config:LastFileDialogDirectory", tr("The directory last visited in a file dialog."),
|
||||||
[]() { return DocumentManager::fileDialogLastVisitedDirectory().toString(); });
|
[] { return DocumentManager::fileDialogLastVisitedDirectory().toString(); });
|
||||||
expander->registerVariable("HostOs:isWindows",
|
expander->registerVariable("HostOs:isWindows",
|
||||||
tr("Is %1 running on Windows?").arg(Constants::IDE_DISPLAY_NAME),
|
tr("Is %1 running on Windows?").arg(Constants::IDE_DISPLAY_NAME),
|
||||||
[]() { return QVariant(Utils::HostOsInfo::isWindowsHost()).toString(); });
|
[] { return QVariant(Utils::HostOsInfo::isWindowsHost()).toString(); });
|
||||||
expander->registerVariable("HostOs:isOSX",
|
expander->registerVariable("HostOs:isOSX",
|
||||||
tr("Is %1 running on OS X?").arg(Constants::IDE_DISPLAY_NAME),
|
tr("Is %1 running on OS X?").arg(Constants::IDE_DISPLAY_NAME),
|
||||||
[]() { return QVariant(Utils::HostOsInfo::isMacHost()).toString(); });
|
[] { return QVariant(Utils::HostOsInfo::isMacHost()).toString(); });
|
||||||
expander->registerVariable("HostOs:isLinux",
|
expander->registerVariable("HostOs:isLinux",
|
||||||
tr("Is %1 running on Linux?").arg(Constants::IDE_DISPLAY_NAME),
|
tr("Is %1 running on Linux?").arg(Constants::IDE_DISPLAY_NAME),
|
||||||
[]() { return QVariant(Utils::HostOsInfo::isLinuxHost()).toString(); });
|
[] { return QVariant(Utils::HostOsInfo::isLinuxHost()).toString(); });
|
||||||
expander->registerVariable("HostOs:isUnix",
|
expander->registerVariable("HostOs:isUnix",
|
||||||
tr("Is %1 running on any unix-based platform?")
|
tr("Is %1 running on any unix-based platform?")
|
||||||
.arg(Constants::IDE_DISPLAY_NAME),
|
.arg(Constants::IDE_DISPLAY_NAME),
|
||||||
[]() { return QVariant(Utils::HostOsInfo::isAnyUnixHost()).toString(); });
|
[] { return QVariant(Utils::HostOsInfo::isAnyUnixHost()).toString(); });
|
||||||
expander->registerVariable("HostOs:PathListSeparator",
|
expander->registerVariable("HostOs:PathListSeparator",
|
||||||
tr("The path list separator for the platform."),
|
tr("The path list separator for the platform."),
|
||||||
[]() { return QString(Utils::HostOsInfo::pathListSeparator()); });
|
[] { return QString(Utils::HostOsInfo::pathListSeparator()); });
|
||||||
expander->registerVariable("HostOs:ExecutableSuffix",
|
expander->registerVariable("HostOs:ExecutableSuffix",
|
||||||
tr("The platform executable suffix."),
|
tr("The platform executable suffix."),
|
||||||
[]() { return QString(Utils::HostOsInfo::withExecutableSuffix("")); });
|
[] { return QString(Utils::HostOsInfo::withExecutableSuffix("")); });
|
||||||
expander->registerVariable("IDE:ResourcePath",
|
expander->registerVariable("IDE:ResourcePath",
|
||||||
tr("The directory where %1 finds its pre-installed resources.")
|
tr("The directory where %1 finds its pre-installed resources.")
|
||||||
.arg(Constants::IDE_DISPLAY_NAME),
|
.arg(Constants::IDE_DISPLAY_NAME),
|
||||||
[]() { return ICore::resourcePath().toString(); });
|
[] { return ICore::resourcePath().toString(); });
|
||||||
expander->registerPrefix("CurrentDate:", tr("The current date (QDate formatstring)."),
|
expander->registerPrefix("CurrentDate:", tr("The current date (QDate formatstring)."),
|
||||||
[](const QString &fmt) { return QDate::currentDate().toString(fmt); });
|
[](const QString &fmt) { return QDate::currentDate().toString(fmt); });
|
||||||
expander->registerPrefix("CurrentTime:", tr("The current time (QTime formatstring)."),
|
expander->registerPrefix("CurrentTime:", tr("The current time (QTime formatstring)."),
|
||||||
[](const QString &fmt) { return QTime::currentTime().toString(fmt); });
|
[](const QString &fmt) { return QTime::currentTime().toString(fmt); });
|
||||||
expander->registerVariable("UUID", tr("Generate a new UUID."),
|
expander->registerVariable("UUID", tr("Generate a new UUID."),
|
||||||
[]() { return QUuid::createUuid().toString(); });
|
[] { return QUuid::createUuid().toString(); });
|
||||||
|
|
||||||
expander->registerPrefix("#:", tr("A comment."), [](const QString &) { return QString(); });
|
expander->registerPrefix("#:", tr("A comment."), [](const QString &) { return QString(); });
|
||||||
|
|
||||||
@@ -264,7 +264,7 @@ static void registerActionsForOptions()
|
|||||||
const QString actionTitle = Tr::tr("%1 > %2 Preferences...")
|
const QString actionTitle = Tr::tr("%1 > %2 Preferences...")
|
||||||
.arg(categoryDisplay.value(page->category()), page->displayName());
|
.arg(categoryDisplay.value(page->category()), page->displayName());
|
||||||
auto action = new QAction(actionTitle, m_instance);
|
auto action = new QAction(actionTitle, m_instance);
|
||||||
QObject::connect(action, &QAction::triggered, m_instance, [id = page->id()]() {
|
QObject::connect(action, &QAction::triggered, m_instance, [id = page->id()] {
|
||||||
ICore::showOptionsDialog(id);
|
ICore::showOptionsDialog(id);
|
||||||
});
|
});
|
||||||
ActionManager::registerAction(action, commandId);
|
ActionManager::registerAction(action, commandId);
|
||||||
@@ -299,10 +299,9 @@ QObject *CorePlugin::remoteCommand(const QStringList & /* options */,
|
|||||||
const QStringList &args)
|
const QStringList &args)
|
||||||
{
|
{
|
||||||
if (!ExtensionSystem::PluginManager::isInitializationDone()) {
|
if (!ExtensionSystem::PluginManager::isInitializationDone()) {
|
||||||
connect(ExtensionSystem::PluginManager::instance(), &ExtensionSystem::PluginManager::initializationDone,
|
connect(ExtensionSystem::PluginManager::instance(),
|
||||||
this, [this, workingDirectory, args]() {
|
&ExtensionSystem::PluginManager::initializationDone,
|
||||||
remoteCommand(QStringList(), workingDirectory, args);
|
this, [=] { remoteCommand(QStringList(), workingDirectory, args); });
|
||||||
});
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
const FilePaths filePaths = Utils::transform(args, FilePath::fromUserInput);
|
const FilePaths filePaths = Utils::transform(args, FilePath::fromUserInput);
|
||||||
@@ -350,13 +349,13 @@ void CorePlugin::addToPathChooserContextMenu(Utils::PathChooser *pathChooser, QM
|
|||||||
|
|
||||||
if (QDir().exists(pathChooser->filePath().toString())) {
|
if (QDir().exists(pathChooser->filePath().toString())) {
|
||||||
auto *showInGraphicalShell = new QAction(Core::FileUtils::msgGraphicalShellAction(), menu);
|
auto *showInGraphicalShell = new QAction(Core::FileUtils::msgGraphicalShellAction(), menu);
|
||||||
connect(showInGraphicalShell, &QAction::triggered, pathChooser, [pathChooser]() {
|
connect(showInGraphicalShell, &QAction::triggered, pathChooser, [pathChooser] {
|
||||||
Core::FileUtils::showInGraphicalShell(pathChooser, pathChooser->filePath());
|
Core::FileUtils::showInGraphicalShell(pathChooser, pathChooser->filePath());
|
||||||
});
|
});
|
||||||
menu->insertAction(firstAction, showInGraphicalShell);
|
menu->insertAction(firstAction, showInGraphicalShell);
|
||||||
|
|
||||||
auto *showInTerminal = new QAction(Core::FileUtils::msgTerminalHereAction(), menu);
|
auto *showInTerminal = new QAction(Core::FileUtils::msgTerminalHereAction(), menu);
|
||||||
connect(showInTerminal, &QAction::triggered, pathChooser, [pathChooser]() {
|
connect(showInTerminal, &QAction::triggered, pathChooser, [pathChooser] {
|
||||||
if (pathChooser->openTerminalHandler())
|
if (pathChooser->openTerminalHandler())
|
||||||
pathChooser->openTerminalHandler()();
|
pathChooser->openTerminalHandler()();
|
||||||
else
|
else
|
||||||
@@ -366,7 +365,7 @@ void CorePlugin::addToPathChooserContextMenu(Utils::PathChooser *pathChooser, QM
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
auto *mkPathAct = new QAction(tr("Create Folder"), menu);
|
auto *mkPathAct = new QAction(tr("Create Folder"), menu);
|
||||||
connect(mkPathAct, &QAction::triggered, pathChooser, [pathChooser]() {
|
connect(mkPathAct, &QAction::triggered, pathChooser, [pathChooser] {
|
||||||
QDir().mkpath(pathChooser->filePath().toString());
|
QDir().mkpath(pathChooser->filePath().toString());
|
||||||
pathChooser->triggerChanged();
|
pathChooser->triggerChanged();
|
||||||
});
|
});
|
||||||
@@ -380,7 +379,7 @@ void CorePlugin::addToPathChooserContextMenu(Utils::PathChooser *pathChooser, QM
|
|||||||
void CorePlugin::checkSettings()
|
void CorePlugin::checkSettings()
|
||||||
{
|
{
|
||||||
const auto showMsgBox = [this](const QString &msg, QMessageBox::Icon icon) {
|
const auto showMsgBox = [this](const QString &msg, QMessageBox::Icon icon) {
|
||||||
connect(ICore::instance(), &ICore::coreOpened, this, [msg, icon]() {
|
connect(ICore::instance(), &ICore::coreOpened, this, [msg, icon] {
|
||||||
QMessageBox msgBox(ICore::dialogParent());
|
QMessageBox msgBox(ICore::dialogParent());
|
||||||
msgBox.setWindowTitle(tr("Settings File Error"));
|
msgBox.setWindowTitle(tr("Settings File Error"));
|
||||||
msgBox.setText(msg);
|
msgBox.setText(msg);
|
||||||
|
@@ -56,7 +56,7 @@ static DesignModePrivate *d = nullptr;
|
|||||||
|
|
||||||
DesignMode::DesignMode()
|
DesignMode::DesignMode()
|
||||||
{
|
{
|
||||||
ICore::addPreCloseListener([]() -> bool {
|
ICore::addPreCloseListener([] {
|
||||||
m_instance->currentEditorChanged(nullptr);
|
m_instance->currentEditorChanged(nullptr);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@@ -84,13 +84,13 @@ FilePropertiesDialog::FilePropertiesDialog(const FilePath &filePath, QWidget *pa
|
|||||||
}.attachTo(this);
|
}.attachTo(this);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
connect(m_readable, &QCheckBox::clicked, [this](bool checked) {
|
connect(m_readable, &QCheckBox::clicked, this, [this](bool checked) {
|
||||||
setPermission(QFile::ReadUser | QFile::ReadOwner, checked);
|
setPermission(QFile::ReadUser | QFile::ReadOwner, checked);
|
||||||
});
|
});
|
||||||
connect(m_writable, &QCheckBox::clicked, [this](bool checked) {
|
connect(m_writable, &QCheckBox::clicked, this, [this](bool checked) {
|
||||||
setPermission(QFile::WriteUser | QFile::WriteOwner, checked);
|
setPermission(QFile::WriteUser | QFile::WriteOwner, checked);
|
||||||
});
|
});
|
||||||
connect(m_executable, &QCheckBox::clicked, [this](bool checked) {
|
connect(m_executable, &QCheckBox::clicked, this, [this](bool checked) {
|
||||||
setPermission(QFile::ExeUser | QFile::ExeOwner, checked);
|
setPermission(QFile::ExeUser | QFile::ExeOwner, checked);
|
||||||
});
|
});
|
||||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||||
|
@@ -490,7 +490,7 @@ void ReadOnlyFilesDialogPrivate::initDialog(const FilePaths &filePaths)
|
|||||||
// Also save the buttongroup for every file to get the result for each entry.
|
// Also save the buttongroup for every file to get the result for each entry.
|
||||||
buttonGroups.append({filePath, radioButtonGroup});
|
buttonGroups.append({filePath, radioButtonGroup});
|
||||||
QObject::connect(radioButtonGroup, &QButtonGroup::buttonClicked,
|
QObject::connect(radioButtonGroup, &QButtonGroup::buttonClicked,
|
||||||
[this] { updateSelectAll(); });
|
q, [this] { updateSelectAll(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the Mac file dialog style.
|
// Apply the Mac file dialog style.
|
||||||
@@ -543,7 +543,7 @@ void ReadOnlyFilesDialogPrivate::initDialog(const FilePaths &filePaths)
|
|||||||
m_setAll->addItem(saveAsText);
|
m_setAll->addItem(saveAsText);
|
||||||
setAllIndexForOperation[SaveAs] = m_setAll->count() - 1;
|
setAllIndexForOperation[SaveAs] = m_setAll->count() - 1;
|
||||||
}
|
}
|
||||||
QObject::connect(m_setAll, &QComboBox::activated, [this](int index) { setAll(index); });
|
QObject::connect(m_setAll, &QComboBox::activated, q, [this](int index) { setAll(index); });
|
||||||
|
|
||||||
// Filter which columns should be visible and resize them to content.
|
// Filter which columns should be visible and resize them to content.
|
||||||
for (int i = 0; i < NumberOfColumns; ++i) {
|
for (int i = 0; i < NumberOfColumns; ++i) {
|
||||||
|
@@ -231,7 +231,7 @@ void DocumentManagerPrivate::registerSaveAllAction()
|
|||||||
cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? QString() : tr("Ctrl+Shift+S")));
|
cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? QString() : tr("Ctrl+Shift+S")));
|
||||||
mfile->addAction(cmd, Constants::G_FILE_SAVE);
|
mfile->addAction(cmd, Constants::G_FILE_SAVE);
|
||||||
m_saveAllAction->setEnabled(false);
|
m_saveAllAction->setEnabled(false);
|
||||||
connect(m_saveAllAction, &QAction::triggered, []() {
|
connect(m_saveAllAction, &QAction::triggered, [] {
|
||||||
DocumentManager::saveAllModifiedDocumentsSilently();
|
DocumentManager::saveAllModifiedDocumentsSilently();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -451,7 +451,7 @@ void EditorManagerPrivate::init()
|
|||||||
|
|
||||||
// Save Action
|
// Save Action
|
||||||
ActionManager::registerAction(m_saveAction, Constants::SAVE, editManagerContext);
|
ActionManager::registerAction(m_saveAction, Constants::SAVE, editManagerContext);
|
||||||
connect(m_saveAction, &QAction::triggered, m_instance, []() { EditorManager::saveDocument(); });
|
connect(m_saveAction, &QAction::triggered, m_instance, [] { EditorManager::saveDocument(); });
|
||||||
|
|
||||||
// Save As Action
|
// Save As Action
|
||||||
ActionManager::registerAction(m_saveAsAction, Constants::SAVEAS, editManagerContext);
|
ActionManager::registerAction(m_saveAsAction, Constants::SAVEAS, editManagerContext);
|
||||||
@@ -494,7 +494,7 @@ void EditorManagerPrivate::init()
|
|||||||
mfile->addAction(cmd, Constants::G_FILE_CLOSE);
|
mfile->addAction(cmd, Constants::G_FILE_CLOSE);
|
||||||
cmd->setAttribute(Command::CA_UpdateText);
|
cmd->setAttribute(Command::CA_UpdateText);
|
||||||
connect(m_closeOtherDocumentsAction, &QAction::triggered,
|
connect(m_closeOtherDocumentsAction, &QAction::triggered,
|
||||||
m_instance, []() { EditorManager::closeOtherDocuments(); });
|
m_instance, [] { EditorManager::closeOtherDocuments(); });
|
||||||
|
|
||||||
// Close All Others Except Visible Action
|
// Close All Others Except Visible Action
|
||||||
cmd = ActionManager::registerAction(m_closeAllEditorsExceptVisibleAction, Constants::CLOSEALLEXCEPTVISIBLE, editManagerContext, true);
|
cmd = ActionManager::registerAction(m_closeAllEditorsExceptVisibleAction, Constants::CLOSEALLEXCEPTVISIBLE, editManagerContext, true);
|
||||||
@@ -563,7 +563,7 @@ void EditorManagerPrivate::init()
|
|||||||
connect(m_openTerminalAction, &QAction::triggered, this, &EditorManagerPrivate::openTerminal);
|
connect(m_openTerminalAction, &QAction::triggered, this, &EditorManagerPrivate::openTerminal);
|
||||||
connect(m_findInDirectoryAction, &QAction::triggered,
|
connect(m_findInDirectoryAction, &QAction::triggered,
|
||||||
this, &EditorManagerPrivate::findInDirectory);
|
this, &EditorManagerPrivate::findInDirectory);
|
||||||
connect(m_filePropertiesAction, &QAction::triggered, this, []() {
|
connect(m_filePropertiesAction, &QAction::triggered, this, [] {
|
||||||
if (!d->m_contextMenuEntry || d->m_contextMenuEntry->filePath().isEmpty())
|
if (!d->m_contextMenuEntry || d->m_contextMenuEntry->filePath().isEmpty())
|
||||||
return;
|
return;
|
||||||
DocumentManager::showFilePropertiesDialog(d->m_contextMenuEntry->filePath());
|
DocumentManager::showFilePropertiesDialog(d->m_contextMenuEntry->filePath());
|
||||||
@@ -608,7 +608,7 @@ void EditorManagerPrivate::init()
|
|||||||
cmd = ActionManager::registerAction(m_splitAction, Constants::SPLIT, editManagerContext);
|
cmd = ActionManager::registerAction(m_splitAction, Constants::SPLIT, editManagerContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+E,2") : tr("Ctrl+E,2")));
|
cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+E,2") : tr("Ctrl+E,2")));
|
||||||
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
|
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
|
||||||
connect(m_splitAction, &QAction::triggered, this, []() { split(Qt::Vertical); });
|
connect(m_splitAction, &QAction::triggered, this, [] { split(Qt::Vertical); });
|
||||||
|
|
||||||
m_splitSideBySideAction = new QAction(Utils::Icons::SPLIT_VERTICAL.icon(),
|
m_splitSideBySideAction = new QAction(Utils::Icons::SPLIT_VERTICAL.icon(),
|
||||||
tr("Split Side by Side"), this);
|
tr("Split Side by Side"), this);
|
||||||
@@ -622,7 +622,7 @@ void EditorManagerPrivate::init()
|
|||||||
cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+E,4") : tr("Ctrl+E,4")));
|
cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+E,4") : tr("Ctrl+E,4")));
|
||||||
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
|
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
|
||||||
connect(m_splitNewWindowAction, &QAction::triggered,
|
connect(m_splitNewWindowAction, &QAction::triggered,
|
||||||
this, []() { splitNewWindow(currentEditorView()); });
|
this, [] { splitNewWindow(currentEditorView()); });
|
||||||
|
|
||||||
m_removeCurrentSplitAction = new QAction(tr("Remove Current Split"), this);
|
m_removeCurrentSplitAction = new QAction(tr("Remove Current Split"), this);
|
||||||
cmd = ActionManager::registerAction(m_removeCurrentSplitAction, Constants::REMOVE_CURRENT_SPLIT, editManagerContext);
|
cmd = ActionManager::registerAction(m_removeCurrentSplitAction, Constants::REMOVE_CURRENT_SPLIT, editManagerContext);
|
||||||
@@ -718,7 +718,7 @@ void EditorManagerPrivate::extensionsInitialized()
|
|||||||
{
|
{
|
||||||
// Do not ask for files to save.
|
// Do not ask for files to save.
|
||||||
// MainWindow::closeEvent has already done that.
|
// MainWindow::closeEvent has already done that.
|
||||||
ICore::addPreCloseListener([]() -> bool { return EditorManager::closeAllEditors(false); });
|
ICore::addPreCloseListener([] { return EditorManager::closeAllEditors(false); });
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorManagerPrivate *EditorManagerPrivate::instance()
|
EditorManagerPrivate *EditorManagerPrivate::instance()
|
||||||
@@ -894,7 +894,7 @@ IEditor *EditorManagerPrivate::openEditor(EditorView *view, const FilePath &file
|
|||||||
auto menu = new QMenu(button);
|
auto menu = new QMenu(button);
|
||||||
for (EditorType *factory : std::as_const(factories)) {
|
for (EditorType *factory : std::as_const(factories)) {
|
||||||
QAction *action = menu->addAction(factory->displayName());
|
QAction *action = menu->addAction(factory->displayName());
|
||||||
connect(action, &QAction::triggered, &msgbox, [&selectedFactory, factory, &msgbox]() {
|
connect(action, &QAction::triggered, &msgbox, [&selectedFactory, factory, &msgbox] {
|
||||||
selectedFactory = factory;
|
selectedFactory = factory;
|
||||||
msgbox.done(QMessageBox::Open);
|
msgbox.done(QMessageBox::Open);
|
||||||
});
|
});
|
||||||
@@ -2967,18 +2967,13 @@ void EditorManager::populateOpenWithMenu(QMenu *menu, const FilePath &filePath)
|
|||||||
// is inside of a qrc file itself, and the qrc editor opens the Open with menu,
|
// is inside of a qrc file itself, and the qrc editor opens the Open with menu,
|
||||||
// crashes happen, because the editor instance is deleted by openEditorWith
|
// crashes happen, because the editor instance is deleted by openEditorWith
|
||||||
// while the menu is still being processed.
|
// while the menu is still being processed.
|
||||||
connect(
|
connect(action, &QAction::triggered, d, [filePath, editorId] {
|
||||||
action,
|
|
||||||
&QAction::triggered,
|
|
||||||
d,
|
|
||||||
[filePath, editorId]() {
|
|
||||||
EditorType *type = EditorType::editorTypeForId(editorId);
|
EditorType *type = EditorType::editorTypeForId(editorId);
|
||||||
if (type && type->asExternalEditor())
|
if (type && type->asExternalEditor())
|
||||||
EditorManager::openExternalEditor(filePath, editorId);
|
EditorManager::openExternalEditor(filePath, editorId);
|
||||||
else
|
else
|
||||||
EditorManagerPrivate::openEditorWith(filePath, editorId);
|
EditorManagerPrivate::openEditorWith(filePath, editorId);
|
||||||
},
|
}, Qt::QueuedConnection);
|
||||||
Qt::QueuedConnection);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menu->setEnabled(anyMatches);
|
menu->setEnabled(anyMatches);
|
||||||
|
@@ -167,7 +167,7 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
|
|||||||
// this signal is disconnected for standalone toolbars and replaced with
|
// this signal is disconnected for standalone toolbars and replaced with
|
||||||
// a private slot connection
|
// a private slot connection
|
||||||
connect(d->m_editorList, &QComboBox::activated, this, &EditorToolBar::listSelectionActivated);
|
connect(d->m_editorList, &QComboBox::activated, this, &EditorToolBar::listSelectionActivated);
|
||||||
connect(d->m_editorList, &QComboBox::customContextMenuRequested, [this](QPoint p) {
|
connect(d->m_editorList, &QComboBox::customContextMenuRequested, this, [this](QPoint p) {
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
fillListContextMenu(&menu);
|
fillListContextMenu(&menu);
|
||||||
menu.exec(d->m_editorList->mapToGlobal(p));
|
menu.exec(d->m_editorList->mapToGlobal(p));
|
||||||
|
@@ -237,7 +237,7 @@ void FindToolWindow::setFindFilters(const QList<IFindFilter *> &filters)
|
|||||||
names << filter->displayName();
|
names << filter->displayName();
|
||||||
m_configWidgets.append(filter->createConfigWidget());
|
m_configWidgets.append(filter->createConfigWidget());
|
||||||
connect(filter, &IFindFilter::displayNameChanged,
|
connect(filter, &IFindFilter::displayNameChanged,
|
||||||
this, [this, filter]() { updateFindFilterName(filter); });
|
this, [this, filter] { updateFindFilterName(filter); });
|
||||||
}
|
}
|
||||||
m_filterList->addItems(names);
|
m_filterList->addItems(names);
|
||||||
if (m_filters.size() > 0)
|
if (m_filters.size() > 0)
|
||||||
|
@@ -347,13 +347,11 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent
|
|||||||
const QModelIndex sourceIndex = m_sortProxyModel->mapToSource(index);
|
const QModelIndex sourceIndex = m_sortProxyModel->mapToSource(index);
|
||||||
const auto filePath = Utils::FilePath::fromString(
|
const auto filePath = Utils::FilePath::fromString(
|
||||||
m_fileSystemModel->filePath(sourceIndex));
|
m_fileSystemModel->filePath(sourceIndex));
|
||||||
// QTimer::singleShot only posts directly onto the event loop if you use the SLOT("...")
|
|
||||||
// notation, so using a singleShot with a lambda would flicker
|
|
||||||
// QTimer::singleShot(0, this, [this, filePath]() { setCrumblePath(filePath); });
|
|
||||||
QMetaObject::invokeMethod(this, [this, filePath] { setCrumblePath(filePath); },
|
QMetaObject::invokeMethod(this, [this, filePath] { setCrumblePath(filePath); },
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
});
|
});
|
||||||
connect(m_crumbLabel, &Utils::FileCrumbLabel::pathClicked, [this](const Utils::FilePath &path) {
|
connect(m_crumbLabel, &Utils::FileCrumbLabel::pathClicked,
|
||||||
|
this, [this](const Utils::FilePath &path) {
|
||||||
const QModelIndex rootIndex = m_sortProxyModel->mapToSource(m_listView->rootIndex());
|
const QModelIndex rootIndex = m_sortProxyModel->mapToSource(m_listView->rootIndex());
|
||||||
const QModelIndex fileIndex = m_fileSystemModel->index(path.toString());
|
const QModelIndex fileIndex = m_fileSystemModel->index(path.toString());
|
||||||
if (!isChildOf(fileIndex, rootIndex))
|
if (!isChildOf(fileIndex, rootIndex))
|
||||||
|
@@ -196,13 +196,15 @@ ICore::ICore(MainWindow *mainwindow)
|
|||||||
// Save settings once after all plugins are initialized:
|
// Save settings once after all plugins are initialized:
|
||||||
connect(PluginManager::instance(), &PluginManager::initializationDone,
|
connect(PluginManager::instance(), &PluginManager::initializationDone,
|
||||||
this, [] { ICore::saveSettings(ICore::InitializationDone); });
|
this, [] { ICore::saveSettings(ICore::InitializationDone); });
|
||||||
connect(PluginManager::instance(), &PluginManager::testsFinished, [this] (int failedTests) {
|
connect(PluginManager::instance(), &PluginManager::testsFinished,
|
||||||
|
this, [this](int failedTests) {
|
||||||
emit coreAboutToClose();
|
emit coreAboutToClose();
|
||||||
if (failedTests != 0)
|
if (failedTests != 0)
|
||||||
qWarning("Test run was not successful: %d test(s) failed.", failedTests);
|
qWarning("Test run was not successful: %d test(s) failed.", failedTests);
|
||||||
QCoreApplication::exit(failedTests);
|
QCoreApplication::exit(failedTests);
|
||||||
});
|
});
|
||||||
connect(PluginManager::instance(), &PluginManager::scenarioFinished, [this] (int exitCode) {
|
connect(PluginManager::instance(), &PluginManager::scenarioFinished,
|
||||||
|
this, [this](int exitCode) {
|
||||||
emit coreAboutToClose();
|
emit coreAboutToClose();
|
||||||
QCoreApplication::exit(exitCode);
|
QCoreApplication::exit(exitCode);
|
||||||
});
|
});
|
||||||
|
@@ -192,7 +192,7 @@ QList<IWizardFactory*> IWizardFactory::allWizardFactories()
|
|||||||
newFactory->m_action = new QAction(newFactory->displayName(), newFactory);
|
newFactory->m_action = new QAction(newFactory->displayName(), newFactory);
|
||||||
ActionManager::registerAction(newFactory->m_action, actionId(newFactory));
|
ActionManager::registerAction(newFactory->m_action, actionId(newFactory));
|
||||||
|
|
||||||
connect(newFactory->m_action, &QAction::triggered, newFactory, [newFactory]() {
|
connect(newFactory->m_action, &QAction::triggered, newFactory, [newFactory] {
|
||||||
if (!ICore::isNewItemDialogRunning()) {
|
if (!ICore::isNewItemDialogRunning()) {
|
||||||
FilePath path = newFactory->runPath({});
|
FilePath path = newFactory->runPath({});
|
||||||
newFactory->runWizard(path, ICore::dialogParent(), Id(), QVariantMap());
|
newFactory->runWizard(path, ICore::dialogParent(), Id(), QVariantMap());
|
||||||
@@ -253,15 +253,15 @@ Wizard *IWizardFactory::runWizard(const FilePath &path, QWidget *parent, Id plat
|
|||||||
s_currentWizard = wizard;
|
s_currentWizard = wizard;
|
||||||
// Connect while wizard exists:
|
// Connect while wizard exists:
|
||||||
if (m_action)
|
if (m_action)
|
||||||
connect(m_action, &QAction::triggered, wizard, [wizard]() { ICore::raiseWindow(wizard); });
|
connect(m_action, &QAction::triggered, wizard, [wizard] { ICore::raiseWindow(wizard); });
|
||||||
connect(s_inspectWizardAction, &QAction::triggered,
|
connect(s_inspectWizardAction, &QAction::triggered,
|
||||||
wizard, [wizard]() { wizard->showVariables(); });
|
wizard, [wizard] { wizard->showVariables(); });
|
||||||
connect(wizard, &Utils::Wizard::finished, this, [wizard](int result) {
|
connect(wizard, &Utils::Wizard::finished, this, [wizard](int result) {
|
||||||
if (result != QDialog::Accepted)
|
if (result != QDialog::Accepted)
|
||||||
s_reopenData.clear();
|
s_reopenData.clear();
|
||||||
wizard->deleteLater();
|
wizard->deleteLater();
|
||||||
});
|
});
|
||||||
connect(wizard, &QObject::destroyed, this, []() {
|
connect(wizard, &QObject::destroyed, this, [] {
|
||||||
s_isWizardRunning = false;
|
s_isWizardRunning = false;
|
||||||
s_currentWizard = nullptr;
|
s_currentWizard = nullptr;
|
||||||
s_inspectWizardAction->setEnabled(false);
|
s_inspectWizardAction->setEnabled(false);
|
||||||
@@ -405,7 +405,7 @@ void IWizardFactory::initialize()
|
|||||||
|
|
||||||
connect(resetAction, &QAction::triggered, &IWizardFactory::clearWizardFactories);
|
connect(resetAction, &QAction::triggered, &IWizardFactory::clearWizardFactories);
|
||||||
connect(ICore::instance(), &ICore::newItemDialogStateChanged, resetAction,
|
connect(ICore::instance(), &ICore::newItemDialogStateChanged, resetAction,
|
||||||
[resetAction]() { resetAction->setEnabled(!ICore::isNewItemDialogRunning()); });
|
[resetAction] { resetAction->setEnabled(!ICore::isNewItemDialogRunning()); });
|
||||||
|
|
||||||
s_inspectWizardAction = new QAction(tr("Inspect Wizard State"), ActionManager::instance());
|
s_inspectWizardAction = new QAction(tr("Inspect Wizard State"), ActionManager::instance());
|
||||||
ActionManager::registerAction(s_inspectWizardAction, "Wizard.Inspect");
|
ActionManager::registerAction(s_inspectWizardAction, "Wizard.Inspect");
|
||||||
|
@@ -611,7 +611,7 @@ LocatorWidget::LocatorWidget(Locator *locator)
|
|||||||
|
|
||||||
m_fileLineEdit->setButtonMenu(Utils::FancyLineEdit::Left, m_filterMenu);
|
m_fileLineEdit->setButtonMenu(Utils::FancyLineEdit::Left, m_filterMenu);
|
||||||
|
|
||||||
connect(m_refreshAction, &QAction::triggered, locator, [locator]() {
|
connect(m_refreshAction, &QAction::triggered, locator, [locator] {
|
||||||
locator->refresh(Locator::filters());
|
locator->refresh(Locator::filters());
|
||||||
});
|
});
|
||||||
connect(m_configureAction, &QAction::triggered, this, &LocatorWidget::showConfigureDialog);
|
connect(m_configureAction, &QAction::triggered, this, &LocatorWidget::showConfigureDialog);
|
||||||
|
@@ -68,14 +68,16 @@ SpotlightIterator::SpotlightIterator(const QStringList &command)
|
|||||||
m_process->setCommand({Environment::systemEnvironment().searchInPath(command.first()),
|
m_process->setCommand({Environment::systemEnvironment().searchInPath(command.first()),
|
||||||
command.mid(1)});
|
command.mid(1)});
|
||||||
m_process->setEnvironment(Utils::Environment::systemEnvironment());
|
m_process->setEnvironment(Utils::Environment::systemEnvironment());
|
||||||
QObject::connect(m_process.get(), &QtcProcess::done, [this, cmd = command.first()] {
|
QObject::connect(m_process.get(), &QtcProcess::done,
|
||||||
|
m_process.get(), [this, cmd = command.first()] {
|
||||||
if (m_process->result() != ProcessResult::FinishedWithSuccess) {
|
if (m_process->result() != ProcessResult::FinishedWithSuccess) {
|
||||||
MessageManager::writeFlashing(SpotlightLocatorFilter::tr(
|
MessageManager::writeFlashing(SpotlightLocatorFilter::tr(
|
||||||
"Locator: Error occurred when running \"%1\".").arg(cmd));
|
"Locator: Error occurred when running \"%1\".").arg(cmd));
|
||||||
}
|
}
|
||||||
scheduleKillProcess();
|
scheduleKillProcess();
|
||||||
});
|
});
|
||||||
QObject::connect(m_process.get(), &QtcProcess::readyReadStandardOutput, [this] {
|
QObject::connect(m_process.get(), &QtcProcess::readyReadStandardOutput,
|
||||||
|
m_process.get(), [this] {
|
||||||
QString output = QString::fromUtf8(m_process->readAllStandardOutput());
|
QString output = QString::fromUtf8(m_process->readAllStandardOutput());
|
||||||
output.replace("\r\n", "\n");
|
output.replace("\r\n", "\n");
|
||||||
const QStringList items = output.split('\n');
|
const QStringList items = output.split('\n');
|
||||||
|
@@ -480,7 +480,7 @@ LoggingViewManagerWidget::LoggingViewManagerWidget(QWidget *parent)
|
|||||||
m_logModel->destroyItem(m_logModel->itemForIndex(m_logModel->index(0, 0)));
|
m_logModel->destroyItem(m_logModel->itemForIndex(m_logModel->index(0, 0)));
|
||||||
m_logModel->appendItem(LogEntry{timestamp, type, category, msg});
|
m_logModel->appendItem(LogEntry{timestamp, type, category, msg});
|
||||||
}, Qt::QueuedConnection);
|
}, Qt::QueuedConnection);
|
||||||
connect(m_logModel, &QAbstractItemModel::rowsInserted, this, [this, autoScroll]() {
|
connect(m_logModel, &QAbstractItemModel::rowsInserted, this, [this, autoScroll] {
|
||||||
if (autoScroll->isChecked())
|
if (autoScroll->isChecked())
|
||||||
m_logView->scrollToBottom();
|
m_logView->scrollToBottom();
|
||||||
}, Qt::QueuedConnection);
|
}, Qt::QueuedConnection);
|
||||||
@@ -516,7 +516,7 @@ LoggingViewManagerWidget::LoggingViewManagerWidget(QWidget *parent)
|
|||||||
connect(m_categoryView, &Utils::BaseTreeView::customContextMenuRequested,
|
connect(m_categoryView, &Utils::BaseTreeView::customContextMenuRequested,
|
||||||
this, &LoggingViewManagerWidget::showLogCategoryContextMenu);
|
this, &LoggingViewManagerWidget::showLogCategoryContextMenu);
|
||||||
connect(clean, &QToolButton::clicked, m_logModel, &Utils::ListModel<LogEntry>::clear);
|
connect(clean, &QToolButton::clicked, m_logModel, &Utils::ListModel<LogEntry>::clear);
|
||||||
connect(stop, &QToolButton::clicked, this, [this, stop]() {
|
connect(stop, &QToolButton::clicked, this, [this, stop] {
|
||||||
if (m_manager->isEnabled()) {
|
if (m_manager->isEnabled()) {
|
||||||
m_manager->setEnabled(false);
|
m_manager->setEnabled(false);
|
||||||
stop->setIcon(Utils::Icons::RUN_SMALL.icon());
|
stop->setIcon(Utils::Icons::RUN_SMALL.icon());
|
||||||
@@ -591,7 +591,7 @@ void LoggingViewManagerWidget::saveLoggingsToFile() const
|
|||||||
{
|
{
|
||||||
// should we just let it continue without temporarily disabling?
|
// should we just let it continue without temporarily disabling?
|
||||||
const bool enabled = m_manager->isEnabled();
|
const bool enabled = m_manager->isEnabled();
|
||||||
Utils::ExecuteOnDestruction exec([this, enabled]() { m_manager->setEnabled(enabled); });
|
Utils::ExecuteOnDestruction exec([this, enabled] { m_manager->setEnabled(enabled); });
|
||||||
if (enabled)
|
if (enabled)
|
||||||
m_manager->setEnabled(false);
|
m_manager->setEnabled(false);
|
||||||
const Utils::FilePath fp = Utils::FileUtils::getSaveFilePath(ICore::dialogParent(),
|
const Utils::FilePath fp = Utils::FileUtils::getSaveFilePath(ICore::dialogParent(),
|
||||||
@@ -719,7 +719,7 @@ void LoggingViewer::showLoggingView()
|
|||||||
{
|
{
|
||||||
ActionManager::command(Constants::LOGGER)->action()->setEnabled(false);
|
ActionManager::command(Constants::LOGGER)->action()->setEnabled(false);
|
||||||
auto widget = new LoggingViewManagerWidget(ICore::dialogParent());
|
auto widget = new LoggingViewManagerWidget(ICore::dialogParent());
|
||||||
QObject::connect(widget, &QDialog::finished, widget, [widget] () {
|
QObject::connect(widget, &QDialog::finished, widget, [widget] {
|
||||||
ActionManager::command(Constants::LOGGER)->action()->setEnabled(true);
|
ActionManager::command(Constants::LOGGER)->action()->setEnabled(true);
|
||||||
// explicitly disable manager again
|
// explicitly disable manager again
|
||||||
widget->deleteLater();
|
widget->deleteLater();
|
||||||
|
@@ -567,7 +567,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
cmd = ActionManager::registerAction(m_newAction, Constants::NEW);
|
cmd = ActionManager::registerAction(m_newAction, Constants::NEW);
|
||||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+Shift+N"));
|
cmd->setDefaultKeySequence(QKeySequence("Ctrl+Shift+N"));
|
||||||
mfile->addAction(cmd, Constants::G_FILE_NEW);
|
mfile->addAction(cmd, Constants::G_FILE_NEW);
|
||||||
connect(m_newAction, &QAction::triggered, this, []() {
|
connect(m_newAction, &QAction::triggered, this, [] {
|
||||||
if (!ICore::isNewItemDialogRunning()) {
|
if (!ICore::isNewItemDialogRunning()) {
|
||||||
ICore::showNewItemDialog(
|
ICore::showNewItemDialog(
|
||||||
tr("New Project", "Title of dialog"),
|
tr("New Project", "Title of dialog"),
|
||||||
@@ -584,7 +584,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
cmd = ActionManager::registerAction(action, Constants::NEW_FILE);
|
cmd = ActionManager::registerAction(action, Constants::NEW_FILE);
|
||||||
cmd->setDefaultKeySequence(QKeySequence::New);
|
cmd->setDefaultKeySequence(QKeySequence::New);
|
||||||
mfile->addAction(cmd, Constants::G_FILE_NEW);
|
mfile->addAction(cmd, Constants::G_FILE_NEW);
|
||||||
connect(action, &QAction::triggered, this, []() {
|
connect(action, &QAction::triggered, this, [] {
|
||||||
if (!ICore::isNewItemDialogRunning()) {
|
if (!ICore::isNewItemDialogRunning()) {
|
||||||
ICore::showNewItemDialog(tr("New File", "Title of dialog"),
|
ICore::showNewItemDialog(tr("New File", "Title of dialog"),
|
||||||
Utils::filtered(Core::IWizardFactory::allWizardFactories(),
|
Utils::filtered(Core::IWizardFactory::allWizardFactories(),
|
||||||
@@ -1527,7 +1527,7 @@ void MainWindow::changeLog()
|
|||||||
connect(versionCombo, &QComboBox::currentIndexChanged, textEdit, showLog);
|
connect(versionCombo, &QComboBox::currentIndexChanged, textEdit, showLog);
|
||||||
showLog(versionCombo->currentIndex());
|
showLog(versionCombo->currentIndex());
|
||||||
|
|
||||||
connect(showInExplorer, &QPushButton::clicked, [versionCombo, versionedFiles] {
|
connect(showInExplorer, &QPushButton::clicked, this, [versionCombo, versionedFiles] {
|
||||||
const int index = versionCombo->currentIndex();
|
const int index = versionCombo->currentIndex();
|
||||||
if (index >= 0 && index < versionedFiles.size())
|
if (index >= 0 && index < versionedFiles.size())
|
||||||
FileUtils::showInGraphicalShell(ICore::dialogParent(), versionedFiles.at(index).second);
|
FileUtils::showInGraphicalShell(ICore::dialogParent(), versionedFiles.at(index).second);
|
||||||
|
@@ -226,12 +226,13 @@ void ModeManagerPrivate::appendMode(IMode *mode)
|
|||||||
});
|
});
|
||||||
|
|
||||||
Id id = mode->id();
|
Id id = mode->id();
|
||||||
QObject::connect(action, &QAction::triggered, [this, id] {
|
QObject::connect(action, &QAction::triggered, m_instance, [this, id] {
|
||||||
ModeManager::activateMode(id);
|
ModeManager::activateMode(id);
|
||||||
ICore::raiseWindow(m_modeStack);
|
ICore::raiseWindow(m_modeStack);
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(mode, &IMode::enabledStateChanged, [this, mode] { enabledStateChanged(mode); });
|
QObject::connect(mode, &IMode::enabledStateChanged,
|
||||||
|
m_instance, [this, mode] { enabledStateChanged(mode); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModeManager::removeMode(IMode *mode)
|
void ModeManager::removeMode(IMode *mode)
|
||||||
|
@@ -134,7 +134,7 @@ void NavigationSubWidget::populateSplitMenu()
|
|||||||
command->keySequence().toString(
|
command->keySequence().toString(
|
||||||
QKeySequence::NativeText));
|
QKeySequence::NativeText));
|
||||||
QAction *action = m_splitMenu->addAction(displayName);
|
QAction *action = m_splitMenu->addAction(displayName);
|
||||||
connect(action, &QAction::triggered, this, [this, i]() { emit splitMe(i); });
|
connect(action, &QAction::triggered, this, [this, i] { emit splitMe(i); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -230,7 +230,7 @@ void NavigationWidget::setFactories(const QList<INavigationWidgetFactory *> &fac
|
|||||||
if (!ActionManager::command(actionId)) {
|
if (!ActionManager::command(actionId)) {
|
||||||
QAction *action = new QAction(tr("Activate %1 View").arg(factory->displayName()), this);
|
QAction *action = new QAction(tr("Activate %1 View").arg(factory->displayName()), this);
|
||||||
d->m_actionMap.insert(action, id);
|
d->m_actionMap.insert(action, id);
|
||||||
connect(action, &QAction::triggered, this, [this, action]() {
|
connect(action, &QAction::triggered, this, [this, action] {
|
||||||
NavigationWidget::activateSubWidget(d->m_actionMap[action], Side::Left);
|
NavigationWidget::activateSubWidget(d->m_actionMap[action], Side::Left);
|
||||||
});
|
});
|
||||||
Command *cmd = ActionManager::registerAction(action, actionId, navicontext);
|
Command *cmd = ActionManager::registerAction(action, actionId, navicontext);
|
||||||
|
@@ -80,14 +80,14 @@ static void createStatusBarManager()
|
|||||||
statusContext->setWidget(bar);
|
statusContext->setWidget(bar);
|
||||||
ICore::addContextObject(statusContext);
|
ICore::addContextObject(statusContext);
|
||||||
|
|
||||||
QObject::connect(ICore::instance(), &ICore::saveSettingsRequested, [] {
|
QObject::connect(ICore::instance(), &ICore::saveSettingsRequested, ICore::instance(), [] {
|
||||||
QSettings *s = ICore::settings();
|
QSettings *s = ICore::settings();
|
||||||
s->beginGroup(QLatin1String(kSettingsGroup));
|
s->beginGroup(QLatin1String(kSettingsGroup));
|
||||||
s->setValue(QLatin1String(kLeftSplitWidthKey), m_splitter->sizes().at(0));
|
s->setValue(QLatin1String(kLeftSplitWidthKey), m_splitter->sizes().at(0));
|
||||||
s->endGroup();
|
s->endGroup();
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(ICore::instance(), &ICore::coreAboutToClose, [statusContext] {
|
QObject::connect(ICore::instance(), &ICore::coreAboutToClose, statusContext, [statusContext] {
|
||||||
delete statusContext;
|
delete statusContext;
|
||||||
// This is the catch-all on rampdown. Individual items may
|
// This is the catch-all on rampdown. Individual items may
|
||||||
// have been removed earlier by destroyStatusBarWidget().
|
// have been removed earlier by destroyStatusBarWidget().
|
||||||
|
@@ -238,7 +238,7 @@ public:
|
|||||||
if (ICore::settings()->value(showCrashButtonKey).toBool()) {
|
if (ICore::settings()->value(showCrashButtonKey).toBool()) {
|
||||||
auto crashButton = new QPushButton("CRASH!!!");
|
auto crashButton = new QPushButton("CRASH!!!");
|
||||||
crashButton->show();
|
crashButton->show();
|
||||||
connect(crashButton, &QPushButton::clicked, []() {
|
connect(crashButton, &QPushButton::clicked, [] {
|
||||||
// do a real crash
|
// do a real crash
|
||||||
volatile int* a = reinterpret_cast<volatile int *>(NULL); *a = 1;
|
volatile int* a = reinterpret_cast<volatile int *>(NULL); *a = 1;
|
||||||
});
|
});
|
||||||
|
@@ -267,7 +267,7 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const FilePath &inpu
|
|||||||
.arg(versionControl->displayName()),
|
.arg(versionControl->displayName()),
|
||||||
Utils::InfoBarEntry::GlobalSuppression::Enabled);
|
Utils::InfoBarEntry::GlobalSuppression::Enabled);
|
||||||
d->m_unconfiguredVcs = versionControl;
|
d->m_unconfiguredVcs = versionControl;
|
||||||
info.addCustomButton(ICore::msgShowOptionsDialog(), []() {
|
info.addCustomButton(ICore::msgShowOptionsDialog(), [] {
|
||||||
QTC_ASSERT(d->m_unconfiguredVcs, return);
|
QTC_ASSERT(d->m_unconfiguredVcs, return);
|
||||||
ICore::showOptionsDialog(d->m_unconfiguredVcs->id());
|
ICore::showOptionsDialog(d->m_unconfiguredVcs->id());
|
||||||
});
|
});
|
||||||
|
@@ -156,14 +156,16 @@ void WindowList::addWindow(QWidget *window)
|
|||||||
m_windowActionIds.append(id);
|
m_windowActionIds.append(id);
|
||||||
auto action = new QAction(window->windowTitle());
|
auto action = new QAction(window->windowTitle());
|
||||||
m_windowActions.append(action);
|
m_windowActions.append(action);
|
||||||
QObject::connect(action, &QAction::triggered, [action, this]() { activateWindow(action); });
|
QObject::connect(action, &QAction::triggered,
|
||||||
|
action, [action, this] { activateWindow(action); });
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
action->setChecked(false);
|
action->setChecked(false);
|
||||||
Command *cmd = ActionManager::registerAction(action, id);
|
Command *cmd = ActionManager::registerAction(action, id);
|
||||||
cmd->setAttribute(Command::CA_UpdateText);
|
cmd->setAttribute(Command::CA_UpdateText);
|
||||||
ActionManager::actionContainer(Constants::M_WINDOW)->addAction(cmd, Constants::G_WINDOW_LIST);
|
ActionManager::actionContainer(Constants::M_WINDOW)->addAction(cmd, Constants::G_WINDOW_LIST);
|
||||||
action->setVisible(window->isVisible() || window->isMinimized()); // minimized windows are hidden but should be shown
|
action->setVisible(window->isVisible() || window->isMinimized()); // minimized windows are hidden but should be shown
|
||||||
QObject::connect(window, &QWidget::windowTitleChanged, [window, this]() { updateTitle(window); });
|
QObject::connect(window, &QWidget::windowTitleChanged,
|
||||||
|
window, [window, this] { updateTitle(window); });
|
||||||
if (m_dockMenu)
|
if (m_dockMenu)
|
||||||
m_dockMenu->addAction(action);
|
m_dockMenu->addAction(action);
|
||||||
if (window->isActiveWindow())
|
if (window->isActiveWindow())
|
||||||
|
Reference in New Issue
Block a user