Diffstat (limited to 'noncore/apps/opie-reader/CAnnoEdit.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/CAnnoEdit.h | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/noncore/apps/opie-reader/CAnnoEdit.h b/noncore/apps/opie-reader/CAnnoEdit.h index f320061..78d3eeb 100644 --- a/noncore/apps/opie-reader/CAnnoEdit.h +++ b/noncore/apps/opie-reader/CAnnoEdit.h | |||
@@ -1,59 +1,48 @@ | |||
1 | #ifndef __CANNOEDIT_H | 1 | #ifndef __CANNOEDIT_H |
2 | #define __CANNOEDIT_H | 2 | #define __CANNOEDIT_H |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qlayout.h> | 4 | #include <qlayout.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qlineedit.h> | 6 | #include <qlineedit.h> |
7 | #include <qmultilineedit.h> | 7 | #include <qmultilineedit.h> |
8 | #include <qcombobox.h> | ||
8 | 9 | ||
9 | class CAnnoEdit : public QWidget | 10 | class CAnnoEdit : public QWidget |
10 | { | 11 | { |
11 | Q_OBJECT | 12 | Q_OBJECT |
12 | 13 | ||
13 | QLineEdit* m_name; | 14 | QLineEdit* m_name; |
14 | QMultiLineEdit* m_anno; | 15 | QMultiLineEdit* m_anno; |
15 | size_t m_posn; | 16 | size_t m_posn, m_posn2; |
17 | QComboBox* colorbox; | ||
16 | public: | 18 | public: |
17 | void setPosn(size_t p) { m_posn = p; } | 19 | void setPosn(size_t p) { m_posn = p; } |
20 | void setPosn2(size_t p) { m_posn2 = p; } | ||
18 | size_t getPosn() { return m_posn; } | 21 | size_t getPosn() { return m_posn; } |
22 | size_t getPosn2() { return m_posn2; } | ||
23 | QColor getColor(); | ||
24 | void setColor(QColor); | ||
19 | void setName(const QString& name) | 25 | void setName(const QString& name) |
20 | { | 26 | { |
21 | m_name->setText(name); | 27 | m_name->setText(name); |
22 | } | 28 | } |
23 | void setAnno(const QString& name) | 29 | void setAnno(const QString& name) |
24 | { | 30 | { |
25 | m_anno->setText(name); | 31 | m_anno->setText(name); |
26 | m_anno->setEdited(false); | 32 | m_anno->setEdited(false); |
27 | } | 33 | } |
28 | bool edited() { return m_anno->edited(); } | 34 | bool edited() { return m_anno->edited(); } |
29 | CAnnoEdit(QWidget *parent=0, const char *name=0, WFlags f = 0) : | 35 | CAnnoEdit(QWidget *parent=0, const char *name=0, WFlags f = 0); |
30 | QWidget(parent, name, f) | ||
31 | { | ||
32 | QVBoxLayout* grid = new QVBoxLayout(this); | ||
33 | m_name = new QLineEdit(this, "Name"); | ||
34 | m_anno = new QMultiLineEdit(this, "Annotation"); | ||
35 | m_anno->setWordWrap(QMultiLineEdit::WidgetWidth); | ||
36 | QPushButton* exitButton = new QPushButton("Okay", this); | ||
37 | connect(exitButton, SIGNAL( released() ), this, SLOT( slotOkay() ) ); | ||
38 | QPushButton* cancelButton = new QPushButton("Cancel", this); | ||
39 | connect(cancelButton, SIGNAL( released() ), this, SLOT( slotCancel() ) ); | ||
40 | QLabel *l = new QLabel("Text",this); | ||
41 | grid->addWidget(l); | ||
42 | grid->addWidget(m_name); | ||
43 | l = new QLabel("Annotation",this); | ||
44 | grid->addWidget(l); | ||
45 | grid->addWidget(m_anno,1); | ||
46 | QHBoxLayout* hgrid = new QHBoxLayout(grid); | ||
47 | hgrid->addWidget(cancelButton); | ||
48 | hgrid->addWidget(exitButton); | ||
49 | } | ||
50 | private slots: | 36 | private slots: |
51 | void slotOkay() { emit finished(m_name->text(), m_anno->text()); } | 37 | void slotOkay() |
38 | { | ||
39 | emit finished(m_name->text(), m_anno->text()); | ||
40 | } | ||
52 | void slotCancel() { emit cancelled(); } | 41 | void slotCancel() { emit cancelled(); } |
53 | public: | 42 | public: |
54 | signals: | 43 | signals: |
55 | void finished(const QString&, const QString&); | 44 | void finished(const QString&, const QString&); |
56 | void cancelled(); | 45 | void cancelled(); |
57 | }; | 46 | }; |
58 | 47 | ||
59 | #endif | 48 | #endif |