Commit f6963123 authored by Tobias Hunger's avatar Tobias Hunger Committed by Hugues Delorme

Use internal namespace in VCSBase more consistently

Change-Id: I61de9796aaeb9484b44029c5f1d46e69834a04c3
Reviewed-by: default avatarHugues Delorme <delorme.hugues@fougsys.fr>
parent 2327b395
......@@ -56,15 +56,19 @@ typedef QMap<QString, QTextCharFormat> ChangeNumberFormatMap;
*/
namespace VCSBase {
namespace Internal {
struct BaseAnnotationHighlighterPrivate {
class BaseAnnotationHighlighterPrivate {
public:
ChangeNumberFormatMap m_changeNumberMap;
};
} // namespace Internal
BaseAnnotationHighlighter::BaseAnnotationHighlighter(const ChangeNumbers &changeNumbers,
QTextDocument *document) :
TextEditor::SyntaxHighlighter(document),
d(new BaseAnnotationHighlighterPrivate)
d(new Internal::BaseAnnotationHighlighterPrivate)
{
setChangeNumbers(changeNumbers);
}
......
......@@ -38,8 +38,9 @@
#include <texteditor/syntaxhighlighter.h>
namespace VCSBase {
struct BaseAnnotationHighlighterPrivate;
namespace Internal {
class BaseAnnotationHighlighterPrivate;
} // namespace Internal
class VCSBASE_EXPORT BaseAnnotationHighlighter : public TextEditor::SyntaxHighlighter
{
......@@ -59,7 +60,7 @@ private:
// Implement this to return the change number of a line
virtual QString changeNumber(const QString &block) const = 0;
BaseAnnotationHighlighterPrivate *d;
Internal::BaseAnnotationHighlighterPrivate *const d;
};
} // namespace VCSBase
......
......@@ -65,8 +65,11 @@
*/
namespace VCSBase {
namespace Internal {
struct BaseCheckoutWizardPrivate {
class BaseCheckoutWizardPrivate
{
public:
BaseCheckoutWizardPrivate() : dialog(0) {}
void clear();
......@@ -83,9 +86,11 @@ void BaseCheckoutWizardPrivate::clear()
checkoutPath.clear();
}
} // namespace Internal
BaseCheckoutWizard::BaseCheckoutWizard(QObject *parent) :
Core::IWizard(parent),
d(new BaseCheckoutWizardPrivate)
d(new Internal::BaseCheckoutWizardPrivate)
{
}
......
......@@ -44,9 +44,11 @@ class QWizardPage;
QT_END_NAMESPACE
namespace VCSBase {
namespace Internal {
class BaseCheckoutWizardPrivate;
}
class AbstractCheckoutJob;
struct BaseCheckoutWizardPrivate;
class VCSBASE_EXPORT BaseCheckoutWizard : public Core::IWizard
{
......@@ -78,7 +80,7 @@ private slots:
void slotProgressPageShown();
private:
BaseCheckoutWizardPrivate *d;
Internal::BaseCheckoutWizardPrivate *const d;
};
} // namespace VCSBase
......
......@@ -48,8 +48,11 @@
*/
namespace VCSBase {
namespace Internal {
struct BaseCheckoutWizardPagePrivate {
class BaseCheckoutWizardPagePrivate
{
public:
BaseCheckoutWizardPagePrivate() : m_valid(false), m_directoryEdited(false) {}
Internal::Ui::BaseCheckoutWizardPage ui;
......@@ -57,9 +60,11 @@ struct BaseCheckoutWizardPagePrivate {
bool m_directoryEdited;
};
} // namespace Internal
BaseCheckoutWizardPage::BaseCheckoutWizardPage(QWidget *parent) :
QWizardPage(parent),
d(new BaseCheckoutWizardPagePrivate)
d(new Internal::BaseCheckoutWizardPagePrivate)
{
d->ui.setupUi(this);
......
......@@ -40,12 +40,13 @@
namespace VCSBase {
namespace Internal {
class BaseCheckoutWizardPagePrivate;
namespace Ui {
class BaseCheckoutWizardPage;
} // namespace Ui
} // namespace Internal
struct BaseCheckoutWizardPagePrivate;
class VCSBASE_EXPORT BaseCheckoutWizardPage : public QWizardPage
{
......@@ -107,7 +108,7 @@ private slots:
void slotRefreshBranches();
private:
BaseCheckoutWizardPagePrivate *d;
Internal::BaseCheckoutWizardPagePrivate *const d;
};
} // namespace VCSBase
......
......@@ -49,9 +49,11 @@
*/
namespace VCSBase {
namespace Internal {
struct BaseVCSEditorFactoryPrivate
class BaseVCSEditorFactoryPrivate
{
public:
BaseVCSEditorFactoryPrivate(const VCSBaseEditorParameters *t);
const VCSBaseEditorParameters *m_type;
......@@ -69,8 +71,10 @@ BaseVCSEditorFactoryPrivate::BaseVCSEditorFactoryPrivate(const VCSBaseEditorPara
{
}
} // namespace Internal
BaseVCSEditorFactory::BaseVCSEditorFactory(const VCSBaseEditorParameters *t)
: d(new BaseVCSEditorFactoryPrivate(t))
: d(new Internal::BaseVCSEditorFactoryPrivate(t))
{
d->m_displayName = QCoreApplication::translate("VCS", t->displayName);
}
......
......@@ -41,8 +41,9 @@
#include <QtCore/QStringList>
namespace VCSBase {
struct BaseVCSEditorFactoryPrivate;
namespace Internal {
class BaseVCSEditorFactoryPrivate;
} // namespace Internal
class VCSBASE_EXPORT BaseVCSEditorFactory : public Core::IEditorFactory
{
......@@ -66,7 +67,7 @@ private:
virtual VCSBaseEditorWidget *createVCSBaseEditor(const VCSBaseEditorParameters *type,
QWidget *parent) = 0;
BaseVCSEditorFactoryPrivate *d;
Internal::BaseVCSEditorFactoryPrivate *const d;
};
// Utility template to create an editor.
......
......@@ -37,8 +37,11 @@
namespace VCSBase {
struct BaseVCSSubmitEditorFactoryPrivate
namespace Internal {
class BaseVCSSubmitEditorFactoryPrivate
{
public:
BaseVCSSubmitEditorFactoryPrivate(const VCSBaseSubmitEditorParameters *parameters);
const VCSBaseSubmitEditorParameters *m_parameters;
......@@ -55,8 +58,10 @@ BaseVCSSubmitEditorFactoryPrivate::BaseVCSSubmitEditorFactoryPrivate(const VCSBa
{
}
} // namespace Internal
BaseVCSSubmitEditorFactory::BaseVCSSubmitEditorFactory(const VCSBaseSubmitEditorParameters *parameters) :
d(new BaseVCSSubmitEditorFactoryPrivate(parameters))
d(new Internal::BaseVCSSubmitEditorFactoryPrivate(parameters))
{
}
......
......@@ -39,9 +39,12 @@
namespace VCSBase {
class VCSBaseSubmitEditor;
struct VCSBaseSubmitEditorParameters;
struct BaseVCSSubmitEditorFactoryPrivate;
class VCSBaseSubmitEditor;
class VCSBaseSubmitEditorParameters;
namespace Internal {
class BaseVCSSubmitEditorFactoryPrivate;
} // namespace Internal
// Parametrizable base class for editor factories creating instances of
// VCSBaseSubmitEditor subclasses.
......@@ -66,7 +69,7 @@ private:
*createBaseSubmitEditor(const VCSBaseSubmitEditorParameters *parameters,
QWidget *parent) = 0;
BaseVCSSubmitEditorFactoryPrivate *d;
Internal::BaseVCSSubmitEditorFactoryPrivate *const d;
};
// Utility template to create an editor that has a constructor taking the
......
......@@ -54,13 +54,20 @@ enum { debug = 0 };
namespace VCSBase {
AbstractCheckoutJob::AbstractCheckoutJob(QObject *parent) :
QObject(parent)
namespace Internal {
// Use a terminal-less process to suppress SSH prompts.
static inline QSharedPointer<QProcess> createProcess()
{
unsigned flags = 0;
if (VCSBasePlugin::isSshPromptConfigured())
flags = Utils::SynchronousProcess::UnixTerminalDisabled;
return Utils::SynchronousProcess::createProcess(flags);
}
struct ProcessCheckoutJobStep
class ProcessCheckoutJobStep
{
public:
ProcessCheckoutJobStep() {}
explicit ProcessCheckoutJobStep(const QString &bin,
const QStringList &args,
......@@ -74,7 +81,9 @@ struct ProcessCheckoutJobStep
QProcessEnvironment environment;
};
struct ProcessCheckoutJobPrivate {
class ProcessCheckoutJobPrivate
{
public:
ProcessCheckoutJobPrivate();
QSharedPointer<QProcess> process;
......@@ -82,13 +91,16 @@ struct ProcessCheckoutJobPrivate {
QString binary;
};
// Use a terminal-less process to suppress SSH prompts.
static inline QSharedPointer<QProcess> createProcess()
ProcessCheckoutJobPrivate::ProcessCheckoutJobPrivate() :
process(createProcess())
{
}
} // namespace Internal
AbstractCheckoutJob::AbstractCheckoutJob(QObject *parent) :
QObject(parent)
{
unsigned flags = 0;
if (VCSBasePlugin::isSshPromptConfigured())
flags = Utils::SynchronousProcess::UnixTerminalDisabled;
return Utils::SynchronousProcess::createProcess(flags);
}
/*!
......@@ -97,14 +109,9 @@ static inline QSharedPointer<QProcess> createProcess()
\brief Convenience implementation of a VCSBase::AbstractCheckoutJob using a QProcess.
*/
ProcessCheckoutJobPrivate::ProcessCheckoutJobPrivate() :
process(createProcess())
{
}
ProcessCheckoutJob::ProcessCheckoutJob(QObject *parent) :
AbstractCheckoutJob(parent),
d(new ProcessCheckoutJobPrivate)
d(new Internal::ProcessCheckoutJobPrivate)
{
connect(d->process.data(), SIGNAL(error(QProcess::ProcessError)), this, SLOT(slotError(QProcess::ProcessError)));
connect(d->process.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotFinished(int,QProcess::ExitStatus)));
......@@ -125,7 +132,7 @@ void ProcessCheckoutJob::addStep(const QString &binary,
{
if (debug)
qDebug() << "ProcessCheckoutJob::addStep" << binary << args << workingDirectory;
d->stepQueue.enqueue(ProcessCheckoutJobStep(binary, args, workingDirectory, env));
d->stepQueue.enqueue(Internal::ProcessCheckoutJobStep(binary, args, workingDirectory, env));
}
void ProcessCheckoutJob::slotOutput()
......@@ -183,7 +190,7 @@ void ProcessCheckoutJob::slotNext()
return;
}
// Launch next
const ProcessCheckoutJobStep step = d->stepQueue.dequeue();
const Internal::ProcessCheckoutJobStep step = d->stepQueue.dequeue();
d->process->setWorkingDirectory(step.workingDirectory);
// Set up SSH correctly.
......
......@@ -47,7 +47,9 @@ QT_END_NAMESPACE
namespace VCSBase {
struct ProcessCheckoutJobPrivate;
namespace Internal {
class ProcessCheckoutJobPrivate;
} // namespace Internal
/* Abstract base class for a job creating an initial project checkout.
* It should be something that runs in the background producing log
......@@ -91,7 +93,7 @@ private slots:
void slotNext();
private:
ProcessCheckoutJobPrivate *d;
Internal::ProcessCheckoutJobPrivate *const d;
};
} // namespace VCSBase
......
......@@ -52,16 +52,8 @@
#include <QtCore/QFuture>
#include <QtCore/QtConcurrentRun>
/*!
\class VCSBase::CleanDialog
\brief File selector dialog for files not under version control.
Completely clean a directory under version control
from all files that are not under version control based on a list
generated from the version control system. Presents the user with
a checkable list of files and/or directories. Double click opens a file.
*/
namespace VCSBase {
namespace Internal {
enum { nameColumn, columnCount };
enum { fileNameRole = Qt::UserRole, isDirectoryRole = Qt::UserRole + 1 };
......@@ -91,12 +83,11 @@ static void removeFileRecursion(const QFileInfo &f, QString *errorMessage)
}
}
namespace VCSBase {
// A QFuture task for cleaning files in the background.
// Emits error signal if not all files can be deleted.
class CleanFilesTask : public QObject {
Q_OBJECT
public:
explicit CleanFilesTask(const QString &repository, const QStringList &files);
......@@ -134,7 +125,10 @@ void CleanFilesTask::run()
}
// ---------------- CleanDialogPrivate ----------------
struct CleanDialogPrivate {
class CleanDialogPrivate
{
public:
CleanDialogPrivate();
Internal::Ui::CleanDialog ui;
......@@ -146,9 +140,22 @@ CleanDialogPrivate::CleanDialogPrivate() : m_filesModel(new QStandardItemModel(0
{
}
} // namespace Internal
/*!
\class VCSBase::CleanDialog
\brief File selector dialog for files not under version control.
Completely clean a directory under version control
from all files that are not under version control based on a list
generated from the version control system. Presents the user with
a checkable list of files and/or directories. Double click opens a file.
*/
CleanDialog::CleanDialog(QWidget *parent) :
QDialog(parent),
d(new CleanDialogPrivate)
d(new Internal::CleanDialogPrivate)
{
setModal(true);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
......@@ -200,8 +207,8 @@ void CleanDialog::setFileList(const QString &workingDirectory, const QStringList
|| fileName.endsWith(qmlProUserSuffix));
nameItem->setCheckable(true);
nameItem->setCheckState(saveFile ? Qt::Unchecked : Qt::Checked);
nameItem->setData(QVariant(fi.absoluteFilePath()), fileNameRole);
nameItem->setData(QVariant(isDir), isDirectoryRole);
nameItem->setData(QVariant(fi.absoluteFilePath()), Internal::fileNameRole);
nameItem->setData(QVariant(isDir), Internal::isDirectoryRole);
// Tooltip with size information
if (fi.isFile()) {
const QString lastModified = fi.lastModified().toString(Qt::DefaultLocaleShortDate);
......@@ -222,7 +229,7 @@ QStringList CleanDialog::checkedFiles() const
for (int r = 0; r < rowCount; r++) {
const QStandardItem *item = d->m_filesModel->item(r, 0);
if (item->checkState() == Qt::Checked)
rc.push_back(item->data(fileNameRole).toString());
rc.push_back(item->data(Internal::fileNameRole).toString());
}
}
return rc;
......@@ -247,12 +254,12 @@ bool CleanDialog::promptToDelete()
return false;
// Remove in background
CleanFilesTask *cleanTask = new CleanFilesTask(d->m_workingDirectory, selectedFiles);
Internal::CleanFilesTask *cleanTask = new Internal::CleanFilesTask(d->m_workingDirectory, selectedFiles);
connect(cleanTask, SIGNAL(error(QString)),
VCSBase::VCSBaseOutputWindow::instance(), SLOT(appendSilently(QString)),
Qt::QueuedConnection);
QFuture<void> task = QtConcurrent::run(cleanTask, &CleanFilesTask::run);
QFuture<void> task = QtConcurrent::run(cleanTask, &Internal::CleanFilesTask::run);
const QString taskName = tr("Cleaning %1").
arg(QDir::toNativeSeparators(d->m_workingDirectory));
Core::ICore::instance()->progressManager()->addTask(task, taskName,
......@@ -264,8 +271,8 @@ void CleanDialog::slotDoubleClicked(const QModelIndex &index)
{
// Open file on doubleclick
if (const QStandardItem *item = d->m_filesModel->itemFromIndex(index))
if (!item->data(isDirectoryRole).toBool()) {
const QString fname = item->data(fileNameRole).toString();
if (!item->data(Internal::isDirectoryRole).toBool()) {
const QString fname = item->data(Internal::fileNameRole).toString();
Core::EditorManager::instance()->openEditor(fname, Core::Id(), Core::EditorManager::ModeSwitch);
}
}
......
......@@ -42,7 +42,10 @@ class QModelIndex;
QT_END_NAMESPACE
namespace VCSBase {
struct CleanDialogPrivate;
namespace Internal {
class CleanDialogPrivate;
} // namespace Internal
class VCSBASE_EXPORT CleanDialog : public QDialog {
Q_OBJECT
......@@ -65,7 +68,7 @@ private:
QStringList checkedFiles() const;
bool promptToDelete();
CleanDialogPrivate *d;
Internal::CleanDialogPrivate *const d;
};
} // namespace VCSBase
......
......@@ -47,8 +47,6 @@
Q_DECLARE_METATYPE(QVariant)
namespace VCSBase {
static QString msgTermination(int exitCode, const QString &binaryPath, const QStringList &args)
{
QString cmd = QFileInfo(binaryPath).baseName();
......@@ -61,6 +59,9 @@ static QString msgTermination(int exitCode, const QString &binaryPath, const QSt
QCoreApplication::translate("VcsCommand", "\n'%1' completed (exit code %2).\n").arg(cmd).arg(exitCode);
}
namespace VCSBase {
namespace Internal {
class CommandPrivate
{
public:
......@@ -112,10 +113,12 @@ CommandPrivate::Job::Job(const QStringList &a, int t) :
Q_UNUSED(qvMetaId)
}
} // namespace Internal
Command::Command(const QString &binary,
const QString &workingDirectory,
const QProcessEnvironment &environment) :
d(new CommandPrivate(binary, workingDirectory, environment))
d(new Internal::CommandPrivate(binary, workingDirectory, environment))
{
}
......@@ -176,14 +179,11 @@ void Command::addJob(const QStringList &arguments)
void Command::addJob(const QStringList &arguments, int timeout)
{
d->m_jobs.push_back(CommandPrivate::Job(arguments, timeout));
d->m_jobs.push_back(Internal::CommandPrivate::Job(arguments, timeout));
}
void Command::execute()
{
if (Constants::Internal::debug)
qDebug() << "Command::execute" << d->m_workingDirectory << d->m_jobs.size();
d->m_lastExecSuccess = false;
d->m_lastExecExitCode = -1;
......@@ -217,10 +217,6 @@ QString Command::msgTimeout(int seconds)
void Command::run()
{
if (Constants::Internal::debug)
qDebug() << "Command::run" << workingDirectory() << d->m_jobs.size()
<< "terminal_disabled" << unixTerminalDisabled();
// Check that the binary path is not empty
if (binaryPath().trimmed().isEmpty()) {
emit errorText(tr("Unable to start process, binary is empty"));
......@@ -244,9 +240,6 @@ void Command::run()
int exitCode = -1;
bool ok = true;
for (int j = 0; j < count; j++) {
if (Constants::Internal::debug)
qDebug() << "Command::run" << j << '/' << count << d->m_jobs.at(j).arguments;
process->start(binaryPath(), d->m_jobs.at(j).arguments);
if (!process->waitForStarted()) {
ok = false;
......
......@@ -42,6 +42,10 @@
namespace VCSBase {
namespace Internal {
class CommandPrivate;
} // namespace Internal
class VCSBASE_EXPORT Command : public QObject
{
Q_OBJECT
......@@ -97,7 +101,7 @@ signals:
void success(const QVariant &cookie);
private:
class CommandPrivate *d;
class Internal::CommandPrivate *const d;
};
} //namespace VCSBase
......
......@@ -44,8 +44,9 @@ namespace VCSBase {
namespace Internal {
// Common VCS settings, message check script and user nick names.
struct CommonVcsSettings
class CommonVcsSettings
{
public:
CommonVcsSettings();
QString nickNameMailMap;
......
......@@ -71,7 +71,7 @@ public:
QRegExp filePattern() const;
private:
Internal::DiffHighlighterPrivate *d;
Internal::DiffHighlighterPrivate *const d;
};
} // namespace VCSBase
......
......@@ -61,7 +61,8 @@ namespace Internal {
// For code clarity, a struct representing the entries of a mail map file
// with parse and model functions.
struct NickNameEntry {
class NickNameEntry {
public:
void clear();
bool parse(const QString &);
QString nickName() const;
......
......@@ -154,8 +154,6 @@ unsigned SubmitFileModel::filter(const QStringList &filter, int column)
qDeleteAll(takeRow(r));
rc++;
}
if (VCSBase::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << " deleted " << rc << " items using " << filter << " , remaining " << rowCount();
return rc;
}
......
......@@ -67,6 +67,6 @@ public:
unsigned filter(const QStringList &filter, int column);
};
}
} // namespace VCSBase
#endif // SUBMITMODEL_H
......@@ -601,9 +601,6 @@ Command *VCSBaseClient::createCommand(const QString &workingDirectory,
VCSBase::VCSBaseEditorWidget *editor,
JobOutputBindMode mode)
{
if (Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << workingDirectory << editor;
Command *cmd = new Command(d->m_clientSettings->stringValue(VCSBaseClientSettings::binaryPathKey),
workingDirectory, processEnvironment());
cmd->setDefaultTimeout(d->m_clientSettings->intValue(VCSBaseClientSettings::timeoutKey));
......
......@@ -63,8 +63,9 @@ class VCSBASE_EXPORT VCSBaseClient : public QObject
Q_OBJECT
public:
struct VCSBASE_EXPORT StatusItem
class VCSBASE_EXPORT StatusItem
{
public:
StatusItem();
StatusItem(const QString &s, const QString &f);
QString flags;
......
......@@ -156,6 +156,7 @@ bool operator==(const SettingValue &lhs, const SettingValue &rhs)
namespace VCSBase {
namespace Internal {
class VCSBaseClientSettingsPrivate : public QSharedData
{
public:
......@@ -176,6 +177,8 @@ public:
QString m_settingsGroup;
};
} // namespace Internal
/*!
\class VCSBase::VCSBaseClientSettings
......@@ -192,7 +195,7 @@ const QLatin1String VCSBaseClientSettings::promptOnSubmitKey("PromptOnSubmit");
const QLatin1String VCSBaseClientSettings::timeoutKey("Timeout");
VCSBaseClientSettings::VCSBaseClientSettings() :
d(new VCSBaseClientSettingsPrivate)
d(new Internal::VCSBaseClientSettingsPrivate)
{
declareKey(binaryPathKey, QLatin1String(""));
declareKey(userNameKey, QLatin1String(""));
......
......@@ -45,7 +45,9 @@ QT_END_NAMESPACE
namespace VCSBase {
namespace Internal {
class VCSBaseClientSettingsPrivate;
} // namespace Internal
class VCSBASE_EXPORT VCSBaseClientSettings
{
......@@ -93,7 +95,7 @@ protected:
private: