From 1b5bdc0f07932ba99858af87432215e986e5f8f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Tue, 19 Apr 2016 08:51:11 +0200 Subject: [PATCH] Better window title --- src/gui.cpp | 12 ++++++++++++ src/gui.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/gui.cpp b/src/gui.cpp index 7e2b6610..c221f0e9 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -547,6 +547,7 @@ bool GUI::openFile(const QString &fileName) updateNavigationActions(); updateStatusBarInfo(); + updateWindowTitle(); updateGraphTabs(); updateTrackView(); @@ -718,6 +719,7 @@ void GUI::reloadFile() } updateStatusBarInfo(); + updateWindowTitle(); updateGraphTabs(); updateTrackView(); if (_files.isEmpty()) @@ -748,6 +750,7 @@ void GUI::closeAll() _fileActionGroup->setEnabled(false); updateStatusBarInfo(); + updateWindowTitle(); updateGraphTabs(); updateTrackView(); } @@ -853,6 +856,15 @@ void GUI::updateStatusBarInfo() _timeLabel->setText(timeSpan(_time)); } +void GUI::updateWindowTitle() +{ + if (_files.count() == 1) + setWindowTitle(QFileInfo(_files.at(0)).fileName() + + QString(" - " APP_NAME)); + else + setWindowTitle(APP_NAME); +} + void GUI::mapChanged(int index) { _currentMap = _maps.at(index); diff --git a/src/gui.h b/src/gui.h index 3010870d..6c597d88 100644 --- a/src/gui.h +++ b/src/gui.h @@ -83,6 +83,7 @@ private: bool loadFile(const QString &fileName); void saveFile(const QString &fileName); void updateStatusBarInfo(); + void updateWindowTitle(); void updateNavigationActions(); void updateGraphTabs(); void updateTrackView();