ClearCase: Modernize

* Use pragma once
* Use static member initialization

Change-Id: Icec025b7c3b310286c675cef30cf01e220002ca8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tobias Hunger
2016-02-03 17:52:09 +01:00
parent 10e6181ccf
commit 9b3016c2e4
22 changed files with 83 additions and 171 deletions

View File

@@ -38,10 +38,8 @@
using namespace ClearCase;
using namespace ClearCase::Internal;
ActivitySelector::ActivitySelector(QWidget *parent) :
QWidget(parent),
m_plugin(ClearCasePlugin::instance()),
m_changed(false)
ActivitySelector::ActivitySelector(QWidget *parent) : QWidget(parent),
m_plugin(ClearCasePlugin::instance())
{
QTC_ASSERT(m_plugin->isUcm(), return);

View File

@@ -24,8 +24,7 @@
**
****************************************************************************/
#ifndef ACTIVITYSELECTOR_H
#define ACTIVITYSELECTOR_H
#pragma once
#include <QWidget>
@@ -43,7 +42,7 @@ class ActivitySelector : public QWidget
Q_OBJECT
public:
explicit ActivitySelector(QWidget *parent = 0);
explicit ActivitySelector(QWidget *parent = nullptr);
QString activity() const;
void setActivity(const QString &act);
void addKeep();
@@ -58,11 +57,9 @@ private slots:
private:
ClearCasePlugin *m_plugin;
bool m_changed;
bool m_changed = false;
QComboBox *m_cmbActivity;
};
} // namespace Internal
} // namespace ClearCase
#endif // ACTIVITYSELECTOR_H

View File

@@ -31,10 +31,8 @@ using namespace ClearCase::Internal;
ClearCaseAnnotationHighlighter::ClearCaseAnnotationHighlighter(const ChangeNumbers &changeNumbers,
QTextDocument *document) :
VcsBase::BaseAnnotationHighlighter(changeNumbers, document),
m_separator(QLatin1Char('|'))
{
}
VcsBase::BaseAnnotationHighlighter(changeNumbers, document)
{ }
QString ClearCaseAnnotationHighlighter::changeNumber(const QString &block) const
{

View File

@@ -24,8 +24,7 @@
**
****************************************************************************/
#ifndef ANNOTATIONHIGHLIGHTER_H
#define ANNOTATIONHIGHLIGHTER_H
#pragma once
#include <vcsbase/baseannotationhighlighter.h>
@@ -38,15 +37,13 @@ class ClearCaseAnnotationHighlighter : public VcsBase::BaseAnnotationHighlighter
Q_OBJECT
public:
explicit ClearCaseAnnotationHighlighter(const ChangeNumbers &changeNumbers,
QTextDocument *document = 0);
QTextDocument *document = nullptr);
private:
QString changeNumber(const QString &block) const;
QString changeNumber(const QString &block) const override;
const QChar m_separator;
const QChar m_separator = QLatin1Char('|');
};
} // namespace Internal
} // namespace ClearCase
#endif // ANNOTATIONHIGHLIGHTER_H

View File

@@ -36,8 +36,9 @@
namespace ClearCase {
namespace Internal {
CheckOutDialog::CheckOutDialog(const QString &fileName, bool isUcm, bool showComment, QWidget *parent) :
QDialog(parent), ui(new Ui::CheckOutDialog), m_actSelector(0)
CheckOutDialog::CheckOutDialog(const QString &fileName, bool isUcm, bool showComment,
QWidget *parent) :
QDialog(parent), ui(new Ui::CheckOutDialog)
{
ui->setupUi(this);
ui->lblFileName->setText(fileName);

View File

@@ -24,8 +24,7 @@
**
****************************************************************************/
#ifndef CHECKOUTDIALOG_H
#define CHECKOUTDIALOG_H
#pragma once
#include <QDialog>
@@ -57,10 +56,8 @@ private slots:
private:
Ui::CheckOutDialog *ui;
ActivitySelector *m_actSelector;
ActivitySelector *m_actSelector = nullptr;
};
} // namespace Internal
} // namespace ClearCase
#endif // CHECKOUTDIALOG_H

View File

@@ -24,8 +24,7 @@
**
****************************************************************************/
#ifndef CLEARCASE_CONSTANTS_H
#define CLEARCASE_CONSTANTS_H
#pragma once
#include <QtGlobal>
@@ -44,5 +43,3 @@ enum { debug = 0 };
} // namespace Constants
} // namespace ClearCase
#endif // CLEARCASE_CONSTANTS_H

View File

