2022-07-10 23:51:49 -04:00
|
|
|
#include "siview.h"
|
|
|
|
|
2022-07-17 19:25:06 -04:00
|
|
|
#include <QFileDialog>
|
2022-07-10 23:51:49 -04:00
|
|
|
#include <QPushButton>
|
|
|
|
#include <QSplitter>
|
|
|
|
#include <QTreeView>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
|
|
using namespace si;
|
|
|
|
|
2022-07-18 03:27:00 -04:00
|
|
|
SIViewDialog::SIViewDialog(Info *riff, QWidget *parent) :
|
|
|
|
QWidget(parent, Qt::Window),
|
2022-07-17 19:25:06 -04:00
|
|
|
root_(riff),
|
2022-07-10 23:51:49 -04:00
|
|
|
last_set_data_(nullptr)
|
|
|
|
{
|
|
|
|
auto layout = new QVBoxLayout(this);
|
|
|
|
|
|
|
|
auto splitter = new QSplitter();
|
|
|
|
splitter->setChildrenCollapsible(false);
|
|
|
|
layout->addWidget(splitter);
|
|
|
|
|
|
|
|
auto tree = new QTreeView();
|
2022-07-11 04:48:50 -04:00
|
|
|
chunk_model_.SetCore(riff);
|
2022-07-10 23:51:49 -04:00
|
|
|
tree->setModel(&chunk_model_);
|
|
|
|
tree->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
connect(tree->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &SIViewDialog::SelectionChanged);
|
|
|
|
splitter->addWidget(tree);
|
|
|
|
|
|
|
|
config_stack_ = new QStackedWidget();
|
|
|
|
splitter->addWidget(config_stack_);
|
|
|
|
|
2022-07-18 03:27:00 -04:00
|
|
|
panel_ = new InfoPanel();
|
|
|
|
config_stack_->addWidget(panel_);
|
2022-07-10 23:51:49 -04:00
|
|
|
|
2022-07-18 03:27:00 -04:00
|
|
|
splitter->setSizes({99999, 99999});
|
2022-07-30 12:03:21 -04:00
|
|
|
|
|
|
|
SetSubtitle(QString());
|
|
|
|
}
|
|
|
|
|
|
|
|
void SIViewDialog::SetSubtitle(const QString &s)
|
|
|
|
{
|
|
|
|
QString t;
|
|
|
|
if (s.isEmpty()) {
|
|
|
|
t = tr("View SI File");
|
|
|
|
} else {
|
|
|
|
t = tr("View SI File: %1").arg(s);
|
|
|
|
}
|
|
|
|
setWindowTitle(t);
|
2022-07-10 23:51:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SIViewDialog::SelectionChanged(const QModelIndex &index)
|
|
|
|
{
|
2022-07-18 03:27:00 -04:00
|
|
|
panel_->SetData(static_cast<Info*>(index.internalPointer()));
|
2022-07-17 19:25:06 -04:00
|
|
|
}
|