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"
|
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;
|
jtkorhonen@0
|
34 QT_END_NAMESPACE
|
jtkorhonen@0
|
35
|
jtkorhonen@0
|
36 class MainWindow : public QMainWindow
|
jtkorhonen@0
|
37 {
|
jtkorhonen@0
|
38 Q_OBJECT
|
jtkorhonen@0
|
39
|
jtkorhonen@0
|
40 public:
|
Chris@172
|
41 MainWindow(QString myDirPath);
|
Chris@98
|
42 HgTabWidget *hgTabs;
|
jtkorhonen@0
|
43 void writeSettings();
|
jtkorhonen@0
|
44
|
jtkorhonen@0
|
45 //Paths to remote repo & workfolder
|
jtkorhonen@0
|
46 //Local repo is directory "./hg/" under work folder
|
jtkorhonen@0
|
47 QString remoteRepoPath;
|
jtkorhonen@0
|
48 QString workFolderPath;
|
Chris@106
|
49 QString currentBranch;
|
Chris@106
|
50 Changesets currentHeads;
|
Chris@108
|
51 Changesets currentParents;
|
Chris@133
|
52 int commitsSincePush;
|
Chris@173
|
53 bool stateUnknown;
|
Chris@175
|
54 bool hgIsOK;
|
Chris@120
|
55 bool needNewLog;
|
jtkorhonen@0
|
56
|
jtkorhonen@0
|
57 protected:
|
jtkorhonen@0
|
58 void closeEvent(QCloseEvent *event);
|
jtkorhonen@0
|
59
|
jtkorhonen@0
|
60 public slots:
|
Chris@145
|
61 void open(QString local);
|
Chris@120
|
62 void hgRefresh();
|
Chris@142
|
63 void commandCompleted(HgAction action, QString stdOut);
|
Chris@142
|
64 void commandFailed(HgAction action, QString stdErr);
|
Chris@95
|
65 void enableDisableActions();
|
jtkorhonen@0
|
66
|
jtkorhonen@0
|
67 private slots:
|
jtkorhonen@0
|
68 void about();
|
Chris@64
|
69 void settings();
|
Chris@69
|
70 void open();
|
Chris@182
|
71 void changeRemoteRepo();
|
Chris@64
|
72 void startupDialog();
|
Chris@94
|
73 void clearSelections();
|
Chris@199
|
74 void showAllChanged(bool);
|
Chris@64
|
75
|
Chris@175
|
76 void hgTest();
|
Chris@200
|
77 void hgTestExtension();
|
Chris@120
|
78 void hgQueryPaths();
|
Chris@120
|
79 void hgStat();
|
jtkorhonen@0
|
80 void hgRemove();
|
jtkorhonen@0
|
81 void hgAdd();
|
jtkorhonen@0
|
82 void hgCommit();
|
Chris@168
|
83 void hgShowSummary();
|
jtkorhonen@0
|
84 void hgFolderDiff();
|
Chris@148
|
85 void hgDiffToCurrent(QString);
|
Chris@148
|
86 void hgDiffToParent(QString, QString);
|
jtkorhonen@0
|
87 void hgUpdate();
|
jtkorhonen@0
|
88 void hgRevert();
|
jtkorhonen@0
|
89 void hgMerge();
|
Chris@163
|
90 void hgMarkResolved(QStringList);
|
jtkorhonen@33
|
91 void hgRetryMerge();
|
jtkorhonen@0
|
92 void hgCloneFromRemote();
|
jtkorhonen@0
|
93 void hgInit();
|
jtkorhonen@0
|
94 void hgIncoming();
|
jtkorhonen@0
|
95 void hgPush();
|
jtkorhonen@0
|
96 void hgPull();
|
Chris@148
|
97 void hgUpdateToRev(QString);
|
Chris@148
|
98 void hgMergeFrom(QString);
|
jtkorhonen@0
|
99 void hgAnnotate();
|
jtkorhonen@0
|
100 void hgResolveList();
|
Chris@164
|
101 void hgTag(QString);
|
jtkorhonen@11
|
102 void hgServe();
|
jtkorhonen@34
|
103 void hgIgnore();
|
jtkorhonen@0
|
104
|
Chris@90
|
105 void fsDirectoryChanged(QString);
|
Chris@90
|
106 void fsFileChanged(QString);
|
Chris@90
|
107
|
jtkorhonen@0
|
108 private:
|
Chris@109
|
109 void hgQueryBranch();
|
Chris@109
|
110 void hgQueryHeads();
|
Chris@109
|
111 void hgQueryParents();
|
jtkorhonen@0
|
112 void hgLog();
|
Chris@150
|
113 void hgLogIncremental(QStringList prune);
|
jtkorhonen@0
|
114 void createActions();
|
jtkorhonen@0
|
115 void connectActions();
|
Chris@141
|
116 void connectTabsSignals();
|
jtkorhonen@0
|
117 void createMenus();
|
jtkorhonen@0
|
118 void createToolBars();
|
jtkorhonen@0
|
119 void createStatusBar();
|
jtkorhonen@0
|
120 void readSettings();
|
jtkorhonen@0
|
121 void splitChangeSets(QStringList *list, QString hgLogOutput);
|
Chris@174
|
122 void reportNewRemoteHeads(QString);
|
jtkorhonen@2
|
123 void presentLongStdoutToUser(QString stdo);
|
Chris@95
|
124
|
Chris@182
|
125 QStringList listAllUpIpV4Addresses();
|
jtkorhonen@34
|
126 QString filterTag(QString tag);
|
jtkorhonen@0
|
127
|
Chris@64
|
128 QString getUserInfo() const;
|
Chris@64
|
129
|
Chris@79
|
130 bool openLocal(QString);
|
Chris@79
|
131 bool openRemote(QString, QString);
|
Chris@79
|
132 bool openInit(QString);
|
Chris@79
|
133
|
Chris@79
|
134 bool complainAboutFilePath(QString);
|
Chris@79
|
135 bool complainAboutUnknownFolder(QString);
|
Chris@84
|
136 bool complainAboutInitInRepo(QString);
|
Chris@84
|
137 bool complainAboutInitFile(QString);
|
Chris@84
|
138 bool complainAboutCloneToExisting(QString);
|
Chris@84
|
139 bool complainAboutCloneToFile(QString);
|
Chris@84
|
140 bool complainAboutCloneToExistingFolder(QString); //!!! not sure about this one
|
Chris@84
|
141
|
Chris@79
|
142 bool askToInitExisting(QString);
|
Chris@79
|
143 bool askToInitNew(QString);
|
Chris@79
|
144 bool askToOpenParentRepo(QString, QString);
|
Chris@84
|
145 bool askToOpenInsteadOfInit(QString);
|
Chris@79
|
146
|
Chris@120
|
147 void showIncoming(QString);
|
Chris@120
|
148 void showPullResult(QString);
|
Chris@120
|
149 void showPushResult(QString);
|
Chris@125
|
150 int extractChangeCount(QString);
|
Chris@125
|
151 QString format3(QString, QString, QString);
|
Chris@120
|
152
|
Chris@120
|
153 void clearState();
|
Chris@120
|
154
|
Chris@90
|
155 void updateFileSystemWatcher();
|
Chris@90
|
156
|
Chris@64
|
157 bool firstStart;
|
Chris@64
|
158
|
Chris@199
|
159 bool showAllFiles;
|
Chris@199
|
160
|
jtkorhonen@0
|
161 //Actions enabled flags
|
jtkorhonen@0
|
162 bool remoteRepoActionsEnabled;
|
jtkorhonen@0
|
163 bool localRepoActionsEnabled;
|
jtkorhonen@0
|
164
|
Chris@172
|
165 QString m_myDirPath;
|
Chris@172
|
166
|
jtkorhonen@0
|
167 //File menu actions
|
Chris@69
|
168 QAction *openAct;
|
Chris@182
|
169 QAction *changeRemoteRepoAct;
|
jtkorhonen@0
|
170 QAction *settingsAct;
|
jtkorhonen@0
|
171 QAction *exitAct;
|
jtkorhonen@0
|
172
|
jtkorhonen@33
|
173 //Repo actions
|
jtkorhonen@0
|
174 QAction *hgIncomingAct;
|
jtkorhonen@0
|
175 QAction *hgPushAct;
|
jtkorhonen@0
|
176 QAction *hgPullAct;
|
Chris@120
|
177 QAction *hgRefreshAct;
|
jtkorhonen@0
|
178 QAction *hgFolderDiffAct;
|
jtkorhonen@0
|
179 QAction *hgChgSetDiffAct;
|
jtkorhonen@0
|
180 QAction *hgRevertAct;
|
jtkorhonen@0
|
181 QAction *hgAddAct;
|
jtkorhonen@0
|
182 QAction *hgRemoveAct;
|
jtkorhonen@0
|
183 QAction *hgUpdateAct;
|
jtkorhonen@0
|
184 QAction *hgCommitAct;
|
jtkorhonen@0
|
185 QAction *hgMergeAct;
|
jtkorhonen@0
|
186 QAction *hgUpdateToRevAct;
|
jtkorhonen@0
|
187 QAction *hgAnnotateAct;
|
jtkorhonen@34
|
188 QAction *hgIgnoreAct;
|
jtkorhonen@11
|
189 QAction *hgServeAct;
|
jtkorhonen@0
|
190
|
jtkorhonen@0
|
191 //Menus
|
jtkorhonen@0
|
192 QMenu *fileMenu;
|
jtkorhonen@0
|
193 QMenu *advancedMenu;
|
jtkorhonen@0
|
194 QMenu *helpMenu;
|
jtkorhonen@0
|
195
|
jtkorhonen@0
|
196 //Help menu actions
|
jtkorhonen@0
|
197 QAction *aboutAct;
|
jtkorhonen@0
|
198
|
jtkorhonen@0
|
199 QToolBar *fileToolBar;
|
jtkorhonen@0
|
200 QToolBar *repoToolBar;
|
jtkorhonen@0
|
201 QToolBar *workFolderToolBar;
|
jtkorhonen@0
|
202
|
Chris@109
|
203 HgRunner *runner;
|
jtkorhonen@0
|
204
|
Chris@163
|
205 bool shouldHgStat;
|
Chris@163
|
206
|
Chris@179
|
207 QString findDiffBinaryName();
|
Chris@179
|
208 QString findMergeBinaryName();
|
Chris@179
|
209 QString findEditorBinaryName();
|
Chris@112
|
210
|
Chris@90
|
211 QFileSystemWatcher *fsWatcher;
|
Chris@90
|
212
|
Chris@163
|
213 QString lastStatOutput;
|
Chris@163
|
214 QStringList lastRevertedFiles;
|
Chris@163
|
215
|
Chris@112
|
216 bool justMerged;
|
Chris@163
|
217 QString mergeTargetRevision;
|
Chris@157
|
218 QString mergeCommitComment;
|
jtkorhonen@0
|
219 };
|
jtkorhonen@0
|
220
|
jtkorhonen@0
|
221 #endif
|