app: show filename in siviewdialog

This commit is contained in:
itsmattkc 2022-07-30 09:03:21 -07:00
parent 339da8aa6d
commit cbf6492177
3 changed files with 16 additions and 2 deletions

View file

@ -326,6 +326,7 @@ void MainWindow::ViewSIFile()
std::unique_ptr<Interleaf> temp = std::make_unique<Interleaf>(); std::unique_ptr<Interleaf> temp = std::make_unique<Interleaf>();
if (OpenInterleafFileInternal(this, temp.get(), s)) { if (OpenInterleafFileInternal(this, temp.get(), s)) {
SIViewDialog *v = new SIViewDialog(temp->GetInformation(), this); SIViewDialog *v = new SIViewDialog(temp->GetInformation(), this);
v->SetSubtitle(QFileInfo(s).fileName());
v->temp = std::move(temp); v->temp = std::move(temp);
v->setAttribute(Qt::WA_DeleteOnClose); v->setAttribute(Qt::WA_DeleteOnClose);
v->show(); v->show();

View file

@ -13,8 +13,6 @@ SIViewDialog::SIViewDialog(Info *riff, QWidget *parent) :
root_(riff), root_(riff),
last_set_data_(nullptr) last_set_data_(nullptr)
{ {
setWindowTitle(tr("View SI File"));
auto layout = new QVBoxLayout(this); auto layout = new QVBoxLayout(this);
auto splitter = new QSplitter(); auto splitter = new QSplitter();
@ -35,6 +33,19 @@ SIViewDialog::SIViewDialog(Info *riff, QWidget *parent) :
config_stack_->addWidget(panel_); config_stack_->addWidget(panel_);
splitter->setSizes({99999, 99999}); splitter->setSizes({99999, 99999});
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);
} }
void SIViewDialog::SelectionChanged(const QModelIndex &index) void SIViewDialog::SelectionChanged(const QModelIndex &index)

View file

@ -14,6 +14,8 @@ class SIViewDialog : public QWidget
public: public:
SIViewDialog(si::Info *info, QWidget *parent = nullptr); SIViewDialog(si::Info *info, QWidget *parent = nullptr);
void SetSubtitle(const QString &s);
std::unique_ptr<si::Interleaf> temp; std::unique_ptr<si::Interleaf> temp;
private: private: