diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-10-21 23:20:46 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-10-25 13:59:04 -0700 |
commit | fa6235d03510558ab381d57e771ad59d7e4769e1 (patch) | |
tree | 2c8162cc67fb4351875658a2d9b8291789266987 /desktop-widgets/mainwindow.cpp | |
parent | 8a20d019c236eeebc3a6d3540936bb209d350510 (diff) | |
download | subsurface-fa6235d03510558ab381d57e771ad59d7e4769e1.tar.gz |
cleanup: remove MainWindow::unsavedChanges() function
This function was used to unify both methods of checking for
unsaved changes: the global unsaved_changes() flag and the
Command::clean() function of the undo-system.
However, all desktop functions are now undoable and therefore
the function is not needed and can be replaced by calls
to !Command::clean().
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 74dd166e6..29cc2c1e4 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -570,14 +570,6 @@ void MainWindow::on_actionCloudstoragesave_triggered() setFileClean(); } -// Currently we have two markers for unsaved changes: -// 1) unsaved_changes() returns true for non-undoable changes. -// 2) Command::isClean() returns false for undoable changes. -static bool unsavedChanges() -{ - return unsaved_changes() || !Command::isClean(); -} - void MainWindow::on_actionCloudOnline_triggered() { bool isOffline = !ui.actionCloudOnline->isChecked(); @@ -597,7 +589,7 @@ void MainWindow::on_actionCloudOnline_triggered() git_local_only = isOffline; if (!isOffline) { // User requests to go online. Try to sync cloud storage - if (unsavedChanges()) { + if (!Command::isClean()) { // If there are unsaved changes, ask the user if they want to save them. // If they don't, they have to sync manually. if (QMessageBox::warning(this, tr("Save changes?"), @@ -625,7 +617,7 @@ bool MainWindow::okToClose(QString message) QMessageBox::warning(this, tr("Warning"), message); return false; } - if (unsavedChanges() && askSaveChanges() == false) + if (!Command::isClean() && askSaveChanges() == false) return false; return true; @@ -1303,7 +1295,7 @@ void MainWindow::closeEvent(QCloseEvent *event) return; } - if (unsavedChanges() && (askSaveChanges() == false)) { + if (!Command::isClean() && (askSaveChanges() == false)) { event->ignore(); return; } @@ -1528,7 +1520,7 @@ void MainWindow::setTitle() return; } - QString unsaved = (unsavedChanges() ? " *" : ""); + QString unsaved = (!Command::isClean() ? " *" : ""); QString shown = QString(" (%1)").arg(DiveFilter::instance()->shownText()); setWindowTitle("Subsurface: " + displayedFilename(existing_filename) + unsaved + shown); } |