author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 15 Mar 2010 12:43:09 +0200 | |
branch | RCL_3 |
changeset 6 | dee5afe5301f |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the test suite of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
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 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef PatternistSDK_MainWindow_H |
|
43 |
#define PatternistSDK_MainWindow_H |
|
44 |
||
45 |
#include <QtDebug> |
|
46 |
#include <QUrl> |
|
47 |
||
48 |
#include "ui_ui_MainWindow.h" |
|
49 |
#include "DebugExpressionFactory.h" |
|
50 |
#include "TestSuite.h" |
|
51 |
||
52 |
QT_BEGIN_HEADER |
|
53 |
||
54 |
QT_BEGIN_NAMESPACE |
|
55 |
||
56 |
namespace QPatternistSDK |
|
57 |
{ |
|
58 |
class FunctionSignaturesView; |
|
59 |
class TestCase; |
|
60 |
class TestCaseView; |
|
61 |
class TestResultView; |
|
62 |
class TreeModel; |
|
63 |
class UserTestCase; |
|
64 |
||
65 |
/** |
|
66 |
* @short The main window of the PatternistSDKView application. |
|
67 |
* |
|
68 |
* MainWindow is heavily influenced by Qt's examples covering recent files, |
|
69 |
* main window usage, QSettings, and other central parts. |
|
70 |
* |
|
71 |
* @ingroup PatternistSDK |
|
72 |
* @author Frans Englich <frans.englich@nokia.com> |
|
73 |
*/ |
|
74 |
class MainWindow : public QMainWindow, |
|
75 |
private Ui_MainWindow |
|
76 |
{ |
|
77 |
Q_OBJECT |
|
78 |
public: |
|
79 |
MainWindow(); |
|
80 |
virtual ~MainWindow(); |
|
81 |
||
82 |
/** |
|
83 |
* Takes care of saving QSettings. |
|
84 |
*/ |
|
85 |
virtual void closeEvent(QCloseEvent *event); |
|
86 |
||
87 |
Q_SIGNALS: |
|
88 |
/** |
|
89 |
* Emitted whenever a test case is selected. The test case |
|
90 |
* selected is @p tc. If something that wasn't a test case |
|
91 |
* was selected, such as a test group or that a new test suite was |
|
92 |
* opened, @p tc is @c null. |
|
93 |
*/ |
|
94 |
void testCaseSelected(TestCase *const tc); |
|
95 |
||
96 |
private Q_SLOTS: |
|
97 |
/** |
|
98 |
* The Open action calls this slot. It is responsible |
|
99 |
* for opening a test suite catalog file. |
|
100 |
*/ |
|
101 |
void on_actionOpen_triggered(); |
|
102 |
||
103 |
void on_actionOpenXSLTSCatalog_triggered(); |
|
104 |
||
105 |
void on_actionOpenXSDTSCatalog_triggered(); |
|
106 |
||
107 |
/** |
|
108 |
* Executes the selected test case or test group. |
|
109 |
*/ |
|
110 |
void on_actionExecute_triggered(); |
|
111 |
||
112 |
/** |
|
113 |
* @param file the name of the catalog to open. |
|
114 |
* @param reportError whether the user should be notified about a loading error. If @c true, |
|
115 |
* an informative message box will be displayed, if any errors occurred. |
|
116 |
*/ |
|
117 |
void openCatalog(const QUrl &file, const bool reportError, |
|
118 |
const TestSuite::SuiteType suitType); |
|
119 |
||
120 |
void openRecentFile(); |
|
121 |
||
122 |
void on_testSuiteView_clicked(const QModelIndex &index); |
|
123 |
||
124 |
void on_sourceTab_currentChanged(int index); |
|
125 |
void on_sourceInput_textChanged(); |
|
126 |
||
127 |
/** |
|
128 |
* Restarts the program by executing restartApplication.sh loaded as a QResource file, |
|
129 |
* combined with shutting down this instance. |
|
130 |
*/ |
|
131 |
void on_actionRestart_triggered(); |
|
132 |
||
133 |
void writeSettings(); |
|
134 |
||
135 |
private: |
|
136 |
/** |
|
137 |
* Saves typing a long line. |
|
138 |
* |
|
139 |
* @returns the source model the index in the proxy @p proxyIndex corresponds to. |
|
140 |
*/ |
|
141 |
inline QModelIndex sourceIndex(const QModelIndex &proxyIndex) const; |
|
142 |
||
143 |
/** |
|
144 |
* Saves typing a long line. |
|
145 |
* |
|
146 |
* @returns the source model for the test suite view, by walking through the |
|
147 |
* proxy model. |
|
148 |
*/ |
|
149 |
inline TreeModel *sourceModel() const; |
|
150 |
||
151 |
void setupMenu(); |
|
152 |
void setupActions(); |
|
153 |
void readSettings(); |
|
154 |
void setCurrentFile(const QUrl &fileName); |
|
155 |
void updateRecentFileActions(); |
|
156 |
||
157 |
UserTestCase *const m_userTC; |
|
158 |
||
159 |
enum {MaximumRecentFiles = 5}; |
|
160 |
QAction * m_recentFileActs[MaximumRecentFiles]; |
|
161 |
||
162 |
/** |
|
163 |
* The current selected test case. |
|
164 |
*/ |
|
165 |
TestCase * m_currentTC; |
|
166 |
QUrl m_previousOpenedCatalog; |
|
167 |
TestCaseView * testCaseView; |
|
168 |
TestResultView * testResultView; |
|
169 |
FunctionSignaturesView * functionView; |
|
170 |
TestSuite::SuiteType m_currentSuiteType; |
|
171 |
}; |
|
172 |
} |
|
173 |
QT_END_NAMESPACE |
|
174 |
||
175 |
QT_END_HEADER |
|
176 |
||
177 |
#endif |
|
178 |
// vim: et:ts=4:sw=4:sts=4 |