-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyGUI.cpp
More file actions
121 lines (116 loc) · 2.59 KB
/
MyGUI.cpp
File metadata and controls
121 lines (116 loc) · 2.59 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
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
117
118
119
120
121
#include "MyGUI.h"
#include <QFileDialog>
#include <iostream>
#include <cstring>
#include <cstdio>
#include "aaa.cpp"
using std::cout;
using std::endl;
using std::string;
/* 点击日志按钮后的处理 */
int MyGUI::onShowClicked4(bool checked)
{
return 0;
}
/* 点击启动按钮后的处理 */
int MyGUI::onShowClicked5(bool checked)
{
/*port = 8082;
dir = "htdocs";*/
/*if(ui.checkBox_1->isChecked())
httpd(ui.port_1->text(), ui.path_1->text());
if (ui.checkBox_1->isChecked())
httpd(ui.port_1->text(), ui.path_1->text());
if (ui.checkBox_1->isChecked())
httpd(ui.port_1->text(), ui.path_1->text());*/
// 如果复选框被选中
if (ui.checkBox_1->isChecked()) {
cout << "第一个输入区域:" << endl;
// QString不能直接cout
printf("第一个域名:%s\n", ui.domainField_1->text().toStdString().data());
printf("第一个端口:%s\n", ui.port_1->text().toStdString().data());
printf("第一个路径:%s\n", ui.path_1->text().toStdString().data());
}
/*
判断有没有被选
ui.checkBox_1->isChecked()
ui.checkBox_2->isChecked()
ui.checkBox_3->isChecked()
三个域名:
ui.domainField_1->text()
ui.domainField_2->text()
ui.domainField_3->text()
三个端口
ui.port_1->text()
ui.port_2->text()
ui.port_3->text()
三个路径
ui.path_1->text()
ui.path_2->text()
ui.path_3->text()
QString如何转化string已经上面已经给出来了
*/
return 0;
}
MyGUI::MyGUI(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
connect(
ui.btChooseFile_1,
SIGNAL(clicked(bool)),
this,
SLOT(onShowClicked1(bool))
);
connect(
ui.btChooseFile_2,
SIGNAL(clicked(bool)),
this,
SLOT(onShowClicked2(bool))
);
connect(
ui.btChooseFile_3,
SIGNAL(clicked(bool)),
this,
SLOT(onShowClicked3(bool))
);
connect(
ui.btStartUp,
SIGNAL(clicked(bool)),
this,
SLOT(onShowClicked4(bool))
);
connect(
ui.btCatalog,
SIGNAL(clicked(bool)),
this,
SLOT(onShowClicked5(bool))
);
}
inline QString MyGUI::getPath()
{
// 文件夹选择器
QString filePath = QFileDialog::getExistingDirectory(this, tr("Open Directory"));
return filePath;
}
/* 设置路径到文本框 */
int MyGUI::onShowClicked1(bool checked)
{
QString temp = "/"; // 分割内容
// 只取最后一部分
ui.path_1->setText(getPath().split(temp).last());
// ui.path_1->setText(getPath());
return 0;
}
int MyGUI::onShowClicked2(bool checked)
{
QString temp = "/"; // 分割内容
ui.path_2->setText(getPath().split(temp).last());
return 0;
}
int MyGUI::onShowClicked3(bool checked)
{
QString temp = "/"; // 分割内容
ui.path_3->setText(getPath().split(temp).last());
return 0;
}