From: APTX Date: Thu, 24 Sep 2009 00:14:35 +0000 (+0200) Subject: Display currently playing file name in window title. X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=abfaa4c7151e6f3567a167e0fd919b2b0a260586;p=aniplayer-old.git Display currently playing file name in window title. --- diff --git a/src/videowindow.cpp b/src/videowindow.cpp index 463d5f1..c3e3837 100644 --- a/src/videowindow.cpp +++ b/src/videowindow.cpp @@ -163,7 +163,7 @@ VideoWindow::VideoWindow(QWidget *parent) : QMainWindow(parent) videoSceneMenu->volumeSlider()->setAudioOutput(videoPlayer->audioOutput()); #endif - setWindowTitle(qApp->applicationName() + " v" + qApp->applicationVersion()); + updateWindowTitle(); #ifndef BROWSERPLUGIN_BUILD loadSettings(); @@ -269,6 +269,8 @@ void VideoWindow::open(const QString &file, bool closeOnStop) #endif m_closeOnStop = closeOnStop; + + updateWindowTitle(fileInfo); } void VideoWindow::openUrl(const QString &urlstr) @@ -733,6 +735,18 @@ void VideoWindow::loadSettings() #endif } +void VideoWindow::updateWindowTitle(const QFileInfo &file) +{ + static const QString appTitle = qApp->applicationName() + QLatin1String(" v") + qApp->applicationVersion(); + if (!file.exists()) + { + setWindowTitle(appTitle); + return; + } + setWindowTitle(file.fileName() + QLatin1Char(' ') + QChar(0x2014) + QLatin1Char(' ') + appTitle); + setWindowFilePath(file.absoluteFilePath()); +} + void VideoWindow::updateCursor() { #ifdef Q_WS_X11 diff --git a/src/videowindow.h b/src/videowindow.h index 22cbced..0a5e03e 100644 --- a/src/videowindow.h +++ b/src/videowindow.h @@ -18,6 +18,7 @@ #include #include #include +#include #ifdef BROWSERPLUGIN_BUILD # include @@ -118,6 +119,7 @@ private: void saveSettings(); void loadSettings(); + void updateWindowTitle(const QFileInfo &file = QFileInfo()); void updateCursor(); Menu *menu;