aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/qthelper.cpp19
-rw-r--r--core/qthelper.h2
-rw-r--r--desktop-widgets/divelistview.cpp10
3 files changed, 25 insertions, 6 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index 3ca48c480..6ee0cb6ae 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -1215,11 +1215,22 @@ const QStringList videoExtensionsList = {
".avi", ".mp4", ".mov", ".mpeg", ".mpg", ".wmv"
};
-QStringList imageExtensionFilters() {
+QStringList mediaExtensionFilters()
+{
+ return imageExtensionFilters() + videoExtensionFilters();
+}
+
+QStringList imageExtensionFilters()
+{
+ QStringList filters;
+ foreach (const QString &format, QImageReader::supportedImageFormats())
+ filters.append("*." + format);
+ return filters;
+}
+
+QStringList videoExtensionFilters()
+{
QStringList filters;
- foreach (QString format, QImageReader::supportedImageFormats()) {
- filters.append(QString("*.").append(format));
- }
foreach (const QString &format, videoExtensionsList)
filters.append("*" + format);
return filters;
diff --git a/core/qthelper.h b/core/qthelper.h
index e1517991c..fa41fd339 100644
--- a/core/qthelper.h
+++ b/core/qthelper.h
@@ -43,7 +43,9 @@ void setCurrentAppState(const QByteArray &state);
void init_proxy();
QString getUUID();
extern const QStringList videoExtensionsList;
+QStringList mediaExtensionFilters();
QStringList imageExtensionFilters();
+QStringList videoExtensionFilters();
char *intdup(int index);
char *copy_qstring(const QString &);
QString get_depth_string(depth_t depth, bool showunit = false, bool showdecimal = true);
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index 647a7fdcc..5c80813ab 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -922,11 +922,17 @@ void DiveListView::shiftTimes()
void DiveListView::loadImages()
{
- QStringList filters = imageExtensionFilters();
+ QStringList m_filters = mediaExtensionFilters();
+ QStringList i_filters = imageExtensionFilters();
+ QStringList v_filters = videoExtensionFilters();
QStringList fileNames = QFileDialog::getOpenFileNames(this,
tr("Open media files"),
lastUsedImageDir(),
- tr("Media files (%1)").arg(filters.join(" ")));
+ QString("%1 (%2);;%3 (%4);;%5 (%6);;%7 (*.*)")
+ .arg(tr("Media files"), m_filters.join(" ")
+ , tr("Image files"), i_filters.join(" ")
+ , tr("Video files"), v_filters.join(" ")
+ , tr("All files")));
if (fileNames.isEmpty())
return;