OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / mercurial / mercurialplugin.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2009 Brian McGillion
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
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.
18 **
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.
22 **
23 ** Other Usage
24 **
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.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef MERCURIALPLUGIN_H
34 #define MERCURIALPLUGIN_H
35
36 #include "mercurialsettings.h"
37
38 #include <vcsbase/vcsbaseplugin.h>
39 #include <coreplugin/icontext.h>
40
41 #include <QtCore/QFileInfo>
42 #include <QtCore/QHash>
43 #include <QtCore/qglobal.h>
44
45 QT_BEGIN_NAMESPACE
46 class QAction;
47 class QTemporaryFile;
48 QT_END_NAMESPACE
49
50 namespace Core {
51 class ActionManager;
52 class ActionContainer;
53 class ICore;
54 class Id;
55 class IVersionControl;
56 class IEditorFactory;
57 class IEditor;
58 } // namespace Core
59
60 namespace Utils {
61 class ParameterAction;
62 } //namespace Utils
63
64 namespace VCSBase {
65 class VCSBaseSubmitEditor;
66 }
67
68 namespace Locator {
69     class CommandLocator;
70 }
71
72 namespace Mercurial {
73 namespace Internal {
74
75 class OptionsPage;
76 class MercurialClient;
77 class MercurialControl;
78 class MercurialEditor;
79 class MercurialSettings;
80
81 class MercurialPlugin : public VCSBase::VCSBasePlugin
82 {
83     Q_OBJECT
84
85 public:
86     MercurialPlugin();
87     virtual ~MercurialPlugin();
88     bool initialize(const QStringList &arguments, QString *error_message);
89
90     static MercurialPlugin *instance() { return m_instance; }
91     MercurialClient *client() const { return m_client; }
92
93     QStringList standardArguments() const;
94
95     const MercurialSettings &settings() const;
96     void setSettings(const MercurialSettings &settings);
97
98 private slots:
99     // File menu action Slots
100     void addCurrentFile();
101     void annotateCurrentFile();
102     void diffCurrentFile();
103     void logCurrentFile();
104     void revertCurrentFile();
105     void statusCurrentFile();
106
107     //Directory menu Action slots
108     void diffRepository();
109     void logRepository();
110     void revertMulti();
111     void statusMulti();
112
113     //repository menu action slots
114     void pull();
115     void push();
116     void update();
117     void import();
118     void incoming();
119     void outgoing();
120     void commit();
121     void showCommitWidget(const QList<QPair<QString, QString> > &status);
122     void commitFromEditor();
123     void diffFromEditorSelected(const QStringList &files);
124
125     //TODO implement
126    /* //repository management action slots
127     void merge();
128     void branch();
129     void heads();
130     void parents();
131     void tags();
132     void tip();
133     void paths();
134
135     //less used repository action
136     void init();
137     void serve();*/
138
139 protected:
140     virtual void updateActions(VCSBase::VCSBasePlugin::ActionState);
141     virtual bool submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *submitEditor);
142
143 private:
144     //methods
145     void createMenu();
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();
154
155     //Variables
156     static MercurialPlugin *m_instance;
157     MercurialSettings mercurialSettings;
158     OptionsPage *optionsPage;
159     MercurialClient *m_client;
160
161     Core::ICore *core;
162     Locator::CommandLocator *m_commandLocator;
163     Core::ActionManager *actionManager;
164     Core::ActionContainer *mercurialContainer;
165
166     QList<QAction *> m_repositoryActionList;
167     QTemporaryFile *changeLog;
168
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;
178
179     QAction *m_createRepositoryAction;
180     //submit editor actions
181     QAction *editorCommit;
182     QAction *editorDiff;
183     QAction *editorUndo;
184     QAction *editorRedo;
185     QAction *m_menuAction;
186
187     QString m_submitRepository;
188 };
189
190 } //namespace Internal
191 } //namespace Mercurial
192
193 #endif // MERCURIALPLUGIN_H