summaryrefslogtreecommitdiff
path: root/src/plugins/qt4projectmanager/wizards
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/qt4projectmanager/wizards
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/qt4projectmanager/wizards')
-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
3 files changed, 126 insertions, 84 deletions
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>