jtkorhonen@0
|
1 /****************************************************************************
|
jtkorhonen@0
|
2 **
|
jtkorhonen@0
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
jtkorhonen@0
|
4 ** All rights reserved.
|
jtkorhonen@0
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
|
jtkorhonen@0
|
6 **
|
jtkorhonen@0
|
7 ** This file is part of the examples of the Qt Toolkit.
|
jtkorhonen@0
|
8 **
|
jtkorhonen@0
|
9 ** $QT_BEGIN_LICENSE:LGPL$
|
jtkorhonen@0
|
10 ** Commercial Usage
|
jtkorhonen@0
|
11 ** Licensees holding valid Qt Commercial licenses may use this file in
|
jtkorhonen@0
|
12 ** accordance with the Qt Commercial License Agreement provided with the
|
jtkorhonen@0
|
13 ** Software or, alternatively, in accordance with the terms contained in
|
jtkorhonen@0
|
14 ** a written agreement between you and Nokia.
|
jtkorhonen@0
|
15 **
|
jtkorhonen@0
|
16 ** GNU Lesser General Public License Usage
|
jtkorhonen@0
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
|
jtkorhonen@0
|
18 ** General Public License version 2.1 as published by the Free Software
|
jtkorhonen@0
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
|
jtkorhonen@0
|
20 ** packaging of this file. Please review the following information to
|
jtkorhonen@0
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
|
jtkorhonen@0
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
jtkorhonen@0
|
23 **
|
jtkorhonen@0
|
24 ** In addition, as a special exception, Nokia gives you certain additional
|
jtkorhonen@0
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
|
jtkorhonen@0
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
jtkorhonen@0
|
27 **
|
jtkorhonen@0
|
28 ** GNU General Public License Usage
|
jtkorhonen@0
|
29 ** Alternatively, this file may be used under the terms of the GNU
|
jtkorhonen@0
|
30 ** General Public License version 3.0 as published by the Free Software
|
jtkorhonen@0
|
31 ** Foundation and appearing in the file LICENSE.GPL included in the
|
jtkorhonen@0
|
32 ** packaging of this file. Please review the following information to
|
jtkorhonen@0
|
33 ** ensure the GNU General Public License version 3.0 requirements will be
|
jtkorhonen@0
|
34 ** met: http://www.gnu.org/copyleft/gpl.html.
|
jtkorhonen@0
|
35 **
|
jtkorhonen@0
|
36 ** If you have questions regarding the use of this file, please contact
|
jtkorhonen@0
|
37 ** Nokia at qt-info@nokia.com.
|
jtkorhonen@0
|
38 ** $QT_END_LICENSE$
|
jtkorhonen@0
|
39 **
|
jtkorhonen@0
|
40 ** Copyright (C) Jari Korhonen, 2010 (HgExplorer specific parts, under lgpl)
|
jtkorhonen@0
|
41 ****************************************************************************/
|
jtkorhonen@0
|
42
|
jtkorhonen@0
|
43 #ifndef MAINWINDOW_H
|
jtkorhonen@0
|
44 #define MAINWINDOW_H
|
jtkorhonen@0
|
45
|
jtkorhonen@0
|
46 #include <QMainWindow>
|
jtkorhonen@0
|
47
|
jtkorhonen@0
|
48 #include "hgexpwidget.h"
|
jtkorhonen@0
|
49 #include "hgrunner.h"
|
jtkorhonen@0
|
50 #include "common.h"
|
jtkorhonen@0
|
51
|
jtkorhonen@0
|
52 QT_BEGIN_NAMESPACE
|
jtkorhonen@0
|
53 class QAction;
|
jtkorhonen@0
|
54 class QMenu;
|
jtkorhonen@0
|
55 QT_END_NAMESPACE
|
jtkorhonen@0
|
56
|
jtkorhonen@0
|
57 enum HGACTIONS
|
jtkorhonen@0
|
58 {
|
jtkorhonen@0
|
59 ACT_NONE,
|
jtkorhonen@0
|
60 ACT_STAT,
|
jtkorhonen@0
|
61 ACT_HEADS,
|
jtkorhonen@0
|
62 ACT_PARENTS,
|
jtkorhonen@0
|
63 ACT_LOG,
|
jtkorhonen@0
|
64 ACT_REMOVE,
|
jtkorhonen@0
|
65 ACT_ADD,
|
jtkorhonen@0
|
66 ACT_INCOMING,
|
jtkorhonen@0
|
67 ACT_PUSH,
|
jtkorhonen@0
|
68 ACT_PULL,
|
jtkorhonen@0
|
69 ACT_CLONEFROMREMOTE,
|
jtkorhonen@0
|
70 ACT_INIT,
|
jtkorhonen@0
|
71 ACT_COMMIT,
|
jtkorhonen@0
|
72 ACT_ANNOTATE,
|
jtkorhonen@0
|
73 ACT_FILEDIFF,
|
jtkorhonen@0
|
74 ACT_FOLDERDIFF,
|
jtkorhonen@0
|
75 ACT_CHGSETDIFF,
|
jtkorhonen@0
|
76 ACT_UPDATE,
|
jtkorhonen@0
|
77 ACT_REVERT,
|
jtkorhonen@0
|
78 ACT_MERGE,
|
jtkorhonen@0
|
79 ACT_RESOLVE_LIST,
|
jtkorhonen@11
|
80 ACT_SERVE,
|
jtkorhonen@0
|
81 ACT_RESOLVE_MARK
|
jtkorhonen@0
|
82 };
|
jtkorhonen@0
|
83
|
jtkorhonen@0
|
84
|
jtkorhonen@0
|
85 class MainWindow : public QMainWindow
|
jtkorhonen@0
|
86 {
|
jtkorhonen@0
|
87 Q_OBJECT
|
jtkorhonen@0
|
88
|
jtkorhonen@0
|
89 public:
|
jtkorhonen@0
|
90 MainWindow();
|
jtkorhonen@0
|
91 HgExpWidget *hgExp;
|
jtkorhonen@0
|
92 void writeSettings();
|
jtkorhonen@0
|
93 void enableDisableActions();
|
jtkorhonen@0
|
94
|
jtkorhonen@0
|
95 //Paths to remote repo & workfolder
|
jtkorhonen@0
|
96 //Local repo is directory "./hg/" under work folder
|
jtkorhonen@0
|
97 QString remoteRepoPath;
|
jtkorhonen@0
|
98 QString workFolderPath;
|
jtkorhonen@0
|
99
|
jtkorhonen@0
|
100 //User info for commits
|
jtkorhonen@0
|
101 QString userInfo;
|
jtkorhonen@0
|
102 bool firstStart;
|
jtkorhonen@0
|
103
|
jtkorhonen@0
|
104 protected:
|
jtkorhonen@0
|
105 void closeEvent(QCloseEvent *event);
|
jtkorhonen@0
|
106 void timerEvent(QTimerEvent *event);
|
jtkorhonen@0
|
107
|
jtkorhonen@0
|
108 public slots:
|
jtkorhonen@0
|
109 void hgStat();
|
jtkorhonen@0
|
110 void tabChanged(int currTab);
|
jtkorhonen@0
|
111
|
jtkorhonen@0
|
112 private slots:
|
jtkorhonen@0
|
113 void about();
|
jtkorhonen@0
|
114 void hgRemove();
|
jtkorhonen@0
|
115 void hgAdd();
|
jtkorhonen@0
|
116 void hgCommit();
|
jtkorhonen@0
|
117 void hgFileDiff();
|
jtkorhonen@0
|
118 void hgFolderDiff();
|
jtkorhonen@0
|
119 void hgChgSetDiff();
|
jtkorhonen@0
|
120 void hgUpdate();
|
jtkorhonen@0
|
121 void hgRevert();
|
jtkorhonen@0
|
122 void hgMerge();
|
jtkorhonen@0
|
123 void settings();
|
jtkorhonen@0
|
124 void hgCloneFromRemote();
|
jtkorhonen@0
|
125 void hgInit();
|
jtkorhonen@0
|
126 void hgIncoming();
|
jtkorhonen@0
|
127 void hgPush();
|
jtkorhonen@0
|
128 void hgPull();
|
jtkorhonen@0
|
129 void hgUpdateToRev();
|
jtkorhonen@0
|
130 void hgAnnotate();
|
jtkorhonen@0
|
131 void hgResolveList();
|
jtkorhonen@0
|
132 void hgResolveMark();
|
jtkorhonen@11
|
133 void hgServe();
|
jtkorhonen@0
|
134
|
jtkorhonen@0
|
135 private:
|
jtkorhonen@0
|
136 void hgHeads();
|
jtkorhonen@0
|
137 void hgParents();
|
jtkorhonen@0
|
138 void hgLog();
|
jtkorhonen@0
|
139 void createActions();
|
jtkorhonen@0
|
140 void connectActions();
|
jtkorhonen@0
|
141 void createMenus();
|
jtkorhonen@0
|
142 void createToolBars();
|
jtkorhonen@0
|
143 void createStatusBar();
|
jtkorhonen@0
|
144 void readSettings();
|
jtkorhonen@0
|
145 void splitChangeSets(QStringList *list, QString hgLogOutput);
|
jtkorhonen@0
|
146 int getCommitComment(QString& comment);
|
jtkorhonen@2
|
147 void presentLongStdoutToUser(QString stdo);
|
jtkorhonen@17
|
148 void countModifications(QListWidget *workList, int& added, int& modified, int& removed, int& notTracked,
|
jtkorhonen@17
|
149 int& selected,
|
jtkorhonen@17
|
150 int& selectedAdded, int& selectedModified, int& selectedRemoved, int& selectedNotTracked);
|
jtkorhonen@0
|
151 bool isSelectedModified(QListWidget *workList);
|
jtkorhonen@17
|
152 bool areAllSelectedUntracked(QListWidget *workList);
|
jtkorhonen@6
|
153 bool isSelectedDeletable(QListWidget *workList);
|
jtkorhonen@17
|
154 bool areAllSelectedCommitable(QListWidget *workList);
|
jtkorhonen@17
|
155 QString findMyIps();
|
jtkorhonen@0
|
156
|
jtkorhonen@0
|
157
|
jtkorhonen@0
|
158 //Actions enabled flags
|
jtkorhonen@0
|
159 bool remoteRepoActionsEnabled;
|
jtkorhonen@0
|
160 bool localRepoActionsEnabled;
|
jtkorhonen@0
|
161
|
jtkorhonen@0
|
162 //File menu actions
|
jtkorhonen@0
|
163 QAction *hgInitAct;
|
jtkorhonen@0
|
164 QAction *hgCloneFromRemoteAct;
|
jtkorhonen@0
|
165 QAction *settingsAct;
|
jtkorhonen@0
|
166 QAction *exitAct;
|
jtkorhonen@0
|
167
|
jtkorhonen@0
|
168 QAction *hgIncomingAct;
|
jtkorhonen@0
|
169 QAction *hgPushAct;
|
jtkorhonen@0
|
170 QAction *hgPullAct;
|
jtkorhonen@0
|
171 QAction *hgStatAct;
|
jtkorhonen@0
|
172 QAction *hgFileDiffAct;
|
jtkorhonen@0
|
173 QAction *hgFolderDiffAct;
|
jtkorhonen@0
|
174 QAction *hgChgSetDiffAct;
|
jtkorhonen@0
|
175 QAction *hgRevertAct;
|
jtkorhonen@0
|
176 QAction *hgAddAct;
|
jtkorhonen@0
|
177 QAction *hgRemoveAct;
|
jtkorhonen@0
|
178 QAction *hgUpdateAct;
|
jtkorhonen@0
|
179 QAction *hgCommitAct;
|
jtkorhonen@0
|
180 QAction *hgMergeAct;
|
jtkorhonen@0
|
181 QAction *hgUpdateToRevAct;
|
jtkorhonen@0
|
182 QAction *hgAnnotateAct;
|
jtkorhonen@0
|
183 QAction *hgResolveListAct;
|
jtkorhonen@0
|
184 QAction *hgResolveMarkAct;
|
jtkorhonen@11
|
185 QAction *hgServeAct;
|
jtkorhonen@0
|
186
|
jtkorhonen@0
|
187 //Menus
|
jtkorhonen@0
|
188 QMenu *fileMenu;
|
jtkorhonen@0
|
189 QMenu *advancedMenu;
|
jtkorhonen@0
|
190 QMenu *helpMenu;
|
jtkorhonen@0
|
191
|
jtkorhonen@0
|
192 //Help menu actions
|
jtkorhonen@0
|
193 QAction *aboutAct;
|
jtkorhonen@0
|
194 QAction *aboutQtAct;
|
jtkorhonen@0
|
195
|
jtkorhonen@0
|
196 QToolBar *fileToolBar;
|
jtkorhonen@0
|
197 QToolBar *repoToolBar;
|
jtkorhonen@0
|
198 QToolBar *workFolderToolBar;
|
jtkorhonen@0
|
199
|
jtkorhonen@0
|
200 int timerId;
|
jtkorhonen@0
|
201 HGACTIONS runningAction;
|
jtkorhonen@0
|
202 HgRunner *runner;
|
jtkorhonen@0
|
203
|
jtkorhonen@0
|
204 int tabPage;
|
jtkorhonen@0
|
205 unsigned char initialFileTypesBits;
|
jtkorhonen@0
|
206 };
|
jtkorhonen@0
|
207
|
jtkorhonen@0
|
208 #endif
|