@@ -36,10 +36,8 @@
using namespace ClearCase;
using namespace ClearCase::Internal;
ClearCaseControl::ClearCaseControl(ClearCasePlugin *plugin) :
m_plugin(plugin)
{
}
ClearCaseControl::ClearCaseControl(ClearCasePlugin *plugin) : m_plugin(plugin)
{ }
QString ClearCaseControl::displayName() const
{

View File

@@ -24,8 +24,7 @@
**
****************************************************************************/
#ifndef CLEARCASECONTROL_H
#define CLEARCASECONTROL_H
#pragma once
#include <coreplugin/iversioncontrol.h>
@@ -68,10 +67,8 @@ public:
void emitConfigurationChanged();
private:
ClearCasePlugin *m_plugin;
ClearCasePlugin *const m_plugin;
};
} // namespace Internal
} // namespace ClearCase
#endif // CLEARCASECONTROL_H

View File

@@ -24,8 +24,7 @@
**
****************************************************************************/
#ifndef CLEARCASEEDITOR_H
#define CLEARCASEEDITOR_H
#pragma once
#include <vcsbase/vcsbaseeditor.h>
@@ -52,5 +51,3 @@ private:
} // namespace Internal
} // namespace ClearCase
#endif // CLEARCASEEDITOR_H

View File

@@ -156,39 +156,9 @@ static QString debugCodec(const QTextCodec *c)
// ------------- ClearCasePlugin
ClearCasePlugin *ClearCasePlugin::m_clearcasePluginInstance = 0;
ViewData::ViewData() :
isDynamic(false),
isUcm(false)
{
}
ClearCasePlugin::ClearCasePlugin() :
m_commandLocator(0),
m_checkOutAction(0),
m_checkInCurrentAction(0),
m_undoCheckOutAction(0),
m_undoHijackAction(0),
m_diffCurrentAction(0),
m_historyCurrentAction(0),
m_annotateCurrentAction(0),
m_addFileAction(0),
m_diffActivityAction(0),
m_updateIndexAction(0),
m_updateViewAction(0),
m_checkInActivityAction(0),
m_checkInAllAction(0),
m_statusAction(0),
m_checkInSelectedAction(0),
m_checkInDiffAction(0),
m_submitUndoAction(0),
m_submitRedoAction(0),
m_menuAction(0),
m_submitActionTriggered(false),
m_activityMutex(new QMutex),
m_statusMap(new StatusMap)
#ifdef WITH_TESTS
,m_fakeClearTool(false)
#endif
{
qRegisterMetaType<ClearCase::Internal::FileStatus::Status>("ClearCase::Internal::FileStatus::Status");
connect(qApp, &QApplication::applicationStateChanged,

View File

@@ -24,8 +24,7 @@
**
****************************************************************************/
#ifndef CLEARCASEPLUGIN_H
#define CLEARCASEPLUGIN_H
#pragma once
#include "clearcasesettings.h"
@@ -94,7 +93,7 @@ public:
FileStatus(Status _status = Unknown, QFile::Permissions perm = 0)
: status(_status), permissions(perm)
{}
{ }
};
typedef QHash<QString, FileStatus> StatusMap;
@@ -102,11 +101,9 @@ typedef QHash<QString, FileStatus> StatusMap;
class ViewData
{
public:
ViewData();
QString name;
bool isDynamic;
bool isUcm;
bool isDynamic = false;
bool isUcm = false;
QString root;
};
@@ -119,9 +116,9 @@ class ClearCasePlugin : public VcsBase::VcsBasePlugin
public:
ClearCasePlugin();
~ClearCasePlugin();
~ClearCasePlugin() override;
bool initialize(const QStringList &arguments, QString *error_message);
bool initialize(const QStringList &arguments, QString *error_message) override;
ClearCaseSubmitEditor *openClearCaseSubmitEditor(const QString &fileName, bool isUcm);
@@ -198,8 +195,8 @@ private slots:
#endif
protected:
void updateActions(VcsBase::VcsBasePlugin::ActionState);
bool submitEditorAboutToClose();
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
bool submitEditorAboutToClose() override;
QString ccGet(const QString &workingDir, const QString &file, const QString &prefix = QString());
QList<QStringPair> ccGetActivities() const;
@@ -271,40 +268,38 @@ private:
QString m_activity;
QString m_diffPrefix;
Core::CommandLocator *m_commandLocator;
Utils::ParameterAction *m_checkOutAction;
Utils::ParameterAction *m_checkInCurrentAction;
Utils::ParameterAction *m_undoCheckOutAction;
Utils::ParameterAction *m_undoHijackAction;
Utils::ParameterAction *m_diffCurrentAction;
Utils::ParameterAction *m_historyCurrentAction;
Utils::ParameterAction *m_annotateCurrentAction;
Utils::ParameterAction *m_addFileAction;
QAction *m_diffActivityAction;
QAction *m_updateIndexAction;
Utils::ParameterAction *m_updateViewAction;
Utils::ParameterAction *m_checkInActivityAction;
QAction *m_checkInAllAction;
QAction *m_statusAction;
Core::CommandLocator *m_commandLocator = nullptr;
Utils::ParameterAction *m_checkOutAction = nullptr;
Utils::ParameterAction *m_checkInCurrentAction = nullptr;
Utils::ParameterAction *m_undoCheckOutAction = nullptr;
Utils::ParameterAction *m_undoHijackAction = nullptr;
Utils::ParameterAction *m_diffCurrentAction = nullptr;
Utils::ParameterAction *m_historyCurrentAction = nullptr;
Utils::ParameterAction *m_annotateCurrentAction = nullptr;
Utils::ParameterAction *m_addFileAction = nullptr;
QAction *m_diffActivityAction = nullptr;
QAction *m_updateIndexAction = nullptr;
Utils::ParameterAction *m_updateViewAction = nullptr;
Utils::ParameterAction *m_checkInActivityAction = nullptr;
QAction *m_checkInAllAction = nullptr;
QAction *m_statusAction = nullptr;
QAction *m_checkInSelectedAction;
QAction *m_checkInDiffAction;
QAction *m_submitUndoAction;
QAction *m_submitRedoAction;
QAction *m_menuAction;
bool m_submitActionTriggered;
QAction *m_checkInSelectedAction = nullptr;
QAction *m_checkInDiffAction = nullptr;
QAction *m_submitUndoAction = nullptr;
QAction *m_submitRedoAction = nullptr;
QAction *m_menuAction = nullptr;
bool m_submitActionTriggered = false;
QMutex *m_activityMutex;
QList<QStringPair> m_activities;
QSharedPointer<StatusMap> m_statusMap;
static ClearCasePlugin *m_clearcasePluginInstance;
#ifdef WITH_TESTS
bool m_fakeClearTool;
bool m_fakeClearTool = false;
QString m_tempFile;
#endif
};
} // namespace Internal
} // namespace ClearCase
#endif // CLEARCASEPLUGIN_H

