fix:1.修正同结构导入问题。2.历史界面添加删除。3.导入排序问题。
This commit is contained in:
parent
f2b1525b92
commit
f9796c7090
9
.vscode/settings.json
vendored
9
.vscode/settings.json
vendored
@ -115,6 +115,13 @@
|
|||||||
"optional": "cpp",
|
"optional": "cpp",
|
||||||
"sstream": "cpp",
|
"sstream": "cpp",
|
||||||
"stop_token": "cpp",
|
"stop_token": "cpp",
|
||||||
"regex": "cpp"
|
"regex": "cpp",
|
||||||
|
"*.tcc": "cpp",
|
||||||
|
"cwctype": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"memory_resource": "cpp",
|
||||||
|
"random": "cpp",
|
||||||
|
"fstream": "cpp",
|
||||||
|
"cinttypes": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,8 +1,5 @@
|
|||||||
#include "MainWidget.h"
|
#include "MainWidget.h"
|
||||||
|
|
||||||
#include "./ui_MainWidget.h"
|
|
||||||
#include "src/data_edit.h"
|
|
||||||
#include "public_def.h"
|
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@ -12,13 +9,17 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
|
#include "./ui_MainWidget.h"
|
||||||
|
#include "public_def.h"
|
||||||
|
#include "src/data_edit.h"
|
||||||
|
|
||||||
constexpr std::size_t g_OnePage = 100;
|
constexpr std::size_t g_OnePage = 100;
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget)
|
MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
setWindowTitle(u8"OneLevelXmlOpr v1.3.1");
|
setWindowTitle(u8"OneLevelXmlOpr v1.3.2");
|
||||||
setWindowIcon(QIcon("://resource/xml.ico"));
|
setWindowIcon(QIcon("://resource/xml.ico"));
|
||||||
|
|
||||||
QScreen* primaryScreen = QGuiApplication::primaryScreen();
|
QScreen* primaryScreen = QGuiApplication::primaryScreen();
|
||||||
@ -78,7 +79,13 @@ MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget
|
|||||||
if (!edit.is_import_sucess_) {
|
if (!edit.is_import_sucess_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cur_config_.is_same) {
|
||||||
|
xml_.get_all_elements(vec_, ui->cbUnit->currentText().toStdString());
|
||||||
|
} else {
|
||||||
xml_.get_all_elements(vec_);
|
xml_.get_all_elements(vec_);
|
||||||
|
}
|
||||||
|
|
||||||
current_.clear();
|
current_.clear();
|
||||||
current_ = vec_;
|
current_ = vec_;
|
||||||
push_content(current_);
|
push_content(current_);
|
||||||
@ -333,8 +340,7 @@ bool MainWidget::read(const QString& file_path)
|
|||||||
ui->cbUnit->setCurrentIndex(0);
|
ui->cbUnit->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
u_ = false;
|
u_ = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ui->cbUnit->setEnabled(false);
|
ui->cbUnit->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,6 +364,7 @@ bool MainWidget::read(const QString& file_path)
|
|||||||
|
|
||||||
ui->cbConfig->setEnabled(false);
|
ui->cbConfig->setEnabled(false);
|
||||||
ui->btnSet->setEnabled(false);
|
ui->btnSet->setEnabled(false);
|
||||||
|
ui->btnHis->setEnabled(false);
|
||||||
|
|
||||||
his_->push(ui->edStatus->text().toStdString());
|
his_->push(ui->edStatus->text().toStdString());
|
||||||
|
|
||||||
|
@ -13,11 +13,11 @@ public:
|
|||||||
public:
|
public:
|
||||||
bool push(const std::string& content);
|
bool push(const std::string& content);
|
||||||
bool get_history(std::vector<std::string>& vec);
|
bool get_history(std::vector<std::string>& vec);
|
||||||
|
bool read_file(std::vector<std::string>& vec);
|
||||||
|
bool write_file(std::vector<std::string>& vec);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void default_set();
|
void default_set();
|
||||||
bool read_file(std::vector<std::string>& vec);
|
|
||||||
bool write_file(std::vector<std::string>& vec);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string work_dir_{};
|
std::string work_dir_{};
|
||||||
|
@ -10,6 +10,7 @@ CUIHistory::CUIHistory(QWidget* parent, CHistory* his) : QDialog(parent), ui(new
|
|||||||
|
|
||||||
connect(ui->btnExit, &QPushButton::clicked, this, [&]() { close(); });
|
connect(ui->btnExit, &QPushButton::clicked, this, [&]() { close(); });
|
||||||
connect(ui->btnOk, &QPushButton::clicked, this, [&]() { select_ok(); });
|
connect(ui->btnOk, &QPushButton::clicked, this, [&]() { select_ok(); });
|
||||||
|
connect(ui->btnDel, &QPushButton::clicked, this, [&]() { del_item(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
CUIHistory::~CUIHistory()
|
CUIHistory::~CUIHistory()
|
||||||
@ -42,3 +43,22 @@ void CUIHistory::select_ok()
|
|||||||
cur_ = re[0]->text();
|
cur_ = re[0]->text();
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CUIHistory::del_item()
|
||||||
|
{
|
||||||
|
auto re = ui->listWidget->selectedItems();
|
||||||
|
if (re.empty()) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
for (auto& item : re) {
|
||||||
|
delete ui->listWidget->takeItem(ui->listWidget->row(item));
|
||||||
|
}
|
||||||
|
std::vector<std::string> vec;
|
||||||
|
for (int i = 0; i < ui->listWidget->count(); ++i) {
|
||||||
|
QListWidgetItem* item = ui->listWidget->item(i);
|
||||||
|
if (item) {
|
||||||
|
vec.push_back(item->text().toStdString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
his_->write_file(vec);
|
||||||
|
}
|
||||||
|
@ -19,6 +19,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void showEvent(QShowEvent* event);
|
void showEvent(QShowEvent* event);
|
||||||
void select_ok();
|
void select_ok();
|
||||||
|
void del_item();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString cur_{};
|
QString cur_{};
|
||||||
|
@ -32,6 +32,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnDel">
|
||||||
|
<property name="text">
|
||||||
|
<string>删除</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btnOk">
|
<widget class="QPushButton" name="btnOk">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -244,6 +244,7 @@ bool CXmlOpr::import_newer_data(const std::vector<std::string>& vec, std::size_t
|
|||||||
++success_count;
|
++success_count;
|
||||||
auto* nitem = copy_element(item);
|
auto* nitem = copy_element(item);
|
||||||
insert_brother_node(last_item, nitem);
|
insert_brother_node(last_item, nitem);
|
||||||
|
last_item = nitem;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user