From 2d203763e8b150492df7ee5b3ffbcd9c2ee02605 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 23 Sep 2022 16:46:51 +0200 Subject: [PATCH] Core: Inline externaltoolconfig.ui Also collapse Core::ExternalToolConfig and Core::Internal::ExternalToolConfig translation contexts. Change-Id: I5764a85d8cdb33158a8ff770d5a769a752a051af Reviewed-by: Eike Ziller Reviewed-by: --- share/qtcreator/translations/qtcreator_cs.ts | 2 +- share/qtcreator/translations/qtcreator_da.ts | 2 +- share/qtcreator/translations/qtcreator_de.ts | 2 +- share/qtcreator/translations/qtcreator_fr.ts | 2 +- share/qtcreator/translations/qtcreator_hr.ts | 2 +- share/qtcreator/translations/qtcreator_ja.ts | 22 +- share/qtcreator/translations/qtcreator_pl.ts | 2 +- share/qtcreator/translations/qtcreator_ru.ts | 2 +- share/qtcreator/translations/qtcreator_sl.ts | 2 +- share/qtcreator/translations/qtcreator_uk.ts | 2 +- .../qtcreator/translations/qtcreator_zh_CN.ts | 2 +- .../qtcreator/translations/qtcreator_zh_TW.ts | 2 +- src/plugins/coreplugin/CMakeLists.txt | 2 +- src/plugins/coreplugin/coreplugin.qbs | 2 +- .../coreplugin/dialogs/externaltoolconfig.cpp | 317 +++++++++++---- .../coreplugin/dialogs/externaltoolconfig.ui | 378 ------------------ 16 files changed, 243 insertions(+), 500 deletions(-) delete mode 100644 src/plugins/coreplugin/dialogs/externaltoolconfig.ui diff --git a/share/qtcreator/translations/qtcreator_cs.ts b/share/qtcreator/translations/qtcreator_cs.ts index 8f0af7a495e..e4895f8b423 100644 --- a/share/qtcreator/translations/qtcreator_cs.ts +++ b/share/qtcreator/translations/qtcreator_cs.ts @@ -29535,7 +29535,7 @@ Místní přivedení nejsou použita na hlavní větev. - Core::Internal::ExternalToolConfig + Core::ExternalToolConfig Form Formulář diff --git a/share/qtcreator/translations/qtcreator_da.ts b/share/qtcreator/translations/qtcreator_da.ts index dc3dac78466..058b49bf240 100644 --- a/share/qtcreator/translations/qtcreator_da.ts +++ b/share/qtcreator/translations/qtcreator_da.ts @@ -7383,7 +7383,7 @@ Vil du dræbe den? - Core::Internal::ExternalToolConfig + Core::ExternalToolConfig Add tool. Tilføj værktøj. diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index 344dcf02957..7f394bff21e 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -13229,7 +13229,7 @@ Lokale Pull-Operationen werden nicht auf den Master-Branch angewandt. - Core::Internal::ExternalToolConfig + Core::ExternalToolConfig Add Hinzufügen diff --git a/share/qtcreator/translations/qtcreator_fr.ts b/share/qtcreator/translations/qtcreator_fr.ts index 39e576d4a90..1a3c2e64ae4 100644 --- a/share/qtcreator/translations/qtcreator_fr.ts +++ b/share/qtcreator/translations/qtcreator_fr.ts @@ -32803,7 +32803,7 @@ Les pulls locaux ne sont pas appliqués à la branche maître. - Core::Internal::ExternalToolConfig + Core::ExternalToolConfig Form Formulaire diff --git a/share/qtcreator/translations/qtcreator_hr.ts b/share/qtcreator/translations/qtcreator_hr.ts index 999ea6fdfb2..58607fa9241 100644 --- a/share/qtcreator/translations/qtcreator_hr.ts +++ b/share/qtcreator/translations/qtcreator_hr.ts @@ -2123,7 +2123,7 @@ Međutim, korištenje opuštenih i proširenih pravila također znači da nije m - Core::Internal::ExternalToolConfig + Core::ExternalToolConfig Add tool. Dodaj alat. diff --git a/share/qtcreator/translations/qtcreator_ja.ts b/share/qtcreator/translations/qtcreator_ja.ts index f7fc3d14b70..b1f0a8a6e1d 100644 --- a/share/qtcreator/translations/qtcreator_ja.ts +++ b/share/qtcreator/translations/qtcreator_ja.ts @@ -1266,7 +1266,7 @@ Local pulls are not applied to the master branch. - Core::Internal::ExternalToolConfig + Core::ExternalToolConfig Form フォーム @@ -50467,26 +50467,6 @@ Output: Sample external tool text テキスト - - Add Tool - ツールを追加 - - - Add Category - カテゴリを追加 - - - PATH=C:\dev\bin;${PATH} - PATH=C:\dev\bin;${PATH} - - - PATH=/opt/bin:${PATH} - PATH=/opt/bin:${PATH} - - - No changes to apply. - 変更しません。 - External Tools 外部ツール diff --git a/share/qtcreator/translations/qtcreator_pl.ts b/share/qtcreator/translations/qtcreator_pl.ts index 98795f7f59a..d67bfd5e7d2 100644 --- a/share/qtcreator/translations/qtcreator_pl.ts +++ b/share/qtcreator/translations/qtcreator_pl.ts @@ -14322,7 +14322,7 @@ Local pulls are not applied to the master branch. - Core::Internal::ExternalToolConfig + Core::ExternalToolConfig Form Formularz diff --git a/share/qtcreator/translations/qtcreator_ru.ts b/share/qtcreator/translations/qtcreator_ru.ts index 6deb2994f74..3c051bbbddc 100644 --- a/share/qtcreator/translations/qtcreator_ru.ts +++ b/share/qtcreator/translations/qtcreator_ru.ts @@ -10368,7 +10368,7 @@ Do you want to kill it? - Core::Internal::ExternalToolConfig + Core::ExternalToolConfig Add Добавить diff --git a/share/qtcreator/translations/qtcreator_sl.ts b/share/qtcreator/translations/qtcreator_sl.ts index c2f872c8edb..ad42e92e2ad 100644 --- a/share/qtcreator/translations/qtcreator_sl.ts +++ b/share/qtcreator/translations/qtcreator_sl.ts @@ -18960,7 +18960,7 @@ Krajevnih potegov se v vejo »master« ne uveljavi. - Core::Internal::ExternalToolConfig + Core::ExternalToolConfig Form Obrazec diff --git a/share/qtcreator/translations/qtcreator_uk.ts b/share/qtcreator/translations/qtcreator_uk.ts index c0c5ad9d610..c13de92d49e 100644 --- a/share/qtcreator/translations/qtcreator_uk.ts +++ b/share/qtcreator/translations/qtcreator_uk.ts @@ -2514,7 +2514,7 @@ Continue? - Core::Internal::ExternalToolConfig + Core::ExternalToolConfig Form Форма diff --git a/share/qtcreator/translations/qtcreator_zh_CN.ts b/share/qtcreator/translations/qtcreator_zh_CN.ts index f2d66998f9b..2373d079f74 100644 --- a/share/qtcreator/translations/qtcreator_zh_CN.ts +++ b/share/qtcreator/translations/qtcreator_zh_CN.ts @@ -30788,7 +30788,7 @@ Local pulls are not applied to the master branch. - Core::Internal::ExternalToolConfig + Core::ExternalToolConfig Form 界面 diff --git a/share/qtcreator/translations/qtcreator_zh_TW.ts b/share/qtcreator/translations/qtcreator_zh_TW.ts index 7b5c22de031..0b2327588d8 100644 --- a/share/qtcreator/translations/qtcreator_zh_TW.ts +++ b/share/qtcreator/translations/qtcreator_zh_TW.ts @@ -18584,7 +18584,7 @@ Local pulls are not applied to the master branch. - Core::Internal::ExternalToolConfig + Core::ExternalToolConfig Form 表單 diff --git a/src/plugins/coreplugin/CMakeLists.txt b/src/plugins/coreplugin/CMakeLists.txt index d710b22872a..5b97b2bbbb2 100644 --- a/src/plugins/coreplugin/CMakeLists.txt +++ b/src/plugins/coreplugin/CMakeLists.txt @@ -27,7 +27,7 @@ add_qtc_plugin(Core designmode.cpp designmode.h dialogs/addtovcsdialog.cpp dialogs/addtovcsdialog.h dialogs/codecselector.cpp dialogs/codecselector.h - dialogs/externaltoolconfig.cpp dialogs/externaltoolconfig.h dialogs/externaltoolconfig.ui + dialogs/externaltoolconfig.cpp dialogs/externaltoolconfig.h dialogs/filepropertiesdialog.cpp dialogs/filepropertiesdialog.h dialogs/ioptionspage.cpp dialogs/ioptionspage.h dialogs/newdialog.cpp dialogs/newdialog.h diff --git a/src/plugins/coreplugin/coreplugin.qbs b/src/plugins/coreplugin/coreplugin.qbs index a64c977e2e9..2f35546178e 100644 --- a/src/plugins/coreplugin/coreplugin.qbs +++ b/src/plugins/coreplugin/coreplugin.qbs @@ -203,7 +203,7 @@ Project { files: [ "addtovcsdialog.cpp", "addtovcsdialog.h", "codecselector.cpp", "codecselector.h", - "externaltoolconfig.cpp", "externaltoolconfig.h", "externaltoolconfig.ui", + "externaltoolconfig.cpp", "externaltoolconfig.h", "filepropertiesdialog.cpp", "filepropertiesdialog.h", "ioptionspage.cpp", "ioptionspage.h", "newdialog.cpp", "newdialog.h", diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp index 63bd8b87029..835b63f8147 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp @@ -4,14 +4,15 @@ #include "externaltoolconfig.h" #include "ioptionspage.h" -#include "ui_externaltoolconfig.h" #include #include #include #include #include +#include #include +#include #include #include #include @@ -21,14 +22,21 @@ #include #include +#include +#include +#include #include -#include -#include +#include +#include +#include #include #include #include +#include #include +#include #include +#include using namespace Utils; @@ -433,63 +441,196 @@ private: void editEnvironmentChanges(); void updateEnvironmentLabel(); - Ui::ExternalToolConfig m_ui; EnvironmentItems m_environment; ExternalToolModel m_model; + + QTreeView *m_toolTree; + QPushButton *m_removeButton; + QPushButton *m_revertButton; + QWidget *m_infoWidget; + QLineEdit *m_description; + Utils::PathChooser *m_executable; + QLineEdit *m_arguments; + Utils::PathChooser *m_workingDirectory; + QComboBox *m_outputBehavior; + QLabel *m_environmentLabel; + QComboBox *m_errorOutputBehavior; + QCheckBox *m_modifiesDocumentCheckbox; + QPlainTextEdit *m_inputText; + QComboBox *m_baseEnvironment; }; ExternalToolConfig::ExternalToolConfig() { - m_ui.setupUi(this); - m_ui.executable->setExpectedKind(PathChooser::ExistingCommand); - m_ui.scrollArea->viewport()->setAutoFillBackground(false); - m_ui.scrollAreaWidgetContents->setAutoFillBackground(false); - m_ui.toolTree->setModel(&m_model); - m_ui.toolTree->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed); + m_toolTree = new QTreeView(this); + m_toolTree->setDragEnabled(true); + m_toolTree->setDragDropMode(QAbstractItemView::InternalMove); + m_toolTree->header()->setVisible(false); + m_toolTree->header()->setDefaultSectionSize(21); - connect(m_ui.toolTree->selectionModel(), &QItemSelectionModel::currentChanged, + auto addButton = new QPushButton(tr("Add")); + addButton->setToolTip(tr("Add tool.")); + + m_removeButton = new QPushButton(tr("Remove")); + m_removeButton->setToolTip(tr("Remove tool.")); + + m_revertButton = new QPushButton(tr("Reset")); + m_revertButton->setToolTip(tr("Revert tool to default.")); + + auto scrollArea = new QScrollArea(this); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(10); + sizePolicy.setVerticalStretch(0); + scrollArea->setSizePolicy(sizePolicy); + scrollArea->setFrameShape(QFrame::NoFrame); + scrollArea->setFrameShadow(QFrame::Plain); + scrollArea->setLineWidth(0); + scrollArea->setWidgetResizable(true); + + auto scrollAreaWidgetContents = new QWidget(); + scrollAreaWidgetContents->setGeometry(QRect(0, 0, 396, 444)); + + m_infoWidget = new QWidget(scrollAreaWidgetContents); + QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy1.setHorizontalStretch(10); + sizePolicy1.setVerticalStretch(0); + m_infoWidget->setSizePolicy(sizePolicy1); + + m_description = new QLineEdit(m_infoWidget); + + m_executable = new PathChooser(m_infoWidget); + + m_arguments = new QLineEdit(m_infoWidget); + + m_workingDirectory = new PathChooser(m_infoWidget); + + auto outputLabel = new QLabel(tr("Output:")); + outputLabel->setToolTip(tr("\n" + "

What to do with the executable's standard output.\n" + "

  • Ignore: Do nothing with it.
  • Show in General Messages.
  • " + "
  • Replace selection: Replace the current selection in the current document with it.
  • " + "

\n")); + + m_outputBehavior = new QComboBox(m_infoWidget); + m_outputBehavior->addItem(tr("Ignore")); + m_outputBehavior->addItem(tr("Show in General Messages")); + m_outputBehavior->addItem(tr("Replace Selection")); + + auto errorOutputLabel = new QLabel(tr("Error output:")); + errorOutputLabel->setToolTip(tr("\n" + "

What to do with the executable's standard error output.

\n" + "
  • Ignore: Do nothing with it.
  • \n" + "
  • Show in General Messages.
  • \n" + "
  • Replace selection: Replace the current selection in the current document with it.
  • \n" + "
")); + + m_errorOutputBehavior = new QComboBox(m_infoWidget); + m_errorOutputBehavior->addItem(tr("Ignore")); + m_errorOutputBehavior->addItem(tr("Show in General Messages")); + m_errorOutputBehavior->addItem(tr("Replace Selection")); + + m_environmentLabel = new QLabel(tr("No changes to apply.")); + m_environmentLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + + auto environmentButton = new QPushButton(tr("Change...")); + + m_modifiesDocumentCheckbox = new QCheckBox(tr("Modifies current document")); + m_modifiesDocumentCheckbox->setToolTip(tr("If the tool modifies the current document, " + "set this flag to ensure that the document is saved before " + "running the tool and is reloaded after the tool finished.")); + + auto inputLabel = new QLabel(tr("Input:")); + inputLabel->setToolTip(tr("Text to pass to the executable via standard input. Leave " + "empty if the executable should not receive any input.")); + + m_inputText = new QPlainTextEdit(m_infoWidget); + QSizePolicy sizePolicy3(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy3.setHorizontalStretch(0); + sizePolicy3.setVerticalStretch(10); + m_inputText->setSizePolicy(sizePolicy3); + m_inputText->setLineWrapMode(QPlainTextEdit::NoWrap); + + m_baseEnvironment = new QComboBox(m_infoWidget); + m_baseEnvironment->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + + scrollArea->setWidget(scrollAreaWidgetContents); + + using namespace Layouting; + + Form { + tr("Description:"), m_description, br, + tr("Executable:"), m_executable, br, + tr("Arguments:"), m_arguments, br, + tr("Working directory:"), m_workingDirectory, br, + outputLabel, m_outputBehavior, br, + errorOutputLabel, m_errorOutputBehavior, br, + tr("Base environment:"), m_baseEnvironment, br, + tr("Environment:"), m_environmentLabel, environmentButton, br, + empty, m_modifiesDocumentCheckbox, br, + inputLabel, m_inputText + }.attachTo(m_infoWidget, WithMargins); + + Column { + m_infoWidget + }.attachTo(scrollAreaWidgetContents, WithoutMargins); + + Row { + Column { + m_toolTree, + Row { addButton, m_removeButton, st, m_revertButton } + }, + scrollArea + }.attachTo(this); + + m_executable->setExpectedKind(PathChooser::ExistingCommand); + scrollArea->viewport()->setAutoFillBackground(false); + scrollAreaWidgetContents->setAutoFillBackground(false); + m_toolTree->setModel(&m_model); + m_toolTree->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed); + + connect(m_toolTree->selectionModel(), &QItemSelectionModel::currentChanged, this, &ExternalToolConfig::handleCurrentChanged); auto chooser = new VariableChooser(this); - chooser->addSupportedWidget(m_ui.executable->lineEdit()); - chooser->addSupportedWidget(m_ui.arguments); - chooser->addSupportedWidget(m_ui.workingDirectory->lineEdit()); - chooser->addSupportedWidget(m_ui.inputText); + chooser->addSupportedWidget(m_executable->lineEdit()); + chooser->addSupportedWidget(m_arguments); + chooser->addSupportedWidget(m_workingDirectory->lineEdit()); + chooser->addSupportedWidget(m_inputText); - fillBaseEnvironmentComboBox(m_ui.baseEnvironment); + fillBaseEnvironmentComboBox(m_baseEnvironment); - connect(m_ui.description, &QLineEdit::editingFinished, + connect(m_description, &QLineEdit::editingFinished, this, &ExternalToolConfig::updateCurrentItem); - connect(m_ui.executable, &PathChooser::editingFinished, + connect(m_executable, &PathChooser::editingFinished, this, &ExternalToolConfig::updateCurrentItem); - connect(m_ui.executable, &PathChooser::browsingFinished, + connect(m_executable, &PathChooser::browsingFinished, this, &ExternalToolConfig::updateCurrentItem); - connect(m_ui.arguments, &QLineEdit::editingFinished, + connect(m_arguments, &QLineEdit::editingFinished, this, &ExternalToolConfig::updateCurrentItem); - connect(m_ui.arguments, &QLineEdit::editingFinished, + connect(m_arguments, &QLineEdit::editingFinished, this, &ExternalToolConfig::updateEffectiveArguments); - connect(m_ui.workingDirectory, &PathChooser::editingFinished, + connect(m_workingDirectory, &PathChooser::editingFinished, this, &ExternalToolConfig::updateCurrentItem); - connect(m_ui.workingDirectory, &PathChooser::browsingFinished, + connect(m_workingDirectory, &PathChooser::browsingFinished, this, &ExternalToolConfig::updateCurrentItem); - connect(m_ui.environmentButton, &QAbstractButton::clicked, + connect(environmentButton, &QAbstractButton::clicked, this, &ExternalToolConfig::editEnvironmentChanges); - connect(m_ui.outputBehavior, &QComboBox::activated, + connect(m_outputBehavior, &QComboBox::activated, this, &ExternalToolConfig::updateCurrentItem); - connect(m_ui.errorOutputBehavior, &QComboBox::activated, + connect(m_errorOutputBehavior, &QComboBox::activated, this, &ExternalToolConfig::updateCurrentItem); - connect(m_ui.modifiesDocumentCheckbox, &QAbstractButton::clicked, + connect(m_modifiesDocumentCheckbox, &QAbstractButton::clicked, this, &ExternalToolConfig::updateCurrentItem); - connect(m_ui.inputText, &QPlainTextEdit::textChanged, + connect(m_inputText, &QPlainTextEdit::textChanged, this, &ExternalToolConfig::updateCurrentItem); - connect(m_ui.revertButton, &QAbstractButton::clicked, + connect(m_revertButton, &QAbstractButton::clicked, this, &ExternalToolConfig::revertCurrentItem); - connect(m_ui.removeButton, &QAbstractButton::clicked, + connect(m_removeButton, &QAbstractButton::clicked, this, &ExternalToolConfig::removeTool); - auto menu = new QMenu(m_ui.addButton); - m_ui.addButton->setMenu(menu); + auto menu = new QMenu(addButton); + addButton->setMenu(menu); auto addTool = new QAction(tr("Add Tool"), this); menu->addAction(addTool); connect(addTool, &QAction::triggered, this, &ExternalToolConfig::addTool); @@ -514,7 +655,7 @@ void ExternalToolConfig::setTools(const QMap > &t if (!toolsCopy.contains(QString())) toolsCopy.insert(QString(), QList()); m_model.setTools(toolsCopy); - m_ui.toolTree->expandAll(); + m_toolTree->expandAll(); } void ExternalToolConfig::handleCurrentChanged(const QModelIndex &now, const QModelIndex &previous) @@ -527,22 +668,22 @@ void ExternalToolConfig::updateButtons(const QModelIndex &index) { const ExternalTool *tool = ExternalToolModel::toolForIndex(index); if (!tool) { - m_ui.removeButton->setEnabled(false); - m_ui.revertButton->setEnabled(false); + m_removeButton->setEnabled(false); + m_revertButton->setEnabled(false); return; } if (!tool->preset()) { - m_ui.removeButton->setEnabled(true); - m_ui.revertButton->setEnabled(false); + m_removeButton->setEnabled(true); + m_revertButton->setEnabled(false); } else { - m_ui.removeButton->setEnabled(false); - m_ui.revertButton->setEnabled((*tool) != (*(tool->preset()))); + m_removeButton->setEnabled(false); + m_revertButton->setEnabled((*tool) != (*(tool->preset()))); } } void ExternalToolConfig::updateCurrentItem() { - const QModelIndex index = m_ui.toolTree->selectionModel()->currentIndex(); + const QModelIndex index = m_toolTree->selectionModel()->currentIndex(); updateItem(index); updateButtons(index); } @@ -552,21 +693,21 @@ void ExternalToolConfig::updateItem(const QModelIndex &index) ExternalTool *tool = ExternalToolModel::toolForIndex(index); if (!tool) return; - tool->setDescription(m_ui.description->text()); + tool->setDescription(m_description->text()); FilePaths executables = tool->executables(); if (executables.size() > 0) - executables[0] = m_ui.executable->rawFilePath(); + executables[0] = m_executable->rawFilePath(); else - executables << m_ui.executable->rawFilePath(); + executables << m_executable->rawFilePath(); tool->setExecutables(executables); - tool->setArguments(m_ui.arguments->text()); - tool->setWorkingDirectory(m_ui.workingDirectory->rawFilePath()); - tool->setBaseEnvironmentProviderId(Id::fromSetting(m_ui.baseEnvironment->currentData())); + tool->setArguments(m_arguments->text()); + tool->setWorkingDirectory(m_workingDirectory->rawFilePath()); + tool->setBaseEnvironmentProviderId(Id::fromSetting(m_baseEnvironment->currentData())); tool->setEnvironmentUserChanges(m_environment); - tool->setOutputHandling(ExternalTool::OutputHandling(m_ui.outputBehavior->currentIndex())); - tool->setErrorHandling(ExternalTool::OutputHandling(m_ui.errorOutputBehavior->currentIndex())); - tool->setModifiesCurrentDocument(m_ui.modifiesDocumentCheckbox->checkState()); - tool->setInput(m_ui.inputText->toPlainText()); + tool->setOutputHandling(ExternalTool::OutputHandling(m_outputBehavior->currentIndex())); + tool->setErrorHandling(ExternalTool::OutputHandling(m_errorOutputBehavior->currentIndex())); + tool->setModifiesCurrentDocument(m_modifiesDocumentCheckbox->checkState()); + tool->setInput(m_inputText->toPlainText()); } void ExternalToolConfig::showInfoForItem(const QModelIndex &index) @@ -574,36 +715,36 @@ void ExternalToolConfig::showInfoForItem(const QModelIndex &index) updateButtons(index); const ExternalTool *tool = ExternalToolModel::toolForIndex(index); if (!tool) { - m_ui.description->clear(); - m_ui.executable->setFilePath({}); - m_ui.arguments->clear(); - m_ui.workingDirectory->setFilePath({}); - m_ui.inputText->clear(); - m_ui.infoWidget->setEnabled(false); + m_description->clear(); + m_executable->setFilePath({}); + m_arguments->clear(); + m_workingDirectory->setFilePath({}); + m_inputText->clear(); + m_infoWidget->setEnabled(false); m_environment.clear(); return; } - m_ui.infoWidget->setEnabled(true); - m_ui.description->setText(tool->description()); - m_ui.executable->setFilePath(tool->executables().isEmpty() ? FilePath() + m_infoWidget->setEnabled(true); + m_description->setText(tool->description()); + m_executable->setFilePath(tool->executables().isEmpty() ? FilePath() : tool->executables().constFirst()); - m_ui.arguments->setText(tool->arguments()); - m_ui.workingDirectory->setFilePath(tool->workingDirectory()); - m_ui.outputBehavior->setCurrentIndex(int(tool->outputHandling())); - m_ui.errorOutputBehavior->setCurrentIndex(int(tool->errorHandling())); - m_ui.modifiesDocumentCheckbox->setChecked(tool->modifiesCurrentDocument()); - const int baseEnvironmentIndex = m_ui.baseEnvironment->findData( + m_arguments->setText(tool->arguments()); + m_workingDirectory->setFilePath(tool->workingDirectory()); + m_outputBehavior->setCurrentIndex(int(tool->outputHandling())); + m_errorOutputBehavior->setCurrentIndex(int(tool->errorHandling())); + m_modifiesDocumentCheckbox->setChecked(tool->modifiesCurrentDocument()); + const int baseEnvironmentIndex = m_baseEnvironment->findData( tool->baseEnvironmentProviderId().toSetting()); - m_ui.baseEnvironment->setCurrentIndex(std::max(0, baseEnvironmentIndex)); + m_baseEnvironment->setCurrentIndex(std::max(0, baseEnvironmentIndex)); m_environment = tool->environmentUserChanges(); { - QSignalBlocker blocker(m_ui.inputText); - m_ui.inputText->setPlainText(tool->input()); + QSignalBlocker blocker(m_inputText); + m_inputText->setPlainText(tool->input()); } - m_ui.description->setCursorPosition(0); - m_ui.arguments->setCursorPosition(0); + m_description->setCursorPosition(0); + m_arguments->setCursorPosition(0); updateEnvironmentLabel(); updateEffectiveArguments(); } @@ -668,7 +809,7 @@ static QString findUnusedId(const QString &proposal, const QMapselectionModel()->currentIndex(); + QModelIndex index = m_toolTree->selectionModel()->currentIndex(); updateItem(index); updateButtons(index); @@ -746,40 +887,40 @@ void ExternalToolConfig::apply() void ExternalToolConfig::revertCurrentItem() { - QModelIndex index = m_ui.toolTree->selectionModel()->currentIndex(); + QModelIndex index = m_toolTree->selectionModel()->currentIndex(); m_model.revertTool(index); showInfoForItem(index); } void ExternalToolConfig::addTool() { - QModelIndex currentIndex = m_ui.toolTree->selectionModel()->currentIndex(); + QModelIndex currentIndex = m_toolTree->selectionModel()->currentIndex(); if (!currentIndex.isValid()) // default to Uncategorized currentIndex = m_model.index(0, 0); QModelIndex index = m_model.addTool(currentIndex); - m_ui.toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Clear); - m_ui.toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::SelectCurrent); - m_ui.toolTree->edit(index); + m_toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Clear); + m_toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::SelectCurrent); + m_toolTree->edit(index); } void ExternalToolConfig::removeTool() { - QModelIndex currentIndex = m_ui.toolTree->selectionModel()->currentIndex(); - m_ui.toolTree->selectionModel()->setCurrentIndex(QModelIndex(), QItemSelectionModel::Clear); + QModelIndex currentIndex = m_toolTree->selectionModel()->currentIndex(); + m_toolTree->selectionModel()->setCurrentIndex(QModelIndex(), QItemSelectionModel::Clear); m_model.removeTool(currentIndex); } void ExternalToolConfig::addCategory() { QModelIndex index = m_model.addCategory(); - m_ui.toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Clear); - m_ui.toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::SelectCurrent); - m_ui.toolTree->edit(index); + m_toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Clear); + m_toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::SelectCurrent); + m_toolTree->edit(index); } void ExternalToolConfig::updateEffectiveArguments() { - m_ui.arguments->setToolTip(Utils::globalMacroExpander()->expandProcessArgs(m_ui.arguments->text())); + m_arguments->setToolTip(Utils::globalMacroExpander()->expandProcessArgs(m_arguments->text())); } void ExternalToolConfig::editEnvironmentChanges() @@ -787,9 +928,9 @@ void ExternalToolConfig::editEnvironmentChanges() const QString placeholderText = HostOsInfo::isWindowsHost() ? tr("PATH=C:\\dev\\bin;${PATH}") : tr("PATH=/opt/bin:${PATH}"); - const auto newItems = EnvironmentDialog::getEnvironmentItems(m_ui.environmentLabel, - m_environment, - placeholderText); + const auto newItems = EnvironmentDialog::getEnvironmentItems(m_environmentLabel, + m_environment, + placeholderText); if (newItems) { m_environment = *newItems; updateEnvironmentLabel(); @@ -799,9 +940,9 @@ void ExternalToolConfig::editEnvironmentChanges() void ExternalToolConfig::updateEnvironmentLabel() { QString shortSummary = EnvironmentItem::toStringList(m_environment).join("; "); - QFontMetrics fm(m_ui.environmentLabel->font()); - shortSummary = fm.elidedText(shortSummary, Qt::ElideRight, m_ui.environmentLabel->width()); - m_ui.environmentLabel->setText(shortSummary.isEmpty() ? tr("No changes to apply.") : shortSummary); + QFontMetrics fm(m_environmentLabel->font()); + shortSummary = fm.elidedText(shortSummary, Qt::ElideRight, m_environmentLabel->width()); + m_environmentLabel->setText(shortSummary.isEmpty() ? tr("No changes to apply.") : shortSummary); } // ToolSettingsPage diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.ui b/src/plugins/coreplugin/dialogs/externaltoolconfig.ui deleted file mode 100644 index 57fe84c348e..00000000000 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.ui +++ /dev/null @@ -1,378 +0,0 @@ - - - Core::Internal::ExternalToolConfig - - - - 0 - 0 - 725 - 468 - - - - - - - - - - - - true - - - QAbstractItemView::InternalMove - - - false - - - 21 - - - - - - - - - Add tool. - - - Add - - - - - - - Remove tool. - - - Remove - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Revert tool to default. - - - Reset - - - - - - - - - - - - 10 - 0 - - - - QFrame::NoFrame - - - QFrame::Plain - - - 0 - - - true - - - - - 0 - 0 - 396 - 444 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 10 - 0 - - - - - QFormLayout::ExpandingFieldsGrow - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Description: - - - - - - - - - - Executable: - - - - - - - - - - Arguments: - - - - - - - - - - Working directory: - - - - - - - - - - <html><head/><body> -<p>What to do with the executable's standard output. -<ul><li>Ignore: Do nothing with it.</li><li>Show in General Messages.</li><li>Replace selection: Replace the current selection in the current document with it.</li></ul></p></body></html> - - - - Output: - - - - - - - - Ignore - - - - - Show in General Messages - - - - - Replace Selection - - - - - - - - <html><head><body> -<p >What to do with the executable's standard error output.</p> -<ul><li>Ignore: Do nothing with it.</li> -<li>Show in General Messages.</li> -<li>Replace selection: Replace the current selection in the current document with it.</li> -</ul></body></html> - - - Error output: - - - - - - - - Ignore - - - - - Show in General Messages - - - - - Replace Selection - - - - - - - - Environment: - - - - - - - 0 - - - - - - 0 - 0 - - - - No changes to apply. - - - - - - - Change... - - - - - - - - - If the tool modifies the current document, set this flag to ensure that the document is saved before running the tool and is reloaded after the tool finished. - - - Modifies current document - - - - - - - Text to pass to the executable via standard input. Leave empty if the executable should not receive any input. - - - Input: - - - - - - - - 0 - 10 - - - - QPlainTextEdit::NoWrap - - - - - - - Base environment: - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - - Utils::PathChooser - QWidget -
utils/pathchooser.h
- 1 - - editingFinished() - browsingFinished() - -
-
- - toolTree - addButton - removeButton - revertButton - description - executable - arguments - workingDirectory - outputBehavior - errorOutputBehavior - environmentButton - modifiesDocumentCheckbox - inputText - - - -