完成元数据更新功能
This commit is contained in:
@@ -15,6 +15,8 @@ MetadataUpdatePage::MetadataUpdatePage(QWidget *parent)
|
||||
{
|
||||
initUI();
|
||||
_processor = new MetadataProcessor(this);
|
||||
QString basePath = QCoreApplication::applicationDirPath();
|
||||
_processor->initConfig(basePath);
|
||||
}
|
||||
|
||||
MetadataUpdatePage::~MetadataUpdatePage()
|
||||
@@ -136,7 +138,7 @@ void MetadataUpdatePage::showEvent(QShowEvent* event)
|
||||
|
||||
void MetadataUpdatePage::showUpdateItems()
|
||||
{
|
||||
QStringList uft3Items = {"标准字段", "数据类型", "标准错误号",
|
||||
QStringList uft3Items = {"标准字段", "数据类型", "表结构",
|
||||
"接口数据"};
|
||||
|
||||
QStringList uf20Items = {"标准字段", "数据类型", "标准错误号",
|
||||
@@ -243,10 +245,13 @@ void MetadataUpdatePage::onUpdateUFT3()
|
||||
void MetadataUpdatePage::updateUf2Interfaces(const QStringList& items)
|
||||
{
|
||||
QString basePath = QCoreApplication::applicationDirPath();
|
||||
int itemCount = items.size();
|
||||
|
||||
foreach (const QString& item, items) {
|
||||
_processLabel->setText(QString("正在更新UF20 - %1").arg(item));
|
||||
_progressBar->setValue((items.indexOf(item) + 1) * 100 / items.size());
|
||||
int currentIndex = items.indexOf(item);
|
||||
int progress = (itemCount == 1) ? 0 : (currentIndex * 100 / itemCount);
|
||||
_progressBar->setValue(progress);
|
||||
|
||||
if (item == "标准字段") {
|
||||
processUf2StdFields(basePath);
|
||||
@@ -257,72 +262,83 @@ void MetadataUpdatePage::updateUf2Interfaces(const QStringList& items)
|
||||
} else if (item == "接口数据") {
|
||||
processUf2Interface(basePath);
|
||||
}
|
||||
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
|
||||
_progressBar->setValue(100);
|
||||
_processLabel->setText("UF20更新完成");
|
||||
|
||||
onUpdateFinished(true, "UF20更新完成");
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::updateUft3Interfaces(const QStringList& items)
|
||||
{
|
||||
QString basePath = QCoreApplication::applicationDirPath();
|
||||
int itemCount = items.size();
|
||||
|
||||
foreach (const QString& item, items) {
|
||||
_processLabel->setText(QString("正在更新UFT30 - %1").arg(item));
|
||||
_progressBar->setValue((items.indexOf(item) + 1) * 100 / items.size());
|
||||
int currentIndex = items.indexOf(item);
|
||||
int progress = (itemCount == 1) ? 0 : (currentIndex * 100 / itemCount);
|
||||
_progressBar->setValue(progress);
|
||||
|
||||
if (item == "标准字段") {
|
||||
processUft3StdFields(basePath);
|
||||
} else if (item == "数据类型") {
|
||||
processUft3DataType(basePath);
|
||||
} else if (item == "标准错误号") {
|
||||
processUft3ErrNumber(basePath);
|
||||
} else if (item == "表结构") {
|
||||
processUft3Table(basePath);
|
||||
} else if (item == "接口数据") {
|
||||
processUft3Interface(basePath);
|
||||
}
|
||||
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
|
||||
_progressBar->setValue(100);
|
||||
_processLabel->setText("UFT30更新完成");
|
||||
|
||||
onUpdateFinished(true, "UFT30更新完成");
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUf2StdFields(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UF20标准字段";
|
||||
_processor->processUf2StdFields(basePath);
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUf2DataType(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UF20数据类型";
|
||||
_processor->processUf2DataType(basePath);
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUf2ErrNumber(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UF20标准错误号";
|
||||
_processor->processUf2ErrNumber(basePath);
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUf2Interface(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UF20接口数据";
|
||||
_processor->processUf2Interfaces(basePath);
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUft3StdFields(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UFT30标准字段";
|
||||
_processor->processUft3StdFields(basePath);
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUft3DataType(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UFT30数据类型";
|
||||
_processor->processUft3DataType(basePath);
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUft3ErrNumber(const QString& basePath)
|
||||
void MetadataUpdatePage::processUft3Table(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UFT30标准错误号";
|
||||
_processor->processUft3Table(basePath);
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUft3Interface(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UFT30接口数据";
|
||||
_processor->processUft3Interfaces(basePath);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ private:
|
||||
|
||||
void processUft3StdFields(const QString& basePath);
|
||||
void processUft3DataType(const QString& basePath);
|
||||
void processUft3ErrNumber(const QString& basePath);
|
||||
void processUft3Table(const QString& basePath);
|
||||
void processUft3Interface(const QString& basePath);
|
||||
|
||||
QGridLayout* _updateGridLayout{nullptr};
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "ElaLineEdit.h"
|
||||
#include "ElaComboBox.h"
|
||||
#include "ElaPushButton.h"
|
||||
#include "src/utils/configmanager.h"
|
||||
|
||||
SettingsPage::SettingsPage(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
@@ -311,7 +312,22 @@ void SettingsPage::onSaveSettings()
|
||||
QSettings settings("UFT30", "ChangeCode");
|
||||
settings.setValue("Theme", m_themeCombo->currentText());
|
||||
|
||||
saveToConfigIni();
|
||||
ConfigManager* configManager = ConfigManager::instance();
|
||||
|
||||
QString uft30Val = m_uft30PathEdit->text().trimmed().replace("/", "\\");
|
||||
QString uf20Val = m_uf20PathEdit->text().trimmed().replace("/", "\\");
|
||||
QString ufAcct20Val = m_uf20AccountPathEdit->text().trimmed().replace("/", "\\");
|
||||
QString createPathVal = m_outputPathEdit->text().trimmed().replace("/", "\\");
|
||||
|
||||
configManager->setValue("projectPath", "uft30", uft30Val);
|
||||
configManager->setValue("projectPath", "uf20", uf20Val);
|
||||
configManager->setValue("projectPath", "ufAcct20", ufAcct20Val);
|
||||
configManager->setValue("projectPath", "createPath", createPathVal);
|
||||
|
||||
QString uft30PubVal = uft30Val + "\\upub\\dev_codes";
|
||||
configManager->setValue("projectPath", "uft30pub", uft30PubVal);
|
||||
|
||||
configManager->saveConfig();
|
||||
|
||||
QMessageBox::information(this, "保存成功", "配置已保存!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user