jtkorhonen@0
|
1 /****************************************************************************
|
jtkorhonen@30
|
2 ** Copyright (C) Jari Korhonen, 2010 (under lgpl)
|
jtkorhonen@0
|
3 ****************************************************************************/
|
jtkorhonen@0
|
4
|
jtkorhonen@0
|
5 #ifndef MAINWINDOW_H
|
jtkorhonen@0
|
6 #define MAINWINDOW_H
|
jtkorhonen@0
|
7
|
jtkorhonen@0
|
8 #include "hgexpwidget.h"
|
jtkorhonen@0
|
9 #include "hgrunner.h"
|
jtkorhonen@0
|
10 #include "common.h"
|
jtkorhonen@0
|
11
|
Chris@50
|
12 #include <QMainWindow>
|
Chris@50
|
13 #include <QListWidget>
|
Chris@50
|
14
|
jtkorhonen@0
|
15 QT_BEGIN_NAMESPACE
|
jtkorhonen@0
|
16 class QAction;
|
jtkorhonen@0
|
17 class QMenu;
|
jtkorhonen@0
|
18 QT_END_NAMESPACE
|
jtkorhonen@0
|
19
|
jtkorhonen@0
|
20 enum HGACTIONS
|
jtkorhonen@0
|
21 {
|
jtkorhonen@0
|
22 ACT_NONE,
|
jtkorhonen@0
|
23 ACT_STAT,
|
jtkorhonen@0
|
24 ACT_HEADS,
|
jtkorhonen@0
|
25 ACT_PARENTS,
|
jtkorhonen@0
|
26 ACT_LOG,
|
jtkorhonen@0
|
27 ACT_REMOVE,
|
jtkorhonen@0
|
28 ACT_ADD,
|
jtkorhonen@0
|
29 ACT_INCOMING,
|
jtkorhonen@0
|
30 ACT_PUSH,
|
jtkorhonen@0
|
31 ACT_PULL,
|
jtkorhonen@0
|
32 ACT_CLONEFROMREMOTE,
|
jtkorhonen@0
|
33 ACT_INIT,
|
jtkorhonen@0
|
34 ACT_COMMIT,
|
jtkorhonen@0
|
35 ACT_ANNOTATE,
|
jtkorhonen@0
|
36 ACT_FILEDIFF,
|
jtkorhonen@0
|
37 ACT_FOLDERDIFF,
|
jtkorhonen@0
|
38 ACT_CHGSETDIFF,
|
jtkorhonen@0
|
39 ACT_UPDATE,
|
jtkorhonen@0
|
40 ACT_REVERT,
|
jtkorhonen@0
|
41 ACT_MERGE,
|
jtkorhonen@0
|
42 ACT_RESOLVE_LIST,
|
jtkorhonen@11
|
43 ACT_SERVE,
|
jtkorhonen@33
|
44 ACT_RESOLVE_MARK,
|
jtkorhonen@33
|
45 ACT_RETRY_MERGE,
|
jtkorhonen@34
|
46 ACT_TAG,
|
jtkorhonen@36
|
47 ACT_HG_IGNORE,
|
jtkorhonen@0
|
48 };
|
jtkorhonen@0
|
49
|
jtkorhonen@0
|
50
|
jtkorhonen@0
|
51 class MainWindow : public QMainWindow
|
jtkorhonen@0
|
52 {
|
jtkorhonen@0
|
53 Q_OBJECT
|
jtkorhonen@0
|
54
|
jtkorhonen@0
|
55 public:
|
jtkorhonen@0
|
56 MainWindow();
|
jtkorhonen@0
|
57 HgExpWidget *hgExp;
|
jtkorhonen@0
|
58 void writeSettings();
|
jtkorhonen@0
|
59 void enableDisableActions();
|
jtkorhonen@0
|
60
|
jtkorhonen@0
|
61 //Paths to remote repo & workfolder
|
jtkorhonen@0
|
62 //Local repo is directory "./hg/" under work folder
|
jtkorhonen@0
|
63 QString remoteRepoPath;
|
jtkorhonen@0
|
64 QString workFolderPath;
|
jtkorhonen@0
|
65
|
jtkorhonen@30
|
66 QString remoteRepoMruList[NUM_PATHS_IN_MRU_LIST];
|
jtkorhonen@30
|
67 QString workFolderMruList[NUM_PATHS_IN_MRU_LIST];
|
jtkorhonen@30
|
68
|
jtkorhonen@0
|
69 //User info for commits
|
jtkorhonen@0
|
70 QString userInfo;
|
jtkorhonen@0
|
71 bool firstStart;
|
jtkorhonen@0
|
72
|
jtkorhonen@0
|
73 protected:
|
jtkorhonen@0
|
74 void closeEvent(QCloseEvent *event);
|
jtkorhonen@0
|
75 void timerEvent(QTimerEvent *event);
|
jtkorhonen@0
|
76
|
jtkorhonen@0
|
77 public slots:
|
jtkorhonen@0
|
78 void hgStat();
|
jtkorhonen@0
|
79 void tabChanged(int currTab);
|
jtkorhonen@0
|
80
|
jtkorhonen@0
|
81 private slots:
|
jtkorhonen@0
|
82 void about();
|
jtkorhonen@0
|
83 void hgRemove();
|
jtkorhonen@0
|
84 void hgAdd();
|
jtkorhonen@0
|
85 void hgCommit();
|
jtkorhonen@0
|
86 void hgFileDiff();
|
jtkorhonen@0
|
87 void hgFolderDiff();
|
jtkorhonen@0
|
88 void hgChgSetDiff();
|
jtkorhonen@0
|
89 void hgUpdate();
|
jtkorhonen@0
|
90 void hgRevert();
|
jtkorhonen@0
|
91 void hgMerge();
|
jtkorhonen@33
|
92 void hgRetryMerge();
|
jtkorhonen@0
|
93 void settings();
|
jtkorhonen@0
|
94 void hgCloneFromRemote();
|
jtkorhonen@0
|
95 void hgInit();
|
jtkorhonen@0
|
96 void hgIncoming();
|
jtkorhonen@0
|
97 void hgPush();
|
jtkorhonen@0
|
98 void hgPull();
|
jtkorhonen@0
|
99 void hgUpdateToRev();
|
jtkorhonen@0
|
100 void hgAnnotate();
|
jtkorhonen@0
|
101 void hgResolveList();
|
jtkorhonen@0
|
102 void hgResolveMark();
|
jtkorhonen@34
|
103 void hgTag();
|
jtkorhonen@11
|
104 void hgServe();
|
jtkorhonen@34
|
105 void hgIgnore();
|
jtkorhonen@0
|
106
|
jtkorhonen@0
|
107 private:
|
jtkorhonen@0
|
108 void hgHeads();
|
jtkorhonen@0
|
109 void hgParents();
|
jtkorhonen@0
|
110 void hgLog();
|
jtkorhonen@0
|
111 void createActions();
|
jtkorhonen@0
|
112 void connectActions();
|
jtkorhonen@0
|
113 void createMenus();
|
jtkorhonen@0
|
114 void createToolBars();
|
jtkorhonen@0
|
115 void createStatusBar();
|
jtkorhonen@0
|
116 void readSettings();
|
jtkorhonen@0
|
117 void splitChangeSets(QStringList *list, QString hgLogOutput);
|
jtkorhonen@34
|
118 int getCommentOrTag(QString& commentOrTag, QString question, QString dlgTitle);
|
jtkorhonen@2
|
119 void presentLongStdoutToUser(QString stdo);
|
jtkorhonen@17
|
120 void countModifications(QListWidget *workList, int& added, int& modified, int& removed, int& notTracked,
|
jtkorhonen@17
|
121 int& selected,
|
jtkorhonen@17
|
122 int& selectedAdded, int& selectedModified, int& selectedRemoved, int& selectedNotTracked);
|
jtkorhonen@0
|
123 bool isSelectedModified(QListWidget *workList);
|
jtkorhonen@17
|
124 bool areAllSelectedUntracked(QListWidget *workList);
|
jtkorhonen@6
|
125 bool isSelectedDeletable(QListWidget *workList);
|
jtkorhonen@17
|
126 bool areAllSelectedCommitable(QListWidget *workList);
|
jtkorhonen@28
|
127 QString listAllUpIpV4Addresses();
|
jtkorhonen@34
|
128 QString filterTag(QString tag);
|
jtkorhonen@0
|
129
|
jtkorhonen@0
|
130 //Actions enabled flags
|
jtkorhonen@0
|
131 bool remoteRepoActionsEnabled;
|
jtkorhonen@0
|
132 bool localRepoActionsEnabled;
|
jtkorhonen@0
|
133
|
jtkorhonen@0
|
134 //File menu actions
|
jtkorhonen@0
|
135 QAction *hgInitAct;
|
jtkorhonen@0
|
136 QAction *hgCloneFromRemoteAct;
|
jtkorhonen@0
|
137 QAction *settingsAct;
|
jtkorhonen@0
|
138 QAction *exitAct;
|
jtkorhonen@0
|
139
|
jtkorhonen@33
|
140 //Repo actions
|
jtkorhonen@0
|
141 QAction *hgIncomingAct;
|
jtkorhonen@0
|
142 QAction *hgPushAct;
|
jtkorhonen@0
|
143 QAction *hgPullAct;
|
jtkorhonen@0
|
144 QAction *hgStatAct;
|
jtkorhonen@0
|
145 QAction *hgFileDiffAct;
|
jtkorhonen@0
|
146 QAction *hgFolderDiffAct;
|
jtkorhonen@0
|
147 QAction *hgChgSetDiffAct;
|
jtkorhonen@0
|
148 QAction *hgRevertAct;
|
jtkorhonen@0
|
149 QAction *hgAddAct;
|
jtkorhonen@0
|
150 QAction *hgRemoveAct;
|
jtkorhonen@0
|
151 QAction *hgUpdateAct;
|
jtkorhonen@0
|
152 QAction *hgCommitAct;
|
jtkorhonen@0
|
153 QAction *hgMergeAct;
|
jtkorhonen@33
|
154 QAction *hgRetryMergeAct;
|
jtkorhonen@0
|
155 QAction *hgUpdateToRevAct;
|
jtkorhonen@0
|
156 QAction *hgAnnotateAct;
|
jtkorhonen@0
|
157 QAction *hgResolveListAct;
|
jtkorhonen@0
|
158 QAction *hgResolveMarkAct;
|
jtkorhonen@34
|
159 QAction *hgTagAct;
|
jtkorhonen@34
|
160 QAction *hgIgnoreAct;
|
jtkorhonen@11
|
161 QAction *hgServeAct;
|
jtkorhonen@0
|
162
|
jtkorhonen@0
|
163 //Menus
|
jtkorhonen@0
|
164 QMenu *fileMenu;
|
jtkorhonen@0
|
165 QMenu *advancedMenu;
|
jtkorhonen@0
|
166 QMenu *helpMenu;
|
jtkorhonen@0
|
167
|
jtkorhonen@0
|
168 //Help menu actions
|
jtkorhonen@0
|
169 QAction *aboutAct;
|
jtkorhonen@0
|
170 QAction *aboutQtAct;
|
jtkorhonen@0
|
171
|
jtkorhonen@0
|
172 QToolBar *fileToolBar;
|
jtkorhonen@0
|
173 QToolBar *repoToolBar;
|
jtkorhonen@0
|
174 QToolBar *workFolderToolBar;
|
jtkorhonen@0
|
175
|
jtkorhonen@0
|
176 int timerId;
|
jtkorhonen@0
|
177 HGACTIONS runningAction;
|
jtkorhonen@0
|
178 HgRunner *runner;
|
jtkorhonen@0
|
179
|
jtkorhonen@33
|
180 int tabPage;
|
jtkorhonen@0
|
181 unsigned char initialFileTypesBits;
|
jtkorhonen@33
|
182 bool justMerged;
|
jtkorhonen@0
|
183 };
|
jtkorhonen@0
|
184
|
jtkorhonen@0
|
185 #endif
|