View File

@@ -60,15 +60,7 @@ using namespace ClearCase::Internal;
ClearCaseSettings::ClearCaseSettings() :
ccCommand(defaultCommand()),
diffType(GraphicalDiff),
diffArgs(QLatin1String(defaultDiffArgs)),
autoAssignActivityName(true),
autoCheckOut(true),
noComment(false),
keepFileUndoCheckout(true),
promptToCheckIn(false),
disableIndexer(false),
extDiffAvailable(false),
historyCount(defaultHistoryCount),
timeOutS(defaultTimeOutS)
{ }

View File

@@ -24,8 +24,7 @@
**
****************************************************************************/
#ifndef CLEARCASESETTINGS_H
#define CLEARCASESETTINGS_H
#pragma once
#include <QHash>
#include <QString>
@@ -57,27 +56,25 @@ public:
QString ccCommand;
QString ccBinaryPath;
DiffType diffType;
DiffType diffType = GraphicalDiff;
QString diffArgs;
QString indexOnlyVOBs;
QHash<QString, int> totalFiles;
bool autoAssignActivityName;
bool autoCheckOut;
bool noComment;
bool keepFileUndoCheckout;
bool promptToCheckIn;
bool disableIndexer;
bool extDiffAvailable;
bool autoAssignActivityName = true;
bool autoCheckOut = true;
bool noComment = false;
bool keepFileUndoCheckout = true;
bool promptToCheckIn = false;
bool disableIndexer = false;
bool extDiffAvailable = false;
int historyCount;
int timeOutS;
};
inline bool operator==(const ClearCaseSettings &p1, const ClearCaseSettings &p2)
{ return p1.equals(p2); }
{ return p1.equals(p2); }
inline bool operator!=(const ClearCaseSettings &p1, const ClearCaseSettings &p2)
{ return !p1.equals(p2); }
{ return !p1.equals(p2); }
} // namespace Internal
} // namespace ClearCase
#endif // CLEARCASESETTINGS_H

View File

@@ -24,8 +24,7 @@
**
****************************************************************************/
#ifndef CLEARCASESUBMITEDITOR_H
#define CLEARCASESUBMITEDITOR_H
#pragma once
#include <vcsbase/vcsbasesubmiteditor.h>
@@ -50,10 +49,7 @@ public:
protected:
QByteArray fileContents() const override;
};
} // namespace Internal
} // namespace ClearCase
#endif // CLEARCASESUBMITEDITOR_H

View File

