forked from qt-creator/qt-creator
Qt: Add button to remove all invalid Qt versions
Add a button to remove all invalid Qt versions. Task-number: QTCREATORBUG-3969
This commit is contained in:
@@ -60,6 +60,7 @@
|
|||||||
#include <QtGui/QHelpEvent>
|
#include <QtGui/QHelpEvent>
|
||||||
#include <QtGui/QToolTip>
|
#include <QtGui/QToolTip>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
|
#include <QtGui/QMessageBox>
|
||||||
|
|
||||||
enum ModelRoles { VersionIdRole = Qt::UserRole, BuildLogRole, BuildRunningRole};
|
enum ModelRoles { VersionIdRole = Qt::UserRole, BuildLogRole, BuildRunningRole};
|
||||||
|
|
||||||
@@ -214,6 +215,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver
|
|||||||
connect(m_debuggingHelperUi->showLogButton, SIGNAL(clicked()),
|
connect(m_debuggingHelperUi->showLogButton, SIGNAL(clicked()),
|
||||||
this, SLOT(slotShowDebuggingBuildLog()));
|
this, SLOT(slotShowDebuggingBuildLog()));
|
||||||
|
|
||||||
|
connect(m_ui->cleanUpButton, SIGNAL(clicked()), this, SLOT(cleanUpQtVersions()));
|
||||||
showEnvironmentPage(0);
|
showEnvironmentPage(0);
|
||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
@@ -300,6 +302,36 @@ void QtOptionsPageWidget::debuggingHelperBuildFinished(int qtVersionId, Debuggin
|
|||||||
showDebuggingBuildLog(item);
|
showDebuggingBuildLog(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtOptionsPageWidget::cleanUpQtVersions()
|
||||||
|
{
|
||||||
|
QStringList toRemove;
|
||||||
|
foreach (const QtVersion *v, m_versions) {
|
||||||
|
if (!v->isValid())
|
||||||
|
toRemove.append(v->displayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toRemove.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (QMessageBox::warning(0, tr("Remove invalid Qt Versions"),
|
||||||
|
tr("Do you want to remove all invalid Qt Versions?<br>"
|
||||||
|
"<ul><li>%1</li></ul><br>"
|
||||||
|
"will be removed.").arg(toRemove.join(QLatin1String("</li><li>"))),
|
||||||
|
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (int i = m_versions.count() - 1; i >= 0; --i) {
|
||||||
|
if (!m_versions.at(i)->isValid()) {
|
||||||
|
QTreeWidgetItem *item = treeItemForIndex(i);
|
||||||
|
delete item;
|
||||||
|
|
||||||
|
delete m_versions.at(i);
|
||||||
|
m_versions.removeAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
|
||||||
void QtOptionsPageWidget::buildDebuggingHelper(DebuggingHelperBuildTask::Tools tools)
|
void QtOptionsPageWidget::buildDebuggingHelper(DebuggingHelperBuildTask::Tools tools)
|
||||||
{
|
{
|
||||||
const int index = currentIndex();
|
const int index = currentIndex();
|
||||||
@@ -592,11 +624,13 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
|
|||||||
|
|
||||||
void QtOptionsPageWidget::updateState()
|
void QtOptionsPageWidget::updateState()
|
||||||
{
|
{
|
||||||
|
bool hasInvalidVersion = false;
|
||||||
for (int i = 0; i < m_versions.count(); ++i) {
|
for (int i = 0; i < m_versions.count(); ++i) {
|
||||||
QTreeWidgetItem *item = treeItemForIndex(i);
|
QTreeWidgetItem *item = treeItemForIndex(i);
|
||||||
if (!m_versions.at(i)->isValid()) {
|
if (!m_versions.at(i)->isValid()) {
|
||||||
if (item)
|
if (item)
|
||||||
item->setIcon(0, m_invalidVersionIcon);
|
item->setIcon(0, m_invalidVersionIcon);
|
||||||
|
hasInvalidVersion = true;
|
||||||
} else {
|
} else {
|
||||||
if (item)
|
if (item)
|
||||||
item->setIcon(0, m_validVersionIcon);
|
item->setIcon(0, m_validVersionIcon);
|
||||||
@@ -607,6 +641,7 @@ void QtOptionsPageWidget::updateState()
|
|||||||
const bool enabled = version != 0;
|
const bool enabled = version != 0;
|
||||||
const bool isAutodetected = enabled && version->isAutodetected();
|
const bool isAutodetected = enabled && version->isAutodetected();
|
||||||
m_ui->delButton->setEnabled(enabled && !isAutodetected);
|
m_ui->delButton->setEnabled(enabled && !isAutodetected);
|
||||||
|
m_ui->cleanUpButton->setEnabled(hasInvalidVersion);
|
||||||
m_versionUi->nameEdit->setEnabled(enabled && !isAutodetected);
|
m_versionUi->nameEdit->setEnabled(enabled && !isAutodetected);
|
||||||
m_versionUi->qmakePath->setEnabled(enabled && !isAutodetected);
|
m_versionUi->qmakePath->setEnabled(enabled && !isAutodetected);
|
||||||
bool s60SDKPathEnabled = enabled &&
|
bool s60SDKPathEnabled = enabled &&
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ private slots:
|
|||||||
void buildQmlObserver();
|
void buildQmlObserver();
|
||||||
void slotShowDebuggingBuildLog();
|
void slotShowDebuggingBuildLog();
|
||||||
void debuggingHelperBuildFinished(int qtVersionId, DebuggingHelperBuildTask::Tools tools, const QString &output);
|
void debuggingHelperBuildFinished(int qtVersionId, DebuggingHelperBuildTask::Tools tools, const QString &output);
|
||||||
|
void cleanUpQtVersions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateDescriptionLabel();
|
void updateDescriptionLabel();
|
||||||
|
|||||||
@@ -80,6 +80,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cleanUpButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Clean up</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user