Changeset 4627973 in subsurface


Ignore:
Timestamp:
May 6, 2017, 8:07:16 AM (7 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
67fbf60
Parents:
59bbaa7
git-author:
Robert C. Helling <helling@…> (05/05/17 12:13:46)
git-committer:
Dirk Hohndel <dirk@…> (05/06/17 08:07:16)
Message:

File selector should filter images we can actually handle.

So better ask Qt about image formats known to it.

Signed-off-by: Robert C. Helling <helling@…>

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • core/qthelper.cpp

    rb368ecd r4627973  
    11741174}
    11751175
     1176QStringList imageExtensionFilters() {
     1177        QStringList filters;
     1178        foreach (QString format, QImageReader::supportedImageFormats()) {
     1179                filters.append(QString("*.").append(format));
     1180        }
     1181        return filters;
     1182}
     1183
    11761184void learnImages(const QDir dir, int max_recursions)
    11771185{
    1178         QStringList filters, files;
     1186        QStringList files;
     1187        QStringList filters = imageExtensionFilters();
    11791188
    11801189        if (max_recursions) {
     
    11841193        }
    11851194
    1186         foreach (QString format, QImageReader::supportedImageFormats()) {
    1187                 filters.append(QString("*.").append(format));
    1188         }
    11891195
    11901196        foreach (QString file, dir.entryList(filters, QDir::Files)) {
  • core/qthelper.h

    rb368ecd r4627973  
    4747void init_proxy();
    4848QString getUUID();
     49QStringList imageExtensionFilters();
    4950
    5051#endif // QTHELPER_H
  • desktop-widgets/divelistview.cpp

    r53ae83e r4627973  
    918918void DiveListView::loadImages()
    919919{
    920         QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Open image files"), lastUsedImageDir(), tr("Image files (*.jpg *.jpeg *.pnm *.tif *.tiff)"));
     920        QStringList filters = imageExtensionFilters();
     921        QStringList fileNames = QFileDialog::getOpenFileNames(this,
     922                                                              tr("Open image files"),
     923                                                              lastUsedImageDir(),
     924                                                              tr("Image files (%1)").arg(filters.join(" ")));
     925
    921926        if (fileNames.isEmpty())
    922927                return;
  • desktop-widgets/simplewidgets.cpp

    r59bbaa7 r4627973  
    2020#include "profile-widget/profilewidget2.h"
    2121#include "desktop-widgets/undocommands.h"
     22#include "core/qthelper.h"
    2223
    2324class MinMaxAvgWidgetPrivate {
Note: See TracChangeset for help on using the changeset viewer.