aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-12 06:53:00 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-12 10:38:01 -0700
commitf442358915a8e0a2897a45be0dd081694cf6ced6 (patch)
tree5584afe16535da159d9c161ade7dc01a21f6d067
parentef95bd9a2784db7468df01bebf0166f73179e7a4 (diff)
downloadsubsurface-f442358915a8e0a2897a45be0dd081694cf6ced6.tar.gz
Cloud storage: better window title
This makes it clear that we are working with the cloud storage and removes the (in that case, redundant) branch name from the title. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/mainwindow.cpp17
-rw-r--r--qt-ui/mainwindow.h1
2 files changed, 14 insertions, 4 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 571eb15f1..7b5223e69 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1415,6 +1415,18 @@ NotificationWidget *MainWindow::getNotificationWidget()
return ui.mainErrorMessage;
}
+QString MainWindow::displayedFilename(QString fullFilename)
+{
+ QFile f(fullFilename);
+ QFileInfo fileInfo(f);
+ QString fileName(fileInfo.fileName());
+
+ if (fullFilename.contains("https://cloud.subsurface-divelog.org"))
+ return tr("[cloud storage for] %1").arg(fileName.left(fileName.indexOf('[')));
+ else
+ return fileName;
+}
+
void MainWindow::setTitle(enum MainWindowTitleFormat format)
{
switch (format) {
@@ -1426,11 +1438,8 @@ void MainWindow::setTitle(enum MainWindowTitleFormat format)
setTitle(MWTF_DEFAULT);
return;
}
- QFile f(existing_filename);
- QFileInfo fileInfo(f);
- QString fileName(fileInfo.fileName());
QString unsaved = (unsaved_changes() ? " *" : "");
- setWindowTitle("Subsurface: " + fileName + unsaved);
+ setWindowTitle("Subsurface: " + displayedFilename(existing_filename) + unsaved);
break;
}
}
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index 9bed1d05f..63a31e0cf 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -195,6 +195,7 @@ private:
CurrentState state;
QString filter();
static MainWindow *m_Instance;
+ QString displayedFilename(QString fullFilename);
bool askSaveChanges();
bool okToClose(QString message);
void closeCurrentFile();