change:格式化xml单元设定一个窗口,可以选择性格式化哪些具体内容。

This commit is contained in:
2024-09-15 15:08:32 +08:00
parent 0f65ef220a
commit 693a371e0d
8 changed files with 376 additions and 17 deletions

View File

@@ -11,6 +11,7 @@
#include "./ui_MainWidget.h"
#include "public_def.h"
#include "qformatset.h"
#include "src/data_edit.h"
constexpr std::size_t g_OnePage = 100;
@@ -20,7 +21,7 @@ MainWidget::MainWidget(QWidget* parent)
{
ui->setupUi(this);
setWindowTitle(u8"OneLevelXmlOpr v1.3.6");
setWindowTitle(u8"OneLevelXmlOpr v1.3.7");
setWindowIcon(QIcon("://resource/xml.ico"));
QScreen* primaryScreen = QGuiApplication::primaryScreen();
@@ -966,16 +967,25 @@ void MainWidget::unit_change()
bool MainWidget::format_xml()
{
std::string xml_path = ui->edStatus->text().toStdString();
QFormatSet set;
set.exec();
if (!set.isok_) {
return false;
}
std::string xml_path = set.xml_path_;
if (xml_path.empty()) {
return false;
}
if (!CUtil::affirm(this, u8"确认", u8"重排版内容将会覆盖源文件,请确认是否需要备份,继续?")) {
if (!CUtil::affirm(
this, u8"确认",
u8"重排版内容将会覆盖源文件,请确认是否需要备份,继续?")) {
return false;
}
if (!xml_.handle_save(xml_path)) {
if (!xml_.handle_save(xml_path, set.values_)) {
CUtil::msg(this, u8"重排版内容失败");
return false;
}