-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
117 lines (92 loc) · 3.51 KB
/
mainwindow.cpp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->lineEdit->setText("/Users/srtsrthwqethqerthsrthwryjwrtsdflly/Qt/6.2.4/macos/bin/macdeployqt");
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
files = QFileDialog::getOpenFileNames(
this,
"Select one or more files to open",
"/home",
"Applicaton (*.app)");
QStringList headers = QStringList() << "filenames app"
<< "passed"
<< "dmg";
ui->tableWidget->setColumnCount(3);
ui->tableWidget->setShowGrid(true);
ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableWidget->setHorizontalHeaderLabels(headers);
ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
//ui->tableWidget->hideColumn(0);
int i=0;
QStringList::const_iterator constIterator;
for (constIterator = files.constBegin(); constIterator != files.constEnd();
++constIterator)
{
qDebug() << (*constIterator).toLocal8Bit().constData() << Qt::endl;
ui->tableWidget->insertRow(i);
QTableWidgetItem* item = new QTableWidgetItem();
item->setText((*constIterator).toLocal8Bit().constData());
ui->tableWidget->setItem(i,0, item);
i++;
}
ui->tableWidget->resizeColumnsToContents();
}
void MainWindow::on_pushButton_2_clicked()
{
// // Заберём путь к файлу и его имененем, который будем open
newPath = QFileDialog::getOpenFileName(this, "macdeployqt",
"/home", "Unix executable(*)");
ui->lineEdit->setText(newPath);
}
void MainWindow::on_pushButton_3_clicked()
{
// QProcess process;
// process.start("ls", QStringList() << "-l");
// process.waitForFinished();
QString program = ui->lineEdit->text();
QStringList arguments;
int i=0;
QStringList::const_iterator constIterator;
for (constIterator = files.constBegin(); constIterator != files.constEnd();
++constIterator)
{
arguments.clear();
if(ui->checkBox->isChecked() == 1) {
arguments << (*constIterator).toLocal8Bit().constData() << "-dmg";
}
else
{
arguments << (*constIterator).toLocal8Bit().constData();
}
// /Users/srtsrthwqethqerthsrthwryjwrtsdflly/Qt/6.2.4/macos/bin/macdeployqt
// /Users/srtsrthwqethqerthsrthwryjwrtsdflly/Downloads/Bike_Parking_By_CppBuzz.app
qDebug() << program << " " << i << " " << (*constIterator).toLocal8Bit().constData() << Qt::endl;
QTableWidgetItem* item = new QTableWidgetItem();
item->setText("OK");
ui->tableWidget->setItem(i,1, item);
QTableWidgetItem* item2 = new QTableWidgetItem();
if(ui->checkBox->isChecked() == 1) {
item2->setText("OK");
}
else
{
item2->setText("---");
}
ui->tableWidget->setItem(i,2, item2);
QProcess *myProcess = new QProcess();
myProcess->start(program, arguments);
myProcess->waitForFinished();
i++;
}
}