Commit db9d1d42 authored by con's avatar con
Browse files

isSystemVersion property to isAutodetected property

parent 2a101e53
......@@ -98,7 +98,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver
for (int i = 0; i < m_versions.count(); ++i) {
const QtVersion * const version = m_versions.at(i);
QTreeWidgetItem *item = new QTreeWidgetItem(version->isSystemVersion()? autoItem : manualItem);
QTreeWidgetItem *item = new QTreeWidgetItem(version->isAutodetected()? autoItem : manualItem);
item->setText(0, version->name());
item->setText(1, QDir::toNativeSeparators(version->path()));
item->setData(0, Qt::UserRole, version->uniqueId());
......@@ -241,11 +241,11 @@ void QtOptionsPageWidget::updateState()
{
int currentIndex = indexForTreeItem(m_ui->qtdirList->currentItem());
bool enabled = (currentIndex >= 0);
bool isSystemVersion = (enabled
&& m_versions.at(currentIndex)->isSystemVersion());
m_ui->delButton->setEnabled(enabled && !isSystemVersion);
m_ui->nameEdit->setEnabled(enabled && !isSystemVersion);
m_ui->qtPath->setEnabled(enabled && !isSystemVersion);
bool isAutodetected = (enabled
&& m_versions.at(currentIndex)->isAutodetected());
m_ui->delButton->setEnabled(enabled && !isAutodetected);
m_ui->nameEdit->setEnabled(enabled && !isAutodetected);
m_ui->qtPath->setEnabled(enabled && !isAutodetected);
m_ui->mingwPath->setEnabled(enabled);
bool hasLog = enabled && !m_ui->qtdirList->currentItem()->data(2, Qt::UserRole).toString().isEmpty();
......
......@@ -85,10 +85,15 @@ QtVersionManager::QtVersionManager()
id = getUniqueId();
else if (id > m_idcount)
m_idcount = id;
bool isAutodetected;
if (s->contains("isAutodetected"))
isAutodetected = s->value("isAutodetected", false).toBool();
else // compatibility
isAutodetected = s->value("IsSystemVersion", false).toBool();
QtVersion *version = new QtVersion(s->value("Name").toString(),
s->value("Path").toString(),
id,
s->value("IsSystemVersion", false).toBool());
isAutodetected);
version->setMingwDirectory(s->value("MingwDirectory").toString());
version->setMsvcVersion(s->value("msvcVersion").toString());
m_versions.append(version);
......@@ -193,7 +198,7 @@ void QtVersionManager::writeVersionsIntoSettings()
s->setValue("Id", m_versions.at(i)->uniqueId());
s->setValue("MingwDirectory", m_versions.at(i)->mingwDirectory());
s->setValue("msvcVersion", m_versions.at(i)->msvcVersion());
s->setValue("IsSystemVersion", m_versions.at(i)->isSystemVersion());
s->setValue("isAutodetected", m_versions.at(i)->isAutodetected());
}
s->endArray();
}
......@@ -283,7 +288,7 @@ void QtVersionManager::updateSystemVersion()
}
foreach (QtVersion *version, m_versions) {
if (version->isSystemVersion()) {
if (version->isAutodetected()) { //TODO this needs to additionally check for the autodetectionsource
version->setPath(systemQtPath);
version->setName(tr("Qt in PATH"));
haveSystemVersion = true;
......@@ -349,9 +354,9 @@ void QtVersionManager::setNewQtVersions(QList<QtVersion *> newVersions, int newD
/// QtVersion
///
QtVersion::QtVersion(const QString &name, const QString &path, int id, bool isSystemVersion)
QtVersion::QtVersion(const QString &name, const QString &path, int id, bool isAutodetected)
: m_name(name),
m_isSystemVersion(isSystemVersion),
m_isAutodetected(isAutodetected),
m_hasDebuggingHelper(false),
m_notInstalled(false),
m_defaultConfigIsDebug(true),
......@@ -370,7 +375,7 @@ QtVersion::QtVersion(const QString &name, const QString &path, int id, bool isSy
QtVersion::QtVersion(const QString &name, const QString &path)
: m_name(name),
m_isSystemVersion(false),
m_isAutodetected(false),
m_hasDebuggingHelper(false),
m_mkspecUpToDate(false),
m_versionInfoUpToDate(false),
......
......@@ -50,7 +50,7 @@ class QtVersion
friend class QtVersionManager;
public:
QtVersion(const QString &name, const QString &path);
QtVersion(const QString &name, const QString &path, int id, bool isSystemVersion = false);
QtVersion(const QString &name, const QString &path, int id, bool isAutodetected = false);
QtVersion()
:m_name(QString::null), m_id(-1), m_toolChain(0)
{ setPath(QString::null); }
......@@ -58,7 +58,7 @@ public:
bool isValid() const; //TOOD check that the dir exists and the name is non empty
bool isInstalled() const;
bool isSystemVersion() const { return m_isSystemVersion; }
bool isAutodetected() const { return m_isAutodetected; }
QString name() const;
QString path() const;
......@@ -129,7 +129,7 @@ private:
QString m_mingwDirectory;
QString m_msvcVersion;
int m_id;
bool m_isSystemVersion;
bool m_isAutodetected;
bool m_hasDebuggingHelper;
mutable bool m_mkspecUpToDate;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment