| 1 |
/****************************************************************************** |
| 2 |
* |
| 3 |
* Copyright (C) 1997-2019 by Dimitri van Heesch. |
| 4 |
* |
| 5 |
* Permission to use, copy, modify, and distribute this software and its |
| 6 |
* documentation under the terms of the GNU General Public License is hereby |
| 7 |
* granted. No representations are made about the suitability of this software |
| 8 |
* for any purpose. It is provided "as is" without express or implied warranty. |
| 9 |
* See the GNU General Public License for more details. |
| 10 |
* |
| 11 |
*/ |
| 12 |
|
| 13 |
#ifndef INPUTINT_H |
| 14 |
#define INPUTINT_H |
| 15 |
|
| 16 |
#include "input.h" |
| 17 |
#include <QObject> |
| 18 |
|
| 19 |
class QGridLayout; |
| 20 |
class QLabel; |
| 21 |
class QSpinBox; |
| 22 |
|
| 23 |
class InputInt : public QObject, public Input |
| 24 |
{ |
| 25 |
Q_OBJECT |
| 26 |
|
| 27 |
public: |
| 28 |
InputInt( QGridLayout *layout,int &row, |
| 29 |
const QString &id, int defVal, |
| 30 |
int minVal, int maxVal, |
| 31 |
const QString &docs ); |
| 32 |
~InputInt() = default; |
| 33 |
|
| 34 |
// Input |
| 35 |
QVariant &value(); |
| 36 |
void update(); |
| 37 |
Kind kind() const { return Int; } |
| 38 |
QString docs() const { return m_docs; } |
| 39 |
QString id() const { return m_id; } |
| 40 |
QString templateDocs() const { return m_tdocs; } |
| 41 |
void addDependency(Input *) { Q_ASSERT(false); } |
| 42 |
void setEnabled(bool); |
| 43 |
void updateDependencies() {} |
| 44 |
bool isDefault(); |
| 45 |
void writeValue(QTextStream &t,TextCodecAdapter *codec,bool convert); |
| 46 |
void setTemplateDocs(const QString &docs) { m_tdocs = docs; } |
| 47 |
|
| 48 |
public slots: |
| 49 |
void reset(); |
| 50 |
void setValue(int val); |
| 51 |
|
| 52 |
private slots: |
| 53 |
void help(); |
| 54 |
|
| 55 |
signals: |
| 56 |
void changed(); |
| 57 |
void showHelp(Input *); |
| 58 |
|
| 59 |
private: |
| 60 |
void updateDefault(); |
| 61 |
QLabel *m_lab; |
| 62 |
QSpinBox *m_sp; |
| 63 |
int m_val; |
| 64 |
int m_default; |
| 65 |
int m_minVal; |
| 66 |
int m_maxVal; |
| 67 |
QVariant m_value; |
| 68 |
QString m_docs; |
| 69 |
QString m_id; |
| 70 |
QString m_tdocs; |
| 71 |
}; |
| 72 |
|
| 73 |
#endif |