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