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>
This commit is contained in:
Lubomir I. Ivanov 2013-06-26 15:13:06 +03:00 committed by Dirk Hohndel
parent c92cf925bd
commit ab95da8fd2
3 changed files with 25 additions and 0 deletions

View file

@ -31,6 +31,8 @@ class MainTab;
class ProfileGraphicsView;
class QTextBrowser;
enum MainWindowTitleFormat { MWTF_DEFAULT, MWTF_FILENAME };
class MainWindow : public QMainWindow
{
Q_OBJECT
@ -43,6 +45,7 @@ public:
DiveListView *dive_list();
GlobeGPS *globe();
void showError(QString message);
void setTitle(enum MainWindowTitleFormat format);
private slots: