File indexing completed on 2024-04-28 04:21:03

0001 /* SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org>
0002 
0003    SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 #ifndef SEARCHDIALOGSETTINGS_H
0006 #define SEARCHDIALOGSETTINGS_H
0007 
0008 #include <QList>
0009 #include <qcheckbox.h>
0010 
0011 namespace Exif
0012 {
0013 
0014 template <class T>
0015 class Setting
0016 {
0017 public:
0018     Setting() { }
0019     Setting(QCheckBox *cb, T value)
0020         : cb(cb)
0021         , value(value)
0022     {
0023     }
0024     QCheckBox *cb;
0025     T value;
0026 };
0027 
0028 template <class T>
0029 class Settings : public QList<Setting<T>>
0030 {
0031 public:
0032     QList<T> selected()
0033     {
0034         QList<T> result;
0035         for (typename QList<Setting<T>>::Iterator it = this->begin(); it != this->end(); ++it) {
0036             if ((*it).cb->isChecked())
0037                 result.append((*it).value);
0038         }
0039         return result;
0040     }
0041 };
0042 
0043 }
0044 
0045 #endif /* SEARCHDIALOGSETTINGS_H */
0046 
0047 // vi:expandtab:tabstop=4 shiftwidth=4: