Fork me on GitHub
2.15.20
FGx
A cross-platform launcher for FlightGear
execontrols.cpp
Go to the documentation of this file.
1 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
2 // FGx FlightGear Launcher // execontrols.cpp
3 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
4 // (c) 2010-2012
5 // Yves Sablonier, Pete Morgan
6 // Geoff McLane
7 // GNU GPLv2, see main.cpp and shipped licence.txt for further information
8 
9 #include <QFile>
10 #include <QFileInfo>
11 #include <QProcess>
12 #include <QTimer>
13 
14 #include <QHBoxLayout>
15 
16 #include "execontrols.h"
18 #include "utilities/utilities.h"
19 
20 ExeControls::ExeControls(QString title, QWidget *parent) :
21  QGroupBox(parent)
22 {
23  //exe_name = exeCmd;
24  setTitle(title);
25 
26  //** Grid layout just in case..
27  QVBoxLayout *layout = new QVBoxLayout();
28  setLayout(layout);
29  layout->setContentsMargins(5,5,5,5);
30  layout->setSpacing(10);
31 
32 
33  //** Buttons layout
34  QHBoxLayout *buttlay = new QHBoxLayout();
35  layout->addLayout(buttlay);
36 
37  //** Stop Button
38  buttonStop = new QToolButton();
39  buttonStop->setText("Stop");
40  buttonStop->setAutoRaise(true);
41  buttonStop->setIcon(QIcon(":/icon/stop"));
42  buttonStop->setStyleSheet("padding: 0px;");
43  buttonStop->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
44  buttonStop->setEnabled(false);
45  connect(buttonStop, SIGNAL(clicked()), this, SLOT(on_stop_clicked()));
46  buttlay->addWidget(buttonStop);
47 
48  //** Start Button
49  buttonStart = new QToolButton();
50  buttonStart->setText("Start");
51  buttonStart->setAutoRaise(true);
52  buttonStart->setIcon(QIcon(":/icon/start"));
53  buttonStart->setStyleSheet("padding: 0px;");
54  buttonStart->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
55  buttlay->addWidget(buttonStart);
56  connect(buttonStart, SIGNAL(clicked()), this, SLOT(on_start_clicked()));
57 
58 
59 }
60 
61 
62 //== Start
64  emit start();
65 }
66 
67 
68 //== Stop
70  emit stop();
71 }
72 
73 
74 //== set_running
75 void ExeControls::set_running(bool running){
76  buttonStart->setEnabled(running == false);
77  buttonStop->setEnabled(running == true);
78 }
void start()
void on_start_clicked()
Definition: execontrols.cpp:63
ExeControls(QString title, QWidget *parent=0)
Definition: execontrols.cpp:20
void set_running(bool running)
Definition: execontrols.cpp:75
void on_stop_clicked()
Definition: execontrols.cpp:69
QToolButton * buttonStart
Definition: execontrols.h:28
QToolButton * buttonStop
Definition: execontrols.h:29