Always show a selection of the MSVC versions available, even for one.

Also, warn if no MSVC version could be detected even though the Qt
version was build with MSVC. This should make the tracing of problem
a bit easier. Before, we have hidden the GUI elements if only one
compiler version could be found. This looks inconsistent and causes
confusion.
This commit is contained in:
Daniel Molkentin
2009-05-18 14:58:19 +02:00
parent 55029f41fb
commit 9a1e869cb4
3 changed files with 108 additions and 55 deletions

View File

@@ -5,6 +5,7 @@
#include "qtversionmanager.h" #include "qtversionmanager.h"
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <QtCore/QDebug>
#include <QtCore/QDir> #include <QtCore/QDir>
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
@@ -254,25 +255,32 @@ void QtOptionsPageWidget::makeMingwVisible(bool visible)
m_ui->mingwPath->setVisible(visible); m_ui->mingwPath->setVisible(visible);
} }
void QtOptionsPageWidget::makeMSVCVisible(bool visible)
{
m_ui->msvcLabel->setVisible(visible);
m_ui->msvcComboBox->setVisible(visible);
m_ui->msvcNotFoundLabel->setVisible(false);
}
void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item) void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
{ {
m_ui->msvcComboBox->setVisible(false);
if (item) { if (item) {
int index = m_ui->qtdirList->indexOfTopLevelItem(item); int index = m_ui->qtdirList->indexOfTopLevelItem(item);
m_ui->errorLabel->setText(""); m_ui->errorLabel->setText("");
ProjectExplorer::ToolChain::ToolChainType t = m_versions.at(index)->toolchainType(); ProjectExplorer::ToolChain::ToolChainType t = m_versions.at(index)->toolchainType();
if (t == ProjectExplorer::ToolChain::MinGW) { if (t == ProjectExplorer::ToolChain::MinGW) {
m_ui->msvcComboBox->setVisible(false); makeMSVCVisible(false);
makeMingwVisible(true); makeMingwVisible(true);
m_ui->mingwPath->setPath(m_versions.at(index)->mingwDirectory()); m_ui->mingwPath->setPath(m_versions.at(index)->mingwDirectory());
} else if (t == ProjectExplorer::ToolChain::MSVC || t == ProjectExplorer::ToolChain::WINCE){ } else if (t == ProjectExplorer::ToolChain::MSVC || t == ProjectExplorer::ToolChain::WINCE){
m_ui->msvcComboBox->setVisible(false); makeMSVCVisible(false);
makeMingwVisible(false); makeMingwVisible(false);
QStringList msvcEnvironments = ProjectExplorer::ToolChain::availableMSVCVersions(); QStringList msvcEnvironments = ProjectExplorer::ToolChain::availableMSVCVersions();
if (msvcEnvironments.count() == 0) { if (msvcEnvironments.count() == 0) {
} else if (msvcEnvironments.count() == 1) { m_ui->msvcLabel->setVisible(true);
m_ui->msvcNotFoundLabel->setVisible(true);
} else { } else {
m_ui->msvcComboBox->setVisible(true); makeMSVCVisible(true);
bool block = m_ui->msvcComboBox->blockSignals(true); bool block = m_ui->msvcComboBox->blockSignals(true);
m_ui->msvcComboBox->clear(); m_ui->msvcComboBox->clear();
foreach(const QString &msvcenv, msvcEnvironments) { foreach(const QString &msvcenv, msvcEnvironments) {
@@ -284,7 +292,7 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
m_ui->msvcComboBox->blockSignals(block); m_ui->msvcComboBox->blockSignals(block);
} }
} else if (t == ProjectExplorer::ToolChain::INVALID) { } else if (t == ProjectExplorer::ToolChain::INVALID) {
m_ui->msvcComboBox->setVisible(false); makeMSVCVisible(false);
makeMingwVisible(false); makeMingwVisible(false);
if (!m_versions.at(index)->isInstalled()) if (!m_versions.at(index)->isInstalled())
m_ui->errorLabel->setText(tr("The Qt Version %1 is not installed. Run make install") m_ui->errorLabel->setText(tr("The Qt Version %1 is not installed. Run make install")
@@ -292,14 +300,14 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
else else
m_ui->errorLabel->setText(tr("%1 is not a valid Qt directory").arg(QDir::toNativeSeparators(m_versions.at(index)->path()))); m_ui->errorLabel->setText(tr("%1 is not a valid Qt directory").arg(QDir::toNativeSeparators(m_versions.at(index)->path())));
} else { //ProjectExplorer::ToolChain::GCC } else { //ProjectExplorer::ToolChain::GCC
m_ui->msvcComboBox->setVisible(false); makeMSVCVisible(false);
makeMingwVisible(false); makeMingwVisible(false);
m_ui->errorLabel->setText(tr("Found Qt version %1, using mkspec %2") m_ui->errorLabel->setText(tr("Found Qt version %1, using mkspec %2")
.arg(m_versions.at(index)->qtVersionString(), .arg(m_versions.at(index)->qtVersionString(),
m_versions.at(index)->mkspec())); m_versions.at(index)->mkspec()));
} }
} else { } else {
m_ui->msvcComboBox->setVisible(false); makeMSVCVisible(false);
makeMingwVisible(false); makeMingwVisible(false);
} }
} }

View File

@@ -72,6 +72,7 @@ private slots:
void removeQtDir(); void removeQtDir();
void updateState(); void updateState();
void makeMingwVisible(bool visible); void makeMingwVisible(bool visible);
void makeMSVCVisible(bool visible);
void onQtBrowsed(); void onQtBrowsed();
void onMingwBrowsed(); void onMingwBrowsed();
void defaultChanged(int index); void defaultChanged(int index);

View File

@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>811</width> <width>577</width>
<height>505</height> <height>477</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@@ -16,8 +16,36 @@
<property name="title"> <property name="title">
<string>Qt versions</string> <string>Qt versions</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="3"> <item row="0" column="0" colspan="2">
<widget class="QTreeWidget" name="qtdirList">
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="columnCount">
<number>3</number>
</property>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Path</string>
</property>
</column>
<column>
<property name="text">
<string>Debugging Helper</string>
</property>
</column>
</widget>
</item>
<item row="0" column="2">
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
@@ -66,34 +94,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="0" colspan="3">
<widget class="QTreeWidget" name="qtdirList">
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="columnCount">
<number>3</number>
</property>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Path</string>
</property>
</column>
<column>
<property name="text">
<string>Debugging Helper</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="versionNameLabel"> <widget class="QLabel" name="versionNameLabel">
<property name="text"> <property name="text">
@@ -101,7 +101,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" colspan="2"> <item row="1" column="1">
<widget class="QLineEdit" name="nameEdit"/> <widget class="QLineEdit" name="nameEdit"/>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
@@ -111,6 +111,9 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1">
<widget class="Core::Utils::PathChooser" name="qtPath" native="true"/>
</item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="mingwLabel"> <widget class="QLabel" name="mingwLabel">
<property name="text"> <property name="text">
@@ -118,33 +121,67 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0" colspan="4"> <item row="3" column="1">
<widget class="QLabel" name="errorLabel"> <widget class="Core::Utils::PathChooser" name="mingwPath" native="true"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="msvcLabel">
<property name="text"> <property name="text">
<string/> <string>MSVC Version:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1" colspan="2"> <item row="4" column="1">
<widget class="QComboBox" name="msvcComboBox"/> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="msvcComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="msvcNotFoundLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;Unable to detect MSVC version.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item> </item>
<item row="2" column="1" colspan="2"> <item row="6" column="0">
<widget class="Core::Utils::PathChooser" name="qtPath" native="true"/>
</item>
<item row="3" column="1" colspan="2">
<widget class="Core::Utils::PathChooser" name="mingwPath" native="true"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Debugging Helper:</string> <string>Debugging Helper:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1" colspan="2"> <item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLabel" name="debuggingHelperStateLabel"> <widget class="QLabel" name="debuggingHelperStateLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
@@ -166,11 +203,18 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="7" column="1">
<widget class="QLabel" name="errorLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QLabel" name="defaultLabel"> <widget class="QLabel" name="defaultLabel">
<property name="text"> <property name="text">