|
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 _INPUTSTRING_H |
|
16 #define _INPUTSTRING_H |
|
17 |
|
18 #include "input.h" |
|
19 |
|
20 #include <QObject> |
|
21 #include <QMap> |
|
22 #include <QStringList> |
|
23 |
|
24 class QLabel; |
|
25 class QLineEdit; |
|
26 class QToolBar; |
|
27 class QComboBox; |
|
28 class QGridLayout; |
|
29 |
|
30 class InputString : public QObject, public Input |
|
31 { |
|
32 Q_OBJECT |
|
33 |
|
34 public: |
|
35 enum StringMode { StringFree=0, |
|
36 StringFile=1, |
|
37 StringDir=2, |
|
38 StringFixed=3 |
|
39 }; |
|
40 |
|
41 InputString( QGridLayout *layout,int &row, |
|
42 const QString &id, const QString &s, |
|
43 StringMode m, |
|
44 const QString &docs, |
|
45 const QString &absPath = QString() ); |
|
46 ~InputString(); |
|
47 void addValue(QString s); |
|
48 void setDefault(); |
|
49 |
|
50 // Input |
|
51 QVariant &value(); |
|
52 void update(); |
|
53 Kind kind() const { return String; } |
|
54 QString docs() const { return m_docs; } |
|
55 QString id() const { return m_id; } |
|
56 void addDependency(Input *) { Q_ASSERT(false); } |
|
57 void setEnabled(bool); |
|
58 void updateDependencies() {} |
|
59 void writeValue(QTextStream &t,QTextCodec *codec); |
|
60 |
|
61 public slots: |
|
62 void reset(); |
|
63 void setValue(const QString&); |
|
64 |
|
65 signals: |
|
66 void changed(); |
|
67 void showHelp(Input *); |
|
68 |
|
69 private slots: |
|
70 void browse(); |
|
71 void clear(); |
|
72 void help(); |
|
73 |
|
74 private: |
|
75 QLabel *m_lab; |
|
76 QLineEdit *m_le; |
|
77 QToolBar *m_br; |
|
78 QComboBox *m_com; |
|
79 QString m_str; |
|
80 QString m_default; |
|
81 StringMode m_sm; |
|
82 QStringList m_values; |
|
83 int m_index; |
|
84 QVariant m_value; |
|
85 QString m_docs; |
|
86 QString m_id; |
|
87 bool m_absPath; |
|
88 }; |
|
89 |
|
90 #endif |