元数据页面实现更新UF20、UFT30接口数据
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
#include <QGridLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QSpacerItem>
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QTimer>
|
||||
|
||||
const int UPDATE_ITEM_SHOW_COLUMN_COUNT = 3;
|
||||
|
||||
@@ -11,10 +14,15 @@ MetadataUpdatePage::MetadataUpdatePage(QWidget *parent)
|
||||
: ElaScrollPage(parent)
|
||||
{
|
||||
initUI();
|
||||
_processor = new MetadataProcessor(this);
|
||||
}
|
||||
|
||||
MetadataUpdatePage::~MetadataUpdatePage()
|
||||
{
|
||||
if (_workerThread && _workerThread->isRunning()) {
|
||||
_workerThread->quit();
|
||||
_workerThread->wait();
|
||||
}
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::initUI()
|
||||
@@ -188,7 +196,12 @@ void MetadataUpdatePage::onUpdateUF20()
|
||||
return;
|
||||
}
|
||||
|
||||
QMessageBox::information(this, "提示", QString("UF20更新功能开发中,已选择: %1").arg(selectedItems.join(", ")));
|
||||
_uf2UpdateBtn->setEnabled(false);
|
||||
_uf2AllBtn->setEnabled(false);
|
||||
_uf2CancelBtn->setEnabled(false);
|
||||
_progressBar->setValue(0);
|
||||
|
||||
updateUf2Interfaces(selectedItems);
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::onUFT3SelectAll()
|
||||
@@ -219,5 +232,121 @@ void MetadataUpdatePage::onUpdateUFT3()
|
||||
return;
|
||||
}
|
||||
|
||||
QMessageBox::information(this, "提示", QString("UFT30更新功能开发中,已选择: %1").arg(selectedItems.join(", ")));
|
||||
_uft3UpdateBtn->setEnabled(false);
|
||||
_uft3AllBtn->setEnabled(false);
|
||||
_uft3CancelBtn->setEnabled(false);
|
||||
_progressBar->setValue(0);
|
||||
|
||||
updateUft3Interfaces(selectedItems);
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::updateUf2Interfaces(const QStringList& items)
|
||||
{
|
||||
QString basePath = QCoreApplication::applicationDirPath();
|
||||
|
||||
foreach (const QString& item, items) {
|
||||
_processLabel->setText(QString("正在更新UF20 - %1").arg(item));
|
||||
_progressBar->setValue((items.indexOf(item) + 1) * 100 / items.size());
|
||||
|
||||
if (item == "标准字段") {
|
||||
processUf2StdFields(basePath);
|
||||
} else if (item == "数据类型") {
|
||||
processUf2DataType(basePath);
|
||||
} else if (item == "标准错误号") {
|
||||
processUf2ErrNumber(basePath);
|
||||
} else if (item == "接口数据") {
|
||||
processUf2Interface(basePath);
|
||||
}
|
||||
}
|
||||
|
||||
onUpdateFinished(true, "UF20更新完成");
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::updateUft3Interfaces(const QStringList& items)
|
||||
{
|
||||
QString basePath = QCoreApplication::applicationDirPath();
|
||||
|
||||
foreach (const QString& item, items) {
|
||||
_processLabel->setText(QString("正在更新UFT30 - %1").arg(item));
|
||||
_progressBar->setValue((items.indexOf(item) + 1) * 100 / items.size());
|
||||
|
||||
if (item == "标准字段") {
|
||||
processUft3StdFields(basePath);
|
||||
} else if (item == "数据类型") {
|
||||
processUft3DataType(basePath);
|
||||
} else if (item == "标准错误号") {
|
||||
processUft3ErrNumber(basePath);
|
||||
} else if (item == "接口数据") {
|
||||
processUft3Interface(basePath);
|
||||
}
|
||||
}
|
||||
|
||||
onUpdateFinished(true, "UFT30更新完成");
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUf2StdFields(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UF20标准字段";
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUf2DataType(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UF20数据类型";
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUf2ErrNumber(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UF20标准错误号";
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUf2Interface(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UF20接口数据";
|
||||
_processor->processUf2Interfaces(basePath);
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUft3StdFields(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UFT30标准字段";
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUft3DataType(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UFT30数据类型";
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUft3ErrNumber(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UFT30标准错误号";
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::processUft3Interface(const QString& basePath)
|
||||
{
|
||||
qInfo() << "处理UFT30接口数据";
|
||||
_processor->processUft3Interfaces(basePath);
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::onUpdateProgress(int progress, const QString& message)
|
||||
{
|
||||
_progressBar->setValue(progress);
|
||||
_processLabel->setText(message);
|
||||
}
|
||||
|
||||
void MetadataUpdatePage::onUpdateFinished(bool success, const QString& message)
|
||||
{
|
||||
_progressBar->setValue(success ? 100 : 0);
|
||||
_processLabel->setText(message);
|
||||
|
||||
_uf2UpdateBtn->setEnabled(true);
|
||||
_uf2AllBtn->setEnabled(true);
|
||||
_uf2CancelBtn->setEnabled(true);
|
||||
_uft3UpdateBtn->setEnabled(true);
|
||||
_uft3AllBtn->setEnabled(true);
|
||||
_uft3CancelBtn->setEnabled(true);
|
||||
|
||||
if (success) {
|
||||
QMessageBox::information(this, "提示", message);
|
||||
} else {
|
||||
QMessageBox::warning(this, "提示", message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
#include "ElaText.h"
|
||||
#include "ElaProgressBar.h"
|
||||
#include "ElaCheckBox.h"
|
||||
#include "metadataupdate/metadataprocessor.h"
|
||||
#include <QGridLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QThread>
|
||||
|
||||
class MetadataUpdatePage : public ElaScrollPage
|
||||
{
|
||||
@@ -28,9 +30,25 @@ private slots:
|
||||
void onUFT3SelectNone();
|
||||
void onUpdateUFT3();
|
||||
|
||||
private slots:
|
||||
void onUpdateProgress(int progress, const QString& message);
|
||||
void onUpdateFinished(bool success, const QString& message);
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
void showUpdateItems();
|
||||
void updateUf2Interfaces(const QStringList& items);
|
||||
void updateUft3Interfaces(const QStringList& items);
|
||||
|
||||
void processUf2StdFields(const QString& basePath);
|
||||
void processUf2DataType(const QString& basePath);
|
||||
void processUf2ErrNumber(const QString& basePath);
|
||||
void processUf2Interface(const QString& basePath);
|
||||
|
||||
void processUft3StdFields(const QString& basePath);
|
||||
void processUft3DataType(const QString& basePath);
|
||||
void processUft3ErrNumber(const QString& basePath);
|
||||
void processUft3Interface(const QString& basePath);
|
||||
|
||||
QGridLayout* _updateGridLayout{nullptr};
|
||||
QGridLayout* _updateUf2GridLayout{nullptr};
|
||||
@@ -45,6 +63,9 @@ private:
|
||||
|
||||
QList<ElaCheckBox*> uft3CheckBoxes;
|
||||
QList<ElaCheckBox*> uf20CheckBoxes;
|
||||
|
||||
MetadataProcessor* _processor{nullptr};
|
||||
QThread* _workerThread{nullptr};
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user