From cc275c062dfac464a230ae9b008c6357873cf2fe Mon Sep 17 00:00:00 2001
From: Tobias Hunger 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. The project %1 is not yet configured. Qt Creator uses the target %2 "
- "to parse the project. You can edit "
- "targets in the options. 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 "
- "No valid kits found. Please add a kit in "
- "Qt Creator > Preferences > Build & Run"
- " or via the maintenance tool of the SDK.
"
+ "Qt Creator cannot parse the project, because no kit "
+ "has been set up.")
.arg(m_project->displayName());
- else if (k->isValid())
- text = tr("
"
+ "Qt Creator uses the kit %2 to parse the project.")
.arg(m_project->displayName())
.arg(k->displayName());
- else
- text = tr("
"
+ "Qt Creator uses the invalid kit %2 to parse the project.")
.arg(m_project->displayName())
.arg(k->displayName());
-
+ showHint = true;
+ }
m_targetSetupPage->setNoteText(text);
+ m_targetSetupPage->showOptionsHint(showHint);
}
void TargetSetupPageWrapper::keyPressEvent(QKeyEvent *event)
@@ -195,12 +192,6 @@ void TargetSetupPageWrapper::done()
Core::ICore::instance()->modeManager()->activateMode(Core::Constants::MODE_EDIT);
}
-void TargetSetupPageWrapper::noteTextLinkActivated()
-{
- Core::ICore::instance()->showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
- QLatin1String(ProjectExplorer::Constants::KITS_SETTINGS_PAGE_ID));
-}
-
void TargetSetupPageWrapper::completeChanged()
{
m_configureButton->setEnabled(m_targetSetupPage->isComplete());
diff --git a/src/plugins/qt4projectmanager/unconfiguredprojectpanel.h b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.h
index dd6e1cbe711..464bf80d3c0 100644
--- a/src/plugins/qt4projectmanager/unconfiguredprojectpanel.h
+++ b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.h
@@ -67,7 +67,6 @@ protected:
void keyPressEvent(QKeyEvent *event);
private slots:
void done();
- void noteTextLinkActivated();
void kitUpdated(ProjectExplorer::Kit *k);
void updateNoteText();
void completeChanged();
diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp
index 52af4b325f1..2e7eab38798 100644
--- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp
+++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp
@@ -71,37 +71,34 @@ public:
QWidget *centralWidget;
QWidget *scrollAreaWidget;
QScrollArea *scrollArea;
+ QLabel *headerLabel;
QLabel *descriptionLabel;
+ QLabel *noValidKitLabel;
+ QLabel *optionHintLabel;
void setupUi(QWidget *q)
{
QWidget *setupTargetPage = new QWidget(q);
+ headerLabel = new QLabel(setupTargetPage);
+ headerLabel->setWordWrap(true);
+ headerLabel->setVisible(false);
+
+ noValidKitLabel = new QLabel(setupTargetPage);
+ noValidKitLabel->setWordWrap(true);
+ noValidKitLabel->setText(TargetSetupPage::tr("No valid kits found."));
+
descriptionLabel = new QLabel(setupTargetPage);
descriptionLabel->setWordWrap(true);
- descriptionLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
- descriptionLabel->setText(TargetSetupPage::tr("Qt Creator can use the following kits:"));
+ descriptionLabel->setVisible(false);
-#ifdef Q_OS_MAC
- 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