Skip to content

Commit

Permalink
Show project profile in title bar
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatherly committed Jan 19, 2025
1 parent e5c5db3 commit 089bc5a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 089bc5a

Please sign in to comment.