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