fix: 修正一个选择文件未赋值的BUG
appro: 1.提示完成窗口。2.Qt路经具体提示。3.添加高分辨率兼容。
This commit is contained in:
parent
913e69b4c5
commit
2b220bf5c2
@ -25,7 +25,7 @@ void MainWidget::connect_operator()
|
||||
|
||||
void MainWidget::control_init()
|
||||
{
|
||||
// ui->plainTextEdit->setEnabled(false);
|
||||
ui->plainTextEdit->setEnabled(false);
|
||||
#if !defined(NDEBUG)
|
||||
ui->edBinary->setText("/home/typ/Downloads/build-QXmlEdit-Desktop_Qt_5_14_2_GCC_64bit-Release/build/qxmledit");
|
||||
ui->edQtDir->setText("/home/typ/Qt5.14.2/5.14.2/gcc_64");
|
||||
@ -174,7 +174,7 @@ QString MainWidget::SelectDirectory(QWidget* parent, QLineEdit* pEdit, const QSt
|
||||
QString MainWidget::SelectFile(QWidget* parent, QLineEdit* pEdit, const QString& info, const QString& filter)
|
||||
{
|
||||
QString filePath = QFileDialog::getOpenFileName(parent, info, QDir::homePath(), filter);
|
||||
if (!filePath.isEmpty() && !pEdit) {
|
||||
if (!filePath.isEmpty() && pEdit) {
|
||||
pEdit->setText(filePath);
|
||||
}
|
||||
return filePath;
|
||||
@ -207,6 +207,7 @@ void MainWidget::generate()
|
||||
binary_ = ui->edBinary->text().trimmed();
|
||||
fs::path binary_dir = fs::path(binary_.toStdString()).parent_path();
|
||||
envs_.push_back(binary_dir.string());
|
||||
std::string filename = fs::path(binary_.toStdString()).filename().string();
|
||||
|
||||
int env_cnt = ui->listWidget->count();
|
||||
for (int i = 0; i < env_cnt; ++i) {
|
||||
@ -243,6 +244,7 @@ void MainWidget::generate()
|
||||
}
|
||||
|
||||
fs::path out_dir(ui->edOutDir->text().trimmed().toStdString());
|
||||
out_dir.append(filename);
|
||||
if (!fs::exists(out_dir)) {
|
||||
fs::create_directories(out_dir);
|
||||
}
|
||||
@ -270,7 +272,7 @@ void MainWidget::generate()
|
||||
file.close();
|
||||
|
||||
std::string run_sh = content.toStdString();
|
||||
boost::replace_all(run_sh, "replace_string", fs::path(binary_.toStdString()).filename().string());
|
||||
boost::replace_all(run_sh, "replace_string", filename);
|
||||
|
||||
std::string out_sh = fs::path(out_dir).append("run.sh").string();
|
||||
std::ofstream out(out_sh, std::ios::out);
|
||||
@ -281,4 +283,5 @@ void MainWidget::generate()
|
||||
out.close();
|
||||
int r = system(std::string("chmod +x " + out_sh).c_str());
|
||||
(void)r;
|
||||
message(this, "完成");
|
||||
}
|
@ -65,7 +65,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Qt路径:</string>
|
||||
<string>Qt路径(选到bin的父目录):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user