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