summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorDaniel Teske <daniel.teske@nokia.com>2011-10-28 10:15:04 +0000
committerhjk <qthjk@ovi.com>2012-02-03 09:36:46 +0100
commite3d14f7c3982f8007fd885a94ad78b47fc9b0acf (patch)
tree3081c0e1cd6b43b27d8a8e3cc8c20fde30b55d84 /src/plugins
parenta309c26f1bb76fc1a55faf109d18289e96a2fffa (diff)
downloadqt-creator-e3d14f7c3982f8007fd885a94ad78b47fc9b0acf.tar.gz
Make Open Project wizard skippable
Task-Nr: QTCREATORBUG-6063 Change-Id: Ieace3e9e68b4e0342c35ac7c279f4b0b61076419 Reviewed-by: Eike Ziller <eike.ziller@nokia.com> Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp7
-rw-r--r--src/plugins/projectexplorer/buildmanager.cpp8
-rw-r--r--src/plugins/projectexplorer/buildmanager.h5
-rw-r--r--src/plugins/projectexplorer/buildsettingspropertiespage.cpp5
-rw-r--r--src/plugins/projectexplorer/buildsettingspropertiespage.h1
-rw-r--r--src/plugins/projectexplorer/codestylesettingspropertiespage.cpp5
-rw-r--r--src/plugins/projectexplorer/codestylesettingspropertiespage.h1
-rw-r--r--src/plugins/projectexplorer/dependenciespanel.cpp5
-rw-r--r--src/plugins/projectexplorer/dependenciespanel.h1
-rw-r--r--src/plugins/projectexplorer/editorsettingspropertiespage.cpp5
-rw-r--r--src/plugins/projectexplorer/editorsettingspropertiespage.h1
-rw-r--r--src/plugins/projectexplorer/images/unconfigured.pngbin0 -> 1696 bytes
-rw-r--r--src/plugins/projectexplorer/iprojectproperties.h6
-rw-r--r--src/plugins/projectexplorer/miniprojecttargetselector.cpp83
-rw-r--r--src/plugins/projectexplorer/miniprojecttargetselector.h2
-rw-r--r--src/plugins/projectexplorer/project.cpp5
-rw-r--r--src/plugins/projectexplorer/project.h2
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp40
-rw-r--r--src/plugins/projectexplorer/projectexplorer.qrc1
-rw-r--r--src/plugins/projectexplorer/projectwindow.cpp43
-rw-r--r--src/plugins/projectexplorer/projectwindow.h1
-rw-r--r--src/plugins/projectexplorer/runsettingspropertiespage.cpp5
-rw-r--r--src/plugins/projectexplorer/runsettingspropertiespage.h1
-rw-r--r--src/plugins/qt4projectmanager/librarydetailscontroller.cpp5
-rw-r--r--src/plugins/qt4projectmanager/projectloadwizard.cpp92
-rw-r--r--src/plugins/qt4projectmanager/qt4nodes.cpp12
-rw-r--r--src/plugins/qt4projectmanager/qt4project.cpp146
-rw-r--r--src/plugins/qt4projectmanager/qt4project.h5
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanager.cpp73
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanager.h19
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanager.pro10
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanagerconstants.h7
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp72
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanagerplugin.h9
-rw-r--r--src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp27
-rw-r--r--src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp195
-rw-r--r--src/plugins/qt4projectmanager/unconfiguredprojectpanel.h (renamed from src/plugins/qt4projectmanager/projectloadwizard.h)45
-rw-r--r--src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.cpp171
-rw-r--r--src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.h81
-rw-r--r--src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp58
-rw-r--r--src/plugins/qt4projectmanager/wizards/targetsetuppage.h13
-rw-r--r--src/plugins/qt4projectmanager/wizards/targetsetuppage.ui139
-rw-r--r--src/plugins/qtsupport/qtversionmanager.h1
43 files changed, 1106 insertions, 307 deletions
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 34501726e5..c80ce35abd 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1484,9 +1484,10 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
RunConfiguration *activeRc = 0;
if (project) {
Target *target = project->activeTarget();
- QTC_ASSERT(target, return);
- activeRc = target->activeRunConfiguration();
- QTC_CHECK(activeRc);
+ if (target)
+ activeRc = target->activeRunConfiguration();
+ if (!activeRc)
+ return;
}
for (int i = 0, n = m_snapshotHandler->size(); i != n; ++i) {
// Run controls might be deleted during exit.
diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp
index a614271f10..d466219939 100644
--- a/src/plugins/projectexplorer/buildmanager.cpp
+++ b/src/plugins/projectexplorer/buildmanager.cpp
@@ -314,7 +314,7 @@ bool BuildManager::tasksAvailable() const
return count > 0;
}
-void BuildManager::startBuildQueue()
+void BuildManager::startBuildQueue(const QStringList &preambleMessage)
{
if (d->m_buildQueue.isEmpty()) {
emit buildQueueFinished(true);
@@ -326,6 +326,8 @@ void BuildManager::startBuildQueue()
d->m_progressFutureInterface = new QFutureInterface<void>;
d->m_progressWatcher.setFuture(d->m_progressFutureInterface->future());
d->m_outputWindow->clearContents();
+ foreach (const QString &str, preambleMessage)
+ addToOutputWindow(str, BuildStep::MessageOutput, BuildStep::DontAppendNewline);
d->m_taskHub->clearTasks(Core::Id(Constants::TASK_CATEGORY_COMPILE));
d->m_taskHub->clearTasks(Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
progressManager->setApplicationLabel(QString());
@@ -537,7 +539,7 @@ bool BuildManager::buildList(BuildStepList *bsl, const QString &stepListName)
return buildLists(QList<BuildStepList *>() << bsl, QStringList() << stepListName);
}
-bool BuildManager::buildLists(QList<BuildStepList *> bsls, const QStringList &stepListNames)
+bool BuildManager::buildLists(QList<BuildStepList *> bsls, const QStringList &stepListNames, const QStringList &preambelMessage)
{
QList<BuildStep *> steps;
foreach(BuildStepList *list, bsls)
@@ -559,7 +561,7 @@ bool BuildManager::buildLists(QList<BuildStepList *> bsls, const QStringList &st
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
d->m_outputWindow->popup(false);
- startBuildQueue();
+ startBuildQueue(preambelMessage);
return true;
}
diff --git a/src/plugins/projectexplorer/buildmanager.h b/src/plugins/projectexplorer/buildmanager.h
index f4c98450d5..572609ef13 100644
--- a/src/plugins/projectexplorer/buildmanager.h
+++ b/src/plugins/projectexplorer/buildmanager.h
@@ -60,7 +60,8 @@ public:
bool tasksAvailable() const;
- bool buildLists(QList<BuildStepList *> bsls, const QStringList &stepListNames);
+ bool buildLists(QList<BuildStepList *> bsls, const QStringList &stepListNames,
+ const QStringList &preambelMessage = QStringList());
bool buildList(BuildStepList *bsl, const QString &stepListName);
bool isBuilding(Project *p);
@@ -103,7 +104,7 @@ private slots:
void finish();
private:
- void startBuildQueue();
+ void startBuildQueue(const QStringList &preambleMessage = QStringList());
void nextStep();
void clearBuildQueue();
bool buildQueueAppend(QList<BuildStep *> steps, QStringList names);
diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
index c9ad2820fd..7b609fcfaa 100644
--- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
@@ -73,6 +73,11 @@ QString BuildSettingsPanelFactory::displayName() const
return QCoreApplication::translate("BuildSettingsPanelFactory", "Build Settings");
}
+int BuildSettingsPanelFactory::priority() const
+{
+ return 10;
+}
+
bool BuildSettingsPanelFactory::supports(Target *target)
{
return target->buildConfigurationFactory();
diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.h b/src/plugins/projectexplorer/buildsettingspropertiespage.h
index 7532b113a2..5899bae2cf 100644
--- a/src/plugins/projectexplorer/buildsettingspropertiespage.h
+++ b/src/plugins/projectexplorer/buildsettingspropertiespage.h
@@ -60,6 +60,7 @@ class BuildSettingsPanelFactory : public ITargetPanelFactory
public:
QString id() const;
QString displayName() const;
+ int priority() const;
bool supports(Target *target);
PropertiesPanel *createPanel(Target *target);
diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp
index 2162d1fe9e..7d2d5f5e2c 100644
--- a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp
@@ -53,6 +53,11 @@ QString CodeStyleSettingsPanelFactory::displayName() const
return QCoreApplication::translate("CodeStyleSettingsPanelFactory", "Code Style Settings");
}
+int CodeStyleSettingsPanelFactory::priority() const
+{
+ return 40;
+}
+
bool CodeStyleSettingsPanelFactory::supports(Project *project)
{
Q_UNUSED(project);
diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.h b/src/plugins/projectexplorer/codestylesettingspropertiespage.h
index a14e11c719..a032db042e 100644
--- a/src/plugins/projectexplorer/codestylesettingspropertiespage.h
+++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.h
@@ -49,6 +49,7 @@ class CodeStyleSettingsPanelFactory : public IProjectPanelFactory
public:
QString id() const;
QString displayName() const;
+ int priority() const;
PropertiesPanel *createPanel(Project *project);
bool supports(Project *project);
};
diff --git a/src/plugins/projectexplorer/dependenciespanel.cpp b/src/plugins/projectexplorer/dependenciespanel.cpp
index 40a251ed91..754b5a0858 100644
--- a/src/plugins/projectexplorer/dependenciespanel.cpp
+++ b/src/plugins/projectexplorer/dependenciespanel.cpp
@@ -275,6 +275,11 @@ QString DependenciesPanelFactory::displayName() const
return QCoreApplication::translate("DependenciesPanelFactory", "Dependencies");
}
+int DependenciesPanelFactory::priority() const
+{
+ return 50;
+}
+
bool DependenciesPanelFactory::supports(Project *project)
{
Q_UNUSED(project);
diff --git a/src/plugins/projectexplorer/dependenciespanel.h b/src/plugins/projectexplorer/dependenciespanel.h
index a000e570e9..3cccd98d13 100644
--- a/src/plugins/projectexplorer/dependenciespanel.h
+++ b/src/plugins/projectexplorer/dependenciespanel.h
@@ -61,6 +61,7 @@ public:
QString id() const;
QString displayName() const;
+ int priority() const;
bool supports(Project *project);
PropertiesPanel *createPanel(Project *project);
private:
diff --git a/src/plugins/projectexplorer/editorsettingspropertiespage.cpp b/src/plugins/projectexplorer/editorsettingspropertiespage.cpp
index e048cb2b01..ec5f9e2e2d 100644
--- a/src/plugins/projectexplorer/editorsettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/editorsettingspropertiespage.cpp
@@ -49,6 +49,11 @@ QString EditorSettingsPanelFactory::displayName() const
return QCoreApplication::translate("EditorSettingsPanelFactory", "Editor Settings");
}
+int EditorSettingsPanelFactory::priority() const
+{
+ return 30;
+}
+
bool EditorSettingsPanelFactory::supports(Project *project)
{
Q_UNUSED(project);
diff --git a/src/plugins/projectexplorer/editorsettingspropertiespage.h b/src/plugins/projectexplorer/editorsettingspropertiespage.h
index cf3d626f52..fedd6f521e 100644
--- a/src/plugins/projectexplorer/editorsettingspropertiespage.h
+++ b/src/plugins/projectexplorer/editorsettingspropertiespage.h
@@ -49,6 +49,7 @@ class EditorSettingsPanelFactory : public IProjectPanelFactory
public:
QString id() const;
QString displayName() const;
+ int priority() const;
PropertiesPanel *createPanel(Project *project);
bool supports(Project *project);
};
diff --git a/src/plugins/projectexplorer/images/unconfigured.png b/src/plugins/projectexplorer/images/unconfigured.png
new file mode 100644
index 0000000000..7966af8d21
--- /dev/null
+++ b/src/plugins/projectexplorer/images/unconfigured.png
Binary files differ
diff --git a/src/plugins/projectexplorer/iprojectproperties.h b/src/plugins/projectexplorer/iprojectproperties.h
index 3be8d4bf10..d78f630551 100644
--- a/src/plugins/projectexplorer/iprojectproperties.h
+++ b/src/plugins/projectexplorer/iprojectproperties.h
@@ -75,6 +75,10 @@ class PROJECTEXPLORER_EXPORT IPanelFactory : public QObject
public:
virtual QString id() const = 0;
virtual QString displayName() const = 0;
+ virtual int priority() const = 0;
+ static bool prioritySort(IPanelFactory *a, IPanelFactory *b)
+ { return (a->priority() == b->priority() && a->id() < b->id())
+ || a->priority() < b->priority(); }
};
class PROJECTEXPLORER_EXPORT IProjectPanelFactory : public IPanelFactory
@@ -83,6 +87,8 @@ class PROJECTEXPLORER_EXPORT IProjectPanelFactory : public IPanelFactory
public:
virtual bool supports(Project *project) = 0;
virtual PropertiesPanel *createPanel(Project *project) = 0;
+signals:
+ void projectUpdated(ProjectExplorer::Project *project);
};
class PROJECTEXPLORER_EXPORT ITargetPanelFactory : public IPanelFactory
diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp
index f4ce6dea35..8608c5b780 100644
--- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp
+++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp
@@ -40,6 +40,7 @@
#include <coreplugin/ifile.h>
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
+#include <coreplugin/modemanager.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
@@ -487,6 +488,8 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi
m_summaryLabel->setMargin(3);
m_summaryLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
m_summaryLabel->setStyleSheet(QString::fromLatin1("background: #464646;"));
+ m_summaryLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ m_summaryLabel->setTextInteractionFlags(m_summaryLabel->textInteractionFlags() | Qt::LinksAccessibleByMouse);
grid->addWidget(m_summaryLabel, 0, 0, 1, 2 * LAST - 1);
@@ -519,6 +522,9 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi
if (m_sessionManager->startupProject())
activeTargetChanged(m_sessionManager->startupProject()->activeTarget());
+ connect(m_summaryLabel, SIGNAL(linkActivated(QString)),
+ this, SLOT(switchToProjectsMode()));
+
connect(m_sessionManager, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
this, SLOT(changeStartupProject(ProjectExplorer::Project*)));
@@ -994,6 +1000,7 @@ QSize MiniProjectTargetSelector::sizeHint() const
static QWidget *actionBar = Core::ICore::mainWindow()->findChild<QWidget*>(QLatin1String("actionbar"));
Q_ASSERT(actionBar);
+ // At least the size of the actionbar
int alignedWithActionHeight
= actionBar->height() - statusBar->height();
QSize s = QWidget::sizeHint();
@@ -1057,23 +1064,55 @@ void MiniProjectTargetSelector::updateActionAndSummary()
}
}
m_projectAction->setProperty("heading", projectName);
- m_projectAction->setProperty("subtitle", buildConfig);
+ if (project && project->needsConfiguration()) {
+ m_projectAction->setProperty("subtitle", tr("Unconfigured"));
+ } else {
+ m_projectAction->setProperty("subtitle", buildConfig);
+ }
m_projectAction->setIcon(targetIcon);
- QString targetTip = targetName.isEmpty() ? QLatin1String("")
- : tr("<b>Target:</b> %1<br/>").arg(targetName);
- QString buildTip = buildConfig.isEmpty() ? QLatin1String("")
- : tr("<b>Build:</b> %1<br/>").arg(buildConfig);
- QString deployTip = deployConfig.isEmpty() ? QLatin1String("")
- : tr("<b>Deploy:</b> %1<br/>").arg(deployConfig);
- QString targetToolTip = targetToolTipText.isEmpty() ? QLatin1String("")
- : tr("<br/>%1").arg(targetToolTipText);
- QString toolTip = tr("<html><nobr><b>Project:</b> %1<br/>%2%3%4<b>Run:</b> %5%6</html>");
- m_projectAction->setToolTip(toolTip.arg(projectName, targetTip, buildTip, deployTip, runConfig, targetToolTip));
+ QStringList lines;
+ lines << tr("<b>Project:</b> %1").arg(projectName);
+ if (!targetName.isEmpty())
+ lines << tr("<b>Target:</b> %1").arg(targetName);
+ if (!buildConfig.isEmpty())
+ lines << tr("<b>Build:</b> %1").arg(buildConfig);
+ if (!deployConfig.isEmpty())
+ lines << tr("<b>Deploy:</b> %1").arg(deployConfig);
+ if (!runConfig.isEmpty())
+ lines << tr("<b>Run:</b> %1").arg(runConfig);
+ if (!targetToolTipText.isEmpty())
+ lines << tr("%1").arg(targetToolTipText);
+ QString toolTip = tr("<html><nobr>%1</html>")
+ .arg(lines.join(QLatin1String("<br/>")));
+ m_projectAction->setToolTip(toolTip);
updateSummary();
}
void MiniProjectTargetSelector::updateSummary()
{
+ // Count the number of lines
+ int visibleLineCount = m_projectListWidget->isVisibleTo(this) ? 0 : 1;
+ for (int i = TARGET; i < LAST; ++i)
+ visibleLineCount += m_listWidgets[i]->isVisibleTo(this) ? 0 : 1;
+
+ if (visibleLineCount == LAST) {
+ m_summaryLabel->setMinimumHeight(0);
+ m_summaryLabel->setMaximumHeight(800);
+ } else {
+ if (visibleLineCount < 3) {
+ foreach (Project *p, m_sessionManager->projects()) {
+ if (p->needsConfiguration()) {
+ visibleLineCount = 3;
+ break;
+ }
+ }
+ }
+
+ int height = visibleLineCount * QFontMetrics(m_summaryLabel->font()).height() + m_summaryLabel->margin() *2;
+ m_summaryLabel->setMinimumHeight(height);
+ m_summaryLabel->setMaximumHeight(height);
+ }
+
QString summary;
if (Project *startupProject = m_sessionManager->startupProject()) {
if (!m_projectListWidget->isVisibleTo(this))
@@ -1090,10 +1129,24 @@ void MiniProjectTargetSelector::updateSummary()
if (!m_listWidgets[RUN]->isVisibleTo(this) && activeTarget->activeRunConfiguration())
summary.append(tr("Run: <b>%1</b><br/>").arg(
activeTarget->activeRunConfiguration()->displayName()));
+ } else if (startupProject->needsConfiguration()) {
+ summary = tr("<style type=text/css>"
+ "a:link {color: rgb(128, 128, 255, 240);}</style>"
+ "The project <b>%1</b> is not yet configured<br/><br/>"
+ "You can configure it in the <a href=\"projectmode\">Projects mode</a><br/>")
+ .arg(startupProject->displayName());
+ } else {
+ if (!m_listWidgets[TARGET]->isVisibleTo(this))
+ summary.append("<br/>");
+ if (!m_listWidgets[BUILD]->isVisibleTo(this))
+ summary.append("<br/>");
+ if (!m_listWidgets[DEPLOY]->isVisibleTo(this))
+ summary.append("<br/>");
+ if (!m_listWidgets[RUN]->isVisibleTo(this))
+ summary.append("<br/>");
}
}
m_summaryLabel->setText(summary);
-
}
void MiniProjectTargetSelector::paintEvent(QPaintEvent *)
@@ -1107,3 +1160,9 @@ void MiniProjectTargetSelector::paintEvent(QPaintEvent *)
static QImage image(QLatin1String(":/projectexplorer/images/targetpanel_bottom.png"));
Utils::StyleHelper::drawCornerImage(image, &painter, bottomRect, 1, 1, 1, 1);
}
+
+void MiniProjectTargetSelector::switchToProjectsMode()
+{
+ Core::ICore::instance()->modeManager()->activateMode(Constants::MODE_SESSION);
+ hide();
+}
diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.h b/src/plugins/projectexplorer/miniprojecttargetselector.h
index 8965287447..b370ed4abe 100644
--- a/src/plugins/projectexplorer/miniprojecttargetselector.h
+++ b/src/plugins/projectexplorer/miniprojecttargetselector.h
@@ -54,7 +54,6 @@ class SessionManager;
namespace Internal {
// helper classes
-
class ListWidget : public QListWidget
{
Q_OBJECT
@@ -144,6 +143,7 @@ private slots:
void delayedHide();
void updateActionAndSummary();
+ void switchToProjectsMode();
private:
void updateProjectListVisible();
void updateTargetListVisible();
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index d0fda764ac..ce9dfbef9f 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -383,4 +383,9 @@ void Project::setNamedSettings(const QString &name, QVariant &value)
d->m_pluginSettings.insert(name, value);
}
+bool Project::needsConfiguration() const
+{
+ return false;
+}
+
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h
index d31d106956..7e5b977b54 100644
--- a/src/plugins/projectexplorer/project.h
+++ b/src/plugins/projectexplorer/project.h
@@ -117,6 +117,8 @@ public:
QVariant namedSettings(const QString &name) const;
void setNamedSettings(const QString &name, QVariant &value);
+ virtual bool needsConfiguration() const;
+
signals:
void fileListChanged();
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 474834bb46..2262a5289b 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -1340,8 +1340,21 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
}
updateActions();
- if (!openedPro.isEmpty())
- Core::ModeManager::activateMode(QLatin1String(Core::Constants::MODE_EDIT));
+ bool switchToProjectsMode = false;
+ foreach (Project *p, openedPro) {
+ if (p->needsConfiguration()) {
+ switchToProjectsMode = true;
+ break;
+ }
+ }
+
+ if (!openedPro.isEmpty()) {
+ if (switchToProjectsMode)
+ Core::ModeManager::activateMode(QLatin1String(ProjectExplorer::Constants::MODE_SESSION));
+ else
+ Core::ModeManager::activateMode(QLatin1String(Core::Constants::MODE_EDIT));
+ Core::ModeManager::setFocusToCurrentMode();
+ }
return openedPro;
}
@@ -1812,6 +1825,12 @@ int ProjectExplorerPlugin::queue(QList<Project *> projects, QStringList stepIds)
QList<BuildStepList *> stepLists;
QStringList names;
+ QStringList preambleMessage;
+
+ foreach (Project *pro, projects)
+ if (pro && pro->needsConfiguration())
+ preambleMessage.append(tr("The project %1 is not configured, skipping it.\n")
+ .arg(pro->displayName()));
foreach (const QString id, stepIds) {
foreach (Project *pro, projects) {
if (!pro || !pro->activeTarget())
@@ -1833,7 +1852,7 @@ int ProjectExplorerPlugin::queue(QList<Project *> projects, QStringList stepIds)
if (stepLists.isEmpty())
return 0;
- if (!d->m_buildManager->buildLists(stepLists, names))
+ if (!d->m_buildManager->buildLists(stepLists, names, preambleMessage))
return -1;
return stepLists.count();
}
@@ -1982,6 +2001,9 @@ QPair<bool, QString> ProjectExplorerPlugin::buildSettingsEnabled(Project *pro)
} else if (d->m_buildManager->isBuilding(pro)) {
result.first = false;
result.second = tr("Currently building the active project.");
+ } else if (pro->needsConfiguration()) {
+ result.first = false;
+ result.second = tr("The project %1 is not configured.").arg(pro->displayName());
} else if (!hasBuildSettings(pro)) {
result.first = false;
result.second = tr("Project has no build settings.");
@@ -2055,8 +2077,9 @@ bool ProjectExplorerPlugin::hasDeploySettings(Project *pro)
{
const QList<Project *> & projects = d->m_session->projectOrder(pro);
foreach(Project *project, projects)
- if (project->activeTarget()->activeDeployConfiguration() &&
- !project->activeTarget()->activeDeployConfiguration()->stepList()->isEmpty())
+ if (project->activeTarget()
+ && project->activeTarget()->activeDeployConfiguration()
+ && !project->activeTarget()->activeDeployConfiguration()->stepList()->isEmpty())
return true;
return false;
}
@@ -2066,7 +2089,9 @@ void ProjectExplorerPlugin::runProject(Project *pro, RunMode mode, const bool fo
if (!pro)
return;
- runRunConfiguration(pro->activeTarget()->activeRunConfiguration(), mode, forceSkipDeploy);
+ if (Target *target = pro->activeTarget())
+ if (RunConfiguration *rc = target->activeRunConfiguration())
+ runRunConfiguration(rc, mode, forceSkipDeploy);
}
void ProjectExplorerPlugin::runRunConfiguration(ProjectExplorer::RunConfiguration *rc,
@@ -2285,6 +2310,9 @@ QString ProjectExplorerPlugin::cannotRunReason(Project *project, RunMode runMode
if (!project)
return tr("No active project.");
+ if (project->needsConfiguration())
+ return tr("The project %1 is not configured.").arg(project->displayName());
+
if (!project->activeTarget())
return tr("The project '%1' has no active target.").arg(project->displayName());
diff --git a/src/plugins/projectexplorer/projectexplorer.qrc b/src/plugins/projectexplorer/projectexplorer.qrc
index a4b8daf4f7..8ece0bc962 100644
--- a/src/plugins/projectexplorer/projectexplorer.qrc
+++ b/src/plugins/projectexplorer/projectexplorer.qrc
@@ -41,5 +41,6 @@
<file>images/window.png</file>
<file>images/stop_small.png</file>
<file>images/disabledbuildstep.png</file>
+ <file>images/unconfigured.png</file>
</qresource>
</RCC>
diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp
index 5e904e8691..4192180396 100644
--- a/src/plugins/projectexplorer/projectwindow.cpp
+++ b/src/plugins/projectexplorer/projectwindow.cpp
@@ -142,6 +142,7 @@ PanelsWidget::PanelsWidget(QWidget *parent) :
setWidget(m_root);
setFrameStyle(QFrame::NoFrame);
setWidgetResizable(true);
+ setFocusPolicy(Qt::NoFocus);
}
PanelsWidget::~PanelsWidget()
@@ -263,6 +264,12 @@ void ProjectWindow::extensionsInitialized()
connect(fac, SIGNAL(supportedTargetIdsChanged()),
this, SLOT(targetFactoriesChanged()));
+ QList<IProjectPanelFactory *> list = ExtensionSystem::PluginManager::instance()->getObjects<IProjectPanelFactory>();
+ qSort(list.begin(), list.end(), &IPanelFactory::prioritySort);
+ foreach (IProjectPanelFactory *fac, list)
+ connect (fac, SIGNAL(projectUpdated(ProjectExplorer::Project *)),
+ this, SLOT(projectUpdated(ProjectExplorer::Project *)));
+
}
void ProjectWindow::aboutToShutdown()
@@ -272,6 +279,15 @@ void ProjectWindow::aboutToShutdown()
disconnect(ProjectExplorerPlugin::instance()->session(), 0, this, 0);
}
+void ProjectWindow::projectUpdated(Project *p)
+{
+ // Called after a project was configured
+ int index = m_tabWidget->currentIndex();
+ deregisterProject(p);
+ registerProject(p);
+ m_tabWidget->setCurrentIndex(index);
+}
+
void ProjectWindow::targetFactoriesChanged()
{
bool changed = false;
@@ -290,6 +306,8 @@ void ProjectWindow::targetFactoriesChanged()
bool ProjectWindow::useTargetPage(ProjectExplorer::Project *project)
{
+ if (project->targets().isEmpty())
+ return false;
if (project->targets().size() > 1)
return true;
QStringList tmp;
@@ -323,12 +341,15 @@ void ProjectWindow::registerProject(ProjectExplorer::Project *project)
if (!usesTargetPage){
// Show the target specific pages directly
- QList<ITargetPanelFactory *> factories =
- ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>();
+ if (project->activeTarget()) {
+ QList<ITargetPanelFactory *> factories =
+ ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>();
+
+ qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort);
- foreach (ITargetPanelFactory *factory, factories) {
- if (factory->supports(project->activeTarget()))
- subtabs << factory->displayName();
+ foreach (ITargetPanelFactory *factory, factories)
+ if (factory->supports(project->activeTarget()))
+ subtabs << factory->displayName();
}
} else {
// Use the Targets page
@@ -336,8 +357,8 @@ void ProjectWindow::registerProject(ProjectExplorer::Project *project)
}
// Add the project specific pages
-
QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IProjectPanelFactory>();
+ qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort);
foreach (IProjectPanelFactory *panelFactory, factories) {
if (panelFactory->supports(project))
subtabs << panelFactory->displayName();
@@ -404,9 +425,11 @@ void ProjectWindow::showProperties(int index, int subIndex)
m_centralWidget->setCurrentWidget(m_currentWidget);
}
++pos;
- } else {
+ } else if (project->activeTarget()) {
// No Targets page, target specific pages are first in the list
- foreach (ITargetPanelFactory *panelFactory, ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>()) {
+ QList<ITargetPanelFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>();
+ qSort(factories.begin(), factories.end(), &ITargetPanelFactory::prioritySort);
+ foreach (ITargetPanelFactory *panelFactory, factories) {
if (panelFactory->supports(project->activeTarget())) {
if (subIndex == pos) {
fac = panelFactory;
@@ -418,7 +441,9 @@ void ProjectWindow::showProperties(int index, int subIndex)
}
if (!fac) {
- foreach (IProjectPanelFactory *panelFactory, ExtensionSystem::PluginManager::instance()->getObjects<IProjectPanelFactory>()) {
+ QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IProjectPanelFactory>();
+ qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort);
+ foreach (IProjectPanelFactory *panelFactory, factories) {
if (panelFactory->supports(project)) {
if (subIndex == pos) {
fac = panelFactory;
diff --git a/src/plugins/projectexplorer/projectwindow.h b/src/plugins/projectexplorer/projectwindow.h
index 41a09d37dd..1cf711e87e 100644
--- a/src/plugins/projectexplorer/projectwindow.h
+++ b/src/plugins/projectexplorer/projectwindow.h
@@ -90,6 +90,7 @@ private slots:
void registerProject(ProjectExplorer::Project*);
void deregisterProject(ProjectExplorer::Project*);
void startupProjectChanged(ProjectExplorer::Project *);
+ void projectUpdated(ProjectExplorer::Project *p);
private:
bool useTargetPage(ProjectExplorer::Project *project);
diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp
index a40521b160..de5ae10b7e 100644
--- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp
@@ -94,6 +94,11 @@ QString RunSettingsPanelFactory::displayName() const
return RunSettingsWidget::tr("Run Settings");
}
+int RunSettingsPanelFactory::priority() const
+{
+ return 20;
+}
+
bool RunSettingsPanelFactory::supports(Target *target)
{
Q_UNUSED(target);
diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.h b/src/plugins/projectexplorer/runsettingspropertiespage.h
index 1d79feef4e..aa897947d0 100644
--- a/src/plugins/projectexplorer/runsettingspropertiespage.h
+++ b/src/plugins/projectexplorer/runsettingspropertiespage.h
@@ -67,6 +67,7 @@ class RunSettingsPanelFactory : public ITargetPanelFactory
public:
QString id() const;
QString displayName() const;
+ int priority() const;
bool supports(Target *target);
PropertiesPanel *createPanel(Target *target);
};
diff --git a/src/plugins/qt4projectmanager/librarydetailscontroller.cpp b/src/plugins/qt4projectmanager/librarydetailscontroller.cpp
index c68d3e7ffb..ba1e1d68b0 100644
--- a/src/plugins/qt4projectmanager/librarydetailscontroller.cpp
+++ b/src/plugins/qt4projectmanager/librarydetailscontroller.cpp
@@ -1080,7 +1080,10 @@ QString InternalLibraryDetailsController::snippet() const
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForFile(proFile());
// the build directory of the active build configuration
- QDir rootBuildDir(project->activeTarget()->activeBuildConfiguration()->buildDirectory());
+ QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir
+ if (ProjectExplorer::Target *t = project->activeTarget())
+ if (ProjectExplorer::BuildConfiguration *bc = t->activeBuildConfiguration())
+ rootBuildDir = bc->buildDirectory();
// the project for which we insert the snippet inside build tree
QFileInfo pfi(rootBuildDir.filePath(proRelavitePath));
diff --git a/src/plugins/qt4projectmanager/projectloadwizard.cpp b/src/plugins/qt4projectmanager/projectloadwizard.cpp
deleted file mode 100644
index 7534bbf1a5..0000000000
--- a/src/plugins/qt4projectmanager/projectloadwizard.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "projectloadwizard.h"
-#include "wizards/targetsetuppage.h"
-#include "qt4project.h"
-
-#include <coreplugin/ifile.h>
-
-#include <QtGui/QCheckBox>
-#include <QtGui/QHeaderView>
-#include <QtGui/QLabel>
-#include <QtGui/QVBoxLayout>
-#include <QtGui/QWizardPage>
-#include <QtGui/QApplication>
-
-using namespace Qt4ProjectManager;
-using namespace Qt4ProjectManager::Internal;
-
-ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::WindowFlags flags)
- : QWizard(parent, flags), m_project(project), m_targetSetupPage(0)
-{
- Q_ASSERT(project);
-
- setWindowTitle(tr("Project Setup"));
-
- m_targetSetupPage = new TargetSetupPage(this);
- m_targetSetupPage->setProFilePath(m_project->file()->fileName());
- m_targetSetupPage->setImportSearch(true);
- resize(900, 450);
-
- addPage(m_targetSetupPage);
-
- setOption(QWizard::NoCancelButton, false);
- setOption(QWizard::NoDefaultButton, false);
- setOption(QWizard::NoBackButtonOnLastPage, true);
-#ifdef Q_OS_MAC
- setButtonLayout(QList<QWizard::WizardButton>()
- << QWizard::CancelButton
- << QWizard::Stretch
- << QWizard::BackButton
- << QWizard::NextButton
- << QWizard::CommitButton
- << QWizard::FinishButton);
-#endif
-}
-
-ProjectLoadWizard::~ProjectLoadWizard()
-{
-}
-
-void ProjectLoadWizard::done(int result)
-{
- QWizard::done(result);
-
- if (result == Accepted)
- applySettings();
-}
-
-void ProjectLoadWizard::applySettings()
-{
- m_targetSetupPage->setupProject(m_project);
-}
diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp
index efb15b6e85..677f6d5b63 100644
--- a/src/plugins/qt4projectmanager/qt4nodes.cpp
+++ b/src/plugins/qt4projectmanager/qt4nodes.cpp
@@ -774,7 +774,10 @@ bool Qt4PriFileNode::deploysFolder(const QString &folder) const
QList<ProjectExplorer::RunConfiguration *> Qt4PriFileNode::runConfigurationsFor(Node *node)
{
- return m_project->activeTarget()->runConfigurationsForNode(node);
+ Qt4BaseTarget *target = m_project->activeTarget();
+ if (target)
+ return target->runConfigurationsForNode(node);
+ return QList<ProjectExplorer::RunConfiguration *>();
}
QList<Qt4PriFileNode *> Qt4PriFileNode::subProjectNodesExact() const
@@ -854,7 +857,9 @@ QList<ProjectNode::ProjectAction> Qt4PriFileNode::supportedActions(Node *node) c
if (fileNode && fileNode->fileType() != ProjectExplorer::ProjectFileType)
actions << Rename;
- if (!m_project->activeTarget()->runConfigurationsForNode(node).isEmpty())
+
+ Qt4BaseTarget *target = m_project->activeTarget();
+ if (target && !target->runConfigurationsForNode(node).isEmpty())
actions << HasSubProjectRunConfigurations;
return actions;
@@ -2132,7 +2137,8 @@ TargetInformation Qt4ProFileNode::targetInformation(QtSupport::ProFileReader *re
// Hmm can we find out whether it's debug or release in a saner way?
// Theoretically it's in CONFIG
QString qmakeBuildConfig = QLatin1String("release");
- if (m_project->activeTarget()->activeQt4BuildConfiguration()->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild)
+ Qt4BaseTarget *target = m_project->activeTarget();
+ if (!target || target->activeQt4BuildConfiguration()->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild)
qmakeBuildConfig = QLatin1String("debug");
wd += QLatin1Char('/') + qmakeBuildConfig;
}
diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp
index d1b09049f1..00f73222c0 100644
--- a/src/plugins/qt4projectmanager/qt4project.cpp
+++ b/src/plugins/qt4projectmanager/qt4project.cpp
@@ -39,7 +39,6 @@
#include "qt4nodes.h"
#include "qt4projectconfigwidget.h"
#include "qt4projectmanagerconstants.h"
-#include "projectloadwizard.h"
#include "qt4buildconfiguration.h"
#include "findqt4profiles.h"
@@ -64,6 +63,8 @@
#include <qtsupport/baseqtversion.h>
#include <qtsupport/profilereader.h>
#include <qtsupport/qtsupportconstants.h>
+#include <qtsupport/qtversionmanager.h>
+#include <qtconcurrent/QtConcurrentTools>
#include <QtCore/QDebug>
#include <QtCore/QDir>
@@ -379,20 +380,6 @@ bool Qt4Project::fromMap(const QVariantMap &map)
}
}
- // Add buildconfigurations so we can parse the pro-files.
- if (targets().isEmpty()) {
- ProjectLoadWizard wizard(this);
- wizard.exec();
- }
-
- if (targets().isEmpty()) {
- qWarning() << "Unable to create targets!";
- return false;
- }
-
- Q_ASSERT(activeTarget());
- Q_ASSERT(activeTarget()->activeBuildConfiguration());
-
m_manager->registerProject(this);
m_rootProjectNode = new Qt4ProFileNode(this, m_fileInfo->fileName(), this);
@@ -480,7 +467,7 @@ void Qt4Project::updateCodeModels()
if (debug)
qDebug()<<"Qt4Project::updateCodeModel()";
- if (!activeTarget() || !activeTarget()->activeBuildConfiguration())
+ if (activeTarget() && !activeTarget()->activeBuildConfiguration())
return;
updateCppCodeModel();
@@ -489,7 +476,15 @@ void Qt4Project::updateCodeModels()
void Qt4Project::updateCppCodeModel()
{
- Qt4BuildConfiguration *activeBC = activeTarget()->activeQt4BuildConfiguration();
+ QtSupport::BaseQtVersion *qtVersion = 0;
+ ToolChain *tc = 0;
+ if (Qt4BaseTarget *target = activeTarget()) {
+ qtVersion = target->activeQt4BuildConfiguration()->qtVersion();
+ tc = target->activeQt4BuildConfiguration()->toolChain();
+ } else {
+ qtVersion = qt4ProjectManager()->unconfiguredSettings().version;
+ tc = qt4ProjectManager()->unconfiguredSettings().toolchain;
+ }
CPlusPlus::CppModelManagerInterface *modelmanager =
CPlusPlus::CppModelManagerInterface::instance();
@@ -503,18 +498,17 @@ void Qt4Project::updateCppCodeModel()
QByteArray predefinedMacros;
QString qtFrameworkPath;
- if (activeBC->qtVersion())
- qtFrameworkPath = activeBC->qtVersion()->frameworkInstallPath();
+ if (qtVersion)
+ qtFrameworkPath = qtVersion->frameworkInstallPath();
if (!qtFrameworkPath.isEmpty())
predefinedFrameworkPaths.append(qtFrameworkPath);
- ToolChain *tc = activeBC->toolChain();
if (tc) {
predefinedMacros = tc->predefinedMacros();
QList<HeaderPath> headers = tc->systemHeaderPaths();
- if (activeBC->qtVersion())
- headers.append(activeBC->qtVersion()->systemHeaderPathes());
+ if (qtVersion)
+ headers.append(qtVersion->systemHeaderPathes());
foreach (const HeaderPath &headerPath, headers) {
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
predefinedFrameworkPaths.append(headerPath.path());
@@ -562,8 +556,8 @@ void Qt4Project::updateCppCodeModel()
// Add mkspec directory
if (rootQt4ProjectNode())
allIncludePaths.append(rootQt4ProjectNode()->resolvedMkspecPath());
- else if (activeBC->qtVersion())
- allIncludePaths.append(activeBC->qtVersion()->mkspecPath().toString());
+ else if (qtVersion)
+ allIncludePaths.append(qtVersion->mkspecPath().toString());
allIncludePaths.append(predefinedIncludePaths);
@@ -628,9 +622,18 @@ void Qt4Project::updateQmlJSCodeModel()
bool preferDebugDump = false;
projectInfo.tryQmlDump = false;
- if (activeTarget() && activeTarget()->activeBuildConfiguration()) {
- preferDebugDump = activeTarget()->activeQt4BuildConfiguration()->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild;
- QtSupport::BaseQtVersion *qtVersion = activeTarget()->activeQt4BuildConfiguration()->qtVersion();
+
+ QtSupport::BaseQtVersion *qtVersion = 0;
+ if (Qt4BaseTarget *t = activeTarget()) {
+ if (Qt4BuildConfiguration *bc = t->activeQt4BuildConfiguration()) {
+ qtVersion = bc->qtVersion();
+ preferDebugDump = bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild;
+ }
+ } else {
+ qtVersion = qt4ProjectManager()->unconfiguredSettings().version;
+ preferDebugDump = qtVersion->defaultBuildConfig() & QtSupport::BaseQtVersion::DebugBuild;
+ }
+ if (qtVersion) {
if (qtVersion && qtVersion->isValid()) {
projectInfo.tryQmlDump = qtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT)
|| qtVersion->type() == QLatin1String(QtSupport::Constants::SIMULATORQT);
@@ -643,9 +646,15 @@ void Qt4Project::updateQmlJSCodeModel()
projectInfo.importPaths.removeDuplicates();
if (projectInfo.tryQmlDump) {
- const Qt4BuildConfiguration *bc = activeTarget()->activeQt4BuildConfiguration();
- if (bc) {
- QtSupport::QmlDumpTool::pathAndEnvironment(this, bc->qtVersion(), bc->toolChain(),
+ if (Qt4BaseTarget *target = activeTarget()) {
+ const Qt4BuildConfiguration *bc = target->activeQt4BuildConfiguration();
+ if (bc)
+ QtSupport::QmlDumpTool::pathAndEnvironment(this, bc->qtVersion(), bc->toolChain(),
+ preferDebugDump, &projectInfo.qmlDumpPath,
+ &projectInfo.qmlDumpEnvironment);
+ } else {
+ UnConfiguredSettings us = qt4ProjectManager()->unconfiguredSettings();
+ QtSupport::QmlDumpTool::pathAndEnvironment(this, us.version, us.toolchain,
preferDebugDump, &projectInfo.qmlDumpPath, &projectInfo.qmlDumpEnvironment);
}
} else {
@@ -668,7 +677,9 @@ void Qt4Project::update()
if (debug)
qDebug()<<"State is now Base";
m_asyncUpdateState = Base;
- activeTarget()->activeQt4BuildConfiguration()->setEnabled(true);
+ Qt4BaseTarget *target = activeTarget();
+ if (target)
+ target->activeQt4BuildConfiguration()->setEnabled(true);
emit proParsingDone();
}
@@ -690,7 +701,8 @@ void Qt4Project::scheduleAsyncUpdate(Qt4ProFileNode *node)
return;
}
- activeTarget()->activeQt4BuildConfiguration()->setEnabled(false);
+ if (activeTarget() && activeTarget()->activeQt4BuildConfiguration())
+ activeTarget()->activeQt4BuildConfiguration()->setEnabled(false);
if (m_asyncUpdateState == AsyncFullUpdatePending) {
// Just postpone
@@ -760,7 +772,8 @@ void Qt4Project::scheduleAsyncUpdate()
qDebug()<<" update in progress, canceling and setting state to full update pending";
m_cancelEvaluate = true;
m_asyncUpdateState = AsyncFullUpdatePending;
- activeTarget()->activeQt4BuildConfiguration()->setEnabled(false);
+ if (activeTarget() && activeTarget()->activeQt4BuildConfiguration())
+ activeTarget()->activeQt4BuildConfiguration()->setEnabled(false);
m_rootProjectNode->setParseInProgressRecursive(true);
return;
}
@@ -768,7 +781,8 @@ void Qt4Project::scheduleAsyncUpdate()
if (debug)
qDebug()<<" starting timer for full update, setting state to full update pending";
m_partialEvaluate.clear();
- activeTarget()->activeQt4BuildConfiguration()->setEnabled(false);
+ if (activeTarget() && activeTarget()->activeQt4BuildConfiguration())
+ activeTarget()->activeQt4BuildConfiguration()->setEnabled(false);
m_rootProjectNode->setParseInProgressRecursive(true);
m_asyncUpdateState = AsyncFullUpdatePending;
m_asyncUpdateTimer.start();
@@ -816,7 +830,8 @@ void Qt4Project::decrementPendingEvaluateFutures()
} else if (m_asyncUpdateState != ShuttingDown){
// After being done, we need to call:
m_asyncUpdateState = Base;
- activeTarget()->activeQt4BuildConfiguration()->setEnabled(true);
+ if (activeTarget() && activeTarget()->activeQt4BuildConfiguration())
+ activeTarget()->activeQt4BuildConfiguration()->setEnabled(true);
foreach (Target *t, targets())
static_cast<Qt4BaseTarget *>(t)->createApplicationProFiles(true);
updateFileList();
@@ -952,32 +967,50 @@ QtSupport::ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4Pro
m_proFileOption = new ProFileOption;
m_proFileOptionRefCnt = 0;
- if (!bc && activeTarget())
- bc = activeTarget()->activeQt4BuildConfiguration();
-
+ QtSupport::BaseQtVersion *qtVersion = 0;
+ ProjectExplorer::ToolChain *tc = 0;
+ Utils::Environment env = Utils::Environment::systemEnvironment();
+ QStringList qmakeArgs;
if (bc) {
- QtSupport::BaseQtVersion *version = bc->qtVersion();
- if (version && version->isValid()) {
- m_proFileOption->properties = version->versionInfo();
- if (bc->toolChain())
- m_proFileOption->sysroot = bc->qtVersion()->systemRoot();
- }
-
- Utils::Environment env = bc->environment();
- Utils::Environment::const_iterator eit = env.constBegin(), eend = env.constEnd();
- for (; eit != eend; ++eit)
- m_proFileOption->environment.insert(env.key(eit), env.value(eit));
-
- QStringList args;
+ qtVersion = bc->qtVersion();
+ env = bc->environment();
+ tc = bc->toolChain();
if (QMakeStep *qs = bc->qmakeStep()) {
- args = qs->parserArguments();
+ qmakeArgs = qs->parserArguments();
m_proFileOption->qmakespec = qs->mkspec().toString();
} else {
- args = bc->configCommandLineArguments();
+ qmakeArgs = bc->configCommandLineArguments();
+ }
+ } else if (Qt4BaseTarget *target = activeTarget()) {
+ if (Qt4BuildConfiguration *bc = target->activeQt4BuildConfiguration()) {
+ qtVersion = bc->qtVersion();
+ env = bc->environment();
+ tc = bc->toolChain();
+ if (QMakeStep *qs = bc->qmakeStep()) {
+ qmakeArgs = qs->parserArguments();
+ m_proFileOption->qmakespec = qs->mkspec().toString();
+ } else {
+ qmakeArgs = bc->configCommandLineArguments();
+ }
}
- m_proFileOption->setCommandLineArguments(args);
+ } else {
+ UnConfiguredSettings ucs = qt4ProjectManager()->unconfiguredSettings();
+ qtVersion = ucs.version;
+ tc = ucs.toolchain;
}
+ if (qtVersion && qtVersion->isValid()) {
+ m_proFileOption->properties = qtVersion->versionInfo();
+ if (tc)
+ m_proFileOption->sysroot = qtVersion->systemRoot();
+ }
+
+ Utils::Environment::const_iterator eit = env.constBegin(), eend = env.constEnd();
+ for (; eit != eend; ++eit)
+ m_proFileOption->environment.insert(env.key(eit), env.value(eit));
+
+ m_proFileOption->setCommandLineArguments(qmakeArgs);
+
QtSupport::ProFileCacheManager::instance()->incRefCount();
}
++m_proFileOptionRefCnt;
@@ -1337,6 +1370,11 @@ void CentralizedFolderWatcher::delayedFolderChanged(const QString &folder)
}
}
+bool Qt4Project::needsConfiguration() const
+{
+ return targets().isEmpty();
+}
+
/*!
Handle special case were a subproject of the qt directory is opened, and
qt was configured to be built as a shadow build -> also build in the sub-
diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h
index 2d225935a6..26dd0ab4a5 100644
--- a/src/plugins/qt4projectmanager/qt4project.h
+++ b/src/plugins/qt4projectmanager/qt4project.h
@@ -57,6 +57,7 @@ class Qt4ProFileNode;
class Qt4PriFileNode;
class Qt4BaseTarget;
class Qt4BuildConfiguration;
+class Qt4Manager;
namespace Internal {
class DeployHelperRunStep;
@@ -71,7 +72,6 @@ namespace Internal {
class QMakeStep;
class MakeStep;
-class Qt4Manager;
class Qt4Project;
class Qt4RunStep;
@@ -138,6 +138,8 @@ public:
void watchFolders(const QStringList &l, Qt4PriFileNode *node);
void unwatchFolders(const QStringList &l, Qt4PriFileNode *node);
+ bool needsConfiguration() const;
+
signals:
void proParsingDone();
void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *node, bool, bool);
@@ -207,6 +209,7 @@ private:
friend class Internal::Qt4ProjectFile;
friend class Internal::Qt4ProjectConfigWidget;
+ friend class Qt4Manager; // to schedule a async update if the unconfigured settings change
};
} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.cpp b/src/plugins/qt4projectmanager/qt4projectmanager.cpp
index b198c07745..5bdcdfc4d2 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanager.cpp
+++ b/src/plugins/qt4projectmanager/qt4projectmanager.cpp
@@ -55,8 +55,12 @@
#include <projectexplorer/session.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/toolchainmanager.h>
+#include <projectexplorer/toolchain.h>
#include <utils/qtcassert.h>
#include <qtsupport/profilereader.h>
+#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtversionmanager.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
@@ -141,6 +145,12 @@ void Qt4Manager::init()
tr("Full path to the bin directory of the current project's Qt version."));
connect(vm, SIGNAL(variableUpdateRequested(QByteArray)),
this, SLOT(updateVariable(QByteArray)));
+
+ QSettings *settings = Core::ICore::instance()->settings();
+ settings->beginGroup("Qt4ProjectManager");
+ m_unConfiguredVersionId = settings->value("QtVersionId", -1).toInt();
+ m_unconfiguredToolChainId = settings->value("ToolChainId", QString()).toString();
+ settings->endGroup();
}
void Qt4Manager::editorChanged(Core::IEditor *editor)
@@ -191,7 +201,14 @@ void Qt4Manager::updateVariable(const QByteArray &variable)
return;
}
QString value;
- QtSupport::BaseQtVersion *qtv = qt4pro->activeTarget()->activeQt4BuildConfiguration()->qtVersion();
+ QtSupport::BaseQtVersion *qtv;
+ if (Qt4BaseTarget *t = qt4pro->activeTarget()) {
+ if (Qt4BuildConfiguration *bc = t->activeQt4BuildConfiguration())
+ qtv = bc->qtVersion();
+ } else {
+ qtv = unconfiguredSettings().version;
+ }
+
if (qtv)
value = qtv->versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
Core::VariableManager::instance()->insert(kInstallBins, value);
@@ -440,3 +457,57 @@ QString Qt4Manager::fileTypeId(ProjectExplorer::FileType type)
return QString();
}
+UnConfiguredSettings Qt4Manager::unconfiguredSettings() const
+{
+ if (m_unConfiguredVersionId == -1 && m_unconfiguredToolChainId.isEmpty()) {
+ // Choose a good default qtversion and try to find a toolchain that fit
+ QtSupport::BaseQtVersion *version = 0;
+ ProjectExplorer::ToolChain *toolChain = 0;
+ QList<QtSupport::BaseQtVersion *> versions = QtSupport::QtVersionManager::instance()->validVersions();
+ if (!versions.isEmpty()) {
+ version = versions.first();
+
+ foreach (ProjectExplorer::ToolChain *tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) {
+ if (tc->mkspec() == version->mkspec()) {
+ toolChain = tc;
+ break;
+ }
+ }
+ if (!toolChain) {
+ foreach (ProjectExplorer::ToolChain *tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) {
+ if (version->qtAbis().contains(tc->targetAbi())) {
+ toolChain = tc;
+ break;
+ }
+ }
+ }
+ m_unConfiguredVersionId = version->uniqueId();
+ m_unconfiguredToolChainId = toolChain->id();
+ }
+ UnConfiguredSettings us;
+ us.version = version;
+ us.toolchain = toolChain;
+ return us;
+ }
+ UnConfiguredSettings us;
+ us.version = QtSupport::QtVersionManager::instance()->version(m_unConfiguredVersionId);
+ us.toolchain = ProjectExplorer::ToolChainManager::instance()->findToolChain(m_unconfiguredToolChainId);
+ return us;
+}
+
+void Qt4Manager::setUnconfiguredSettings(const UnConfiguredSettings &setting)
+{
+ m_unConfiguredVersionId = setting.version ? setting.version->uniqueId() : -1;
+ m_unconfiguredToolChainId = setting.toolchain ? setting.toolchain->id() : QString();
+
+ QSettings *settings = Core::ICore::instance()->settings();
+ settings->beginGroup("Qt4ProjectManager");
+ settings->setValue("QtVersionId", m_unConfiguredVersionId);
+ settings->setValue("ToolChainId", m_unconfiguredToolChainId);
+ settings->endGroup();
+
+ foreach (Qt4Project *pro, m_projects)
+ if (pro->targets().isEmpty())
+ pro->scheduleAsyncUpdate();
+ emit unconfiguredSettingsChanged();
+}
diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.h b/src/plugins/qt4projectmanager/qt4projectmanager.h
index 4d018c7a49..21cefe136a 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanager.h
+++ b/src/plugins/qt4projectmanager/qt4projectmanager.h
@@ -50,10 +50,12 @@ namespace ProjectExplorer {
class Project;
class ProjectExplorerPlugin;
class Node;
+class ToolChain;
}
namespace QtSupport {
class QtVersionManager;
+class BaseQtVersion;
}
namespace Qt4ProjectManager {
@@ -62,6 +64,13 @@ namespace Internal {
class Qt4Builder;
class ProFileEditorWidget;
class Qt4ProjectManagerPlugin;
+
+class UnConfiguredSettings
+{
+public:
+ QtSupport::BaseQtVersion *version;
+ ProjectExplorer::ToolChain *toolchain;
+};
}
class Qt4Project;
@@ -96,6 +105,13 @@ public:
enum Action { BUILD, REBUILD, CLEAN };
+ /// Settings to use for codemodel if no targets exist
+ Internal::UnConfiguredSettings unconfiguredSettings() const;
+ void setUnconfiguredSettings(const Internal::UnConfiguredSettings &setting);
+
+signals:
+ void unconfiguredSettingsChanged();
+
public slots:
void addLibrary();
void addLibraryContextMenu();
@@ -118,7 +134,8 @@ private:
void runQMake(ProjectExplorer::Project *p, ProjectExplorer::Node *node);
Internal::Qt4ProjectManagerPlugin *m_plugin;
-
+ mutable int m_unConfiguredVersionId;
+ mutable QString m_unconfiguredToolChainId;
ProjectExplorer::Node *m_contextNode;
ProjectExplorer::Project *m_contextProject;
diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.pro b/src/plugins/qt4projectmanager/qt4projectmanager.pro
index 2daa79eaed..2a13afdb98 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanager.pro
+++ b/src/plugins/qt4projectmanager/qt4projectmanager.pro
@@ -51,7 +51,6 @@ HEADERS += \
qmakestep.h \
qtmodulesinfo.h \
qt4projectconfigwidget.h \
- projectloadwizard.h \
qtuicodemodelsupport.h \
externaleditors.h \
qt4buildconfiguration.h \
@@ -67,7 +66,9 @@ HEADERS += \
winceqtversionfactory.h \
winceqtversion.h \
profilecompletionassist.h \
- qt4basetargetfactory.h
+ qt4basetargetfactory.h \
+ unconfiguredprojectpanel.h \
+ unconfiguredsettingsoptionpage.h
SOURCES += qt4projectmanagerplugin.cpp \
qt4projectmanager.cpp \
@@ -113,7 +114,6 @@ SOURCES += qt4projectmanagerplugin.cpp \
qmakestep.cpp \
qtmodulesinfo.cpp \
qt4projectconfigwidget.cpp \
- projectloadwizard.cpp \
qtuicodemodelsupport.cpp \
externaleditors.cpp \
qt4buildconfiguration.cpp \
@@ -125,7 +125,9 @@ SOURCES += qt4projectmanagerplugin.cpp \
profilekeywords.cpp \
winceqtversionfactory.cpp \
winceqtversion.cpp \
- profilecompletionassist.cpp
+ profilecompletionassist.cpp \
+ unconfiguredprojectpanel.cpp \
+ unconfiguredsettingsoptionpage.cpp
FORMS += makestep.ui \
qmakestep.ui \
diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h b/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h
index ad130464e3..f34dd69022 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h
+++ b/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h
@@ -101,6 +101,13 @@ const char ICON_HTML5_APP[] = ":/wizards/images/html5app.png";
const char QMAKEVAR_QMLJSDEBUGGER_PATH[] = "QMLJSDEBUGGER_PATH";
const char QMAKEVAR_DECLARATIVE_DEBUG[] = "CONFIG+=declarative_debug";
+// Unconfigured Settings page
+const char UNCONFIGURED_SETTINGS_PAGE_ID[] = "R.UnconfiguredSettings";
+const char UNCONFIGURED_SETTINGS_PAGE_NAME[] = QT_TRANSLATE_NOOP("Qt4ProjectManager", "Unconfigured Project Settings");
+
+// Unconfigured Panel
+const char UNCONFIGURED_PANEL_PAGE_ID[] = "UnconfiguredPanel";
+
} // namespace Constants
} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
index 59527b8c58..93b2aeb710 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
+++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
@@ -36,6 +36,8 @@
#include "qt4nodes.h"
#include "qmakestep.h"
#include "makestep.h"
+#include "qt4target.h"
+#include "qt4buildconfiguration.h"
#include "wizards/consoleappwizard.h"
#include "wizards/guiappwizard.h"
#include "wizards/mobileappwizard.h"
@@ -60,6 +62,8 @@
#include "qt-desktop/desktopqtversionfactory.h"
#include "qt-desktop/simulatorqtversionfactory.h"
#include "winceqtversionfactory.h"
+#include "unconfiguredprojectpanel.h"
+#include "unconfiguredsettingsoptionpage.h"
#include <coreplugin/id.h>
#include <coreplugin/icore.h>
@@ -90,6 +94,12 @@ using namespace Qt4ProjectManager::Internal;
using namespace Qt4ProjectManager;
using ProjectExplorer::Project;
+Qt4ProjectManagerPlugin::Qt4ProjectManagerPlugin()
+ : m_previousStartupProject(0), m_previousTarget(0)
+{
+
+}
+
Qt4ProjectManagerPlugin::~Qt4ProjectManagerPlugin()
{
//removeObject(m_embeddedPropertiesPage);
@@ -141,6 +151,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
addAutoReleasedObject(new MakeStepFactory);
addAutoReleasedObject(new Qt4RunConfigurationFactory);
+ addAutoReleasedObject(new UnConfiguredSettingsOptionPage);
#ifdef Q_OS_MAC
addAutoReleasedObject(new MacDesignerExternalEditor);
@@ -160,6 +171,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
addAutoReleasedObject(new ProFileCompletionAssistProvider);
addAutoReleasedObject(new ProFileHoverHandler(this));
+ addAutoReleasedObject(new UnconfiguredProjectPanel);
//menus
Core::ActionContainer *mbuild =
@@ -217,8 +229,8 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
connect(m_projectExplorer->buildManager(), SIGNAL(buildStateChanged(ProjectExplorer::Project *)),
this, SLOT(buildStateChanged(ProjectExplorer::Project *)));
- connect(m_projectExplorer, SIGNAL(currentProjectChanged(ProjectExplorer::Project *)),
- this, SLOT(currentProjectChanged()));
+ connect(m_projectExplorer->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
+ this, SLOT(startupProjectChanged()));
connect(m_projectExplorer, SIGNAL(currentNodeChanged(ProjectExplorer::Node*,ProjectExplorer::Project*)),
this, SLOT(currentNodeChanged(ProjectExplorer::Node*)));
@@ -276,14 +288,18 @@ void Qt4ProjectManagerPlugin::updateContextMenu(Project *project,
m_cleanSubProjectContextMenu->setEnabled(false);
Qt4ProFileNode *proFileNode = qobject_cast<Qt4ProFileNode *>(node);
- if (qobject_cast<Qt4Project *>(project) && proFileNode) {
+ Qt4Project *qt4Project = qobject_cast<Qt4Project *>(project);
+ if (qt4Project && proFileNode
+ && qt4Project->activeTarget()
+ && qt4Project->activeTarget()->activeQt4BuildConfiguration()) {
m_runQMakeActionContextMenu->setVisible(true);
m_buildSubProjectContextMenu->setVisible(true);
m_rebuildSubProjectContextMenu->setVisible(true);
m_cleanSubProjectContextMenu->setVisible(true);
if (!m_projectExplorer->buildManager()->isBuilding(project)) {
- m_runQMakeActionContextMenu->setEnabled(true);
+ if (qt4Project->activeTarget()->activeQt4BuildConfiguration()->qmakeStep())
+ m_runQMakeActionContextMenu->setEnabled(true);
m_buildSubProjectContextMenu->setEnabled(true);
m_rebuildSubProjectContextMenu->setEnabled(true);
m_cleanSubProjectContextMenu->setEnabled(true);
@@ -296,9 +312,49 @@ void Qt4ProjectManagerPlugin::updateContextMenu(Project *project,
}
}
-void Qt4ProjectManagerPlugin::currentProjectChanged()
+
+void Qt4ProjectManagerPlugin::startupProjectChanged()
+{
+ if (m_previousStartupProject)
+ disconnect(m_previousStartupProject, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
+ this, SLOT(activeTargetChanged()));
+
+ m_previousStartupProject = qobject_cast<Qt4Project *>(m_projectExplorer->session()->startupProject());
+
+ if (m_previousStartupProject)
+ connect(m_previousStartupProject, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
+ this, SLOT(activeTargetChanged()));
+
+ activeTargetChanged();
+}
+
+void Qt4ProjectManagerPlugin::activeTargetChanged()
+{
+ if (m_previousTarget)
+ disconnect(m_previousTarget, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
+ this, SLOT(updateRunQMakeAction()));
+
+ m_previousTarget = m_previousStartupProject ? m_previousStartupProject->activeTarget() : 0;
+
+ if (m_previousTarget)
+ connect(m_previousTarget, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
+ this, SLOT(updateRunQMakeAction()));
+
+ updateRunQMakeAction();
+}
+
+void Qt4ProjectManagerPlugin::updateRunQMakeAction()
{
- m_runQMakeAction->setEnabled(!m_projectExplorer->buildManager()->isBuilding(m_projectExplorer->currentProject()));
+ bool enable = true;
+ if (m_projectExplorer->buildManager()->isBuilding(m_projectExplorer->currentProject()))
+ enable = false;
+ Qt4Project *pro = qobject_cast<Qt4Project *>(m_projectExplorer->currentProject());
+ if (!pro
+ || !pro->activeTarget()
+ || !pro->activeTarget()->activeBuildConfiguration())
+ enable = false;
+
+ m_runQMakeAction->setEnabled(enable);
}
void Qt4ProjectManagerPlugin::currentNodeChanged(ProjectExplorer::Node *node)
@@ -310,9 +366,7 @@ void Qt4ProjectManagerPlugin::buildStateChanged(ProjectExplorer::Project *pro)
{
ProjectExplorer::Project *currentProject = m_projectExplorer->currentProject();
if (pro == currentProject)
- m_runQMakeAction->setEnabled(!m_projectExplorer->buildManager()->isBuilding(currentProject));
- if (pro == m_qt4ProjectManager->contextProject())
- m_runQMakeActionContextMenu->setEnabled(!m_projectExplorer->buildManager()->isBuilding(pro));
+ updateRunQMakeAction();
}
void Qt4ProjectManagerPlugin::jumpToFile()
diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
index c1b2e0d958..c0bbe0ce3a 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
+++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
@@ -49,6 +49,8 @@ namespace Qt4ProjectManager {
class Qt4Manager;
class QtVersionManager;
+class Qt4Project;
+class Qt4BaseTarget;
namespace Internal {
@@ -59,6 +61,7 @@ class Qt4ProjectManagerPlugin : public ExtensionSystem::IPlugin
Q_OBJECT
public:
+ Qt4ProjectManagerPlugin();
~Qt4ProjectManagerPlugin();
bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized();
@@ -66,7 +69,9 @@ public:
private slots:
void updateContextMenu(ProjectExplorer::Project *project,
ProjectExplorer::Node *node);
- void currentProjectChanged();
+ void startupProjectChanged();
+ void activeTargetChanged();
+ void updateRunQMakeAction();
void currentNodeChanged(ProjectExplorer::Node *node);
void buildStateChanged(ProjectExplorer::Project *pro);
void jumpToFile();
@@ -86,6 +91,8 @@ private:
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
ProFileEditorFactory *m_proFileEditorFactory;
Qt4Manager *m_qt4ProjectManager;
+ Qt4Project *m_previousStartupProject;
+ Qt4BaseTarget *m_previousTarget;
QAction *m_runQMakeAction;
QAction *m_runQMakeActionContextMenu;
diff --git a/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp b/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp
index 937bb49a60..05a8cd819f 100644
--- a/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp
+++ b/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp
@@ -34,6 +34,7 @@
#include "qt4buildconfiguration.h"
#include "qt4project.h"
+#include "qt4projectmanager.h"
#include "qt4target.h"
#include <qtsupport/baseqtversion.h>
@@ -57,14 +58,28 @@ Qt4UiCodeModelSupport::~Qt4UiCodeModelSupport()
QString Qt4UiCodeModelSupport::uicCommand() const
{
- Qt4BuildConfiguration *qt4bc = m_project->activeTarget()->activeQt4BuildConfiguration();
- if (!qt4bc->qtVersion())
- return QString();
- return qt4bc->qtVersion()->uicCommand();
+ if (m_project->needsConfiguration()) {
+ UnConfiguredSettings us = m_project->qt4ProjectManager()->unconfiguredSettings();
+ if (!us.version)
+ return QString();
+ return us.version->uicCommand();
+ } else {
+ Qt4BaseTarget *target = m_project->activeTarget();
+ Qt4BuildConfiguration *qt4bc = target->activeQt4BuildConfiguration();
+ if (!qt4bc->qtVersion())
+ return QString();
+ return qt4bc->qtVersion()->uicCommand();
+ }
+ return QString();
}
QStringList Qt4UiCodeModelSupport::environment() const
{
- Qt4BuildConfiguration *qt4bc = m_project->activeTarget()->activeQt4BuildConfiguration();
- return qt4bc->environment().toStringList();
+ if (m_project->needsConfiguration()) {
+ return Utils::Environment::systemEnvironment().toStringList();
+ } else {
+ Qt4BaseTarget *target = m_project->activeTarget();
+ Qt4BuildConfiguration *qt4bc = target->activeQt4BuildConfiguration();
+ return qt4bc->environment().toStringList();
+ }
}
diff --git a/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp
new file mode 100644
index 0000000000..b47bb1fee2
--- /dev/null
+++ b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp
@@ -0,0 +1,195 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "unconfiguredprojectpanel.h"
+#include "wizards/targetsetuppage.h"
+#include "qt4projectmanagerconstants.h"
+
+#include "qt4project.h"
+#include "qt4projectmanager.h"
+
+#include <coreplugin/ifile.h>
+#include <coreplugin/icore.h>
+#include <coreplugin/modemanager.h>
+#include <coreplugin/coreconstants.h>
+
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/toolchain.h>
+
+#include <QtGui/QLabel>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QPushButton>
+
+using namespace Qt4ProjectManager;
+using namespace Qt4ProjectManager::Internal;
+
+
+UnconfiguredProjectPanel::UnconfiguredProjectPanel()
+{
+}
+
+QString Qt4ProjectManager::Internal::UnconfiguredProjectPanel::id() const
+{
+ return Constants::UNCONFIGURED_PANEL_PAGE_ID;
+}
+
+QString Qt4ProjectManager::Internal::UnconfiguredProjectPanel::displayName() const
+{
+ return tr("Configure Project");
+}
+
+int UnconfiguredProjectPanel::priority() const
+{
+ return -10;
+}
+
+bool Qt4ProjectManager::Internal::UnconfiguredProjectPanel::supports(ProjectExplorer::Project *project)
+{
+ if (qobject_cast<Qt4Project *>(project) && project->targets().isEmpty())
+ return true;
+ return false;
+}
+
+ProjectExplorer::PropertiesPanel *Qt4ProjectManager::Internal::UnconfiguredProjectPanel::createPanel(ProjectExplorer::Project *project)
+{
+ ProjectExplorer::PropertiesPanel *panel = new ProjectExplorer::PropertiesPanel;
+ panel->setDisplayName(displayName());
+ // TODO the icon needs a update
+ panel->setIcon(QIcon(":/projectexplorer/images/unconfigured.png"));
+
+ TargetSetupPageWrapper *w = new TargetSetupPageWrapper(project);
+ connect (w, SIGNAL(projectUpdated(ProjectExplorer::Project*)),
+ this, SIGNAL(projectUpdated(ProjectExplorer::Project*)));
+ panel->setWidget(w);
+ return panel;
+}
+
+/////////
+/// TargetSetupPageWrapper
+////////
+
+TargetSetupPageWrapper::TargetSetupPageWrapper(ProjectExplorer::Project *project)
+ : QWidget(), m_project(qobject_cast<Qt4Project *>(project))
+{
+ QVBoxLayout *layout = new QVBoxLayout();
+ layout->setMargin(0);
+ setLayout(layout);
+
+ m_targetSetupPage = new TargetSetupPage(this);
+ m_targetSetupPage->setUseScrollArea(false);
+ m_targetSetupPage->setImportSearch(true);
+ m_targetSetupPage->setProFilePath(project->file()->fileName());
+ m_targetSetupPage->initializePage();
+ m_targetSetupPage->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
+ updateNoteText();
+
+ layout->addWidget(m_targetSetupPage);
+
+ // Apply row
+ QHBoxLayout *hbox = new QHBoxLayout();
+ layout->addLayout(hbox);
+ layout->setMargin(0);
+ hbox->addStretch();
+ QPushButton *button = new QPushButton(this);
+ button->setText(tr("Configure Project"));
+ hbox->addWidget(button);
+
+ layout->addStretch(10);
+
+ connect(button, SIGNAL(clicked()),
+ this, SLOT(done()));
+ connect(m_targetSetupPage, SIGNAL(noteTextLinkActivated()),
+ this, SLOT(noteTextLinkActivated()));
+ connect(m_project->qt4ProjectManager(), SIGNAL(unconfiguredSettingsChanged()),
+ this, SLOT(updateNoteText()));
+}
+
+void TargetSetupPageWrapper::updateNoteText()
+{
+ UnConfiguredSettings us = m_project->qt4ProjectManager()->unconfiguredSettings();
+
+ QString text;
+ if (us.version && us.toolchain)
+ text = tr("<p>The project <b>%1</b> is not yet configured.</p><p>Qt Creator uses the Qt version: <b>%2</b> "
+ "and the tool chain: <b>%3</b> to parse the project. You can edit "
+ "these in the <b><a href=\"edit\">settings</a></b></p>")
+ .arg(m_project->displayName())
+ .arg(us.version->displayName())
+ .arg(us.toolchain->displayName());
+ else if (us.version)
+ text = tr("<p>The project <b>%1</b> is not yet configured.</p><p>Qt Creator uses the Qt version: <b>%2</b> "
+ "and <b>no tool chain</b> to parse the project. You can edit "
+ "these in the <b><a href=\"edit\">settings</a></b></p>")
+ .arg(m_project->displayName())
+ .arg(us.version->displayName());
+ else if (us.toolchain)
+ text = tr("<p>The project <b>%1</b> is not yet configured.</p><p>Qt Creator uses <b>no Qt version</b> "
+ "and the tool chain: <b>%2</b> to parse the project. You can edit "
+ "these in the <b><a href=\"edit\">settings</a></b></p>")
+ .arg(m_project->displayName())
+ .arg(us.toolchain->displayName());
+ else
+ text = tr("<p>The project <b>%1</b> is not yet configured.</p><p>Qt Creator uses <b>no Qt version</b> "
+ "and <b>no tool chain</b> to parse the project. You can edit "
+ "these in the <b><a href=\"edit\">settings</a></b></p>")
+ .arg(m_project->displayName());
+
+ m_targetSetupPage->setNoteText(text);
+}
+
+void TargetSetupPageWrapper::keyPressEvent(QKeyEvent *event)
+{
+ if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
+ event->accept();
+ done();
+ }
+}
+
+void TargetSetupPageWrapper::keyReleaseEvent(QKeyEvent *event)
+{
+ if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
+ event->accept();
+ }
+}
+
+void TargetSetupPageWrapper::done()
+{
+ m_targetSetupPage->setupProject(m_project);
+ emit projectUpdated(m_project);
+ Core::ICore::instance()->modeManager()->activateMode(QLatin1String(Core::Constants::MODE_EDIT));
+}
+
+void TargetSetupPageWrapper::noteTextLinkActivated()
+{
+ Core::ICore::instance()->showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
+ QLatin1String(Constants::UNCONFIGURED_SETTINGS_PAGE_ID));
+}
diff --git a/src/plugins/qt4projectmanager/projectloadwizard.h b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.h
index ba45ce6a59..cef4cbdd3e 100644
--- a/src/plugins/qt4projectmanager/projectloadwizard.h
+++ b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.h
@@ -30,33 +30,52 @@
**
**************************************************************************/
-#ifndef PROJECTLOADWIZARD_H
-#define PROJECTLOADWIZARD_H
+#ifndef UNCONFIGUREDPROJECTPANEL_H
+#define UNCONFIGUREDPROJECTPANEL_H
-#include <QtGui/QWizard>
+#include <projectexplorer/iprojectproperties.h>
+
+#include <QtCore/QString>
namespace Qt4ProjectManager {
-class Qt4Project;
class TargetSetupPage;
+class Qt4Project;
namespace Internal {
-class ProjectLoadWizard : public QWizard
+class UnconfiguredProjectPanel : public ProjectExplorer::IProjectPanelFactory
{
Q_OBJECT
public:
- explicit ProjectLoadWizard(Qt4Project *project, QWidget * parent = 0, Qt::WindowFlags flags = 0);
- virtual ~ProjectLoadWizard();
- virtual void done(int result);
+ UnconfiguredProjectPanel();
+ virtual QString id() const;
+ virtual QString displayName() const;
+ int priority() const;
+ virtual bool supports(ProjectExplorer::Project *project);
+ virtual ProjectExplorer::PropertiesPanel *createPanel(ProjectExplorer::Project *project);
+};
-private:
- void applySettings();
+class TargetSetupPageWrapper : public QWidget
+{
+ Q_OBJECT
+public:
+ TargetSetupPageWrapper(ProjectExplorer::Project *project);
+protected:
+ void keyReleaseEvent(QKeyEvent *event);
+ void keyPressEvent(QKeyEvent *event);
+signals:
+ void projectUpdated(ProjectExplorer::Project *project);
+private slots:
+ void done();
+ void noteTextLinkActivated();
+ void updateNoteText();
+private:
Qt4Project *m_project;
TargetSetupPage *m_targetSetupPage;
};
-} // namespace Internal
-} // namespace Qt4ProjectManager
+}
+}
-#endif // PROJECTLOADWIZARD_H
+#endif // UNCONFIGUREDPROJECTPANEL_H
diff --git a/src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.cpp b/src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.cpp
new file mode 100644
index 0000000000..44d6bb5f52
--- /dev/null
+++ b/src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.cpp
@@ -0,0 +1,171 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "unconfiguredsettingsoptionpage.h"
+#include "qt4projectmanagerconstants.h"
+
+#include <extensionsystem/pluginmanager.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/toolchainmanager.h>
+#include <projectexplorer/toolchain.h>
+#include <qtsupport/qtversionmanager.h>
+#include <qt4projectmanager/qt4projectmanager.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtGui/QIcon>
+#include <QtGui/QComboBox>
+#include <QtGui/QLabel>
+#include <QtGui/QCheckBox>
+#include <QFormLayout>
+
+using namespace Qt4ProjectManager;
+using namespace Qt4ProjectManager::Internal;
+
+//////////////////////////
+// UnConfiguredSettingsWidget
+//////////////////////////
+
+UnConfiguredSettingsWidget::UnConfiguredSettingsWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ QFormLayout *layout = new QFormLayout(this);
+
+ m_qtVersionComboBox = new QComboBox;
+ layout->addRow(tr("Qt Version:"), m_qtVersionComboBox);
+
+ m_toolchainComboBox = new QComboBox;
+ layout->addRow(tr("Tool Chain:"), m_toolchainComboBox);
+
+ Qt4Manager *qt4Manager = ExtensionSystem::PluginManager::instance()->getObject<Qt4Manager>();
+ Internal::UnConfiguredSettings ucs = qt4Manager->unconfiguredSettings();
+
+ QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
+ foreach (QtSupport::BaseQtVersion *version, vm->validVersions())
+ m_qtVersionComboBox->addItem(version->displayName(), version->uniqueId());
+
+ int index = ucs.version ? m_qtVersionComboBox->findData(ucs.version->uniqueId()) : 0;
+ if (index == -1)
+ index = 0;
+ if (index < m_qtVersionComboBox->count())
+ m_qtVersionComboBox->setCurrentIndex(index);
+
+
+ ProjectExplorer::ToolChainManager *tm = ProjectExplorer::ToolChainManager::instance();
+ foreach (ProjectExplorer::ToolChain *tc, tm->toolChains())
+ m_toolchainComboBox->addItem(tc->displayName(), tc->id());
+
+ index = ucs.toolchain ? m_toolchainComboBox->findData(ucs.toolchain->id()) : 0;
+ if (index == -1)
+ index = 0;
+ if (index < m_toolchainComboBox->count())
+ m_toolchainComboBox->setCurrentIndex(index);
+}
+
+void UnConfiguredSettingsWidget::apply()
+{
+ Qt4Manager *qt4Manager = ExtensionSystem::PluginManager::instance()->getObject<Qt4Manager>();
+ Internal::UnConfiguredSettings ucs;
+
+ int index = m_qtVersionComboBox->currentIndex();
+ int qtVersionId = (index != -1) ? m_qtVersionComboBox->itemData(index).toInt() : -1;
+ ucs.version = QtSupport::QtVersionManager::instance()->version(qtVersionId);
+ index = m_toolchainComboBox->currentIndex();
+ QString toolChainId = index != -1 ? m_toolchainComboBox->itemData(index).toString() : QString();
+ ucs.toolchain = ProjectExplorer::ToolChainManager::instance()->findToolChain(toolChainId);
+ qt4Manager->setUnconfiguredSettings(ucs);
+}
+
+bool UnConfiguredSettingsWidget::matches(const QString &searchKeyword)
+{
+ for (int i = 0; i < layout()->count(); ++i) {
+ if (QLabel *l = qobject_cast<QLabel *>(layout()->itemAt(i)->widget()))
+ if (l->text().contains(searchKeyword))
+ return true;
+ }
+ return false;
+}
+
+//////////////////////////
+// UnConfiguredSettingsOptionPage
+//////////////////////////
+
+UnConfiguredSettingsOptionPage::UnConfiguredSettingsOptionPage()
+{
+}
+
+QString UnConfiguredSettingsOptionPage::id() const
+{
+ return Constants::UNCONFIGURED_SETTINGS_PAGE_ID;
+}
+
+QString UnConfiguredSettingsOptionPage::displayName() const
+{
+ return QCoreApplication::translate("Qt4ProjectManager", Constants::UNCONFIGURED_SETTINGS_PAGE_NAME);
+}
+
+QString UnConfiguredSettingsOptionPage::category() const
+{
+ return QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY);
+}
+
+QString UnConfiguredSettingsOptionPage::displayCategory() const
+{
+ return QCoreApplication::translate("ProjectExplorer",
+ ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_TR_CATEGORY);
+}
+
+QIcon UnConfiguredSettingsOptionPage::categoryIcon() const
+{
+ return QIcon(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON);
+}
+
+bool UnConfiguredSettingsOptionPage::matches(const QString &searchKeyword) const
+{
+ return m_widget->matches(searchKeyword);
+}
+
+QWidget *UnConfiguredSettingsOptionPage::createPage(QWidget *parent)
+{
+ m_widget = new UnConfiguredSettingsWidget(parent);
+ return m_widget;
+}
+
+void UnConfiguredSettingsOptionPage::apply()
+{
+ if (m_widget)
+ m_widget->apply();
+}
+
+void UnConfiguredSettingsOptionPage::finish()
+{
+
+}
diff --git a/src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.h b/src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.h
new file mode 100644
index 0000000000..082c9f218b
--- /dev/null
+++ b/src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.h
@@ -0,0 +1,81 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef UNCONFIGUREDSETTINGSOPTIONPAGE_H
+#define UNCONFIGUREDSETTINGSOPTIONPAGE_H
+
+#include <coreplugin/dialogs/ioptionspage.h>
+#include <QtGui/QWidget>
+
+QT_BEGIN_NAMESPACE
+class QComboBox;
+class QCheckBox;
+QT_END_NAMESPACE
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+class UnConfiguredSettingsWidget : public QWidget
+{
+public:
+ UnConfiguredSettingsWidget(QWidget *parent);
+ void apply();
+ bool matches(const QString &searchKeyword);
+private:
+ QComboBox *m_qtVersionComboBox;
+ QComboBox *m_toolchainComboBox;
+ QCheckBox *m_alwaysSkipCheckBox;
+};
+
+class UnConfiguredSettingsOptionPage : public Core::IOptionsPage
+{
+public:
+ UnConfiguredSettingsOptionPage();
+
+ QString id() const;
+ QString displayName() const;
+ QString category() const;
+ QString displayCategory() const;
+ QIcon categoryIcon() const;
+ bool matches(const QString &searcKeyword) const;
+
+ QWidget *createPage(QWidget *parent);
+ void apply();
+ void finish();
+private:
+ UnConfiguredSettingsWidget *m_widget;
+};
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
+
+#endif // UNCONFIGUREDSETTINGSOPTIONPAGE_H
diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp
index c1d57acf38..ecac81603d 100644
--- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp
+++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp
@@ -35,6 +35,7 @@
#include "ui_targetsetuppage.h"
#include "buildconfigurationinfo.h"
#include "qt4project.h"
+#include "qt4projectmanager.h"
#include "qt4projectmanagerconstants.h"
#include "qt4target.h"
#include "qt4basetargetfactory.h"
@@ -42,6 +43,8 @@
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/task.h>
#include <projectexplorer/taskhub.h>
+#include <projectexplorer/toolchainmanager.h>
+#include <projectexplorer/toolchain.h>
#include <qtsupport/qtversionfactory.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
@@ -54,6 +57,7 @@ using namespace Qt4ProjectManager;
TargetSetupPage::TargetSetupPage(QWidget *parent) :
QWizardPage(parent),
m_importSearch(false),
+ m_useScrollArea(true),
m_maximumQtVersionNumber(INT_MAX, INT_MAX, INT_MAX),
m_spacer(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)),
m_ui(new Internal::Ui::TargetSetupPage)
@@ -61,11 +65,14 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) :
m_ui->setupUi(this);
QWidget *centralWidget = new QWidget(this);
m_ui->scrollArea->setWidget(centralWidget);
- m_layout = new QVBoxLayout;
- centralWidget->setLayout(m_layout);
- m_layout->addSpacerItem(m_spacer);
+ centralWidget->setLayout(new QVBoxLayout);
+ m_ui->centralWidget->setLayout(new QVBoxLayout);
+ m_ui->centralWidget->layout()->setMargin(0);
setTitle(tr("Target Setup"));
+
+ connect(m_ui->descriptionLabel, SIGNAL(linkActivated(QString)),
+ this, SIGNAL(noteTextLinkActivated()));
}
void TargetSetupPage::initializePage()
@@ -130,6 +137,13 @@ void TargetSetupPage::setImportSearch(bool b)
void TargetSetupPage::setupWidgets()
{
+ QLayout *layout = 0;
+ if (m_useScrollArea)
+ layout = m_ui->scrollArea->widget()->layout();
+ else
+ layout = m_ui->centralWidget->layout();
+
+ // Target Page setup
QList<Qt4BaseTargetFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<Qt4BaseTargetFactory>();
bool atLeastOneTargetSelected = false;
foreach (Qt4BaseTargetFactory *factory, factories) {
@@ -159,7 +173,7 @@ void TargetSetupPage::setupWidgets()
atLeastOneTargetSelected |= selectTarget;
m_widgets.insert(id, widget);
m_factories.insert(widget, factory);
- m_layout->addWidget(widget);
+ layout->addWidget(widget);
connect(widget, SIGNAL(selectedToggled()),
this, SIGNAL(completeChanged()));
connect(widget, SIGNAL(newImportBuildConfiguration(BuildConfigurationInfo)),
@@ -173,15 +187,17 @@ void TargetSetupPage::setupWidgets()
widget->setTargetSelected(true);
}
-
- m_layout->addSpacerItem(m_spacer);
+ if (m_useScrollArea)
+ layout->addItem(m_spacer);
if (m_widgets.isEmpty()) {
// Oh no one can create any targets
m_ui->scrollArea->setVisible(false);
+ m_ui->centralWidget->setVisible(false);
m_ui->descriptionLabel->setVisible(false);
m_ui->noValidQtVersionsLabel->setVisible(true);
} else {
- m_ui->scrollArea->setVisible(true);
+ m_ui->scrollArea->setVisible(m_useScrollArea);
+ m_ui->centralWidget->setVisible(!m_useScrollArea);
m_ui->descriptionLabel->setVisible(true);
m_ui->noValidQtVersionsLabel->setVisible(false);
}
@@ -189,11 +205,17 @@ void TargetSetupPage::setupWidgets()
void TargetSetupPage::deleteWidgets()
{
+ QLayout *layout = 0;
+ if (m_useScrollArea)
+ layout = m_ui->scrollArea->widget()->layout();
+ else
+ layout = m_ui->centralWidget->layout();
foreach (Qt4TargetSetupWidget *widget, m_widgets)
delete widget;
m_widgets.clear();
m_factories.clear();
- m_layout->removeItem(m_spacer);
+ if (m_useScrollArea)
+ layout->removeItem(m_spacer);
}
void TargetSetupPage::setProFilePath(const QString &path)
@@ -208,6 +230,11 @@ void TargetSetupPage::setProFilePath(const QString &path)
setupWidgets();
}
+void TargetSetupPage::setNoteText(const QString &text)
+{
+ m_ui->descriptionLabel->setText(text);
+}
+
void TargetSetupPage::setupImportInfos()
{
if (m_importSearch)
@@ -251,14 +278,6 @@ bool TargetSetupPage::setupProject(Qt4ProjectManager::Qt4Project *project)
project->addTarget(target);
}
- // Create a desktop target if nothing else was set up:
- if (project->targets().isEmpty()) {
- const QString desktopTargetId = QLatin1String(Constants::DESKTOP_TARGET_ID);
- if (Qt4BaseTargetFactory *tf = Qt4BaseTargetFactory::qt4BaseTargetFactoryForId(desktopTargetId))
- if (ProjectExplorer::Target *target = tf->create(project, desktopTargetId))
- project->addTarget(target);
- }
-
// Select active target
// a) Simulator target
// b) Desktop target
@@ -276,5 +295,10 @@ bool TargetSetupPage::setupProject(Qt4ProjectManager::Qt4Project *project)
if (activeTarget)
project->setActiveTarget(activeTarget);
- return !project->targets().isEmpty();
+ return true;
+}
+
+void TargetSetupPage::setUseScrollArea(bool b)
+{
+ m_useScrollArea = b;
}
diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.h b/src/plugins/qt4projectmanager/wizards/targetsetuppage.h
index ce7dd8fb03..b8351e3a3f 100644
--- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.h
+++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.h
@@ -91,11 +91,22 @@ public:
/// Sets whether the TargetSetupPage looks on disk for builds of this project
/// call this before \sa initializePage()
void setImportSearch(bool b);
+
+ /// Sets whether the targetsetupage uses a scrollarea
+ /// to host the widgets from the factories
+ /// call this before \sa initializePage()
+ void setUseScrollArea(bool b);
+
bool isComplete() const;
bool setupProject(Qt4ProjectManager::Qt4Project *project);
bool isTargetSelected(const QString &id) const;
void setProFilePath(const QString &dir);
+ /// Overrides the summary text of the targetsetuppage
+ void setNoteText(const QString &text);
+signals:
+ void noteTextLinkActivated();
+
private slots:
void newImportBuildConfiguration(const BuildConfigurationInfo &info);
@@ -109,6 +120,7 @@ private:
QSet<QString> m_requiredTargetFeatures;
Core::FeatureSet m_requiredQtFeatures;
bool m_importSearch;
+ bool m_useScrollArea;
QtSupport::QtVersionNumber m_minimumQtVersionNumber;
QtSupport::QtVersionNumber m_maximumQtVersionNumber;
QString m_proFilePath;
@@ -116,7 +128,6 @@ private:
QMap<QString, Qt4TargetSetupWidget *> m_widgets;
QHash<Qt4TargetSetupWidget *, Qt4BaseTargetFactory *> m_factories;
- QVBoxLayout *m_layout;
QSpacerItem *m_spacer;
Internal::Ui::TargetSetupPage *m_ui;
QList<BuildConfigurationInfo> m_importInfos;
diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.ui b/src/plugins/qt4projectmanager/wizards/targetsetuppage.ui
index 62b8f0f20d..94aa736606 100644
--- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.ui
+++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.ui
@@ -6,79 +6,86 @@
<rect>
<x>0</x>
<y>0</y>
- <width>555</width>
- <height>450</height>
+ <width>230</width>
+ <height>218</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="windowTitle">
<string>Set up Targets for Your Project</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="noValidQtVersionsLabel">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;No valid Qt versions found.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Please add a Qt version in &lt;span style=&quot; font-style:italic;&quot;&gt;Tools &amp;gt; Options &amp;gt; Build &amp;amp; Run&lt;/span&gt; (&lt;span style=&quot; font-style:italic;&quot;&gt;Qt Creator &amp;gt; Preferences &amp;gt; Build &amp;amp; Run &lt;/span&gt;on Mac OS) or via the maintenance tool of the SDK.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="descriptionLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Qt Creator can set up the following targets:</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::NoTextInteraction</set>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::MinimumExpanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>13</width>
- <height>13</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <property name="margin">
+ <number>0</number>
+ </property>
<item>
- <widget class="QScrollArea" name="scrollArea">
- <property name="widgetResizable">
- <bool>true</bool>
- </property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>541</width>
- <height>358</height>
- </rect>
+ <widget class="QWidget" name="setupTargetPage" native="true">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="margin">
+ <number>0</number>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2"/>
- </widget>
+ <item>
+ <widget class="QLabel" name="descriptionLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Qt Creator can set up the following targets:</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="noValidQtVersionsLabel">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;No valid Qt versions found.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Please add a Qt version in &lt;span style=&quot; font-style:italic;&quot;&gt;Tools &amp;gt; Options &amp;gt; Build &amp;amp; Run&lt;/span&gt; (&lt;span style=&quot; font-style:italic;&quot;&gt;Qt Creator &amp;gt; Preferences &amp;gt; Build &amp;amp; Run &lt;/span&gt;on Mac OS) or via the maintenance tool of the SDK.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="centralWidget" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>224</width>
+ <height>66</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
</layout>
diff --git a/src/plugins/qtsupport/qtversionmanager.h b/src/plugins/qtsupport/qtversionmanager.h
index 8e11af254e..611d82f379 100644
--- a/src/plugins/qtsupport/qtversionmanager.h
+++ b/src/plugins/qtsupport/qtversionmanager.h
@@ -75,7 +75,6 @@ public:
BaseQtVersion *qtVersionForQMakeBinary(const Utils::FileName &qmakePath);
- // Used by the projectloadwizard
void addVersion(BaseQtVersion *version);
void removeVersion(BaseQtVersion *version);