trikRuntime
wiFiInitWidget.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 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
20  #include <QtGui/QWidget>
21  #include <QtGui/QLabel>
22  #include <QtGui/QVBoxLayout>
23 #else
24  #include <QtWidgets/QWidget>
25  #include <QtWidgets/QLabel>
26  #include <QtWidgets/QVBoxLayout>
27 #endif
28 
29 #include <QtCore/QProcess>
30 #include <QtCore/QEventLoop>
31 
32 #include "wiFiModeWidget.h"
33 #include "mainWidget.h"
34 
35 namespace trikGui {
36 
38 class WiFiInitWidget : public MainWidget
39 {
40  Q_OBJECT
41 
42 public:
45  explicit WiFiInitWidget(QWidget *parent = 0);
46 
47  enum Result {
49  , fail
50  };
51 
56 
57  void renewFocus() override;
58 
59 protected:
60  void keyPressEvent(QKeyEvent *event) override;
61 
62 private:
63  QEventLoop mEventLoop;
64  QVBoxLayout mLayout;
65  QLabel mInitMessage;
66  QLabel mWaitMessage;
67  QLabel mBreakMessage;
68  QProcess mProcess;
69 
70 private slots:
71  void onProcessFinished(int, QProcess::ExitStatus exitStatus);
72  void onProcessError(QProcess::ProcessError error);
73 };
74 
75 }
void keyPressEvent(QKeyEvent *event) override
Definition: wiFiInitWidget.cpp:91
Abstract class for widgets which will be used for conversation with user.
Definition: mainWidget.h:28
Definition: wiFiInitWidget.h:49
WiFiInitWidget(QWidget *parent=0)
Constructor.
Definition: wiFiInitWidget.cpp:28
Mode
Definition: wiFiModeWidget.h:45
Definition: abstractIndicator.h:21
Definition: wiFiInitWidget.h:48
Result init(WiFiModeWidget::Mode mode)
Initialize wi-fi on the controller.
Definition: wiFiInitWidget.cpp:51
Widget for initializing wi-fi on the controller.
Definition: wiFiInitWidget.h:38
Result
Definition: wiFiInitWidget.h:47
void renewFocus() override
Set focus properly on this widget or one of its children.
Definition: wiFiInitWidget.cpp:86