Diffstat (limited to 'noncore/apps/opie-reader/CAnnoEdit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/CAnnoEdit.cpp | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/CAnnoEdit.cpp b/noncore/apps/opie-reader/CAnnoEdit.cpp new file mode 100644 index 0000000..35821ed --- a/dev/null +++ b/noncore/apps/opie-reader/CAnnoEdit.cpp | |||
@@ -0,0 +1,121 @@ | |||
1 | #include "CAnnoEdit.h" | ||
2 | |||
3 | QColor CAnnoEdit::getColor() | ||
4 | { | ||
5 | switch (colorbox->currentItem()) | ||
6 | { | ||
7 | case 0: | ||
8 | default: | ||
9 | return white; | ||
10 | case 1: | ||
11 | return darkGray; | ||
12 | case 2: | ||
13 | return gray; | ||
14 | case 3: | ||
15 | return lightGray; | ||
16 | case 4: | ||
17 | return red; | ||
18 | case 5: | ||
19 | return green; | ||
20 | case 6: | ||
21 | return blue; | ||
22 | case 7: | ||
23 | return cyan; | ||
24 | case 8: | ||
25 | return magenta; | ||
26 | case 9: | ||
27 | return yellow; | ||
28 | case 10: | ||
29 | return darkRed; | ||
30 | case 11: | ||
31 | return darkGreen; | ||
32 | case 12: | ||
33 | return darkBlue; | ||
34 | case 13: | ||
35 | return darkCyan; | ||
36 | case 14: | ||
37 | return darkMagenta; | ||
38 | case 15: | ||
39 | return darkYellow; | ||
40 | } | ||
41 | } | ||
42 | |||
43 | void CAnnoEdit::setColor(QColor v) | ||
44 | { | ||
45 | if (v == white) | ||
46 | colorbox->setCurrentItem(0); | ||
47 | else if (v == darkGray) | ||
48 | colorbox->setCurrentItem(1); | ||
49 | else if (v == gray) | ||
50 | colorbox->setCurrentItem(2); | ||
51 | else if (v == lightGray) | ||
52 | colorbox->setCurrentItem(3); | ||
53 | else if (v == red) | ||
54 | colorbox->setCurrentItem(4); | ||
55 | else if (v == green) | ||
56 | colorbox->setCurrentItem(5); | ||
57 | else if (v == blue) | ||
58 | colorbox->setCurrentItem(6); | ||
59 | else if (v == cyan) | ||
60 | colorbox->setCurrentItem(7); | ||
61 | else if (v == magenta) | ||
62 | colorbox->setCurrentItem(8); | ||
63 | else if (v == yellow) | ||
64 | colorbox->setCurrentItem(9); | ||
65 | else if (v == darkRed) | ||
66 | colorbox->setCurrentItem(10); | ||
67 | else if (v == darkGreen) | ||
68 | colorbox->setCurrentItem(11); | ||
69 | else if (v == darkBlue) | ||
70 | colorbox->setCurrentItem(12); | ||
71 | else if (v == darkCyan) | ||
72 | colorbox->setCurrentItem(13); | ||
73 | else if (v == darkMagenta) | ||
74 | colorbox->setCurrentItem(14); | ||
75 | else if (v == darkYellow) | ||
76 | colorbox->setCurrentItem(15); | ||
77 | else | ||
78 | colorbox->setCurrentItem(0); | ||
79 | } | ||
80 | |||
81 | CAnnoEdit::CAnnoEdit(QWidget *parent, const char *name, WFlags f) : | ||
82 | QWidget(parent, name, f) | ||
83 | { | ||
84 | QVBoxLayout* grid = new QVBoxLayout(this); | ||
85 | m_name = new QLineEdit(this, "Name"); | ||
86 | m_anno = new QMultiLineEdit(this, "Annotation"); | ||
87 | m_anno->setWordWrap(QMultiLineEdit::WidgetWidth); | ||
88 | QPushButton* exitButton = new QPushButton("Okay", this); | ||
89 | connect(exitButton, SIGNAL( clicked() ), this, SLOT( slotOkay() ) ); | ||
90 | QPushButton* cancelButton = new QPushButton("Cancel", this); | ||
91 | connect(cancelButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) ); | ||
92 | QLabel *l = new QLabel("Text",this); | ||
93 | grid->addWidget(l); | ||
94 | grid->addWidget(m_name); | ||
95 | l = new QLabel("Annotation",this); | ||
96 | grid->addWidget(l); | ||
97 | grid->addWidget(m_anno,1); | ||
98 | |||
99 | colorbox = new QComboBox( this ); | ||
100 | |||
101 | colorbox->insertItem("None"); | ||
102 | colorbox->insertItem("Dark Gray"); | ||
103 | colorbox->insertItem("Gray"); | ||
104 | colorbox->insertItem("Light Gray"); | ||
105 | colorbox->insertItem("Red"); | ||
106 | colorbox->insertItem("Green"); | ||
107 | colorbox->insertItem("Blue"); | ||
108 | colorbox->insertItem("Cyan"); | ||
109 | colorbox->insertItem("Magenta"); | ||
110 | colorbox->insertItem("Yellow"); | ||
111 | colorbox->insertItem("Dark Red"); | ||
112 | colorbox->insertItem("Dark Green"); | ||
113 | colorbox->insertItem("Dark Blue"); | ||
114 | colorbox->insertItem("Dark Cyan"); | ||
115 | colorbox->insertItem("Dark Magenta"); | ||
116 | colorbox->insertItem("Dark Yellow"); | ||
117 | QHBoxLayout* hgrid = new QHBoxLayout(grid); | ||
118 | hgrid->addWidget(colorbox); | ||
119 | hgrid->addWidget(cancelButton); | ||
120 | hgrid->addWidget(exitButton); | ||
121 | } | ||