summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-10-27 14:52:27 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-11-04 14:27:00 +0100
commit8b56dc30d78aabc697749a8542d6d4f39b63f44d (patch)
treed1acaa4174073a98987049a6c2e357a23760c55b /desktop-widgets/mainwindow.cpp
parent92ba4b9cc7bbc2e1818191745d1976f9b915be9a (diff)
downloadsubsurface-8b56dc30d78aabc697749a8542d6d4f39b63f44d.tar.gz
Correct, cleanup, translate and unify file filters
Correct spelling and typos in file filters. Unify and translate file filter names. Don't pass a file filter to a directory open dialog - not needed. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r--desktop-widgets/mainwindow.cpp137
1 files changed, 83 insertions, 54 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index df0a43b1b..e84b6160a 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -537,7 +537,7 @@ void MainWindow::on_actionOpen_triggered()
// yes, this look wrong to use getSaveFileName() for the open dialog, but we need to be able
// to enter file names that don't exist in order to use our git syntax /path/to/dir[branch]
// with is a potentially valid input, but of course won't exist. So getOpenFileName() wouldn't work
- QFileDialog dialog(this, tr("Open file"), lastUsedDir(), filter());
+ QFileDialog dialog(this, tr("Open file"), lastUsedDir(), filter_open());
dialog.setFileMode(QFileDialog::AnyFile);
dialog.setViewMode(QFileDialog::Detail);
dialog.setLabelText(QFileDialog::Accept, tr("Open"));
@@ -649,7 +649,7 @@ void learnImageDirs(QStringList dirnames)
void MainWindow::on_actionHash_images_triggered()
{
QFuture<void> future;
- QFileDialog dialog(this, tr("Traverse image directories"), lastUsedDir(), filter());
+ QFileDialog dialog(this, tr("Traverse image directories"), lastUsedDir());
dialog.setFileMode(QFileDialog::Directory);
dialog.setViewMode(QFileDialog::Detail);
dialog.setLabelText(QFileDialog::Accept, tr("Scan"));
@@ -1259,43 +1259,89 @@ void MainWindow::on_actionUserSurvey_triggered()
survey->show();
}
-QString MainWindow::filter()
+QString MainWindow::filter_open()
{
QString f;
- f += "Dive log files ( *.ssrf ";
- f += "*.can *.CAN ";
- f += "*.db *.DB " ;
- f += "*.sql *.SQL " ;
- f += "*.dld *.DLD ";
- f += "*.jlb *.JLB ";
- f += "*.lvd *.LVD ";
- f += "*.sde *.SDE ";
- f += "*.udcf *.UDCF ";
- f += "*.uddf *.UDDF ";
- f += "*.xml *.XML ";
- f += "*.dlf *.DLF ";
- f += "*.log *.LOG ";
- f += "*.txt *.TXT) ";
- f += "*.apd *.APD) ";
- f += "*.dive *.DIVE ";
- f += "*.zxu *.zxl *.ZXU *.ZXL ";
+ f += tr("Dive log files");
+ f += " (*.ssrf";
+ f += " *.xml";
+ f += " *.can";
+ f += " *.db" ;
+ f += " *.sql" ;
+ f += " *.dld";
+ f += " *.jlb";
+ f += " *.lvd";
+ f += " *.sde";
+ f += " *.udcf";
+ f += " *.uddf";
+ f += " *.dlf";
+ f += " *.log";
+ f += " *.txt";
+ f += " *.apd";
+ f += " *.dive";
+ f += " *.zxu *.zxl";
f += ");;";
- f += "Subsurface (*.ssrf);;";
- f += "Cochran (*.can *.CAN);;";
- f += "DiveLogs.de (*.dld *.DLD);;";
- f += "JDiveLog (*.jlb *.JLB);;";
- f += "Liquivision (*.lvd *.LVD);;";
- f += "Suunto (*.sde *.SDE *.db *.DB);;";
- f += "UDCF (*.udcf *.UDCF);;";
- f += "UDDF (*.uddf *.UDDF);;";
- f += "XML (*.xml *.XML);;";
- f += "Divesoft (*.dlf *.DLF);;";
- f += "Datatrak/WLog Files (*.log *.LOG);;";
- f += "MkVI files (*.txt *.TXT);;";
- f += "APD log viewer (*.apd *.APD);;";
- f += "OSTCtools Files (*.dive *.DIVE);;";
- f += "DAN DL7 (*.zxu *.zxl *.ZXU *.ZXL)";
+ f += tr("Subsurface files") + " (*.ssrf *.xml);;";
+ f += tr("Cochran") + " (*.can);;";
+ f += tr("DiveLogs.de") + " (*.dld);;";
+ f += tr("JDiveLog") + " (*.jlb);;";
+ f += tr("Liquivision") + " (*.lvd);;";
+ f += tr("Suunto") + " (*.sde *.db);;";
+ f += tr("UDCF") + " (*.udcf);;";
+ f += tr("UDDF") + " (*.uddf);;";
+ f += tr("XML") + " (*.xml);;";
+ f += tr("Divesoft") + " (*.dlf);;";
+ f += tr("Datatrak/WLog") + " (*.log);;";
+ f += tr("MkVI files") + " (*.txt);;";
+ f += tr("APD log viewer") + " (*.apd);;";
+ f += tr("OSTCtools") + " (*.dive);;";
+ f += tr("DAN DL7") + " (*.zxu *.zxl)";
+
+ return f;
+}
+
+QString MainWindow::filter_import()
+{
+ QString f;
+ f += tr("Dive log files");
+ f += " (*.ssrf";
+ f += " *.xml";
+ f += " *.can";
+ f += " *.csv";
+ f += " *.db" ;
+ f += " *.sql" ;
+ f += " *.dld";
+ f += " *.jlb";
+ f += " *.lvd";
+ f += " *.sde";
+ f += " *.udcf";
+ f += " *.uddf";
+ f += " *.dlf";
+ f += " *.log";
+ f += " *.txt";
+ f += " *.apd";
+ f += " *.dive";
+ f += " *.zxu *.zxl";
+ f += ");;";
+
+ f += tr("Subsurface files") + " (*.ssrf *.xml);;";
+ f += tr("Cochran") + " (*.can);;";
+ f += tr("CSV") + " (*.csv *.CSV);;";
+ f += tr("DiveLogs.de") + " (*.dld);;";
+ f += tr("JDiveLog") + " (*.jlb);;";
+ f += tr("Liquivision") + " (*.lvd);;";
+ f += tr("Suunto") + " (*.sde *.db);;";
+ f += tr("UDCF") + " (*.udcf);;";
+ f += tr("UDDF") + " (*.uddf);;";
+ f += tr("XML") + " (*.xml);;";
+ f += tr("Divesoft") + " (*.dlf);;";
+ f += tr("Datatrak/WLog") + " (*.log);;";
+ f += tr("MkVI files") + " (*.txt);;";
+ f += tr("APD log viewer") + " (*.apd);;";
+ f += tr("OSTCtools") + " (*.dive);;";
+ f += tr("DAN DL7") + " (*.zxu *.zxl);;";
+ f += tr("All files") + " (*.*)";
return f;
}
@@ -1635,7 +1681,7 @@ int MainWindow::file_save_as(void)
}
// create a file dialog that allows us to save to a new file
QFileDialog selection_dialog(this, tr("Save file as"), default_filename,
- tr("Subsurface XML files (*.ssrf *.xml *.XML)"));
+ tr("Subsurface files") + " (*.ssrf *.xml)");
selection_dialog.setAcceptMode(QFileDialog::AcceptSave);
selection_dialog.setFileMode(QFileDialog::AnyFile);
selection_dialog.setDefaultSuffix("");
@@ -1843,24 +1889,7 @@ void MainWindow::loadFiles(const QStringList fileNames)
void MainWindow::on_actionImportDiveLog_triggered()
{
- QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Open dive log file"), lastUsedDir(),
- tr("Dive log files (*.ssrf *.can *.csv *.db *.sql *.dld *.jlb *.lvd *.sde *.udcf *.uddf *.xml *.txt *.dlf *.apd *.zxu *.zxl"
- "*.SSRF *.CAN *.CSV *.DB *.SQL *.DLD *.JLB *.LVD *.SDE *.UDCF *.UDDF *.xml *.TXT *.DLF *.APD *.ZXU *.ZXL);;"
- "Cochran files (*.can *.CAN);;"
- "CSV files (*.csv *.CSV);;"
- "DiveLog.de files (*.dld *.DLD);;"
- "JDiveLog files (*.jlb *.JLB);;"
- "Liquivision files (*.lvd *.LVD);;"
- "MkVI files (*.txt *.TXT);;"
- "Suunto files (*.sde *.db *.SDE *.DB);;"
- "Divesoft files (*.dlf *.DLF);;"
- "UDDF/UDCF files (*.uddf *.udcf *.UDDF *.UDCF);;"
- "XML files (*.xml *.XML);;"
- "APD log viewer (*.apd *.APD);;"
- "Datatrak/WLog Files (*.log *.LOG);;"
- "OSTCtools Files (*.dive *.DIVE);;"
- "DAN DL7 (*.zxu *.zxl *.ZXU *.ZXL);;"
- "All files (*)"));
+ QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Open dive log file"), lastUsedDir(), filter_import());
if (fileNames.isEmpty())
return;