132 lines
3.7 KiB
C++
132 lines
3.7 KiB
C++
#pragma once
|
|
#include <QWidget>
|
|
#include <QTableView>
|
|
#include <QStandardItemModel>
|
|
#include <QTreeView>
|
|
#include <QLineEdit>
|
|
#include <QStackedWidget>
|
|
#include <QSpinBox>
|
|
#include <QPushButton>
|
|
#include <QCheckBox>
|
|
#include <QTextBrowser>
|
|
#include "extract_basic.h"
|
|
#include "TranslateBasic.h"
|
|
|
|
namespace unit_configurations {
|
|
class SingleBasedConfiguration : public QWidget {
|
|
Q_OBJECT
|
|
private:
|
|
std::shared_ptr<TranslateBasic> _bind_core;
|
|
QSpinBox* const _offset_enter;
|
|
QComboBox* const _delegate_changed;
|
|
QPushButton* const _delegate_sync;
|
|
QTextBrowser* const _content_display;
|
|
|
|
std::shared_ptr<extract::SingleBasedUnit> inst_current = nullptr;
|
|
QModelIndex idx_current;
|
|
|
|
public:
|
|
SingleBasedConfiguration(std::shared_ptr<TranslateBasic> core, QWidget* p = nullptr);
|
|
void currentAccept(std::shared_ptr<ExtractUnit> inst_u, const QModelIndex& idx);
|
|
|
|
signals:
|
|
void reloadRequest();
|
|
};
|
|
|
|
/// <summary>
|
|
/// Áбí×Ö¶ÎÅäÖÃÃæ°å
|
|
/// </summary>
|
|
class ListBasedConfiguration : public QWidget {
|
|
Q_OBJECT
|
|
private:
|
|
std::shared_ptr<TranslateBasic> _bind_core;
|
|
|
|
QSpinBox* const _offset_enter;
|
|
QPushButton* const _delegate_sync;
|
|
QComboBox* const _delegate_select;
|
|
QComboBox* const _size_layout_select;
|
|
QStackedWidget* const _configs_stack;
|
|
QTextBrowser* const _content_display;
|
|
|
|
QSpinBox* const _const_number_input;
|
|
QComboBox* const _prev_field_refer;
|
|
|
|
std::shared_ptr<extract::ListBasedUnit> _bind_u = nullptr;
|
|
std::shared_ptr<ScopeFieldsGetter> _fields_getter = nullptr;
|
|
QModelIndex _bind_index;
|
|
|
|
public:
|
|
ListBasedConfiguration(std::shared_ptr<TranslateBasic> core, QWidget* p = nullptr);
|
|
void currentAccept(std::shared_ptr<ExtractUnit> inst_u,
|
|
const QModelIndex& idx, std::shared_ptr<ScopeFieldsGetter> get);
|
|
|
|
signals:
|
|
void reloadRequest();
|
|
};
|
|
|
|
class UnionBasedConfiguration : public QWidget {
|
|
Q_OBJECT
|
|
private:
|
|
QSpinBox* const _offset_enter; // Æ«ÒÆ
|
|
QSpinBox* const _size_input; // ³ß´çÊäÈë
|
|
QTextEdit* const _context_present; // ÄÚÈÝչʾ
|
|
|
|
QComboBox* const _match_select; // Æ¥ÅäÀàÐÍ
|
|
QComboBox* const _delegate_select; // ½âÎö´úÀíÀàÐÍ
|
|
QTableView* const _members_present;// ³ÉÔ±´úÀíÀàÐÍ
|
|
QStandardItemModel* const _members_model;
|
|
|
|
QComboBox* const _intfield_bind;
|
|
QComboBox* const _compare_op;
|
|
QSpinBox* const _value_enters;
|
|
|
|
public:
|
|
UnionBasedConfiguration(std::shared_ptr<TranslateBasic> core, QWidget* p = nullptr);
|
|
void currentAccept(std::shared_ptr<ExtractUnit> inst_u,
|
|
const QModelIndex& idx, std::shared_ptr<ScopeFieldsGetter> get);
|
|
|
|
signals:
|
|
void reloadRequest();
|
|
};
|
|
}
|
|
|
|
#include <QStyledItemDelegate>
|
|
class UnitSelectDelegate : public QStyledItemDelegate {
|
|
private:
|
|
std::shared_ptr<TranslateBasic> _kernel;
|
|
|
|
public:
|
|
UnitSelectDelegate(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;
|
|
};
|
|
|
|
class ExtractRuleView : public QWidget
|
|
{
|
|
private:
|
|
std::shared_ptr<TranslateBasic> _basic_bind;
|
|
|
|
QTableView* const _member_units;
|
|
QStandardItemModel* const _members_model;
|
|
QStackedWidget* const _configs_stack;
|
|
|
|
std::shared_ptr<extract::AsRuleSet> _current_rule;
|
|
std::shared_ptr<FieldManagerLayer> _current_fields_cache = nullptr;
|
|
|
|
public:
|
|
ExtractRuleView(std::shared_ptr<TranslateBasic> base,
|
|
std::shared_ptr<extract::AsRuleSet> inst_r, QWidget* p = nullptr);
|
|
|
|
void reload();
|
|
void appendUnit();
|
|
|
|
void dataChanged(QStandardItem* item);
|
|
|
|
protected:
|
|
void showEvent(QShowEvent* e) override;
|
|
};
|
|
|