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@0
|
43 ACT_RESOLVE_MARK
|
jtkorhonen@0
|
44 };
|
jtkorhonen@0
|
45
|
jtkorhonen@0
|
46
|
jtkorhonen@0
|
47 class MainWindow : public QMainWindow
|
jtkorhonen@0
|
48 {
|
jtkorhonen@0
|
49 Q_OBJECT
|
jtkorhonen@0
|
50
|
jtkorhonen@0
|
51 public:
|
jtkorhonen@0
|
52 MainWindow();
|
jtkorhonen@0
|
53 HgExpWidget *hgExp;
|
jtkorhonen@0
|
54 void writeSettings();
|
jtkorhonen@0
|
55 void enableDisableActions();
|
jtkorhonen@0
|
56
|
jtkorhonen@0
|
57 //Paths to remote repo & workfolder
|
jtkorhonen@0
|
58 //Local repo is directory "./hg/" under work folder
|
jtkorhonen@0
|
59 QString remoteRepoPath;
|
jtkorhonen@0
|
60 QString workFolderPath;
|
jtkorhonen@0
|
61
|
jtkorhonen@30
|
62 QString remoteRepoMruList[NUM_PATHS_IN_MRU_LIST];
|
jtkorhonen@30
|
63 QString workFolderMruList[NUM_PATHS_IN_MRU_LIST];
|
jtkorhonen@30
|
64
|
jtkorhonen@0
|
65 //User info for commits
|
jtkorhonen@0
|
66 QString userInfo;
|
jtkorhonen@0
|
67 bool firstStart;
|
jtkorhonen@0
|
68
|
jtkorhonen@0
|
69 protected:
|
jtkorhonen@0
|
70 void closeEvent(QCloseEvent *event);
|
jtkorhonen@0
|
71 void timerEvent(QTimerEvent *event);
|
jtkorhonen@0
|
72
|
jtkorhonen@0
|
73 public slots:
|
jtkorhonen@0
|
74 void hgStat();
|
jtkorhonen@0
|
75 void tabChanged(int currTab);
|
jtkorhonen@0
|
76
|
jtkorhonen@0
|
77 private slots:
|
jtkorhonen@0
|
78 void about();
|
jtkorhonen@0
|
79 void hgRemove();
|
jtkorhonen@0
|
80 void hgAdd();
|
jtkorhonen@0
|
81 void hgCommit();
|
jtkorhonen@0
|
82 void hgFileDiff();
|
jtkorhonen@0
|
83 void hgFolderDiff();
|
jtkorhonen@0
|
84 void hgChgSetDiff();
|
jtkorhonen@0
|
85 void hgUpdate();
|
jtkorhonen@0
|
86 void hgRevert();
|
jtkorhonen@0
|
87 void hgMerge();
|
jtkorhonen@0
|
88 void settings();
|
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();
|
jtkorhonen@0
|
94 void hgUpdateToRev();
|
jtkorhonen@0
|
95 void hgAnnotate();
|
jtkorhonen@0
|
96 void hgResolveList();
|
jtkorhonen@0
|
97 void hgResolveMark();
|
jtkorhonen@11
|
98 void hgServe();
|
jtkorhonen@0
|
99
|
jtkorhonen@0
|
100 private:
|
jtkorhonen@0
|
101 void hgHeads();
|
jtkorhonen@0
|
102 void hgParents();
|
jtkorhonen@0
|
103 void hgLog();
|
jtkorhonen@0
|
104 void createActions();
|
jtkorhonen@0
|
105 void connectActions();
|
jtkorhonen@0
|
106 void createMenus();
|
jtkorhonen@0
|
107 void createToolBars();
|
jtkorhonen@0
|
108 void createStatusBar();
|
jtkorhonen@0
|
109 void readSettings();
|
jtkorhonen@0
|
110 void splitChangeSets(QStringList *list, QString hgLogOutput);
|
jtkorhonen@0
|
111 int getCommitComment(QString& comment);
|
jtkorhonen@2
|
112 void presentLongStdoutToUser(QString stdo);
|
jtkorhonen@17
|
113 void countModifications(QListWidget *workList, int& added, int& modified, int& removed, int& notTracked,
|
jtkorhonen@17
|
114 int& selected,
|
jtkorhonen@17
|
115 int& selectedAdded, int& selectedModified, int& selectedRemoved, int& selectedNotTracked);
|
jtkorhonen@0
|
116 bool isSelectedModified(QListWidget *workList);
|
jtkorhonen@17
|
117 bool areAllSelectedUntracked(QListWidget *workList);
|
jtkorhonen@6
|
118 bool isSelectedDeletable(QListWidget *workList);
|
jtkorhonen@17
|
119 bool areAllSelectedCommitable(QListWidget *workList);
|
jtkorhonen@28
|
120 QString listAllUpIpV4Addresses();
|
jtkorhonen@0
|
121
|
jtkorhonen@0
|
122
|
jtkorhonen@0
|
123 //Actions enabled flags
|
jtkorhonen@0
|
124 bool remoteRepoActionsEnabled;
|
jtkorhonen@0
|
125 bool localRepoActionsEnabled;
|
jtkorhonen@0
|
126
|
jtkorhonen@0
|
127 //File menu actions
|
jtkorhonen@0
|
128 QAction *hgInitAct;
|
jtkorhonen@0
|
129 QAction *hgCloneFromRemoteAct;
|
jtkorhonen@0
|
130 QAction *settingsAct;
|
jtkorhonen@0
|
131 QAction *exitAct;
|
jtkorhonen@0
|
132
|
jtkorhonen@0
|
133 QAction *hgIncomingAct;
|
jtkorhonen@0
|
134 QAction *hgPushAct;
|
jtkorhonen@0
|
135 QAction *hgPullAct;
|
jtkorhonen@0
|
136 QAction *hgStatAct;
|
jtkorhonen@0
|
137 QAction *hgFileDiffAct;
|
jtkorhonen@0
|
138 QAction *hgFolderDiffAct;
|
jtkorhonen@0
|
139 QAction *hgChgSetDiffAct;
|
jtkorhonen@0
|
140 QAction *hgRevertAct;
|
jtkorhonen@0
|
141 QAction *hgAddAct;
|
jtkorhonen@0
|
142 QAction *hgRemoveAct;
|
jtkorhonen@0
|
143 QAction *hgUpdateAct;
|
jtkorhonen@0
|
144 QAction *hgCommitAct;
|
jtkorhonen@0
|
145 QAction *hgMergeAct;
|
jtkorhonen@0
|
146 QAction *hgUpdateToRevAct;
|
jtkorhonen@0
|
147 QAction *hgAnnotateAct;
|
jtkorhonen@0
|
148 QAction *hgResolveListAct;
|
jtkorhonen@0
|
149 QAction *hgResolveMarkAct;
|
jtkorhonen@11
|
150 QAction *hgServeAct;
|
jtkorhonen@0
|
151
|
jtkorhonen@0
|
152 //Menus
|
jtkorhonen@0
|
153 QMenu *fileMenu;
|
jtkorhonen@0
|
154 QMenu *advancedMenu;
|
jtkorhonen@0
|
155 QMenu *helpMenu;
|
jtkorhonen@0
|
156
|
jtkorhonen@0
|
157 //Help menu actions
|
jtkorhonen@0
|
158 QAction *aboutAct;
|
jtkorhonen@0
|
159 QAction *aboutQtAct;
|
jtkorhonen@0
|
160
|
jtkorhonen@0
|
161 QToolBar *fileToolBar;
|
jtkorhonen@0
|
162 QToolBar *repoToolBar;
|
jtkorhonen@0
|
163 QToolBar *workFolderToolBar;
|
jtkorhonen@0
|
164
|
jtkorhonen@0
|
165 int timerId;
|
jtkorhonen@0
|
166 HGACTIONS runningAction;
|
jtkorhonen@0
|
167 HgRunner *runner;
|
jtkorhonen@0
|
168
|
jtkorhonen@0
|
169 int tabPage;
|
jtkorhonen@0
|
170 unsigned char initialFileTypesBits;
|
jtkorhonen@0
|
171 };
|
jtkorhonen@0
|
172
|
jtkorhonen@0
|
173 #endif
|