update
This commit is contained in:
parent
357ed5642b
commit
5ca2632039
|
@ -5,6 +5,7 @@
|
||||||
#include "TranslateBasic.h"
|
#include "TranslateBasic.h"
|
||||||
|
|
||||||
using namespace extract;
|
using namespace extract;
|
||||||
|
using namespace unit_func;
|
||||||
|
|
||||||
IntDelegate::IntDelegate(int min, int max)
|
IntDelegate::IntDelegate(int min, int max)
|
||||||
: _min_value(min), _max_value(max) {
|
: _min_value(min), _max_value(max) {
|
||||||
|
|
|
@ -9,48 +9,48 @@
|
||||||
#include "TranslateBasic.h"
|
#include "TranslateBasic.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace unit_func {
|
||||||
|
/// <summary>
|
||||||
|
/// 整形修改代理
|
||||||
|
/// </summary>
|
||||||
|
class IntDelegate : public QStyledItemDelegate {
|
||||||
|
Q_OBJECT
|
||||||
|
private:
|
||||||
|
int _min_value, _max_value;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void valueChanged(const QModelIndex& idx) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
IntDelegate(int min, int max);
|
||||||
|
|
||||||
|
virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
||||||
|
virtual void setEditorData(QWidget* editor, const QModelIndex& index) const override;
|
||||||
|
virtual void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
|
||||||
|
virtual void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 整形修改代理
|
/// 翻译规则编辑代理
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class IntDelegate : public QStyledItemDelegate {
|
class RuleSelectDelegate : public QStyledItemDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
int _min_value, _max_value;
|
std::shared_ptr<TranslateBasic> _kernel;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void valueChanged(const QModelIndex& idx) const;
|
void dataChanged(const QModelIndex& idx) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IntDelegate(int min, int max);
|
RuleSelectDelegate(std::shared_ptr<TranslateBasic> ins);
|
||||||
|
|
||||||
virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
||||||
virtual void setEditorData(QWidget* editor, const QModelIndex& index) const override;
|
virtual void setEditorData(QWidget* editor, const QModelIndex& index) const override;
|
||||||
virtual void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
|
virtual void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
|
||||||
virtual void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
virtual void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 翻译规则编辑代理
|
|
||||||
/// </summary>
|
|
||||||
class RuleSelectDelegate : public QStyledItemDelegate {
|
|
||||||
Q_OBJECT
|
|
||||||
private:
|
|
||||||
std::shared_ptr<TranslateBasic> _kernel;
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void dataChanged(const QModelIndex& idx) const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
RuleSelectDelegate(std::shared_ptr<TranslateBasic> ins);
|
|
||||||
|
|
||||||
virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
|
||||||
virtual void setEditorData(QWidget* editor, const QModelIndex& index) const override;
|
|
||||||
virtual void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
|
|
||||||
virtual void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ÐòÁл¯¹æÔòÊÓͼ
|
/// ÐòÁл¯¹æÔòÊÓͼ
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include "TranslateBasic.h"
|
#include "TranslateBasic.h"
|
||||||
|
|
||||||
|
using namespace configuration_panel;
|
||||||
|
using namespace size_provider;
|
||||||
|
|
||||||
|
|
||||||
StructuralRuleView::StructuralRuleView(
|
StructuralRuleView::StructuralRuleView(
|
||||||
std::shared_ptr<TranslateBasic> base,
|
std::shared_ptr<TranslateBasic> base,
|
||||||
std::shared_ptr<extract::BytesAsRuleSet> inst_r, QWidget* p /*= nullptr*/)
|
std::shared_ptr<extract::BytesAsRuleSet> inst_r, QWidget* p /*= nullptr*/)
|
||||||
|
|
|
@ -9,109 +9,111 @@
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include "SequenceView.h"
|
#include "SequenceView.h"
|
||||||
|
|
||||||
/// <summary>
|
namespace configuration_panel {
|
||||||
/// 空白配置面板
|
/// <summary>
|
||||||
/// </summary>
|
/// 空白配置面板
|
||||||
class EmptyConfiguration : public QWidget {
|
/// </summary>
|
||||||
public:
|
class EmptyConfiguration : public QWidget {
|
||||||
EmptyConfiguration(QWidget* p = nullptr);
|
public:
|
||||||
};
|
EmptyConfiguration(QWidget* p = nullptr);
|
||||||
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 字段长度配置面板
|
/// 字段长度配置面板
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class CountWithinConfiguration : public QWidget {
|
class CountWithinConfiguration : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<ExtractUnit> _bind_u;
|
std::shared_ptr<ExtractUnit> _bind_u;
|
||||||
QModelIndex _bind_index;
|
QModelIndex _bind_index;
|
||||||
QSpinBox* const _count_input;
|
QSpinBox* const _count_input;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CountWithinConfiguration(QWidget* p = nullptr);
|
CountWithinConfiguration(QWidget* p = nullptr);
|
||||||
|
|
||||||
void currentRuleAccept(std::shared_ptr<ExtractUnit> u, const QModelIndex& i);
|
void currentRuleAccept(std::shared_ptr<ExtractUnit> u, const QModelIndex& i);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void currentRuleChanged(const QModelIndex& idx);
|
void currentRuleChanged(const QModelIndex& idx);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 字符串文本编码配置面板
|
/// 字符串文本编码配置面板
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class EncodingConfiguration : public QWidget {
|
class EncodingConfiguration : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<ExtractUnit> _bind_u;
|
std::shared_ptr<ExtractUnit> _bind_u;
|
||||||
QModelIndex _bind_index;
|
QModelIndex _bind_index;
|
||||||
QSpinBox* const _count_input;
|
QSpinBox* const _count_input;
|
||||||
QComboBox* const _encoding_set;
|
QComboBox* const _encoding_set;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EncodingConfiguration(QWidget* p = nullptr);
|
EncodingConfiguration(QWidget* p = nullptr);
|
||||||
|
|
||||||
void currentRuleAccept(std::shared_ptr<ExtractUnit> u, const QModelIndex& i);
|
void currentRuleAccept(std::shared_ptr<ExtractUnit> u, const QModelIndex& i);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void currentRuleChanged(const QModelIndex& idx);
|
void currentRuleChanged(const QModelIndex& idx);
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "extract_basic.h"
|
#include "extract_basic.h"
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 位联合配置面板
|
/// 位联合配置面板
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class BitCombineConfiguration : public QWidget {
|
class BitCombineConfiguration : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<extract::BytesAsBitCombine> _bind_u;
|
std::shared_ptr<extract::BytesAsBitCombine> _bind_u;
|
||||||
QModelIndex _bind_index;
|
QModelIndex _bind_index;
|
||||||
|
|
||||||
QSpinBox* const _count_input;
|
QSpinBox* const _count_input;
|
||||||
QTableView* const _bit_items;
|
QTableView* const _bit_items;
|
||||||
QStandardItemModel* const _bit_model;
|
QStandardItemModel* const _bit_model;
|
||||||
QSpinBox* const _index_appoint;
|
QSpinBox* const _index_appoint;
|
||||||
QLineEdit* const _bit_means;
|
QLineEdit* const _bit_means;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BitCombineConfiguration(QWidget* p = nullptr);
|
BitCombineConfiguration(QWidget* p = nullptr);
|
||||||
|
|
||||||
void currentRuleAccept(std::shared_ptr<ExtractUnit> u, const QModelIndex& i);
|
void currentRuleAccept(std::shared_ptr<ExtractUnit> u, const QModelIndex& i);
|
||||||
void reloadContent(std::shared_ptr<extract::BytesAsBitCombine> u);
|
void reloadContent(std::shared_ptr<extract::BytesAsBitCombine> u);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void currentRuleChanged(const QModelIndex& idx);
|
void currentRuleChanged(const QModelIndex& idx);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 列表字段配置面板
|
/// 列表字段配置面板
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class ListUnitConfiguration : public QWidget {
|
class ListUnitConfiguration : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<TranslateBasic> _bind_core;
|
std::shared_ptr<TranslateBasic> _bind_core;
|
||||||
std::shared_ptr<extract::BytesAsList> _bind_u;
|
std::shared_ptr<extract::BytesAsList> _bind_u;
|
||||||
QModelIndex _bind_index;
|
QModelIndex _bind_index;
|
||||||
|
|
||||||
QComboBox* const _rule_select;
|
QComboBox* const _rule_select;
|
||||||
QComboBox* const _size_layout_select;
|
QComboBox* const _size_layout_select;
|
||||||
|
|
||||||
QStackedWidget* const _configs_stack;
|
QStackedWidget* const _configs_stack;
|
||||||
QSpinBox* const _const_number_input;
|
QSpinBox* const _const_number_input;
|
||||||
QComboBox* const _prev_field_refer;
|
QComboBox* const _prev_field_refer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ListUnitConfiguration(std::shared_ptr<TranslateBasic> core, QWidget* p = nullptr);
|
ListUnitConfiguration(std::shared_ptr<TranslateBasic> core, QWidget* p = nullptr);
|
||||||
|
|
||||||
void currentRuleAccept(
|
void currentRuleAccept(
|
||||||
std::shared_ptr<ExtractUnit> u,
|
std::shared_ptr<ExtractUnit> u,
|
||||||
const QModelIndex& i,
|
const QModelIndex& i,
|
||||||
std::shared_ptr<ScopeFieldsGetter> getter);
|
std::shared_ptr<ScopeFieldsGetter> getter);
|
||||||
void reloadContent(std::shared_ptr<extract::BytesAsList> u,
|
void reloadContent(std::shared_ptr<extract::BytesAsList> u,
|
||||||
std::shared_ptr<ScopeFieldsGetter> getter);
|
std::shared_ptr<ScopeFieldsGetter> getter);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void currentRuleChanged(const QModelIndex& idx);
|
void currentRuleChanged(const QModelIndex& idx);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
class StructuralRuleView : public QWidget
|
class StructuralRuleView : public QWidget
|
||||||
{
|
{
|
||||||
|
@ -126,6 +128,6 @@ public:
|
||||||
StructuralRuleView(std::shared_ptr<TranslateBasic> base,
|
StructuralRuleView(std::shared_ptr<TranslateBasic> base,
|
||||||
std::shared_ptr<extract::BytesAsRuleSet> inst_r, QWidget* p = nullptr);
|
std::shared_ptr<extract::BytesAsRuleSet> inst_r, QWidget* p = nullptr);
|
||||||
|
|
||||||
void cacheRefresh(const QModelIndex& curr, ListUnitConfiguration* t);
|
void cacheRefresh(const QModelIndex& curr, configuration_panel::ListUnitConfiguration* t);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "TranslateBasic.h"
|
#include "TranslateBasic.h"
|
||||||
|
|
||||||
using namespace extract;
|
using namespace extract;
|
||||||
|
using namespace size_provider;
|
||||||
|
|
||||||
TranslateBasic::TranslateBasic()
|
TranslateBasic::TranslateBasic()
|
||||||
{
|
{
|
||||||
|
|
|
@ -131,56 +131,58 @@ public:
|
||||||
QHash<QString, std::shared_ptr<extract::BytesAsRuleSet>> customRules() const;
|
QHash<QString, std::shared_ptr<extract::BytesAsRuleSet>> customRules() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
namespace size_provider {
|
||||||
/// 常量数字提供
|
/// <summary>
|
||||||
/// </summary>
|
/// 常量数字提供
|
||||||
class ConstNumberProvider : public SizeProvider {
|
/// </summary>
|
||||||
public:
|
class ConstNumberProvider : public SizeProvider {
|
||||||
struct __Private {
|
public:
|
||||||
QString _value_string;
|
struct __Private {
|
||||||
} _number;
|
QString _value_string;
|
||||||
|
} _number;
|
||||||
|
|
||||||
|
public:
|
||||||
|
QString name() const override;
|
||||||
|
|
||||||
|
void bindInput(std::shared_ptr<DataAccessContext> inst) override;
|
||||||
|
|
||||||
|
int32_t value(const QString& expr) const override;
|
||||||
|
void setExpression(const QString& expr) override;
|
||||||
|
QString expression() const override;
|
||||||
|
|
||||||
|
void loadFrom(std::shared_ptr<TranslateBasic> core, const QJsonObject& obj) override;
|
||||||
|
void saveTo(QJsonObject& obj) const override;
|
||||||
|
|
||||||
|
std::shared_ptr<Serializable> newDefault() const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
public:
|
/// <summary>
|
||||||
QString name() const override;
|
/// 解释期数字提供器
|
||||||
|
/// </summary>
|
||||||
void bindInput(std::shared_ptr<DataAccessContext> inst) override;
|
class InterpretedNumberPrivider : public SizeProvider {
|
||||||
|
public:
|
||||||
int32_t value(const QString& expr) const override;
|
struct __Private {
|
||||||
void setExpression(const QString& expr) override;
|
QString _field_refer;
|
||||||
QString expression() const override;
|
std::shared_ptr<DataAccessContext> _context_inst;
|
||||||
|
} _refer;
|
||||||
void loadFrom(std::shared_ptr<TranslateBasic> core, const QJsonObject& obj) override;
|
|
||||||
void saveTo(QJsonObject& obj) const override;
|
|
||||||
|
|
||||||
std::shared_ptr<Serializable> newDefault() const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 解释期数字提供器
|
|
||||||
/// </summary>
|
|
||||||
class InterpretedNumberPrivider : public SizeProvider {
|
|
||||||
public:
|
|
||||||
struct __Private {
|
|
||||||
QString _field_refer;
|
|
||||||
std::shared_ptr<DataAccessContext> _context_inst;
|
|
||||||
} _refer;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString name() const override;
|
QString name() const override;
|
||||||
|
|
||||||
void bindInput(std::shared_ptr<DataAccessContext> inst) override;
|
void bindInput(std::shared_ptr<DataAccessContext> inst) override;
|
||||||
|
|
||||||
int32_t value(const QString& expr) const override;
|
int32_t value(const QString& expr) const override;
|
||||||
void setExpression(const QString& expr) override;
|
void setExpression(const QString& expr) override;
|
||||||
QString expression() const override;
|
QString expression() const override;
|
||||||
|
|
||||||
void loadFrom(std::shared_ptr<TranslateBasic> core, const QJsonObject& obj) override;
|
void loadFrom(std::shared_ptr<TranslateBasic> core, const QJsonObject& obj) override;
|
||||||
void saveTo(QJsonObject& obj) const override;
|
void saveTo(QJsonObject& obj) const override;
|
||||||
|
|
||||||
std::shared_ptr<Serializable> newDefault() const override;
|
std::shared_ptr<Serializable> newDefault() const override;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
class ValueAccess : public DataAccessContext,
|
class ValueAccess : public DataAccessContext,
|
||||||
std::enable_shared_from_this<ValueAccess> {
|
std::enable_shared_from_this<ValueAccess> {
|
||||||
|
|
Loading…
Reference in New Issue