@@ -36,7 +36,6 @@
using namespace ClearCase::Internal;
ClearCaseSubmitEditorWidget::ClearCaseSubmitEditorWidget()
: m_actSelector(0)
{
setDescriptionMandatory(false);
auto checkInWidget = new QWidget(this);

View File

@@ -24,8 +24,7 @@
**
****************************************************************************/
#ifndef CLEARCASESUBMITEDITORWIDGET_H
#define CLEARCASESUBMITEDITORWIDGET_H
#pragma once
#include <vcsbase/submiteditorwidget.h>
@@ -58,7 +57,7 @@ protected:
QString commitName() const;
private:
ActivitySelector *m_actSelector;
ActivitySelector *m_actSelector = nullptr;
QCheckBox *m_chkIdentical;
QCheckBox *m_chkPTime;
QVBoxLayout *m_verticalLayout;
@@ -66,5 +65,3 @@ private:
} // namespace Internal
} // namespace ClearCase
#endif // CLEARCASESUBMITEDITORWIDGET_H

View File

@@ -43,8 +43,7 @@ namespace Internal {
ClearCaseSync::ClearCaseSync(ClearCasePlugin *plugin, QSharedPointer<StatusMap> statusMap) :
m_plugin(plugin),
m_statusMap(statusMap)
{
}
{ }
QStringList ClearCaseSync::updateStatusHotFiles(const QString &viewRoot, int &total)
{

View File

@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef CLEARCASESYNC_H
#define CLEARCASESYNC_H
#pragma once
#include "clearcaseplugin.h"
@@ -55,7 +54,7 @@ signals:
void updateStreamAndView();
private:
ClearCasePlugin *m_plugin;
ClearCasePlugin *const m_plugin;
QSharedPointer<StatusMap> m_statusMap;
public slots:
@@ -69,10 +68,7 @@ public slots:
void verifyFileNotManagedDynamicView();
#endif
};
} // namespace Internal
} // namespace ClearCase
#endif // CLEARCASESYNC_H

View File

@@ -42,8 +42,7 @@
using namespace ClearCase::Internal;
using namespace Utils;
SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
QWidget(parent)
SettingsPageWidget::SettingsPageWidget(QWidget *parent) : QWidget(parent)
{
m_ui.setupUi(this);
m_ui.commandPathChooser->setPromptDialogTitle(tr("ClearCase Command"));
@@ -105,8 +104,7 @@ void SettingsPageWidget::setSettings(const ClearCaseSettings &s)
m_ui.indexOnlyVOBsEdit->setText(s.indexOnlyVOBs);
}
SettingsPage::SettingsPage() :
m_widget(0)
SettingsPage::SettingsPage()
{
setId(ClearCase::Constants::VCS_ID_CLEARCASE);
setDisplayName(tr("ClearCase"));

View File

@@ -24,8 +24,7 @@
**
****************************************************************************/
#ifndef SETTINGSPAGE_H
#define SETTINGSPAGE_H
#pragma once
#include <vcsbase/vcsbaseoptionspage.h>
@@ -43,7 +42,7 @@ class SettingsPageWidget : public QWidget
Q_OBJECT
public:
explicit SettingsPageWidget(QWidget *parent = 0);
explicit SettingsPageWidget(QWidget *parent = nullptr);
ClearCaseSettings settings() const;
void setSettings(const ClearCaseSettings &);
@@ -60,15 +59,13 @@ class SettingsPage : public VcsBase::VcsBaseOptionsPage
public:
SettingsPage();
QWidget *widget();
void apply();
void finish() { }
QWidget *widget() override;
void apply() override;
void finish() override { }
private:
QPointer<SettingsPageWidget> m_widget;
QPointer<SettingsPageWidget> m_widget = nullptr;
};
} // namespace ClearCase
} // namespace Internal
#endif // SETTINGSPAGE_H

View File

@@ -24,8 +24,7 @@
**
****************************************************************************/
#ifndef VERSIONSELECTOR_H
#define VERSIONSELECTOR_H
#pragma once
#include <QDialog>
@@ -43,18 +42,18 @@ class VersionSelector : public QDialog
Q_OBJECT
public:
explicit VersionSelector(const QString &fileName, const QString &message, QWidget *parent = 0);
~VersionSelector();
explicit VersionSelector(const QString &fileName, const QString &message,
QWidget *parent = nullptr);
~VersionSelector() override;
bool isUpdate() const;
private:
bool readValues();
Ui::VersionSelector *ui;
QTextStream *m_stream;
QString m_versionID, m_createdBy, m_createdOn, m_message;
bool readValues();
};
} // namespace Internal
} // namespace ClearCase
#endif // VERSIONSELECTOR_H