trikRuntime
backgroundWidget.h
Go to the documentation of this file.
1 /* Copyright 2014 - 2015 CyberTech Labs Ltd.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License. */
14 
15 #pragma once
16 
17 #include <QtCore/qglobal.h>
18 
19 #include <QtCore/QString>
20 #include <QtCore/QStack>
21 #include <QtCore/QScopedPointer>
22 
23 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
24  #include <QtGui/QWidget>
25  #include <QtGui/QVBoxLayout>
26  #include <QtGui/QHBoxLayout>
27  #include <QtGui/QStackedLayout>
28 #else
29  #include <QtWidgets/QWidget>
30  #include <QtWidgets/QVBoxLayout>
31  #include <QtWidgets/QHBoxLayout>
32  #include <QtWidgets/QStackedLayout>
33 #endif
34 
35 #include "controller.h"
36 #include "batteryIndicator.h"
37 #include "wiFiIndicator.h"
38 #include "gamepadIndicator.h"
39 #include "openSocketIndicator.h"
40 #include "startWidget.h"
41 #include "runningWidget.h"
42 
43 namespace trikGui {
44 
45 class LazyMainWidget;
46 
50 class BackgroundWidget : public QWidget
51 {
52  Q_OBJECT
53 
54 public:
59  explicit BackgroundWidget(const QString &configPath, QWidget *parent = 0);
60 
61  ~BackgroundWidget() override;
62 
63 private slots:
66  void addMainWidget(trikGui::MainWidget &widget);
67 
70  void addRunningWidget(trikGui::MainWidget &widget);
71 
74  void addLazyWidget(trikGui::LazyMainWidget &widget);
75 
77  void renewFocus();
78 
80  void refresh();
81 
84  void showMainWidget(trikGui::MainWidget &widget);
85 
87  void showRunningWidget(const QString &fileName, int scriptId);
88 
89  void hideRunningWidget(int scriptId);
90 
91  void showError(const QString &error, int scriptId);
92 
93  void hideGraphicsWidget();
94 
95  void hideScriptWidgets();
96 
97  void updateStack(int removedWidget);
98 
99 private:
102  void resetWidgetLayout(MainWidget &widget);
103 
105  void expandMainWidget();
106 
108  void unexpandMainWidget();
109 
110  const QMargins mDefaultMargins{11, 11, 11, 11};
111 
112  Controller mController;
113  QVBoxLayout mMainLayout;
114  QHBoxLayout mStatusBarLayout;
115  QStackedLayout mMainWidgetsLayout;
116  BatteryIndicator mBatteryIndicator;
117  WiFiIndicator mWiFiIndicator;
118  GamepadIndicator mGamepadIndicator;
119  OpenSocketIndicator mMailboxIndicator;
120  OpenSocketIndicator mCommunicatorIndicator;
121  StartWidget mStartWidget;
122  RunningWidget mRunningWidget;
123  QScopedPointer<LazyMainWidget> mBrickDisplayWidgetWrapper;
124 
125  QStack<int> mMainWidgetIndex;
126 };
127 
128 }
Main widget for trikGui application, displays menu which allows to open other widgets.
Definition: startWidget.h:49
Provides backend features like Qt Script runner for frontend.
Definition: controller.h:35
Abstract class for widgets which will be used for conversation with user.
Definition: mainWidget.h:28
TrikGui backround widget which is a parent for other trikGui widgets.
Definition: backgroundWidget.h:50
BackgroundWidget(const QString &configPath, QWidget *parent=0)
Constructor.
Definition: backgroundWidget.cpp:29
Window that shows information about currently executed script.
Definition: runningWidget.h:38
A label that shows wifi connection status.
Definition: wiFiIndicator.h:25
Definition: abstractIndicator.h:21
~BackgroundWidget() override
Definition: backgroundWidget.cpp:80
A label that shows gamepad connection status.
Definition: gamepadIndicator.h:25
A label that shows whether or not some connection is open (for example, Mailbox connection) ...
Definition: openSocketIndicator.h:28
Abstract class for widgets which will be used for conversation with user (but when it doesn&#39;t want to...
Definition: lazyMainWidget.h:31
Label showing battery voltage.
Definition: batteryIndicator.h:32