Commit d8016ef8 authored by Tobias Hunger's avatar Tobias Hunger

Disable Project Mode if no projects are loaded

parent b492c264
......@@ -183,6 +183,8 @@ struct ProjectExplorerPluginPrivate {
Internal::ProjectExplorerSettings m_projectExplorerSettings;
Internal::ProjectWelcomePage *m_welcomePlugin;
Internal::ProjectWelcomePageWidget *m_welcomePage;
Core::BaseMode * m_projectsMode;
};
ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
......@@ -191,7 +193,8 @@ ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
m_currentProject(0),
m_currentNode(0),
m_delayedRunConfiguration(0),
m_debuggingRunControl(0)
m_debuggingRunControl(0),
m_projectsMode(0)
{
}
......@@ -263,14 +266,15 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
QList<int> pecontext;
pecontext << core->uniqueIDManager()->uniqueIdentifier(Constants::C_PROJECTEXPLORER);
Core::BaseMode *mode = new Core::BaseMode;
mode->setDisplayName(tr("Projects"));
mode->setId(QLatin1String(Constants::MODE_SESSION));
mode->setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Project.png")));
mode->setPriority(Constants::P_MODE_SESSION);
mode->setWidget(d->m_proWindow);
mode->setContext(QList<int>() << pecontext);
addAutoReleasedObject(mode);
d->m_projectsMode = new Core::BaseMode;
d->m_projectsMode->setDisplayName(tr("Projects"));
d->m_projectsMode->setId(QLatin1String(Constants::MODE_SESSION));
d->m_projectsMode->setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Project.png")));
d->m_projectsMode->setPriority(Constants::P_MODE_SESSION);
d->m_projectsMode->setWidget(d->m_proWindow);
d->m_projectsMode->setContext(QList<int>() << pecontext);
d->m_projectsMode->setEnabled(session()->startupProject());
addAutoReleasedObject(d->m_projectsMode);
d->m_proWindow->layout()->addWidget(new Core::FindToolBarPlaceHolder(d->m_proWindow));
d->m_buildManager = new BuildManager(this);
......@@ -902,6 +906,7 @@ void ProjectExplorerPlugin::shutdown()
{
d->m_proWindow->shutdown(); // disconnect from session
d->m_session->clear();
d->m_projectsMode = 0;
// d->m_proWindow->saveConfigChanges();
}
......@@ -1669,6 +1674,9 @@ void ProjectExplorerPlugin::startupProjectChanged()
if (project == previousStartupProject)
return;
if (d->m_projectsMode)
d->m_projectsMode->setEnabled(project);
if (previousStartupProject) {
disconnect(previousStartupProject, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
this, SLOT(updateRunActions()));
......
......@@ -232,24 +232,6 @@ ProjectWindow::ProjectWindow(QWidget *parent)
m_centralWidget = new QStackedWidget(this);
viewLayout->addWidget(m_centralWidget);
// no projects label:
m_noprojectLabel = new QWidget;
QVBoxLayout *noprojectLayout = new QVBoxLayout;
noprojectLayout->setMargin(0);
QLabel *label = new QLabel(m_noprojectLabel);
label->setText(tr("No project loaded."));
{
QFont f = label->font();
f.setPointSizeF(f.pointSizeF() * 1.4);
f.setBold(true);
label->setFont(f);
}
label->setMargin(10);
label->setAlignment(Qt::AlignTop);
noprojectLayout->addWidget(label);
noprojectLayout->addStretch(10);
m_centralWidget->addWidget(m_noprojectLabel);
// connects:
connect(m_tabWidget, SIGNAL(currentIndexChanged(int,int)),
this, SLOT(showProperties(int,int)));
......@@ -314,11 +296,9 @@ void ProjectWindow::saveStatus()
void ProjectWindow::showProperties(int index, int subIndex)
{
if (index < 0) {
m_centralWidget->setCurrentWidget(m_noprojectLabel);
removeCurrentWidget();
if (index < 0 || index >= m_tabIndexToProject.count())
return;
}
Project *project = m_tabIndexToProject.at(index);
// Set up custom panels again:
......
......@@ -97,7 +97,6 @@ private:
void removeCurrentWidget();
DoubleTabWidget *m_tabWidget;
QWidget *m_noprojectLabel;
QStackedWidget *m_centralWidget;
QWidget *m_currentWidget;
IPropertiesPanel *m_currentPanel;
......
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