summaryrefslogtreecommitdiff
path: root/src/plugins/cvs
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@theqtcompany.com>2016-02-04 13:07:35 +0100
committerTobias Hunger <tobias.hunger@theqtcompany.com>2016-02-04 13:16:42 +0000
commiteb07fd92b2cfeb886bd1d3dbfae9058237b3f6d9 (patch)
tree04b76bef7487ddd283a58401f993f8872ef2bb1c /src/plugins/cvs
parentbc9c57756b71c8681a3604aa70461735ceb1da09 (diff)
downloadqt-creator-eb07fd92b2cfeb886bd1d3dbfae9058237b3f6d9.tar.gz
CVS: Modernize
* Use pragma once * Use some more overrides * Tiny clean-ups here and there Change-Id: I951afa8ed31c5f414d4ae872c79f80db19909ee0 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/cvs')
-rw-r--r--src/plugins/cvs/annotationhighlighter.cpp8
-rw-r--r--src/plugins/cvs/annotationhighlighter.h9
-rw-r--r--src/plugins/cvs/cvs.pro3
-rw-r--r--src/plugins/cvs/cvs.qbs1
-rw-r--r--src/plugins/cvs/cvsclient.cpp1
-rw-r--r--src/plugins/cvs/cvsclient.h18
-rw-r--r--src/plugins/cvs/cvsconstants.h37
-rw-r--r--src/plugins/cvs/cvscontrol.cpp3
-rw-r--r--src/plugins/cvs/cvscontrol.h7
-rw-r--r--src/plugins/cvs/cvseditor.cpp3
-rw-r--r--src/plugins/cvs/cvseditor.h5
-rw-r--r--src/plugins/cvs/cvsplugin.cpp21
-rw-r--r--src/plugins/cvs/cvsplugin.h22
-rw-r--r--src/plugins/cvs/cvssettings.h5
-rw-r--r--src/plugins/cvs/cvssubmiteditor.cpp3
-rw-r--r--src/plugins/cvs/cvssubmiteditor.h5
-rw-r--r--src/plugins/cvs/cvsutils.cpp22
-rw-r--r--src/plugins/cvs/cvsutils.h17
-rw-r--r--src/plugins/cvs/settingspage.h17
19 files changed, 42 insertions, 165 deletions
diff --git a/src/plugins/cvs/annotationhighlighter.cpp b/src/plugins/cvs/annotationhighlighter.cpp
index 877ede7074..4c6d57e7d0 100644
--- a/src/plugins/cvs/annotationhighlighter.cpp
+++ b/src/plugins/cvs/annotationhighlighter.cpp
@@ -30,13 +30,11 @@ using namespace Cvs::Internal;
CvsAnnotationHighlighter::CvsAnnotationHighlighter(const ChangeNumbers &changeNumbers,
QTextDocument *document) :
- VcsBase::BaseAnnotationHighlighter(changeNumbers, document),
- m_blank(QLatin1Char(' '))
-{
-}
+ VcsBase::BaseAnnotationHighlighter(changeNumbers, document)
+{ }
QString CvsAnnotationHighlighter::changeNumber(const QString &block) const
{
- const int pos = block.indexOf(m_blank);
+ const int pos = block.indexOf(QLatin1Char(' '));
return pos > 1 ? block.left(pos) : QString();
}
diff --git a/src/plugins/cvs/annotationhighlighter.h b/src/plugins/cvs/annotationhighlighter.h
index f8d26a5265..afa52aba61 100644
--- a/src/plugins/cvs/annotationhighlighter.h
+++ b/src/plugins/cvs/annotationhighlighter.h
@@ -23,8 +23,7 @@
**
****************************************************************************/
-#ifndef ANNOTATIONHIGHLIGHTER_H
-#define ANNOTATIONHIGHLIGHTER_H
+#pragma once
#include <vcsbase/baseannotationhighlighter.h>
@@ -41,12 +40,8 @@ public:
QTextDocument *document = 0);
private:
- QString changeNumber(const QString &block) const;
-
- const QChar m_blank;
+ QString changeNumber(const QString &block) const override;
};
} // namespace Internal
} // namespace Cvs
-
-#endif // ANNOTATIONHIGHLIGHTER_H
diff --git a/src/plugins/cvs/cvs.pro b/src/plugins/cvs/cvs.pro
index aff49e95ca..55572dab1a 100644
--- a/src/plugins/cvs/cvs.pro
+++ b/src/plugins/cvs/cvs.pro
@@ -8,8 +8,7 @@ HEADERS += annotationhighlighter.h \
cvseditor.h \
cvssubmiteditor.h \
cvssettings.h \
- cvsutils.h \
- cvsconstants.h
+ cvsutils.h
SOURCES += annotationhighlighter.cpp \
cvsplugin.cpp \
diff --git a/src/plugins/cvs/cvs.qbs b/src/plugins/cvs/cvs.qbs
index 040b86debe..63f231dadf 100644
--- a/src/plugins/cvs/cvs.qbs
+++ b/src/plugins/cvs/cvs.qbs
@@ -16,7 +16,6 @@ QtcPlugin {
"cvs.qrc",
"cvsclient.cpp",
"cvsclient.h",
- "cvsconstants.h",
"cvscontrol.cpp",
"cvscontrol.h",
"cvseditor.cpp",
diff --git a/src/plugins/cvs/cvsclient.cpp b/src/plugins/cvs/cvsclient.cpp
index 08218617dd..c297cf6ad4 100644
--- a/src/plugins/cvs/cvsclient.cpp
+++ b/src/plugins/cvs/cvsclient.cpp
@@ -25,7 +25,6 @@
#include "cvsclient.h"
#include "cvssettings.h"
-#include "cvsconstants.h"
#include <vcsbase/vcsbaseplugin.h>
#include <vcsbase/vcsbaseeditor.h>
diff --git a/src/plugins/cvs/cvsclient.h b/src/plugins/cvs/cvsclient.h
index 2244cf6b9a..54e7640e87 100644
--- a/src/plugins/cvs/cvsclient.h
+++ b/src/plugins/cvs/cvsclient.h
@@ -23,10 +23,10 @@
**
****************************************************************************/
-#ifndef CVSCLIENT_H
-#define CVSCLIENT_H
+#pragma once
#include "cvssettings.h"
+
#include <vcsbase/vcsbaseclient.h>
namespace Cvs {
@@ -43,17 +43,15 @@ public:
CvsSettings &settings() const;
void diff(const QString &workingDir, const QStringList &files,
- const QStringList &extraOptions = QStringList());
- QString findTopLevelForFile(const QFileInfo &file) const;
- QStringList revisionSpec(const QString &revision) const;
- StatusItem parseStatusLine(const QString &line) const;
+ const QStringList &extraOptions = QStringList()) override;
+ QString findTopLevelForFile(const QFileInfo &file) const override;
+ QStringList revisionSpec(const QString &revision) const override;
+ StatusItem parseStatusLine(const QString &line) const override;
protected:
- Utils::ExitCodeInterpreter *exitCodeInterpreter(VcsCommandTag cmd, QObject *parent) const;
- Core::Id vcsEditorKind(VcsCommandTag cmd) const;
+ Utils::ExitCodeInterpreter *exitCodeInterpreter(VcsCommandTag cmd, QObject *parent) const override;
+ Core::Id vcsEditorKind(VcsCommandTag cmd) const override;
};
} // namespace Internal
} // namespace Cvs
-
-#endif // CVSCLIENT_H
diff --git a/src/plugins/cvs/cvsconstants.h b/src/plugins/cvs/cvsconstants.h
deleted file mode 100644
index df819a0c9d..0000000000
--- a/src/plugins/cvs/cvsconstants.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#ifndef CVS_CONSTANTS_H
-#define CVS_CONSTANTS_H
-
-namespace Cvs {
-namespace Constants {
-
-enum { debug = 0 };
-
-} // namespace Constants
-} // namespace Cvs
-
-#endif // CVS_CONSTANTS_H
diff --git a/src/plugins/cvs/cvscontrol.cpp b/src/plugins/cvs/cvscontrol.cpp
index c14b639b74..c277557d16 100644
--- a/src/plugins/cvs/cvscontrol.cpp
+++ b/src/plugins/cvs/cvscontrol.cpp
@@ -42,8 +42,7 @@ using namespace Cvs::Internal;
CvsControl::CvsControl(CvsPlugin *plugin) :
m_plugin(plugin)
-{
-}
+{ }
QString CvsControl::displayName() const
{
diff --git a/src/plugins/cvs/cvscontrol.h b/src/plugins/cvs/cvscontrol.h
index 9c9876a02b..ea9d94ccf7 100644
--- a/src/plugins/cvs/cvscontrol.h
+++ b/src/plugins/cvs/cvscontrol.h
@@ -23,8 +23,7 @@
**
****************************************************************************/
-#ifndef CVSCONTROL_H
-#define CVSCONTROL_H
+#pragma once
#include <coreplugin/iversioncontrol.h>
@@ -67,10 +66,8 @@ public:
void emitFilesChanged(const QStringList &l);
private:
- CvsPlugin *m_plugin;
+ CvsPlugin *const m_plugin;
};
} // namespace Internal
} // namespace Cvs
-
-#endif // CVSCONTROL_H
diff --git a/src/plugins/cvs/cvseditor.cpp b/src/plugins/cvs/cvseditor.cpp
index 268c5cfed7..8e0b0bbb2c 100644
--- a/src/plugins/cvs/cvseditor.cpp
+++ b/src/plugins/cvs/cvseditor.cpp
@@ -27,7 +27,6 @@
#include "cvsutils.h"
#include "annotationhighlighter.h"
-#include "cvsconstants.h"
#include <utils/qtcassert.h>
#include <vcsbase/diffandloghighlighter.h>
@@ -81,8 +80,6 @@ QSet<QString> CvsEditorWidget::annotationChanges() const
changes.insert(r.cap(1));
}
}
- if (Constants::debug)
- qDebug() << "CVSEditor::annotationChanges() returns #" << changes.size();
return changes;
}
diff --git a/src/plugins/cvs/cvseditor.h b/src/plugins/cvs/cvseditor.h
index 9ccd185be2..f7ce08fd0b 100644
--- a/src/plugins/cvs/cvseditor.h
+++ b/src/plugins/cvs/cvseditor.h
@@ -23,8 +23,7 @@
**
****************************************************************************/
-#ifndef CVSEDITOR_H
-#define CVSEDITOR_H
+#pragma once
#include <vcsbase/vcsbaseeditor.h>
@@ -54,5 +53,3 @@ private:
} // namespace Internal
} // namespace Cvs
-
-#endif // CVSEDITOR_H
diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index 5f8b2e3cac..9f4097ebb1 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -28,7 +28,6 @@
#include "cvseditor.h"
#include "cvssubmiteditor.h"
#include "cvsclient.h"
-#include "cvsconstants.h"
#include "cvscontrol.h"
#include <vcsbase/basevcseditorfactory.h>
@@ -153,11 +152,6 @@ static inline const VcsBaseEditorParameters *findType(int ie)
return VcsBaseEditor::findType(editorParameters, sizeof(editorParameters) / sizeof(editorParameters[0]), et);
}
-static inline QString debugCodec(const QTextCodec *c)
-{
- return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec");
-}
-
static inline bool messageBoxQuestion(const QString &title, const QString &question)
{
return QMessageBox::question(ICore::dialogParent(), title, question, QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes;
@@ -202,7 +196,6 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments)
Q_UNUSED(errorMessage)
- using namespace Constants;
using namespace Core::Constants;
Context context(CVS_CONTEXT);
@@ -711,8 +704,6 @@ void CvsPlugin::startCommit(const QString &workingDir, const QString &file)
bool CvsPlugin::commit(const QString &messageFile,
const QStringList &fileList)
{
- if (Constants::debug)
- qDebug() << Q_FUNC_INFO << messageFile << fileList;
QStringList args = QStringList(QLatin1String("commit"));
args << QLatin1String("-F") << messageFile;
args.append(fileList);
@@ -1003,8 +994,6 @@ bool CvsPlugin::describe(const QString &toplevel, const QString &file, const
// This function makes use of it to find all files related to
// a commit in order to emulate a "describe global change" functionality
// if desired.
- if (Constants::debug)
- qDebug() << Q_FUNC_INFO << file << changeNr;
// Number must be > 1
if (isFirstRevision(changeNr)) {
*errorMessage = tr("The initial revision %1 cannot be described.").arg(changeNr);
@@ -1179,9 +1168,6 @@ IEditor *CvsPlugin::showOutputInEditor(const QString& title, const QString &outp
const VcsBaseEditorParameters *params = findType(editorType);
QTC_ASSERT(params, return 0);
const Id id = params->id;
- if (Constants::debug)
- qDebug() << "CVSPlugin::showOutputInEditor" << title << id.name()
- << "source=" << source << "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
QString s = title;
IEditor *editor = EditorManager::openEditorWithContents(id, &s, output.toUtf8());
connect(editor, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)),
@@ -1252,12 +1238,7 @@ bool CvsPlugin::managesDirectory(const QString &directory, QString *topLevel /*
}
}
} while (false);
- if (Constants::debug) {
- QDebug nsp = qDebug().nospace();
- nsp << "CVSPlugin::managesDirectory" << directory << manages;
- if (topLevel)
- nsp << *topLevel;
- }
+
return manages;
}
diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h
index 029bf7ba38..86567c4511 100644
--- a/src/plugins/cvs/cvsplugin.h
+++ b/src/plugins/cvs/cvsplugin.h
@@ -23,8 +23,7 @@
**
****************************************************************************/
-#ifndef CVSPLUGIN_H
-#define CVSPLUGIN_H
+#pragma once
#include "cvssettings.h"
#include "cvsutils.h"
@@ -40,7 +39,7 @@ QT_END_NAMESPACE
namespace Core {
class CommandLocator;
class IVersionControl;
-}
+} // namespace Core
namespace Utils { class ParameterAction; }
namespace VcsBase { class VcsBaseSubmitEditor; }
@@ -48,17 +47,16 @@ namespace VcsBase { class VcsBaseSubmitEditor; }
namespace Cvs {
namespace Internal {
-struct CvsDiffParameters;
class CvsSubmitEditor;
class CvsControl;
class CvsClient;
-struct CvsResponse
+class CvsResponse
{
+public:
enum Result { Ok, NonNullExitCode, OtherError };
- CvsResponse() : result(Ok) {}
- Result result;
+ Result result = Ok;
QString stdOut;
QString stdErr;
QString message;
@@ -70,11 +68,11 @@ class CvsPlugin : public VcsBase::VcsBasePlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CVS.json")
public:
- ~CvsPlugin();
+ ~CvsPlugin() override;
CvsClient *client() const;
- bool initialize(const QStringList &arguments, QString *errorMessage);
+ bool initialize(const QStringList &arguments, QString *errorMessage) override;
CvsSubmitEditor *openCVSSubmitEditor(const QString &fileName);
@@ -102,8 +100,8 @@ private slots:
#endif
protected:
- void updateActions(VcsBase::VcsBasePlugin::ActionState);
- bool submitEditorAboutToClose();
+ void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
+ bool submitEditorAboutToClose() override;
private:
void addCurrentFile();
@@ -205,5 +203,3 @@ private:
} // namespace Cvs
} // namespace Internal
-
-#endif // CVSPLUGIN_H
diff --git a/src/plugins/cvs/cvssettings.h b/src/plugins/cvs/cvssettings.h
index 65222780b4..ab4755b2c9 100644
--- a/src/plugins/cvs/cvssettings.h
+++ b/src/plugins/cvs/cvssettings.h
@@ -23,8 +23,7 @@
**
****************************************************************************/
-#ifndef CVSSETTINGS_H
-#define CVSSETTINGS_H
+#pragma once
#include <vcsbase/vcsbaseclientsettings.h>
@@ -52,5 +51,3 @@ protected:
} // namespace Internal
} // namespace Cvs
-
-#endif // CVSSETTINGS_H
diff --git a/src/plugins/cvs/cvssubmiteditor.cpp b/src/plugins/cvs/cvssubmiteditor.cpp
index 43c7f40b0a..5cbae05b4f 100644
--- a/src/plugins/cvs/cvssubmiteditor.cpp
+++ b/src/plugins/cvs/cvssubmiteditor.cpp
@@ -36,8 +36,7 @@ CvsSubmitEditor::CvsSubmitEditor(const VcsBaseSubmitEditorParameters *parameters
m_msgAdded(tr("Added")),
m_msgRemoved(tr("Removed")),
m_msgModified(tr("Modified"))
-{
-}
+{ }
QString CvsSubmitEditor::stateName(State st) const
{
diff --git a/src/plugins/cvs/cvssubmiteditor.h b/src/plugins/cvs/cvssubmiteditor.h
index eebd9ef798..e4d99986b2 100644
--- a/src/plugins/cvs/cvssubmiteditor.h
+++ b/src/plugins/cvs/cvssubmiteditor.h
@@ -23,8 +23,7 @@
**
****************************************************************************/
-#ifndef CVSSUBMITEDITOR_H
-#define CVSSUBMITEDITOR_H
+#pragma once
#include <QPair>
#include <QStringList>
@@ -58,5 +57,3 @@ private:
} // namespace Internal
} // namespace Cvs
-
-#endif // CVSSUBMITEDITOR_H
diff --git a/src/plugins/cvs/cvsutils.cpp b/src/plugins/cvs/cvsutils.cpp
index 393b601e1f..eac2986039 100644
--- a/src/plugins/cvs/cvsutils.cpp
+++ b/src/plugins/cvs/cvsutils.cpp
@@ -25,31 +25,17 @@
#include "cvsutils.h"
-#include <QDebug>
#include <QRegExp>
#include <QStringList>
namespace Cvs {
namespace Internal {
-CvsRevision::CvsRevision(const QString &rev) :
- revision(rev)
-{
-}
-
-CvsLogEntry::CvsLogEntry(const QString &f) :
- file(f)
-{
-}
+CvsRevision::CvsRevision(const QString &rev) : revision(rev)
+{ }
-QDebug operator<<(QDebug d, const CvsLogEntry &e)
-{
- QDebug nospace = d.nospace();
- nospace << "File: " << e.file << e.revisions.size() << '\n';
- foreach (const CvsRevision &r, e.revisions)
- nospace << " " << r.revision << ' ' << r.date << ' ' << r.commitId << '\n';
- return d;
-}
+CvsLogEntry::CvsLogEntry(const QString &f) : file(f)
+{ }
/* Parse:
\code
diff --git a/src/plugins/cvs/cvsutils.h b/src/plugins/cvs/cvsutils.h
index e5a88b54d2..7dace06adf 100644
--- a/src/plugins/cvs/cvsutils.h
+++ b/src/plugins/cvs/cvsutils.h
@@ -23,26 +23,22 @@
**
****************************************************************************/
-#ifndef CVSUTILS_H
-#define CVSUTILS_H
+#pragma once
#include "cvssubmiteditor.h"
#include <QString>
#include <QList>
-QT_BEGIN_NAMESPACE
-class QDebug;
-QT_END_NAMESPACE
-
namespace Cvs {
namespace Internal {
// Utilities to parse output of a CVS log.
// A revision of a file.
-struct CvsRevision
+class CvsRevision
{
+public:
CvsRevision(const QString &rev);
QString revision;
@@ -51,16 +47,15 @@ struct CvsRevision
};
// A log entry consisting of the file and its revisions.
-struct CvsLogEntry
+class CvsLogEntry
{
+public:
CvsLogEntry(const QString &file);
QString file;
QList<CvsRevision> revisions;
};
-QDebug operator<<(QDebug d, const CvsLogEntry &);
-
// Parse. Pass on a directory to obtain full paths when
// running from the repository directory.
QList<CvsLogEntry> parseLogEntries(const QString &output,
@@ -83,5 +78,3 @@ bool isFirstRevision(const QString &r);
} // namespace Internal
} // namespace Cvs
-
-#endif // CVSUTILS_H
diff --git a/src/plugins/cvs/settingspage.h b/src/plugins/cvs/settingspage.h
index f1207fb430..cf1c08ee40 100644
--- a/src/plugins/cvs/settingspage.h
+++ b/src/plugins/cvs/settingspage.h
@@ -23,24 +23,13 @@
**
****************************************************************************/
-#ifndef SETTINGSPAGE_H
-#define SETTINGSPAGE_H
+#pragma once
#include "ui_settingspage.h"
#include <vcsbase/vcsbaseoptionspage.h>
-#include <QWidget>
-#include <QPointer>
-#include <QString>
-
-QT_BEGIN_NAMESPACE
-class QSettings;
-QT_END_NAMESPACE
-
-namespace VcsBase {
-class VcsBaseClientSettings;
-} // namespace VcsBase
+namespace VcsBase { class VcsBaseClientSettings; }
namespace Cvs {
namespace Internal {
@@ -70,5 +59,3 @@ public:
} // namespace Cvs
} // namespace Internal
-
-#endif // SETTINGSPAGE_H