Commit 2a548814 authored by hjk's avatar hjk

Mercurial: code cosmetics

Change-Id: Id7257fc5ccdcc4d36b276278906902f12d7e8c57
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@nokia.com>
parent 595f4ce2
......@@ -41,12 +41,13 @@
#include <vcsbase/vcsconfigurationpage.h>
using namespace Mercurial::Internal;
using namespace VcsBase;
CloneWizard::CloneWizard(QObject *parent)
: VcsBase::BaseCheckoutWizard(parent),
m_icon(QIcon(QLatin1String(":/mercurial/images/hg.png")))
: BaseCheckoutWizard(parent),
m_icon(QIcon(QLatin1String(":/mercurial/images/hg.png")))
{
setId(QLatin1String(VcsBase::Constants::VCS_ID_MERCURIAL));
setId(QLatin1String(Constants::VCS_ID_MERCURIAL));
}
QIcon CloneWizard::icon() const
......@@ -64,25 +65,25 @@ QString CloneWizard::displayName() const
return tr("Mercurial Clone");
}
QList<QWizardPage*> CloneWizard::createParameterPages(const QString &path)
QList<QWizardPage *> CloneWizard::createParameterPages(const QString &path)
{
QList<QWizardPage*> wizardPageList;
QList<QWizardPage *> wizardPageList;
const Core::IVersionControl *vc = MercurialPlugin::instance()->versionControl();
if (!vc->isConfigured())
wizardPageList.append(new VcsBase::VcsConfigurationPage(vc));
wizardPageList.append(new VcsConfigurationPage(vc));
CloneWizardPage *page = new CloneWizardPage;
page->setPath(path);
wizardPageList.append(page);
return wizardPageList;
}
QSharedPointer<VcsBase::AbstractCheckoutJob> CloneWizard::createJob(const QList<QWizardPage *> &parameterPages,
QString *checkoutPath)
QSharedPointer<AbstractCheckoutJob> CloneWizard::createJob(const QList<QWizardPage *> &parameterPages,
QString *checkoutPath)
{
const CloneWizardPage *page = qobject_cast<const CloneWizardPage *>(parameterPages.front());
if (!page)
return QSharedPointer<VcsBase::AbstractCheckoutJob>();
return QSharedPointer<AbstractCheckoutJob>();
const MercurialSettings &settings = MercurialPlugin::instance()->settings();
......@@ -92,7 +93,7 @@ QSharedPointer<VcsBase::AbstractCheckoutJob> CloneWizard::createJob(const QList<
QStringList args;
args << QLatin1String("clone") << page->repository() << directory;
*checkoutPath = path + QLatin1Char('/') + directory;
VcsBase::ProcessCheckoutJob *job = new VcsBase::ProcessCheckoutJob;
ProcessCheckoutJob *job = new ProcessCheckoutJob;
job->addStep(settings.stringValue(MercurialSettings::binaryPathKey), args, path);
return QSharedPointer<VcsBase::AbstractCheckoutJob>(job);
return QSharedPointer<AbstractCheckoutJob>(job);
}
......@@ -45,13 +45,13 @@ CloneWizardPage::CloneWizardPage(QWidget *parent)
QString CloneWizardPage::directoryFromRepository(const QString &repository) const
{
//mercurial repositories are generally of the form protocol://repositoryUrl/repository/
//we are just looking for repository.
// Mercurial repositories are generally of the form protocol://repositoryUrl/repository/
// We are just looking for repository.
const QChar slash = QLatin1Char('/');
QString repo = repository.trimmed();
if (repo.endsWith(slash))
repo.truncate(repo.size() - 1);
//Take the basename or the repository url
// Take the basename or the repository url.
return repo.mid(repo.lastIndexOf(slash) + 1);
}
......@@ -36,13 +36,13 @@
#include <vcsbase/submitfilemodel.h>
#include <QtCore/QDebug>
#include <QtCore/QDir> //TODO REMOVE WHEN BASE FILE CHANGES ARE PULLED
using namespace Mercurial::Internal;
using namespace VcsBase;
CommitEditor::CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters, QWidget *parent)
: VcsBase::VcsBaseSubmitEditor(parameters, new MercurialCommitWidget(parent)),
CommitEditor::CommitEditor(const VcsBaseSubmitEditorParameters *parameters, QWidget *parent)
: VcsBaseSubmitEditor(parameters, new MercurialCommitWidget(parent)),
fileModel(0)
{
setDisplayName(tr("Commit Editor"));
......@@ -55,7 +55,7 @@ MercurialCommitWidget *CommitEditor::commitWidget()
void CommitEditor::setFields(const QFileInfo &repositoryRoot, const QString &branch,
const QString &userName, const QString &email,
const QList<VcsBase::VcsBaseClient::StatusItem> &repoStatus)
const QList<VcsBaseClient::StatusItem> &repoStatus)
{
MercurialCommitWidget *mercurialWidget = commitWidget();
if (!mercurialWidget)
......@@ -63,23 +63,23 @@ void CommitEditor::setFields(const QFileInfo &repositoryRoot, const QString &bra
mercurialWidget->setFields(repositoryRoot.absoluteFilePath(), branch, userName, email);
fileModel = new VcsBase::SubmitFileModel(this);
fileModel = new SubmitFileModel(this);
//TODO Messy tidy this up
QStringList shouldTrack;
foreach (const VcsBase::VcsBaseClient::StatusItem &item, repoStatus) {
foreach (const VcsBaseClient::StatusItem &item, repoStatus) {
if (item.flags == QLatin1String("Untracked"))
shouldTrack.append(item.file);
else
fileModel->addFile(item.file, item.flags, false);
}
VcsBase::VcsBaseSubmitEditor::filterUntrackedFilesOfProject(repositoryRoot.absoluteFilePath(),
VcsBaseSubmitEditor::filterUntrackedFilesOfProject(repositoryRoot.absoluteFilePath(),
&shouldTrack);
foreach (const QString &track, shouldTrack) {
foreach (const VcsBase::VcsBaseClient::StatusItem &item, repoStatus) {
foreach (const VcsBaseClient::StatusItem &item, repoStatus) {
if (item.file == track)
fileModel->addFile(item.file, item.flags, false);
}
......
......@@ -30,8 +30,8 @@
**
**************************************************************************/
#ifndef CONSTANTS_H
#define CONSTANTS_H
#ifndef MERCURIAL_CONSTANTS_H
#define MERCURIAL_CONSTANTS_H
namespace Mercurial {
namespace Constants {
......@@ -40,14 +40,14 @@ enum { debug = 0 };
const char MECURIALREPO[] = ".hg";
const char MERCURIALDEFAULT[] = "hg";
//changeset identifiers
// Changeset identifiers
const char CHANGESETID12[] = " ([a-f0-9]{12,12}) "; //match 12 hex chars and capture
const char CHANGESETID40[] = " ([a-f0-9]{40,40}) ";
const char CHANGEIDEXACT12[] = "[a-f0-9]{12,12}"; //match 12 hex chars a
const char CHANGEIDEXACT40[] = "[a-f0-9]{40,40}";
const char DIFFIDENTIFIER[] = "^[-+]{3,3} [ab]{1,1}.*"; // match e.g. +++ b/filename
//BaseEditorParameters
// Base editor parameters
const char COMMANDLOG_ID[] = "Mercurial Command Log Editor";
const char COMMANDLOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial Command Log Editor");
const char COMMANDLOG[] = "Mercurial Command Log Editor";
......@@ -72,13 +72,12 @@ const char DIFFLOG[] = "Mercurial Diff Editor";
const char DIFFAPP[] = "text/x-patch";
const char DIFFEXT[] = "diff";
//SubmitEditorParameters
// Submit editor parameters
const char COMMIT_ID[] = "Mercurial Commit Log Editor";
const char COMMIT_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial Commit Log Editor");
const char COMMITMIMETYPE[] = "application/vnd.nokia.text.scs_mercurial_commitlog";
//menu items
//File menu actions
// File menu actions
const char ADD[] = "Mercurial.AddSingleFile";
const char DELETE[] = "Mercurial.DeleteSingleFile";
const char ANNOTATE[] = "Mercurial.Annotate";
......@@ -87,13 +86,13 @@ const char LOG[] = "Mercurial.LogSingleFile";
const char REVERT[] = "Mercurial.RevertSingleFile";
const char STATUS[] = "Mercurial.Status";
//directory menu Actions
// Directory menu actions
const char DIFFMULTI[] = "Mercurial.Action.DiffMulti";
const char REVERTMULTI[] = "Mercurial.Action.RevertMulti";
const char STATUSMULTI[] = "Mercurial.Action.StatusMulti";
const char LOGMULTI[] = "Mercurial.Action.Logmulti";
//repository menu actions
// Repository menu actions
const char PULL[] = "Mercurial.Action.Pull";
const char PUSH[] = "Mercurial.Action.Push";
const char UPDATE[] = "Mercurial.Action.Update";
......@@ -103,10 +102,10 @@ const char OUTGOING[] = "Mercurial.Action.Outgoing";
const char COMMIT[] = "Mercurial.Action.Commit";
const char CREATE_REPOSITORY[] = "Mercurial.Action.CreateRepository";
//submit editor actions
// Submit editor actions
const char DIFFEDITOR[] = "Mercurial.Action.Editor.Diff";
} // namespace Constants
} // namespace mercurial
#endif // CONSTANTS_H
#endif // MERCURIAL_CONSTANTS_H
......@@ -72,7 +72,7 @@ private:
const QChar m_hashChar;
};
MercurialSubmitHighlighter::MercurialSubmitHighlighter(QTextEdit * parent) :
MercurialSubmitHighlighter::MercurialSubmitHighlighter(QTextEdit *parent) :
QSyntaxHighlighter(parent),
m_commentFormat(commentFormat()),
m_keywordPattern(QLatin1String("^\\w+:")),
......
......@@ -44,7 +44,7 @@
using namespace Mercurial::Internal;
MercurialControl::MercurialControl(MercurialClient *client)
: mercurialClient(client)
: mercurialClient(client)
{
}
......
......@@ -44,11 +44,12 @@ namespace Internal {
class MercurialClient;
//Implements just the basics of the Version Control Interface
//MercurialClient handles all the work
// Implements just the basics of the Version Control Interface
// MercurialClient handles all the work.
class MercurialControl: public Core::IVersionControl
{
Q_OBJECT
public:
explicit MercurialControl(MercurialClient *mercurialClient);
......@@ -82,7 +83,7 @@ private:
MercurialClient *mercurialClient;
};
} //namespace Internal
} //namespace Mercurial
} // namespace Internal
} // namespace Mercurial
#endif // MERCURIALCONTROL_H
......@@ -133,4 +133,3 @@ QStringList MercurialEditor::annotationPreviousVersions(const QString &revision)
return QStringList();
return descriptions;
}
......@@ -63,4 +63,5 @@ private:
} // namespace Internal
} // namespace Mercurial
#endif // MERCURIALEDITOR_H
This diff is collapsed.
......@@ -39,36 +39,22 @@
#include <vcsbase/vcsbaseplugin.h>
#include <coreplugin/icontext.h>
#include <QtCore/QFileInfo>
#include <QtCore/QHash>
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
class QAction;
class QTemporaryFile;
QT_END_NAMESPACE
namespace Core {
class ActionManager;
class ActionContainer;
class ActionManager;
class ICore;
class Id;
class IVersionControl;
class IEditorFactory;
class IEditor;
} // namespace Core
namespace Utils {
class ParameterAction;
} //namespace Utils
namespace VcsBase {
class VcsBaseSubmitEditor;
}
namespace Locator {
class CommandLocator;
}
namespace Utils { class ParameterAction; }
namespace VcsBase { class VcsBaseSubmitEditor; }
namespace Locator { class CommandLocator; }
namespace Mercurial {
namespace Internal {
......@@ -95,7 +81,7 @@ public:
void setSettings(const MercurialSettings &settings);
private slots:
// File menu action Slots
// File menu action slots
void addCurrentFile();
void annotateCurrentFile();
void diffCurrentFile();
......@@ -103,13 +89,13 @@ private slots:
void revertCurrentFile();
void statusCurrentFile();
//Directory menu Action slots
// Directory menu action slots
void diffRepository();
void logRepository();
void revertMulti();
void statusMulti();
//repository menu action slots
// Repository menu action slots
void pull();
void push();
void update();
......@@ -140,7 +126,6 @@ protected:
virtual bool submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submitEditor);
private:
//methods
void createMenu();
void createSubmitEditorActions();
void createSeparator(const Core::Context &context, const Core::Id &id);
......@@ -151,7 +136,7 @@ private:
void createLessUsedActions(const Core::Context &context);
void deleteCommitLog();
//Variables
// Variables
static MercurialPlugin *m_instance;
MercurialSettings mercurialSettings;
OptionsPage *optionsPage;
......@@ -165,7 +150,7 @@ private:
QList<QAction *> m_repositoryActionList;
QTemporaryFile *changeLog;
//Menu Items (file actions)
// Menu items (file actions)
Utils::ParameterAction *m_addAction;
Utils::ParameterAction *m_deleteAction;
Utils::ParameterAction *annotateFile;
......@@ -176,7 +161,7 @@ private:
Utils::ParameterAction *statusFile;
QAction *m_createRepositoryAction;
//submit editor actions
// Submit editor actions
QAction *editorCommit;
QAction *editorDiff;
QAction *editorUndo;
......@@ -186,7 +171,7 @@ private:
QString m_submitRepository;
};
} //namespace Internal
} //namespace Mercurial
} // namespace Internal
} // namespace Mercurial
#endif // MERCURIALPLUGIN_H
......@@ -38,16 +38,17 @@
namespace Mercurial {
namespace Internal {
const QLatin1String MercurialSettings::diffIgnoreWhiteSpaceKey("diffIgnoreWhiteSpace");
const QLatin1String MercurialSettings::diffIgnoreBlankLinesKey("diffIgnoreBlankLines");
const QLatin1String MercurialSettings::diffIgnoreWhiteSpaceKey("diffIgnoreWhiteSpace");
const QLatin1String MercurialSettings::diffIgnoreBlankLinesKey("diffIgnoreBlankLines");
MercurialSettings::MercurialSettings()
{
setSettingsGroup(QLatin1String("Mercurial"));
// Override default binary path
declareKey(binaryPathKey, QLatin1String(Constants::MERCURIALDEFAULT));
declareKey(diffIgnoreWhiteSpaceKey, false);
declareKey(diffIgnoreBlankLinesKey, false);
}
MercurialSettings::MercurialSettings()
{
setSettingsGroup(QLatin1String("Mercurial"));
// Override default binary path
declareKey(binaryPathKey, QLatin1String(Constants::MERCURIALDEFAULT));
declareKey(diffIgnoreWhiteSpaceKey, false);
declareKey(diffIgnoreBlankLinesKey, false);
}
} // namespace Internal
} // namespace Mercurial
......@@ -30,20 +30,20 @@
**
**************************************************************************/
#ifndef REVERTDIALOG_H
#define REVERTDIALOG_H
#ifndef MERCURIAL_REVERTDIALOG_H
#define MERCURIAL_REVERTDIALOG_H
#include "ui_revertdialog.h"
#include <QtGui/QDialog>
namespace Mercurial {
namespace Internal {
class RevertDialog : public QDialog
{
Q_OBJECT
public:
RevertDialog(QWidget *parent = 0);
~RevertDialog();
......@@ -59,4 +59,5 @@ private:
} // namespace Internal
} // namespace Mercurial
#endif // REVERTDIALOG_H
#endif // MERCURIAL_REVERTDIALOG_H
......@@ -58,10 +58,9 @@ QString SrcDestDialog::getRepositoryString() const
{
if (m_ui->defaultButton->isChecked())
return QString();
else if (m_ui->localButton->isChecked())
if (m_ui->localButton->isChecked())
return m_ui->localPathChooser->path();
else
return m_ui->urlLineEdit->text();
return m_ui->urlLineEdit->text();
}
void SrcDestDialog::changeEvent(QEvent *e)
......
......@@ -33,21 +33,19 @@
#ifndef SRCDESTDIALOG_H
#define SRCDESTDIALOG_H
#include <QtGui/QDialog>
#include <utils/pathchooser.h>
#include <QtGui/QDialog>
namespace Mercurial {
namespace Internal {
namespace Ui {
class SrcDestDialog;
}
namespace Ui { class SrcDestDialog; }
class SrcDestDialog : public QDialog
{
Q_OBJECT
public:
public:
SrcDestDialog(QWidget *parent = 0);
~SrcDestDialog();
void setPathChooserKind(Utils::PathChooser::Kind kind);
......@@ -62,4 +60,5 @@ private:
} // namespace Internal
} // namespace Mercurial
#endif // SRCDESTDIALOG_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment