Git: Style fixes

Change-Id: I600e939e99de77e92de1ff068a5ebad98eb736ca
Reviewed-by: Petar Perisin <petar.perisin@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-06-10 19:49:18 +03:00
committed by Orgad Shaneh
parent 5cb29aec0b
commit 69d0d6cdca
13 changed files with 50 additions and 36 deletions

View File

@@ -34,8 +34,8 @@ namespace Git {
namespace Internal { namespace Internal {
BranchCheckoutDialog::BranchCheckoutDialog(QWidget *parent, BranchCheckoutDialog::BranchCheckoutDialog(QWidget *parent,
const QString& currentBranch, const QString &currentBranch,
const QString& nextBranch) : const QString &nextBranch) :
QDialog(parent), QDialog(parent),
m_ui(new Ui::BranchCheckoutDialog), m_ui(new Ui::BranchCheckoutDialog),
m_foundStashForNextBranch(false), m_foundStashForNextBranch(false),

View File

@@ -44,8 +44,8 @@ class BranchCheckoutDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit BranchCheckoutDialog(QWidget *parent, const QString& currentBranch, explicit BranchCheckoutDialog(QWidget *parent, const QString &currentBranch,
const QString& nextBranch); const QString &nextBranch);
~BranchCheckoutDialog(); ~BranchCheckoutDialog();
void foundNoLocalChanges(); void foundNoLocalChanges();

View File

@@ -136,8 +136,8 @@ bool CommitData::checkLine(const QString &stateInfo, const QString &file)
if (xState == UnknownFileState || yState == UnknownFileState) if (xState == UnknownFileState || yState == UnknownFileState)
return false; return false;
bool isMerge = (xState == UnmergedFile || yState == UnmergedFile || bool isMerge = (xState == UnmergedFile || yState == UnmergedFile
((xState == yState) && (xState == AddedFile || xState == DeletedFile))); || ((xState == yState) && (xState == AddedFile || xState == DeletedFile)));
if (isMerge) { if (isMerge) {
if (xState == yState) { if (xState == yState) {
if (xState == UnmergedFile) if (xState == UnmergedFile)

View File

@@ -2369,10 +2369,9 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR
{ {
QStringList arguments(QLatin1String("ls-remote")); QStringList arguments(QLatin1String("ls-remote"));
arguments << repositoryURL << QLatin1String(HEAD) << QLatin1String("refs/heads/*"); arguments << repositoryURL << QLatin1String(HEAD) << QLatin1String("refs/heads/*");
const unsigned flags = const unsigned flags = VcsBasePlugin::SshPasswordPrompt
VcsBasePlugin::SshPasswordPrompt| | VcsBasePlugin::SuppressStdErrInLogWindow
VcsBasePlugin::SuppressStdErrInLogWindow| | VcsBasePlugin::SuppressFailMessageInLogWindow;
VcsBasePlugin::SuppressFailMessageInLogWindow;
const Utils::SynchronousProcessResponse resp = synchronousGit(QString(), arguments, flags); const Utils::SynchronousProcessResponse resp = synchronousGit(QString(), arguments, flags);
QStringList branches; QStringList branches;
branches << tr("<Detached HEAD>"); branches << tr("<Detached HEAD>");
@@ -2780,7 +2779,7 @@ GitClient::RevertResult GitClient::revertI(QStringList files,
= QMessageBox::question(Core::ICore::mainWindow(), = QMessageBox::question(Core::ICore::mainWindow(),
tr("Revert"), tr("Revert"),
tr("The file has been changed. Do you want to revert it?"), tr("The file has been changed. Do you want to revert it?"),
QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes | QMessageBox::No,
QMessageBox::No); QMessageBox::No);
if (answer == QMessageBox::No) if (answer == QMessageBox::No)
return RevertCanceled; return RevertCanceled;
@@ -2832,7 +2831,8 @@ bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
const QString &abortCommand) const QString &abortCommand)
{ {
// Disable UNIX terminals to suppress SSH prompting. // Disable UNIX terminals to suppress SSH prompting.
const unsigned flags = VcsBasePlugin::SshPasswordPrompt | VcsBasePlugin::ShowStdOutInLogWindow const unsigned flags = VcsBasePlugin::SshPasswordPrompt
| VcsBasePlugin::ShowStdOutInLogWindow
| VcsBasePlugin::ExpectRepoChanges; | VcsBasePlugin::ExpectRepoChanges;
const Utils::SynchronousProcessResponse resp = synchronousGit(workingDirectory, arguments, flags); const Utils::SynchronousProcessResponse resp = synchronousGit(workingDirectory, arguments, flags);
ConflictHandler conflictHandler(0, workingDirectory, abortCommand); ConflictHandler conflictHandler(0, workingDirectory, abortCommand);
@@ -2936,8 +2936,9 @@ void GitClient::synchronousSubversionFetch(const QString &workingDirectory)
QStringList args; QStringList args;
args << QLatin1String("svn") << QLatin1String("fetch"); args << QLatin1String("svn") << QLatin1String("fetch");
// Disable UNIX terminals to suppress SSH prompting. // Disable UNIX terminals to suppress SSH prompting.
const unsigned flags = VcsBasePlugin::SshPasswordPrompt|VcsBasePlugin::ShowStdOutInLogWindow const unsigned flags = VcsBasePlugin::SshPasswordPrompt
|VcsBasePlugin::ShowSuccessMessage; | VcsBasePlugin::ShowStdOutInLogWindow
| VcsBasePlugin::ShowSuccessMessage;
synchronousGit(workingDirectory, args, flags); synchronousGit(workingDirectory, args, flags);
} }
@@ -3198,9 +3199,9 @@ QString GitClient::readConfigValue(const QString &workingDirectory, const QStrin
bool GitClient::cloneRepository(const QString &directory,const QByteArray &url) bool GitClient::cloneRepository(const QString &directory,const QByteArray &url)
{ {
QDir workingDirectory(directory); QDir workingDirectory(directory);
const unsigned flags = VcsBasePlugin::SshPasswordPrompt | const unsigned flags = VcsBasePlugin::SshPasswordPrompt
VcsBasePlugin::ShowStdOutInLogWindow| | VcsBasePlugin::ShowStdOutInLogWindow
VcsBasePlugin::ShowSuccessMessage; | VcsBasePlugin::ShowSuccessMessage;
if (workingDirectory.exists()) { if (workingDirectory.exists()) {
if (!synchronousInit(workingDirectory.path())) if (!synchronousInit(workingDirectory.path()))

View File

@@ -57,8 +57,8 @@ static QList<QStandardItem *> hostEntry(const QString &host,
int projectCount, int projectCount,
const QString &description, bool isDummyEntry) const QString &description, bool isDummyEntry)
{ {
const Qt::ItemFlags nonEditableFlags = (Qt::ItemIsSelectable|Qt::ItemIsEnabled); const Qt::ItemFlags nonEditableFlags = (Qt::ItemIsSelectable | Qt::ItemIsEnabled);
const Qt::ItemFlags editableFlags = nonEditableFlags|Qt::ItemIsEditable; const Qt::ItemFlags editableFlags = nonEditableFlags | Qt::ItemIsEditable;
QStandardItem *hostItem = new QStandardItem(host); QStandardItem *hostItem = new QStandardItem(host);
hostItem->setFlags(isDummyEntry ? editableFlags : nonEditableFlags); hostItem->setFlags(isDummyEntry ? editableFlags : nonEditableFlags);
// Empty for dummy, else "..." or count // Empty for dummy, else "..." or count
@@ -154,7 +154,10 @@ void GitoriousHostWidget::selectRow(int r)
{ {
if (r >= 0 && r != selectedRow()) { if (r >= 0 && r != selectedRow()) {
const QModelIndex index = m_model->index(r, 0); const QModelIndex index = m_model->index(r, 0);
ui->hostView->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Select|QItemSelectionModel::Current|QItemSelectionModel::Rows); ui->hostView->selectionModel()->setCurrentIndex(index,
QItemSelectionModel::Select
| QItemSelectionModel::Current
| QItemSelectionModel::Rows);
} }
} }

View File

@@ -100,7 +100,10 @@ GitoriousProjectWidget::GitoriousProjectWidget(int hostIndex,
ui->projectTreeView->resizeColumnToContents(r); ui->projectTreeView->resizeColumnToContents(r);
// Select first // Select first
const QModelIndex index = m_filterModel->index(0, 0); const QModelIndex index = m_filterModel->index(0, 0);
ui->projectTreeView->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Select|QItemSelectionModel::Current|QItemSelectionModel::Rows); ui->projectTreeView->selectionModel()->setCurrentIndex(index,
QItemSelectionModel::Select
| QItemSelectionModel::Current
| QItemSelectionModel::Rows);
} }
// Continuous update // Continuous update
@@ -175,10 +178,10 @@ static inline QList<QStandardItem *> projectEntry(const GitoriousProject &p)
name += QLatin1String("..."); name += QLatin1String("...");
} }
QStandardItem *nameItem = new QStandardItem(name); QStandardItem *nameItem = new QStandardItem(name);
nameItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); nameItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
// Description // Description
QStandardItem *descriptionItem = new QStandardItem; QStandardItem *descriptionItem = new QStandardItem;
descriptionItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); descriptionItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QList<QStandardItem *> rc; QList<QStandardItem *> rc;
rc << nameItem << descriptionItem; rc << nameItem << descriptionItem;
// Should the text contain an URL, store it under 'urlRole' for the info button // Should the text contain an URL, store it under 'urlRole' for the info button

View File

@@ -128,13 +128,13 @@ static inline QList<QStandardItem *> headerEntry(const QString &h)
static inline QList<QStandardItem *> repositoryEntry(const GitoriousRepository &r) static inline QList<QStandardItem *> repositoryEntry(const GitoriousRepository &r)
{ {
QStandardItem *nameItem = new QStandardItem(r.name); QStandardItem *nameItem = new QStandardItem(r.name);
nameItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); nameItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
nameItem->setData(QVariant(RepositoryType), TypeRole); nameItem->setData(QVariant(RepositoryType), TypeRole);
QStandardItem *ownerItem = new QStandardItem(r.owner); QStandardItem *ownerItem = new QStandardItem(r.owner);
ownerItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); ownerItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
ownerItem->setData(QVariant(RepositoryType), TypeRole); ownerItem->setData(QVariant(RepositoryType), TypeRole);
QStandardItem *descriptionItem = new QStandardItem; QStandardItem *descriptionItem = new QStandardItem;
descriptionItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); descriptionItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
descriptionItem->setData(QVariant(RepositoryType), TypeRole); descriptionItem->setData(QVariant(RepositoryType), TypeRole);
QList<QStandardItem *> rc; QList<QStandardItem *> rc;
rc << nameItem << ownerItem << descriptionItem; rc << nameItem << ownerItem << descriptionItem;
@@ -182,7 +182,10 @@ void GitoriousRepositoryWizardPage::initializePage()
// Select first // Select first
if (firstEntry) { if (firstEntry) {
const QModelIndex filterIndex = m_filterModel->mapFromSource(m_model->indexFromItem(firstEntry)); const QModelIndex filterIndex = m_filterModel->mapFromSource(m_model->indexFromItem(firstEntry));
ui->repositoryTreeView->selectionModel()->setCurrentIndex(filterIndex, QItemSelectionModel::Select|QItemSelectionModel::Current|QItemSelectionModel::Rows); ui->repositoryTreeView->selectionModel()->setCurrentIndex(filterIndex,
QItemSelectionModel::Select
| QItemSelectionModel::Current
| QItemSelectionModel::Rows);
} }
ui->repositoryTreeView->setFocus(); ui->repositoryTreeView->setFocus();
} }

View File

@@ -1285,7 +1285,7 @@ void GitPlugin::stashSnapshot()
const VcsBase::VcsBasePluginState state = currentState(); const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return); QTC_ASSERT(state.hasTopLevel(), return);
const QString id = m_gitClient->synchronousStash(state.topLevel(), QString(), const QString id = m_gitClient->synchronousStash(state.topLevel(), QString(),
GitClient::StashImmediateRestore|GitClient::StashPromptDescription); GitClient::StashImmediateRestore | GitClient::StashPromptDescription);
if (!id.isEmpty() && m_stashDialog) if (!id.isEmpty() && m_stashDialog)
m_stashDialog->refresh(state.topLevel(), true); m_stashDialog->refresh(state.topLevel(), true);
} }

View File

@@ -142,7 +142,8 @@ QString GitVersionControl::vcsCreateSnapshot(const QString &topLevel)
QString keyword = QLatin1String(stashMessageKeywordC) + QString::number(n++); QString keyword = QLatin1String(stashMessageKeywordC) + QString::number(n++);
const QString stashMessage = const QString stashMessage =
m_client->synchronousStash(topLevel, keyword, m_client->synchronousStash(topLevel, keyword,
GitClient::StashImmediateRestore|GitClient::StashIgnoreUnchanged, GitClient::StashImmediateRestore
| GitClient::StashIgnoreUnchanged,
&repositoryUnchanged); &repositoryUnchanged);
if (!stashMessage.isEmpty()) if (!stashMessage.isEmpty())
return stashMessage; return stashMessage;

View File

@@ -248,7 +248,8 @@ void MergeTool::readData()
} else if (m_merging && line.startsWith("Continue merging")) { } else if (m_merging && line.startsWith("Continue merging")) {
if (QMessageBox::question(0, tr("Continue Merging"), if (QMessageBox::question(0, tr("Continue Merging"),
tr("Continue merging other unresolved paths?"), tr("Continue merging other unresolved paths?"),
QMessageBox::Yes|QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) { QMessageBox::Yes | QMessageBox::No,
QMessageBox::No) == QMessageBox::Yes) {
m_process->write("y\n"); m_process->write("y\n");
} else { } else {
m_process->write("n\n"); m_process->write("n\n");

View File

@@ -159,7 +159,8 @@ void RemoteDialog::removeRemote()
const QString remoteName = m_remoteModel->remoteName(row); const QString remoteName = m_remoteModel->remoteName(row);
if (QMessageBox::question(this, tr("Delete Remote"), if (QMessageBox::question(this, tr("Delete Remote"),
tr("Would you like to delete the remote \"%1\"?").arg(remoteName), tr("Would you like to delete the remote \"%1\"?").arg(remoteName),
QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) { QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes) == QMessageBox::Yes) {
m_remoteModel->removeRemote(row); m_remoteModel->removeRemote(row);
} }
} }

View File

@@ -36,7 +36,7 @@ namespace Internal {
// ------ RemoteModel // ------ RemoteModel
RemoteModel::RemoteModel(GitClient *client, QObject *parent) : RemoteModel::RemoteModel(GitClient *client, QObject *parent) :
QAbstractTableModel(parent), QAbstractTableModel(parent),
m_flags(Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable), m_flags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable),
m_client(client) m_client(client)
{ } { }

View File

@@ -56,7 +56,7 @@ static inline GitClient *gitClient()
static inline QList<QStandardItem*> stashModelRowItems(const Stash &s) static inline QList<QStandardItem*> stashModelRowItems(const Stash &s)
{ {
Qt::ItemFlags itemFlags = Qt::ItemIsSelectable|Qt::ItemIsEnabled; Qt::ItemFlags itemFlags = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
QStandardItem *nameItem = new QStandardItem(s.name); QStandardItem *nameItem = new QStandardItem(s.name);
nameItem->setFlags(itemFlags); nameItem->setFlags(itemFlags);
QStandardItem *branchItem = new QStandardItem(s.branch); QStandardItem *branchItem = new QStandardItem(s.branch);
@@ -402,7 +402,8 @@ void StashDialog::warning(const QString &title, const QString &what, const QStri
bool StashDialog::ask(const QString &title, const QString &what, bool defaultButton) bool StashDialog::ask(const QString &title, const QString &what, bool defaultButton)
{ {
return QMessageBox::question(this, title, what, QMessageBox::Yes|QMessageBox::No, return QMessageBox::question(
this, title, what, QMessageBox::Yes | QMessageBox::No,
defaultButton ? QMessageBox::Yes : QMessageBox::No) == QMessageBox::Yes; defaultButton ? QMessageBox::Yes : QMessageBox::No) == QMessageBox::Yes;
} }