trikRuntime
runningWidget.h
Go to the documentation of this file.
1 /* Copyright 2013 Yurii Litvinov
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 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
20  #include <QtGui/QWidget>
21  #include <QtGui/QVBoxLayout>
22  #include <QtGui/QLabel>
23 #else
24  #include <QtWidgets/QWidget>
25  #include <QtWidgets/QLabel>
26  #include <QtWidgets/QVBoxLayout>
27 #endif
28 
29 #include <QtCore/QList>
30 #include <QtCore/QString>
31 
32 #include "controller.h"
33 #include "mainWidget.h"
34 
35 namespace trikGui {
36 
38 class RunningWidget : public MainWidget
39 {
40  Q_OBJECT
41 
42 public:
47  explicit RunningWidget(Controller &controller, QWidget *parent = 0);
48 
50  void showError(const QString &error, int scriptId);
51 
53  void setProgram(const QString &programName, int scriptId);
54 
56  int scriptId() const;
57 
58  void renewFocus() override;
59 
60 signals:
62  void hideMe(int scriptId);
63 
64 protected:
65  void keyPressEvent(QKeyEvent *event) override;
66 
67 private:
68  QVBoxLayout mLayout;
69  QLabel mStatusLabel;
70  QLabel mAbortLabel;
71  Controller &mController;
72  int mScriptId { -1 };
73 };
74 
75 }
Provides backend features like Qt Script runner for frontend.
Definition: controller.h:35
void showError(const QString &error, int scriptId)
Shows given error message on a widget.
Definition: runningWidget.cpp:39
Abstract class for widgets which will be used for conversation with user.
Definition: mainWidget.h:28
void hideMe(int scriptId)
Emitted when running widget wants to hide itself.
Window that shows information about currently executed script.
Definition: runningWidget.h:38
void keyPressEvent(QKeyEvent *event) override
Definition: runningWidget.cpp:57
Definition: abstractIndicator.h:21
void renewFocus() override
Set focus properly on this widget or one of its children.
Definition: runningWidget.cpp:71
int scriptId() const
Returns an id of the script which information running widget is showing at the moment.
Definition: runningWidget.cpp:76
RunningWidget(Controller &controller, QWidget *parent=0)
Constructor.
Definition: runningWidget.cpp:21
void setProgram(const QString &programName, int scriptId)
Associates running widget with a new script.
Definition: runningWidget.cpp:50