From cbf6492177e4f64922af7ce74f9c1765f4ea386f Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Sat, 30 Jul 2022 09:03:21 -0700 Subject: [PATCH] app: show filename in siviewdialog --- app/mainwindow.cpp | 1 + app/siview/siview.cpp | 15 +++++++++++++-- app/siview/siview.h | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index 4ff9d36..aa31bf5 100644 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -326,6 +326,7 @@ void MainWindow::ViewSIFile() std::unique_ptr temp = std::make_unique(); if (OpenInterleafFileInternal(this, temp.get(), s)) { SIViewDialog *v = new SIViewDialog(temp->GetInformation(), this); + v->SetSubtitle(QFileInfo(s).fileName()); v->temp = std::move(temp); v->setAttribute(Qt::WA_DeleteOnClose); v->show(); diff --git a/app/siview/siview.cpp b/app/siview/siview.cpp index c0c4768..341d23a 100644 --- a/app/siview/siview.cpp +++ b/app/siview/siview.cpp @@ -13,8 +13,6 @@ SIViewDialog::SIViewDialog(Info *riff, QWidget *parent) : root_(riff), last_set_data_(nullptr) { - setWindowTitle(tr("View SI File")); - auto layout = new QVBoxLayout(this); auto splitter = new QSplitter(); @@ -35,6 +33,19 @@ SIViewDialog::SIViewDialog(Info *riff, QWidget *parent) : config_stack_->addWidget(panel_); 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) diff --git a/app/siview/siview.h b/app/siview/siview.h index 229888c..5b95514 100644 --- a/app/siview/siview.h +++ b/app/siview/siview.h @@ -14,6 +14,8 @@ class SIViewDialog : public QWidget public: SIViewDialog(si::Info *info, QWidget *parent = nullptr); + void SetSubtitle(const QString &s); + std::unique_ptr temp; private: