2009-11-02 18:50:06 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (c) 2013 Brian McGillion
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2009-11-02 18:50:06 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-11-02 18:50:06 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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 Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2009-11-02 18:50:06 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, 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.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
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
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QAction;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
class ActionContainer;
|
2012-01-07 14:32:59 +01:00
|
|
|
class ActionManager;
|
2009-09-15 13:03:13 +03:00
|
|
|
class ICore;
|
2010-09-10 14:13:19 +02:00
|
|
|
class Id;
|
2009-09-15 13:03:13 +03:00
|
|
|
class IEditor;
|
2009-11-02 19:52:28 +01:00
|
|
|
} // namespace Core
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2012-01-07 14:32:59 +01:00
|
|
|
namespace Utils { class ParameterAction; }
|
|
|
|
|
namespace VcsBase { class VcsBaseSubmitEditor; }
|
|
|
|
|
namespace Locator { class CommandLocator; }
|
2010-02-12 16:03:08 +01:00
|
|
|
|
2009-09-15 13:03:13 +03:00
|
|
|
namespace Mercurial {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class OptionsPage;
|
|
|
|
|
class MercurialClient;
|
|
|
|
|
class MercurialControl;
|
|
|
|
|
class MercurialEditor;
|
|
|
|
|
class MercurialSettings;
|
|
|
|
|
|
2012-01-07 12:31:48 +01:00
|
|
|
class MercurialPlugin : public VcsBase::VcsBasePlugin
|
2009-09-15 13:03:13 +03:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2012-02-21 16:52:28 +01:00
|
|
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Mercurial.json")
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
MercurialPlugin();
|
2013-01-17 21:51:27 +02:00
|
|
|
~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:
|
2012-01-07 14:32:59 +01:00
|
|
|
// 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();
|
|
|
|
|
|
2012-01-07 14:32:59 +01:00
|
|
|
// Directory menu action slots
|
2009-09-15 13:03:13 +03:00
|
|
|
void diffRepository();
|
|
|
|
|
void logRepository();
|
|
|
|
|
void revertMulti();
|
|
|
|
|
void statusMulti();
|
|
|
|
|
|
2012-01-07 14:32:59 +01:00
|
|
|
// Repository menu action slots
|
2009-09-15 13:03:13 +03:00
|
|
|
void pull();
|
|
|
|
|
void push();
|
|
|
|
|
void update();
|
|
|
|
|
void import();
|
|
|
|
|
void incoming();
|
|
|
|
|
void outgoing();
|
|
|
|
|
void commit();
|
2012-01-07 12:31:48 +01:00
|
|
|
void showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusItem> &status);
|
2009-09-15 13:03:13 +03:00
|
|
|
void commitFromEditor();
|
|
|
|
|
void diffFromEditorSelected(const QStringList &files);
|
2013-01-21 22:56:01 +02:00
|
|
|
#ifdef WITH_TESTS
|
|
|
|
|
void testDiffFileResolving_data();
|
|
|
|
|
void testDiffFileResolving();
|
2013-01-28 22:02:35 +02:00
|
|
|
void testLogResolving();
|
2013-01-21 22:56:01 +02:00
|
|
|
#endif
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
|
//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:
|
2013-01-17 21:51:27 +02:00
|
|
|
void updateActions(VcsBase::VcsBasePlugin::ActionState);
|
2013-04-18 12:06:43 +02:00
|
|
|
bool submitEditorAboutToClose();
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void createMenu();
|
|
|
|
|
void createSubmitEditorActions();
|
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
|
|
|
|
2012-01-07 14:32:59 +01:00
|
|
|
// Variables
|
2009-09-15 13:03:13 +03:00
|
|
|
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::ActionContainer *mercurialContainer;
|
|
|
|
|
|
2009-12-08 14:28:00 +01:00
|
|
|
QList<QAction *> m_repositoryActionList;
|
2009-09-15 13:03:13 +03:00
|
|
|
|
2012-01-07 14:32:59 +01:00
|
|
|
// 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;
|
2012-01-07 14:32:59 +01:00
|
|
|
// Submit editor actions
|
2009-09-15 13:03:13 +03:00
|
|
|
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;
|
2012-09-26 15:18:44 +02:00
|
|
|
|
|
|
|
|
bool m_submitActionTriggered;
|
2009-09-15 13:03:13 +03:00
|
|
|
};
|
|
|
|
|
|
2012-01-07 14:32:59 +01:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Mercurial
|
2009-09-15 13:03:13 +03:00
|
|
|
|
|
|
|
|
#endif // MERCURIALPLUGIN_H
|