comparison src/mainwindow.h @ 370:b9c153e00e84

Move source files to src/
author Chris Cannam
date Thu, 24 Mar 2011 10:27:51 +0000
parents mainwindow.h@f89e50d748ed
children 2a19d5706673
comparison
equal deleted inserted replaced
369:19cce6d2c470 370:b9c153e00e84
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 EasyMercurial
5
6 Based on hgExplorer by Jari Korhonen
7 Copyright (c) 2010 Jari Korhonen
8 Copyright (c) 2011 Chris Cannam
9 Copyright (c) 2011 Queen Mary, University of London
10
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License as
13 published by the Free Software Foundation; either version 2 of the
14 License, or (at your option) any later version. See the file
15 COPYING included with this distribution for more information.
16 */
17
18 #ifndef MAINWINDOW_H
19 #define MAINWINDOW_H
20
21 #include "hgtabwidget.h"
22 #include "hgrunner.h"
23 #include "common.h"
24 #include "changeset.h"
25 #include "hgaction.h"
26
27 #include <QMainWindow>
28 #include <QListWidget>
29 #include <QFileSystemWatcher>
30
31 QT_BEGIN_NAMESPACE
32 class QAction;
33 class QMenu;
34 class QTimer;
35 QT_END_NAMESPACE
36
37 class WorkStatusWidget;
38
39 class MainWindow : public QMainWindow
40 {
41 Q_OBJECT
42
43 public:
44 MainWindow(QString myDirPath);
45
46 protected:
47 void closeEvent(QCloseEvent *event);
48
49 public slots:
50 void open(QString local);
51 void hgRefresh();
52 void commandStarting(HgAction);
53 void commandCompleted(HgAction action, QString stdOut);
54 void commandFailed(HgAction action, QString stdErr);
55 void enableDisableActions();
56
57 private slots:
58 void about();
59 void settings();
60 void open();
61 void recentMenuActivated();
62 void changeRemoteRepo();
63 void changeRemoteRepo(bool initial);
64 void startupDialog();
65 void clearSelections();
66 void showAllChanged(bool);
67
68 void hgTest();
69 void hgTestExtension();
70 void hgQueryPaths();
71 void hgStat();
72 void hgRemove();
73 void hgAdd();
74 void hgCommit();
75 void hgShowSummary();
76 void hgShowSummaryFor(Changeset *);
77 void hgFolderDiff();
78 void hgDiffToCurrent(QString);
79 void hgDiffToParent(QString, QString);
80 void hgUpdate();
81 void hgRevert();
82 void hgMerge();
83 void hgRedoMerge();
84 void hgCloneFromRemote();
85 void hgInit();
86 void hgIncoming();
87 void hgPush();
88 void hgPull();
89 void hgUpdateToRev(QString);
90 void hgMergeFrom(QString);
91 void hgResolveList();
92 void hgTag(QString);
93 void hgNewBranch();
94 void hgNoBranch();
95 void hgServe();
96 void hgIgnore();
97
98 void hgAnnotateFiles(QStringList);
99 void hgDiffFiles(QStringList);
100 void hgCommitFiles(QStringList);
101 void hgRevertFiles(QStringList);
102 void hgRenameFiles(QStringList);
103 void hgCopyFiles(QStringList);
104 void hgAddFiles(QStringList);
105 void hgRemoveFiles(QStringList);
106 void hgRedoFileMerges(QStringList);
107 void hgMarkFilesResolved(QStringList);
108 void hgIgnoreFiles(QStringList);
109 void hgUnIgnoreFiles(QStringList);
110
111 void fsDirectoryChanged(QString);
112 void fsFileChanged(QString);
113 void checkFilesystem();
114 void actuallyRestoreFileSystemWatcher();
115
116 private:
117 void hgQueryBranch();
118 void hgQueryHeads();
119 void hgQueryParents();
120 void hgLog();
121 void hgLogIncremental(QStringList prune);
122
123 void updateRecentMenu();
124 void createActions();
125 void connectActions();
126 void connectTabsSignals();
127 void createMenus();
128 void createToolBars();
129 void updateToolBarStyle();
130 void createStatusBar();
131 void readSettings();
132 void splitChangeSets(QStringList *list, QString hgLogOutput);
133 void reportNewRemoteHeads(QString);
134 void reportAuthFailed(QString);
135 void writeSettings();
136
137 QStringList listAllUpIpV4Addresses();
138 QString filterTag(QString tag);
139
140 QString getUserInfo() const;
141
142 bool openLocal(QString);
143 bool openRemote(QString, QString);
144 bool openInit(QString);
145
146 bool complainAboutFilePath(QString);
147 bool complainAboutUnknownFolder(QString);
148 bool complainAboutInitInRepo(QString);
149 bool complainAboutInitFile(QString);
150 bool complainAboutCloneToExisting(QString);
151 bool complainAboutCloneToFile(QString);
152 QString complainAboutCloneToExistingFolder(QString local, QString remote); // returns new location, or empty string for cancel
153
154 bool askAboutUnknownFolder(QString);
155 bool askToInitExisting(QString);
156 bool askToInitNew(QString);
157 bool askToOpenParentRepo(QString, QString);
158 bool askToOpenInsteadOfInit(QString);
159
160 void showIncoming(QString);
161 void showPullResult(QString);
162 void showPushResult(QString);
163 int extractChangeCount(QString);
164 QString format1(QString);
165 QString format3(QString, QString, QString);
166
167 void clearState();
168
169 void updateFileSystemWatcher();
170 void suspendFileSystemWatcher();
171 void restoreFileSystemWatcher();
172
173 void updateWorkFolderAndRepoNames();
174
175 WorkStatusWidget *m_workStatus;
176 HgTabWidget *m_hgTabs;
177
178 QString m_remoteRepoPath;
179 QString m_workFolderPath;
180 QString m_currentBranch;
181 Changesets m_currentHeads;
182 Changesets m_currentParents;
183 int m_commitsSincePush;
184 bool m_stateUnknown;
185 bool m_hgIsOK;
186 bool m_needNewLog;
187
188 bool m_firstStart;
189
190 bool m_showAllFiles;
191
192 //Actions enabled flags
193 bool m_remoteRepoActionsEnabled;
194 bool m_localRepoActionsEnabled;
195
196 QString m_myDirPath;
197
198 // File menu actions
199 QAction *m_openAct;
200 QAction *m_changeRemoteRepoAct;
201 QAction *m_settingsAct;
202 QAction *m_exitAct;
203
204 // Repo actions
205 QAction *m_hgIncomingAct;
206 QAction *m_hgPushAct;
207 QAction *m_hgPullAct;
208 QAction *m_hgRefreshAct;
209 QAction *m_hgFolderDiffAct;
210 QAction *m_hgChgSetDiffAct;
211 QAction *m_hgRevertAct;
212 QAction *m_hgAddAct;
213 QAction *m_hgRemoveAct;
214 QAction *m_hgUpdateAct;
215 QAction *m_hgCommitAct;
216 QAction *m_hgMergeAct;
217 QAction *m_hgUpdateToRevAct;
218 QAction *m_hgAnnotateAct;
219 QAction *m_hgIgnoreAct;
220 QAction *m_hgServeAct;
221
222 // Menus
223 QMenu *m_fileMenu;
224 QMenu *m_recentMenu;
225 QMenu *m_advancedMenu;
226 QMenu *m_helpMenu;
227
228 // Help menu actions
229 QAction *m_aboutAct;
230
231 QToolBar *m_fileToolBar;
232 QToolBar *m_repoToolBar;
233 QToolBar *m_workFolderToolBar;
234
235 HgRunner *m_runner;
236
237 bool m_shouldHgStat;
238
239 QString getDiffBinaryName();
240 QString getMergeBinaryName();
241 QString getEditorBinaryName();
242
243 QFileSystemWatcher *m_fsWatcher;
244 QTimer *m_fsWatcherGeneralTimer;
245 QTimer *m_fsWatcherRestoreTimer;
246 bool m_fsWatcherSuspended;
247
248 QString m_lastStatOutput;
249 QStringList m_lastRevertedFiles;
250
251 bool m_justMerged;
252 QString m_mergeTargetRevision;
253 QString m_mergeCommitComment;
254 };
255
256 #endif