Commit b6114dfa authored by dt's avatar dt

Refactoring: Rename QtDirWidget to QtOptionsPageWidget

More accurate name.
parent 4274156b
...@@ -46,7 +46,7 @@ QString QtOptionsPage::trCategory() const ...@@ -46,7 +46,7 @@ QString QtOptionsPage::trCategory() const
QWidget *QtOptionsPage::createPage(QWidget *parent) QWidget *QtOptionsPage::createPage(QWidget *parent)
{ {
QtVersionManager *vm = QtVersionManager::instance(); QtVersionManager *vm = QtVersionManager::instance();
m_widget = new QtDirWidget(parent, vm->versions(), vm->currentQtVersion()); m_widget = new QtOptionsPageWidget(parent, vm->versions(), vm->currentQtVersion());
return m_widget; return m_widget;
} }
...@@ -59,7 +59,7 @@ void QtOptionsPage::apply() ...@@ -59,7 +59,7 @@ void QtOptionsPage::apply()
} }
//----------------------------------------------------- //-----------------------------------------------------
QtDirWidget::QtDirWidget(QWidget *parent, QList<QtVersion *> versions, QtVersion *defaultVersion) QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> versions, QtVersion *defaultVersion)
: QWidget(parent) : QWidget(parent)
, m_defaultVersion(versions.indexOf(defaultVersion)) , m_defaultVersion(versions.indexOf(defaultVersion))
, m_specifyNameString(tr("<specify a name>")) , m_specifyNameString(tr("<specify a name>"))
...@@ -138,7 +138,7 @@ QtDirWidget::QtDirWidget(QWidget *parent, QList<QtVersion *> versions, QtVersion ...@@ -138,7 +138,7 @@ QtDirWidget::QtDirWidget(QWidget *parent, QList<QtVersion *> versions, QtVersion
updateState(); updateState();
} }
void QtDirWidget::buildDebuggingHelper() void QtOptionsPageWidget::buildDebuggingHelper()
{ {
// Find the qt version for this button.. // Find the qt version for this button..
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem(); QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
...@@ -161,7 +161,7 @@ void QtDirWidget::buildDebuggingHelper() ...@@ -161,7 +161,7 @@ void QtDirWidget::buildDebuggingHelper()
m_ui->showLogButton->setEnabled(true); m_ui->showLogButton->setEnabled(true);
} }
void QtDirWidget::showDebuggingBuildLog() void QtOptionsPageWidget::showDebuggingBuildLog()
{ {
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem(); QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
if (!currentItem) if (!currentItem)
...@@ -175,13 +175,13 @@ void QtDirWidget::showDebuggingBuildLog() ...@@ -175,13 +175,13 @@ void QtDirWidget::showDebuggingBuildLog()
dlg.exec(); dlg.exec();
} }
QtDirWidget::~QtDirWidget() QtOptionsPageWidget::~QtOptionsPageWidget()
{ {
qDeleteAll(m_versions); qDeleteAll(m_versions);
delete m_ui; delete m_ui;
} }
void QtDirWidget::addQtDir() void QtOptionsPageWidget::addQtDir()
{ {
QtVersion *newVersion = new QtVersion(m_specifyNameString, m_specifyPathString); QtVersion *newVersion = new QtVersion(m_specifyNameString, m_specifyPathString);
m_versions.append(newVersion); m_versions.append(newVersion);
...@@ -201,7 +201,7 @@ void QtDirWidget::addQtDir() ...@@ -201,7 +201,7 @@ void QtDirWidget::addQtDir()
m_ui->nameEdit->selectAll(); m_ui->nameEdit->selectAll();
} }
void QtDirWidget::removeQtDir() void QtOptionsPageWidget::removeQtDir()
{ {
QTreeWidgetItem *item = m_ui->qtdirList->currentItem(); QTreeWidgetItem *item = m_ui->qtdirList->currentItem();
int index = m_ui->qtdirList->indexOfTopLevelItem(item); int index = m_ui->qtdirList->indexOfTopLevelItem(item);
...@@ -221,7 +221,7 @@ void QtDirWidget::removeQtDir() ...@@ -221,7 +221,7 @@ void QtDirWidget::removeQtDir()
updateState(); updateState();
} }
void QtDirWidget::updateState() void QtOptionsPageWidget::updateState()
{ {
bool enabled = (m_ui->qtdirList->currentItem() != 0); bool enabled = (m_ui->qtdirList->currentItem() != 0);
bool isSystemVersion = (enabled bool isSystemVersion = (enabled
...@@ -248,13 +248,13 @@ void QtDirWidget::updateState() ...@@ -248,13 +248,13 @@ void QtDirWidget::updateState()
m_ui->debuggingHelperStateLabel->setPixmap(QPixmap()); m_ui->debuggingHelperStateLabel->setPixmap(QPixmap());
} }
} }
void QtDirWidget::makeMingwVisible(bool visible) void QtOptionsPageWidget::makeMingwVisible(bool visible)
{ {
m_ui->mingwLabel->setVisible(visible); m_ui->mingwLabel->setVisible(visible);
m_ui->mingwPath->setVisible(visible); m_ui->mingwPath->setVisible(visible);
} }
void QtDirWidget::showEnvironmentPage(QTreeWidgetItem *item) void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
{ {
m_ui->msvcComboBox->setVisible(false); m_ui->msvcComboBox->setVisible(false);
if (item) { if (item) {
...@@ -304,7 +304,7 @@ void QtDirWidget::showEnvironmentPage(QTreeWidgetItem *item) ...@@ -304,7 +304,7 @@ void QtDirWidget::showEnvironmentPage(QTreeWidgetItem *item)
} }
} }
void QtDirWidget::versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old) void QtOptionsPageWidget::versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old)
{ {
if (old) { if (old) {
fixQtVersionName(m_ui->qtdirList->indexOfTopLevelItem(old)); fixQtVersionName(m_ui->qtdirList->indexOfTopLevelItem(old));
...@@ -320,7 +320,7 @@ void QtDirWidget::versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old) ...@@ -320,7 +320,7 @@ void QtDirWidget::versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old)
updateState(); updateState();
} }
void QtDirWidget::onQtBrowsed() void QtOptionsPageWidget::onQtBrowsed()
{ {
const QString dir = m_ui->qtPath->path(); const QString dir = m_ui->qtPath->path();
if (dir.isEmpty()) if (dir.isEmpty())
...@@ -336,7 +336,7 @@ void QtDirWidget::onQtBrowsed() ...@@ -336,7 +336,7 @@ void QtDirWidget::onQtBrowsed()
updateState(); updateState();
} }
void QtDirWidget::onMingwBrowsed() void QtOptionsPageWidget::onMingwBrowsed()
{ {
const QString dir = m_ui->mingwPath->path(); const QString dir = m_ui->mingwPath->path();
if (dir.isEmpty()) if (dir.isEmpty())
...@@ -346,7 +346,7 @@ void QtDirWidget::onMingwBrowsed() ...@@ -346,7 +346,7 @@ void QtDirWidget::onMingwBrowsed()
updateState(); updateState();
} }
void QtDirWidget::defaultChanged(int) void QtOptionsPageWidget::defaultChanged(int)
{ {
for (int i=0; i<m_ui->defaultCombo->count(); ++i) { for (int i=0; i<m_ui->defaultCombo->count(); ++i) {
if (m_versions.at(i)->name() == m_ui->defaultCombo->currentText()) { if (m_versions.at(i)->name() == m_ui->defaultCombo->currentText()) {
...@@ -358,7 +358,7 @@ void QtDirWidget::defaultChanged(int) ...@@ -358,7 +358,7 @@ void QtDirWidget::defaultChanged(int)
m_defaultVersion = 0; m_defaultVersion = 0;
} }
void QtDirWidget::updateCurrentQtName() void QtOptionsPageWidget::updateCurrentQtName()
{ {
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem(); QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
Q_ASSERT(currentItem); Q_ASSERT(currentItem);
...@@ -370,7 +370,7 @@ void QtDirWidget::updateCurrentQtName() ...@@ -370,7 +370,7 @@ void QtDirWidget::updateCurrentQtName()
} }
void QtDirWidget::finish() void QtOptionsPageWidget::finish()
{ {
if (QTreeWidgetItem *item = m_ui->qtdirList->currentItem()) if (QTreeWidgetItem *item = m_ui->qtdirList->currentItem())
fixQtVersionName(m_ui->qtdirList->indexOfTopLevelItem(item)); fixQtVersionName(m_ui->qtdirList->indexOfTopLevelItem(item));
...@@ -380,7 +380,7 @@ void QtDirWidget::finish() ...@@ -380,7 +380,7 @@ void QtDirWidget::finish()
* and otherwise changes the name * and otherwise changes the name
* *
*/ */
void QtDirWidget::fixQtVersionName(int index) void QtOptionsPageWidget::fixQtVersionName(int index)
{ {
int count = m_versions.count(); int count = m_versions.count();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
...@@ -407,7 +407,7 @@ void QtDirWidget::fixQtVersionName(int index) ...@@ -407,7 +407,7 @@ void QtDirWidget::fixQtVersionName(int index)
} }
} }
void QtDirWidget::updateCurrentQtPath() void QtOptionsPageWidget::updateCurrentQtPath()
{ {
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem(); QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
Q_ASSERT(currentItem); Q_ASSERT(currentItem);
...@@ -436,7 +436,7 @@ void QtDirWidget::updateCurrentQtPath() ...@@ -436,7 +436,7 @@ void QtDirWidget::updateCurrentQtPath()
} }
} }
void QtDirWidget::updateCurrentMingwDirectory() void QtOptionsPageWidget::updateCurrentMingwDirectory()
{ {
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem(); QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
Q_ASSERT(currentItem); Q_ASSERT(currentItem);
...@@ -444,7 +444,7 @@ void QtDirWidget::updateCurrentMingwDirectory() ...@@ -444,7 +444,7 @@ void QtDirWidget::updateCurrentMingwDirectory()
m_versions[currentItemIndex]->setMingwDirectory(m_ui->mingwPath->path()); m_versions[currentItemIndex]->setMingwDirectory(m_ui->mingwPath->path());
} }
void QtDirWidget::msvcVersionChanged() void QtOptionsPageWidget::msvcVersionChanged()
{ {
const QString &msvcVersion = m_ui->msvcComboBox->currentText(); const QString &msvcVersion = m_ui->msvcComboBox->currentText();
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem(); QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
...@@ -453,12 +453,12 @@ void QtDirWidget::msvcVersionChanged() ...@@ -453,12 +453,12 @@ void QtDirWidget::msvcVersionChanged()
m_versions[currentItemIndex]->setMsvcVersion(msvcVersion); m_versions[currentItemIndex]->setMsvcVersion(msvcVersion);
} }
QList<QtVersion *> QtDirWidget::versions() const QList<QtVersion *> QtOptionsPageWidget::versions() const
{ {
return m_versions; return m_versions;
} }
int QtDirWidget::defaultVersion() const int QtOptionsPageWidget::defaultVersion() const
{ {
return m_defaultVersion; return m_defaultVersion;
} }
...@@ -46,12 +46,12 @@ namespace Ui { ...@@ -46,12 +46,12 @@ namespace Ui {
class QtVersionManager; class QtVersionManager;
} }
class QtDirWidget : public QWidget class QtOptionsPageWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
QtDirWidget(QWidget *parent, QList<QtVersion *> versions, QtVersion *defaultVersion); QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> versions, QtVersion *defaultVersion);
~QtDirWidget(); ~QtOptionsPageWidget();
QList<QtVersion *> versions() const; QList<QtVersion *> versions() const;
int defaultVersion() const; int defaultVersion() const;
void finish(); void finish();
...@@ -97,7 +97,7 @@ public: ...@@ -97,7 +97,7 @@ public:
void apply(); void apply();
void finish() { } void finish() { }
private: private:
QtDirWidget *m_widget; QtOptionsPageWidget *m_widget;
}; };
} //namespace Internal } //namespace Internal
......
...@@ -39,12 +39,12 @@ ...@@ -39,12 +39,12 @@
namespace ProjectExplorer { namespace ProjectExplorer {
namespace Internal { namespace Internal {
class QtDirWidget; class QtOptionsPageWidget;
} }
class PROJECTEXPLORER_EXPORT QtVersion class PROJECTEXPLORER_EXPORT QtVersion
{ {
friend class Internal::QtDirWidget; //for changing name and path friend class Internal::QtOptionsPageWidget; //for changing name and path
friend class QtVersionManager; friend class QtVersionManager;
public: public:
QtVersion(const QString &name, const QString &path); QtVersion(const QString &name, const QString &path);
......
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