diff --git a/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp index 7d7de373720..4711c5e9634 100644 --- a/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp +++ b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp @@ -126,8 +126,6 @@ TargetSetupPageWrapper::TargetSetupPageWrapper(ProjectExplorer::Project *project connect(m_configureButton, SIGNAL(clicked()), this, SLOT(done())); - connect(m_targetSetupPage, SIGNAL(noteTextLinkActivated()), - this, SLOT(noteTextLinkActivated())); connect(m_targetSetupPage, SIGNAL(completeChanged()), this, SLOT(completeChanged())); connect(ProjectExplorer::KitManager::instance(), SIGNAL(defaultkitChanged()), @@ -146,31 +144,30 @@ void TargetSetupPageWrapper::updateNoteText() { ProjectExplorer::Kit *k = ProjectExplorer::KitManager::instance()->defaultKit(); - QString text; - if (!k) - text = tr("
The project %1 is not yet configured.
" - "Qt Creator cannot parse the project, because no target " - "has been set up. You can set up targets " - "in the options.
") + bool showHint = false; + if (!k) { + text = tr("The project %1 is not yet configured.The project %1 is not yet configured.
" - "Qt Creator uses the target %2 " - "to parse the project. You can edit " - "targets in the options.
") + showHint = true; + } else if (k->isValid()) { + text = tr("The project %1 is not yet configured.The project %1 is not yet configured.
" - "Qt Creator uses the invalid target %2 " - "to parse the project. You can edit " - "targets in the options
") + showHint = false; + } else { + text = tr("The project %1 is not yet configured." - "No valid kits found.
" - "Please add a kit in " - "Qt Creator > Preferences > Build & Run" - " or via the maintenance tool of the SDK.
"); -#else - QString hint = TargetSetupPage::tr( - "" - "No valid kits found.
" - "Please add a kit in " - "Tools > Options > Build & Run" - " or via the maintenance tool of the SDK.
"); -#endif - - QLabel *noValidKitLabel = new QLabel(setupTargetPage); - noValidKitLabel->setWordWrap(true); - noValidKitLabel->setText(hint); - noValidKitLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); + optionHintLabel = new QLabel(setupTargetPage); + optionHintLabel->setWordWrap(true); + optionHintLabel->setText(TargetSetupPage::tr( + "Please add a kit in the options " + "or via the maintenance tool of the SDK.")); + optionHintLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); + optionHintLabel->setVisible(false); centralWidget = new QWidget(setupTargetPage); QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Fixed); @@ -125,8 +122,10 @@ public: verticalLayout->addWidget(scrollArea); QVBoxLayout *verticalLayout_2 = new QVBoxLayout(setupTargetPage); - verticalLayout_2->addWidget(descriptionLabel); + verticalLayout_2->addWidget(headerLabel); verticalLayout_2->addWidget(noValidKitLabel); + verticalLayout_2->addWidget(descriptionLabel); + verticalLayout_2->addWidget(optionHintLabel); verticalLayout_2->addWidget(centralWidget); verticalLayout_2->addWidget(scrollAreaWidget); @@ -134,10 +133,8 @@ public: verticalLayout_3->setContentsMargins(0, 0, 0, -1); verticalLayout_3->addWidget(setupTargetPage); - QObject::connect(noValidKitLabel, SIGNAL(linkActivated(QString)), - q, SIGNAL(noteTextLinkActivated())); - QObject::connect(descriptionLabel, SIGNAL(linkActivated(QString)), - q, SIGNAL(noteTextLinkActivated())); + QObject::connect(optionHintLabel, SIGNAL(linkActivated(QString)), + q, SLOT(openOptions())); } }; @@ -155,7 +152,8 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) : m_firstWidget(0), m_ui(new TargetSetupPageUi), m_importWidget(new Internal::ImportWidget(this)), - m_spacer(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding)) + m_spacer(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding)), + m_forceOptionHint(false) { setObjectName(QLatin1String("TargetSetupPage")); setWindowTitle(tr("Select Kits for Your Project")); @@ -358,10 +356,10 @@ void TargetSetupPage::removeProject(ProjectExplorer::Kit *k, const QString &path void TargetSetupPage::setProFilePath(const QString &path) { m_proFilePath = path; - if (!m_proFilePath.isEmpty()) { - m_ui->descriptionLabel->setText(tr("Qt Creator can use the following kits for project %1:", - "%1: Project name").arg(QFileInfo(m_proFilePath).baseName())); - } + if (!m_proFilePath.isEmpty()) + m_ui->headerLabel->setText(tr("Qt Creator can use the following kits for project %1:", + "%1: Project name").arg(QFileInfo(m_proFilePath).baseName())); + m_ui->headerLabel->setVisible(!m_proFilePath.isEmpty()); if (m_widgets.isEmpty()) return; @@ -373,6 +371,13 @@ void TargetSetupPage::setProFilePath(const QString &path) void TargetSetupPage::setNoteText(const QString &text) { m_ui->descriptionLabel->setText(text); + m_ui->descriptionLabel->setVisible(!text.isEmpty()); +} + +void TargetSetupPage::showOptionsHint(bool show) +{ + m_forceOptionHint = show; + updateVisibility(); } void TargetSetupPage::import(const Utils::FileName &path) @@ -584,9 +589,19 @@ void TargetSetupPage::updateVisibility() m_ui->scrollAreaWidget->setVisible(m_baseLayout == m_ui->scrollArea->widget()->layout()); m_ui->centralWidget->setVisible(m_baseLayout == m_ui->centralWidget->layout()); + bool hasKits = !m_widgets.isEmpty(); + m_ui->noValidKitLabel->setVisible(!hasKits); + m_ui->optionHintLabel->setVisible(m_forceOptionHint || !hasKits); + emit completeChanged(); } +void TargetSetupPage::openOptions() +{ + Core::ICore::instance()->showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY), + QLatin1String(ProjectExplorer::Constants::KITS_SETTINGS_PAGE_ID)); +} + void TargetSetupPage::removeWidget(ProjectExplorer::Kit *k) { Qt4TargetSetupWidget *widget = m_widgets.value(k->id()); diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.h b/src/plugins/qt4projectmanager/wizards/targetsetuppage.h index 8e41739c8ff..c6206571ce1 100644 --- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.h +++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.h @@ -81,8 +81,7 @@ public: /// Overrides the summary text of the targetsetuppage void setNoteText(const QString &text); -signals: - void noteTextLinkActivated(); + void showOptionsHint(bool show); private slots: void import(const Utils::FileName &path); @@ -91,6 +90,7 @@ private slots: void handleKitRemoval(ProjectExplorer::Kit *k); void handleKitUpdate(ProjectExplorer::Kit *k); void updateVisibility(); + void openOptions(); private: void selectAtLeastOneKit(); @@ -123,6 +123,8 @@ private: Internal::ImportWidget *m_importWidget; QSpacerItem *m_spacer; + + bool m_forceOptionHint; }; } // namespace Qt4ProjectManager