Commit da8270e1 authored by hjk's avatar hjk
Browse files

ProjectExplorer: Move private slots to Pimpl



Change-Id: I62a8f4f0e94b3e9f85e9a88f3447c5fbfdd38295
Reviewed-by: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
parent 2ee4363d
......@@ -49,6 +49,7 @@ class JsonWizardFactory;
class JsonWizardPageFactory;
class JsonWizardGeneratorFactory;
class ProjectExplorerPlugin;
class ProjectExplorerPluginPrivate;
// Documentation inside.
class PROJECTEXPLORER_EXPORT JsonWizardFactory : public Core::IWizardFactory
......@@ -116,6 +117,7 @@ private:
static int m_verbose;
friend class ProjectExplorerPlugin;
friend class ProjectExplorerPluginPrivate;
};
} //namespace ProjectExplorer
......
......@@ -193,6 +193,8 @@ static Kit *currentKit()
class ProjectExplorerPluginPrivate : public QObject
{
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::ProjectExplorerPlugin)
public:
ProjectExplorerPluginPrivate();
......@@ -211,6 +213,83 @@ public:
void updateDeployActions();
void updateRunWithoutDeployMenu();
void buildQueueFinished(bool success);
void buildStateChanged(ProjectExplorer::Project * pro);
void buildProjectOnly();
void handleBuildProject();
void buildProjectContextMenu();
void buildSession();
void rebuildProjectOnly();
void rebuildProject();
void rebuildProjectContextMenu();
void rebuildSession();
void deployProjectOnly();
void deployProject();
void deployProjectContextMenu();
void deploySession();
void cleanProjectOnly();
void cleanProject();
void cleanProjectContextMenu();
void cleanSession();
void cancelBuild();
void loadAction();
void handleUnloadProject();
void unloadProjectContextMenu();
void closeAllProjects();
void newProject();
void showSessionManager();
void updateSessionMenu();
void setSession(QAction *action);
void determineSessionToRestoreAtStartup();
void restoreSession();
void loadSession(const QString &session);
void handleRunProject();
void runProjectContextMenu();
void runProjectWithoutDeploy();
void savePersistentSettings();
void addNewFile();
void handleAddExistingFiles();
void addExistingDirectory();
void addNewSubproject();
void removeProject();
void openFile();
void searchOnFileSystem();
void showInGraphicalShell();
void removeFile();
void deleteFile();
void handleRenameFile();
void handleSetStartupProject();
void setStartupProject(ProjectExplorer::Project *project);
void updateRecentProjectMenu();
void clearRecentProjects();
void openRecentProject();
void updateUnloadProjectMenu();
void openTerminalHere();
void invalidateProject(ProjectExplorer::Project *project);
void projectAdded(ProjectExplorer::Project *pro);
void projectRemoved(ProjectExplorer::Project *pro);
void projectDisplayNameChanged(ProjectExplorer::Project *pro);
void startupProjectChanged(); // Calls updateRunAction
void activeTargetChanged();
void activeRunConfigurationChanged();
void slotUpdateRunActions();
void currentModeChanged(Core::IMode *mode, Core::IMode *oldMode);
void loadCustomWizards();
void updateWelcomePage();
void handleRunControlFinished();
void runConfigurationConfigurationFinished();
public:
QMenu *m_sessionMenu;
QMenu *m_openWithMenu;
......@@ -352,6 +431,11 @@ ProjectExplorerPlugin *ProjectExplorerPlugin::instance()
return m_instance;
}
static void updateActions()
{
dd->updateActions();
}
bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *error)
{
Q_UNUSED(error);
......@@ -406,11 +490,11 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
addAutoReleasedObject(new TaskHub);
connect(ICore::instance(), &ICore::newItemsDialogRequested,
this, &ProjectExplorerPlugin::loadCustomWizards);
dd, &ProjectExplorerPluginPrivate::loadCustomWizards);
dd->m_welcomePage = new ProjectWelcomePage;
connect(dd->m_welcomePage, &ProjectWelcomePage::manageSessions,
this, &ProjectExplorerPlugin::showSessionManager);
dd, &ProjectExplorerPluginPrivate::showSessionManager);
addObject(dd->m_welcomePage);
auto sessionManager = new SessionManager(this);
......@@ -418,31 +502,28 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(sessionManager, &SessionManager::projectAdded,
this, &ProjectExplorerPlugin::fileListChanged);
connect(sessionManager, &SessionManager::aboutToRemoveProject,
this, &ProjectExplorerPlugin::invalidateProject);
dd, &ProjectExplorerPluginPrivate::invalidateProject);
connect(sessionManager, &SessionManager::projectRemoved,
this, &ProjectExplorerPlugin::fileListChanged);
connect(sessionManager, &SessionManager::projectAdded,
this, &ProjectExplorerPlugin::projectAdded);
dd, &ProjectExplorerPluginPrivate::projectAdded);
connect(sessionManager, &SessionManager::projectRemoved,
this, &ProjectExplorerPlugin::projectRemoved);
dd, &ProjectExplorerPluginPrivate::projectRemoved);
connect(sessionManager, &SessionManager::startupProjectChanged,
this, &ProjectExplorerPlugin::startupProjectChanged);
dd, &ProjectExplorerPluginPrivate::startupProjectChanged);
connect(sessionManager, &SessionManager::projectDisplayNameChanged,
this, &ProjectExplorerPlugin::projectDisplayNameChanged);
connect(sessionManager, &SessionManager::dependencyChanged,
this, &ProjectExplorerPlugin::updateActions);
connect(sessionManager, &SessionManager::sessionLoaded,
this, &ProjectExplorerPlugin::updateActions);
dd, &ProjectExplorerPluginPrivate::projectDisplayNameChanged);
connect(sessionManager, &SessionManager::dependencyChanged, updateActions);
connect(sessionManager, &SessionManager::sessionLoaded, updateActions);
connect(sessionManager, &SessionManager::sessionLoaded,
this, &ProjectExplorerPlugin::updateWelcomePage);
dd, &ProjectExplorerPluginPrivate::updateWelcomePage);
ProjectTree *tree = new ProjectTree(this);
connect(tree, &ProjectTree::currentProjectChanged,
dd, &ProjectExplorerPluginPrivate::updateContextMenuActions);
connect(tree, &ProjectTree::currentNodeChanged,
dd, &ProjectExplorerPluginPrivate::updateContextMenuActions);
connect(tree, &ProjectTree::currentProjectChanged,
dd, &ProjectExplorerPluginPrivate::updateActions);
connect(tree, &ProjectTree::currentProjectChanged, updateActions);
addAutoReleasedObject(new CustomWizardMetaFactory<CustomProjectWizard>(IWizardFactory::ProjectWizard));
addAutoReleasedObject(new CustomWizardMetaFactory<CustomWizard>(IWizardFactory::FileWizard));
......@@ -484,7 +565,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(dd->m_outputPane, &AppOutputPane::runControlStarted,
this, &ProjectExplorerPlugin::runControlStarted);
connect(dd->m_outputPane, &AppOutputPane::runControlFinished,
this, &ProjectExplorerPlugin::handleRunControlFinished);
dd, &ProjectExplorerPluginPrivate::handleRunControlFinished);
addAutoReleasedObject(new AllProjectsFilter);
addAutoReleasedObject(new CurrentProjectFilter);
......@@ -715,7 +796,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
mrecent->setOnAllDisabledBehavior(ActionContainer::Show);
mfile->addMenu(mrecent, Core::Constants::G_FILE_OPEN);
connect(mfile->menu(), &QMenu::aboutToShow,
this, &ProjectExplorerPlugin::updateRecentProjectMenu);
dd, &ProjectExplorerPluginPrivate::updateRecentProjectMenu);
// session menu
ActionContainer *msession = ActionManager::createMenu(Constants::M_SESSION);
......@@ -724,7 +805,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
mfile->addMenu(msession, Core::Constants::G_FILE_OPEN);
dd->m_sessionMenu = msession->menu();
connect(mfile->menu(), &QMenu::aboutToShow,
this, &ProjectExplorerPlugin::updateSessionMenu);
dd, &ProjectExplorerPluginPrivate::updateSessionMenu);
// session manager action
dd->m_sessionManagerAction = new QAction(tr("Session Manager..."), this);
......@@ -747,7 +828,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
munload->setOnAllDisabledBehavior(ActionContainer::Show);
mfile->addMenu(munload, Core::Constants::G_FILE_PROJECT);
connect(mfile->menu(), &QMenu::aboutToShow,
this, &ProjectExplorerPlugin::updateUnloadProjectMenu);
dd, &ProjectExplorerPluginPrivate::updateUnloadProjectMenu);
// unload session action
dd->m_closeAllProjects = new QAction(tr("Close All Projects and Editors"), this);
......@@ -1012,7 +1093,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+T")));
connect(ICore::instance(), &ICore::saveSettingsRequested,
this, &ProjectExplorerPlugin::savePersistentSettings);
dd, &ProjectExplorerPluginPrivate::savePersistentSettings);
addAutoReleasedObject(new ProjectTreeWidgetFactory);
addAutoReleasedObject(new FolderNavigationWidgetFactory);
......@@ -1061,67 +1142,105 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
if (dd->m_projectExplorerSettings.environmentId.isNull())
dd->m_projectExplorerSettings.environmentId = QUuid::createUuid();
connect(dd->m_sessionManagerAction, &QAction::triggered, this, &ProjectExplorerPlugin::showSessionManager);
connect(dd->m_newAction, &QAction::triggered, this, &ProjectExplorerPlugin::newProject);
connect(dd->m_loadAction, &QAction::triggered, this, &ProjectExplorerPlugin::loadAction);
connect(dd->m_buildProjectOnlyAction, &QAction::triggered, this, &ProjectExplorerPlugin::buildProjectOnly);
connect(dd->m_buildAction, &QAction::triggered, this, &ProjectExplorerPlugin::handleBuildProject);
connect(dd->m_buildActionContextMenu, &QAction::triggered, this, &ProjectExplorerPlugin::buildProjectContextMenu);
connect(dd->m_buildSessionAction, &QAction::triggered, this, &ProjectExplorerPlugin::buildSession);
connect(dd->m_rebuildProjectOnlyAction, &QAction::triggered, this, &ProjectExplorerPlugin::rebuildProjectOnly);
connect(dd->m_rebuildAction, &QAction::triggered, this, &ProjectExplorerPlugin::rebuildProject);
connect(dd->m_rebuildActionContextMenu, &QAction::triggered, this, &ProjectExplorerPlugin::rebuildProjectContextMenu);
connect(dd->m_rebuildSessionAction, &QAction::triggered, this, &ProjectExplorerPlugin::rebuildSession);
connect(dd->m_deployProjectOnlyAction, &QAction::triggered, this, &ProjectExplorerPlugin::deployProjectOnly);
connect(dd->m_deployAction, &QAction::triggered, this, &ProjectExplorerPlugin::deployProject);
connect(dd->m_deployActionContextMenu, &QAction::triggered, this, &ProjectExplorerPlugin::deployProjectContextMenu);
connect(dd->m_deploySessionAction, &QAction::triggered, this, &ProjectExplorerPlugin::deploySession);
connect(dd->m_cleanProjectOnlyAction, &QAction::triggered, this, &ProjectExplorerPlugin::cleanProjectOnly);
connect(dd->m_cleanAction, &QAction::triggered, this, &ProjectExplorerPlugin::cleanProject);
connect(dd->m_cleanActionContextMenu, &QAction::triggered, this, &ProjectExplorerPlugin::cleanProjectContextMenu);
connect(dd->m_cleanSessionAction, &QAction::triggered, this, &ProjectExplorerPlugin::cleanSession);
connect(dd->m_runAction, &QAction::triggered, this, &ProjectExplorerPlugin::handleRunProject);
connect(dd->m_runActionContextMenu, &QAction::triggered, this, &ProjectExplorerPlugin::runProjectContextMenu);
connect(dd->m_runWithoutDeployAction, &QAction::triggered, this, &ProjectExplorerPlugin::runProjectWithoutDeploy);
connect(dd->m_cancelBuildAction, &QAction::triggered, this, &ProjectExplorerPlugin::cancelBuild);
connect(dd->m_unloadAction, &QAction::triggered, this, &ProjectExplorerPlugin::handleUnloadProject);
connect(dd->m_unloadActionContextMenu, &QAction::triggered, this, &ProjectExplorerPlugin::unloadProjectContextMenu);
connect(dd->m_closeAllProjects, &QAction::triggered, this, &ProjectExplorerPlugin::closeAllProjects);
connect(dd->m_addNewFileAction, &QAction::triggered, this, &ProjectExplorerPlugin::addNewFile);
connect(dd->m_addExistingFilesAction, &QAction::triggered, this, &ProjectExplorerPlugin::handleAddExistingFiles);
connect(dd->m_addExistingDirectoryAction, &QAction::triggered, this, &ProjectExplorerPlugin::addExistingDirectory);
connect(dd->m_addNewSubprojectAction, &QAction::triggered, this, &ProjectExplorerPlugin::addNewSubproject);
connect(dd->m_removeProjectAction, &QAction::triggered, this, &ProjectExplorerPlugin::removeProject);
connect(dd->m_openFileAction, &QAction::triggered, this, &ProjectExplorerPlugin::openFile);
connect(dd->m_searchOnFileSystem, &QAction::triggered, this, &ProjectExplorerPlugin::searchOnFileSystem);
connect(dd->m_showInGraphicalShell, &QAction::triggered, this, &ProjectExplorerPlugin::showInGraphicalShell);
connect(dd->m_openTerminalHere, &QAction::triggered, this, &ProjectExplorerPlugin::openTerminalHere);
connect(dd->m_removeFileAction, &QAction::triggered, this, &ProjectExplorerPlugin::removeFile);
connect(dd->m_deleteFileAction, &QAction::triggered, this, &ProjectExplorerPlugin::deleteFile);
connect(dd->m_renameFileAction, &QAction::triggered, this, &ProjectExplorerPlugin::handleRenameFile);
connect(dd->m_setStartupProjectAction, &QAction::triggered, this, &ProjectExplorerPlugin::handleSetStartupProject);
connect(dd->m_sessionManagerAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::showSessionManager);
connect(dd->m_newAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::newProject);
connect(dd->m_loadAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::loadAction);
connect(dd->m_buildProjectOnlyAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::buildProjectOnly);
connect(dd->m_buildAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::handleBuildProject);
connect(dd->m_buildActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::buildProjectContextMenu);
connect(dd->m_buildSessionAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::buildSession);
connect(dd->m_rebuildProjectOnlyAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::rebuildProjectOnly);
connect(dd->m_rebuildAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::rebuildProject);
connect(dd->m_rebuildActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::rebuildProjectContextMenu);
connect(dd->m_rebuildSessionAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::rebuildSession);
connect(dd->m_deployProjectOnlyAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::deployProjectOnly);
connect(dd->m_deployAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::deployProject);
connect(dd->m_deployActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::deployProjectContextMenu);
connect(dd->m_deploySessionAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::deploySession);
connect(dd->m_cleanProjectOnlyAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::cleanProjectOnly);
connect(dd->m_cleanAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::cleanProject);
connect(dd->m_cleanActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::cleanProjectContextMenu);
connect(dd->m_cleanSessionAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::cleanSession);
connect(dd->m_runAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::handleRunProject);
connect(dd->m_runActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::runProjectContextMenu);
connect(dd->m_runWithoutDeployAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::runProjectWithoutDeploy);
connect(dd->m_cancelBuildAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::cancelBuild);
connect(dd->m_unloadAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::handleUnloadProject);
connect(dd->m_unloadActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::unloadProjectContextMenu);
connect(dd->m_closeAllProjects, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::closeAllProjects);
connect(dd->m_addNewFileAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::addNewFile);
connect(dd->m_addExistingFilesAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::handleAddExistingFiles);
connect(dd->m_addExistingDirectoryAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::addExistingDirectory);
connect(dd->m_addNewSubprojectAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::addNewSubproject);
connect(dd->m_removeProjectAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::removeProject);
connect(dd->m_openFileAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::openFile);
connect(dd->m_searchOnFileSystem, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::searchOnFileSystem);
connect(dd->m_showInGraphicalShell, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::showInGraphicalShell);
connect(dd->m_openTerminalHere, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::openTerminalHere);
connect(dd->m_removeFileAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::removeFile);
connect(dd->m_deleteFileAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::deleteFile);
connect(dd->m_renameFileAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::handleRenameFile);
connect(dd->m_setStartupProjectAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::handleSetStartupProject);
connect(dd->m_projectTreeCollapseAllAction, &QAction::triggered,
ProjectTree::instance(), &ProjectTree::collapseAll);
connect(this, &ProjectExplorerPlugin::updateRunActions, this, &ProjectExplorerPlugin::slotUpdateRunActions);
connect(this, &ProjectExplorerPlugin::updateRunActions,
dd, &ProjectExplorerPluginPrivate::slotUpdateRunActions);
connect(this, &ProjectExplorerPlugin::settingsChanged,
dd, &ProjectExplorerPluginPrivate::updateRunWithoutDeployMenu);
auto buildManager = new BuildManager(this, dd->m_cancelBuildAction);
connect(buildManager, &BuildManager::buildStateChanged,
this, &ProjectExplorerPlugin::buildStateChanged);
dd, &ProjectExplorerPluginPrivate::buildStateChanged);
connect(buildManager, &BuildManager::buildQueueFinished,
this, &ProjectExplorerPlugin::buildQueueFinished, Qt::QueuedConnection);
m_instance->updateActions();
dd, &ProjectExplorerPluginPrivate::buildQueueFinished, Qt::QueuedConnection);
connect(ICore::instance(), &ICore::coreAboutToOpen,
this, &ProjectExplorerPlugin::determineSessionToRestoreAtStartup);
connect(ICore::instance(), &ICore::coreOpened, this, &ProjectExplorerPlugin::restoreSession);
connect(ICore::instance(), &ICore::newItemDialogRunningChanged,
this, &ProjectExplorerPlugin::updateActions);
dd, &ProjectExplorerPluginPrivate::determineSessionToRestoreAtStartup);
connect(ICore::instance(), &ICore::coreOpened,
dd, &ProjectExplorerPluginPrivate::restoreSession);
connect(ICore::instance(), &ICore::newItemDialogRunningChanged, updateActions);
updateWelcomePage();
dd->updateWelcomePage();
// FIXME: These are mostly "legacy"/"convenience" entries, relying on
// the global entry point ProjectExplorer::currentProject(). They should
......@@ -1241,7 +1360,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
return true;
}
void ProjectExplorerPlugin::loadAction()
void ProjectExplorerPluginPrivate::loadAction()
{
if (debug)
qDebug() << "ProjectExplorerPlugin::loadAction";
......@@ -1263,23 +1382,23 @@ void ProjectExplorerPlugin::loadAction()
if (filename.isEmpty())
return;
QString errorMessage;
openProject(filename, &errorMessage);
ProjectExplorerPlugin::openProject(filename, &errorMessage);
if (!errorMessage.isEmpty())
QMessageBox::critical(ICore::mainWindow(), tr("Failed to open project."), errorMessage);
updateActions();
}
void ProjectExplorerPlugin::unloadProjectContextMenu()
void ProjectExplorerPluginPrivate::unloadProjectContextMenu()
{
if (debug)
qDebug() << "ProjectExplorerPlugin::unloadProjectContextMenu";
if (Project *p = ProjectTree::currentProject())
unloadProject(p);
ProjectExplorerPlugin::unloadProject(p);
}
void ProjectExplorerPlugin::handleUnloadProject()
void ProjectExplorerPluginPrivate::handleUnloadProject()
{
if (debug)
qDebug() << "ProjectExplorerPlugin::unloadProject";
......@@ -1287,7 +1406,7 @@ void ProjectExplorerPlugin::handleUnloadProject()
QList<Project *> projects = SessionManager::projects();
QTC_ASSERT(!projects.isEmpty(), return);
unloadProject(projects.first());
ProjectExplorerPlugin::unloadProject(projects.first());
}
void ProjectExplorerPlugin::unloadProject(Project *project)
......@@ -1317,10 +1436,10 @@ void ProjectExplorerPlugin::unloadProject(Project *project)
dd->addToRecentProjects(document->filePath().toString(), project->displayName());
SessionManager::removeProject(project);
m_instance->updateActions();
updateActions();
}
void ProjectExplorerPlugin::closeAllProjects()
void ProjectExplorerPluginPrivate::closeAllProjects()
{
if (debug)
qDebug() << "ProjectExplorerPlugin::closeAllProject";
......@@ -1382,7 +1501,7 @@ void ProjectExplorerPlugin::extensionsInitialized()
dd->m_kitManager->restoreKits();
}
void ProjectExplorerPlugin::loadCustomWizards()
void ProjectExplorerPluginPrivate::loadCustomWizards()
{
// Add custom wizards, for which other plugins might have registered
// class factories
......@@ -1390,9 +1509,9 @@ void ProjectExplorerPlugin::loadCustomWizards()
if (firstTime) {
firstTime = false;
foreach (IWizardFactory *cpw, CustomWizard::createWizards())
addAutoReleasedObject(cpw);
m_instance->addAutoReleasedObject(cpw);
foreach (IWizardFactory *cpw, JsonWizardFactory::createWizardFactories())
addAutoReleasedObject(cpw);
m_instance->addAutoReleasedObject(cpw);
}
}
......@@ -1404,7 +1523,7 @@ void ProjectExplorerPluginPrivate::updateRunWithoutDeployMenu()
ExtensionSystem::IPlugin::ShutdownFlag ProjectExplorerPlugin::aboutToShutdown()
{
disconnect(ModeManager::instance(), &ModeManager::currentModeChanged,
this, &ProjectExplorerPlugin::currentModeChanged);
dd, &ProjectExplorerPluginPrivate::currentModeChanged);
ProjectTree::aboutToShutDown();
dd->m_proWindow->aboutToShutdown(); // disconnect from session
SessionManager::closeAllProjects();
......@@ -1420,7 +1539,7 @@ ExtensionSystem::IPlugin::ShutdownFlag ProjectExplorerPlugin::aboutToShutdown()
return AsynchronousShutdown;
}
void ProjectExplorerPlugin::newProject()
void ProjectExplorerPluginPrivate::newProject()
{
if (debug)
qDebug() << "ProjectExplorerPlugin::newProject";
......@@ -1430,7 +1549,7 @@ void ProjectExplorerPlugin::newProject()
updateActions();
}
void ProjectExplorerPlugin::showSessionManager()
void ProjectExplorerPluginPrivate::showSessionManager()
{
if (debug)
qDebug() << "ProjectExplorerPlugin::showSessionManager";
......@@ -1452,7 +1571,7 @@ void ProjectExplorerPlugin::showSessionManager()
updateWelcomePage();
}
void ProjectExplorerPlugin::setStartupProject(Project *project)
void ProjectExplorerPluginPrivate::setStartupProject(Project *project)
{
if (debug)
qDebug() << "ProjectExplorerPlugin::setStartupProject";
......@@ -1463,7 +1582,7 @@ void ProjectExplorerPlugin::setStartupProject(Project *project)
updateActions();
}
void ProjectExplorerPlugin::savePersistentSettings()
void ProjectExplorerPluginPrivate::savePersistentSettings()
{
if (debug)
qDebug()<<"ProjectExplorerPlugin::savePersistentSettings()";
......@@ -1616,7 +1735,7 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
if (fileNames.size() > 1)
SessionManager::reportProjectLoadingProgress();
}
m_instance->updateActions();
updateActions();
bool switchToProjectsMode = Utils::anyOf(openedPro, &Project::needsConfiguration);
......@@ -1631,12 +1750,12 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
return openedPro;
}
void ProjectExplorerPlugin::updateWelcomePage()
void ProjectExplorerPluginPrivate::updateWelcomePage()
{
dd->m_welcomePage->reloadWelcomeScreenData();
m_welcomePage->reloadWelcomeScreenData();
}
void ProjectExplorerPlugin::currentModeChanged(IMode *mode, IMode *oldMode)
void ProjectExplorerPluginPrivate::currentModeChanged(IMode *mode, IMode *oldMode)
{
if (oldMode && oldMode->id() == Constants::MODE_SESSION)
ICore::saveSettings();
......@@ -1644,30 +1763,30 @@ void ProjectExplorerPlugin::currentModeChanged(IMode *mode, IMode *oldMode)
updateWelcomePage();
}
void ProjectExplorerPlugin::determineSessionToRestoreAtStartup()
void ProjectExplorerPluginPrivate::determineSessionToRestoreAtStartup()
{
// Process command line arguments first:
if (pluginSpec()->arguments().contains(QLatin1String("-lastsession")))
dd->m_sessionToRestoreAtStartup = SessionManager::lastSession();
if (m_instance->pluginSpec()->arguments().contains(QLatin1String("-lastsession")))
m_sessionToRestoreAtStartup = SessionManager::lastSession();
QStringList arguments = ExtensionSystem::PluginManager::arguments();
if (dd->m_sessionToRestoreAtStartup.isNull()) {
if (m_sessionToRestoreAtStartup.isNull()) {
QStringList sessions = SessionManager::sessions();
// We have command line arguments, try to find a session in them
// Default to no session loading
foreach (const QString &arg, arguments) {
if (sessions.contains(arg)) {
// Session argument
dd->m_sessionToRestoreAtStartup = arg;
m_sessionToRestoreAtStartup = arg;
break;
}
}
}
// Handle settings only after command line arguments:
if (dd->m_sessionToRestoreAtStartup.isNull()
&& dd->m_projectExplorerSettings.autorestoreLastSession)
dd->m_sessionToRestoreAtStartup = SessionManager::lastSession();
if (m_sessionToRestoreAtStartup.isNull()
&& m_projectExplorerSettings.autorestoreLastSession)
m_sessionToRestoreAtStartup = SessionManager::lastSession();
if (!dd->m_sessionToRestoreAtStartup.isNull())
if (!m_sessionToRestoreAtStartup.isNull())
ModeManager::activateMode(Core::Constants::MODE_EDIT);
}
......@@ -1698,7 +1817,7 @@ void ProjectExplorerPlugin::updateContextMenuActions()
default session and puts the list of recent projects and sessions
onto the welcome page.
*/
void ProjectExplorerPlugin::restoreSession()
void ProjectExplorerPluginPrivate::restoreSession()
{
if (debug)
qDebug() << "ProjectExplorerPlugin::restoreSession";
......@@ -1760,30 +1879,30 @@ void ProjectExplorerPlugin::restoreSession()
// update welcome page
connect(ModeManager::instance(), &ModeManager::currentModeChanged,
this, &ProjectExplorerPlugin::currentModeChanged);
dd, &ProjectExplorerPluginPrivate::currentModeChanged);
connect(dd->m_welcomePage, &ProjectWelcomePage::requestSession,
this, &ProjectExplorerPlugin::loadSession);
dd, &ProjectExplorerPluginPrivate::loadSession);
connect(dd->m_welcomePage, &ProjectWelcomePage::requestProject,
this, &ProjectExplorerPlugin::openProjectWelcomePage);
m_instance, &ProjectExplorerPlugin::openProjectWelcomePage);
dd->m_arguments = arguments;
QTimer::singleShot(0, this, SLOT(restoreSession2()));
updateActions();
}
void ProjectExplorerPlugin::restoreSession2()