comparison mainwindow.h @ 0:a9098eba2ee5

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