diff options
author | con <qtc-committer@nokia.com> | 2011-02-02 13:35:48 +0100 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2011-02-18 17:15:40 +0100 |
commit | 69c920c6ad8bb58b699a1bd1fea314197f44395c (patch) | |
tree | cbbfe1a269b328dff4703631b0a4d175b3ebaa7e /src/plugins/coreplugin/dialogs | |
parent | 8cda869a15d4ac0a7f42db44a9e02b93052450a4 (diff) | |
download | qt-creator-69c920c6ad8bb58b699a1bd1fea314197f44395c.tar.gz |
Implement the 'remove tool' button.
Diffstat (limited to 'src/plugins/coreplugin/dialogs')
-rw-r--r-- | src/plugins/coreplugin/dialogs/externaltoolconfig.cpp | 25 | ||||
-rw-r--r-- | src/plugins/coreplugin/dialogs/externaltoolconfig.h | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp index 80d8182d5d..61768f674a 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp @@ -71,6 +71,7 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) : ui->revertButton->setIcon(QIcon(QLatin1String(Constants::ICON_RESET))); connect(ui->revertButton, SIGNAL(clicked()), this, SLOT(revertCurrentItem())); connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addTool())); + connect(ui->removeButton, SIGNAL(clicked()), this, SLOT(removeTool())); showInfoForItem(0); updateButtons(ui->toolTree->currentItem()); @@ -302,6 +303,7 @@ void ExternalToolConfig::revertCurrentItem() int index = items.indexOf(tool); if (index != -1) { items[index] = resetTool; + break; } } delete tool; @@ -336,3 +338,26 @@ void ExternalToolConfig::addTool() ui->toolTree->setCurrentItem(item); ui->toolTree->editItem(item); } + +void ExternalToolConfig::removeTool() +{ + QTreeWidgetItem *currentItem = ui->toolTree->currentItem(); + QTC_ASSERT(currentItem, return); + ExternalTool *tool = currentItem->data(0, Qt::UserRole).value<ExternalTool *>(); + QTC_ASSERT(tool, return); + QTC_ASSERT(!tool->preset(), return); + // remove the tool and the tree item + QMutableMapIterator<QString, QList<ExternalTool *> > it(m_tools); + while (it.hasNext()) { + it.next(); + QList<ExternalTool *> &items = it.value(); + int index = items.indexOf(tool); + if (index != -1) { + items.removeAt(index); + break; + } + } + ui->toolTree->setCurrentItem(0); + delete currentItem; + delete tool; +} diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.h b/src/plugins/coreplugin/dialogs/externaltoolconfig.h index 77fbd153d3..d9db9c80b1 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.h +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.h @@ -69,6 +69,7 @@ private slots: void updateButtons(QTreeWidgetItem *item); void updateCurrentItem(); void addTool(); + void removeTool(); private: Ui::ExternalToolConfig *ui; |