blob: 87e65a89025d6933ade233ab734b9cb00d3c164d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/****************************************************************************
**
** Copyright (C) 2016 Pelagicore AG
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QmlLive tool.
**
** $QT_BEGIN_LICENSE:GPL-QTAS$
** Commercial License Usage
** Licensees holding valid commercial Qt Automotive Suite licenses may use
** this file in accordance with the commercial license agreement provided
** with the Software or, alternatively, in accordance with the terms
** contained in a written agreement between you and The Qt Company. For
** licensing terms and conditions see https://www.qt.io/terms-conditions.
** For further information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
** SPDX-License-Identifier: GPL-3.0
**
****************************************************************************/
#pragma once
#include <QtCore>
#include <QtWidgets>
#include <QtQuick>
class BenchQuickView;
class WorkspaceView;
class LogView;
class LiveRuntime;
class LiveHubEngine;
class BenchLiveNodeEngine;
class WindowWidget;
class HostModel;
class HostManager;
class AllHostsWidget;
class Host;
class HostDiscoveryManager;
class Options;
QT_FORWARD_DECLARE_CLASS(QToolBar);
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void activateDocument(const QString path);
void setWorkspace(const QString& path, bool activateRootPath = true);
void setPluginPath(const QString& path);
void setImportPaths(const QStringList& pathList);
void setStaysOnTop(bool enabled);
void init();
bool isInitialized() const { return m_initialized; }
HostModel *hostModel() const { return m_hostModel; }
HostManager *hostManager() const { return m_hostManager; }
protected:
void closeEvent(QCloseEvent *event);
void showEvent(QShowEvent *event);
private:
void setupContent();
void setupWorkspaceView();
void setupHostView();
void setupLogView();
void setupToolBar();
void setupMenuBar();
void writeSettings();
void resetImportPaths();
private slots:
void resizeToFit();
void takeSnapshot();
void slowDownAnimations(bool enable);
void openWorkspace();
void logQuitEvent();
void updateWindowTitle();
void openPreferences(Host *host = 0);
void openRecentFolder();
void clearRecentFolder();
void stayOnTop();
void onActiveWindowChanged(QQuickWindow *activeWindow);
void onLogWidgetAdded(QDockWidget* logDock);
private:
void updateRecentFolder(const QString &path = QString());
private:
bool m_initialized;
WindowWidget *m_ww;
WorkspaceView *m_workspace;
QString m_workspacePath;
LogView *m_log;
QUrl m_currentSource;
QDockWidget *m_logDock;
QDockWidget *m_workspaceDock;
QDockWidget *m_hostDock;
HostManager *m_hostManager;
HostModel *m_hostModel;
HostDiscoveryManager *m_discoveryManager;
AllHostsWidget* m_allHosts;
LiveHubEngine *m_hub;
BenchLiveNodeEngine *m_node;
QStringList m_recentFolder;
QMenu* m_recentMenu;
QMenu* m_logDockMenu;
QAction *m_stayOnTop;
QAction *m_openWorkspace;
QAction *m_refresh;
QAction *m_resizeFit;
QAction *m_clipRootObject;
QToolBar* m_toolBar;
QStringList m_qmlDefaultimportList;
};
|