94 lines
3.1 KiB
C
94 lines
3.1 KiB
C
|
#pragma once
|
|||
|
|
|||
|
#include <QWidget>
|
|||
|
#include <QToolBox>
|
|||
|
#include <QSplitter>
|
|||
|
#include <QTableView>
|
|||
|
#include <QStandardItemModel>
|
|||
|
#include <QListView>
|
|||
|
#include <QComboBox>
|
|||
|
#include <QPushButton>
|
|||
|
#include <QStyledItemDelegate>
|
|||
|
#include <QMainWindow>
|
|||
|
#include "xast_parse.h"
|
|||
|
#include "storyline_compare.h"
|
|||
|
|
|||
|
|
|||
|
namespace views {
|
|||
|
class StorylineModel : public QAbstractItemModel {
|
|||
|
private:
|
|||
|
QList<std::shared_ptr<xast_parse::IElementSlice>> _nodes_temp;
|
|||
|
std::shared_ptr<xast_parse::IElementSlice> _current_slice = nullptr;
|
|||
|
|
|||
|
public:
|
|||
|
void loadCurrentSlice(std::shared_ptr<xast_parse::IElementSlice> target_slice);
|
|||
|
std::shared_ptr<xast_parse::IElementSlice> currentSlice();
|
|||
|
|
|||
|
// Inherited via QAbstractItemModel
|
|||
|
virtual QModelIndex index(int row, int column, const QModelIndex& parent) const override;
|
|||
|
virtual QModelIndex parent(const QModelIndex& child) const override;
|
|||
|
virtual int rowCount(const QModelIndex& parent) const override;
|
|||
|
virtual int columnCount(const QModelIndex& parent) const override;
|
|||
|
virtual QVariant data(const QModelIndex& index, int role) const override;
|
|||
|
|
|||
|
virtual Qt::ItemFlags flags(const QModelIndex& idx) const override;
|
|||
|
virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
|
|||
|
};
|
|||
|
|
|||
|
class StorylineDelegate : public QStyledItemDelegate {
|
|||
|
private:
|
|||
|
QWidget* const bind_view;
|
|||
|
public:
|
|||
|
explicit StorylineDelegate(QAbstractItemView* pwidget);
|
|||
|
|
|||
|
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 QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
|||
|
};
|
|||
|
|
|||
|
class StoryChangePresent : public QWidget {
|
|||
|
public:
|
|||
|
StoryChangePresent(
|
|||
|
const QHash<QString, std::shared_ptr<xast_parse::StoryDefine>>& g_base,
|
|||
|
const QHash<QString, std::shared_ptr<xast_parse::StoryDefine>>& g_old,
|
|||
|
QWidget* parent = nullptr);
|
|||
|
|
|||
|
compare::Compare& compareTool();
|
|||
|
|
|||
|
private:
|
|||
|
compare::Compare base_compare;
|
|||
|
QHash<QString, std::shared_ptr<xast_parse::StoryDefine>> g_old;
|
|||
|
|
|||
|
QToolBox* const _type_appoint;
|
|||
|
QTableView* const _fragment_summary; // <20><><EFBFBD>ڵ<EFBFBD><DAB5>Ļ<DEB8><C4BB><EFBFBD>
|
|||
|
QTableView* const _upstream_summary; // <20><><EFBFBD>νڵ<CEBD><DAB5>Ļ<DEB8><C4BB><EFBFBD>
|
|||
|
QStandardItemModel* const _change_model;
|
|||
|
|
|||
|
QComboBox* const _story_appoint;
|
|||
|
|
|||
|
QSplitter* const _edit_splitter;
|
|||
|
QListView* const _define_view;
|
|||
|
QListView* const _refer_view;
|
|||
|
|
|||
|
StorylineModel* const _defn_fragment;
|
|||
|
StorylineModel* const _curr_refslice;
|
|||
|
|
|||
|
void type_change(int idx);
|
|||
|
void fragment_selected(const QModelIndex& item);
|
|||
|
void storyline_selected(const QString& line);
|
|||
|
};
|
|||
|
|
|||
|
class CompareWindow : public QMainWindow {
|
|||
|
private:
|
|||
|
xast_parse::XAST_Parser _graph_base, _graph_old;
|
|||
|
StoryChangePresent *const _cmp_widget;
|
|||
|
|
|||
|
public:
|
|||
|
CompareWindow(QFileInfo file_base, QFileInfo file_old);
|
|||
|
};
|
|||
|
}
|
|||
|
|