1 #include "ProgramDisplay.h"
2 #include "ProgramDisplay.moc"
7 ProgramDisplay::ProgramDisplay(QWidget
*parent
) {
9 this->setGeometry(0, 0, 400, 300);
10 this->setWindowTitle("Unlaunched program");
12 create_launch_widget();
15 ProgramDisplay::~ProgramDisplay() {
19 void ProgramDisplay::create_launch_widget() {
20 launch_widget
= new QWidget();
21 launch_layout
= new QVBoxLayout();
23 launch_program_layout
= new QGridLayout();
25 launch_program_label
= new QLabel(tr("Executable path:"));
26 launch_program_layout
->addWidget(launch_program_label
, 0, 0);
27 launch_program_name
= new QLineEdit("");
28 launch_program_layout
->addWidget(launch_program_name
, 0, 1);
30 launch_layout
->addLayout(launch_program_layout
);
33 launch_program_arguments_label
= new QLabel(tr("Program arguments:"));
34 launch_program_layout
->addWidget(launch_program_arguments_label
, 1, 0);
35 launch_program_arguments
= new QLineEdit("");
36 launch_program_layout
->addWidget(launch_program_arguments
, 1, 1);
38 launch_program_xterm
= new QCheckBox("&Launch executable in terminal");
39 launch_program_layout
->addWidget(launch_program_xterm
, 2, 0);
41 launch_layout
->addStretch();
42 launch_program_button
= new QPushButton(tr("&Begin execution"));
43 launch_program_button
->show();
44 connect(launch_program_button
, SIGNAL(clicked()), this, SLOT(begin_program()));
45 launch_program_layout
->addWidget(launch_program_button
, 3, 0, 1, 2, Qt::AlignBottom
);
47 launch_widget
->setLayout(launch_layout
);
48 setWidget(launch_widget
);
51 void ProgramDisplay::create_running_widget() {
52 running_widget
= new QWidget();
53 running_layout
= new QVBoxLayout();
54 running_tab_bar
= new QTabWidget();
56 program_block_display
= new ProgramBlockDisplay();
57 program_reference_display
= new ProgramReferenceDisplay();
60 running_general
= new QWidget();
61 running_general_layout
= new QVBoxLayout();
64 running_general_program_layout
= new QHBoxLayout();
66 running_general_program_label
= new QLabel(tr("Executable path:"));
67 running_general_program_layout
->addWidget(running_general_program_label
);
68 running_general_program_name_label
= new QLabel(launch_program_name
->text());
69 running_general_program_layout
->addWidget(running_general_program_name_label
);
71 running_general_layout
->addLayout(running_general_program_layout
);
73 running_general_layout
->addStretch();
75 running_general
->setLayout(running_general_layout
);
77 running_tab_bar
->addTab(running_general
, "&General information");
78 running_tab_bar
->addTab(program_block_display
, "&Block display");
79 running_tab_bar
->addTab(program_reference_display
, "&Reference display");
81 running_layout
->addWidget(running_tab_bar
);
83 running_widget
->setLayout(running_layout
);
84 setWidget(running_widget
);
86 setWindowTitle(tr("Running program (") + launch_program_name
->text() + tr(")"));
89 void ProgramDisplay::begin_program() {
90 create_running_widget();
91 program
= new Program(launch_program_name
->text().toStdString(), launch_program_arguments
->text().toStdString(), launch_program_xterm
->isChecked());
95 } // namespace Aesalon