Commit b9f92c29 authored by hjk's avatar hjk
Browse files

vcsmanager: coding convention

parent c5fb5bb4
......@@ -129,7 +129,7 @@ VariableManager *CoreImpl::variableManager() const
return m_mainwindow->variableManager();
}
VCSManager *CoreImpl::vcsManager() const
VcsManager *CoreImpl::vcsManager() const
{
return m_mainwindow->vcsManager();
}
......
......@@ -64,7 +64,7 @@ public:
ProgressManager *progressManager() const;
ScriptManager *scriptManager() const;
VariableManager *variableManager() const;
VCSManager *vcsManager() const;
VcsManager *vcsManager() const;
ModeManager *modeManager() const;
MimeDatabase *mimeDatabase() const;
HelpManager *helpManager() const;
......
......@@ -160,7 +160,7 @@
*/
/*!
\fn VCSManager *ICore::vcsManager() const
\fn VcsManager *ICore::vcsManager() const
\brief Returns the application's vcs manager.
The vcs manager can be used to e.g. retrieve information about
......
......@@ -59,7 +59,7 @@ class ScriptManager;
class SettingsDatabase;
class UniqueIDManager;
class VariableManager;
class VCSManager;
class VcsManager;
class CORE_EXPORT ICore : public QObject
{
......@@ -93,7 +93,7 @@ public:
virtual ProgressManager *progressManager() const = 0;
virtual ScriptManager *scriptManager() const = 0;
virtual VariableManager *variableManager() const = 0;
virtual VCSManager *vcsManager() const = 0;
virtual VcsManager *vcsManager() const = 0;
virtual ModeManager *modeManager() const = 0;
virtual MimeDatabase *mimeDatabase() const = 0;
virtual HelpManager *helpManager() const = 0;
......
......@@ -66,7 +66,7 @@ public:
* Returns whether files in this directory should be managed with this
* version control.
* If \a topLevel is non-null, it should return the topmost directory,
* for which this IVersionControl should be used. The VCSManager assumes
* for which this IVersionControl should be used. The VcsManager assumes
* that all files in the returned directory are managed by the same IVersionControl.
*/
......
......@@ -131,7 +131,7 @@ MainWindow::MainWindow() :
m_progressManager(new ProgressManagerPrivate()),
m_scriptManager(new ScriptManagerPrivate(this)),
m_variableManager(new VariableManager),
m_vcsManager(new VCSManager),
m_vcsManager(new VcsManager),
m_statusBarManager(0),
m_modeManager(0),
m_mimeDatabase(new MimeDatabase),
......@@ -1000,7 +1000,7 @@ MessageManager *MainWindow::messageManager() const
return m_messageManager;
}
VCSManager *MainWindow::vcsManager() const
VcsManager *MainWindow::vcsManager() const
{
return m_vcsManager;
}
......
......@@ -62,7 +62,7 @@ class ScriptManager;
class SettingsDatabase;
class UniqueIDManager;
class VariableManager;
class VCSManager;
class VcsManager;
namespace Internal {
......@@ -107,7 +107,7 @@ public:
Core::MimeDatabase *mimeDatabase() const;
Core::HelpManager *helpManager() const;
VCSManager *vcsManager() const;
VcsManager *vcsManager() const;
QSettings *settings(QSettings::Scope scope) const;
inline SettingsDatabase *settingsDatabase() const { return m_settingsDatabase; }
virtual QPrinter *printer() const;
......@@ -186,7 +186,7 @@ private:
ProgressManagerPrivate *m_progressManager;
ScriptManager *m_scriptManager;
QScopedPointer<VariableManager> m_variableManager;
VCSManager *m_vcsManager;
VcsManager *m_vcsManager;
StatusBarManager *m_statusBarManager;
ModeManager *m_modeManager;
MimeDatabase *m_mimeDatabase;
......
......@@ -59,22 +59,24 @@ static inline VersionControlList allVersionControls()
// ---- VCSManagerPrivate:
// Maintains a cache of top-level directory->version control.
struct VCSManagerPrivate {
class VcsManagerPrivate
{
public:
VersionControlCache m_cachedMatches;
};
VCSManager::VCSManager(QObject *parent) :
VcsManager::VcsManager(QObject *parent) :
QObject(parent),
m_d(new VCSManagerPrivate)
m_d(new VcsManagerPrivate)
{
}
VCSManager::~VCSManager()
VcsManager::~VcsManager()
{
delete m_d;
}
void VCSManager::extensionsInitialized()
void VcsManager::extensionsInitialized()
{
// Change signal connections
FileManager *fileManager = ICore::instance()->fileManager();
......@@ -91,7 +93,7 @@ static bool longerThanPath(QPair<QString, IVersionControl *> &pair1, QPair<QStri
return pair1.first.size() > pair2.first.size();
}
IVersionControl* VCSManager::findVersionControlForDirectory(const QString &directory,
IVersionControl* VcsManager::findVersionControlForDirectory(const QString &directory,
QString *topLevelDirectory)
{
typedef VersionControlCache::const_iterator VersionControlCacheConstIterator;
......@@ -181,14 +183,14 @@ IVersionControl* VCSManager::findVersionControlForDirectory(const QString &direc
return 0;
}
bool VCSManager::promptToDelete(const QString &fileName)
bool VcsManager::promptToDelete(const QString &fileName)
{
if (IVersionControl *vc = findVersionControlForDirectory(QFileInfo(fileName).absolutePath()))
return promptToDelete(vc, fileName);
return true;
}
IVersionControl *VCSManager::checkout(const QString &versionControlType,
IVersionControl *VcsManager::checkout(const QString &versionControlType,
const QString &directory,
const QByteArray &url)
{
......@@ -205,7 +207,7 @@ IVersionControl *VCSManager::checkout(const QString &versionControlType,
return 0;
}
bool VCSManager::findVersionControl(const QString &versionControlType)
bool VcsManager::findVersionControl(const QString &versionControlType)
{
foreach (IVersionControl * versionControl, allVersionControls()) {
if (versionControl->displayName() == versionControlType)
......@@ -214,7 +216,7 @@ bool VCSManager::findVersionControl(const QString &versionControlType)
return false;
}
QString VCSManager::repositoryUrl(const QString &directory)
QString VcsManager::repositoryUrl(const QString &directory)
{
IVersionControl *vc = findVersionControlForDirectory(directory);
......@@ -223,15 +225,14 @@ QString VCSManager::repositoryUrl(const QString &directory)
return QString();
}
bool VCSManager::promptToDelete(IVersionControl *vc, const QString &fileName)
bool VcsManager::promptToDelete(IVersionControl *vc, const QString &fileName)
{
QTC_ASSERT(vc, return true)
if (!vc->supportsOperation(IVersionControl::DeleteOperation))
return true;
const QString title = QCoreApplication::translate("VCSManager", "Version Control");
const QString msg = QCoreApplication::translate("VCSManager",
"Would you like to remove this file from the version control system (%1)?\n"
"Note: This might remove the local file.").arg(vc->displayName());
const QString title = tr("Version Control");
const QString msg = tr("Would you like to remove this file from the version control system (%1)?\n"
"Note: This might remove the local file.").arg(vc->displayName());
const QMessageBox::StandardButton button =
QMessageBox::question(0, title, msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if (button != QMessageBox::Yes)
......@@ -239,7 +240,7 @@ bool VCSManager::promptToDelete(IVersionControl *vc, const QString &fileName)
return vc->vcsDelete(fileName);
}
CORE_EXPORT QDebug operator<<(QDebug in, const VCSManager &v)
CORE_EXPORT QDebug operator<<(QDebug in, const VcsManager &v)
{
QDebug nospace = in.nospace();
const VersionControlCache::const_iterator cend = v.m_d->m_cachedMatches.constEnd();
......
......@@ -41,12 +41,12 @@ QT_END_NAMESPACE
namespace Core {
struct VCSManagerPrivate;
class VcsManagerPrivate;
class IVersionControl;
/* VCSManager:
/* VcsManager:
* 1) Provides functionality for finding the IVersionControl * for a given
* filename (findVersionControlForDirectory). Note that the VCSManager assumes
* filename (findVersionControlForDirectory). Note that the VcsManager assumes
* that if a IVersionControl * manages a directory, then it also manages
* all the files and all the subdirectories.
* It works by asking all IVersionControl * if they manage the file, and ask
......@@ -56,13 +56,12 @@ class IVersionControl;
* branching repositories and routes them to its signals (repositoryChanged,
* filesChanged). */
class CORE_EXPORT VCSManager : public QObject
class CORE_EXPORT VcsManager : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(VCSManager)
public:
explicit VCSManager(QObject *parent = 0);
virtual ~VCSManager();
explicit VcsManager(QObject *parent = 0);
virtual ~VcsManager();
void extensionsInitialized();
......@@ -82,16 +81,16 @@ public:
bool promptToDelete(const QString &fileName);
bool promptToDelete(IVersionControl *versionControl, const QString &fileName);
friend CORE_EXPORT QDebug operator<<(QDebug in, const VCSManager &);
friend CORE_EXPORT QDebug operator<<(QDebug in, const VcsManager &);
signals:
void repositoryChanged(const QString &repository);
private:
VCSManagerPrivate *m_d;
VcsManagerPrivate *m_d;
};
CORE_EXPORT QDebug operator<<(QDebug in, const VCSManager &);
CORE_EXPORT QDebug operator<<(QDebug in, const VcsManager &);
} // namespace Core
......
......@@ -102,7 +102,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
// Objects
m_modelManager = new CppModelManager(this);
Core::VCSManager *vcsManager = core->vcsManager();
Core::VcsManager *vcsManager = core->vcsManager();
Core::FileManager *fileManager = core->fileManager();
connect(vcsManager, SIGNAL(repositoryChanged(QString)),
m_modelManager, SLOT(updateModifiedSourceFiles()));
......
......@@ -1036,7 +1036,7 @@ void Qt4PriFileNode::changeFiles(const FileType fileType,
QFileInfo fi(m_projectFilePath);
if (!fi.isWritable()) {
// Try via vcs manager
Core::VCSManager *vcsManager = Core::ICore::instance()->vcsManager();
Core::VcsManager *vcsManager = Core::ICore::instance()->vcsManager();
Core::IVersionControl *versionControl = vcsManager->findVersionControlForDirectory(fi.absolutePath());
if (!versionControl || versionControl->vcsOpen(m_projectFilePath)) {
bool makeWritable = QFile::setPermissions(m_projectFilePath, fi.permissions() | QFile::WriteUser);
......
......@@ -202,7 +202,7 @@ void StateListener::slotStateChanged()
{
const ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
const Core::ICore *core = Core::ICore::instance();
Core::VCSManager *vcsManager = core->vcsManager();
Core::VcsManager *vcsManager = core->vcsManager();
// Get the current file. Are we on a temporary submit editor indicated by
// temporary path prefix or does the file contains a hash, indicating a project
......
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