mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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>
This commit is contained in:
parent
ef95bd9a27
commit
f442358915
2 changed files with 14 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue