From 73f5f7128272b8de942dc0d5246548317fb609ab Mon Sep 17 00:00:00 2001 From: hjk Date: Sun, 2 Sep 2012 22:52:46 +0200 Subject: [PATCH] Improve "Configure Project" target settings hint Make "Configure Project" help text link to options dialog depend on the actual architecture instead of listing all possibilities. Also, make the link work. Task-number: QTCREATORBUG-7810 Change-Id: I78360cdc5b1a836b46dad5c31bdf7335d83e846e Reviewed-by: Tobias Hunger --- .../qt4projectmanager/qt4projectmanager.pro | 1 - .../qt4projectmanager/qt4projectmanager.qbs | 1 - .../wizards/targetsetuppage.cpp | 106 ++++++++++++++++- .../wizards/targetsetuppage.h | 7 +- .../wizards/targetsetuppage.ui | 110 ------------------ 5 files changed, 103 insertions(+), 122 deletions(-) delete mode 100644 src/plugins/qt4projectmanager/wizards/targetsetuppage.ui diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.pro b/src/plugins/qt4projectmanager/qt4projectmanager.pro index f50840f50fa..f0406b0ad63 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.pro +++ b/src/plugins/qt4projectmanager/qt4projectmanager.pro @@ -139,7 +139,6 @@ FORMS += makestep.ui \ qt4projectconfigwidget.ui \ librarydetailswidget.ui \ wizards/testwizardpage.ui \ - wizards/targetsetuppage.ui \ wizards/html5appwizardsourcespage.ui \ wizards/mobilelibrarywizardoptionpage.ui \ wizards/mobileappwizardgenericoptionspage.ui \ diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.qbs b/src/plugins/qt4projectmanager/qt4projectmanager.qbs index 0d83c6f9515..16843041484 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.qbs +++ b/src/plugins/qt4projectmanager/qt4projectmanager.qbs @@ -137,7 +137,6 @@ QtcPlugin { "qt-desktop/simulatorqtversion.h", "qt-desktop/simulatorqtversionfactory.cpp", "qt-desktop/simulatorqtversionfactory.h", - "wizards/targetsetuppage.ui", "wizards/testwizardpage.ui", "wizards/wizards.qrc", "wizards/abstractmobileapp.cpp", diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp index ff26061205e..fdb185466d4 100644 --- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp +++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp @@ -49,13 +49,103 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include -using namespace Qt4ProjectManager; +namespace Qt4ProjectManager { +namespace Internal { static const Core::Id QT_IS_TEMPORARY("Qt4PM.TempQt"); static const Core::Id PROFILE_IS_TEMPORARY("Qt4PM.TempProfile"); static const Core::Id TEMPORARY_OF_PROJECTS("Qt4PM.TempProject"); +class TargetSetupPageUi +{ +public: + QWidget *centralWidget; + QWidget *scrollAreaWidget; + QScrollArea *scrollArea; + QLabel *descriptionLabel; + + void setupUi(QWidget *q) + { + QWidget *setupTargetPage = new QWidget(q); + + descriptionLabel = new QLabel(setupTargetPage); + descriptionLabel->setWordWrap(true); + descriptionLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); + descriptionLabel->setText(TargetSetupPage::tr("Qt Creator can set up the following targets:")); + +#ifdef Q_OS_MAC + QString hint = TargetSetupPage::tr( + "

" + "No valid targets found.

" + "

Please add a target in " + "Qt Creator > Preferences > Build & Run" + " or via the maintenance tool of the SDK.

"); +#else + QString hint = TargetSetupPage::tr( + "

" + "No valid targets found.

" + "

Please add a target in " + "Tools > Options > Build & Run" + " or via the maintenance tool of the SDK.

"); +#endif + + QLabel *noValidProfileLabel = new QLabel(setupTargetPage); + noValidProfileLabel->setWordWrap(true); + noValidProfileLabel->setText(hint); + noValidProfileLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); + + centralWidget = new QWidget(setupTargetPage); + QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Fixed); + policy.setHorizontalStretch(0); + policy.setVerticalStretch(0); + policy.setHeightForWidth(centralWidget->sizePolicy().hasHeightForWidth()); + centralWidget->setSizePolicy(policy); + + scrollAreaWidget = new QWidget(setupTargetPage); + scrollArea = new QScrollArea(scrollAreaWidget); + scrollArea->setWidgetResizable(true); + + QWidget *scrollAreaWidgetContents; + scrollAreaWidgetContents = new QWidget(); + scrollAreaWidgetContents->setGeometry(QRect(0, 0, 230, 81)); + scrollArea->setWidget(scrollAreaWidgetContents); + + QVBoxLayout *verticalLayout = new QVBoxLayout(scrollAreaWidget); + verticalLayout->setSpacing(0); + verticalLayout->setContentsMargins(0, 0, 0, 0); + verticalLayout->addWidget(scrollArea); + + QVBoxLayout *verticalLayout_2 = new QVBoxLayout(setupTargetPage); + verticalLayout_2->addWidget(descriptionLabel); + verticalLayout_2->addWidget(noValidProfileLabel); + verticalLayout_2->addWidget(centralWidget); + verticalLayout_2->addWidget(scrollAreaWidget); + + QVBoxLayout *verticalLayout_3 = new QVBoxLayout(q); + verticalLayout_3->setContentsMargins(0, 0, 0, -1); + verticalLayout_3->addWidget(setupTargetPage); + + QObject::connect(noValidProfileLabel, SIGNAL(linkActivated(QString)), + q, SIGNAL(noteTextLinkActivated())); + QObject::connect(descriptionLabel, SIGNAL(linkActivated(QString)), + q, SIGNAL(noteTextLinkActivated())); + } +}; + +} // namespace Internal + +using namespace Internal; + TargetSetupPage::TargetSetupPage(QWidget *parent) : QWizardPage(parent), m_requiredMatcher(0), @@ -64,13 +154,20 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) : m_importSearch(false), m_ignoreUpdates(false), m_firstWidget(0), - m_ui(new Internal::Ui::TargetSetupPage), + m_ui(new TargetSetupPageUi), m_importWidget(new Internal::ImportWidget(this)), m_spacer(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding)) { setObjectName(QLatin1String("TargetSetupPage")); + setWindowTitle(tr("Set up Targets for Your Project")); m_ui->setupUi(this); + QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Preferred); + policy.setHorizontalStretch(0); + policy.setVerticalStretch(0); + policy.setHeightForWidth(sizePolicy().hasHeightForWidth()); + setSizePolicy(policy); + QWidget *centralWidget = new QWidget(this); m_ui->scrollArea->setWidget(centralWidget); centralWidget->setLayout(new QVBoxLayout); @@ -82,9 +179,6 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) : setTitle(tr("Target Setup")); - connect(m_ui->descriptionLabel, SIGNAL(linkActivated(QString)), - this, SIGNAL(noteTextLinkActivated())); - ProjectExplorer::ProfileManager *sm = ProjectExplorer::ProfileManager::instance(); connect(sm, SIGNAL(profileAdded(ProjectExplorer::Profile*)), this, SLOT(handleProfileAddition(ProjectExplorer::Profile*))); @@ -589,3 +683,5 @@ void TargetSetupPage::setUseScrollArea(bool b) m_ui->scrollAreaWidget->setVisible(b); m_ui->centralWidget->setVisible(!b); } + +} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.h b/src/plugins/qt4projectmanager/wizards/targetsetuppage.h index 08c18b13188..a8b719e9711 100644 --- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.h +++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.h @@ -46,10 +46,7 @@ class Qt4Project; namespace Internal { class ImportWidget; - -namespace Ui { -class TargetSetupPage; -} // namespace Ui +class TargetSetupPageUi; } // namespace Internal /// \internal @@ -122,7 +119,7 @@ private: QMap m_widgets; Qt4TargetSetupWidget *m_firstWidget; - Internal::Ui::TargetSetupPage *m_ui; + Internal::TargetSetupPageUi *m_ui; Internal::ImportWidget *m_importWidget; QSpacerItem *m_spacer; diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.ui b/src/plugins/qt4projectmanager/wizards/targetsetuppage.ui deleted file mode 100644 index fa36001aee2..00000000000 --- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.ui +++ /dev/null @@ -1,110 +0,0 @@ - - - Qt4ProjectManager::Internal::TargetSetupPage - - - - 0 - 0 - 256 - 297 - - - - - 0 - 0 - - - - Set up Targets for Your Project - - - - 0 - - - 0 - - - 0 - - - - - - - - - 0 - 0 - - - - Qt Creator can set up the following targets: - - - true - - - Qt::LinksAccessibleByMouse - - - - - - - <html><head/><body><p><span style=" font-weight:600;">No valid targets found.</span></p><p>Please add a target in <a href="buildandrun"><span style=" text-decoration: underline; color:#0000ff;">Tools &gt; Options &gt; Build &amp; Run</span></a> (<a href="buildandrun"><span style=" text-decoration: underline; color:#0000ff;">Qt Creator &gt; Preferences &gt; Build &amp; Run</span></a> on Mac OS) or via the maintenance tool of the SDK.</p></body></html> - - - true - - - - - - - - 0 - 0 - - - - - - - - - 0 - - - 0 - - - - - true - - - - - 0 - 0 - 230 - 81 - - - - - - - - - - - - - - - -