forked from qt-creator/qt-creator
Git: Use Qt5-style connects
The heavy lifting was done by clazy. Change-Id: I60dcd378419b92f96dc681921701c9231ef8ee57 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -67,23 +67,23 @@ BranchDialog::BranchDialog(QWidget *parent) :
|
|||||||
|
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
connect(m_ui->refreshButton, SIGNAL(clicked()), this, SLOT(refresh()));
|
connect(m_ui->refreshButton, &QAbstractButton::clicked, this, &BranchDialog::refreshCurrentRepository);
|
||||||
connect(m_ui->addButton, SIGNAL(clicked()), this, SLOT(add()));
|
connect(m_ui->addButton, &QAbstractButton::clicked, this, &BranchDialog::add);
|
||||||
connect(m_ui->checkoutButton, SIGNAL(clicked()), this, SLOT(checkout()));
|
connect(m_ui->checkoutButton, &QAbstractButton::clicked, this, &BranchDialog::checkout);
|
||||||
connect(m_ui->removeButton, SIGNAL(clicked()), this, SLOT(remove()));
|
connect(m_ui->removeButton, &QAbstractButton::clicked, this, &BranchDialog::remove);
|
||||||
connect(m_ui->renameButton, SIGNAL(clicked()), this, SLOT(rename()));
|
connect(m_ui->renameButton, &QAbstractButton::clicked, this, &BranchDialog::rename);
|
||||||
connect(m_ui->diffButton, SIGNAL(clicked()), this, SLOT(diff()));
|
connect(m_ui->diffButton, &QAbstractButton::clicked, this, &BranchDialog::diff);
|
||||||
connect(m_ui->logButton, SIGNAL(clicked()), this, SLOT(log()));
|
connect(m_ui->logButton, &QAbstractButton::clicked, this, &BranchDialog::log);
|
||||||
connect(m_ui->resetButton, SIGNAL(clicked()), this, SLOT(reset()));
|
connect(m_ui->resetButton, &QAbstractButton::clicked, this, &BranchDialog::reset);
|
||||||
connect(m_ui->mergeButton, SIGNAL(clicked()), this, SLOT(merge()));
|
connect(m_ui->mergeButton, &QAbstractButton::clicked, this, &BranchDialog::merge);
|
||||||
connect(m_ui->rebaseButton, SIGNAL(clicked()), this, SLOT(rebase()));
|
connect(m_ui->rebaseButton, &QAbstractButton::clicked, this, &BranchDialog::rebase);
|
||||||
connect(m_ui->cherryPickButton, SIGNAL(clicked()), this, SLOT(cherryPick()));
|
connect(m_ui->cherryPickButton, &QAbstractButton::clicked, this, &BranchDialog::cherryPick);
|
||||||
connect(m_ui->trackButton, SIGNAL(clicked()), this, SLOT(setRemoteTracking()));
|
connect(m_ui->trackButton, &QAbstractButton::clicked, this, &BranchDialog::setRemoteTracking);
|
||||||
|
|
||||||
m_ui->branchView->setModel(m_model);
|
m_ui->branchView->setModel(m_model);
|
||||||
|
|
||||||
connect(m_ui->branchView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
connect(m_ui->branchView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||||
this, SLOT(enableButtons()));
|
this, &BranchDialog::enableButtons);
|
||||||
|
|
||||||
enableButtons();
|
enableButtons();
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ void BranchDialog::refresh(const QString &repository, bool force)
|
|||||||
void BranchDialog::refreshIfSame(const QString &repository)
|
void BranchDialog::refreshIfSame(const QString &repository)
|
||||||
{
|
{
|
||||||
if (m_repository == repository)
|
if (m_repository == repository)
|
||||||
refresh();
|
refreshCurrentRepository();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BranchDialog::enableButtons()
|
void BranchDialog::enableButtons()
|
||||||
@@ -137,7 +137,7 @@ void BranchDialog::enableButtons()
|
|||||||
m_ui->trackButton->setEnabled(hasActions && currentLocal && !currentSelected && !isTag);
|
m_ui->trackButton->setEnabled(hasActions && currentLocal && !currentSelected && !isTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BranchDialog::refresh()
|
void BranchDialog::refreshCurrentRepository()
|
||||||
{
|
{
|
||||||
refresh(m_repository, true);
|
refresh(m_repository, true);
|
||||||
}
|
}
|
||||||
@@ -306,7 +306,7 @@ void BranchDialog::rename()
|
|||||||
m_model->renameTag(oldName, branchAddDialog.branchName());
|
m_model->renameTag(oldName, branchAddDialog.branchName());
|
||||||
else
|
else
|
||||||
m_model->renameBranch(oldName, branchAddDialog.branchName());
|
m_model->renameBranch(oldName, branchAddDialog.branchName());
|
||||||
refresh();
|
refreshCurrentRepository();
|
||||||
}
|
}
|
||||||
enableButtons();
|
enableButtons();
|
||||||
}
|
}
|
||||||
|
@@ -62,9 +62,9 @@ public slots:
|
|||||||
void refresh(const QString &repository, bool force);
|
void refresh(const QString &repository, bool force);
|
||||||
void refreshIfSame(const QString &repository);
|
void refreshIfSame(const QString &repository);
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void enableButtons();
|
void enableButtons();
|
||||||
void refresh();
|
void refreshCurrentRepository();
|
||||||
void add();
|
void add();
|
||||||
void checkout();
|
void checkout();
|
||||||
void remove();
|
void remove();
|
||||||
@@ -77,7 +77,6 @@ private slots:
|
|||||||
void cherryPick();
|
void cherryPick();
|
||||||
void setRemoteTracking();
|
void setRemoteTracking();
|
||||||
|
|
||||||
private:
|
|
||||||
QModelIndex selectedIndex();
|
QModelIndex selectedIndex();
|
||||||
|
|
||||||
Ui::BranchDialog *m_ui;
|
Ui::BranchDialog *m_ui;
|
||||||
|
@@ -290,7 +290,7 @@ void ChangeSelectionDialog::changeTextChanged(const QString &text)
|
|||||||
if (QCompleter *comp = m_ui->changeNumberEdit->completer()) {
|
if (QCompleter *comp = m_ui->changeNumberEdit->completer()) {
|
||||||
if (text.isEmpty() && !comp->popup()->isVisible()) {
|
if (text.isEmpty() && !comp->popup()->isVisible()) {
|
||||||
comp->setCompletionPrefix(text);
|
comp->setCompletionPrefix(text);
|
||||||
QTimer::singleShot(0, comp, SLOT(complete()));
|
QTimer::singleShot(0, comp, [comp]{ comp->complete(); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recalculateDetails();
|
recalculateDetails();
|
||||||
|
@@ -346,9 +346,7 @@ public:
|
|||||||
static QString msgNoCommits(bool includeRemote);
|
static QString msgNoCommits(bool includeRemote);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void show(const QString &source,
|
void show(const QString &source, const QString &id, const QString &name = QString());
|
||||||
const QString &id,
|
|
||||||
const QString &name = QString());
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void finishSubmoduleUpdate();
|
void finishSubmoduleUpdate();
|
||||||
|
@@ -325,10 +325,15 @@ void GitEditorWidget::addChangeActions(QMenu *menu, const QString &change)
|
|||||||
{
|
{
|
||||||
m_currentChange = change;
|
m_currentChange = change;
|
||||||
if (contentType() != OtherContent) {
|
if (contentType() != OtherContent) {
|
||||||
menu->addAction(tr("Cherr&y-Pick Change %1").arg(change), this, SLOT(cherryPickChange()));
|
connect(menu->addAction(tr("Cherr&y-Pick Change %1").arg(change)), &QAction::triggered,
|
||||||
menu->addAction(tr("Re&vert Change %1").arg(change), this, SLOT(revertChange()));
|
this, &GitEditorWidget::cherryPickChange);
|
||||||
menu->addAction(tr("C&heckout Change %1").arg(change), this, SLOT(checkoutChange()));
|
connect(menu->addAction(tr("Re&vert Change %1").arg(change)), &QAction::triggered,
|
||||||
menu->addAction(tr("&Log for Change %1").arg(change), this, SLOT(logChange()));
|
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);
|
QMenu *resetMenu = new QMenu(tr("&Reset to Change %1").arg(change), menu);
|
||||||
connect(resetMenu->addAction(tr("&Hard")), &QAction::triggered,
|
connect(resetMenu->addAction(tr("&Hard")), &QAction::triggered,
|
||||||
this, [this]() { resetChange("hard"); });
|
this, [this]() { resetChange("hard"); });
|
||||||
|
@@ -206,7 +206,7 @@ ParameterAction *GitPlugin::createParameterAction(ActionContainer *ac,
|
|||||||
return action;
|
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,
|
QAction *GitPlugin::createFileAction(ActionContainer *ac,
|
||||||
const QString &defaultText, const QString ¶meterText,
|
const QString &defaultText, const QString ¶meterText,
|
||||||
Id id, const Context &context, bool addToLocator,
|
Id id, const Context &context, bool addToLocator,
|
||||||
@@ -241,7 +241,7 @@ QAction *GitPlugin::createProjectAction(ActionContainer *ac, const QString &defa
|
|||||||
return action;
|
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,
|
QAction *GitPlugin::createRepositoryAction(ActionContainer *ac, const QString &text, Id id,
|
||||||
const Context &context, bool addToLocator,
|
const Context &context, bool addToLocator,
|
||||||
const std::function<void()> &callback,
|
const std::function<void()> &callback,
|
||||||
@@ -270,7 +270,7 @@ QAction *GitPlugin::createRepositoryAction(ActionContainer *ac, const QString &t
|
|||||||
QTC_ASSERT(currentState().hasTopLevel(), return);
|
QTC_ASSERT(currentState().hasTopLevel(), return);
|
||||||
(m_gitClient->*func)(currentState().topLevel());
|
(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);
|
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();
|
IDocument *document = submitEditor->document();
|
||||||
document->setPreferredDisplayName(title);
|
document->setPreferredDisplayName(title);
|
||||||
VcsBasePlugin::setSource(document, m_submitRepository);
|
VcsBasePlugin::setSource(document, m_submitRepository);
|
||||||
connect(submitEditor, SIGNAL(diff(QStringList,QStringList)), this, SLOT(submitEditorDiff(QStringList,QStringList)));
|
connect(submitEditor, &GitSubmitEditor::diff, this, &GitPlugin::submitEditorDiff);
|
||||||
connect(submitEditor, SIGNAL(merge(QStringList)), this, SLOT(submitEditorMerge(QStringList)));
|
connect(submitEditor, &GitSubmitEditor::merge, this, &GitPlugin::submitEditorMerge);
|
||||||
connect(submitEditor, SIGNAL(show(QString,QString)), m_gitClient, SLOT(show(QString,QString)));
|
connect(submitEditor, &GitSubmitEditor::show,
|
||||||
|
m_gitClient, [this](const QString &wd, const QString &c) { m_gitClient->show(wd, c); });
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1036,7 +1037,7 @@ bool GitPlugin::submitEditorAboutToClose()
|
|||||||
if (editor->panelData().pushAction == NormalPush)
|
if (editor->panelData().pushAction == NormalPush)
|
||||||
m_gitClient->push(m_submitRepository);
|
m_gitClient->push(m_submitRepository);
|
||||||
else if (editor->panelData().pushAction == PushToGerrit)
|
else if (editor->panelData().pushAction == PushToGerrit)
|
||||||
connect(editor, SIGNAL(destroyed()), this, SLOT(delayedPushToGerrit()));
|
connect(editor, &QObject::destroyed, this, &GitPlugin::delayedPushToGerrit);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -96,7 +96,20 @@ public slots:
|
|||||||
void startCommit();
|
void startCommit();
|
||||||
void updateBranches(const QString &repository);
|
void updateBranches(const QString &repository);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
|
||||||
|
bool submitEditorAboutToClose() override;
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
private slots:
|
private slots:
|
||||||
|
void testStatusParsing_data();
|
||||||
|
void testStatusParsing();
|
||||||
|
void testDiffFileResolving_data();
|
||||||
|
void testDiffFileResolving();
|
||||||
|
void testLogResolving();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
void diffCurrentFile();
|
void diffCurrentFile();
|
||||||
void diffCurrentProject();
|
void diffCurrentProject();
|
||||||
void submitEditorDiff(const QStringList &unstaged, const QStringList &staged);
|
void submitEditorDiff(const QStringList &unstaged, const QStringList &staged);
|
||||||
@@ -138,21 +151,10 @@ private slots:
|
|||||||
void updateContinueAndAbortCommands();
|
void updateContinueAndAbortCommands();
|
||||||
void delayedPushToGerrit();
|
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,
|
Core::Command *createCommand(QAction *action, Core::ActionContainer *ac, Core::Id id,
|
||||||
const Core::Context &context, bool addToLocator,
|
const Core::Context &context, bool addToLocator,
|
||||||
const std::function<void()> &callback, const QKeySequence &keys);
|
const std::function<void()> &callback, const QKeySequence &keys);
|
||||||
|
|
||||||
Utils::ParameterAction *createParameterAction(Core::ActionContainer *ac,
|
Utils::ParameterAction *createParameterAction(Core::ActionContainer *ac,
|
||||||
const QString &defaultText, const QString ¶meterText,
|
const QString &defaultText, const QString ¶meterText,
|
||||||
Core::Id id, const Core::Context &context, bool addToLocator,
|
Core::Id id, const Core::Context &context, bool addToLocator,
|
||||||
|
@@ -132,9 +132,8 @@ GitSubmitEditor::GitSubmitEditor(const VcsBaseSubmitEditorParameters *parameters
|
|||||||
m_firstUpdate(true),
|
m_firstUpdate(true),
|
||||||
m_commitDataFetcher(0)
|
m_commitDataFetcher(0)
|
||||||
{
|
{
|
||||||
connect(this, &VcsBaseSubmitEditor::diffSelectedRows,
|
connect(this, &VcsBaseSubmitEditor::diffSelectedRows, this, &GitSubmitEditor::slotDiffSelected);
|
||||||
this, &GitSubmitEditor::slotDiffSelected);
|
connect(submitEditorWidget(), &GitSubmitEditorWidget::show, this, &GitSubmitEditor::showCommit);
|
||||||
connect(submitEditorWidget(), SIGNAL(show(QString)), this, SLOT(showCommit(QString)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GitSubmitEditor::~GitSubmitEditor()
|
GitSubmitEditor::~GitSubmitEditor()
|
||||||
@@ -156,8 +155,8 @@ void GitSubmitEditor::resetCommitDataFetcher()
|
|||||||
{
|
{
|
||||||
if (!m_commitDataFetcher)
|
if (!m_commitDataFetcher)
|
||||||
return;
|
return;
|
||||||
disconnect(m_commitDataFetcher, SIGNAL(finished(bool)), this, SLOT(commitDataRetrieved(bool)));
|
disconnect(m_commitDataFetcher, &CommitDataFetcher::finished, this, &GitSubmitEditor::commitDataRetrieved);
|
||||||
connect(m_commitDataFetcher, SIGNAL(finished(bool)), m_commitDataFetcher, SLOT(deleteLater()));
|
connect(m_commitDataFetcher, &CommitDataFetcher::finished, m_commitDataFetcher, &QObject::deleteLater);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitSubmitEditor::setCommitData(const CommitData &d)
|
void GitSubmitEditor::setCommitData(const CommitData &d)
|
||||||
@@ -264,7 +263,7 @@ void GitSubmitEditor::updateFileModel()
|
|||||||
w->setUpdateInProgress(true);
|
w->setUpdateInProgress(true);
|
||||||
resetCommitDataFetcher();
|
resetCommitDataFetcher();
|
||||||
m_commitDataFetcher = new CommitDataFetcher(m_commitType, m_workingDirectory);
|
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);
|
QFuture<void> future = QtConcurrent::run(m_commitDataFetcher, &CommitDataFetcher::start);
|
||||||
Core::ProgressManager::addTask(future, tr("Refreshing Commit Data"), TASK_UPDATE_COMMIT);
|
Core::ProgressManager::addTask(future, tr("Refreshing Commit Data"), TASK_UPDATE_COMMIT);
|
||||||
|
|
||||||
|
@@ -68,12 +68,11 @@ protected:
|
|||||||
QByteArray fileContents() const override;
|
QByteArray fileContents() const override;
|
||||||
void updateFileModel() override;
|
void updateFileModel() override;
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void slotDiffSelected(const QList<int> &rows);
|
void slotDiffSelected(const QList<int> &rows);
|
||||||
void showCommit(const QString &commit);
|
void showCommit(const QString &commit);
|
||||||
void commitDataRetrieved(bool success);
|
void commitDataRetrieved(bool success);
|
||||||
|
|
||||||
private:
|
|
||||||
inline GitSubmitEditorWidget *submitEditorWidget();
|
inline GitSubmitEditorWidget *submitEditorWidget();
|
||||||
inline const GitSubmitEditorWidget *submitEditorWidget() const;
|
inline const GitSubmitEditorWidget *submitEditorWidget() const;
|
||||||
void resetCommitDataFetcher();
|
void resetCommitDataFetcher();
|
||||||
|
@@ -108,8 +108,7 @@ void GitSubmitEditorWidget::initialize(CommitType commitType,
|
|||||||
logChangeGroupBox->setLayout(logChangeLayout);
|
logChangeGroupBox->setLayout(logChangeLayout);
|
||||||
m_logChangeWidget = new LogChangeWidget;
|
m_logChangeWidget = new LogChangeWidget;
|
||||||
m_logChangeWidget->init(repository);
|
m_logChangeWidget->init(repository);
|
||||||
connect(m_logChangeWidget, &LogChangeWidget::activated,
|
connect(m_logChangeWidget, &LogChangeWidget::commitActivated, this, &GitSubmitEditorWidget::show);
|
||||||
this, &GitSubmitEditorWidget::show);
|
|
||||||
logChangeLayout->addWidget(m_logChangeWidget);
|
logChangeLayout->addWidget(m_logChangeWidget);
|
||||||
insertLeftWidget(logChangeGroupBox);
|
insertLeftWidget(logChangeGroupBox);
|
||||||
m_gitSubmitPanelUi.editGroup->hide();
|
m_gitSubmitPanelUi.editGroup->hide();
|
||||||
@@ -121,9 +120,12 @@ void GitSubmitEditorWidget::initialize(CommitType commitType,
|
|||||||
|
|
||||||
if (enablePush) {
|
if (enablePush) {
|
||||||
auto menu = new QMenu(this);
|
auto menu = new QMenu(this);
|
||||||
menu->addAction(tr("&Commit only"), this, SLOT(commitOnlySlot()));
|
connect(menu->addAction(tr("&Commit only")), &QAction::triggered,
|
||||||
menu->addAction(tr("Commit and &Push"), this, SLOT(commitAndPushSlot()));
|
this, &GitSubmitEditorWidget::commitOnlySlot);
|
||||||
menu->addAction(tr("Commit and Push to &Gerrit"), this, SLOT(commitAndPushToGerritSlot()));
|
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);
|
addSubmitButtonMenu(menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -85,13 +85,12 @@ protected:
|
|||||||
signals:
|
signals:
|
||||||
void show(const QString &commit);
|
void show(const QString &commit);
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void authorInformationChanged();
|
void authorInformationChanged();
|
||||||
void commitOnlySlot();
|
void commitOnlySlot();
|
||||||
void commitAndPushSlot();
|
void commitAndPushSlot();
|
||||||
void commitAndPushToGerritSlot();
|
void commitAndPushToGerritSlot();
|
||||||
|
|
||||||
private:
|
|
||||||
bool emailIsValid() const;
|
bool emailIsValid() const;
|
||||||
void setPanelData(const GitSubmitEditorPanelData &data);
|
void setPanelData(const GitSubmitEditorPanelData &data);
|
||||||
void setPanelInfo(const GitSubmitEditorPanelInfo &info);
|
void setPanelInfo(const GitSubmitEditorPanelInfo &info);
|
||||||
|
@@ -73,7 +73,7 @@ LogChangeWidget::LogChangeWidget(QWidget *parent)
|
|||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
setActivationMode(Utils::DoubleClickActivation);
|
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)
|
bool LogChangeWidget::init(const QString &repository, const QString &commit, LogFlags flags)
|
||||||
@@ -120,12 +120,12 @@ void LogChangeWidget::setItemDelegate(QAbstractItemDelegate *delegate)
|
|||||||
m_hasCustomDelegate = true;
|
m_hasCustomDelegate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogChangeWidget::emitActivated(const QModelIndex &index)
|
void LogChangeWidget::emitCommitActivated(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
QString commit = index.sibling(index.row(), Sha1Column).data().toString();
|
QString commit = index.sibling(index.row(), Sha1Column).data().toString();
|
||||||
if (!commit.isEmpty())
|
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);
|
QPushButton *okButton = m_dialogButtonBox->addButton(QDialogButtonBox::Ok);
|
||||||
layout->addLayout(popUpLayout);
|
layout->addLayout(popUpLayout);
|
||||||
|
|
||||||
connect(m_dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
connect(m_dialogButtonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||||
connect(m_dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
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);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
resize(600, 400);
|
resize(600, 400);
|
||||||
|
@@ -72,12 +72,11 @@ public:
|
|||||||
void setItemDelegate(QAbstractItemDelegate *delegate);
|
void setItemDelegate(QAbstractItemDelegate *delegate);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void activated(const QString &commit);
|
void commitActivated(const QString &commit);
|
||||||
|
|
||||||
private slots:
|
|
||||||
void emitActivated(const QModelIndex &index);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void emitCommitActivated(const QModelIndex &index);
|
||||||
|
|
||||||
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
|
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
|
||||||
bool populateLog(const QString &repository, const QString &commit, LogFlags flags);
|
bool populateLog(const QString &repository, const QString &commit, LogFlags flags);
|
||||||
const QStandardItem *currentItem(int column = 0) const;
|
const QStandardItem *currentItem(int column = 0) const;
|
||||||
|
@@ -106,8 +106,8 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
|
|||||||
VcsOutputWindow::appendCommand(workingDirectory, binary, arguments);
|
VcsOutputWindow::appendCommand(workingDirectory, binary, arguments);
|
||||||
m_process->start(binary.toString(), arguments);
|
m_process->start(binary.toString(), arguments);
|
||||||
if (m_process->waitForStarted()) {
|
if (m_process->waitForStarted()) {
|
||||||
connect(m_process, SIGNAL(finished(int)), this, SLOT(done()));
|
connect(m_process, static_cast<void (QProcess::*)(int)>(&QProcess::finished), this, &MergeTool::done);
|
||||||
connect(m_process, SIGNAL(readyRead()), this, SLOT(readData()));
|
connect(m_process, &QIODevice::readyRead, this, &MergeTool::readData);
|
||||||
} else {
|
} else {
|
||||||
delete m_process;
|
delete m_process;
|
||||||
m_process = 0;
|
m_process = 0;
|
||||||
|
@@ -69,11 +69,10 @@ public:
|
|||||||
SymbolicLinkMerge
|
SymbolicLinkMerge
|
||||||
};
|
};
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void readData();
|
void readData();
|
||||||
void done();
|
void done();
|
||||||
|
|
||||||
private:
|
|
||||||
FileState waitAndReadStatus(QString &extraInfo);
|
FileState waitAndReadStatus(QString &extraInfo);
|
||||||
QString mergeTypeName();
|
QString mergeTypeName();
|
||||||
QString stateName(FileState state, const QString &extraInfo);
|
QString stateName(FileState state, const QString &extraInfo);
|
||||||
|
@@ -98,19 +98,14 @@ RemoteDialog::RemoteDialog(QWidget *parent) :
|
|||||||
m_ui->remoteView->setModel(m_remoteModel);
|
m_ui->remoteView->setModel(m_remoteModel);
|
||||||
new Utils::HeaderViewStretcher(m_ui->remoteView->header(), 1);
|
new Utils::HeaderViewStretcher(m_ui->remoteView->header(), 1);
|
||||||
|
|
||||||
connect(m_ui->addButton, &QPushButton::clicked,
|
connect(m_ui->addButton, &QPushButton::clicked, this, &RemoteDialog::addRemote);
|
||||||
this, &RemoteDialog::addRemote);
|
connect(m_ui->fetchButton, &QPushButton::clicked, this, &RemoteDialog::fetchFromRemote);
|
||||||
connect(m_ui->fetchButton, &QPushButton::clicked,
|
connect(m_ui->pushButton, &QPushButton::clicked, this, &RemoteDialog::pushToRemote);
|
||||||
this, &RemoteDialog::fetchFromRemote);
|
connect(m_ui->removeButton, &QPushButton::clicked, this, &RemoteDialog::removeRemote);
|
||||||
connect(m_ui->pushButton, &QPushButton::clicked,
|
connect(m_ui->refreshButton, &QPushButton::clicked, this, &RemoteDialog::refreshRemotes);
|
||||||
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)),
|
connect(m_ui->remoteView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||||
this, SLOT(updateButtonState()));
|
this, &RemoteDialog::updateButtonState);
|
||||||
|
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
@@ -80,6 +80,7 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void refresh(const QString &repository, bool force);
|
void refresh(const QString &repository, bool force);
|
||||||
|
|
||||||
|
private:
|
||||||
void refreshRemotes();
|
void refreshRemotes();
|
||||||
void addRemote();
|
void addRemote();
|
||||||
void removeRemote();
|
void removeRemote();
|
||||||
@@ -88,7 +89,6 @@ public slots:
|
|||||||
|
|
||||||
void updateButtonState();
|
void updateButtonState();
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::RemoteDialog *m_ui;
|
Ui::RemoteDialog *m_ui;
|
||||||
|
|
||||||
RemoteModel *m_remoteModel;
|
RemoteModel *m_remoteModel;
|
||||||
|
@@ -148,10 +148,10 @@ StashDialog::StashDialog(QWidget *parent) :
|
|||||||
ui->stashView->setUniformRowHeights(true);
|
ui->stashView->setUniformRowHeights(true);
|
||||||
connect(ui->filterLineEdit, &Utils::FancyLineEdit::filterChanged,
|
connect(ui->filterLineEdit, &Utils::FancyLineEdit::filterChanged,
|
||||||
m_proxyModel, &QSortFilterProxyModel::setFilterFixedString);
|
m_proxyModel, &QSortFilterProxyModel::setFilterFixedString);
|
||||||
connect(ui->stashView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
|
connect(ui->stashView->selectionModel(), &QItemSelectionModel::currentRowChanged,
|
||||||
this, SLOT(enableButtons()));
|
this, &StashDialog::enableButtons);
|
||||||
connect(ui->stashView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
connect(ui->stashView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||||
this, SLOT(enableButtons()));
|
this, &StashDialog::enableButtons);
|
||||||
connect(ui->stashView, &Utils::TreeView::activated,
|
connect(ui->stashView, &Utils::TreeView::activated,
|
||||||
this, &StashDialog::showCurrent);
|
this, &StashDialog::showCurrent);
|
||||||
ui->stashView->setFocus();
|
ui->stashView->setFocus();
|
||||||
|
@@ -63,15 +63,6 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void refresh(const QString &repository, bool force);
|
void refresh(const QString &repository, bool force);
|
||||||
|
|
||||||
private slots:
|
|
||||||
void deleteAll();
|
|
||||||
void deleteSelection();
|
|
||||||
void showCurrent();
|
|
||||||
void restoreCurrent();
|
|
||||||
void restoreCurrentInBranch();
|
|
||||||
void enableButtons();
|
|
||||||
void forceRefresh();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Prompt dialog for modified repositories. Ask to undo or stash away.
|
// Prompt dialog for modified repositories. Ask to undo or stash away.
|
||||||
enum ModifiedRepositoryAction {
|
enum ModifiedRepositoryAction {
|
||||||
@@ -80,6 +71,14 @@ private:
|
|||||||
ModifiedRepositoryDiscard
|
ModifiedRepositoryDiscard
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void deleteAll();
|
||||||
|
void deleteSelection();
|
||||||
|
void showCurrent();
|
||||||
|
void restoreCurrent();
|
||||||
|
void restoreCurrentInBranch();
|
||||||
|
void enableButtons();
|
||||||
|
void forceRefresh();
|
||||||
|
|
||||||
ModifiedRepositoryAction promptModifiedRepository(const QString &stash);
|
ModifiedRepositoryAction promptModifiedRepository(const QString &stash);
|
||||||
bool promptForRestore(QString *stash, QString *branch /* = 0 */, QString *errorMessage);
|
bool promptForRestore(QString *stash, QString *branch /* = 0 */, QString *errorMessage);
|
||||||
bool ask(const QString &title, const QString &what, bool defaultButton = true);
|
bool ask(const QString &title, const QString &what, bool defaultButton = true);
|
||||||
|
Reference in New Issue
Block a user