Commit 2eadc220 authored by hjk's avatar hjk

vcsbase: style

Change-Id: I139d9d46605383f03215c80bd9e9fd965021b435
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@nokia.com>
parent bf197d7a
......@@ -58,7 +58,8 @@ typedef QMap<QString, QTextCharFormat> ChangeNumberFormatMap;
namespace VCSBase {
namespace Internal {
class BaseAnnotationHighlighterPrivate {
class BaseAnnotationHighlighterPrivate
{
public:
ChangeNumberFormatMap m_changeNumberMap;
};
......
......@@ -195,9 +195,9 @@ QString BaseCheckoutWizard::openProject(const QString &path, QString *errorMessa
return QString();
// Open. Do not use a busy cursor here as additional wizards might pop up
const QString projectFile = projectFiles.front().absoluteFilePath();
if (!pe->openProject(projectFile, errorMessage)) {
if (!pe->openProject(projectFile, errorMessage))
return QString();
}
return projectFile;
}
......
......@@ -56,12 +56,12 @@ protected:
explicit BaseVCSSubmitEditorFactory(const VCSBaseSubmitEditorParameters *parameters);
public:
virtual ~BaseVCSSubmitEditorFactory();
~BaseVCSSubmitEditorFactory();
virtual Core::IEditor *createEditor(QWidget *parent);
virtual Core::Id id() const;
virtual QString displayName() const;
virtual QStringList mimeTypes() const;
Core::IEditor *createEditor(QWidget *parent);
Core::Id id() const;
QString displayName() const;
QStringList mimeTypes() const;
Core::IFile *open(const QString &fileName);
private:
......@@ -79,27 +79,19 @@ template <class Editor>
class VCSSubmitEditorFactory : public BaseVCSSubmitEditorFactory
{
public:
explicit VCSSubmitEditorFactory(const VCSBaseSubmitEditorParameters *parameters);
explicit VCSSubmitEditorFactory(const VCSBaseSubmitEditorParameters *parameters)
: BaseVCSSubmitEditorFactory(parameters)
{
}
private:
virtual VCSBaseSubmitEditor
*createBaseSubmitEditor(const VCSBaseSubmitEditorParameters *parameters,
QWidget *parent);
VCSBaseSubmitEditor *createBaseSubmitEditor
(const VCSBaseSubmitEditorParameters *parameters, QWidget *parent)
{
return new Editor(parameters, parent);
}
};
template <class Editor>
VCSSubmitEditorFactory<Editor>::VCSSubmitEditorFactory(const VCSBaseSubmitEditorParameters *parameters) :
BaseVCSSubmitEditorFactory(parameters)
{
}
template <class Editor>
VCSBaseSubmitEditor *VCSSubmitEditorFactory<Editor>::createBaseSubmitEditor(const VCSBaseSubmitEditorParameters *parameters,
QWidget *parent)
{
return new Editor(parameters, parent);
}
} // namespace VCSBase
#endif // VCSBASE_BASEEDITOR_H
......@@ -40,16 +40,9 @@
#include <QtCore/QProcess>
#include <QtCore/QProcessEnvironment>
QT_BEGIN_NAMESPACE
class QStringList;
class QByteArray;
QT_END_NAMESPACE
namespace VCSBase {
namespace Internal {
class ProcessCheckoutJobPrivate;
} // namespace Internal
namespace Internal { class ProcessCheckoutJobPrivate; }
/* Abstract base class for a job creating an initial project checkout.
* It should be something that runs in the background producing log
......@@ -58,6 +51,7 @@ class ProcessCheckoutJobPrivate;
class VCSBASE_EXPORT AbstractCheckoutJob : public QObject
{
Q_OBJECT
public:
virtual void start() = 0;
virtual void cancel() = 0;
......@@ -74,17 +68,18 @@ signals:
class VCSBASE_EXPORT ProcessCheckoutJob : public AbstractCheckoutJob
{
Q_OBJECT
public:
explicit ProcessCheckoutJob(QObject *parent = 0);
virtual ~ProcessCheckoutJob();
~ProcessCheckoutJob();
void addStep(const QString &binary,
const QStringList &args,
const QString &workingDirectory = QString(),
const QProcessEnvironment &env = QProcessEnvironment::systemEnvironment());
virtual void start();
virtual void cancel();
void start();
void cancel();
private slots:
void slotError(QProcess::ProcessError error);
......
......@@ -41,9 +41,7 @@ class AbstractCheckoutJob;
namespace Internal {
namespace Ui {
class CheckoutProgressWizardPage;
}
namespace Ui { class CheckoutProgressWizardPage; }
class CheckoutProgressWizardPage : public QWizardPage
{
......@@ -81,4 +79,5 @@ private:
} // namespace Internal
} // namespace VCSBase
#endif // CHECKOUTPROGRESSWIZARDPAGE_H
......@@ -88,11 +88,10 @@ void CheckoutWizardDialog::start(const QSharedPointer<AbstractCheckoutJob> &job)
void CheckoutWizardDialog::reject()
{
// First click kills, 2nd closes
if (currentId() == m_progressPageId && m_progressPage->isRunning()) {
if (currentId() == m_progressPageId && m_progressPage->isRunning())
m_progressPage->terminate();
} else {
else
QWizard::reject();
}
}
} // namespace Internal
......
......@@ -43,8 +43,10 @@ class AbstractCheckoutJob;
namespace Internal {
class CheckoutProgressWizardPage;
class CheckoutWizardDialog : public Utils::Wizard {
class CheckoutWizardDialog : public Utils::Wizard
{
Q_OBJECT
public:
explicit CheckoutWizardDialog(const QList<QWizardPage *> &parameterPages,
QWidget *parent = 0);
......@@ -66,4 +68,5 @@ private:
} // namespace Internal
} // namespace VCSBase
#endif // CHECKOUTWIZARDDIALOG_H
......@@ -85,7 +85,8 @@ static void removeFileRecursion(const QFileInfo &f, QString *errorMessage)
// A QFuture task for cleaning files in the background.
// Emits error signal if not all files can be deleted.
class CleanFilesTask : public QObject {
class CleanFilesTask : public QObject
{
Q_OBJECT
public:
......@@ -136,7 +137,8 @@ public:
QString m_workingDirectory;
};
CleanDialogPrivate::CleanDialogPrivate() : m_filesModel(new QStandardItemModel(0, columnCount))
CleanDialogPrivate::CleanDialogPrivate() :
m_filesModel(new QStandardItemModel(0, columnCount))
{
}
......@@ -195,7 +197,7 @@ void CleanDialog::setFileList(const QString &workingDirectory, const QStringList
const QString qmlProUserSuffix = QLatin1String(".qmlproject.user");
const QChar slash = QLatin1Char('/');
// Do not initially check patches or 'pro.user' files for deletion.
foreach(const QString &fileName, l) {
foreach (const QString &fileName, l) {
const QFileInfo fi(workingDirectory + slash + fileName);
const bool isDir = fi.isDir();
QStandardItem *nameItem = new QStandardItem(QDir::toNativeSeparators(fileName));
......
......@@ -43,20 +43,20 @@ QT_END_NAMESPACE
namespace VCSBase {
namespace Internal {
class CleanDialogPrivate;
} // namespace Internal
namespace Internal { class CleanDialogPrivate; }
class VCSBASE_EXPORT CleanDialog : public QDialog {
class VCSBASE_EXPORT CleanDialog : public QDialog
{
Q_OBJECT
public:
explicit CleanDialog(QWidget *parent = 0);
virtual ~CleanDialog();
~CleanDialog();
void setFileList(const QString &workingDirectory, const QStringList &);
public slots:
virtual void accept();
void accept();
protected:
void changeEvent(QEvent *e);
......@@ -72,4 +72,5 @@ private:
};
} // namespace VCSBase
#endif // CLEANDIALOG_H
......@@ -42,9 +42,7 @@
namespace VCSBase {
namespace Internal {
class CommandPrivate;
} // namespace Internal
namespace Internal { class CommandPrivate; }
class VCSBASE_EXPORT Command : public QObject
{
......@@ -52,9 +50,12 @@ class VCSBASE_EXPORT Command : public QObject
public:
// Where to report command termination with exit code if desired
enum TerminationReportMode { NoReport,
ReportStdout, // This assumes UTF8
ReportStderr };
enum TerminationReportMode
{
NoReport,
ReportStdout, // This assumes UTF8
ReportStderr
};
Command(const QString &binary,
const QString &workingDirectory,
......@@ -104,6 +105,6 @@ private:
class Internal::CommandPrivate *const d;
};
} //namespace VCSBase
} // namespace VCSBase
#endif // VCSBASE_COMMAND_H
......@@ -116,10 +116,6 @@ void CommonOptionsPage::updateNickNames()
{
}
CommonOptionsPage::~CommonOptionsPage()
{
}
QString CommonOptionsPage::id() const
{
return QLatin1String(Constants::VCS_COMMON_SETTINGS_ID);
......
......@@ -51,7 +51,7 @@ class CommonSettingsWidget : public QWidget
public:
explicit CommonSettingsWidget(QWidget *parent = 0);
virtual ~CommonSettingsWidget();
~CommonSettingsWidget();
CommonVcsSettings settings() const;
void setSettings(const CommonVcsSettings &s);
......@@ -68,15 +68,14 @@ class CommonOptionsPage : public VCSBaseOptionsPage
public:
explicit CommonOptionsPage(QObject *parent = 0);
virtual ~CommonOptionsPage();
virtual QString id() const;
virtual QString displayName() const;
QString id() const;
QString displayName() const;
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
virtual void finish() { }
virtual bool matches(const QString &key) const;
QWidget *createPage(QWidget *parent);
void apply();
void finish() { }
bool matches(const QString &key) const;
CommonVcsSettings settings() const { return m_settings; }
......
......@@ -61,5 +61,5 @@ bool CoreListener::editorAboutToClose(Core::IEditor *editor)
return result;
}
}
}
} // namespace Internal
} // namespace VCSBase
......@@ -44,9 +44,10 @@ namespace Internal {
class CoreListener : public Core::ICoreListener
{
Q_OBJECT
public:
explicit CoreListener(QObject *parent = 0);
virtual bool editorAboutToClose(Core::IEditor *editor);
bool editorAboutToClose(Core::IEditor *editor);
signals:
void submitEditorAboutToClose(VCSBaseSubmitEditor *e, bool *result);
......@@ -54,4 +55,5 @@ signals:
} // Internal
} // VCSBase
#endif // CORELISTENER_H
......@@ -88,10 +88,12 @@ enum FoldingState {
};
// --- DiffHighlighterPrivate
class DiffHighlighterPrivate {
class DiffHighlighterPrivate
{
public:
DiffHighlighterPrivate(const QRegExp &filePattern);
inline DiffFormats analyzeLine(const QString &block) const;
DiffFormats analyzeLine(const QString &block) const;
const QRegExp m_filePattern;
const QString m_locationIndicator;
......
......@@ -42,28 +42,23 @@ class QRegExp;
class QTextCharFormat;
QT_END_NAMESPACE
namespace Core {
class ICore;
}
namespace TextEditor {
class FontSettingsPage;
}
namespace Core { class ICore; }
namespace TextEditor { class FontSettingsPage; }
namespace VCSBase {
namespace Internal {
class DiffHighlighterPrivate;
} // namespace Internal
namespace Internal { class DiffHighlighterPrivate; }
class VCSBASE_EXPORT DiffHighlighter : public TextEditor::SyntaxHighlighter
{
Q_OBJECT
public:
explicit DiffHighlighter(const QRegExp &filePattern,
QTextDocument *document = 0);
virtual ~DiffHighlighter();
~DiffHighlighter();
virtual void highlightBlock(const QString &text);
void highlightBlock(const QString &text);
// Set formats from a sequence of type QTextCharFormat
void setFormats(const QVector<QTextCharFormat> &s);
......
......@@ -61,7 +61,8 @@ namespace Internal {
// For code clarity, a struct representing the entries of a mail map file
// with parse and model functions.
class NickNameEntry {
class NickNameEntry
{
public:
void clear();
bool parse(const QString &);
......@@ -276,5 +277,5 @@ QStringList NickNameDialog::nickNameList(const QStandardItemModel *model)
return rc;
}
}
}
} // namespace Internal
} // namespace VCSBase
......@@ -55,7 +55,7 @@ void SubmitEditorFile::rename(const QString &newName)
return;
}
void SubmitEditorFile::setFileName(const QString name)
void SubmitEditorFile::setFileName(const QString &name)
{
m_fileName = name;
emit changed();
......
......@@ -50,7 +50,7 @@ public:
QString suggestedFileName() const { return QString(); }
bool isModified() const { return m_modified; }
virtual QString mimeType() const;
QString mimeType() const;
bool isReadOnly() const { return false; }
bool isSaveAsAllowed() const { return false; }
bool save(QString *errorString, const QString &fileName, bool autoSave);
......@@ -58,7 +58,7 @@ public:
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
void rename(const QString &newName);
void setFileName(const QString name);
void setFileName(const QString &name);
void setModified(bool modified = true);
signals:
......
......@@ -157,4 +157,4 @@ unsigned SubmitFileModel::filter(const QStringList &filter, int column)
return rc;
}
}
} // namespace VCSBase
......@@ -167,10 +167,6 @@ void VCSBaseClientPrivate::commandFinishedGotoLine(QObject *editorObject)
}
}
VCSBaseClient::StatusItem::StatusItem()
{
}
VCSBaseClient::StatusItem::StatusItem(const QString &s, const QString &f) :
flags(s), file(f)
{
......
......@@ -66,7 +66,7 @@ public:
class VCSBASE_EXPORT StatusItem
{
public:
StatusItem();
StatusItem() {}
StatusItem(const QString &s, const QString &f);
QString flags;
QString file;
......
......@@ -157,12 +157,11 @@ bool operator==(const SettingValue &lhs, const SettingValue &rhs)
namespace VCSBase {
namespace Internal {
class VCSBaseClientSettingsPrivate : public QSharedData
{
public:
VCSBaseClientSettingsPrivate()
{
}
VCSBaseClientSettingsPrivate() {}
VCSBaseClientSettingsPrivate(const VCSBaseClientSettingsPrivate &other) :
QSharedData(other),
......@@ -213,7 +212,7 @@ VCSBaseClientSettings::VCSBaseClientSettings(const VCSBaseClientSettings &other)
VCSBaseClientSettings &VCSBaseClientSettings::operator=(const VCSBaseClientSettings &other)
{
if (this != &other)
d = other.d;
d = other.d;
return *this;
}
......
......@@ -34,7 +34,7 @@
#define VCSBASECLIENTSETTINGS_H
#include "vcsbase_global.h"
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtCore/QSharedDataPointer>
......@@ -45,9 +45,7 @@ QT_END_NAMESPACE
namespace VCSBase {
namespace Internal {
class VCSBaseClientSettingsPrivate;
} // namespace Internal
namespace Internal { class VCSBaseClientSettingsPrivate; }
class VCSBASE_EXPORT VCSBaseClientSettings
{
......
......@@ -136,7 +136,7 @@ public:
};
} // namespace Internal
} // VCSBase
} // namespace VCSBase
Q_DECLARE_METATYPE(VCSBase::Internal::DiffChunkAction)
......
......@@ -45,21 +45,18 @@ class QTextCodec;
class QTextCursor;
QT_END_NAMESPACE
namespace Core {
class IVersionControl;
}
namespace Core { class IVersionControl; }
namespace VCSBase {
namespace Internal {
class VCSBaseEditorWidgetPrivate;
} // namespace Internal
namespace Internal { class VCSBaseEditorWidgetPrivate; }
class DiffHighlighter;
class BaseAnnotationHighlighter;
// Documentation inside
enum EditorContentType {
enum EditorContentType
{
RegularCommandOutput,
LogOutput,
AnnotateOutput,
......@@ -106,7 +103,7 @@ protected:
public:
void init();
virtual ~VCSBaseEditorWidget();
~VCSBaseEditorWidget();
/* Force read-only: Make it a read-only, temporary file.
* Should be set to true by version control views. It is not on
......
......@@ -107,10 +107,6 @@ public:
that should trigger the rerun of the VCS operation.
*/
VCSBaseEditorParameterWidget::ComboBoxItem::ComboBoxItem()
{
}
VCSBaseEditorParameterWidget::ComboBoxItem::ComboBoxItem(const QString &text,
const QVariant &val) :
displayText(text),
......
......@@ -35,9 +35,9 @@
#include "vcsbase_global.h"
#include <QtGui/QWidget>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class QComboBox;
......@@ -46,9 +46,7 @@ QT_END_NAMESPACE
namespace VCSBase {
namespace Internal {
class VCSBaseEditorParameterWidgetPrivate;
} // namespace
namespace Internal { class VCSBaseEditorParameterWidgetPrivate; }
// Documentation->inside.
class VCSBASE_EXPORT VCSBaseEditorParameterWidget : public QWidget
......@@ -61,7 +59,7 @@ public:
struct VCSBASE_EXPORT ComboBoxItem
{
ComboBoxItem();
ComboBoxItem() {}
ComboBoxItem(const QString &text, const QVariant &val);
QString displayText;
QVariant value;
......
......@@ -33,10 +33,10 @@
#ifndef VCSBASEOPTIONSPAGE_H
#define VCSBASEOPTIONSPAGE_H
#include <coreplugin/dialogs/ioptionspage.h>
#include "vcsbase_global.h"
#include <coreplugin/dialogs/ioptionspage.h>
namespace VCSBase {
class VCSBASE_EXPORT VCSBaseOptionsPage : public Core::IOptionsPage
......
......@@ -72,7 +72,8 @@ namespace VCSBase {
namespace Internal {
// Store repository along with text blocks
class RepositoryUserData : public QTextBlockUserData {
class RepositoryUserData : public QTextBlockUserData
{
public:
explicit RepositoryUserData(const QString &repo) : m_repository(repo) {}
const QString &repository() const { return m_repository; }
......@@ -83,7 +84,8 @@ private:
// A plain text edit with a special context menu containing "Clear" and
// and functions to append specially formatted entries.
class OutputWindowPlainTextEdit : public QPlainTextEdit {
class OutputWindowPlainTextEdit : public QPlainTextEdit
{
public:
explicit OutputWindowPlainTextEdit(QWidget *parent = 0);
......@@ -244,7 +246,8 @@ void OutputWindowPlainTextEdit::appendCommand(const QString &text)
} // namespace Internal
// ------------------- VCSBaseOutputWindowPrivate
struct VCSBaseOutputWindowPrivate {
struct VCSBaseOutputWindowPrivate
{
static VCSBaseOutputWindow *instance;
Internal::OutputWindowPlainTextEdit *plainTextEdit();