forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/master' into 4.8
Change-Id: I99d7e3aa727316db2e4909be6c0ea7583b90c816
This commit is contained in:
@@ -36,7 +36,7 @@ class GitAnnotationHighlighter : public VcsBase::BaseAnnotationHighlighter
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GitAnnotationHighlighter(const ChangeNumbers &changeNumbers,
|
||||
QTextDocument *document = 0);
|
||||
QTextDocument *document = nullptr);
|
||||
|
||||
private:
|
||||
QString changeNumber(const QString &block) const override;
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Internal {
|
||||
class BranchNameValidator : public QValidator
|
||||
{
|
||||
public:
|
||||
BranchNameValidator(const QStringList &localBranches, QObject *parent = 0) :
|
||||
BranchNameValidator(const QStringList &localBranches, QObject *parent = nullptr) :
|
||||
QValidator(parent),
|
||||
m_invalidChars(GitPlugin::invalidBranchAndRemoteNamePattern()),
|
||||
m_localBranches(localBranches)
|
||||
|
||||
@@ -33,9 +33,7 @@ BranchCheckoutDialog::BranchCheckoutDialog(QWidget *parent,
|
||||
const QString ¤tBranch,
|
||||
const QString &nextBranch) :
|
||||
QDialog(parent),
|
||||
m_ui(new Ui::BranchCheckoutDialog),
|
||||
m_foundStashForNextBranch(false),
|
||||
m_hasLocalChanges(true)
|
||||
m_ui(new Ui::BranchCheckoutDialog)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ private:
|
||||
void updatePopStashCheckBox(bool moveChangesChecked);
|
||||
|
||||
Ui::BranchCheckoutDialog *m_ui;
|
||||
bool m_foundStashForNextBranch;
|
||||
bool m_hasLocalChanges;
|
||||
bool m_foundStashForNextBranch = false;
|
||||
bool m_hasLocalChanges = true;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -122,8 +122,14 @@ void BranchView::refresh(const QString &repository, bool force)
|
||||
return;
|
||||
|
||||
m_repository = repository;
|
||||
m_repositoryLabel->setText(QDir::toNativeSeparators(m_repository));
|
||||
m_repositoryLabel->setToolTip(GitPlugin::msgRepositoryLabel(m_repository));
|
||||
if (m_repository.isEmpty()) {
|
||||
m_repositoryLabel->setText(tr("<No repository>"));
|
||||
m_branchView->setEnabled(false);
|
||||
} else {
|
||||
m_repositoryLabel->setText(QDir::toNativeSeparators(m_repository));
|
||||
m_repositoryLabel->setToolTip(GitPlugin::msgRepositoryLabel(m_repository));
|
||||
m_branchView->setEnabled(true);
|
||||
}
|
||||
QString errorMessage;
|
||||
if (!m_model->refresh(m_repository, &errorMessage))
|
||||
VcsBase::VcsOutputWindow::appendError(errorMessage);
|
||||
|
||||
@@ -204,7 +204,7 @@ void ChangeSelectionDialog::terminateProcess()
|
||||
m_process->kill();
|
||||
m_process->waitForFinished();
|
||||
delete m_process;
|
||||
m_process = 0;
|
||||
m_process = nullptr;
|
||||
}
|
||||
|
||||
void ChangeSelectionDialog::recalculateCompletion()
|
||||
|
||||
@@ -64,8 +64,6 @@ QString GitSubmitEditorPanelData::authorString() const
|
||||
|
||||
CommitData::CommitData(CommitType type)
|
||||
: commitType(type)
|
||||
, commitEncoding(0)
|
||||
, enablePush(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -105,10 +105,10 @@ public:
|
||||
|
||||
CommitType commitType;
|
||||
QString amendSHA1;
|
||||
QTextCodec *commitEncoding;
|
||||
QTextCodec *commitEncoding = nullptr;
|
||||
GitSubmitEditorPanelInfo panelInfo;
|
||||
GitSubmitEditorPanelData panelData;
|
||||
bool enablePush;
|
||||
bool enablePush = false;
|
||||
|
||||
QList<StateFilePair> files;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class AuthenticationDialog : public QDialog
|
||||
|
||||
public:
|
||||
AuthenticationDialog(GerritServer *server);
|
||||
~AuthenticationDialog();
|
||||
~AuthenticationDialog() override;
|
||||
bool isAuthenticated() const { return m_authenticated; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -69,7 +69,7 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
|
||||
m_ui->remoteComboBox->setParameters(m_parameters);
|
||||
m_ui->remoteComboBox->setFallbackEnabled(true);
|
||||
m_queryModel->setStringList(m_parameters->savedQueries);
|
||||
QCompleter *completer = new QCompleter(this);
|
||||
auto completer = new QCompleter(this);
|
||||
completer->setModel(m_queryModel);
|
||||
m_ui->queryLineEdit->setSpecialCompleter(completer);
|
||||
m_ui->queryLineEdit->setOkColor(Utils::creatorTheme()->color(Utils::Theme::TextColorNormal));
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
const QSharedPointer<GerritServer> &s,
|
||||
const QString &repository,
|
||||
QWidget *parent = nullptr);
|
||||
~GerritDialog();
|
||||
~GerritDialog() override;
|
||||
QString repositoryPath() const;
|
||||
void setCurrentPath(const QString &path);
|
||||
void fetchStarted(const QSharedPointer<Gerrit::Internal::GerritChange> &change);
|
||||
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
const GerritServer &server,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
~QueryContext();
|
||||
~QueryContext() override;
|
||||
void start();
|
||||
void terminate();
|
||||
|
||||
@@ -845,7 +845,7 @@ QList<QStandardItem *> GerritModel::changeToRow(const GerritChangePtr &c) const
|
||||
const QVariant filterV = QVariant(c->filterString());
|
||||
const QVariant changeV = qVariantFromValue(c);
|
||||
for (int i = 0; i < GerritModel::ColumnCount; ++i) {
|
||||
QStandardItem *item = new QStandardItem;
|
||||
auto item = new QStandardItem;
|
||||
item->setData(changeV, GerritModel::GerritChangeRole);
|
||||
item->setData(filterV, GerritModel::FilterRole);
|
||||
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
SortRole = Qt::UserRole + 3
|
||||
};
|
||||
GerritModel(const QSharedPointer<GerritParameters> &, QObject *parent = nullptr);
|
||||
~GerritModel();
|
||||
~GerritModel() override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ GerritOptionsWidget::GerritOptionsWidget(QWidget *parent)
|
||||
, m_portSpinBox(new QSpinBox(this))
|
||||
, m_httpsCheckBox(new QCheckBox(tr("HTTPS")))
|
||||
{
|
||||
QFormLayout *formLayout = new QFormLayout(this);
|
||||
auto formLayout = new QFormLayout(this);
|
||||
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
formLayout->addRow(tr("&Host:"), m_hostLineEdit);
|
||||
formLayout->addRow(tr("&User:"), m_userLineEdit);
|
||||
|
||||
@@ -67,7 +67,7 @@ class GerritOptionsPage : public VcsBase::VcsBaseOptionsPage
|
||||
|
||||
public:
|
||||
GerritOptionsPage(const QSharedPointer<GerritParameters> &p, QObject *parent = nullptr);
|
||||
~GerritOptionsPage();
|
||||
~GerritOptionsPage() override;
|
||||
|
||||
QWidget *widget() override;
|
||||
void apply() override;
|
||||
|
||||
@@ -99,8 +99,7 @@ void GerritParameters::setPortFlagBySshType()
|
||||
}
|
||||
|
||||
GerritParameters::GerritParameters()
|
||||
: https(true)
|
||||
, portFlag(defaultPortFlag)
|
||||
: portFlag(defaultPortFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
QString ssh;
|
||||
QString curl;
|
||||
QStringList savedQueries;
|
||||
bool https;
|
||||
bool https = true;
|
||||
QString portFlag;
|
||||
};
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
const QString &repository, const Utils::FileName &git,
|
||||
const GerritServer &server,
|
||||
FetchMode fm, QObject *parent = nullptr);
|
||||
~FetchContext();
|
||||
~FetchContext() override;
|
||||
void start();
|
||||
|
||||
private:
|
||||
@@ -467,8 +467,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
if (repository.isEmpty())
|
||||
return;
|
||||
|
||||
FetchContext *fc = new FetchContext(change, repository, git,
|
||||
*m_server, FetchMode(mode), this);
|
||||
auto fc = new FetchContext(change, repository, git, *m_server, FetchMode(mode), this);
|
||||
connect(fc, &QObject::destroyed, this, &GerritPlugin::fetchFinished);
|
||||
emit fetchStarted(change);
|
||||
fc->start();
|
||||
|
||||
@@ -53,7 +53,7 @@ class GerritPlugin : public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GerritPlugin(QObject *parent = nullptr);
|
||||
~GerritPlugin();
|
||||
~GerritPlugin() override;
|
||||
|
||||
bool initialize(Core::ActionContainer *ac);
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
|
||||
m_ui->remoteComboBox->setParameters(parameters);
|
||||
m_ui->remoteComboBox->setAllowDups(true);
|
||||
|
||||
PushItemDelegate *delegate = new PushItemDelegate(m_ui->commitView);
|
||||
auto delegate = new PushItemDelegate(m_ui->commitView);
|
||||
delegate->setParent(this);
|
||||
|
||||
initRemoteBranches();
|
||||
|
||||
@@ -48,7 +48,7 @@ class GerritPushDialog : public QDialog
|
||||
public:
|
||||
GerritPushDialog(const QString &workingDir, const QString &reviewerList,
|
||||
QSharedPointer<GerritParameters> parameters, QWidget *parent);
|
||||
~GerritPushDialog();
|
||||
~GerritPushDialog() override;
|
||||
|
||||
QString selectedCommit() const;
|
||||
QString selectedRemoteName() const;
|
||||
|
||||
@@ -139,7 +139,7 @@ static QString branchesDisplay(const QString &prefix, QStringList *branches, boo
|
||||
//: Displayed after the untranslated message "Branches: branch1, branch2 'and %n more'"
|
||||
// in git show.
|
||||
if (more > 0)
|
||||
output += ' ' + GitClient::tr("and %n more", 0, more);
|
||||
output += ' ' + GitClient::tr("and %n more", nullptr, more);
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ bool DescriptionWidgetDecorator::eventFilter(QObject *watched, QEvent *event)
|
||||
return QObject::eventFilter(watched, event);
|
||||
|
||||
if (event->type() == QEvent::MouseMove) {
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
auto mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->buttons())
|
||||
return QObject::eventFilter(watched, event);
|
||||
|
||||
@@ -207,7 +207,7 @@ bool DescriptionWidgetDecorator::eventFilter(QObject *watched, QEvent *event)
|
||||
textEditor->viewport()->setCursor(cursorShape);
|
||||
return ret;
|
||||
} else if (event->type() == QEvent::MouseButtonRelease) {
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
auto mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
|
||||
if (mouseEvent->button() == Qt::LeftButton && !(mouseEvent->modifiers() & Qt::ShiftModifier)) {
|
||||
const QTextCursor cursor = textEditor->cursorForPosition(mouseEvent->pos());
|
||||
@@ -588,6 +588,15 @@ public:
|
||||
tr("Ignore whitespace only changes.")),
|
||||
settings.boolPointer(GitSettings::ignoreSpaceChangesInBlameKey));
|
||||
|
||||
const QList<ComboBoxItem> logChoices = {
|
||||
ComboBoxItem(tr("No Move Detection"), ""),
|
||||
ComboBoxItem(tr("Detect Moves Within File"), "-M"),
|
||||
ComboBoxItem(tr("Detect Moves Between Files"), "-M -C"),
|
||||
ComboBoxItem(tr("Detect Moves and Copies Between Files"), "-M -C -C")
|
||||
};
|
||||
mapSetting(addComboBox({}, logChoices),
|
||||
settings.intPointer(GitSettings::blameMoveDetection));
|
||||
|
||||
addButton(tr("Reload"), Utils::Icons::RELOAD.icon());
|
||||
}
|
||||
};
|
||||
@@ -624,12 +633,12 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class ConflictHandler : public QObject
|
||||
class ConflictHandler final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static void attachToCommand(VcsCommand *command, const QString &abortCommand = QString()) {
|
||||
ConflictHandler *handler = new ConflictHandler(command->defaultWorkingDirectory(), abortCommand);
|
||||
auto handler = new ConflictHandler(command->defaultWorkingDirectory(), abortCommand);
|
||||
handler->setParent(command); // delete when command goes out of scope
|
||||
|
||||
command->addFlags(VcsCommand::ExpectRepoChanges);
|
||||
@@ -655,7 +664,7 @@ private:
|
||||
m_abortCommand(abortCommand)
|
||||
{ }
|
||||
|
||||
~ConflictHandler()
|
||||
~ConflictHandler() final
|
||||
{
|
||||
// If interactive rebase editor window is closed, plugin is terminated
|
||||
// but referenced here when the command ends
|
||||
@@ -1296,7 +1305,7 @@ bool GitClient::synchronousReset(const QString &workingDirectory,
|
||||
if (files.isEmpty()) {
|
||||
msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
|
||||
} else {
|
||||
msgCannotRun(tr("Cannot reset %n files in \"%1\": %2", 0, files.size())
|
||||
msgCannotRun(tr("Cannot reset %n files in \"%1\": %2", nullptr, files.size())
|
||||
.arg(QDir::toNativeSeparators(workingDirectory), resp.stdErr()),
|
||||
errorMessage);
|
||||
}
|
||||
@@ -2632,9 +2641,9 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
||||
static inline QString msgCommitted(const QString &amendSHA1, int fileCount)
|
||||
{
|
||||
if (amendSHA1.isEmpty())
|
||||
return GitClient::tr("Committed %n files.", 0, fileCount) + '\n';
|
||||
return GitClient::tr("Committed %n files.", nullptr, fileCount) + '\n';
|
||||
if (fileCount)
|
||||
return GitClient::tr("Amended \"%1\" (%n files).", 0, fileCount).arg(amendSHA1) + '\n';
|
||||
return GitClient::tr("Amended \"%1\" (%n files).", nullptr, fileCount).arg(amendSHA1) + '\n';
|
||||
return GitClient::tr("Amended \"%1\".").arg(amendSHA1);
|
||||
}
|
||||
|
||||
@@ -2725,7 +2734,7 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
|
||||
VcsOutputWindow::appendError(stdErr);
|
||||
return true;
|
||||
} else {
|
||||
VcsOutputWindow::appendError(tr("Cannot commit %n files: %1\n", 0, commitCount).arg(stdErr));
|
||||
VcsOutputWindow::appendError(tr("Cannot commit %n files: %1\n", nullptr, commitCount).arg(stdErr));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2863,7 +2872,7 @@ bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
|
||||
return resp.result == SynchronousProcessResponse::Finished;
|
||||
}
|
||||
|
||||
bool GitClient::synchronousPull(const QString &workingDirectory, bool rebase)
|
||||
void GitClient::pull(const QString &workingDirectory, bool rebase)
|
||||
{
|
||||
QString abortCommand;
|
||||
QStringList arguments = {"pull"};
|
||||
@@ -2874,12 +2883,10 @@ bool GitClient::synchronousPull(const QString &workingDirectory, bool rebase)
|
||||
abortCommand = "merge";
|
||||
}
|
||||
|
||||
bool ok = executeAndHandleConflicts(workingDirectory, arguments, abortCommand);
|
||||
|
||||
if (ok)
|
||||
updateSubmodulesIfNeeded(workingDirectory, true);
|
||||
|
||||
return ok;
|
||||
VcsCommand *command = vcsExecAbortable(workingDirectory, arguments, rebase);
|
||||
connect(command, &VcsCommand::success, this,
|
||||
[this, workingDirectory] { updateSubmodulesIfNeeded(workingDirectory, true); },
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void GitClient::synchronousAbortCommand(const QString &workingDir, const QString &abortCommand)
|
||||
@@ -3045,18 +3052,21 @@ void GitClient::revert(const QString &workingDirectory, const QString &argument)
|
||||
// Stashing is handled prior to this call.
|
||||
VcsCommand *GitClient::vcsExecAbortable(const QString &workingDirectory,
|
||||
const QStringList &arguments,
|
||||
bool createProgressParser)
|
||||
bool isRebase)
|
||||
{
|
||||
QTC_ASSERT(!arguments.isEmpty(), return nullptr);
|
||||
|
||||
QString abortCommand = arguments.at(0);
|
||||
// Git might request an editor, so this must be done asynchronously and without timeout
|
||||
VcsCommand *command = createCommand(workingDirectory, nullptr, VcsWindowOutputBind);
|
||||
command->setCookie(workingDirectory);
|
||||
command->addFlags(VcsCommand::ShowSuccessMessage);
|
||||
command->addJob(vcsBinary(), arguments, 0);
|
||||
command->addFlags(VcsCommand::SshPasswordPrompt
|
||||
| VcsCommand::ShowStdOut
|
||||
| VcsCommand::ShowSuccessMessage);
|
||||
// For rebase, Git might request an editor (which means the process keeps running until the
|
||||
// user closes it), so run without timeout.
|
||||
command->addJob(vcsBinary(), arguments, isRebase ? 0 : command->defaultTimeoutS());
|
||||
ConflictHandler::attachToCommand(command, abortCommand);
|
||||
if (createProgressParser)
|
||||
if (isRebase)
|
||||
GitProgressParser::attachToCommand(command);
|
||||
command->execute();
|
||||
|
||||
@@ -3240,9 +3250,9 @@ unsigned GitClient::synchronousGitVersion(QString *errorMessage) const
|
||||
QRegExp versionPattern("^[^\\d]+(\\d+)\\.(\\d+)\\.(\\d+|rc\\d).*$");
|
||||
QTC_ASSERT(versionPattern.isValid(), return 0);
|
||||
QTC_ASSERT(versionPattern.exactMatch(output), return 0);
|
||||
const unsigned majorV = versionPattern.cap(1).toUInt(0, 16);
|
||||
const unsigned minorV = versionPattern.cap(2).toUInt(0, 16);
|
||||
const unsigned patchV = versionPattern.cap(3).toUInt(0, 16);
|
||||
const unsigned majorV = versionPattern.cap(1).toUInt(nullptr, 16);
|
||||
const unsigned minorV = versionPattern.cap(2).toUInt(nullptr, 16);
|
||||
const unsigned patchV = versionPattern.cap(3).toUInt(nullptr, 16);
|
||||
return version(majorV, minorV, patchV);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
|
||||
VcsBase::VcsCommand *vcsExecAbortable(const QString &workingDirectory,
|
||||
const QStringList &arguments,
|
||||
bool createProgressParser = false);
|
||||
bool isRebase = false);
|
||||
|
||||
QString findRepositoryForDirectory(const QString &dir) const;
|
||||
QString findGitDirForRepository(const QString &repositoryDir) const;
|
||||
@@ -242,7 +242,7 @@ public:
|
||||
bool isFastForwardMerge(const QString &workingDirectory, const QString &branch);
|
||||
|
||||
void fetch(const QString &workingDirectory, const QString &remote);
|
||||
bool synchronousPull(const QString &workingDirectory, bool rebase);
|
||||
void pull(const QString &workingDirectory, bool rebase);
|
||||
void push(const QString &workingDirectory, const QStringList &pushArgs = QStringList());
|
||||
bool synchronousMerge(const QString &workingDirectory, const QString &branch,
|
||||
bool allowFastForward = true);
|
||||
|
||||
@@ -214,7 +214,7 @@ static bool isGitDirectory(const QString &path)
|
||||
{
|
||||
static IVersionControl *gitVc = VcsManager::versionControl(VcsBase::Constants::VCS_ID_GIT);
|
||||
QTC_ASSERT(gitVc, return false);
|
||||
return gitVc == VcsManager::findVersionControlForDirectory(path, 0);
|
||||
return gitVc == VcsManager::findVersionControlForDirectory(path, nullptr);
|
||||
}
|
||||
|
||||
GitGrep::GitGrep(QObject *parent)
|
||||
@@ -303,7 +303,8 @@ IEditor *GitGrep::openEditor(const SearchResultItem &item,
|
||||
if (content.isEmpty())
|
||||
return nullptr;
|
||||
QByteArray fileContent;
|
||||
if (TextFileFormat::readFileUTF8(path, 0, &fileContent, 0) == TextFileFormat::ReadSuccess) {
|
||||
if (TextFileFormat::readFileUTF8(path, nullptr, &fileContent, nullptr)
|
||||
== TextFileFormat::ReadSuccess) {
|
||||
if (fileContent == content)
|
||||
return nullptr; // open the file for read/write
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ GitSubmitHighlighter::GitSubmitHighlighter(QTextEdit * parent) :
|
||||
void GitSubmitHighlighter::highlightBlock(const QString &text)
|
||||
{
|
||||
// figure out current state
|
||||
State state = static_cast<State>(previousBlockState());
|
||||
auto state = static_cast<State>(previousBlockState());
|
||||
if (text.trimmed().isEmpty()) {
|
||||
if (state == Header)
|
||||
state = Other;
|
||||
|
||||
@@ -51,7 +51,7 @@ enum Format {
|
||||
class GitSubmitHighlighter : public TextEditor::SyntaxHighlighter
|
||||
{
|
||||
public:
|
||||
explicit GitSubmitHighlighter(QTextEdit *parent = 0);
|
||||
explicit GitSubmitHighlighter(QTextEdit *parent = nullptr);
|
||||
void highlightBlock(const QString &text) override;
|
||||
|
||||
private:
|
||||
@@ -65,7 +65,7 @@ private:
|
||||
class GitRebaseHighlighter : public TextEditor::SyntaxHighlighter
|
||||
{
|
||||
public:
|
||||
explicit GitRebaseHighlighter(QTextDocument *parent = 0);
|
||||
explicit GitRebaseHighlighter(QTextDocument *parent = nullptr);
|
||||
void highlightBlock(const QString &text) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -128,7 +128,7 @@ const VcsBaseEditorParameters editorParameters[] = {
|
||||
|
||||
// GitPlugin
|
||||
|
||||
static GitPlugin *m_instance = 0;
|
||||
static GitPlugin *m_instance = nullptr;
|
||||
|
||||
GitPlugin::GitPlugin()
|
||||
{
|
||||
@@ -142,7 +142,7 @@ GitPlugin::~GitPlugin()
|
||||
{
|
||||
cleanCommitMessageFile();
|
||||
delete m_gitClient;
|
||||
m_instance = 0;
|
||||
m_instance = nullptr;
|
||||
}
|
||||
|
||||
void GitPlugin::cleanCommitMessageFile()
|
||||
@@ -986,8 +986,8 @@ void GitPlugin::updateVersionWarning()
|
||||
IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &cd)
|
||||
{
|
||||
IEditor *editor = EditorManager::openEditor(fileName, Constants::GITSUBMITEDITOR_ID);
|
||||
GitSubmitEditor *submitEditor = qobject_cast<GitSubmitEditor*>(editor);
|
||||
QTC_ASSERT(submitEditor, return 0);
|
||||
auto submitEditor = qobject_cast<GitSubmitEditor*>(editor);
|
||||
QTC_ASSERT(submitEditor, return nullptr);
|
||||
setSubmitEditor(submitEditor);
|
||||
submitEditor->setCommitData(cd);
|
||||
submitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
|
||||
@@ -1020,7 +1020,7 @@ bool GitPlugin::submitEditorAboutToClose()
|
||||
{
|
||||
if (!isCommitEditorOpen())
|
||||
return true;
|
||||
GitSubmitEditor *editor = qobject_cast<GitSubmitEditor *>(submitEditor());
|
||||
auto editor = qobject_cast<GitSubmitEditor *>(submitEditor());
|
||||
QTC_ASSERT(editor, return true);
|
||||
IDocument *editorDocument = editor->document();
|
||||
QTC_ASSERT(editorDocument, return true);
|
||||
@@ -1052,7 +1052,7 @@ bool GitPlugin::submitEditorAboutToClose()
|
||||
|
||||
|
||||
// Go ahead!
|
||||
SubmitFileModel *model = qobject_cast<SubmitFileModel *>(editor->fileModel());
|
||||
auto model = qobject_cast<SubmitFileModel *>(editor->fileModel());
|
||||
CommitType commitType = editor->commitType();
|
||||
QString amendSHA1 = editor->amendSHA1();
|
||||
if (model->hasCheckedFiles() || !amendSHA1.isEmpty()) {
|
||||
@@ -1111,7 +1111,7 @@ void GitPlugin::pull()
|
||||
|
||||
if (!m_gitClient->beginStashScope(topLevel, "Pull", rebase ? Default : AllowUnstashed))
|
||||
return;
|
||||
m_gitClient->synchronousPull(topLevel, rebase);
|
||||
m_gitClient->pull(topLevel, rebase);
|
||||
}
|
||||
|
||||
void GitPlugin::push()
|
||||
|
||||
@@ -74,7 +74,7 @@ class GitPlugin : public VcsBase::VcsBasePlugin
|
||||
|
||||
public:
|
||||
GitPlugin();
|
||||
~GitPlugin();
|
||||
~GitPlugin() override;
|
||||
|
||||
static GitPlugin *instance();
|
||||
static GitClient *client();
|
||||
|
||||
@@ -37,6 +37,7 @@ const QLatin1String GitSettings::showTagsKey("ShowTags");
|
||||
const QLatin1String GitSettings::omitAnnotationDateKey("OmitAnnotationDate");
|
||||
const QLatin1String GitSettings::ignoreSpaceChangesInDiffKey("SpaceIgnorantDiff");
|
||||
const QLatin1String GitSettings::ignoreSpaceChangesInBlameKey("SpaceIgnorantBlame");
|
||||
const QLatin1String GitSettings::blameMoveDetection("BlameDetectMove");
|
||||
const QLatin1String GitSettings::diffPatienceKey("DiffPatience");
|
||||
const QLatin1String GitSettings::winSetHomeEnvironmentKey("WinSetHomeEnvironment");
|
||||
const QLatin1String GitSettings::gitkOptionsKey("GitKOptions");
|
||||
@@ -56,6 +57,7 @@ GitSettings::GitSettings()
|
||||
declareKey(showTagsKey, false);
|
||||
declareKey(omitAnnotationDateKey, false);
|
||||
declareKey(ignoreSpaceChangesInDiffKey, true);
|
||||
declareKey(blameMoveDetection, 0);
|
||||
declareKey(ignoreSpaceChangesInBlameKey, true);
|
||||
declareKey(diffPatienceKey, true);
|
||||
declareKey(winSetHomeEnvironmentKey, true);
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
static const QLatin1String omitAnnotationDateKey;
|
||||
static const QLatin1String ignoreSpaceChangesInDiffKey;
|
||||
static const QLatin1String ignoreSpaceChangesInBlameKey;
|
||||
static const QLatin1String blameMoveDetection;
|
||||
static const QLatin1String diffPatienceKey;
|
||||
static const QLatin1String winSetHomeEnvironmentKey;
|
||||
static const QLatin1String gitkOptionsKey;
|
||||
|
||||
@@ -51,13 +51,13 @@ namespace Internal {
|
||||
class GitSubmitFileModel : public SubmitFileModel
|
||||
{
|
||||
public:
|
||||
GitSubmitFileModel(QObject *parent = 0) : SubmitFileModel(parent)
|
||||
GitSubmitFileModel(QObject *parent = nullptr) : SubmitFileModel(parent)
|
||||
{ }
|
||||
|
||||
void updateSelections(SubmitFileModel *source) override
|
||||
{
|
||||
QTC_ASSERT(source, return);
|
||||
GitSubmitFileModel *gitSource = static_cast<GitSubmitFileModel *>(source);
|
||||
auto gitSource = static_cast<GitSubmitFileModel *>(source);
|
||||
int j = 0;
|
||||
for (int i = 0; i < rowCount() && j < source->rowCount(); ++i) {
|
||||
CommitData::StateFilePair stateFile = stateFilePair(i);
|
||||
|
||||
@@ -74,7 +74,7 @@ bool inputText(QWidget *parent, const QString &title, const QString &prompt, QSt
|
||||
dialog.setLabelText(prompt);
|
||||
dialog.setTextValue(*s);
|
||||
// Nasty hack:
|
||||
if (QLineEdit *le = dialog.findChild<QLineEdit*>())
|
||||
if (auto le = dialog.findChild<QLineEdit*>())
|
||||
le->setMinimumWidth(500);
|
||||
if (dialog.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
|
||||
@@ -159,7 +159,7 @@ bool LogChangeWidget::populateLog(const QString &repository, const QString &comm
|
||||
arguments << "--not" << "--remotes";
|
||||
arguments << "--";
|
||||
QString output;
|
||||
if (!GitPlugin::client()->synchronousLog(repository, arguments, &output, 0, VcsCommand::NoOutput))
|
||||
if (!GitPlugin::client()->synchronousLog(repository, arguments, &output, nullptr, VcsCommand::NoOutput))
|
||||
return false;
|
||||
const QStringList lines = output.split('\n');
|
||||
for (const QString &line : lines) {
|
||||
@@ -193,14 +193,13 @@ const QStandardItem *LogChangeWidget::currentItem(int column) const
|
||||
const QModelIndex currentIndex = selectionModel()->currentIndex();
|
||||
if (currentIndex.isValid())
|
||||
return m_model->item(currentIndex.row(), column);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) :
|
||||
QDialog(parent)
|
||||
, m_widget(new LogChangeWidget)
|
||||
, m_dialogButtonBox(new QDialogButtonBox(this))
|
||||
, m_resetTypeComboBox(0)
|
||||
{
|
||||
auto layout = new QVBoxLayout(this);
|
||||
layout->addWidget(new QLabel(isReset ? tr("Reset to:") : tr("Select change:"), this));
|
||||
|
||||
@@ -96,9 +96,9 @@ public:
|
||||
LogChangeWidget *widget() const;
|
||||
|
||||
private:
|
||||
LogChangeWidget *m_widget;
|
||||
QDialogButtonBox *m_dialogButtonBox;
|
||||
QComboBox *m_resetTypeComboBox;
|
||||
LogChangeWidget *m_widget = nullptr;
|
||||
QDialogButtonBox *m_dialogButtonBox = nullptr;
|
||||
QComboBox *m_resetTypeComboBox = nullptr;
|
||||
};
|
||||
|
||||
class LogItemDelegate : public QStyledItemDelegate
|
||||
|
||||
@@ -50,8 +50,8 @@ class MergeTool : public QObject
|
||||
};
|
||||
|
||||
public:
|
||||
explicit MergeTool(QObject *parent = 0);
|
||||
~MergeTool();
|
||||
explicit MergeTool(QObject *parent = nullptr);
|
||||
~MergeTool() override;
|
||||
bool start(const QString &workingDirectory, const QStringList &files = QStringList());
|
||||
|
||||
enum MergeType {
|
||||
|
||||
@@ -39,7 +39,7 @@ class RemoteDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RemoteDialog(QWidget *parent = 0);
|
||||
explicit RemoteDialog(QWidget *parent = nullptr);
|
||||
~RemoteDialog() override;
|
||||
|
||||
void refresh(const QString &repository, bool force);
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Internal {
|
||||
class RemoteModel : public QAbstractTableModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RemoteModel(QObject *parent = 0);
|
||||
explicit RemoteModel(QObject *parent = nullptr);
|
||||
|
||||
void clear();
|
||||
bool refresh(const QString &workingDirectory, QString *errorMessage);
|
||||
|
||||
@@ -120,7 +120,7 @@ void SettingsPage::apply()
|
||||
|
||||
if (widget()->isVisible()) {
|
||||
const VcsBaseClientSettings settings = widget()->settings();
|
||||
const GitSettings *rc = static_cast<const GitSettings *>(&settings);
|
||||
auto rc = static_cast<const GitSettings *>(&settings);
|
||||
bool gitFoundOk;
|
||||
QString errorMessage;
|
||||
rc->gitExecutable(&gitFoundOk, &errorMessage);
|
||||
|
||||
@@ -43,7 +43,7 @@ class SettingsPageWidget : public VcsBase::VcsClientOptionsPageWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SettingsPageWidget(QWidget *parent = 0);
|
||||
explicit SettingsPageWidget(QWidget *parent = nullptr);
|
||||
|
||||
VcsBase::VcsBaseClientSettings settings() const override;
|
||||
void setSettings(const VcsBase::VcsBaseClientSettings &s) override;
|
||||
|
||||
@@ -63,7 +63,7 @@ static inline QList<QStandardItem*> stashModelRowItems(const Stash &s)
|
||||
// ----------- StashModel
|
||||
class StashModel : public QStandardItemModel {
|
||||
public:
|
||||
explicit StashModel(QObject *parent = 0);
|
||||
explicit StashModel(QObject *parent = nullptr);
|
||||
|
||||
void setStashes(const QList<Stash> &stashes);
|
||||
const Stash &at(int i) { return m_stashes.at(i); }
|
||||
@@ -189,7 +189,7 @@ void StashDialog::deleteSelection()
|
||||
const QList<int> rows = selectedRows();
|
||||
QTC_ASSERT(!rows.isEmpty(), return);
|
||||
const QString title = tr("Delete Stashes");
|
||||
if (!ask(title, tr("Do you want to delete %n stash(es)?", 0, rows.size())))
|
||||
if (!ask(title, tr("Do you want to delete %n stash(es)?", nullptr, rows.size())))
|
||||
return;
|
||||
QString errorMessage;
|
||||
QStringList errors;
|
||||
@@ -267,7 +267,7 @@ bool StashDialog::promptForRestore(QString *stash,
|
||||
{
|
||||
const QString stashIn = *stash;
|
||||
bool modifiedPromptShown = false;
|
||||
switch (GitPlugin::client()->gitStatus(m_repository, StatusMode(NoUntracked | NoSubmodules), 0, errorMessage)) {
|
||||
switch (GitPlugin::client()->gitStatus(m_repository, StatusMode(NoUntracked | NoSubmodules), nullptr, errorMessage)) {
|
||||
case GitClient::StatusFailed:
|
||||
return false;
|
||||
case GitClient::StatusChanged: {
|
||||
@@ -317,7 +317,7 @@ void StashDialog::restoreCurrent()
|
||||
QString name = m_model->at(index).name;
|
||||
// Make sure repository is not modified, restore. The command will
|
||||
// output to window on success.
|
||||
if (promptForRestore(&name, 0, &errorMessage)
|
||||
if (promptForRestore(&name, nullptr, &errorMessage)
|
||||
&& GitPlugin::client()->synchronousStashRestore(m_repository, name)) {
|
||||
refresh(m_repository, true); // Might have stashed away local changes.
|
||||
} else if (!errorMessage.isEmpty()) {
|
||||
|
||||
@@ -48,7 +48,7 @@ class StashDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit StashDialog(QWidget *parent = 0);
|
||||
explicit StashDialog(QWidget *parent = nullptr);
|
||||
~StashDialog() override;
|
||||
|
||||
void refresh(const QString &repository, bool force);
|
||||
|
||||
Reference in New Issue
Block a user