mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
code cleanup: simplify if / else chains
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
9e6a3bee0d
commit
858740e8a1
1 changed files with 6 additions and 10 deletions
|
@ -1427,14 +1427,11 @@ QString MainWindow::filter_import()
|
|||
|
||||
bool MainWindow::askSaveChanges()
|
||||
{
|
||||
QString message;
|
||||
QMessageBox response(this);
|
||||
|
||||
if (existing_filename)
|
||||
message = tr("Do you want to save the changes that you made in the file %1?")
|
||||
.arg(displayedFilename(existing_filename));
|
||||
else
|
||||
message = tr("Do you want to save the changes that you made in the data file?");
|
||||
QString message = existing_filename ?
|
||||
tr("Do you want to save the changes that you made in the file %1?").arg(displayedFilename(existing_filename)) :
|
||||
tr("Do you want to save the changes that you made in the data file?");
|
||||
|
||||
response.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||
response.setDefaultButton(QMessageBox::Save);
|
||||
|
@ -1729,10 +1726,9 @@ QString MainWindow::displayedFilename(QString fullFilename)
|
|||
|
||||
if (fullFilename.contains(prefs.cloud_git_url)) {
|
||||
QString email = fileName.left(fileName.indexOf('['));
|
||||
if (git_local_only)
|
||||
return tr("[local cache for] %1").arg(email);
|
||||
else
|
||||
return tr("[cloud storage for] %1").arg(email);
|
||||
return git_local_only ?
|
||||
tr("[local cache for] %1").arg(email) :
|
||||
tr("[cloud storage for] %1").arg(email);
|
||||
} else {
|
||||
return fileName;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue