1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the test suite of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef PatternistSDK_MainWindow_H
43 #define PatternistSDK_MainWindow_H
48 #include "ui_ui_MainWindow.h"
49 #include "DebugExpressionFactory.h"
50 #include "TestSuite.h"
56 namespace QPatternistSDK
58 class FunctionSignaturesView;
66 * @short The main window of the PatternistSDKView application.
68 * MainWindow is heavily influenced by Qt's examples covering recent files,
69 * main window usage, QSettings, and other central parts.
71 * @ingroup PatternistSDK
72 * @author Frans Englich <frans.englich@nokia.com>
74 class MainWindow : public QMainWindow,
80 virtual ~MainWindow();
83 * Takes care of saving QSettings.
85 virtual void closeEvent(QCloseEvent *event);
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.
94 void testCaseSelected(TestCase *const tc);
98 * The Open action calls this slot. It is responsible
99 * for opening a test suite catalog file.
101 void on_actionOpen_triggered();
103 void on_actionOpenXSLTSCatalog_triggered();
105 void on_actionOpenXSDTSCatalog_triggered();
108 * Executes the selected test case or test group.
110 void on_actionExecute_triggered();
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.
117 void openCatalog(const QUrl &file, const bool reportError,
118 const TestSuite::SuiteType suitType);
120 void openRecentFile();
122 void on_testSuiteView_clicked(const QModelIndex &index);
124 void on_sourceTab_currentChanged(int index);
125 void on_sourceInput_textChanged();
128 * Restarts the program by executing restartApplication.sh loaded as a QResource file,
129 * combined with shutting down this instance.
131 void on_actionRestart_triggered();
133 void writeSettings();
137 * Saves typing a long line.
139 * @returns the source model the index in the proxy @p proxyIndex corresponds to.
141 inline QModelIndex sourceIndex(const QModelIndex &proxyIndex) const;
144 * Saves typing a long line.
146 * @returns the source model for the test suite view, by walking through the
149 inline TreeModel *sourceModel() const;
154 void setCurrentFile(const QUrl &fileName);
155 void updateRecentFileActions();
157 UserTestCase *const m_userTC;
159 enum {MaximumRecentFiles = 5};
160 QAction * m_recentFileActs[MaximumRecentFiles];
163 * The current selected test case.
165 TestCase * m_currentTC;
166 QUrl m_previousOpenedCatalog;
167 TestCaseView * testCaseView;
168 TestResultView * testResultView;
169 FunctionSignaturesView * functionView;
170 TestSuite::SuiteType m_currentSuiteType;
178 // vim: et:ts=4:sw=4:sts=4