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