-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathhelperwindow.cpp
More file actions
41 lines (36 loc) · 1.04 KB
/
Copy pathhelperwindow.cpp
File metadata and controls
41 lines (36 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "helperwindow.h"
#include "ui_helperwindow.h"
#include <QTextStream>
#include <QFile>
HelperWindow::HelperWindow(QWidget *parent) :
QDialog(parent),
hui(new Ui::HelperWindow)
{
hui->setupUi(this);
QFile file("/opt/bashme.sh");
file.open(QFile::ReadWrite | QFile::Text);
QTextStream ReadFile(&file);
hui->bashmesh_plainTextEdit->setPlainText(ReadFile.readAll());
}
HelperWindow::~HelperWindow()
{
delete hui;
}
void HelperWindow::on_backtobuilder_pushButton_clicked()
{
close();
}
void HelperWindow::on_terminalopen_pushButton_clicked()
{
system(qPrintable("xterm -title RPiTC_BASHME! -geometry 180x40 -e 'cd /opt && echo \"# Now you can run ./bashme.sh\" && bash' &"));
}
void HelperWindow::on_savebashmesh_pushButton_clicked()
{
//updating bashme.sh script...
QFile file("/opt/bashme.sh");
file.open(QIODevice::Truncate | QIODevice::Text | QIODevice::ReadWrite);
QTextStream SaveFile(&file);
SaveFile << hui->bashmesh_plainTextEdit->toPlainText();
file.flush();
file.close();
}