diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2013-06-26 15:13:06 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-06-27 07:23:12 +0800 |
commit | ab95da8fd2024a408b3136708071c85058bbe872 (patch) | |
tree | d7fc82f285d95e51bd731c730f10ea368f6343c1 /qt-gui.cpp | |
parent | c92cf925bd3ea4c04666155ad8c446f94235a88d (diff) | |
download | subsurface-ab95da8fd2024a408b3136708071c85058bbe872.tar.gz |
Update main window title depending of current file state
If a file has been opened from the command line or via the File
menu the main window title becomes "Subsurface: filename.ext".
Title also updates if 'File->Save As' is called. "Subsurface" only
is displayed when no active file is present or post 'File->New'
or 'File->Close'.
To make this work a new public method is added - MainWindow::setTitle()
and also an enum type MainWindowTitleFormat, which should allow
more complicated formatting, such as showing the selected dives
or the total number of dives (e.g. MWTF_FILENAME_N_DIVES).
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-gui.cpp')
-rw-r--r-- | qt-gui.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp index 2474d407d..eab282dc0 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -75,6 +75,10 @@ void init_qt_ui(int *argcp, char ***argvp, char *errormessage) MainWindow *window = new MainWindow(); window->showError(errormessage); window->show(); + if (existing_filename && existing_filename[0] != '\0') + window->setTitle(MWTF_FILENAME); + else + window->setTitle(MWTF_DEFAULT); } const char *getSetting(QSettings &s, QString name) |