forked from qt-creator/qt-creator
Register wizard windows so they appear in window list and get shortcuts
Change-Id: I69b3a49ba2e2162585502a523be835918b7b9533 Task-number: QTCREATORBUG-13766 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "basefilewizardfactory.h"
|
||||
|
||||
#include "basefilewizard.h"
|
||||
#include "icontext.h"
|
||||
#include "icore.h"
|
||||
#include "ifilewizardextension.h"
|
||||
#include "mimedatabase.h"
|
||||
@@ -220,6 +221,7 @@ void BaseFileWizardFactory::runWizard(const QString &path, QWidget *parent, cons
|
||||
dialogParameterFlags,
|
||||
extraValues)));
|
||||
QTC_ASSERT(!wizard.isNull(), return);
|
||||
ICore::registerWindow(wizard.data(), Context("Core.NewWizard"));
|
||||
|
||||
GeneratedFiles files;
|
||||
// Run the wizard: Call generate files on switching to the first extension
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -198,6 +199,7 @@ NewDialog::NewDialog(QWidget *parent) :
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
setWindowFlags(windowFlags());
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
ICore::registerWindow(this, Context("Core.NewDialog"));
|
||||
m_ui->setupUi(this);
|
||||
QPalette p = m_ui->frame->palette();
|
||||
p.setColor(QPalette::Window, p.color(QPalette::Base));
|
||||
|
||||
@@ -743,7 +743,7 @@ void MainWindow::registerDefaultActions()
|
||||
|
||||
void MainWindow::newFile()
|
||||
{
|
||||
showNewItemDialog(tr("New", "Title of dialog"), IWizardFactory::allWizardFactories(), QString());
|
||||
showNewItemDialog(tr("New File or Project", "Title of dialog"), IWizardFactory::allWizardFactories(), QString());
|
||||
}
|
||||
|
||||
void MainWindow::openFile()
|
||||
|
||||
@@ -116,6 +116,11 @@ bool WindowSupport::eventFilter(QObject *obj, QEvent *event)
|
||||
updateFullScreenAction();
|
||||
} else if (event->type() == QEvent::WindowActivate) {
|
||||
WindowList::setActiveWindow(m_window);
|
||||
} else if (event->type() == QEvent::Hide) {
|
||||
// minimized windows are hidden, but we still want to show them
|
||||
WindowList::setWindowVisible(m_window, m_window->isMinimized());
|
||||
} else if (event->type() == QEvent::Show) {
|
||||
WindowList::setWindowVisible(m_window, true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -165,6 +170,7 @@ void WindowList::addWindow(QWidget *window)
|
||||
Context(Constants::C_GLOBAL));
|
||||
cmd->setAttribute(Command::CA_UpdateText);
|
||||
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
|
||||
QObject::connect(window, &QWidget::windowTitleChanged, [window]() { WindowList::updateTitle(window); });
|
||||
if (m_dockMenu)
|
||||
m_dockMenu->addAction(action);
|
||||
@@ -215,5 +221,13 @@ void WindowList::setActiveWindow(QWidget *window)
|
||||
m_windowActions.at(i)->setChecked(m_windows.at(i) == window);
|
||||
}
|
||||
|
||||
void WindowList::setWindowVisible(QWidget *window, bool visible)
|
||||
{
|
||||
int index = m_windows.indexOf(window);
|
||||
QTC_ASSERT(index >= 0, return);
|
||||
QTC_ASSERT(index < m_windowActions.size(), return);
|
||||
m_windowActions.at(index)->setVisible(visible);
|
||||
}
|
||||
|
||||
} // Internal
|
||||
} // Core
|
||||
|
||||
@@ -50,6 +50,7 @@ public:
|
||||
static void addWindow(QWidget *window);
|
||||
static void removeWindow(QWidget *window);
|
||||
static void setActiveWindow(QWidget *window);
|
||||
static void setWindowVisible(QWidget *window, bool visible);
|
||||
|
||||
private:
|
||||
static void activateWindow(QAction *action);
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "../projectexplorerconstants.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
|
||||
@@ -366,6 +367,7 @@ void JsonWizardFactory::runWizard(const QString &path, QWidget *parent, const QS
|
||||
{
|
||||
JsonWizard wizard(parent);
|
||||
wizard.setWindowIcon(icon());
|
||||
wizard.setWindowTitle(displayName());
|
||||
|
||||
wizard.setValue(QStringLiteral("WizardDir"), m_wizardDir);
|
||||
Core::FeatureSet tmp = requiredFeatures();
|
||||
@@ -434,11 +436,13 @@ void JsonWizardFactory::runWizard(const QString &path, QWidget *parent, const QS
|
||||
wizard.addGenerator(gen);
|
||||
}
|
||||
|
||||
if (!m_pages.isEmpty())
|
||||
if (!m_pages.isEmpty()) {
|
||||
Core::ICore::registerWindow(&wizard, Core::Context("Core.NewJSONWizard"));
|
||||
wizard.exec();
|
||||
else
|
||||
} else {
|
||||
wizard.accept();
|
||||
}
|
||||
}
|
||||
|
||||
QList<QVariant> JsonWizardFactory::objectOrList(const QVariant &data, QString *errorMessage)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "basecheckoutwizardfactory.h"
|
||||
#include "basecheckoutwizard.h"
|
||||
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/featureprovider.h>
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
@@ -86,6 +88,7 @@ void BaseCheckoutWizardFactory::runWizard(const QString &path, QWidget *parent,
|
||||
{
|
||||
QScopedPointer<BaseCheckoutWizard> wizard(m_wizardCreator(Utils::FileName::fromString(path), parent));
|
||||
wizard->setWindowTitle(displayName());
|
||||
Core::ICore::registerWindow(wizard.data(), Core::Context("New.CheckoutWizard"));
|
||||
checkoutPath = wizard->run();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user