From 089bc5a8f7b6765edd2f26d32da9dcc54b16fbfb Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Sun, 19 Jan 2025 17:02:49 -0600 Subject: [PATCH] Show project profile in title bar As suggested here: https://forum.shotcut.org/t/settings-video-mode/12790/2 --- src/mainwindow.cpp | 23 +++++++++++++++++++---- src/mainwindow.h | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7809e4e0de..1b745a5c15 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -252,6 +252,9 @@ void MainWindow::connectUISignals() connect(this, &MainWindow::producerOpened, this, &MainWindow::onProducerOpened); connect(ui->mainToolBar, SIGNAL(visibilityChanged(bool)), SLOT(onToolbarVisibilityChanged(bool))); ui->actionSave->setEnabled(false); + connect(this, &MainWindow::audioChannelsChanged, this, &MainWindow::updateWindowTitle); + connect(this, &MainWindow::producerOpened, this, &MainWindow::updateWindowTitle); + connect(this, &MainWindow::profileChanged, this, &MainWindow::updateWindowTitle); } void MainWindow::setupAndConnectUndoStack() @@ -2287,19 +2290,31 @@ void MainWindow::configureVideoWidget() void MainWindow::setCurrentFile(const QString &filename) { - QString shownName = tr("Untitled"); if (filename == untitledFileName()) m_currentFile.clear(); else m_currentFile = filename; + updateWindowTitle(); + ui->actionShowProjectFolder->setDisabled(m_currentFile.isEmpty()); +} + +void MainWindow::updateWindowTitle() +{ + QString shownName = tr("Untitled"); if (!m_currentFile.isEmpty()) shownName = QFileInfo(m_currentFile).fileName(); + QString profileText = tr("%1x%2 %3fps %4ch").arg( + QString::number(MLT.profile().width(), 'f', 0), + QString::number(MLT.profile().height(), 'f', 0), + QString::number(MLT.profile().fps(), 'g', 2), + QString::number(Settings.playerAudioChannels(), 'f', 0)); #ifdef Q_OS_MAC - setWindowTitle(QStringLiteral("%1 - %2").arg(shownName).arg(qApp->applicationName())); + setWindowTitle(QStringLiteral("%1 - %2 - %3").arg(shownName).arg(profileText).arg( + qApp->applicationName())); #else - setWindowTitle(QStringLiteral("%1[*] - %2").arg(shownName).arg(qApp->applicationName())); + setWindowTitle(QStringLiteral("%1[*] - %2 - %3").arg(shownName).arg(profileText).arg( + qApp->applicationName())); #endif - ui->actionShowProjectFolder->setDisabled(m_currentFile.isEmpty()); } void MainWindow::on_actionAbout_Shotcut_triggered() diff --git a/src/mainwindow.h b/src/mainwindow.h index b82f2e08ad..35a4495ded 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -179,6 +179,7 @@ class MainWindow : public QMainWindow void writeSettings(); void configureVideoWidget(); void setCurrentFile(const QString &filename); + void updateWindowTitle(); void changeAudioChannels(bool checked, int channels); void changeDeinterlacer(bool checked, const char *method); void changeInterpolation(bool checked, const char *method);