diff --git a/src/plugins/git/branchdialog.cpp b/src/plugins/git/branchdialog.cpp index ee68ed5dfaf04fb924d317fb317b066e1ec3c209..926230e3da0c79ef3416932eadb9c08560b4b417 100644 --- a/src/plugins/git/branchdialog.cpp +++ b/src/plugins/git/branchdialog.cpp @@ -67,23 +67,23 @@ BranchDialog::BranchDialog(QWidget *parent) : m_ui->setupUi(this); - connect(m_ui->refreshButton, SIGNAL(clicked()), this, SLOT(refresh())); - connect(m_ui->addButton, SIGNAL(clicked()), this, SLOT(add())); - connect(m_ui->checkoutButton, SIGNAL(clicked()), this, SLOT(checkout())); - connect(m_ui->removeButton, SIGNAL(clicked()), this, SLOT(remove())); - connect(m_ui->renameButton, SIGNAL(clicked()), this, SLOT(rename())); - connect(m_ui->diffButton, SIGNAL(clicked()), this, SLOT(diff())); - connect(m_ui->logButton, SIGNAL(clicked()), this, SLOT(log())); - connect(m_ui->resetButton, SIGNAL(clicked()), this, SLOT(reset())); - connect(m_ui->mergeButton, SIGNAL(clicked()), this, SLOT(merge())); - connect(m_ui->rebaseButton, SIGNAL(clicked()), this, SLOT(rebase())); - connect(m_ui->cherryPickButton, SIGNAL(clicked()), this, SLOT(cherryPick())); - connect(m_ui->trackButton, SIGNAL(clicked()), this, SLOT(setRemoteTracking())); + connect(m_ui->refreshButton, &QAbstractButton::clicked, this, &BranchDialog::refreshCurrentRepository); + connect(m_ui->addButton, &QAbstractButton::clicked, this, &BranchDialog::add); + connect(m_ui->checkoutButton, &QAbstractButton::clicked, this, &BranchDialog::checkout); + connect(m_ui->removeButton, &QAbstractButton::clicked, this, &BranchDialog::remove); + connect(m_ui->renameButton, &QAbstractButton::clicked, this, &BranchDialog::rename); + connect(m_ui->diffButton, &QAbstractButton::clicked, this, &BranchDialog::diff); + connect(m_ui->logButton, &QAbstractButton::clicked, this, &BranchDialog::log); + connect(m_ui->resetButton, &QAbstractButton::clicked, this, &BranchDialog::reset); + connect(m_ui->mergeButton, &QAbstractButton::clicked, this, &BranchDialog::merge); + connect(m_ui->rebaseButton, &QAbstractButton::clicked, this, &BranchDialog::rebase); + connect(m_ui->cherryPickButton, &QAbstractButton::clicked, this, &BranchDialog::cherryPick); + connect(m_ui->trackButton, &QAbstractButton::clicked, this, &BranchDialog::setRemoteTracking); m_ui->branchView->setModel(m_model); - connect(m_ui->branchView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(enableButtons())); + connect(m_ui->branchView->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &BranchDialog::enableButtons); enableButtons(); } @@ -110,7 +110,7 @@ void BranchDialog::refresh(const QString &repository, bool force) void BranchDialog::refreshIfSame(const QString &repository) { if (m_repository == repository) - refresh(); + refreshCurrentRepository(); } void BranchDialog::enableButtons() @@ -137,7 +137,7 @@ void BranchDialog::enableButtons() m_ui->trackButton->setEnabled(hasActions && currentLocal && !currentSelected && !isTag); } -void BranchDialog::refresh() +void BranchDialog::refreshCurrentRepository() { refresh(m_repository, true); } @@ -306,7 +306,7 @@ void BranchDialog::rename() m_model->renameTag(oldName, branchAddDialog.branchName()); else m_model->renameBranch(oldName, branchAddDialog.branchName()); - refresh(); + refreshCurrentRepository(); } enableButtons(); } diff --git a/src/plugins/git/branchdialog.h b/src/plugins/git/branchdialog.h index dfccc62c5ea6566332e97773c5ccd84f4a5e5795..46c4a4de692c50d9dbff67fe0c565da32c48d6a8 100644 --- a/src/plugins/git/branchdialog.h +++ b/src/plugins/git/branchdialog.h @@ -62,9 +62,9 @@ public slots: void refresh(const QString &repository, bool force); void refreshIfSame(const QString &repository); -private slots: +private: void enableButtons(); - void refresh(); + void refreshCurrentRepository(); void add(); void checkout(); void remove(); @@ -77,7 +77,6 @@ private slots: void cherryPick(); void setRemoteTracking(); -private: QModelIndex selectedIndex(); Ui::BranchDialog *m_ui; diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp index 43b59431f7232e462e51bb13e4dca09f42c7a692..9d02d500ee21fbd48968e60ae6bf72ea99e35b48 100644 --- a/src/plugins/git/changeselectiondialog.cpp +++ b/src/plugins/git/changeselectiondialog.cpp @@ -290,7 +290,7 @@ void ChangeSelectionDialog::changeTextChanged(const QString &text) if (QCompleter *comp = m_ui->changeNumberEdit->completer()) { if (text.isEmpty() && !comp->popup()->isVisible()) { comp->setCompletionPrefix(text); - QTimer::singleShot(0, comp, SLOT(complete())); + QTimer::singleShot(0, comp, [comp]{ comp->complete(); }); } } recalculateDetails(); diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index a3c3b88543518ef3dbed707067ea78bfafe078d2..12ba79f743de46995de39e57be1d7c380058c9ea 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -346,9 +346,7 @@ public: static QString msgNoCommits(bool includeRemote); public slots: - void show(const QString &source, - const QString &id, - const QString &name = QString()); + void show(const QString &source, const QString &id, const QString &name = QString()); private slots: void finishSubmoduleUpdate(); diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp index 45fee1db5dd130fa967a84819c498d0733cda1a7..3f3615885b0bf93604ace97707ae194313244e8d 100644 --- a/src/plugins/git/giteditor.cpp +++ b/src/plugins/git/giteditor.cpp @@ -325,10 +325,15 @@ void GitEditorWidget::addChangeActions(QMenu *menu, const QString &change) { m_currentChange = change; if (contentType() != OtherContent) { - menu->addAction(tr("Cherr&y-Pick Change %1").arg(change), this, SLOT(cherryPickChange())); - menu->addAction(tr("Re&vert Change %1").arg(change), this, SLOT(revertChange())); - menu->addAction(tr("C&heckout Change %1").arg(change), this, SLOT(checkoutChange())); - menu->addAction(tr("&Log for Change %1").arg(change), this, SLOT(logChange())); + connect(menu->addAction(tr("Cherr&y-Pick Change %1").arg(change)), &QAction::triggered, + this, &GitEditorWidget::cherryPickChange); + connect(menu->addAction(tr("Re&vert Change %1").arg(change)), &QAction::triggered, + this, &GitEditorWidget::revertChange); + connect(menu->addAction(tr("C&heckout Change %1").arg(change)), &QAction::triggered, + this, &GitEditorWidget::checkoutChange); + connect(menu->addAction(tr("&Log for Change %1").arg(change)), &QAction::triggered, + this, &GitEditorWidget::logChange); + QMenu *resetMenu = new QMenu(tr("&Reset to Change %1").arg(change), menu); connect(resetMenu->addAction(tr("&Hard")), &QAction::triggered, this, [this]() { resetChange("hard"); }); diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index b52e02d767c38114768308fe078b7568babe8ecd..e78e2df06adae69a19cccb35854176e162ac7515 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -206,7 +206,7 @@ ParameterAction *GitPlugin::createParameterAction(ActionContainer *ac, return action; } -// Create an action to act on a file with a slot. +// Create an action to act on a file. QAction *GitPlugin::createFileAction(ActionContainer *ac, const QString &defaultText, const QString ¶meterText, Id id, const Context &context, bool addToLocator, @@ -241,7 +241,7 @@ QAction *GitPlugin::createProjectAction(ActionContainer *ac, const QString &defa return action; } -// Create an action to act on the repository with slot +// Create an action to act on the repository QAction *GitPlugin::createRepositoryAction(ActionContainer *ac, const QString &text, Id id, const Context &context, bool addToLocator, const std::function<void()> &callback, @@ -270,7 +270,7 @@ QAction *GitPlugin::createRepositoryAction(ActionContainer *ac, const QString &t QTC_ASSERT(currentState().hasTopLevel(), return); (m_gitClient->*func)(currentState().topLevel()); }; - // Set the member func as data and connect to generic slot + // Set the member func as data and connect to GitClient method return createRepositoryAction(ac, text, id, context, addToLocator, cb, keys); } @@ -959,9 +959,10 @@ IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData & IDocument *document = submitEditor->document(); document->setPreferredDisplayName(title); VcsBasePlugin::setSource(document, m_submitRepository); - connect(submitEditor, SIGNAL(diff(QStringList,QStringList)), this, SLOT(submitEditorDiff(QStringList,QStringList))); - connect(submitEditor, SIGNAL(merge(QStringList)), this, SLOT(submitEditorMerge(QStringList))); - connect(submitEditor, SIGNAL(show(QString,QString)), m_gitClient, SLOT(show(QString,QString))); + connect(submitEditor, &GitSubmitEditor::diff, this, &GitPlugin::submitEditorDiff); + connect(submitEditor, &GitSubmitEditor::merge, this, &GitPlugin::submitEditorMerge); + connect(submitEditor, &GitSubmitEditor::show, + m_gitClient, [this](const QString &wd, const QString &c) { m_gitClient->show(wd, c); }); return editor; } @@ -1036,7 +1037,7 @@ bool GitPlugin::submitEditorAboutToClose() if (editor->panelData().pushAction == NormalPush) m_gitClient->push(m_submitRepository); else if (editor->panelData().pushAction == PushToGerrit) - connect(editor, SIGNAL(destroyed()), this, SLOT(delayedPushToGerrit())); + connect(editor, &QObject::destroyed, this, &GitPlugin::delayedPushToGerrit); } return true; diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index ea575e60fd50fd36f97dafbaacde571ea4127ea7..d9fb048db829e50a1f76836274793beffe9480d8 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -96,7 +96,20 @@ public slots: void startCommit(); void updateBranches(const QString &repository); +protected: + void updateActions(VcsBase::VcsBasePlugin::ActionState) override; + bool submitEditorAboutToClose() override; + +#ifdef WITH_TESTS private slots: + void testStatusParsing_data(); + void testStatusParsing(); + void testDiffFileResolving_data(); + void testDiffFileResolving(); + void testLogResolving(); +#endif + +private: void diffCurrentFile(); void diffCurrentProject(); void submitEditorDiff(const QStringList &unstaged, const QStringList &staged); @@ -138,21 +151,10 @@ private slots: void updateContinueAndAbortCommands(); void delayedPushToGerrit(); -#ifdef WITH_TESTS - void testStatusParsing_data(); - void testStatusParsing(); - void testDiffFileResolving_data(); - void testDiffFileResolving(); - void testLogResolving(); -#endif -protected: - void updateActions(VcsBase::VcsBasePlugin::ActionState) override; - bool submitEditorAboutToClose() override; - -private: Core::Command *createCommand(QAction *action, Core::ActionContainer *ac, Core::Id id, const Core::Context &context, bool addToLocator, const std::function<void()> &callback, const QKeySequence &keys); + Utils::ParameterAction *createParameterAction(Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, Core::Id id, const Core::Context &context, bool addToLocator, diff --git a/src/plugins/git/gitsubmiteditor.cpp b/src/plugins/git/gitsubmiteditor.cpp index c4c6f8583a9050f110cb325f9af9c82d5677a58e..b39fdeec3361f6e0e99f829f9860ef83f8461f57 100644 --- a/src/plugins/git/gitsubmiteditor.cpp +++ b/src/plugins/git/gitsubmiteditor.cpp @@ -132,9 +132,8 @@ GitSubmitEditor::GitSubmitEditor(const VcsBaseSubmitEditorParameters *parameters m_firstUpdate(true), m_commitDataFetcher(0) { - connect(this, &VcsBaseSubmitEditor::diffSelectedRows, - this, &GitSubmitEditor::slotDiffSelected); - connect(submitEditorWidget(), SIGNAL(show(QString)), this, SLOT(showCommit(QString))); + connect(this, &VcsBaseSubmitEditor::diffSelectedRows, this, &GitSubmitEditor::slotDiffSelected); + connect(submitEditorWidget(), &GitSubmitEditorWidget::show, this, &GitSubmitEditor::showCommit); } GitSubmitEditor::~GitSubmitEditor() @@ -156,8 +155,8 @@ void GitSubmitEditor::resetCommitDataFetcher() { if (!m_commitDataFetcher) return; - disconnect(m_commitDataFetcher, SIGNAL(finished(bool)), this, SLOT(commitDataRetrieved(bool))); - connect(m_commitDataFetcher, SIGNAL(finished(bool)), m_commitDataFetcher, SLOT(deleteLater())); + disconnect(m_commitDataFetcher, &CommitDataFetcher::finished, this, &GitSubmitEditor::commitDataRetrieved); + connect(m_commitDataFetcher, &CommitDataFetcher::finished, m_commitDataFetcher, &QObject::deleteLater); } void GitSubmitEditor::setCommitData(const CommitData &d) @@ -264,7 +263,7 @@ void GitSubmitEditor::updateFileModel() w->setUpdateInProgress(true); resetCommitDataFetcher(); m_commitDataFetcher = new CommitDataFetcher(m_commitType, m_workingDirectory); - connect(m_commitDataFetcher, SIGNAL(finished(bool)), this, SLOT(commitDataRetrieved(bool))); + connect(m_commitDataFetcher, &CommitDataFetcher::finished, this, &GitSubmitEditor::commitDataRetrieved); QFuture<void> future = QtConcurrent::run(m_commitDataFetcher, &CommitDataFetcher::start); Core::ProgressManager::addTask(future, tr("Refreshing Commit Data"), TASK_UPDATE_COMMIT); diff --git a/src/plugins/git/gitsubmiteditor.h b/src/plugins/git/gitsubmiteditor.h index 1d27bbb4d414716c3523d4700768351ed5de7b38..4a8910d01bf526faa5737c11da284389cd743a8e 100644 --- a/src/plugins/git/gitsubmiteditor.h +++ b/src/plugins/git/gitsubmiteditor.h @@ -68,12 +68,11 @@ protected: QByteArray fileContents() const override; void updateFileModel() override; -private slots: +private: void slotDiffSelected(const QList<int> &rows); void showCommit(const QString &commit); void commitDataRetrieved(bool success); -private: inline GitSubmitEditorWidget *submitEditorWidget(); inline const GitSubmitEditorWidget *submitEditorWidget() const; void resetCommitDataFetcher(); diff --git a/src/plugins/git/gitsubmiteditorwidget.cpp b/src/plugins/git/gitsubmiteditorwidget.cpp index e0a33d07c00edcc7c243c69314ae7c0a4faeb22c..19bfdfe88849d7578bb102b7bad2cfc891520d8d 100644 --- a/src/plugins/git/gitsubmiteditorwidget.cpp +++ b/src/plugins/git/gitsubmiteditorwidget.cpp @@ -108,8 +108,7 @@ void GitSubmitEditorWidget::initialize(CommitType commitType, logChangeGroupBox->setLayout(logChangeLayout); m_logChangeWidget = new LogChangeWidget; m_logChangeWidget->init(repository); - connect(m_logChangeWidget, &LogChangeWidget::activated, - this, &GitSubmitEditorWidget::show); + connect(m_logChangeWidget, &LogChangeWidget::commitActivated, this, &GitSubmitEditorWidget::show); logChangeLayout->addWidget(m_logChangeWidget); insertLeftWidget(logChangeGroupBox); m_gitSubmitPanelUi.editGroup->hide(); @@ -121,9 +120,12 @@ void GitSubmitEditorWidget::initialize(CommitType commitType, if (enablePush) { auto menu = new QMenu(this); - menu->addAction(tr("&Commit only"), this, SLOT(commitOnlySlot())); - menu->addAction(tr("Commit and &Push"), this, SLOT(commitAndPushSlot())); - menu->addAction(tr("Commit and Push to &Gerrit"), this, SLOT(commitAndPushToGerritSlot())); + connect(menu->addAction(tr("&Commit only")), &QAction::triggered, + this, &GitSubmitEditorWidget::commitOnlySlot); + connect(menu->addAction(tr("Commit and &Push")), &QAction::triggered, + this, &GitSubmitEditorWidget::commitAndPushSlot); + connect(menu->addAction(tr("Commit and Push to &Gerrit")), &QAction::triggered, + this, &GitSubmitEditorWidget::commitAndPushToGerritSlot); addSubmitButtonMenu(menu); } } diff --git a/src/plugins/git/gitsubmiteditorwidget.h b/src/plugins/git/gitsubmiteditorwidget.h index 7b0ca0b6174e3704ddd20b060962e12e04e3a334..f7568ee9ae9b3ff0a4bf3f0516beee7a0bc61a81 100644 --- a/src/plugins/git/gitsubmiteditorwidget.h +++ b/src/plugins/git/gitsubmiteditorwidget.h @@ -85,13 +85,12 @@ protected: signals: void show(const QString &commit); -private slots: +private: void authorInformationChanged(); void commitOnlySlot(); void commitAndPushSlot(); void commitAndPushToGerritSlot(); -private: bool emailIsValid() const; void setPanelData(const GitSubmitEditorPanelData &data); void setPanelInfo(const GitSubmitEditorPanelInfo &info); diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp index aa16937529594c57382a7b5bc7ec4a1f51448508..6a5b374d6b569ebc2c13407ed3a2462f373a0d66 100644 --- a/src/plugins/git/logchangedialog.cpp +++ b/src/plugins/git/logchangedialog.cpp @@ -73,7 +73,7 @@ LogChangeWidget::LogChangeWidget(QWidget *parent) setRootIsDecorated(false); setSelectionBehavior(QAbstractItemView::SelectRows); setActivationMode(Utils::DoubleClickActivation); - connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(emitActivated(QModelIndex))); + connect(this, &LogChangeWidget::activated, this, &LogChangeWidget::emitCommitActivated); } bool LogChangeWidget::init(const QString &repository, const QString &commit, LogFlags flags) @@ -120,12 +120,12 @@ void LogChangeWidget::setItemDelegate(QAbstractItemDelegate *delegate) m_hasCustomDelegate = true; } -void LogChangeWidget::emitActivated(const QModelIndex &index) +void LogChangeWidget::emitCommitActivated(const QModelIndex &index) { if (index.isValid()) { QString commit = index.sibling(index.row(), Sha1Column).data().toString(); if (!commit.isEmpty()) - emit activated(commit); + emit commitActivated(commit); } } @@ -228,10 +228,10 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) : QPushButton *okButton = m_dialogButtonBox->addButton(QDialogButtonBox::Ok); layout->addLayout(popUpLayout); - connect(m_dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(m_dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(m_dialogButtonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(m_dialogButtonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); - connect(m_widget, SIGNAL(activated(QModelIndex)), okButton, SLOT(animateClick())); + connect(m_widget, &LogChangeWidget::activated, okButton, [okButton] { okButton->animateClick(); }); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); resize(600, 400); diff --git a/src/plugins/git/logchangedialog.h b/src/plugins/git/logchangedialog.h index 5b2000f97979e1b24af41210758ebe6b2f4389b7..9aa345ad95f9fc08ede2a60b47b92f6604d9740e 100644 --- a/src/plugins/git/logchangedialog.h +++ b/src/plugins/git/logchangedialog.h @@ -72,12 +72,11 @@ public: void setItemDelegate(QAbstractItemDelegate *delegate); signals: - void activated(const QString &commit); - -private slots: - void emitActivated(const QModelIndex &index); + void commitActivated(const QString &commit); private: + void emitCommitActivated(const QModelIndex &index); + void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override; bool populateLog(const QString &repository, const QString &commit, LogFlags flags); const QStandardItem *currentItem(int column = 0) const; diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp index 6bd665c9ed8a9c2ce0ffbc98115f7368c8bf0d78..40d9f840970759cf953bfcd58c90518f53aaf2b0 100644 --- a/src/plugins/git/mergetool.cpp +++ b/src/plugins/git/mergetool.cpp @@ -106,8 +106,8 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files) VcsOutputWindow::appendCommand(workingDirectory, binary, arguments); m_process->start(binary.toString(), arguments); if (m_process->waitForStarted()) { - connect(m_process, SIGNAL(finished(int)), this, SLOT(done())); - connect(m_process, SIGNAL(readyRead()), this, SLOT(readData())); + connect(m_process, static_cast<void (QProcess::*)(int)>(&QProcess::finished), this, &MergeTool::done); + connect(m_process, &QIODevice::readyRead, this, &MergeTool::readData); } else { delete m_process; m_process = 0; diff --git a/src/plugins/git/mergetool.h b/src/plugins/git/mergetool.h index ddc4589010fc4eace92b43fdfd5f32872205efbc..f7c547aced64fd8f03469eb4a43cd21220fe99da 100644 --- a/src/plugins/git/mergetool.h +++ b/src/plugins/git/mergetool.h @@ -69,11 +69,10 @@ public: SymbolicLinkMerge }; -private slots: +private: void readData(); void done(); -private: FileState waitAndReadStatus(QString &extraInfo); QString mergeTypeName(); QString stateName(FileState state, const QString &extraInfo); diff --git a/src/plugins/git/remotedialog.cpp b/src/plugins/git/remotedialog.cpp index c145a0fee0cdda3518587350bffa17c8675e4c39..7f79ffdaa5a1b72ac78a4276b98fc71b15f07eb8 100644 --- a/src/plugins/git/remotedialog.cpp +++ b/src/plugins/git/remotedialog.cpp @@ -98,19 +98,14 @@ RemoteDialog::RemoteDialog(QWidget *parent) : m_ui->remoteView->setModel(m_remoteModel); new Utils::HeaderViewStretcher(m_ui->remoteView->header(), 1); - connect(m_ui->addButton, &QPushButton::clicked, - this, &RemoteDialog::addRemote); - connect(m_ui->fetchButton, &QPushButton::clicked, - this, &RemoteDialog::fetchFromRemote); - connect(m_ui->pushButton, &QPushButton::clicked, - this, &RemoteDialog::pushToRemote); - connect(m_ui->removeButton, &QPushButton::clicked, - this, &RemoteDialog::removeRemote); - connect(m_ui->refreshButton, &QPushButton::clicked, - this, &RemoteDialog::refreshRemotes); - - connect(m_ui->remoteView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(updateButtonState())); + connect(m_ui->addButton, &QPushButton::clicked, this, &RemoteDialog::addRemote); + connect(m_ui->fetchButton, &QPushButton::clicked, this, &RemoteDialog::fetchFromRemote); + connect(m_ui->pushButton, &QPushButton::clicked, this, &RemoteDialog::pushToRemote); + connect(m_ui->removeButton, &QPushButton::clicked, this, &RemoteDialog::removeRemote); + connect(m_ui->refreshButton, &QPushButton::clicked, this, &RemoteDialog::refreshRemotes); + + connect(m_ui->remoteView->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &RemoteDialog::updateButtonState); updateButtonState(); } diff --git a/src/plugins/git/remotedialog.h b/src/plugins/git/remotedialog.h index a3cf3dcc885a05ec094de23bc9d19ab2bb0ea1ca..940cfa2fb87c65d0362e091d510664b17fe7c352 100644 --- a/src/plugins/git/remotedialog.h +++ b/src/plugins/git/remotedialog.h @@ -80,6 +80,7 @@ public: public slots: void refresh(const QString &repository, bool force); +private: void refreshRemotes(); void addRemote(); void removeRemote(); @@ -88,7 +89,6 @@ public slots: void updateButtonState(); -private: Ui::RemoteDialog *m_ui; RemoteModel *m_remoteModel; diff --git a/src/plugins/git/stashdialog.cpp b/src/plugins/git/stashdialog.cpp index 0a3049c18efe433de459066e888bfabf9ae8973a..1b60dd38472355c9a1c8b0ee45652f2a305d5097 100644 --- a/src/plugins/git/stashdialog.cpp +++ b/src/plugins/git/stashdialog.cpp @@ -148,10 +148,10 @@ StashDialog::StashDialog(QWidget *parent) : ui->stashView->setUniformRowHeights(true); connect(ui->filterLineEdit, &Utils::FancyLineEdit::filterChanged, m_proxyModel, &QSortFilterProxyModel::setFilterFixedString); - connect(ui->stashView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), - this, SLOT(enableButtons())); - connect(ui->stashView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(enableButtons())); + connect(ui->stashView->selectionModel(), &QItemSelectionModel::currentRowChanged, + this, &StashDialog::enableButtons); + connect(ui->stashView->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &StashDialog::enableButtons); connect(ui->stashView, &Utils::TreeView::activated, this, &StashDialog::showCurrent); ui->stashView->setFocus(); diff --git a/src/plugins/git/stashdialog.h b/src/plugins/git/stashdialog.h index 5b01784a9bb7675b131f8d544a4be938bdf896cf..1837347054fa46dacb3d5f6625698863e8afcfd1 100644 --- a/src/plugins/git/stashdialog.h +++ b/src/plugins/git/stashdialog.h @@ -63,15 +63,6 @@ public: public slots: void refresh(const QString &repository, bool force); -private slots: - void deleteAll(); - void deleteSelection(); - void showCurrent(); - void restoreCurrent(); - void restoreCurrentInBranch(); - void enableButtons(); - void forceRefresh(); - private: // Prompt dialog for modified repositories. Ask to undo or stash away. enum ModifiedRepositoryAction { @@ -80,6 +71,14 @@ private: ModifiedRepositoryDiscard }; + void deleteAll(); + void deleteSelection(); + void showCurrent(); + void restoreCurrent(); + void restoreCurrentInBranch(); + void enableButtons(); + void forceRefresh(); + ModifiedRepositoryAction promptModifiedRepository(const QString &stash); bool promptForRestore(QString *stash, QString *branch /* = 0 */, QString *errorMessage); bool ask(const QString &title, const QString &what, bool defaultButton = true);