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@244
|
8 Copyright (c) 2011 Chris Cannam
|
Chris@244
|
9 Copyright (c) 2011 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"
|
Chris@109
|
25 #include "hgaction.h"
|
Chris@472
|
26 #include "settingsdialog.h"
|
jtkorhonen@0
|
27
|
Chris@50
|
28 #include <QMainWindow>
|
Chris@50
|
29 #include <QListWidget>
|
Chris@90
|
30 #include <QFileSystemWatcher>
|
Chris@50
|
31
|
jtkorhonen@0
|
32 QT_BEGIN_NAMESPACE
|
jtkorhonen@0
|
33 class QAction;
|
jtkorhonen@0
|
34 class QMenu;
|
Chris@238
|
35 class QTimer;
|
jtkorhonen@0
|
36 QT_END_NAMESPACE
|
jtkorhonen@0
|
37
|
Chris@287
|
38 class WorkStatusWidget;
|
Chris@287
|
39
|
jtkorhonen@0
|
40 class MainWindow : public QMainWindow
|
jtkorhonen@0
|
41 {
|
jtkorhonen@0
|
42 Q_OBJECT
|
jtkorhonen@0
|
43
|
jtkorhonen@0
|
44 public:
|
Chris@172
|
45 MainWindow(QString myDirPath);
|
jtkorhonen@0
|
46
|
jtkorhonen@0
|
47 protected:
|
jtkorhonen@0
|
48 void closeEvent(QCloseEvent *event);
|
jtkorhonen@0
|
49
|
jtkorhonen@0
|
50 public slots:
|
Chris@145
|
51 void open(QString local);
|
Chris@120
|
52 void hgRefresh();
|
Chris@238
|
53 void commandStarting(HgAction);
|
Chris@142
|
54 void commandCompleted(HgAction action, QString stdOut);
|
Chris@142
|
55 void commandFailed(HgAction action, QString stdErr);
|
Chris@95
|
56 void enableDisableActions();
|
jtkorhonen@0
|
57
|
jtkorhonen@0
|
58 private slots:
|
jtkorhonen@0
|
59 void about();
|
Chris@494
|
60 void help();
|
Chris@64
|
61 void settings();
|
Chris@472
|
62 void settings(SettingsDialog::Tab);
|
Chris@69
|
63 void open();
|
Chris@359
|
64 void recentMenuActivated();
|
Chris@182
|
65 void changeRemoteRepo();
|
Chris@363
|
66 void changeRemoteRepo(bool initial);
|
Chris@64
|
67 void startupDialog();
|
Chris@94
|
68 void clearSelections();
|
Chris@484
|
69 void showAllChanged();
|
Chris@64
|
70
|
Chris@175
|
71 void hgTest();
|
Chris@200
|
72 void hgTestExtension();
|
Chris@120
|
73 void hgQueryPaths();
|
Chris@120
|
74 void hgStat();
|
jtkorhonen@0
|
75 void hgRemove();
|
jtkorhonen@0
|
76 void hgAdd();
|
jtkorhonen@0
|
77 void hgCommit();
|
Chris@168
|
78 void hgShowSummary();
|
Chris@289
|
79 void hgShowSummaryFor(Changeset *);
|
jtkorhonen@0
|
80 void hgFolderDiff();
|
Chris@148
|
81 void hgDiffToCurrent(QString);
|
Chris@148
|
82 void hgDiffToParent(QString, QString);
|
jtkorhonen@0
|
83 void hgUpdate();
|
jtkorhonen@0
|
84 void hgRevert();
|
jtkorhonen@0
|
85 void hgMerge();
|
Chris@326
|
86 void hgRedoMerge();
|
jtkorhonen@0
|
87 void hgCloneFromRemote();
|
jtkorhonen@0
|
88 void hgInit();
|
jtkorhonen@0
|
89 void hgIncoming();
|
jtkorhonen@0
|
90 void hgPush();
|
jtkorhonen@0
|
91 void hgPull();
|
Chris@148
|
92 void hgUpdateToRev(QString);
|
Chris@148
|
93 void hgMergeFrom(QString);
|
jtkorhonen@0
|
94 void hgResolveList();
|
Chris@164
|
95 void hgTag(QString);
|
Chris@311
|
96 void hgNewBranch();
|
Chris@311
|
97 void hgNoBranch();
|
Chris@514
|
98 void hgCloseBranch();
|
jtkorhonen@11
|
99 void hgServe();
|
Chris@425
|
100 void hgIgnore();
|
Chris@413
|
101 void hgEditIgnore();
|
jtkorhonen@0
|
102
|
Chris@326
|
103 void hgAnnotateFiles(QStringList);
|
Chris@326
|
104 void hgDiffFiles(QStringList);
|
Chris@326
|
105 void hgCommitFiles(QStringList);
|
Chris@326
|
106 void hgRevertFiles(QStringList);
|
Chris@361
|
107 void hgRenameFiles(QStringList);
|
Chris@361
|
108 void hgCopyFiles(QStringList);
|
Chris@326
|
109 void hgAddFiles(QStringList);
|
Chris@326
|
110 void hgRemoveFiles(QStringList);
|
Chris@326
|
111 void hgRedoFileMerges(QStringList);
|
Chris@326
|
112 void hgMarkFilesResolved(QStringList);
|
Chris@326
|
113 void hgIgnoreFiles(QStringList);
|
Chris@326
|
114 void hgUnIgnoreFiles(QStringList);
|
Chris@326
|
115
|
Chris@90
|
116 void fsDirectoryChanged(QString);
|
Chris@90
|
117 void fsFileChanged(QString);
|
Chris@238
|
118 void checkFilesystem();
|
Chris@238
|
119 void actuallyRestoreFileSystemWatcher();
|
Chris@90
|
120
|
Chris@491
|
121 void newerVersionAvailable(QString);
|
Chris@491
|
122
|
jtkorhonen@0
|
123 private:
|
Chris@109
|
124 void hgQueryBranch();
|
Chris@519
|
125 void hgQueryBookmarks();
|
Chris@506
|
126 void hgQueryHeadsActive();
|
Chris@109
|
127 void hgQueryHeads();
|
Chris@109
|
128 void hgQueryParents();
|
jtkorhonen@0
|
129 void hgLog();
|
Chris@150
|
130 void hgLogIncremental(QStringList prune);
|
Chris@359
|
131
|
Chris@417
|
132 void initHgIgnore();
|
Chris@417
|
133
|
Chris@359
|
134 void updateRecentMenu();
|
jtkorhonen@0
|
135 void createActions();
|
jtkorhonen@0
|
136 void connectActions();
|
Chris@141
|
137 void connectTabsSignals();
|
jtkorhonen@0
|
138 void createMenus();
|
jtkorhonen@0
|
139 void createToolBars();
|
Chris@230
|
140 void updateToolBarStyle();
|
jtkorhonen@0
|
141 void createStatusBar();
|
jtkorhonen@0
|
142 void readSettings();
|
jtkorhonen@0
|
143 void splitChangeSets(QStringList *list, QString hgLogOutput);
|
Chris@174
|
144 void reportNewRemoteHeads(QString);
|
Chris@353
|
145 void reportAuthFailed(QString);
|
Chris@284
|
146 void writeSettings();
|
Chris@95
|
147
|
Chris@182
|
148 QStringList listAllUpIpV4Addresses();
|
jtkorhonen@34
|
149 QString filterTag(QString tag);
|
jtkorhonen@0
|
150
|
Chris@64
|
151 QString getUserInfo() const;
|
Chris@64
|
152
|
Chris@79
|
153 bool openLocal(QString);
|
Chris@79
|
154 bool openRemote(QString, QString);
|
Chris@79
|
155 bool openInit(QString);
|
Chris@79
|
156
|
Chris@79
|
157 bool complainAboutFilePath(QString);
|
Chris@79
|
158 bool complainAboutUnknownFolder(QString);
|
Chris@84
|
159 bool complainAboutInitInRepo(QString);
|
Chris@84
|
160 bool complainAboutInitFile(QString);
|
Chris@84
|
161 bool complainAboutCloneToExisting(QString);
|
Chris@84
|
162 bool complainAboutCloneToFile(QString);
|
Chris@237
|
163 QString complainAboutCloneToExistingFolder(QString local, QString remote); // returns new location, or empty string for cancel
|
Chris@84
|
164
|
Chris@248
|
165 bool askAboutUnknownFolder(QString);
|
Chris@79
|
166 bool askToInitExisting(QString);
|
Chris@79
|
167 bool askToInitNew(QString);
|
Chris@79
|
168 bool askToOpenParentRepo(QString, QString);
|
Chris@84
|
169 bool askToOpenInsteadOfInit(QString);
|
Chris@79
|
170
|
Chris@120
|
171 void showIncoming(QString);
|
Chris@120
|
172 void showPullResult(QString);
|
Chris@120
|
173 void showPushResult(QString);
|
Chris@125
|
174 int extractChangeCount(QString);
|
Chris@275
|
175 QString format1(QString);
|
Chris@125
|
176 QString format3(QString, QString, QString);
|
Chris@120
|
177
|
Chris@120
|
178 void clearState();
|
Chris@120
|
179
|
Chris@90
|
180 void updateFileSystemWatcher();
|
Chris@238
|
181 void suspendFileSystemWatcher();
|
Chris@238
|
182 void restoreFileSystemWatcher();
|
Chris@90
|
183
|
Chris@506
|
184 void updateClosedHeads();
|
Chris@506
|
185
|
Chris@287
|
186 void updateWorkFolderAndRepoNames();
|
Chris@287
|
187
|
Chris@287
|
188 WorkStatusWidget *m_workStatus;
|
Chris@284
|
189 HgTabWidget *m_hgTabs;
|
Chris@64
|
190
|
Chris@284
|
191 QString m_remoteRepoPath;
|
Chris@284
|
192 QString m_workFolderPath;
|
Chris@284
|
193 QString m_currentBranch;
|
Chris@284
|
194 Changesets m_currentHeads;
|
Chris@506
|
195 Changesets m_activeHeads;
|
Chris@519
|
196 QHash<QString, QStringList> m_bookmarks; // changeset id -> names, not vice versa
|
Chris@506
|
197 QSet<QString> m_closedHeadIds;
|
Chris@284
|
198 Changesets m_currentParents;
|
Chris@284
|
199 int m_commitsSincePush;
|
Chris@284
|
200 bool m_stateUnknown;
|
Chris@284
|
201 bool m_hgIsOK;
|
Chris@284
|
202 bool m_needNewLog;
|
Chris@284
|
203
|
Chris@284
|
204 bool m_firstStart;
|
Chris@284
|
205
|
Chris@284
|
206 bool m_showAllFiles;
|
Chris@199
|
207
|
jtkorhonen@0
|
208 //Actions enabled flags
|
Chris@284
|
209 bool m_remoteRepoActionsEnabled;
|
Chris@284
|
210 bool m_localRepoActionsEnabled;
|
jtkorhonen@0
|
211
|
Chris@172
|
212 QString m_myDirPath;
|
Chris@172
|
213
|
Chris@284
|
214 // File menu actions
|
Chris@284
|
215 QAction *m_openAct;
|
Chris@284
|
216 QAction *m_changeRemoteRepoAct;
|
Chris@284
|
217 QAction *m_settingsAct;
|
Chris@284
|
218 QAction *m_exitAct;
|
jtkorhonen@0
|
219
|
Chris@284
|
220 // Repo actions
|
Chris@284
|
221 QAction *m_hgIncomingAct;
|
Chris@284
|
222 QAction *m_hgPushAct;
|
Chris@284
|
223 QAction *m_hgPullAct;
|
Chris@284
|
224 QAction *m_hgRefreshAct;
|
Chris@284
|
225 QAction *m_hgFolderDiffAct;
|
Chris@284
|
226 QAction *m_hgChgSetDiffAct;
|
Chris@284
|
227 QAction *m_hgRevertAct;
|
Chris@284
|
228 QAction *m_hgAddAct;
|
Chris@284
|
229 QAction *m_hgRemoveAct;
|
Chris@413
|
230 QAction *m_hgIgnoreAct;
|
Chris@284
|
231 QAction *m_hgUpdateAct;
|
Chris@284
|
232 QAction *m_hgCommitAct;
|
Chris@284
|
233 QAction *m_hgMergeAct;
|
Chris@284
|
234 QAction *m_hgUpdateToRevAct;
|
Chris@284
|
235 QAction *m_hgAnnotateAct;
|
Chris@413
|
236 QAction *m_hgEditIgnoreAct;
|
Chris@284
|
237 QAction *m_hgServeAct;
|
jtkorhonen@0
|
238
|
Chris@284
|
239 // Menus
|
Chris@284
|
240 QMenu *m_fileMenu;
|
Chris@359
|
241 QMenu *m_recentMenu;
|
Chris@284
|
242 QMenu *m_helpMenu;
|
jtkorhonen@0
|
243
|
Chris@284
|
244 // Help menu actions
|
Chris@284
|
245 QAction *m_aboutAct;
|
Chris@494
|
246 QAction *m_helpAct;
|
jtkorhonen@0
|
247
|
Chris@284
|
248 QToolBar *m_fileToolBar;
|
Chris@284
|
249 QToolBar *m_repoToolBar;
|
Chris@284
|
250 QToolBar *m_workFolderToolBar;
|
jtkorhonen@0
|
251
|
Chris@494
|
252 QDialog *m_helpDialog;
|
Chris@494
|
253
|
Chris@284
|
254 HgRunner *m_runner;
|
jtkorhonen@0
|
255
|
Chris@284
|
256 bool m_shouldHgStat;
|
Chris@163
|
257
|
Chris@239
|
258 QString getDiffBinaryName();
|
Chris@239
|
259 QString getMergeBinaryName();
|
Chris@239
|
260 QString getEditorBinaryName();
|
Chris@112
|
261
|
Chris@284
|
262 QFileSystemWatcher *m_fsWatcher;
|
Chris@238
|
263 QTimer *m_fsWatcherGeneralTimer;
|
Chris@238
|
264 QTimer *m_fsWatcherRestoreTimer;
|
Chris@241
|
265 bool m_fsWatcherSuspended;
|
Chris@90
|
266
|
Chris@284
|
267 QString m_lastStatOutput;
|
Chris@284
|
268 QStringList m_lastRevertedFiles;
|
Chris@163
|
269
|
Chris@284
|
270 bool m_justMerged;
|
Chris@284
|
271 QString m_mergeTargetRevision;
|
Chris@284
|
272 QString m_mergeCommitComment;
|
jtkorhonen@0
|
273 };
|
jtkorhonen@0
|
274
|
jtkorhonen@0
|
275 #endif
|