File indexing completed on 2024-06-02 04:19:31

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2008-01-20
0007  * Description : User interface for searches
0008  *
0009  * SPDX-FileCopyrightText: 2008-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  * SPDX-FileCopyrightText: 2011-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "searchfields_p.h"
0017 
0018 namespace Digikam
0019 {
0020 
0021 SearchField* SearchField::createField(const QString& name, SearchFieldGroup* const parent)
0022 {
0023     if      (name == QLatin1String("albumid"))
0024     {
0025         SearchFieldAlbum* const field = new SearchFieldAlbum(parent, SearchFieldAlbum::TypeAlbum);
0026         field->setFieldName(name);
0027         field->setText(i18n("Album"), i18n("Search items located in"));
0028 
0029         return field;
0030     }
0031     else if (name == QLatin1String("albumname"))
0032     {
0033         SearchFieldText* const field = new SearchFieldText(parent);
0034         field->setFieldName(name);
0035         field->setText(i18n("Album"), i18n("The album name contains"));
0036 
0037         return field;
0038     }
0039     else if (name == QLatin1String("albumcaption"))
0040     {
0041         SearchFieldText* const field = new SearchFieldText(parent);
0042         field->setFieldName(name);
0043         field->setText(i18n("Album"), i18n("The album caption contains"));
0044 
0045         return field;
0046     }
0047     else if (name == QLatin1String("albumcollection"))
0048     {
0049         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0050         field->setFieldName(name);
0051         field->setText(i18n("Album"), i18n("The album category is"));
0052         ApplicationSettings* const settings = ApplicationSettings::instance();
0053 
0054         if (settings)
0055         {
0056             QStringList Categories = settings->getAlbumCategoryNames();
0057             int size               = Categories.size();
0058             QStringList categorychoices;
0059 
0060             for (int i = 0 ; i < size ; ++i)
0061             {
0062                 categorychoices << Categories.at(i) << Categories.at(i);
0063             }
0064 
0065             field->setChoice(categorychoices);
0066         }
0067 
0068         return field;
0069     }
0070     else if (name == QLatin1String("tagid"))
0071     {
0072         SearchFieldAlbum* const field = new SearchFieldAlbum(parent, SearchFieldAlbum::TypeTag);
0073         field->setFieldName(name);
0074         field->setText(i18n("Tags"), i18n("Return items with tag"));
0075 
0076         return field;
0077     }
0078     else if (name == QLatin1String("tagname"))
0079     {
0080         SearchFieldText* const field = new SearchFieldText(parent);
0081         field->setFieldName(name);
0082         field->setText(i18n("Tags"), i18n("A tag of the item contains"));
0083 
0084         return field;
0085     }
0086     else if (name == QLatin1String("nottagged"))
0087     {
0088         /**
0089          * @todo Merge a "Not tagged" field into TagModel together with AND/OR control
0090          * for checked tags and logical connections (AND and Not Tagged checked => all other tags disabled)
0091          */
0092 
0093         SearchFieldCheckBox* const field = new SearchFieldCheckBox(parent);
0094         field->setFieldName(name);
0095         field->setText(i18n("Tags"), i18n("Return items without tags"));
0096         field->setLabel(i18n("Not Tagged"));
0097 
0098         return field;
0099     }
0100     else if (name == QLatin1String("filename"))
0101     {
0102         SearchFieldText* const field = new SearchFieldText(parent);
0103         field->setFieldName(name);
0104         field->setText(i18n("File Name"), i18n("Return items whose file name contains"));
0105 
0106         return field;
0107     }
0108     else if (name == QLatin1String("modificationdate"))
0109     {
0110         SearchFieldRangeDate* const field = new SearchFieldRangeDate(parent, SearchFieldRangeDate::DateTime);
0111         field->setFieldName(name);
0112         field->setText(i18n("Modification"), i18n("Return items modified between"));
0113         field->setBetweenText(i18nc("'Return items modified between...and...", "and"));
0114 
0115         return field;
0116     }
0117     else if (name == QLatin1String("filesize"))
0118     {
0119         SearchFieldRangeDouble* const field = new SearchFieldRangeDouble(parent);
0120         field->setFieldName(name);
0121         field->setText(i18n("File Size"), i18n("Size of the file in megabytes"));
0122         field->setBetweenText(i18nc("Size of the file ...-...", "-"));
0123         field->setNumberPrefixAndSuffix(QString(), QLatin1String("MiB"));
0124         field->setBoundary(0, 1000000, 1, 0.5);
0125         field->setFactor(1024 * 1024);
0126 
0127         return field;
0128     }
0129     else if (name == QLatin1String("bytesize"))
0130     {
0131         SearchFieldRangeInt* const field = new SearchFieldRangeInt(parent);
0132         field->setFieldName(name);
0133         field->setText(i18n("File Size"), i18n("Size of the file in bytes"));
0134         field->setBetweenText(i18nc("Size of the file ...-...", "-"));
0135         field->setNumberPrefixAndSuffix(QString(), QLatin1String("B"));
0136         field->setBoundary(0, 1024 * 1024, 100);
0137 
0138         return field;
0139     }
0140     else if (name == QLatin1String("monthday"))
0141     {
0142         SearchFieldMonthDay* const field = new SearchFieldMonthDay(parent);
0143         field->setFieldName(name);
0144         field->setText(i18n("Month/Day"), i18n("Return items from a month or a day of the month"));
0145 
0146         return field;
0147     }
0148     else if (name == QLatin1String("labels"))
0149     {
0150         SearchFieldLabels* const field = new SearchFieldLabels(parent);
0151         field->setFieldName(name);
0152         field->setText(i18n("Labels"), i18n("Return items with labels"));
0153 
0154         return field;
0155     }
0156     else if (name == QLatin1String("rating"))
0157     {
0158         SearchFieldRating* const field = new SearchFieldRating(parent);
0159         field->setFieldName(name);
0160         field->setText(i18n("Rating"), i18n("Return items rated at least"));
0161         field->setBetweenText(i18nc("Return items rated at least...at most...", "at most"));
0162 
0163         return field;
0164     }
0165     else if (name == QLatin1String("creationdate"))
0166     {
0167         SearchFieldRangeDate* const field = new SearchFieldRangeDate(parent, SearchFieldRangeDate::DateTime);
0168         field->setFieldName(name);
0169         field->setText(i18n("Date"), i18n("Return items created between"));
0170         field->setBetweenText(i18nc("'Return items created between...and...", "and"));
0171 
0172         return field;
0173     }
0174     else if (name == QLatin1String("digitizationdate"))
0175     {
0176         SearchFieldRangeDate* const field = new SearchFieldRangeDate(parent, SearchFieldRangeDate::DateTime);
0177         field->setFieldName(name);
0178         field->setText(i18n("Digitization"), i18n("Return items digitized between"));
0179         field->setBetweenText(i18nc("'Return items digitized between...and...", "and"));
0180 
0181         return field;
0182     }
0183     else if (name == QLatin1String("creationtime"))
0184     {
0185         SearchFieldRangeTime* const field = new SearchFieldRangeTime(parent);
0186         field->setFieldName(name);
0187         field->setText(i18n("Time"), i18n("Return items with created time between"));
0188         field->setBetweenText(i18nc("'Return items with created time between...and...", "and"));
0189 
0190         return field;
0191     }
0192     else if (name == QLatin1String("orientation"))
0193     {
0194         // choice
0195 
0196         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0197         field->setFieldName(name);
0198         field->setText(i18n("Exif Orientation"), i18n("Find items with orientation flag"));
0199         QMap<int, QString> map = DMetadata::possibleValuesForEnumField(MetadataInfo::Orientation);
0200         field->setChoice(map);
0201 
0202         return field;
0203     }
0204     else if (name == QLatin1String("dimension"))
0205     {
0206         // "width", "height", "pixels"
0207     }
0208     else if (name == QLatin1String("width"))
0209     {
0210         SearchFieldRangeInt* const field = new SearchFieldRangeInt(parent);
0211         field->setFieldName(name);
0212         field->setText(i18n("Width"), i18n("Find items with a width between"));
0213         field->setBetweenText(i18nc("Find items with a width between...and...", "and"));
0214         field->setNumberPrefixAndSuffix(QString(), i18nc("Pixels", "px"));
0215         field->setBoundary(1, 1000000, 250);
0216         field->setSuggestedValues(QList<int>()
0217                                   << 50 << 100 << 200 << 300 << 400 << 500 << 600 << 700 << 800 << 900
0218                                   << 1000 << 1250 << 1500 << 1750 << 2000 << 3000 << 4000
0219                                   << 5000 << 6000 << 7000 << 8000 << 9000 << 10000
0220                                  );
0221         field->setSuggestedInitialValue(1000);
0222         field->setSingleSteps(50, 1000);
0223 
0224         return field;
0225     }
0226     else if (name == QLatin1String("height"))
0227     {
0228         SearchFieldRangeInt* const field = new SearchFieldRangeInt(parent);
0229         field->setFieldName(name);
0230         field->setText(i18n("Height"), i18n("Find items with a height between"));
0231         field->setBetweenText(i18nc("Find items with a height between...and...", "and"));
0232         field->setNumberPrefixAndSuffix(QString(), i18nc("Pixels", "px"));
0233         field->setBoundary(1, 1000000, 250);
0234         field->setSuggestedValues(QList<int>()
0235                                   << 50 << 100 << 200 << 300 << 400 << 500 << 600 << 700 << 800 << 900
0236                                   << 1000 << 1250 << 1500 << 1750 << 2000 << 3000 << 4000
0237                                   << 5000 << 6000 << 7000 << 8000 << 9000 << 10000
0238                                  );
0239         field->setSuggestedInitialValue(1000);
0240         field->setSingleSteps(50, 1000);
0241 
0242         return field;
0243     }
0244     else if (name == QLatin1String("pageorientation"))
0245     {
0246         SearchFieldPageOrientation* const field = new SearchFieldPageOrientation(parent);
0247         field->setFieldName(name);
0248         field->setText(i18n("Orientation"), i18nc("Find items with any orientation / landscape / portrait orientation...",
0249                                                   "Find items with"));
0250         return field;
0251     }
0252     else if (name == QLatin1String("format"))
0253     {
0254         // choice
0255         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0256         field->setFieldName(name);
0257         field->setText(i18n("File Format"), i18n("Return items with the file format"));
0258         QStringList formats;
0259 
0260         Q_FOREACH (const QString& fmt, CoreDbAccess().db()->getFormatStatistics(DatabaseItem::Image).keys())
0261         {
0262             formats << fmt << i18nc("@label: file format", "%1 [Image]", fmt);
0263         }
0264 
0265         Q_FOREACH (const QString& fmt, CoreDbAccess().db()->getFormatStatistics(DatabaseItem::Video).keys())
0266         {
0267             formats << fmt << i18nc("@label: file format", "%1 [Video]", fmt);
0268         }
0269 
0270         Q_FOREACH (const QString& fmt, CoreDbAccess().db()->getFormatStatistics(DatabaseItem::Audio).keys())
0271         {
0272             formats << fmt << i18nc("@label: file format", "%1 [Audio]", fmt);
0273         }
0274 
0275 /*
0276         FIXME: This can report 2 times JPG : one as image, one as other. Where is the problem ?
0277 
0278         Q_FOREACH (const QString& fmt, CoreDbAccess().db()->getFormatStatistics(DatabaseItem::Other).keys())
0279         {
0280             formats << fmt << i18n("%1 [Other]", fmt);
0281         }
0282 */
0283         formats.sort();
0284 
0285         qCDebug(DIGIKAM_GENERAL_LOG) << formats;
0286 
0287         field->setChoice(formats);
0288 
0289         return field;
0290     }
0291     else if (name == QLatin1String("colordepth"))
0292     {
0293         // choice
0294 
0295         SearchFieldColorDepth* const field = new SearchFieldColorDepth(parent);
0296         field->setFieldName(name);
0297         field->setText(i18n("Color Depth"), i18nc("Find items with any color depth / 8 bits per channel...", "Find items with"));
0298 
0299         return field;
0300     }
0301     else if (name == QLatin1String("colormodel"))
0302     {
0303         // choice
0304 
0305         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0306         field->setFieldName(name);
0307         field->setText(i18n("Color Model"), i18n("Find items with the color model"));
0308         QMap<int, QString> map;
0309 
0310         // Images
0311 
0312         map.insert(DImg::COLORMODELUNKNOWN,          i18nc("@label: color model", "%1 [Image]", DImg::colorModelToString(DImg::COLORMODELUNKNOWN)));
0313         map.insert(DImg::RGB,                        i18nc("@label: color model", "%1 [Image]", DImg::colorModelToString(DImg::RGB)));
0314         map.insert(DImg::GRAYSCALE,                  i18nc("@label: color model", "%1 [Image]", DImg::colorModelToString(DImg::GRAYSCALE)));
0315         map.insert(DImg::MONOCHROME,                 i18nc("@label: color model", "%1 [Image]", DImg::colorModelToString(DImg::MONOCHROME)));
0316         map.insert(DImg::INDEXED,                    i18nc("@label: color model", "%1 [Image]", DImg::colorModelToString(DImg::INDEXED)));
0317         map.insert(DImg::YCBCR,                      i18nc("@label: color model", "%1 [Image]", DImg::colorModelToString(DImg::YCBCR)));
0318         map.insert(DImg::CMYK,                       i18nc("@label: color model", "%1 [Image]", DImg::colorModelToString(DImg::CMYK)));
0319         map.insert(DImg::CIELAB,                     i18nc("@label: color model", "%1 [Image]", DImg::colorModelToString(DImg::CIELAB)));
0320         map.insert(DImg::COLORMODELRAW,              i18nc("@label: color model", "%1 [Image]", DImg::colorModelToString(DImg::COLORMODELRAW)));
0321 
0322         // Video
0323 
0324         map.insert(DMetadata::VIDEOCOLORMODEL_SRGB,  i18nc("@label: color model", "%1 [Video]", DMetadata::videoColorModelToString(DMetadata::VIDEOCOLORMODEL_SRGB)));
0325         map.insert(DMetadata::VIDEOCOLORMODEL_BT709, i18nc("@label: color model", "%1 [Video]", DMetadata::videoColorModelToString(DMetadata::VIDEOCOLORMODEL_BT709)));
0326         map.insert(DMetadata::VIDEOCOLORMODEL_BT601, i18nc("@label: color model", "%1 [Video]", DMetadata::videoColorModelToString(DMetadata::VIDEOCOLORMODEL_BT601)));
0327         map.insert(DMetadata::VIDEOCOLORMODEL_OTHER, i18nc("@label: color model", "%1 [Video]", DMetadata::videoColorModelToString(DMetadata::VIDEOCOLORMODEL_OTHER)));
0328         field->setChoice(map);
0329 
0330         return field;
0331     }
0332     else if (name == QLatin1String("make"))
0333     {
0334         // choice
0335 
0336         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0337         field->setFieldName(name);
0338         field->setText(i18n("Camera"), i18n("The make of the camera"));
0339 
0340         QStringList make = CoreDbAccess().db()->getListFromImageMetadata(DatabaseFields::Make);
0341         QString wildcard = QLatin1String("*%1*");
0342         QMap<QString, QString> makeMap;
0343 
0344         for (int i = 0 ; i < make.count() ; ++i)
0345         {
0346             QString shortName = make[i];
0347             ItemPropertiesTab::shortenedMakeInfo(shortName);
0348             makeMap.insert(shortName, wildcard.arg(shortName));
0349         }
0350 
0351         make.clear();
0352         QMap<QString, QString>::const_iterator it;
0353 
0354         for (it = makeMap.constBegin() ; it != makeMap.constEnd() ; ++it)
0355         {
0356             make << it.value() << it.key();
0357         }
0358 
0359         field->setChoice(make);
0360 
0361         return field;
0362     }
0363     else if (name == QLatin1String("model"))
0364     {
0365         // choice
0366 
0367         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0368         field->setFieldName(name);
0369         field->setText(i18n("Camera"), i18n("The model of the camera"));
0370 
0371         QStringList model = CoreDbAccess().db()->getListFromImageMetadata(DatabaseFields::Model);
0372         QString wildcard  = QLatin1String("*%1*");
0373         QMap<QString, QString> modelMap;
0374 
0375         for (int i = 0 ; i < model.count() ; ++i)
0376         {
0377             QString shortName = model[i];
0378             ItemPropertiesTab::shortenedModelInfo(shortName);
0379             modelMap.insert(shortName, wildcard.arg(model[i]));
0380         }
0381 
0382         model.clear();
0383         QMap<QString, QString>::const_iterator it;
0384 
0385         for (it = modelMap.constBegin() ; it != modelMap.constEnd() ; ++it)
0386         {
0387             model << it.value() << it.key();
0388         }
0389 
0390         field->setChoice(model);
0391 
0392         return field;
0393     }
0394     else if (name == QLatin1String("lenses"))
0395     {
0396         // choice
0397 
0398         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0399         field->setFieldName(name);
0400         field->setText(i18n("Lens"), i18n("The type of the lens"));
0401         QStringList lens = CoreDbAccess().db()->getListFromImageMetadata(DatabaseFields::Lens);
0402         lens += lens;
0403         lens.sort();
0404         field->setChoice(lens);
0405 
0406         return field;
0407     }
0408     else if (name == QLatin1String("aperture"))
0409     {
0410         // double
0411 
0412         SearchFieldRangeDouble* const field = new SearchFieldRangeDouble(parent);
0413         field->setFieldName(name);
0414         field->setText(i18n("Aperture"), i18n("Lens aperture as f-number"));
0415         field->setBetweenText(i18nc("Lens aperture as f-number ...-...", "-"));
0416         field->setNoValueText(QLatin1String("f/#"));
0417         field->setNumberPrefixAndSuffix(QLatin1String("f/"), QString());
0418         field->setBoundary(0.3, 65536, 1, 0.1);
0419         field->setSuggestedValues(QList<double>()
0420                                   << 0.5 << 0.7 << 1.0 << 1.4 << 2 << 2.8 << 4 << 5.6
0421                                   << 8 << 11 << 16 << 22 << 32 << 45 << 64 << 90 << 128
0422                                  );
0423         field->setSuggestedInitialValue(1.0);
0424         field->setSingleSteps(0.1, 10);
0425 
0426         return field;
0427     }
0428     else if (name == QLatin1String("focallength"))
0429     {
0430         // double
0431 
0432         SearchFieldRangeInt* const field = new SearchFieldRangeInt(parent);
0433         field->setFieldName(name);
0434         field->setText(i18n("Focal length"), i18n("Focal length of the lens"));
0435         field->setBetweenText(i18nc("Focal length of the lens ...-...", "-"));
0436         field->setNumberPrefixAndSuffix(QString(), QLatin1String("mm"));
0437         field->setBoundary(0, 200000, 10);
0438         field->setSuggestedValues(QList<int>()
0439                                   << 10 << 15 << 20 << 25 << 30 << 40 << 50 << 60 << 70 << 80 << 90
0440                                   << 100 << 150 << 200 << 250 << 300 << 400 << 500 << 750 << 1000
0441                                  );
0442         field->setSuggestedInitialValue(30);
0443         field->setSingleSteps(2, 500);
0444 
0445         return field;
0446     }
0447     else if (name == QLatin1String("focallength35"))
0448     {
0449         // double
0450 
0451         SearchFieldRangeInt* const field = new SearchFieldRangeInt(parent);
0452         field->setFieldName(name);
0453         field->setText(i18n("Focal length"), i18n("35mm equivalent focal length"));
0454         field->setBetweenText(i18nc("35mm equivalent focal length ...-...", "-"));
0455         field->setNumberPrefixAndSuffix(QString(), QLatin1String("mm"));
0456         field->setBoundary(0, 200000, 10);
0457         field->setSuggestedValues(QList<int>()
0458                                   << 8 << 10 << 15 << 16 << 20 << 28 << 30 << 40 << 50 << 60 << 70 << 80
0459                                   << 90 << 100 << 150 << 200 << 250 << 300 << 400 << 500 << 750 << 1000
0460                                  );
0461         field->setSuggestedInitialValue(28);
0462         field->setSingleSteps(2, 500);
0463 
0464         return field;
0465     }
0466     else if (name == QLatin1String("exposuretime"))
0467     {
0468         // double
0469 
0470         SearchFieldRangeInt* const field = new SearchFieldRangeInt(parent);
0471         field->setFieldName(name);
0472         field->setText(i18n("Exposure"), i18n("Exposure time"));
0473         field->setBetweenText(i18nc("Exposure time ...-...", "-"));
0474         field->setNumberPrefixAndSuffix(QString(), QLatin1String("s"));
0475         field->enableFractionMagic(QLatin1String("1/"));    // it's 1/250, not 250 as in the spin box
0476         field->setBoundary(86400, -1024000, 10);            // negative is 1/
0477         field->setSuggestedValues(QList<int>()
0478                                   << 30 << 15 << 8 << 4 << 2 << 1 << -2 << -4 << -8 << -15
0479                                   << -30 << -50 << -60 << -100 << -125 << -150 << -200
0480                                   << -250 << -500 << -750 << -1000 << -2000 << -4000 << -8000 << -16000
0481                                  );
0482         field->setSuggestedInitialValue(-200);
0483         field->setSingleSteps(2000, 5);
0484 
0485         return field;
0486     }
0487     else if (name == QLatin1String("exposureprogram"))
0488     {
0489         // choice
0490 
0491         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0492         field->setFieldName(name);
0493         field->setText(i18n("Exposure"), i18n("Automatic exposure program"));
0494         QMap<int, QString> map = DMetadata::possibleValuesForEnumField(MetadataInfo::ExposureProgram);
0495         field->setChoice(map);
0496 
0497         return field;
0498     }
0499     else if (name == QLatin1String("exposuremode"))
0500     {
0501         // choice
0502 
0503         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0504         field->setFieldName(name);
0505         field->setText(i18n("Exposure"), i18n("Automatic or manual exposure"));
0506         QMap<int, QString> map = DMetadata::possibleValuesForEnumField(MetadataInfo::ExposureMode);
0507         field->setChoice(map);
0508         return field;
0509     }
0510     else if (name == QLatin1String("sensitivity"))
0511     {
0512         // int
0513 
0514         SearchFieldRangeInt* const field = new SearchFieldRangeInt(parent);
0515         field->setFieldName(name);
0516         field->setText(i18n("Sensitivity"), i18n("ISO film speed (linear scale, ASA)"));
0517         field->setBetweenText(i18nc("ISO film speed (linear scale, ASA) ...-...", "-"));
0518         field->setBoundary(0, 2000000, 50);
0519         field->setSuggestedValues(QList<int>()
0520                                   << 6 << 8 << 10 << 12 << 16 << 20 << 25 << 32 << 40 << 50 << 64
0521                                   << 80 << 100 << 125 << 160 << 200 << 250 << 320 << 400 << 500
0522                                   << 640 << 800 << 1000 << 1250 << 1600 << 2000 << 2500 << 3200
0523                                   << 4000 << 5000 << 6400
0524                                  );
0525         field->setSuggestedInitialValue(200);
0526         field->setSingleSteps(1, 400);
0527 
0528         return field;
0529     }
0530     else if (name == QLatin1String("flashmode"))
0531     {
0532         // choice
0533 
0534         /**
0535          * @todo This is a bitmask, and gives some more information
0536          */
0537 
0538         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0539         field->setFieldName(name);
0540         field->setText(i18nc("@label: flash is on or off", "Flash"), i18nc("@label: flash mode used", "Flash mode"));
0541         QMap<int, QString> map = DMetadata::possibleValuesForEnumField(MetadataInfo::FlashMode);
0542         field->setChoice(map);
0543 
0544         return field;
0545     }
0546     else if (name == QLatin1String("whitebalance"))
0547     {
0548         // choice
0549 
0550         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0551         field->setFieldName(name);
0552         field->setText(i18n("White Balance"), i18n("Automatic or manual white balance"));
0553         QMap<int, QString> map = DMetadata::possibleValuesForEnumField(MetadataInfo::WhiteBalance);
0554         field->setChoice(map);
0555 
0556         return field;
0557     }
0558     else if (name == QLatin1String("whitebalancecolortemperature"))
0559     {
0560         // int
0561         SearchFieldRangeInt* const field = new SearchFieldRangeInt(parent);
0562         field->setFieldName(name);
0563         field->setText(i18n("White balance"), i18n("Color temperature used for white balance"));
0564         field->setBetweenText(i18nc("Color temperature used for white balance ...-...", "-"));
0565         field->setNumberPrefixAndSuffix(QString(), QLatin1String("K"));
0566         field->setBoundary(1, 100000, 100);
0567 
0568         return field;
0569     }
0570     else if (name == QLatin1String("meteringmode"))
0571     {
0572         // choice
0573 
0574         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0575         field->setFieldName(name);
0576         field->setText(i18n("Metering Mode"), i18n("Method to determine the exposure"));
0577         QMap<int, QString> map = DMetadata::possibleValuesForEnumField(MetadataInfo::MeteringMode);
0578         field->setChoice(map);
0579 
0580         return field;
0581     }
0582     else if (name == QLatin1String("subjectdistance"))
0583     {
0584         // double
0585 
0586         SearchFieldRangeDouble* const field = new SearchFieldRangeDouble(parent);
0587         field->setFieldName(name);
0588         field->setText(i18n("Subject Distance"), i18n("Distance of the subject from the lens"));
0589         field->setBetweenText(i18nc("Distance of the subject from the lens ...-...", "-"));
0590         field->setNumberPrefixAndSuffix(QString(), QLatin1String("m"));
0591         field->setBoundary(0, 50000, 1, 0.1);
0592 
0593         return field;
0594     }
0595     else if (name == QLatin1String("subjectdistancecategory"))
0596     {
0597         // choice
0598 
0599         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0600         field->setFieldName(name);
0601         field->setText(i18n("Subject Distance"), i18n("Macro, close or distant view"));
0602         QMap<int, QString> map = DMetadata::possibleValuesForEnumField(MetadataInfo::SubjectDistanceCategory);
0603         field->setChoice(map);
0604 
0605         return field;
0606     }
0607 
0608     else if (name == QLatin1String("latitude"))
0609     {
0610     }
0611     else if (name == QLatin1String("longitude"))
0612     {
0613     }
0614     else if (name == QLatin1String("altitude"))
0615     {
0616         SearchFieldRangeDouble* const field = new SearchFieldRangeDouble(parent);
0617         field->setFieldName(name);
0618         field->setText(i18n("GPS"), i18n("Altitude range"));
0619         field->setBetweenText(i18nc("Altitude range ...-...", "-"));
0620         field->setNumberPrefixAndSuffix(QString(), QLatin1String("m"));
0621         field->setBoundary(0, 10000, 4, 1);
0622 
0623         return field;
0624     }
0625     else if (name == QLatin1String("positionorientation"))
0626     {
0627     }
0628     else if (name == QLatin1String("positiontilt"))
0629     {
0630     }
0631     else if (name == QLatin1String("positionroll"))
0632     {
0633     }
0634     else if (name == QLatin1String("positiondescription"))
0635     {
0636     }
0637     else if (name == QLatin1String("nogps"))
0638     {
0639         SearchFieldCheckBox* const field = new SearchFieldCheckBox(parent);
0640         field->setFieldName(name);
0641         field->setText(i18n("GPS"), i18n("Item has no GPS info"));
0642         field->setLabel(i18n("Not Geo-located"));
0643 
0644         return field;
0645     }
0646     else if (name == QLatin1String("country"))
0647     {
0648         // choice
0649 
0650         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0651         field->setFieldName(name);
0652         field->setText(i18n("Country"), i18n("Country shown in the item"));
0653 
0654         QStringList countries = CoreDbAccess().db()->getAllImagePropertiesByName(name);
0655         countries            += countries;
0656         countries.sort();
0657 
0658         field->setChoice(countries);
0659 
0660         return field;
0661     }
0662     else if (name == QLatin1String("provinceState"))
0663     {
0664         // choice
0665 
0666         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0667         field->setFieldName(name);
0668         field->setText(i18n("Province"), i18n("Province shown in the item"));
0669 
0670         QStringList provinces = CoreDbAccess().db()->getAllImagePropertiesByName(name);
0671         provinces            += provinces;
0672         provinces.sort();
0673 
0674         field->setChoice(provinces);
0675 
0676         return field;
0677     }
0678     else if (name == QLatin1String("city"))
0679     {
0680         // choice
0681 
0682         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0683         field->setFieldName(name);
0684         field->setText(i18n("City"), i18n("City shown in the item"));
0685 
0686         QStringList cities = CoreDbAccess().db()->getAllImagePropertiesByName(name);
0687         cities            += cities;
0688         cities.sort();
0689 
0690         field->setChoice(cities);
0691 
0692         return field;
0693     }
0694     else if (name == QLatin1String("location"))
0695     {
0696         // choice
0697 
0698         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0699         field->setFieldName(name);
0700         field->setText(i18n("Sublocation"), i18n("Sublocation shown in the item"));
0701 
0702         QStringList locations = CoreDbAccess().db()->getAllImagePropertiesByName(name);
0703         locations            += locations;
0704         locations.sort();
0705 
0706         field->setChoice(locations);
0707 
0708         return field;
0709     }
0710     else if (name == QLatin1String("creator"))
0711     {
0712         SearchFieldText* const field = new SearchFieldText(parent);
0713         field->setFieldName(name);
0714         field->setText(i18nc("@label: item creator", "Creator"), i18n("Return items created by"));
0715 
0716         return field;
0717     }
0718     else if (name == QLatin1String("comment"))
0719     {
0720         SearchFieldText* const field = new SearchFieldText(parent);
0721         field->setFieldName(name);
0722         field->setText(i18nc("@label: item comment", "Caption"), i18n("Return items whose comment contains"));
0723 
0724         return field;
0725     }
0726     else if (name == QLatin1String("commentauthor"))
0727     {
0728         SearchFieldText* const field = new SearchFieldText(parent);
0729         field->setFieldName(name);
0730         field->setText(i18n("Author"), i18n("Return items commented by"));
0731 
0732         return field;
0733     }
0734     else if (name == QLatin1String("headline"))
0735     {
0736         SearchFieldText* const field = new SearchFieldText(parent);
0737         field->setFieldName(name);
0738         field->setText(i18n("Headline"), i18n("Return items with the IPTC headline"));
0739 
0740         return field;
0741     }
0742     else if (name == QLatin1String("title"))
0743     {
0744         SearchFieldText* const field = new SearchFieldText(parent);
0745         field->setFieldName(name);
0746         field->setText(i18nc("@label: item title", "Title"), i18n("Return items with the IPTC title"));
0747 
0748         return field;
0749     }
0750     else if (name == QLatin1String("keyword"))
0751     {
0752         SearchFieldText* const field = new SearchFieldKeyword(parent);
0753         field->setFieldName(name);
0754         field->setText(QString(), i18n("Find items that have associated all these words:"));
0755 
0756         return field;
0757     }
0758     else if (name == QLatin1String("emptytext"))
0759     {
0760         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0761         field->setFieldName(name);
0762         field->setText(i18n("Empty Text"), i18n("Return items without text in:"));
0763         QStringList comments;
0764         comments << QLatin1String("creator")  << i18nc("@label: search items without creator property",  "Creator");
0765         comments << QLatin1String("comment")  << i18nc("@label: search items without caption property",  "Caption");
0766         comments << QLatin1String("author")   << i18nc("@label: search items without author property",   "Author");
0767         comments << QLatin1String("headline") << i18nc("@label: search items without headline property", "Headline");
0768         comments << QLatin1String("title")    << i18nc("@label: search items without title property",    "Title");
0769 
0770         field->setChoice(comments);
0771 
0772         return field;
0773     }
0774     else if (name == QLatin1String("aspectratioimg"))
0775     {
0776         SearchFieldText* const field = new SearchFieldText(parent);
0777         field->setFieldName(name);
0778         field->setText(i18n("Aspect Ratio"), i18n("Return items with the aspect ratio"));
0779 
0780         return field;
0781     }
0782     else if (name == QLatin1String("pixelsize"))
0783     {
0784         SearchFieldRangeInt* const field = new SearchFieldRangeInt(parent);
0785         field->setFieldName(name);
0786         field->setText(i18n("Pixel Size"), i18n("Value of (Width * Height) between"));
0787         field->setBetweenText(i18nc("Value of (Width * Height) between...and...", "and"));
0788         field->setNumberPrefixAndSuffix(QString(), QLatin1String("px"));
0789         field->setBoundary(1, 2000000000, 100);
0790 
0791         return field;
0792     }
0793     else if (name == QLatin1String("videoaspectratio"))
0794     {
0795         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0796         field->setFieldName(name);
0797         field->setText(i18n("Aspect Ratio"), i18n("Return video with the frame aspect ratio"));
0798         QStringList ratio;
0799         ratio << QLatin1String("4:3")  << QLatin1String("4:3");
0800         ratio << QLatin1String("3:2")  << QLatin1String("3:2");
0801         ratio << QLatin1String("16:9") << QLatin1String("16:9");
0802         ratio << QLatin1String("2:1")  << QLatin1String("2:1");
0803 
0804         // TODO: add more possible aspect ratio
0805 
0806         field->setChoice(ratio);
0807 
0808         return field;
0809     }
0810     else if (name == QLatin1String("videoduration"))
0811     {
0812         SearchFieldRangeInt* const field = new SearchFieldRangeInt(parent);
0813         field->setFieldName(name);
0814         field->setText(i18n("Duration"), i18n("Length of the video"));
0815         field->setBetweenText(i18nc("Find video with a length between...and...", "and"));
0816         field->setNumberPrefixAndSuffix(QString(), i18nc("Seconds", "s"));
0817         field->setBoundary(1, 10000, 100);
0818         field->setSuggestedValues(QList<int>()
0819                                   << 10 << 30 << 60 << 90 << 120 << 240 << 360 << 500 << 1000 << 2000
0820                                   << 3000 << 4000 << 5000 << 6000 << 7000 << 8000 << 9000 << 10000
0821                                   // TODO : adjust default values
0822                                  );
0823         field->setSuggestedInitialValue(10);
0824         field->setSingleSteps(10, 100);
0825 
0826         return field;
0827     }
0828     else if (name == QLatin1String("videoframerate"))
0829     {
0830         SearchFieldRangeInt* const field = new SearchFieldRangeInt(parent);
0831         field->setFieldName(name);
0832         field->setText(i18n("Frame Rate"), i18n("Return video with the frame rate"));
0833         field->setBetweenText(i18nc("Find video with frame rate between...and...", "and"));
0834         field->setNumberPrefixAndSuffix(QString(), i18nc("Frames per Second", "fps"));
0835         field->setBoundary(10, 600, 5);
0836         field->setSuggestedValues(QList<int>()
0837                                   << 10 << 15 << 20 << 25 << 30 << 35 << 40 << 45 << 55 << 60 << 120
0838                                   << 180 << 240 << 300 << 360 << 420 << 480 << 540 << 600
0839                                   // TODO : adjust default values
0840                                  );
0841         field->setSuggestedInitialValue(10);
0842         field->setSingleSteps(5, 60);
0843 
0844         return field;
0845     }
0846     else if (name == QLatin1String("videocodec"))
0847     {
0848         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0849         field->setFieldName(name);
0850         field->setText(i18n("Codec"), i18n("Return video codec"));
0851         QStringList codec;
0852 
0853         // List of most common video codecs supported by FFMpeg (see "ffpmpeg -codecs" for details)
0854         //
0855         //       FFMpeg codec name                 FFMpeg codec description
0856         codec << QLatin1String("8bps")          << QLatin1String("QuickTime 8BPS video");
0857         codec << QLatin1String("amv")           << QLatin1String("AMV Video");
0858         codec << QLatin1String("avs")           << QLatin1String("AVS (Audio Video Standard) video");
0859         codec << QLatin1String("cavs")          << QLatin1String("Chinese AVS (Audio Video Standard) (AVS1-P2, JiZhun profile)");
0860         codec << QLatin1String("cinepak")       << QLatin1String("Cinepak");
0861         codec << QLatin1String("dirac")         << QLatin1String("Dirac");
0862         codec << QLatin1String("flv1")          << QLatin1String("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)");
0863         codec << QLatin1String("h261")          << QLatin1String("H.261");
0864         codec << QLatin1String("h263")          << QLatin1String("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2");
0865         codec << QLatin1String("h263i")         << QLatin1String("Intel H.263");
0866         codec << QLatin1String("h263p")         << QLatin1String("H.263+ / H.263-1998 / H.263 version 2");
0867         codec << QLatin1String("h264")          << QLatin1String("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10");
0868         codec << QLatin1String("hevc")          << QLatin1String("H.265 / HEVC (High Efficiency Video Coding)");
0869         codec << QLatin1String("jpeg2000")      << QLatin1String("JPEG 2000");
0870         codec << QLatin1String("mjpeg")         << QLatin1String("Motion JPEG");
0871         codec << QLatin1String("mjpegb")        << QLatin1String("Apple MJPEG-B");
0872         codec << QLatin1String("mpeg1video")    << QLatin1String("MPEG-1 video");
0873         codec << QLatin1String("mpeg2video")    << QLatin1String("MPEG-2 video");
0874         codec << QLatin1String("mpeg4")         << QLatin1String("MPEG-4 part 2");
0875         codec << QLatin1String("msmpeg4v1")     << QLatin1String("MPEG-4 part 2 Microsoft variant version 1");
0876         codec << QLatin1String("msmpeg4v2")     << QLatin1String("MPEG-4 part 2 Microsoft variant version 2");
0877         codec << QLatin1String("msmpeg4v3")     << QLatin1String("MPEG-4 part 2 Microsoft variant version 3");
0878         codec << QLatin1String("msvideo1")      << QLatin1String("Microsoft Video 1");
0879         codec << QLatin1String("msrle")         << QLatin1String("Microsoft RLE");
0880         codec << QLatin1String("mvc1")          << QLatin1String("Silicon Graphics Motion Video Compressor 1");
0881         codec << QLatin1String("mvc2")          << QLatin1String("Silicon Graphics Motion Video Compressor 2");
0882         codec << QLatin1String("qtrle")         << QLatin1String("QuickTime Animation (RLE) video");
0883         codec << QLatin1String("rawvideo")      << QLatin1String("Raw video");
0884         codec << QLatin1String("rpza")          << QLatin1String("QuickTime video (RPZA)");
0885         codec << QLatin1String("rv10")          << QLatin1String("RealVideo 1.0");
0886         codec << QLatin1String("rv20")          << QLatin1String("RealVideo 2.0");
0887         codec << QLatin1String("rv30")          << QLatin1String("RealVideo 3.0");
0888         codec << QLatin1String("rv40")          << QLatin1String("RealVideo 4.0");
0889         codec << QLatin1String("smc")           << QLatin1String("QuickTime Graphics (SMC)");
0890         codec << QLatin1String("snow")          << QLatin1String("Snow");
0891         codec << QLatin1String("svq1")          << QLatin1String("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1");
0892         codec << QLatin1String("svq3")          << QLatin1String("Sorenson Vector Quantizer 3 / Sorenson Video 3 / SVQ3");
0893         codec << QLatin1String("theora")        << QLatin1String("Theora");
0894         codec << QLatin1String("vc1")           << QLatin1String("SMPTE VC-1");
0895         codec << QLatin1String("vc1image")      << QLatin1String("Windows Media Video 9 Image v2");
0896         codec << QLatin1String("vp3")           << QLatin1String("On2 VP3");
0897         codec << QLatin1String("vp5")           << QLatin1String("On2 VP5");
0898         codec << QLatin1String("vp6")           << QLatin1String("On2 VP6");
0899         codec << QLatin1String("vp6a")          << QLatin1String("On2 VP6 (Flash version, with alpha channel)");
0900         codec << QLatin1String("vp6f")          << QLatin1String("On2 VP6 (Flash version)");
0901         codec << QLatin1String("vp7")           << QLatin1String("On2 VP7");
0902         codec << QLatin1String("vp8")           << QLatin1String("On2 VP8");
0903         codec << QLatin1String("vp9")           << QLatin1String("Google VP9");
0904         codec << QLatin1String("wmv1")          << QLatin1String("Windows Media Video 7");
0905         codec << QLatin1String("wmv2")          << QLatin1String("Windows Media Video 8");
0906         codec << QLatin1String("wmv3")          << QLatin1String("Windows Media Video 9");
0907         codec << QLatin1String("wmv3image")     << QLatin1String("Windows Media Video 9 Image");
0908 
0909         // TODO: add more possible codec
0910         field->setChoice(codec);
0911 
0912         return field;
0913     }
0914     else if (name == QLatin1String("videoaudiobitrate"))
0915     {
0916         SearchFieldRangeInt* const field = new SearchFieldRangeInt(parent);
0917         field->setFieldName(name);
0918         field->setText(i18n("Audio Bit Rate"), i18n("Return Audio Bits Rate"));
0919         field->setBetweenText(i18nc("Find files with audio bit rate between...and...", "and"));
0920         field->setNumberPrefixAndSuffix(QString(), i18nc("Bits per Second", "bps"));
0921         field->setBoundary(1000, 100000, 1000);
0922         field->setSuggestedValues(QList<int>()
0923                                   << 1000 << 4000 << 8000 << 12000 << 16000 << 20000 << 30000 << 40000 << 50000
0924                                   << 60000 << 700000 << 800000 << 900000 << 100000
0925                                   // TODO : adjust default values
0926                                  );
0927         field->setSuggestedInitialValue(1000);
0928         field->setSingleSteps(1000, 1000);
0929 
0930         return field;
0931     }
0932     else if (name == QLatin1String("videoaudiochanneltype"))
0933     {
0934         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0935         field->setFieldName(name);
0936         field->setText(i18n("Audio Channel Type"), i18n("Return Audio Channel Type"));
0937         QStringList type;
0938         type << QLatin1String("Mono")       << i18nc("@label: audio channel type", "Mono");
0939         type << QLatin1String("Stereo")     << i18nc("@label: audio channel type", "Stereo");
0940         type << QLatin1String("5.1")        << i18nc("@label: audio channel type", "5.1 Surround Sound");
0941         type << QLatin1String("7.1")        << i18nc("@label: audio channel type", "7.1 Surround Sound");
0942         type << QLatin1String("16 Channel") << i18nc("@label: audio channel type", "16 Channels Sequence");
0943         type << QLatin1String("Other")      << i18nc("@label: audio channel type", "Other Channel Type");
0944 
0945         // TODO: add more possible audio channel type
0946 
0947         field->setChoice(type);
0948 
0949         return field;
0950     }
0951     else if (name == QLatin1String("videoaudioCodec"))
0952     {
0953         SearchFieldChoice* const field = new SearchFieldChoice(parent);
0954         field->setFieldName(name);
0955         field->setText(i18n("Audio Codec"), i18n("Return Audio Codec"));
0956         QStringList type;
0957 
0958         // List of most common audio codecs supported by FFMpeg (see "ffpmpeg -codecs" for details)
0959         //
0960         //      FFMpeg codec name                      FFMpeg codec description
0961         type << QLatin1String("aac")                << QLatin1String("AAC (Advanced Audio Coding)");
0962         type << QLatin1String("aac_latm")           << QLatin1String("AAC LATM (Advanced Audio Coding LATM syntax)");
0963         type << QLatin1String("ac3")                << QLatin1String("ATSC A/52A (AC-3)");
0964         type << QLatin1String("adpcm_g722")         << QLatin1String("G.722 ADPCM");
0965         type << QLatin1String("adpcm_g726")         << QLatin1String("G.726 ADPCM");
0966         type << QLatin1String("adpcm_g726le")       << QLatin1String("G.726 ADPCM little-endian");
0967         type << QLatin1String("adpcm_ima_wav")      << QLatin1String("ADPCM IMA WAV");
0968         type << QLatin1String("adpcm_ima_qt")       << QLatin1String("ADPCM IMA QuickTime");
0969         type << QLatin1String("adpcm_swf")          << QLatin1String("ADPCM Shockwave Flash");
0970         type << QLatin1String("alac")               << QLatin1String("ALAC (Apple Lossless Audio Codec)");
0971         type << QLatin1String("amr_nb")             << QLatin1String("AMR-NB (Adaptive Multi-Rate NarrowBand)");
0972         type << QLatin1String("amr_wb")             << QLatin1String("AMR-WB (Adaptive Multi-Rate WideBand)");
0973         type << QLatin1String("ape")                << QLatin1String("Monkey's Audio");
0974         type << QLatin1String("atrac1")             << QLatin1String("ATRAC1 (Adaptive TRansform Acoustic Coding)");
0975         type << QLatin1String("atrac3")             << QLatin1String("ATRAC3 (Adaptive TRansform Acoustic Coding 3)");
0976         type << QLatin1String("atrac3al")           << QLatin1String("ATRAC3 AL (Adaptive TRansform Acoustic Coding 3 Advanced Lossless)");
0977         type << QLatin1String("atrac3p")            << QLatin1String("ATRAC3+ (Adaptive TRansform Acoustic Coding 3+)");
0978         type << QLatin1String("atrac3pal")          << QLatin1String("ATRAC3+ AL (Adaptive TRansform Acoustic Coding 3+ Advanced Lossless)");
0979         type << QLatin1String("celt")               << QLatin1String("Constrained Energy Lapped Transform (CELT)");
0980         type << QLatin1String("cook")               << QLatin1String("Cook / Cooker / Gecko (RealAudio G2)");
0981         type << QLatin1String("dts")                << QLatin1String("DCA (DTS Coherent Acoustics)");
0982         type << QLatin1String("eac3")               << QLatin1String("ATSC A/52B (AC-3, E-AC-3)");
0983         type << QLatin1String("flac")               << QLatin1String("FLAC (Free Lossless Audio Codec)");
0984         type << QLatin1String("g723_1")             << QLatin1String("G.723.1");
0985         type << QLatin1String("g729")               << QLatin1String("G.729");
0986         type << QLatin1String("mp1")                << QLatin1String("MP1 (MPEG audio layer 1)");
0987         type << QLatin1String("mp2")                << QLatin1String("MP2 (MPEG audio layer 2)");
0988         type << QLatin1String("mp3")                << QLatin1String("MP3 (MPEG audio layer 3)");
0989         type << QLatin1String("mp3adu")             << QLatin1String("ADU (Application Data Unit) MP3 (MPEG audio layer 3)");
0990         type << QLatin1String("mp3on4")             << QLatin1String("MP3 on MP4");
0991         type << QLatin1String("mp4als")             << QLatin1String("MPEG-4 Audio Lossless Coding (ALS)");
0992         type << QLatin1String("musepack7")          << QLatin1String("Musepack SV7");
0993         type << QLatin1String("musepack8")          << QLatin1String("Musepack SV8");
0994         type << QLatin1String("nellymoser")         << QLatin1String("Nellymoser Asao");
0995         type << QLatin1String("opus")               << QLatin1String("Opus (Opus Interactive Audio Codec)");
0996         type << QLatin1String("pcm_alaw")           << QLatin1String("PCM A-law / G.711 A-law");
0997         type << QLatin1String("pcm_bluray")         << QLatin1String("PCM signed 16|20|24-bit big-endian for Blu-ray media");
0998         type << QLatin1String("pcm_dvd")            << QLatin1String("PCM signed 20|24-bit big-endian");
0999         type << QLatin1String("pcm_f16le")          << QLatin1String("PCM 16.8 floating point little-endian");
1000         type << QLatin1String("pcm_f24le")          << QLatin1String("PCM 24.0 floating point little-endian");
1001         type << QLatin1String("pcm_f32be")          << QLatin1String("PCM 32-bit floating point big-endian");
1002         type << QLatin1String("pcm_f32le")          << QLatin1String("PCM 32-bit floating point little-endian");
1003         type << QLatin1String("pcm_f64be")          << QLatin1String("PCM 64-bit floating point big-endian");
1004         type << QLatin1String("pcm_f64le")          << QLatin1String("PCM 64-bit floating point little-endian");
1005         type << QLatin1String("pcm_lxf")            << QLatin1String("PCM signed 20-bit little-endian planar");
1006         type << QLatin1String("pcm_mulaw")          << QLatin1String("PCM mu-law / G.711 mu-law");
1007         type << QLatin1String("pcm_s16be")          << QLatin1String("PCM signed 16-bit big-endian");
1008         type << QLatin1String("pcm_s16be_planar")   << QLatin1String("PCM signed 16-bit big-endian planar");
1009         type << QLatin1String("pcm_s16le")          << QLatin1String("PCM signed 16-bit little-endian");
1010         type << QLatin1String("pcm_s16le_planar")   << QLatin1String("PCM signed 16-bit little-endian planar");
1011         type << QLatin1String("pcm_s24be")          << QLatin1String("PCM signed 24-bit big-endian");
1012         type << QLatin1String("pcm_s24daud")        << QLatin1String("PCM D-Cinema audio signed 24-bit");
1013         type << QLatin1String("pcm_s24le")          << QLatin1String("PCM signed 24-bit little-endian");
1014         type << QLatin1String("pcm_s24le_planar")   << QLatin1String("PCM signed 24-bit little-endian planar");
1015         type << QLatin1String("pcm_s32be")          << QLatin1String("PCM signed 32-bit big-endian");
1016         type << QLatin1String("pcm_s32le")          << QLatin1String("PCM signed 32-bit little-endian");
1017         type << QLatin1String("pcm_s32le_planar")   << QLatin1String("PCM signed 32-bit little-endian planar");
1018         type << QLatin1String("pcm_s64be")          << QLatin1String("PCM signed 64-bit big-endian");
1019         type << QLatin1String("pcm_s64le")          << QLatin1String("PCM signed 64-bit little-endian");
1020         type << QLatin1String("pcm_s8")             << QLatin1String("PCM signed 8-bit");
1021         type << QLatin1String("pcm_s8_planar")      << QLatin1String("PCM signed 8-bit planar");
1022         type << QLatin1String("pcm_u16be")          << QLatin1String("PCM unsigned 16-bit big-endian");
1023         type << QLatin1String("pcm_u16le")          << QLatin1String("PCM unsigned 16-bit little-endian");
1024         type << QLatin1String("pcm_u24be")          << QLatin1String("PCM unsigned 24-bit big-endian");
1025         type << QLatin1String("pcm_u24le")          << QLatin1String("PCM unsigned 24-bit little-endian");
1026         type << QLatin1String("pcm_u32be")          << QLatin1String("PCM unsigned 32-bit big-endian");
1027         type << QLatin1String("pcm_u32le")          << QLatin1String("PCM unsigned 32-bit little-endian");
1028         type << QLatin1String("pcm_u8")             << QLatin1String("PCM unsigned 8-bit");
1029         type << QLatin1String("pcm_zork")           << QLatin1String("PCM Zork");
1030         type << QLatin1String("ra_144")             << QLatin1String("RealAudio 1.0 (14.4K)");
1031         type << QLatin1String("ra_288")             << QLatin1String("RealAudio 2.0 (28.8K)");
1032         type << QLatin1String("ralf")               << QLatin1String("RealAudio Lossless");
1033         type << QLatin1String("sipr")               << QLatin1String("RealAudio SIPR / ACELP.NET");
1034         type << QLatin1String("speex")              << QLatin1String("Speex");
1035         type << QLatin1String("tak")                << QLatin1String("TAK (Tom's lossless Audio Kompressor)");
1036         type << QLatin1String("wavpack")            << QLatin1String("WavPack");
1037         type << QLatin1String("wmalossless")        << QLatin1String("Windows Media Audio Lossless");
1038         type << QLatin1String("wmapro")             << QLatin1String("Windows Media Audio 9 Professional");
1039         type << QLatin1String("wmav1")              << QLatin1String("Windows Media Audio 1");
1040         type << QLatin1String("wmav2")              << QLatin1String("Windows Media Audio 2");
1041         type << QLatin1String("wmavoice")           << QLatin1String("Windows Media Audio Voice");
1042 
1043         // TODO: add more possible audio Codec
1044 
1045         field->setChoice(type);
1046 
1047         return field;
1048     }
1049     else if (name == QLatin1String("faceregionscount"))
1050     {
1051         SearchFieldRangeInt* const field = new SearchFieldRangeInt(parent);
1052         field->setFieldName(name);
1053         field->setText(i18n("Faces"), i18n("Return items by number of face regions"));
1054         field->setBetweenText(i18nc("Return items by number of face regions between...and...", "and"));
1055         field->setBoundary(0, 1000, 1);
1056 
1057         return field;
1058     }
1059     else if (name == QLatin1String("nofaceregions"))
1060     {
1061         SearchFieldCheckBox* const field = new SearchFieldCheckBox(parent);
1062         field->setFieldName(name);
1063         field->setText(i18n("Faces"), i18n("Return items without face regions"));
1064         field->setLabel(i18n("No Face Regions"));
1065 
1066         return field;
1067     }
1068     else
1069     {
1070         qCWarning(DIGIKAM_GENERAL_LOG) << "SearchField::createField: cannot create SearchField for" << name;
1071     }
1072 
1073     return nullptr;
1074 }
1075 
1076 } // namespace Digikam