Chris@57
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@57
|
2
|
Chris@57
|
3 /*
|
Chris@57
|
4 EasyMercurial
|
Chris@57
|
5
|
Chris@98
|
6 Based on hgExplorer by Jari Korhonen
|
Chris@57
|
7 Copyright (c) 2010 Jari Korhonen
|
Chris@57
|
8 Copyright (c) 2010 Chris Cannam
|
Chris@57
|
9 Copyright (c) 2010 Queen Mary, University of London
|
Chris@57
|
10
|
Chris@57
|
11 This program is free software; you can redistribute it and/or
|
Chris@57
|
12 modify it under the terms of the GNU General Public License as
|
Chris@57
|
13 published by the Free Software Foundation; either version 2 of the
|
Chris@57
|
14 License, or (at your option) any later version. See the file
|
Chris@57
|
15 COPYING included with this distribution for more information.
|
Chris@57
|
16 */
|
jtkorhonen@0
|
17
|
jtkorhonen@0
|
18 #ifndef MAINWINDOW_H
|
jtkorhonen@0
|
19 #define MAINWINDOW_H
|
jtkorhonen@0
|
20
|
Chris@96
|
21 #include "hgtabwidget.h"
|
jtkorhonen@0
|
22 #include "hgrunner.h"
|
jtkorhonen@0
|
23 #include "common.h"
|
Chris@106
|
24 #include "changeset.h"
|
jtkorhonen@0
|
25
|
Chris@50
|
26 #include <QMainWindow>
|
Chris@50
|
27 #include <QListWidget>
|
Chris@90
|
28 #include <QFileSystemWatcher>
|
Chris@50
|
29
|
jtkorhonen@0
|
30 QT_BEGIN_NAMESPACE
|
jtkorhonen@0
|
31 class QAction;
|
jtkorhonen@0
|
32 class QMenu;
|
jtkorhonen@0
|
33 QT_END_NAMESPACE
|
jtkorhonen@0
|
34
|
jtkorhonen@0
|
35 enum HGACTIONS
|
jtkorhonen@0
|
36 {
|
jtkorhonen@0
|
37 ACT_NONE,
|
Chris@74
|
38 ACT_PATHS,
|
Chris@106
|
39 ACT_BRANCH,
|
jtkorhonen@0
|
40 ACT_STAT,
|
jtkorhonen@0
|
41 ACT_HEADS,
|
jtkorhonen@0
|
42 ACT_PARENTS,
|
jtkorhonen@0
|
43 ACT_LOG,
|
jtkorhonen@0
|
44 ACT_REMOVE,
|
jtkorhonen@0
|
45 ACT_ADD,
|
jtkorhonen@0
|
46 ACT_INCOMING,
|
jtkorhonen@0
|
47 ACT_PUSH,
|
jtkorhonen@0
|
48 ACT_PULL,
|
jtkorhonen@0
|
49 ACT_CLONEFROMREMOTE,
|
jtkorhonen@0
|
50 ACT_INIT,
|
jtkorhonen@0
|
51 ACT_COMMIT,
|
jtkorhonen@0
|
52 ACT_ANNOTATE,
|
jtkorhonen@0
|
53 ACT_FILEDIFF,
|
jtkorhonen@0
|
54 ACT_FOLDERDIFF,
|
jtkorhonen@0
|
55 ACT_CHGSETDIFF,
|
jtkorhonen@0
|
56 ACT_UPDATE,
|
jtkorhonen@0
|
57 ACT_REVERT,
|
jtkorhonen@0
|
58 ACT_MERGE,
|
jtkorhonen@0
|
59 ACT_RESOLVE_LIST,
|
jtkorhonen@11
|
60 ACT_SERVE,
|
jtkorhonen@33
|
61 ACT_RESOLVE_MARK,
|
jtkorhonen@33
|
62 ACT_RETRY_MERGE,
|
jtkorhonen@34
|
63 ACT_TAG,
|
jtkorhonen@36
|
64 ACT_HG_IGNORE,
|
jtkorhonen@0
|
65 };
|
jtkorhonen@0
|
66
|
jtkorhonen@0
|
67
|
jtkorhonen@0
|
68 class MainWindow : public QMainWindow
|
jtkorhonen@0
|
69 {
|
jtkorhonen@0
|
70 Q_OBJECT
|
jtkorhonen@0
|
71
|
jtkorhonen@0
|
72 public:
|
jtkorhonen@0
|
73 MainWindow();
|
Chris@98
|
74 HgTabWidget *hgTabs;
|
jtkorhonen@0
|
75 void writeSettings();
|
jtkorhonen@0
|
76
|
jtkorhonen@0
|
77 //Paths to remote repo & workfolder
|
jtkorhonen@0
|
78 //Local repo is directory "./hg/" under work folder
|
jtkorhonen@0
|
79 QString remoteRepoPath;
|
jtkorhonen@0
|
80 QString workFolderPath;
|
Chris@106
|
81 QString currentBranch;
|
Chris@106
|
82 Changesets currentHeads;
|
Chris@108
|
83 Changesets currentParents;
|
jtkorhonen@0
|
84
|
jtkorhonen@0
|
85 protected:
|
jtkorhonen@0
|
86 void closeEvent(QCloseEvent *event);
|
jtkorhonen@0
|
87
|
jtkorhonen@0
|
88 public slots:
|
Chris@74
|
89 void hgPaths();
|
jtkorhonen@0
|
90 void hgStat();
|
jtkorhonen@0
|
91 void tabChanged(int currTab);
|
Chris@62
|
92 void commandCompleted();
|
Chris@62
|
93 void commandFailed();
|
Chris@95
|
94 void enableDisableActions();
|
jtkorhonen@0
|
95
|
jtkorhonen@0
|
96 private slots:
|
jtkorhonen@0
|
97 void about();
|
Chris@64
|
98 void settings();
|
Chris@69
|
99 void open();
|
Chris@64
|
100 void startupDialog();
|
Chris@94
|
101 void clearSelections();
|
Chris@64
|
102
|
jtkorhonen@0
|
103 void hgRemove();
|
jtkorhonen@0
|
104 void hgAdd();
|
jtkorhonen@0
|
105 void hgCommit();
|
jtkorhonen@0
|
106 void hgFileDiff();
|
jtkorhonen@0
|
107 void hgFolderDiff();
|
jtkorhonen@0
|
108 void hgChgSetDiff();
|
jtkorhonen@0
|
109 void hgUpdate();
|
jtkorhonen@0
|
110 void hgRevert();
|
jtkorhonen@0
|
111 void hgMerge();
|
jtkorhonen@33
|
112 void hgRetryMerge();
|
jtkorhonen@0
|
113 void hgCloneFromRemote();
|
jtkorhonen@0
|
114 void hgInit();
|
jtkorhonen@0
|
115 void hgIncoming();
|
jtkorhonen@0
|
116 void hgPush();
|
jtkorhonen@0
|
117 void hgPull();
|
jtkorhonen@0
|
118 void hgUpdateToRev();
|
jtkorhonen@0
|
119 void hgAnnotate();
|
jtkorhonen@0
|
120 void hgResolveList();
|
jtkorhonen@0
|
121 void hgResolveMark();
|
jtkorhonen@34
|
122 void hgTag();
|
jtkorhonen@11
|
123 void hgServe();
|
jtkorhonen@34
|
124 void hgIgnore();
|
jtkorhonen@0
|
125
|
Chris@90
|
126 void fsDirectoryChanged(QString);
|
Chris@90
|
127 void fsFileChanged(QString);
|
Chris@90
|
128
|
jtkorhonen@0
|
129 private:
|
Chris@106
|
130 void hgBranch();
|
jtkorhonen@0
|
131 void hgHeads();
|
jtkorhonen@0
|
132 void hgParents();
|
jtkorhonen@0
|
133 void hgLog();
|
jtkorhonen@0
|
134 void createActions();
|
jtkorhonen@0
|
135 void connectActions();
|
jtkorhonen@0
|
136 void createMenus();
|
jtkorhonen@0
|
137 void createToolBars();
|
jtkorhonen@0
|
138 void createStatusBar();
|
jtkorhonen@0
|
139 void readSettings();
|
jtkorhonen@0
|
140 void splitChangeSets(QStringList *list, QString hgLogOutput);
|
jtkorhonen@2
|
141 void presentLongStdoutToUser(QString stdo);
|
Chris@95
|
142
|
jtkorhonen@28
|
143 QString listAllUpIpV4Addresses();
|
jtkorhonen@34
|
144 QString filterTag(QString tag);
|
jtkorhonen@0
|
145
|
Chris@64
|
146 QString getUserInfo() const;
|
Chris@64
|
147
|
Chris@79
|
148 bool openLocal(QString);
|
Chris@79
|
149 bool openRemote(QString, QString);
|
Chris@79
|
150 bool openInit(QString);
|
Chris@79
|
151
|
Chris@79
|
152 bool complainAboutFilePath(QString);
|
Chris@79
|
153 bool complainAboutUnknownFolder(QString);
|
Chris@84
|
154 bool complainAboutInitInRepo(QString);
|
Chris@84
|
155 bool complainAboutInitFile(QString);
|
Chris@84
|
156 bool complainAboutCloneToExisting(QString);
|
Chris@84
|
157 bool complainAboutCloneToFile(QString);
|
Chris@84
|
158 bool complainAboutCloneToExistingFolder(QString); //!!! not sure about this one
|
Chris@84
|
159
|
Chris@79
|
160 bool askToInitExisting(QString);
|
Chris@79
|
161 bool askToInitNew(QString);
|
Chris@79
|
162 bool askToOpenParentRepo(QString, QString);
|
Chris@84
|
163 bool askToOpenInsteadOfInit(QString);
|
Chris@79
|
164
|
Chris@90
|
165 void updateFileSystemWatcher();
|
Chris@90
|
166
|
Chris@64
|
167 bool firstStart;
|
Chris@64
|
168
|
jtkorhonen@0
|
169 //Actions enabled flags
|
jtkorhonen@0
|
170 bool remoteRepoActionsEnabled;
|
jtkorhonen@0
|
171 bool localRepoActionsEnabled;
|
jtkorhonen@0
|
172
|
jtkorhonen@0
|
173 //File menu actions
|
jtkorhonen@0
|
174 QAction *hgInitAct;
|
jtkorhonen@0
|
175 QAction *hgCloneFromRemoteAct;
|
Chris@69
|
176 QAction *openAct;
|
jtkorhonen@0
|
177 QAction *settingsAct;
|
jtkorhonen@0
|
178 QAction *exitAct;
|
jtkorhonen@0
|
179
|
jtkorhonen@33
|
180 //Repo actions
|
jtkorhonen@0
|
181 QAction *hgIncomingAct;
|
jtkorhonen@0
|
182 QAction *hgPushAct;
|
jtkorhonen@0
|
183 QAction *hgPullAct;
|
jtkorhonen@0
|
184 QAction *hgStatAct;
|
jtkorhonen@0
|
185 QAction *hgFileDiffAct;
|
jtkorhonen@0
|
186 QAction *hgFolderDiffAct;
|
jtkorhonen@0
|
187 QAction *hgChgSetDiffAct;
|
jtkorhonen@0
|
188 QAction *hgRevertAct;
|
jtkorhonen@0
|
189 QAction *hgAddAct;
|
jtkorhonen@0
|
190 QAction *hgRemoveAct;
|
jtkorhonen@0
|
191 QAction *hgUpdateAct;
|
jtkorhonen@0
|
192 QAction *hgCommitAct;
|
jtkorhonen@0
|
193 QAction *hgMergeAct;
|
jtkorhonen@33
|
194 QAction *hgRetryMergeAct;
|
jtkorhonen@0
|
195 QAction *hgUpdateToRevAct;
|
jtkorhonen@0
|
196 QAction *hgAnnotateAct;
|
jtkorhonen@0
|
197 QAction *hgResolveListAct;
|
jtkorhonen@0
|
198 QAction *hgResolveMarkAct;
|
jtkorhonen@34
|
199 QAction *hgTagAct;
|
jtkorhonen@34
|
200 QAction *hgIgnoreAct;
|
jtkorhonen@11
|
201 QAction *hgServeAct;
|
jtkorhonen@0
|
202
|
jtkorhonen@0
|
203 //Menus
|
jtkorhonen@0
|
204 QMenu *fileMenu;
|
jtkorhonen@0
|
205 QMenu *advancedMenu;
|
jtkorhonen@0
|
206 QMenu *helpMenu;
|
jtkorhonen@0
|
207
|
jtkorhonen@0
|
208 //Help menu actions
|
jtkorhonen@0
|
209 QAction *aboutAct;
|
jtkorhonen@0
|
210 QAction *aboutQtAct;
|
jtkorhonen@0
|
211
|
Chris@94
|
212 // Other actions
|
Chris@94
|
213 QAction *clearSelectionsAct;
|
Chris@94
|
214
|
jtkorhonen@0
|
215 QToolBar *fileToolBar;
|
jtkorhonen@0
|
216 QToolBar *repoToolBar;
|
jtkorhonen@0
|
217 QToolBar *workFolderToolBar;
|
jtkorhonen@0
|
218
|
jtkorhonen@0
|
219 HGACTIONS runningAction;
|
jtkorhonen@0
|
220 HgRunner *runner;
|
jtkorhonen@0
|
221
|
Chris@90
|
222 QFileSystemWatcher *fsWatcher;
|
Chris@90
|
223
|
jtkorhonen@33
|
224 int tabPage;
|
jtkorhonen@0
|
225 unsigned char initialFileTypesBits;
|
jtkorhonen@33
|
226 bool justMerged;
|
jtkorhonen@0
|
227 };
|
jtkorhonen@0
|
228
|
jtkorhonen@0
|
229 #endif
|