|
1 /****************************************************************************** |
|
2 * |
|
3 * |
|
4 * |
|
5 * Copyright (C) 1997-2007 by Dimitri van Heesch. |
|
6 * |
|
7 * Permission to use, copy, modify, and distribute this software and its |
|
8 * documentation under the terms of the GNU General Public License is hereby |
|
9 * granted. No representations are made about the suitability of this software |
|
10 * for any purpose. It is provided "as is" without express or implied warranty. |
|
11 * See the GNU General Public License for more details. |
|
12 * |
|
13 */ |
|
14 |
|
15 #ifndef _INPUTSTRLIST_H |
|
16 #define _INPUTSTRLIST_H |
|
17 |
|
18 #include "input.h" |
|
19 |
|
20 #include <QObject> |
|
21 #include <QStringList> |
|
22 |
|
23 class QLabel; |
|
24 class QLineEdit; |
|
25 class QPushButton; |
|
26 class QListWidget; |
|
27 class QStringList; |
|
28 class QGridLayout; |
|
29 class QAction; |
|
30 |
|
31 class InputStrList : public QObject, public Input |
|
32 { |
|
33 Q_OBJECT |
|
34 |
|
35 public: |
|
36 enum ListMode { ListString = 0, |
|
37 ListFile = 1, |
|
38 ListDir = 2, |
|
39 ListFileDir = ListFile | ListDir |
|
40 }; |
|
41 |
|
42 InputStrList( QGridLayout *layout,int &row, |
|
43 const QString &id, const QStringList &sl, |
|
44 ListMode v, const QString &docs); |
|
45 void setValue(const QStringList &sl); |
|
46 |
|
47 QVariant &value(); |
|
48 void update(); |
|
49 Kind kind() const { return StrList; } |
|
50 QString docs() const { return m_docs; } |
|
51 QString id() const { return m_id; } |
|
52 void addDependency(Input *) { Q_ASSERT(false); } |
|
53 void setEnabled(bool); |
|
54 void updateDependencies() {} |
|
55 void writeValue(QTextStream &t,QTextCodec *codec); |
|
56 |
|
57 public slots: |
|
58 void reset(); |
|
59 |
|
60 signals: |
|
61 void changed(); |
|
62 void showHelp(Input *); |
|
63 |
|
64 private slots: |
|
65 void addString(); |
|
66 void delString(); |
|
67 void updateString(); |
|
68 void selectText(const QString &s); |
|
69 void browseFiles(); |
|
70 void browseDir(); |
|
71 void help(); |
|
72 |
|
73 private: |
|
74 void updateDefault(); |
|
75 QLabel *m_lab; |
|
76 QLineEdit *m_le; |
|
77 QAction *m_add; |
|
78 QAction *m_del; |
|
79 QAction *m_upd; |
|
80 QAction *m_brFile; |
|
81 QAction *m_brDir; |
|
82 QListWidget *m_lb; |
|
83 QStringList m_default; |
|
84 QStringList m_strList; |
|
85 QVariant m_value; |
|
86 QString m_docs; |
|
87 QString m_id; |
|
88 |
|
89 }; |
|
90 |
|
91 #endif |