Commit 7ccab966 authored by dt's avatar dt
Browse files

Project Explorer: Add set startup project to context menu

Task-Nr: QTCREATORBUG-1506
parent be4342b7
......@@ -169,6 +169,7 @@ struct ProjectExplorerPluginPrivate {
QAction *m_openFileAction;
QAction *m_showInGraphicalShell;
QAction *m_openTerminalHere;
QAction *m_setStartupProjectAction;
QAction *m_projectSelectorAction;
QAction *m_projectSelectorActionMenu;
......@@ -394,15 +395,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
msessionContextMenu->appendGroup(Constants::G_SESSION_OTHER);
msessionContextMenu->appendGroup(Constants::G_SESSION_CONFIG);
mproject->appendGroup(Constants::G_PROJECT_OPEN);
mproject->appendGroup(Constants::G_PROJECT_NEW);
mproject->appendGroup(Constants::G_PROJECT_FIRST);
mproject->appendGroup(Constants::G_PROJECT_BUILD);
mproject->appendGroup(Constants::G_PROJECT_RUN);
mproject->appendGroup(Constants::G_PROJECT_FILES);
mproject->appendGroup(Constants::G_PROJECT_OTHER);
mproject->appendGroup(Constants::G_PROJECT_CONFIG);
msubProject->appendGroup(Constants::G_PROJECT_OPEN);
msubProject->appendGroup(Constants::G_PROJECT_FIRST);
msubProject->appendGroup(Constants::G_PROJECT_BUILD);
msubProject->appendGroup(Constants::G_PROJECT_FILES);
msubProject->appendGroup(Constants::G_PROJECT_OTHER);
......@@ -445,11 +445,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
mproject->addAction(cmd, Constants::G_PROJECT_FILES);
msubProject->addAction(cmd, Constants::G_PROJECT_FILES);
sep = new QAction(this);
sep->setSeparator(true);
cmd = am->registerAction(sep, QLatin1String("ProjectExplorer.New.Sep"), globalcontext);
mproject->addAction(cmd, Constants::G_PROJECT_NEW);
sep = new QAction(this);
sep->setSeparator(true);
cmd = am->registerAction(sep, QLatin1String("ProjectExplorer.Config.Sep"), globalcontext);
......@@ -748,6 +743,12 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// msubProject->addAction(cmd, Constants::G_FOLDER_FILES);
// mproject->addAction(cmd, Constants::G_FOLDER_FILES);
// set startup project action
d->m_setStartupProjectAction = new QAction(tr("Set as Startup Project"), this);
cmd = am->registerAction(d->m_setStartupProjectAction, ProjectExplorer::Constants::SETSTARTUP,
globalcontext);
mproject->addAction(cmd, Constants::G_PROJECT_FIRST);
// target selector
d->m_projectSelectorAction = new QAction(this);
d->m_projectSelectorAction->setCheckable(true);
......@@ -840,6 +841,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(d->m_removeFileAction, SIGNAL(triggered()), this, SLOT(removeFile()));
connect(d->m_deleteFileAction, SIGNAL(triggered()), this, SLOT(deleteFile()));
connect(d->m_renameFileAction, SIGNAL(triggered()), this, SLOT(renameFile()));
connect(d->m_setStartupProjectAction, SIGNAL(triggered()), this, SLOT(setStartupProject()));
updateActions();
......@@ -2241,6 +2243,11 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &to)
}
}
void ProjectExplorerPlugin::setStartupProject()
{
setStartupProject(d->m_currentProject);
}
void ProjectExplorerPlugin::populateOpenWithMenu(QMenu *menu, const QString &fileName)
{
typedef QList<Core::IEditorFactory*> EditorFactoryList;
......
......@@ -111,6 +111,7 @@ public:
void renameFile(Node *node, const QString &to);
static QStringList projectFilePatterns();
bool coreAboutToClose();
void setStartupProject(ProjectExplorer::Project *project);
signals:
void aboutToShowContextMenu(ProjectExplorer::Project *project,
......@@ -127,7 +128,6 @@ signals:
void settingsChanged();
public slots:
void setStartupProject(ProjectExplorer::Project *project = 0);
void openOpenProjectDialog();
private slots:
......@@ -176,6 +176,7 @@ private slots:
void removeFile();
void deleteFile();
void renameFile();
void setStartupProject();
void updateRecentProjectMenu();
void openRecentProject();
......
......@@ -81,6 +81,7 @@ const char * const OPENTERMIANLHERE = "ProjectExplorer.OpenTerminalHere";
const char * const REMOVEFILE = "ProjectExplorer.RemoveFile";
const char * const DELETEFILE = "ProjectExplorer.DeleteFile";
const char * const RENAMEFILE = "ProjectExplorer.RenameFile";
const char * const SETSTARTUP = "ProjectExplorer.SetStartup";
const char * const SHOW_TASK_IN_EDITOR = "ProjectExplorer.ShowTaskInEditor";
const char * const VCS_ANNOTATE_TASK = "ProjectExplorer.VcsAnnotateTask";
......@@ -141,8 +142,7 @@ const char * const G_SESSION_FILES = "Session.Group.Files";
const char * const G_SESSION_OTHER = "Session.Group.Other";
const char * const G_SESSION_CONFIG = "Session.Group.Config";
const char * const G_PROJECT_OPEN = "Project.Group.Open";
const char * const G_PROJECT_NEW = "Project.Group.New";
const char * const G_PROJECT_FIRST = "Project.Group.Open";
const char * const G_PROJECT_FILES = "Project.Group.Files";
const char * const G_PROJECT_BUILD = "Project.Group.Build";
const char * const G_PROJECT_OTHER = "Project.Group.Other";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment