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"
|
jtkorhonen@0
|
24
|
Chris@50
|
25 #include <QMainWindow>
|
Chris@50
|
26 #include <QListWidget>
|
Chris@90
|
27 #include <QFileSystemWatcher>
|
Chris@50
|
28
|
jtkorhonen@0
|
29 QT_BEGIN_NAMESPACE
|
jtkorhonen@0
|
30 class QAction;
|
jtkorhonen@0
|
31 class QMenu;
|
jtkorhonen@0
|
32 QT_END_NAMESPACE
|
jtkorhonen@0
|
33
|
jtkorhonen@0
|
34 enum HGACTIONS
|
jtkorhonen@0
|
35 {
|
jtkorhonen@0
|
36 ACT_NONE,
|
Chris@74
|
37 ACT_PATHS,
|
jtkorhonen@0
|
38 ACT_STAT,
|
jtkorhonen@0
|
39 ACT_HEADS,
|
jtkorhonen@0
|
40 ACT_PARENTS,
|
jtkorhonen@0
|
41 ACT_LOG,
|
jtkorhonen@0
|
42 ACT_REMOVE,
|
jtkorhonen@0
|
43 ACT_ADD,
|
jtkorhonen@0
|
44 ACT_INCOMING,
|
jtkorhonen@0
|
45 ACT_PUSH,
|
jtkorhonen@0
|
46 ACT_PULL,
|
jtkorhonen@0
|
47 ACT_CLONEFROMREMOTE,
|
jtkorhonen@0
|
48 ACT_INIT,
|
jtkorhonen@0
|
49 ACT_COMMIT,
|
jtkorhonen@0
|
50 ACT_ANNOTATE,
|
jtkorhonen@0
|
51 ACT_FILEDIFF,
|
jtkorhonen@0
|
52 ACT_FOLDERDIFF,
|
jtkorhonen@0
|
53 ACT_CHGSETDIFF,
|
jtkorhonen@0
|
54 ACT_UPDATE,
|
jtkorhonen@0
|
55 ACT_REVERT,
|
jtkorhonen@0
|
56 ACT_MERGE,
|
jtkorhonen@0
|
57 ACT_RESOLVE_LIST,
|
jtkorhonen@11
|
58 ACT_SERVE,
|
jtkorhonen@33
|
59 ACT_RESOLVE_MARK,
|
jtkorhonen@33
|
60 ACT_RETRY_MERGE,
|
jtkorhonen@34
|
61 ACT_TAG,
|
jtkorhonen@36
|
62 ACT_HG_IGNORE,
|
jtkorhonen@0
|
63 };
|
jtkorhonen@0
|
64
|
jtkorhonen@0
|
65
|
jtkorhonen@0
|
66 class MainWindow : public QMainWindow
|
jtkorhonen@0
|
67 {
|
jtkorhonen@0
|
68 Q_OBJECT
|
jtkorhonen@0
|
69
|
jtkorhonen@0
|
70 public:
|
jtkorhonen@0
|
71 MainWindow();
|
Chris@98
|
72 HgTabWidget *hgTabs;
|
jtkorhonen@0
|
73 void writeSettings();
|
jtkorhonen@0
|
74
|
jtkorhonen@0
|
75 //Paths to remote repo & workfolder
|
jtkorhonen@0
|
76 //Local repo is directory "./hg/" under work folder
|
jtkorhonen@0
|
77 QString remoteRepoPath;
|
jtkorhonen@0
|
78 QString workFolderPath;
|
jtkorhonen@0
|
79
|
jtkorhonen@0
|
80 protected:
|
jtkorhonen@0
|
81 void closeEvent(QCloseEvent *event);
|
jtkorhonen@0
|
82
|
jtkorhonen@0
|
83 public slots:
|
Chris@74
|
84 void hgPaths();
|
jtkorhonen@0
|
85 void hgStat();
|
jtkorhonen@0
|
86 void tabChanged(int currTab);
|
Chris@62
|
87 void commandCompleted();
|
Chris@62
|
88 void commandFailed();
|
Chris@95
|
89 void enableDisableActions();
|
jtkorhonen@0
|
90
|
jtkorhonen@0
|
91 private slots:
|
jtkorhonen@0
|
92 void about();
|
Chris@64
|
93 void settings();
|
Chris@69
|
94 void open();
|
Chris@64
|
95 void startupDialog();
|
Chris@94
|
96 void clearSelections();
|
Chris@64
|
97
|
jtkorhonen@0
|
98 void hgRemove();
|
jtkorhonen@0
|
99 void hgAdd();
|
jtkorhonen@0
|
100 void hgCommit();
|
jtkorhonen@0
|
101 void hgFileDiff();
|
jtkorhonen@0
|
102 void hgFolderDiff();
|
jtkorhonen@0
|
103 void hgChgSetDiff();
|
jtkorhonen@0
|
104 void hgUpdate();
|
jtkorhonen@0
|
105 void hgRevert();
|
jtkorhonen@0
|
106 void hgMerge();
|
jtkorhonen@33
|
107 void hgRetryMerge();
|
jtkorhonen@0
|
108 void hgCloneFromRemote();
|
jtkorhonen@0
|
109 void hgInit();
|
jtkorhonen@0
|
110 void hgIncoming();
|
jtkorhonen@0
|
111 void hgPush();
|
jtkorhonen@0
|
112 void hgPull();
|
jtkorhonen@0
|
113 void hgUpdateToRev();
|
jtkorhonen@0
|
114 void hgAnnotate();
|
jtkorhonen@0
|
115 void hgResolveList();
|
jtkorhonen@0
|
116 void hgResolveMark();
|
jtkorhonen@34
|
117 void hgTag();
|
jtkorhonen@11
|
118 void hgServe();
|
jtkorhonen@34
|
119 void hgIgnore();
|
jtkorhonen@0
|
120
|
Chris@90
|
121 void fsDirectoryChanged(QString);
|
Chris@90
|
122 void fsFileChanged(QString);
|
Chris@90
|
123
|
jtkorhonen@0
|
124 private:
|
jtkorhonen@0
|
125 void hgHeads();
|
jtkorhonen@0
|
126 void hgParents();
|
jtkorhonen@0
|
127 void hgLog();
|
jtkorhonen@0
|
128 void createActions();
|
jtkorhonen@0
|
129 void connectActions();
|
jtkorhonen@0
|
130 void createMenus();
|
jtkorhonen@0
|
131 void createToolBars();
|
jtkorhonen@0
|
132 void createStatusBar();
|
jtkorhonen@0
|
133 void readSettings();
|
jtkorhonen@0
|
134 void splitChangeSets(QStringList *list, QString hgLogOutput);
|
Chris@90
|
135 bool getCommentOrTag(QString& commentOrTag, QString question, QString dlgTitle);
|
jtkorhonen@2
|
136 void presentLongStdoutToUser(QString stdo);
|
Chris@95
|
137
|
jtkorhonen@28
|
138 QString listAllUpIpV4Addresses();
|
jtkorhonen@34
|
139 QString filterTag(QString tag);
|
jtkorhonen@0
|
140
|
Chris@64
|
141 QString getUserInfo() const;
|
Chris@64
|
142
|
Chris@79
|
143 bool openLocal(QString);
|
Chris@79
|
144 bool openRemote(QString, QString);
|
Chris@79
|
145 bool openInit(QString);
|
Chris@79
|
146
|
Chris@79
|
147 bool complainAboutFilePath(QString);
|
Chris@79
|
148 bool complainAboutUnknownFolder(QString);
|
Chris@84
|
149 bool complainAboutInitInRepo(QString);
|
Chris@84
|
150 bool complainAboutInitFile(QString);
|
Chris@84
|
151 bool complainAboutCloneToExisting(QString);
|
Chris@84
|
152 bool complainAboutCloneToFile(QString);
|
Chris@84
|
153 bool complainAboutCloneToExistingFolder(QString); //!!! not sure about this one
|
Chris@84
|
154
|
Chris@79
|
155 bool askToInitExisting(QString);
|
Chris@79
|
156 bool askToInitNew(QString);
|
Chris@79
|
157 bool askToOpenParentRepo(QString, QString);
|
Chris@84
|
158 bool askToOpenInsteadOfInit(QString);
|
Chris@79
|
159
|
Chris@90
|
160 void updateFileSystemWatcher();
|
Chris@90
|
161
|
Chris@64
|
162 bool firstStart;
|
Chris@64
|
163
|
jtkorhonen@0
|
164 //Actions enabled flags
|
jtkorhonen@0
|
165 bool remoteRepoActionsEnabled;
|
jtkorhonen@0
|
166 bool localRepoActionsEnabled;
|
jtkorhonen@0
|
167
|
jtkorhonen@0
|
168 //File menu actions
|
jtkorhonen@0
|
169 QAction *hgInitAct;
|
jtkorhonen@0
|
170 QAction *hgCloneFromRemoteAct;
|
Chris@69
|
171 QAction *openAct;
|
jtkorhonen@0
|
172 QAction *settingsAct;
|
jtkorhonen@0
|
173 QAction *exitAct;
|
jtkorhonen@0
|
174
|
jtkorhonen@33
|
175 //Repo actions
|
jtkorhonen@0
|
176 QAction *hgIncomingAct;
|
jtkorhonen@0
|
177 QAction *hgPushAct;
|
jtkorhonen@0
|
178 QAction *hgPullAct;
|
jtkorhonen@0
|
179 QAction *hgStatAct;
|
jtkorhonen@0
|
180 QAction *hgFileDiffAct;
|
jtkorhonen@0
|
181 QAction *hgFolderDiffAct;
|
jtkorhonen@0
|
182 QAction *hgChgSetDiffAct;
|
jtkorhonen@0
|
183 QAction *hgRevertAct;
|
jtkorhonen@0
|
184 QAction *hgAddAct;
|
jtkorhonen@0
|
185 QAction *hgRemoveAct;
|
jtkorhonen@0
|
186 QAction *hgUpdateAct;
|
jtkorhonen@0
|
187 QAction *hgCommitAct;
|
jtkorhonen@0
|
188 QAction *hgMergeAct;
|
jtkorhonen@33
|
189 QAction *hgRetryMergeAct;
|
jtkorhonen@0
|
190 QAction *hgUpdateToRevAct;
|
jtkorhonen@0
|
191 QAction *hgAnnotateAct;
|
jtkorhonen@0
|
192 QAction *hgResolveListAct;
|
jtkorhonen@0
|
193 QAction *hgResolveMarkAct;
|
jtkorhonen@34
|
194 QAction *hgTagAct;
|
jtkorhonen@34
|
195 QAction *hgIgnoreAct;
|
jtkorhonen@11
|
196 QAction *hgServeAct;
|
jtkorhonen@0
|
197
|
jtkorhonen@0
|
198 //Menus
|
jtkorhonen@0
|
199 QMenu *fileMenu;
|
jtkorhonen@0
|
200 QMenu *advancedMenu;
|
jtkorhonen@0
|
201 QMenu *helpMenu;
|
jtkorhonen@0
|
202
|
jtkorhonen@0
|
203 //Help menu actions
|
jtkorhonen@0
|
204 QAction *aboutAct;
|
jtkorhonen@0
|
205 QAction *aboutQtAct;
|
jtkorhonen@0
|
206
|
Chris@94
|
207 // Other actions
|
Chris@94
|
208 QAction *clearSelectionsAct;
|
Chris@94
|
209
|
jtkorhonen@0
|
210 QToolBar *fileToolBar;
|
jtkorhonen@0
|
211 QToolBar *repoToolBar;
|
jtkorhonen@0
|
212 QToolBar *workFolderToolBar;
|
jtkorhonen@0
|
213
|
jtkorhonen@0
|
214 HGACTIONS runningAction;
|
jtkorhonen@0
|
215 HgRunner *runner;
|
jtkorhonen@0
|
216
|
Chris@90
|
217 QFileSystemWatcher *fsWatcher;
|
Chris@90
|
218
|
jtkorhonen@33
|
219 int tabPage;
|
jtkorhonen@0
|
220 unsigned char initialFileTypesBits;
|
jtkorhonen@33
|
221 bool justMerged;
|
jtkorhonen@0
|
222 };
|
jtkorhonen@0
|
223
|
jtkorhonen@0
|
224 #endif
|