2025-07-13 18:33:40 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QtWidgets/QMainWindow>
|
2025-08-05 03:50:14 +00:00
|
|
|
|
#include <QStandardItemModel>
|
|
|
|
|
#include "TranslateBasic.h"
|
2025-07-13 18:33:40 +00:00
|
|
|
|
|
2025-08-05 03:50:14 +00:00
|
|
|
|
enum class ViewType {
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
ExtractConfiguration,
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// У<><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
ValidateConfiguration,
|
|
|
|
|
};
|
|
|
|
|
class ViewManager : public QObject {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
private:
|
|
|
|
|
std::shared_ptr<TranslateBasic> _translate_core = nullptr;
|
|
|
|
|
QList<std::tuple<std::shared_ptr<extract::BytesAsRuleSet>, QWidget*, ViewType>> content_pages;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ViewManager(std::shared_ptr<TranslateBasic> base, QObject* p = nullptr);
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void open(const QString& rule_name, ViewType v_type, QWidget* p = nullptr);
|
|
|
|
|
void closeAt(int index);
|
|
|
|
|
void active(const QString& rule_name, ViewType v_type);
|
|
|
|
|
void purge(const QString& rule_name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void appendRequest(QWidget* view, const QString& title);
|
|
|
|
|
void removeRequest(int index);
|
|
|
|
|
void activeRequest(int index, const QString& new_title);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#include <QTreeView>
|
2025-07-13 18:33:40 +00:00
|
|
|
|
class TranslateUI : public QMainWindow
|
|
|
|
|
{
|
2025-08-05 03:50:14 +00:00
|
|
|
|
Q_OBJECT
|
|
|
|
|
private:
|
|
|
|
|
QTabWidget *const _tab_widget;
|
|
|
|
|
QTreeView* const _ruleset_navi;
|
|
|
|
|
QStandardItemModel* _solution_model = nullptr;
|
2025-07-13 18:33:40 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2025-08-05 03:50:14 +00:00
|
|
|
|
struct __Private {
|
|
|
|
|
std::shared_ptr<TranslateBasic> _translate_core = nullptr;
|
2025-07-13 18:33:40 +00:00
|
|
|
|
|
2025-08-05 03:50:14 +00:00
|
|
|
|
ViewManager* _view_mgr = nullptr;
|
|
|
|
|
} _core;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TranslateUI(QWidget* parent = nullptr);
|
|
|
|
|
~TranslateUI();
|
|
|
|
|
|
|
|
|
|
void addCustomRule();
|
|
|
|
|
void openExtractView();
|
|
|
|
|
|
|
|
|
|
void removeCustomRule(const QString &name);
|
|
|
|
|
|
|
|
|
|
void present_solution_customs(
|
|
|
|
|
std::shared_ptr<TranslateBasic> ins, QStandardItemModel* model) const;
|
2025-07-13 18:33:40 +00:00
|
|
|
|
};
|
|
|
|
|
|