OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / bazaar / bazaarplugin.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2010 Hugues Delorme
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 BAZAARPLUGIN_H
34 #define BAZAARPLUGIN_H
35
36 #include "bazaarsettings.h"
37
38 #include <vcsbase/vcsbaseclientsettings.h>
39 #include <vcsbase/vcsbaseplugin.h>
40 #include <coreplugin/icontext.h>
41
42 #include <QtCore/QFileInfo>
43 #include <QtCore/QHash>
44 #include <QtCore/qglobal.h>
45
46 QT_BEGIN_NAMESPACE
47 class QAction;
48 class QTemporaryFile;
49 QT_END_NAMESPACE
50
51 namespace Core {
52 class ActionManager;
53 class ActionContainer;
54 class ICore;
55 class Id;
56 class IVersionControl;
57 class IEditorFactory;
58 class IEditor;
59 } // namespace Core
60
61 namespace Utils {
62 class ParameterAction;
63 } //namespace Utils
64
65 namespace VCSBase {
66 class VCSBaseSubmitEditor;
67 }
68
69 namespace Locator {
70     class CommandLocator;
71 }
72
73 namespace Bazaar {
74 namespace Internal {
75
76 class OptionsPage;
77 class BazaarClient;
78 class BazaarControl;
79 class BazaarEditor;
80
81 class BazaarPlugin : public VCSBase::VCSBasePlugin
82 {
83     Q_OBJECT
84
85 public:
86     BazaarPlugin();
87     virtual ~BazaarPlugin();
88     bool initialize(const QStringList &arguments, QString *errorMessage);
89
90     static BazaarPlugin *instance();
91     BazaarClient *client() const;
92
93     const BazaarSettings &settings() const;
94     void setSettings(const BazaarSettings &settings);
95
96 private slots:
97     // File menu action slots
98     void addCurrentFile();
99     void annotateCurrentFile();
100     void diffCurrentFile();
101     void logCurrentFile();
102     void revertCurrentFile();
103     void statusCurrentFile();
104
105     // Directory menu action slots
106     void diffRepository();
107     void logRepository();
108     void revertAll();
109     void statusMulti();
110
111     // Repository menu action slots
112     void pull();
113     void push();
114     void update();
115     void commit();
116     void showCommitWidget(const QList<QPair<QString, QString> > &status);
117     void commitFromEditor();
118     void diffFromEditorSelected(const QStringList &files);
119
120 protected:
121     virtual void updateActions(VCSBase::VCSBasePlugin::ActionState);
122     virtual bool submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *submitEditor);
123
124 private:
125     // Methods
126     void createMenu();
127     void createSubmitEditorActions();
128     void createSeparator(const Core::Context &context, const Core::Id &id);
129     void createFileActions(const Core::Context &context);
130     void createDirectoryActions(const Core::Context &context);
131     void createRepositoryActions(const Core::Context &context);
132     void deleteCommitLog();
133
134     // Variables
135     static BazaarPlugin *m_instance;
136     BazaarSettings m_bazaarSettings;
137     OptionsPage *m_optionsPage;
138     BazaarClient *m_client;
139
140     Core::ICore *m_core;
141     Locator::CommandLocator *m_commandLocator;
142     Core::ActionManager *m_actionManager;
143     Core::ActionContainer *m_bazaarContainer;
144
145     QList<QAction *> m_repositoryActionList;
146     QTemporaryFile *m_changeLog;
147
148     // Menu Items (file actions)
149     Utils::ParameterAction *m_addAction;
150     Utils::ParameterAction *m_deleteAction;
151     Utils::ParameterAction *m_annotateFile;
152     Utils::ParameterAction *m_diffFile;
153     Utils::ParameterAction *m_logFile;
154     Utils::ParameterAction *m_renameFile;
155     Utils::ParameterAction *m_revertFile;
156     Utils::ParameterAction *m_statusFile;
157
158     // Submit editor actions
159     QAction *m_editorCommit;
160     QAction *m_editorDiff;
161     QAction *m_editorUndo;
162     QAction *m_editorRedo;
163     QAction *m_menuAction;
164
165     QString m_submitRepository;
166 };
167
168 } //namespace Internal
169 } //namespace Bazaar
170
171 #endif // BAZAARPLUGIN_H