forked from qt-creator/qt-creator
Move function to show session manager to SessionManager
Change-Id: Ibcaae8c4fb68fe6b43759c11b77bfaab73d41745 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -454,7 +454,6 @@ public:
|
|||||||
void unloadProjectContextMenu();
|
void unloadProjectContextMenu();
|
||||||
void unloadOtherProjectsContextMenu();
|
void unloadOtherProjectsContextMenu();
|
||||||
void closeAllProjects();
|
void closeAllProjects();
|
||||||
void showSessionManager();
|
|
||||||
void updateSessionMenu();
|
void updateSessionMenu();
|
||||||
void setSession(QAction *action);
|
void setSession(QAction *action);
|
||||||
|
|
||||||
@@ -815,9 +814,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
IWizardFactory::registerFeatureProvider(new KitFeatureProvider);
|
IWizardFactory::registerFeatureProvider(new KitFeatureProvider);
|
||||||
IWizardFactory::registerFactoryCreator([] { return new SimpleProjectWizard; });
|
IWizardFactory::registerFactoryCreator([] { return new SimpleProjectWizard; });
|
||||||
|
|
||||||
connect(&dd->m_welcomePage, &ProjectWelcomePage::manageSessions,
|
|
||||||
dd, &ProjectExplorerPluginPrivate::showSessionManager);
|
|
||||||
|
|
||||||
ProjectManager *sessionManager = &dd->m_sessionManager;
|
ProjectManager *sessionManager = &dd->m_sessionManager;
|
||||||
connect(sessionManager, &ProjectManager::projectAdded,
|
connect(sessionManager, &ProjectManager::projectAdded,
|
||||||
this, &ProjectExplorerPlugin::fileListChanged);
|
this, &ProjectExplorerPlugin::fileListChanged);
|
||||||
@@ -839,6 +835,12 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
dd, &ProjectExplorerPluginPrivate::updateWelcomePage);
|
dd, &ProjectExplorerPluginPrivate::updateWelcomePage);
|
||||||
connect(SessionManager::instance(), &SessionManager::sessionLoaded,
|
connect(SessionManager::instance(), &SessionManager::sessionLoaded,
|
||||||
dd, &ProjectExplorerPluginPrivate::loadSesssionTasks);
|
dd, &ProjectExplorerPluginPrivate::loadSesssionTasks);
|
||||||
|
connect(SessionManager::instance(), &SessionManager::sessionCreated,
|
||||||
|
dd, &ProjectExplorerPluginPrivate::updateWelcomePage);
|
||||||
|
connect(SessionManager::instance(), &SessionManager::sessionRenamed,
|
||||||
|
dd, &ProjectExplorerPluginPrivate::updateWelcomePage);
|
||||||
|
connect(SessionManager::instance(), &SessionManager::sessionRemoved,
|
||||||
|
dd, &ProjectExplorerPluginPrivate::updateWelcomePage);
|
||||||
|
|
||||||
ProjectTree *tree = &dd->m_projectTree;
|
ProjectTree *tree = &dd->m_projectTree;
|
||||||
connect(tree, &ProjectTree::currentProjectChanged, dd, [] {
|
connect(tree, &ProjectTree::currentProjectChanged, dd, [] {
|
||||||
@@ -1728,8 +1730,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
connect(buildManager, &BuildManager::buildQueueFinished,
|
connect(buildManager, &BuildManager::buildQueueFinished,
|
||||||
dd, &ProjectExplorerPluginPrivate::buildQueueFinished, Qt::QueuedConnection);
|
dd, &ProjectExplorerPluginPrivate::buildQueueFinished, Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(dd->m_sessionManagerAction, &QAction::triggered,
|
connect(dd->m_sessionManagerAction,
|
||||||
dd, &ProjectExplorerPluginPrivate::showSessionManager);
|
&QAction::triggered,
|
||||||
|
SessionManager::instance(),
|
||||||
|
&SessionManager::showSessionManager);
|
||||||
connect(dd->m_newAction, &QAction::triggered,
|
connect(dd->m_newAction, &QAction::triggered,
|
||||||
dd, &ProjectExplorerPlugin::openNewProjectDialog);
|
dd, &ProjectExplorerPlugin::openNewProjectDialog);
|
||||||
connect(dd->m_loadAction, &QAction::triggered,
|
connect(dd->m_loadAction, &QAction::triggered,
|
||||||
@@ -2192,11 +2196,6 @@ IPlugin::ShutdownFlag ProjectExplorerPlugin::aboutToShutdown()
|
|||||||
return AsynchronousShutdown;
|
return AsynchronousShutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::showSessionManager()
|
|
||||||
{
|
|
||||||
dd->showSessionManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProjectExplorerPlugin::openNewProjectDialog()
|
void ProjectExplorerPlugin::openNewProjectDialog()
|
||||||
{
|
{
|
||||||
if (!ICore::isNewItemDialogRunning()) {
|
if (!ICore::isNewItemDialogRunning()) {
|
||||||
@@ -2208,20 +2207,6 @@ void ProjectExplorerPlugin::openNewProjectDialog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPluginPrivate::showSessionManager()
|
|
||||||
{
|
|
||||||
SessionManager::saveSession();
|
|
||||||
SessionDialog sessionDialog(ICore::dialogParent());
|
|
||||||
sessionDialog.setAutoLoadSession(sb_d->isAutoRestoreLastSession());
|
|
||||||
sessionDialog.exec();
|
|
||||||
sb_d->setAutoRestoreLastSession(sessionDialog.autoLoadSession());
|
|
||||||
|
|
||||||
updateActions();
|
|
||||||
|
|
||||||
if (ModeManager::currentModeId() == Core::Constants::MODE_WELCOME)
|
|
||||||
updateWelcomePage();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProjectExplorerPluginPrivate::setStartupProject(Project *project)
|
void ProjectExplorerPluginPrivate::setStartupProject(Project *project)
|
||||||
{
|
{
|
||||||
if (!project)
|
if (!project)
|
||||||
|
|||||||
@@ -155,7 +155,6 @@ public:
|
|||||||
static QThreadPool *sharedThreadPool();
|
static QThreadPool *sharedThreadPool();
|
||||||
static Internal::MiniProjectTargetSelector *targetSelector();
|
static Internal::MiniProjectTargetSelector *targetSelector();
|
||||||
|
|
||||||
static void showSessionManager();
|
|
||||||
static void openNewProjectDialog();
|
static void openNewProjectDialog();
|
||||||
static void openOpenProjectDialog();
|
static void openOpenProjectDialog();
|
||||||
|
|
||||||
|
|||||||
@@ -580,7 +580,7 @@ public:
|
|||||||
auto manageSessionsButton = new WelcomePageButton(this);
|
auto manageSessionsButton = new WelcomePageButton(this);
|
||||||
manageSessionsButton->setText(Tr::tr("Manage..."));
|
manageSessionsButton->setText(Tr::tr("Manage..."));
|
||||||
manageSessionsButton->setWithAccentColor(true);
|
manageSessionsButton->setWithAccentColor(true);
|
||||||
manageSessionsButton->setOnClicked([] { ProjectExplorerPlugin::showSessionManager(); });
|
manageSessionsButton->setOnClicked([] { SessionManager::showSessionManager(); });
|
||||||
|
|
||||||
auto sessionsLabel = new QLabel(this);
|
auto sessionsLabel = new QLabel(this);
|
||||||
sessionsLabel->setFont(brandFont());
|
sessionsLabel->setFont(brandFont());
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestProject(const Utils::FilePath &project);
|
void requestProject(const Utils::FilePath &project);
|
||||||
void manageSessions();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void openSessionAt(int index);
|
void openSessionAt(int index);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "session.h"
|
#include "session.h"
|
||||||
|
|
||||||
#include "session_p.h"
|
#include "session_p.h"
|
||||||
|
#include "sessiondialog.h"
|
||||||
|
|
||||||
#include "projectexplorer.h"
|
#include "projectexplorer.h"
|
||||||
#include "projectexplorertr.h"
|
#include "projectexplorertr.h"
|
||||||
@@ -204,6 +205,7 @@ bool SessionManager::createSession(const QString &session)
|
|||||||
Q_ASSERT(sb_d->m_sessions.size() > 0);
|
Q_ASSERT(sb_d->m_sessions.size() > 0);
|
||||||
sb_d->m_sessions.insert(1, session);
|
sb_d->m_sessions.insert(1, session);
|
||||||
sb_d->m_lastActiveTimes.insert(session, QDateTime::currentDateTime());
|
sb_d->m_lastActiveTimes.insert(session, QDateTime::currentDateTime());
|
||||||
|
emit instance()->sessionCreated(session);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,6 +219,14 @@ bool SessionManager::renameSession(const QString &original, const QString &newNa
|
|||||||
return deleteSession(original);
|
return deleteSession(original);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SessionManager::showSessionManager()
|
||||||
|
{
|
||||||
|
saveSession();
|
||||||
|
Internal::SessionDialog sessionDialog(ICore::dialogParent());
|
||||||
|
sessionDialog.setAutoLoadSession(sb_d->isAutoRestoreLastSession());
|
||||||
|
sessionDialog.exec();
|
||||||
|
sb_d->setAutoRestoreLastSession(sessionDialog.autoLoadSession());
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Shows a dialog asking the user to confirm deleting the session \p session
|
\brief Shows a dialog asking the user to confirm deleting the session \p session
|
||||||
@@ -265,6 +275,8 @@ bool SessionManager::cloneSession(const QString &original, const QString &clone)
|
|||||||
if (!sessionFile.exists() || sessionFile.copyFile(sessionNameToFileName(clone))) {
|
if (!sessionFile.exists() || sessionFile.copyFile(sessionNameToFileName(clone))) {
|
||||||
sb_d->m_sessions.insert(1, clone);
|
sb_d->m_sessions.insert(1, clone);
|
||||||
sb_d->m_sessionDateTimes.insert(clone, sessionNameToFileName(clone).lastModified());
|
sb_d->m_sessionDateTimes.insert(clone, sessionNameToFileName(clone).lastModified());
|
||||||
|
emit instance()->sessionCreated(clone);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public:
|
|||||||
|
|
||||||
static bool cloneSession(const QString &original, const QString &clone);
|
static bool cloneSession(const QString &original, const QString &clone);
|
||||||
static bool renameSession(const QString &original, const QString &newName);
|
static bool renameSession(const QString &original, const QString &newName);
|
||||||
|
static void showSessionManager();
|
||||||
|
|
||||||
static Utils::FilePath sessionNameToFileName(const QString &session);
|
static Utils::FilePath sessionNameToFileName(const QString &session);
|
||||||
|
|
||||||
@@ -75,6 +76,7 @@ signals:
|
|||||||
void sessionLoaded(QString sessionName);
|
void sessionLoaded(QString sessionName);
|
||||||
void aboutToSaveSession();
|
void aboutToSaveSession();
|
||||||
|
|
||||||
|
void sessionCreated(const QString &name);
|
||||||
void sessionRenamed(const QString &oldName, const QString &newName);
|
void sessionRenamed(const QString &oldName, const QString &newName);
|
||||||
void sessionRemoved(const QString &name);
|
void sessionRemoved(const QString &name);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user