1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2009 Brian McGillion
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #ifndef MERCURIALPLUGIN_H
34 #define MERCURIALPLUGIN_H
36 #include "mercurialsettings.h"
38 #include <vcsbase/vcsbaseplugin.h>
39 #include <coreplugin/icontext.h>
41 #include <QtCore/QFileInfo>
42 #include <QtCore/QHash>
43 #include <QtCore/qglobal.h>
52 class ActionContainer;
55 class IVersionControl;
61 class ParameterAction;
65 class VCSBaseSubmitEditor;
76 class MercurialClient;
77 class MercurialControl;
78 class MercurialEditor;
79 class MercurialSettings;
81 class MercurialPlugin : public VCSBase::VCSBasePlugin
87 virtual ~MercurialPlugin();
88 bool initialize(const QStringList &arguments, QString *error_message);
90 static MercurialPlugin *instance() { return m_instance; }
91 MercurialClient *client() const { return m_client; }
93 QStringList standardArguments() const;
95 const MercurialSettings &settings() const;
96 void setSettings(const MercurialSettings &settings);
99 // File menu action Slots
100 void addCurrentFile();
101 void annotateCurrentFile();
102 void diffCurrentFile();
103 void logCurrentFile();
104 void revertCurrentFile();
105 void statusCurrentFile();
107 //Directory menu Action slots
108 void diffRepository();
109 void logRepository();
113 //repository menu action slots
121 void showCommitWidget(const QList<QPair<QString, QString> > &status);
122 void commitFromEditor();
123 void diffFromEditorSelected(const QStringList &files);
126 /* //repository management action slots
135 //less used repository action
140 virtual void updateActions(VCSBase::VCSBasePlugin::ActionState);
141 virtual bool submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *submitEditor);
146 void createSubmitEditorActions();
147 void createSeparator(const Core::Context &context, const Core::Id &id);
148 void createFileActions(const Core::Context &context);
149 void createDirectoryActions(const Core::Context &context);
150 void createRepositoryActions(const Core::Context &context);
151 void createRepositoryManagementActions(const Core::Context &context);
152 void createLessUsedActions(const Core::Context &context);
153 void deleteCommitLog();
156 static MercurialPlugin *m_instance;
157 MercurialSettings mercurialSettings;
158 OptionsPage *optionsPage;
159 MercurialClient *m_client;
162 Locator::CommandLocator *m_commandLocator;
163 Core::ActionManager *actionManager;
164 Core::ActionContainer *mercurialContainer;
166 QList<QAction *> m_repositoryActionList;
167 QTemporaryFile *changeLog;
169 //Menu Items (file actions)
170 Utils::ParameterAction *m_addAction;
171 Utils::ParameterAction *m_deleteAction;
172 Utils::ParameterAction *annotateFile;
173 Utils::ParameterAction *diffFile;
174 Utils::ParameterAction *logFile;
175 Utils::ParameterAction *renameFile;
176 Utils::ParameterAction *revertFile;
177 Utils::ParameterAction *statusFile;
179 QAction *m_createRepositoryAction;
180 //submit editor actions
181 QAction *editorCommit;
185 QAction *m_menuAction;
187 QString m_submitRepository;
190 } //namespace Internal
191 } //namespace Mercurial
193 #endif // MERCURIALPLUGIN_H