summaryrefslogtreecommitdiffstats
path: root/itemselectionwidget.h
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-01-04 09:25:20 +0100
committerArno <arno@disconnect.de>2018-01-04 09:25:20 +0100
commit73b49673c2a5b36ee562ebf95a890b19927607ec (patch)
treed1164e0d5b84185b33438fd73b4881ba0fae3de7 /itemselectionwidget.h
parentf459b30a4ab8ac4bc5d6646795d2e391f70851d3 (diff)
downloadShemovCleaner-73b49673c2a5b36ee562ebf95a890b19927607ec.tar.gz
ShemovCleaner-73b49673c2a5b36ee562ebf95a890b19927607ec.tar.bz2
ShemovCleaner-73b49673c2a5b36ee562ebf95a890b19927607ec.zip
More renaming for new ItemSelectionWidget
Use item instead of directory in var and function names to make clear that this a general purpose widget. Introduce a mode, so we can hide the browse button if we're not selecting directories. Make the label configurable and use different icons for folders or other items.
Diffstat (limited to 'itemselectionwidget.h')
-rw-r--r--itemselectionwidget.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/itemselectionwidget.h b/itemselectionwidget.h
index 0b8b48b..f78b9d1 100644
--- a/itemselectionwidget.h
+++ b/itemselectionwidget.h
@@ -2,6 +2,7 @@
#define DIRSELECTIONWIDGET_H
#include <QWidget>
+#include <QIcon>
class QStandardItemModel;
class QListView;
@@ -11,19 +12,21 @@ class ItemSelectionWidget : public QWidget
{
Q_OBJECT
public:
- explicit ItemSelectionWidget(QWidget *parent = nullptr);
- const QStringList directories() const;
- void setDirectories(const QStringList &dirs);
+ enum Mode { Item, Directories };
+ explicit ItemSelectionWidget(int mode, QString labelText, QWidget *parent = nullptr);
+ const QStringList items() const;
+ void setItems(const QStringList &items);
public slots:
void browseDir();
- void addDir();
- void removeDir();
+ void addItem();
+ void removeItem();
private:
QStandardItemModel *mModel;
QListView *mView;
- QLineEdit *mDir;
+ QLineEdit *mItem;
+ QIcon mIcon;
};
#endif // DIRSELECTIONWIDGET_H