2009-11-02 18:50:06 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2009 Brian McGillion
|
|
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2009-11-02 18:50:06 +01:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2009-11-02 18:50:06 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2009-11-02 18:50:06 +01:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2009-09-15 13:03:13 +03:00
|
|
|
#ifndef MERCURIALPLUGIN_H
|
|
|
|
|
#define MERCURIALPLUGIN_H
|
|
|
|
|
|
2009-11-06 12:32:38 +01:00
|
|
|
#include "mercurialsettings.h"
|
|
|
|
|
|
2011-08-22 15:33:03 +00:00
|
|
|
#include <vcsbase/vcsbaseclient.h>
|
2009-12-08 14:28:00 +01:00
|
|
|
#include <vcsbase/vcsbaseplugin.h>
|
2010-06-25 12:56:16 +02:00
|
|
|
#include <coreplugin/icontext.h>
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
|
#include <QtCore/QFileInfo>
|
|
|
|
|
#include <QtCore/QHash>
|
|
|
|
|
#include <QtCore/qglobal.h>
|
|
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QAction;
|
|
|
|
|
class QTemporaryFile;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
class ActionManager;
|
|
|
|
|
class ActionContainer;
|
|
|
|
|
class ICore;
|
2010-09-10 14:13:19 +02:00
|
|
|
class Id;
|
2009-09-15 13:03:13 +03:00
|
|
|
class IVersionControl;
|
|
|
|
|
class IEditorFactory;
|
|
|
|
|
class IEditor;
|
2009-11-02 19:52:28 +01:00
|
|
|
} // namespace Core
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
|
namespace Utils {
|
|
|
|
|
class ParameterAction;
|
|
|
|
|
} //namespace Utils
|
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
namespace VCSBase {
|
|
|
|
|
class VCSBaseSubmitEditor;
|
2009-09-15 13:03:13 +03:00
|
|
|
}
|
|
|
|
|
|
2010-02-12 16:03:08 +01:00
|
|
|
namespace Locator {
|
|
|
|
|
class CommandLocator;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-15 13:03:13 +03:00
|
|
|
namespace Mercurial {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class OptionsPage;
|
|
|
|
|
class MercurialClient;
|
|
|
|
|
class MercurialControl;
|
|
|
|
|
class MercurialEditor;
|
|
|
|
|
class MercurialSettings;
|
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
class MercurialPlugin : public VCSBase::VCSBasePlugin
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
MercurialPlugin();
|
|
|
|
|
virtual ~MercurialPlugin();
|
2011-09-21 13:05:15 +02:00
|
|
|
bool initialize(const QStringList &arguments, QString *errorMessage);
|
2010-04-26 09:12:58 +02:00
|
|
|
|
2009-09-15 13:03:13 +03:00
|
|
|
static MercurialPlugin *instance() { return m_instance; }
|
2010-01-08 09:44:07 +01:00
|
|
|
MercurialClient *client() const { return m_client; }
|
2009-12-08 14:28:00 +01:00
|
|
|
|
2009-11-06 12:32:38 +01:00
|
|
|
const MercurialSettings &settings() const;
|
|
|
|
|
void setSettings(const MercurialSettings &settings);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
// File menu action Slots
|
2010-01-11 15:22:17 +01:00
|
|
|
void addCurrentFile();
|
2009-09-15 13:03:13 +03:00
|
|
|
void annotateCurrentFile();
|
|
|
|
|
void diffCurrentFile();
|
|
|
|
|
void logCurrentFile();
|
|
|
|
|
void revertCurrentFile();
|
|
|
|
|
void statusCurrentFile();
|
|
|
|
|
|
|
|
|
|
//Directory menu Action slots
|
|
|
|
|
void diffRepository();
|
|
|
|
|
void logRepository();
|
|
|
|
|
void revertMulti();
|
|
|
|
|
void statusMulti();
|
|
|
|
|
|
|
|
|
|
//repository menu action slots
|
|
|
|
|
void pull();
|
|
|
|
|
void push();
|
|
|
|
|
void update();
|
|
|
|
|
void import();
|
|
|
|
|
void incoming();
|
|
|
|
|
void outgoing();
|
|
|
|
|
void commit();
|
2011-08-22 15:33:03 +00:00
|
|
|
void showCommitWidget(const QList<VCSBase::VCSBaseClient::StatusItem> &status);
|
2009-09-15 13:03:13 +03:00
|
|
|
void commitFromEditor();
|
|
|
|
|
void diffFromEditorSelected(const QStringList &files);
|
|
|
|
|
|
|
|
|
|
//TODO implement
|
|
|
|
|
/* //repository management action slots
|
|
|
|
|
void merge();
|
|
|
|
|
void branch();
|
|
|
|
|
void heads();
|
|
|
|
|
void parents();
|
|
|
|
|
void tags();
|
|
|
|
|
void tip();
|
|
|
|
|
void paths();
|
|
|
|
|
|
|
|
|
|
//less used repository action
|
|
|
|
|
void init();
|
|
|
|
|
void serve();*/
|
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
protected:
|
|
|
|
|
virtual void updateActions(VCSBase::VCSBasePlugin::ActionState);
|
|
|
|
|
virtual bool submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *submitEditor);
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
//methods
|
|
|
|
|
void createMenu();
|
|
|
|
|
void createSubmitEditorActions();
|
2010-09-10 14:13:19 +02:00
|
|
|
void createSeparator(const Core::Context &context, const Core::Id &id);
|
2010-06-25 12:56:16 +02:00
|
|
|
void createFileActions(const Core::Context &context);
|
|
|
|
|
void createDirectoryActions(const Core::Context &context);
|
|
|
|
|
void createRepositoryActions(const Core::Context &context);
|
|
|
|
|
void createRepositoryManagementActions(const Core::Context &context);
|
|
|
|
|
void createLessUsedActions(const Core::Context &context);
|
2009-09-15 13:03:13 +03:00
|
|
|
void deleteCommitLog();
|
|
|
|
|
|
|
|
|
|
//Variables
|
|
|
|
|
static MercurialPlugin *m_instance;
|
2009-11-06 12:32:38 +01:00
|
|
|
MercurialSettings mercurialSettings;
|
2009-09-15 13:03:13 +03:00
|
|
|
OptionsPage *optionsPage;
|
2010-01-08 09:44:07 +01:00
|
|
|
MercurialClient *m_client;
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
|
Core::ICore *core;
|
2010-02-12 16:03:08 +01:00
|
|
|
Locator::CommandLocator *m_commandLocator;
|
2009-09-15 13:03:13 +03:00
|
|
|
Core::ActionManager *actionManager;
|
|
|
|
|
Core::ActionContainer *mercurialContainer;
|
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
QList<QAction *> m_repositoryActionList;
|
2009-09-15 13:03:13 +03:00
|
|
|
QTemporaryFile *changeLog;
|
|
|
|
|
|
|
|
|
|
//Menu Items (file actions)
|
2010-01-11 15:22:17 +01:00
|
|
|
Utils::ParameterAction *m_addAction;
|
|
|
|
|
Utils::ParameterAction *m_deleteAction;
|
2009-11-02 19:52:28 +01:00
|
|
|
Utils::ParameterAction *annotateFile;
|
|
|
|
|
Utils::ParameterAction *diffFile;
|
|
|
|
|
Utils::ParameterAction *logFile;
|
|
|
|
|
Utils::ParameterAction *renameFile;
|
|
|
|
|
Utils::ParameterAction *revertFile;
|
|
|
|
|
Utils::ParameterAction *statusFile;
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2010-01-12 16:45:21 +01:00
|
|
|
QAction *m_createRepositoryAction;
|
2009-09-15 13:03:13 +03:00
|
|
|
//submit editor actions
|
|
|
|
|
QAction *editorCommit;
|
|
|
|
|
QAction *editorDiff;
|
|
|
|
|
QAction *editorUndo;
|
|
|
|
|
QAction *editorRedo;
|
2009-12-08 14:28:00 +01:00
|
|
|
QAction *m_menuAction;
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
QString m_submitRepository;
|
2009-09-15 13:03:13 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} //namespace Internal
|
|
|
|
|
} //namespace Mercurial
|
|
|
|
|
|
|
|
|
|
#endif // MERCURIALPLUGIN_H
|