diff --git a/src/plugins/binarytools/mainframe/binarytoolsconfigview.cpp b/src/plugins/binarytools/mainframe/binarytoolsconfigview.cpp index 933ee97f5..b1b60fcbe 100644 --- a/src/plugins/binarytools/mainframe/binarytoolsconfigview.cpp +++ b/src/plugins/binarytools/mainframe/binarytoolsconfigview.cpp @@ -10,17 +10,19 @@ #include "common/util/custompaths.h" #include "common/dialog/contextdialog.h" -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include + #include #include #include #include -#include #include -#include #include #include #include @@ -29,26 +31,27 @@ static QString CURRENT_COMMAND = "Current command"; static QString ALL_COMMAND = "All command"; static QString ENVIRONMENT = "Environment"; +DWIDGET_USE_NAMESPACE class BinaryToolsConfigViewPrivate { friend class BinaryToolsConfigView; QGridLayout *gridLayout = nullptr; - QWidget *compatConfigWidget = nullptr; - QComboBox *runComandCombo = nullptr; - QLineEdit *toolArgsEdit = nullptr; + DWidget *compatConfigWidget = nullptr; + DComboBox *runComandCombo = nullptr; + DLineEdit *toolArgsEdit = nullptr; QDialog *combinationDialog = nullptr; - QLabel *commandCombination = nullptr; - QLabel *nameLabel = nullptr; - QLabel *commandLabel = nullptr; - QLineEdit *executableDirEdit = nullptr; - QLineEdit *workingDirEdit = nullptr; + DLabel *commandCombination = nullptr; + DLabel *nameLabel = nullptr; + DLabel *commandLabel = nullptr; + DLineEdit *executableDirEdit = nullptr; + DLineEdit *workingDirEdit = nullptr; EnvironmentView *envView = nullptr; - QPushButton *addButton = nullptr; - QPushButton *deleteButton = nullptr; - QPushButton *renameButton = nullptr; - QPushButton *combineButton = nullptr; - QPushButton *useCombinationButton = nullptr; + DPushButton *addButton = nullptr; + DPushButton *deleteButton = nullptr; + DPushButton *renameButton = nullptr; + DPushButton *combineButton = nullptr; + DPushButton *useCombinationButton = nullptr; BinaryToolsSetting *settings = nullptr; QList programList; QList argsList; @@ -60,23 +63,23 @@ BinaryToolsConfigView::BinaryToolsConfigView(QWidget *parent) : QWidget(parent) , d(new BinaryToolsConfigViewPrivate) { - d->compatConfigWidget = new QWidget(this); - d->nameLabel = new QLabel(); + d->compatConfigWidget = new DWidget(this); + d->nameLabel = new DLabel(); - d->runComandCombo = new QComboBox(this); + d->runComandCombo = new DComboBox(this); d->runComandCombo->setMinimumContentsLength(15); - d->runComandCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents); + d->runComandCombo->setSizeAdjustPolicy(DComboBox::AdjustToContents); - d->addButton = new QPushButton(tr("Add"), this); - d->deleteButton = new QPushButton(tr("Delete"), this); - d->renameButton = new QPushButton(tr("Rename"), this); - d->combineButton = new QPushButton(tr("Combine"), this); + d->addButton = new DPushButton(tr("Add"), this); + d->deleteButton = new DPushButton(tr("Delete"), this); + d->renameButton = new DPushButton(tr("Rename"), this); + d->combineButton = new DPushButton(tr("Combine"), this); d->gridLayout = new QGridLayout(this); d->gridLayout->setSpacing(6); d->gridLayout->setContentsMargins(10, 10, 10, 10); - auto configLabel = new QLabel(this); + auto configLabel = new DLabel(this); configLabel->setText(tr("Binary configuration:")); d->gridLayout->addWidget(configLabel, 0, 0, 1, 1); @@ -90,8 +93,8 @@ BinaryToolsConfigView::BinaryToolsConfigView(QWidget *parent) setConfigWidget(); d->combinationDialog = new QDialog(this); - d->commandCombination = new QLabel(tr("command combination:"), d->combinationDialog); - d->useCombinationButton = new QPushButton(tr("Use Combination Command"), d->combinationDialog); + d->commandCombination = new DLabel(tr("command combination:"), d->combinationDialog); + d->useCombinationButton = new DPushButton(tr("Use Combination Command"), d->combinationDialog); initializeCombinationDialog(); if (!d->settings) { @@ -107,19 +110,19 @@ BinaryToolsConfigView::BinaryToolsConfigView(QWidget *parent) } readConfig(); - connect(d->runComandCombo, static_cast(&QComboBox::currentIndexChanged), + connect(d->runComandCombo, static_cast(&DComboBox::currentIndexChanged), this, &BinaryToolsConfigView::currentConfigChanged); - connect(d->addButton, &QPushButton::clicked, + connect(d->addButton, &DPushButton::clicked, this, &BinaryToolsConfigView::addCompatConfig); - connect(d->deleteButton, &QPushButton::clicked, + connect(d->deleteButton, &DPushButton::clicked, this, &BinaryToolsConfigView::deleteCompatConfig); - connect(d->renameButton, &QPushButton::clicked, + connect(d->renameButton, &DPushButton::clicked, this, &BinaryToolsConfigView::renameCompatConfig); - connect(d->combineButton, &QPushButton::clicked, + connect(d->combineButton, &DPushButton::clicked, this, &BinaryToolsConfigView::combineCompatConfig); } @@ -274,7 +277,7 @@ void BinaryToolsConfigView::initializeCombinationDialog() gridLayout->setContentsMargins(30, 30, 30, 30); gridLayout->addWidget(d->commandCombination, 0, 0, 1, 2); gridLayout->addWidget(d->useCombinationButton, 1, 1, 1, 1); - QObject::connect(d->useCombinationButton, &QPushButton::clicked, [=](){ + QObject::connect(d->useCombinationButton, &DPushButton::clicked, [=](){ d->combinationDialog->close(); emit useCombinationCommand(); }); @@ -386,33 +389,33 @@ void BinaryToolsConfigView::setConfigWidget() { d->compatConfigWidget->setContentsMargins(0, 0, 0, 0); d->compatConfigWidget->setAutoFillBackground(true); - auto cmdLabel = new QLabel(d->compatConfigWidget); + auto cmdLabel = new DLabel(d->compatConfigWidget); QFont ft; ft.setBold(true); cmdLabel->setFont(ft); cmdLabel->setText(tr("Command:")); - d->commandLabel = new QLabel(d->compatConfigWidget); + d->commandLabel = new DLabel(d->compatConfigWidget); - auto argsLabel = new QLabel(d->compatConfigWidget); + auto argsLabel = new DLabel(d->compatConfigWidget); argsLabel->setText(tr("Tool arguments:")); - d->toolArgsEdit = new QLineEdit(d->compatConfigWidget); + d->toolArgsEdit = new DLineEdit(d->compatConfigWidget); d->toolArgsEdit->setPlaceholderText(tr("Input your arguments.")); - auto exeLabel = new QLabel(d->compatConfigWidget); + auto exeLabel = new DLabel(d->compatConfigWidget); exeLabel->setText(tr("Executable:")); - d->executableDirEdit = new QLineEdit(d->compatConfigWidget); - auto browseButton1 = new QPushButton(tr("Browse..."), d->compatConfigWidget); + d->executableDirEdit = new DLineEdit(d->compatConfigWidget); + auto browseButton1 = new DPushButton(tr("Browse..."), d->compatConfigWidget); - auto workLabel = new QLabel(d->compatConfigWidget); + auto workLabel = new DLabel(d->compatConfigWidget); workLabel->setText(tr("Working directory:")); - d->workingDirEdit = new QLineEdit(d->compatConfigWidget); - auto browseButton2 = new QPushButton(tr("Browse..."), d->compatConfigWidget); + d->workingDirEdit = new DLineEdit(d->compatConfigWidget); + auto browseButton2 = new DPushButton(tr("Browse..."), d->compatConfigWidget); - auto envLabel = new QLabel(d->compatConfigWidget); + auto envLabel = new DLabel(d->compatConfigWidget); envLabel->setText(tr("Envrioment: Base environment for this command configuration.")); - auto appendButton = new QPushButton(tr("&Append"), d->compatConfigWidget); - auto deleteButton = new QPushButton(tr("&Delete"), d->compatConfigWidget); - auto resetButton = new QPushButton(tr("&Reset"), d->compatConfigWidget); + auto appendButton = new DPushButton(tr("&Append"), d->compatConfigWidget); + auto deleteButton = new DPushButton(tr("&Delete"), d->compatConfigWidget); + auto resetButton = new DPushButton(tr("&Reset"), d->compatConfigWidget); deleteButton->setEnabled(false); d->envView = new EnvironmentView(); d->envView->setFixedHeight(250); @@ -438,31 +441,31 @@ void BinaryToolsConfigView::setConfigWidget() gridLayout->addWidget(d->envView, 5, 1, 5, 2); d->compatConfigWidget->setLayout(gridLayout); - connect(browseButton1, &QPushButton::clicked, [=]() { + connect(browseButton1, &DPushButton::clicked, [=]() { QString dir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); - QString filePath = QFileDialog::getOpenFileName(nullptr, tr("Select Executabel Path"), dir); + QString filePath = DFileDialog::getOpenFileName(nullptr, tr("Select Executabel Path"), dir); if (filePath.isEmpty() && !QFileInfo(filePath).exists()) return; d->executableDirEdit->setText(filePath); }); - connect(browseButton2, &QPushButton::clicked, [=]() { + connect(browseButton2, &DPushButton::clicked, [=]() { QString dir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); - QString filePath = QFileDialog::getExistingDirectory(nullptr, tr("Select Working Directory"), dir); + QString filePath = DFileDialog::getExistingDirectory(nullptr, tr("Select Working Directory"), dir); if (filePath.isEmpty() && !QFileInfo(filePath).exists()) return; d->workingDirEdit->setText(filePath); }); - connect(appendButton, &QPushButton::clicked, d->envView, &EnvironmentView::appendRow); - connect(deleteButton, &QPushButton::clicked, d->envView, &EnvironmentView::deleteRow); - connect(resetButton, &QPushButton::clicked, d->envView, &EnvironmentView::initModel); + connect(appendButton, &DPushButton::clicked, d->envView, &EnvironmentView::appendRow); + connect(deleteButton, &DPushButton::clicked, d->envView, &EnvironmentView::deleteRow); + connect(resetButton, &DPushButton::clicked, d->envView, &EnvironmentView::initModel); - connect(d->toolArgsEdit, &QLineEdit::textChanged, [=](){ + connect(d->toolArgsEdit, &DLineEdit::textChanged, [=](){ d->commandLabel->setText(d->executableDirEdit->text() + " " + d->toolArgsEdit->text()); }); - connect(d->executableDirEdit, &QLineEdit::textChanged, [=](){ + connect(d->executableDirEdit, &DLineEdit::textChanged, [=](){ d->commandLabel->setText(d->executableDirEdit->text() + " " + d->toolArgsEdit->text()); }); diff --git a/src/plugins/binarytools/mainframe/binarytoolsdialog.cpp b/src/plugins/binarytools/mainframe/binarytoolsdialog.cpp index 4f98b05b6..81e373c37 100644 --- a/src/plugins/binarytools/mainframe/binarytoolsdialog.cpp +++ b/src/plugins/binarytools/mainframe/binarytoolsdialog.cpp @@ -6,17 +6,19 @@ #include "binarytoolsconfigview.h" #include "common/util/eventdefinitions.h" -#include -#include +#include +#include + #include #include #include +DWIDGET_USE_NAMESPACE class BinaryToolsDialogPrivate { friend class BinaryToolsDialog; BinaryToolsConfigView *configView = nullptr; - QDialogButtonBox *buttons = nullptr; + DDialogButtonBox *buttons = nullptr; }; BinaryToolsDialog::BinaryToolsDialog(QDialog *parent) @@ -34,12 +36,12 @@ BinaryToolsDialog::BinaryToolsDialog(QDialog *parent) vLayout->addStretch(); QHBoxLayout * buttonLayout = new QHBoxLayout(); - d->buttons = new QDialogButtonBox(this); - d->buttons->setStandardButtons(QDialogButtonBox::Apply | QDialogButtonBox::Save | QDialogButtonBox::Cancel); - d->buttons->button(QDialogButtonBox::Apply)->setText(tr("Use Tool")); - d->buttons->button(QDialogButtonBox::Save)->setText(tr("Save")); - d->buttons->button(QDialogButtonBox::Cancel)->setText(tr("Cancel")); - d->buttons->button(QDialogButtonBox::Apply)->setDefault(true); + d->buttons = new DDialogButtonBox(this); + d->buttons->setStandardButtons(DDialogButtonBox::Apply | DDialogButtonBox::Save | DDialogButtonBox::Cancel); + d->buttons->button(DDialogButtonBox::Apply)->setText(tr("Use Tool")); + d->buttons->button(DDialogButtonBox::Save)->setText(tr("Save")); + d->buttons->button(DDialogButtonBox::Cancel)->setText(tr("Cancel")); + d->buttons->button(DDialogButtonBox::Apply)->setDefault(true); buttonLayout->addWidget(d->buttons); vLayout->addLayout(buttonLayout); @@ -48,14 +50,14 @@ BinaryToolsDialog::BinaryToolsDialog(QDialog *parent) useClicked(); }); }); - connect(d->buttons->button(QDialogButtonBox::Apply), &QPushButton::clicked, [=](){ + connect(d->buttons->button(DDialogButtonBox::Apply), &DPushButton::clicked, [=](){ QtConcurrent::run([=](){ useClicked(); }); }); - connect(d->buttons->button(QDialogButtonBox::Save), &QPushButton::clicked, this, &BinaryToolsDialog::saveClicked); - connect(d->buttons, &QDialogButtonBox::rejected, this, &BinaryToolsDialog::reject); - connect(d->buttons, &QDialogButtonBox::accepted, this, &BinaryToolsDialog::accept); + connect(d->buttons->button(DDialogButtonBox::Save), &DPushButton::clicked, this, &BinaryToolsDialog::saveClicked); + connect(d->buttons, &DDialogButtonBox::rejected, this, &BinaryToolsDialog::reject); + connect(d->buttons, &DDialogButtonBox::accepted, this, &BinaryToolsDialog::accept); } BinaryToolsDialog::~BinaryToolsDialog() diff --git a/src/plugins/binarytools/mainframe/environmentview.cpp b/src/plugins/binarytools/mainframe/environmentview.cpp index 7c6c77f44..19b4d1f4a 100644 --- a/src/plugins/binarytools/mainframe/environmentview.cpp +++ b/src/plugins/binarytools/mainframe/environmentview.cpp @@ -4,12 +4,15 @@ #include "environmentview.h" +#include +#include +#include + #include -#include #include -#include #include +DWIDGET_USE_NAMESPACE class EnvironmentModelPrivate { friend class EnvironmentModel; @@ -141,7 +144,7 @@ class EnvironmentViewPrivate friend class EnvironmentView; QVBoxLayout *vLayout = nullptr; - QTableView *tableView = nullptr; + DTableView *tableView = nullptr; EnvironmentModel *model = nullptr; }; @@ -156,10 +159,10 @@ EnvironmentView::EnvironmentView(QWidget *parent) this->setLayout(d->vLayout); if (!d->tableView) { - d->tableView = new QTableView(); + d->tableView = new DTableView(); d->tableView->setShowGrid(false); - QHeaderView* headerView = d->tableView->horizontalHeader(); - headerView->setSectionResizeMode(QHeaderView::ResizeToContents); + DHeaderView* headerView = d->tableView->horizontalHeader(); + headerView->setSectionResizeMode(DHeaderView::ResizeToContents); d->tableView->verticalHeader()->hide(); d->tableView->setSelectionMode(QAbstractItemView::SingleSelection); d->tableView->setSelectionBehavior(QAbstractItemView::SelectItems);