summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/profileeditorplugins.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/profileeditorplugins.cpp b/noncore/apps/opie-console/profileeditorplugins.cpp
index a0bcab8..b63fa1c 100644
--- a/noncore/apps/opie-console/profileeditorplugins.cpp
+++ b/noncore/apps/opie-console/profileeditorplugins.cpp
@@ -1,210 +1,211 @@
1 1
2#include "profileeditorplugins.h" 2#include "profileeditorplugins.h"
3#include "profile.h" 3#include "profile.h"
4 4
5#include "qframe.h" 5#include "qframe.h"
6#include "qlabel.h" 6#include "qlabel.h"
7#include "qlineedit.h" 7#include "qlineedit.h"
8#include "qlayout.h" 8#include "qlayout.h"
9#include "qcombobox.h" 9#include "qcombobox.h"
10#include "qradiobutton.h" 10#include "qradiobutton.h"
11#include "qcheckbox.h" 11#include "qcheckbox.h"
12#include "qbuttongroup.h" 12#include "qbuttongroup.h"
13 13
14#include "io_serial.h" 14#include "io_serial.h"
15 15
16// Base class 16// Base class
17 17
18ProfileEditorPlugin::ProfileEditorPlugin(QWidget *parent, Profile *p) 18ProfileEditorPlugin::ProfileEditorPlugin(QWidget *parent, Profile *p)
19: QObject()
19{ 20{
20 m_parent = parent; 21 m_parent = parent;
21 m_profile = p; 22 m_profile = p;
22 m_widget = NULL; 23 m_widget = NULL;
23} 24}
24 25
25ProfileEditorPlugin::~ProfileEditorPlugin() 26ProfileEditorPlugin::~ProfileEditorPlugin()
26{ 27{
27 if(m_widget) delete m_widget; 28 if(m_widget) delete m_widget;
28} 29}
29 30
30QWidget *ProfileEditorPlugin::connection_widget() 31QWidget *ProfileEditorPlugin::connection_widget()
31{ 32{
32 QWidget *root; 33 QWidget *root;
33 QVBoxLayout *lroot; 34 QVBoxLayout *lroot;
34 35
35 root = new QWidget(); 36 root = new QWidget();
36 37
37 // Build GUI 38 // Build GUI
38 39
39 QComboBox *speed_box = new QComboBox(root); 40 QComboBox *speed_box = new QComboBox(root);
40 speed_box->insertItem("115200 baud", id_baud_115200); 41 speed_box->insertItem("115200 baud", id_baud_115200);
41 speed_box->insertItem("57600 baud", id_baud_57600); 42 speed_box->insertItem("57600 baud", id_baud_57600);
42 speed_box->insertItem("38400 baud", id_baud_38400); 43 speed_box->insertItem("38400 baud", id_baud_38400);
43 speed_box->insertItem("19200 baud", id_baud_19200); 44 speed_box->insertItem("19200 baud", id_baud_19200);
44 speed_box->insertItem("9600 baud", id_baud_9600); 45 speed_box->insertItem("9600 baud", id_baud_9600);
45 46
46 QLabel *speedlabel = new QLabel(QObject::tr("Speed"), root); 47 QLabel *speedlabel = new QLabel(QObject::tr("Speed"), root);
47 QLabel *flow = new QLabel(QObject::tr("Flow control"), root); 48 QLabel *flow = new QLabel(QObject::tr("Flow control"), root);
48 QLabel *parity = new QLabel(QObject::tr("Parity"), root); 49 QLabel *parity = new QLabel(QObject::tr("Parity"), root);
49 50
50 QButtonGroup *group_flow = new QButtonGroup(root); 51 QButtonGroup *group_flow = new QButtonGroup(root);
51 group_flow->hide(); 52 group_flow->hide();
52 QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), root); 53 QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), root);
53 QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), root); 54 QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), root);
54 group_flow->insert(flow_hw, id_flow_hw); 55 group_flow->insert(flow_hw, id_flow_hw);
55 group_flow->insert(flow_sw, id_flow_sw); 56 group_flow->insert(flow_sw, id_flow_sw);
56 57
57 QButtonGroup *group_parity = new QButtonGroup(root); 58 QButtonGroup *group_parity = new QButtonGroup(root);
58 group_parity->hide(); 59 group_parity->hide();
59 QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), root); 60 QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), root);
60 QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), root); 61 QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), root);
61 group_parity->insert(parity_odd, id_parity_odd); 62 group_parity->insert(parity_odd, id_parity_odd);
62 group_parity->insert(parity_even, id_parity_even); 63 group_parity->insert(parity_even, id_parity_even);
63 64
64 // Build Layout 65 // Build Layout
65 66
66 lroot = new QVBoxLayout(root); 67 lroot = new QVBoxLayout(root);
67 lroot->add(speedlabel); 68 lroot->add(speedlabel);
68 lroot->add(speed_box); 69 lroot->add(speed_box);
69 lroot->add(flow); 70 lroot->add(flow);
70 QHBoxLayout *hbox = new QHBoxLayout(lroot, 2); 71 QHBoxLayout *hbox = new QHBoxLayout(lroot, 2);
71 hbox->add(flow_hw); 72 hbox->add(flow_hw);
72 hbox->add(flow_sw); 73 hbox->add(flow_sw);
73 lroot->add(parity); 74 lroot->add(parity);
74 QHBoxLayout *hbox2 = new QHBoxLayout(lroot, 2); 75 QHBoxLayout *hbox2 = new QHBoxLayout(lroot, 2);
75 hbox2->add(parity_odd); 76 hbox2->add(parity_odd);
76 hbox2->add(parity_even); 77 hbox2->add(parity_even);
77 78
78 // Apply profile settings 79 // Apply profile settings
79 80
80 int rad_flow = m_profile->readNumEntry("Flow"); 81 int rad_flow = m_profile->readNumEntry("Flow");
81 int rad_parity = m_profile->readNumEntry("Parity"); 82 int rad_parity = m_profile->readNumEntry("Parity");
82 int speed = m_profile->readNumEntry("Speed"); 83 int speed = m_profile->readNumEntry("Speed");
83 84
84 if(rad_flow == IOSerial::FlowHW) flow_hw->setChecked(true); 85 if(rad_flow == IOSerial::FlowHW) flow_hw->setChecked(true);
85 else flow_sw->setChecked(true); 86 else flow_sw->setChecked(true);
86 if(rad_parity == IOSerial::ParityEven) parity_even->setChecked(true); 87 if(rad_parity == IOSerial::ParityEven) parity_even->setChecked(true);
87 else parity_odd->setChecked(true); 88 else parity_odd->setChecked(true);
88 if(speed == 115200) speed_box->setCurrentItem(id_baud_115200); 89 if(speed == 115200) speed_box->setCurrentItem(id_baud_115200);
89 if(speed == 57600) speed_box->setCurrentItem(id_baud_57600); 90 if(speed == 57600) speed_box->setCurrentItem(id_baud_57600);
90 if(speed == 38400) speed_box->setCurrentItem(id_baud_38400); 91 if(speed == 38400) speed_box->setCurrentItem(id_baud_38400);
91 if(speed == 19200) speed_box->setCurrentItem(id_baud_19200); 92 if(speed == 19200) speed_box->setCurrentItem(id_baud_19200);
92 if(speed == 9600) speed_box->setCurrentItem(id_baud_9600); 93 if(speed == 9600) speed_box->setCurrentItem(id_baud_9600);
93 94
94 // Signals 95 // Signals
95 96
96 connect(group_flow, SIGNAL(clicked(int)), SLOT(slotConnFlow(int))); 97 connect(group_flow, SIGNAL(clicked(int)), SLOT(slotConnFlow(int)));
97 connect(group_parity, SIGNAL(clicked(int)), SLOT(slotConnParity(int))); 98 connect(group_parity, SIGNAL(clicked(int)), SLOT(slotConnParity(int)));
98 connect(speed_box, SIGNAL(activated(int)), SLOT(slotConnSpeed(int))); 99 connect(speed_box, SIGNAL(activated(int)), SLOT(slotConnSpeed(int)));
99 100
100 return root; 101 return root;
101} 102}
102 103
103QWidget *ProfileEditorPlugin::terminal_widget() 104QWidget *ProfileEditorPlugin::terminal_widget()
104{ 105{
105 QWidget *root; 106 QWidget *root;
106 QVBoxLayout *lroot; 107 QVBoxLayout *lroot;
107 108
108 root = new QWidget(); 109 root = new QWidget();
109 110
110 // Build GUI 111 // Build GUI
111 112
112 QComboBox *terminal_box = new QComboBox(root); 113 QComboBox *terminal_box = new QComboBox(root);
113 terminal_box->insertItem("VT 100", id_term_vt100); 114 terminal_box->insertItem("VT 100", id_term_vt100);
114 terminal_box->insertItem("VT 220", id_term_vt220); 115 terminal_box->insertItem("VT 220", id_term_vt220);
115 terminal_box->insertItem("ANSI", id_term_ansi); 116 terminal_box->insertItem("ANSI", id_term_ansi);
116 117
117 QLabel *terminal = new QLabel(QObject::tr("Terminal type"), root); 118 QLabel *terminal = new QLabel(QObject::tr("Terminal type"), root);
118 QLabel *colourlabel = new QLabel(QObject::tr("Colour scheme"), root); 119 QLabel *colourlabel = new QLabel(QObject::tr("Colour scheme"), root);
119 QLabel *sizelabel = new QLabel(QObject::tr("Font size"), root); 120 QLabel *sizelabel = new QLabel(QObject::tr("Font size"), root);
120 QLabel *options = new QLabel(QObject::tr("Options"), root); 121 QLabel *options = new QLabel(QObject::tr("Options"), root);
121 QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), root); 122 QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), root);
122 123
123 QComboBox *colour_box = new QComboBox(root); 124 QComboBox *colour_box = new QComboBox(root);
124 colour_box->insertItem(QObject::tr("black on white"), id_term_black); 125 colour_box->insertItem(QObject::tr("black on white"), id_term_black);
125 colour_box->insertItem(QObject::tr("white on black"), id_term_white); 126 colour_box->insertItem(QObject::tr("white on black"), id_term_white);
126 127
127 QButtonGroup *group_size = new QButtonGroup(root); 128 QButtonGroup *group_size = new QButtonGroup(root);
128 group_size->hide(); 129 group_size->hide();
129 QRadioButton *size_small = new QRadioButton(QObject::tr("small"), root); 130 QRadioButton *size_small = new QRadioButton(QObject::tr("small"), root);
130 QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), root); 131 QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), root);
131 QRadioButton *size_large = new QRadioButton(QObject::tr("large"), root); 132 QRadioButton *size_large = new QRadioButton(QObject::tr("large"), root);
132 group_size->insert(size_small); 133 group_size->insert(size_small);
133 group_size->insert(size_medium); 134 group_size->insert(size_medium);
134 group_size->insert(size_large); 135 group_size->insert(size_large);
135 136
136 QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), root); 137 QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), root);
137 QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), root); 138 QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), root);
138 139
139 QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), root); 140 QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), root);
140 QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), root); 141 QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), root);
141 142
142 // Build Layout 143 // Build Layout
143 144
144 lroot = new QVBoxLayout(root, 2); 145 lroot = new QVBoxLayout(root, 2);
145 lroot->add(terminal); 146 lroot->add(terminal);
146 lroot->add(terminal_box); 147 lroot->add(terminal_box);
147 lroot->add(sizelabel); 148 lroot->add(sizelabel);
148 QHBoxLayout *hbox = new QHBoxLayout(lroot, 2); 149 QHBoxLayout *hbox = new QHBoxLayout(lroot, 2);
149 hbox->add(size_small); 150 hbox->add(size_small);
150 hbox->add(size_medium); 151 hbox->add(size_medium);
151 hbox->add(size_large); 152 hbox->add(size_large);
152 lroot->add(colourlabel); 153 lroot->add(colourlabel);
153 lroot->add(colour_box); 154 lroot->add(colour_box);
154 lroot->add(conversions); 155 lroot->add(conversions);
155 QHBoxLayout *hbox2 = new QHBoxLayout(lroot, 2); 156 QHBoxLayout *hbox2 = new QHBoxLayout(lroot, 2);
156 hbox2->add(conv_inbound); 157 hbox2->add(conv_inbound);
157 hbox2->add(conv_outbound); 158 hbox2->add(conv_outbound);
158 lroot->add(options); 159 lroot->add(options);
159 QHBoxLayout *hbox3 = new QHBoxLayout(lroot, 2); 160 QHBoxLayout *hbox3 = new QHBoxLayout(lroot, 2);
160 hbox3->add(option_wrap); 161 hbox3->add(option_wrap);
161 hbox3->add(option_echo); 162 hbox3->add(option_echo);
162 163
163 // Apply profile settings 164 // Apply profile settings
164 165
165 int term = m_profile->readNumEntry("Terminal"); 166 int term = m_profile->readNumEntry("Terminal");
166 int colour = m_profile->readNumEntry("Colour"); 167 int colour = m_profile->readNumEntry("Colour");
167 int fontsize = m_profile->readNumEntry("Font"); 168 int fontsize = m_profile->readNumEntry("Font");
168 int opt_echo = m_profile->readNumEntry("Echo"); 169 int opt_echo = m_profile->readNumEntry("Echo");
169 int opt_wrap = m_profile->readNumEntry("Wrap"); 170 int opt_wrap = m_profile->readNumEntry("Wrap");
170 int opt_inbound = m_profile->readNumEntry("Inbound"); 171 int opt_inbound = m_profile->readNumEntry("Inbound");
171 int opt_outbound = m_profile->readNumEntry("Outbound"); 172 int opt_outbound = m_profile->readNumEntry("Outbound");
172 173
173 if(term == Profile::VT102) terminal_box->setCurrentItem(id_term_vt100); 174 if(term == Profile::VT102) terminal_box->setCurrentItem(id_term_vt100);
174 175
175 if(colour == Profile::Black) colour_box->setCurrentItem(id_term_black); 176 if(colour == Profile::Black) colour_box->setCurrentItem(id_term_black);
176 if(colour == Profile::White) colour_box->setCurrentItem(id_term_white); 177 if(colour == Profile::White) colour_box->setCurrentItem(id_term_white);
177 178
178 if(fontsize == Profile::Micro) size_small->setChecked(true); 179 if(fontsize == Profile::Micro) size_small->setChecked(true);
179 if(fontsize == Profile::Small) size_medium->setChecked(true); 180 if(fontsize == Profile::Small) size_medium->setChecked(true);
180 if(fontsize == Profile::Medium) size_large->setChecked(true); 181 if(fontsize == Profile::Medium) size_large->setChecked(true);
181 182
182 if(opt_echo) option_echo->setChecked(true); 183 if(opt_echo) option_echo->setChecked(true);
183 if(opt_wrap) option_wrap->setChecked(true); 184 if(opt_wrap) option_wrap->setChecked(true);
184 if(opt_inbound) conv_inbound->setChecked(true); 185 if(opt_inbound) conv_inbound->setChecked(true);
185 if(opt_outbound) conv_outbound->setChecked(true); 186 if(opt_outbound) conv_outbound->setChecked(true);
186 187
187 // Signals 188 // Signals
188 189
189 connect(terminal_box, SIGNAL(activated(int)), SLOT(slotTermTerm(int))); 190 connect(terminal_box, SIGNAL(activated(int)), SLOT(slotTermTerm(int)));
190 connect(colour_box, SIGNAL(activated(int)), SLOT(slotTermColour(int))); 191 connect(colour_box, SIGNAL(activated(int)), SLOT(slotTermColour(int)));
191 connect(group_size, SIGNAL(clicked(int)), SLOT(slotTermFont(int))); 192 connect(group_size, SIGNAL(clicked(int)), SLOT(slotTermFont(int)));
192 193
193 connect(option_echo, SIGNAL(toggled(bool)), SLOT(slotTermEcho(bool))); 194 connect(option_echo, SIGNAL(toggled(bool)), SLOT(slotTermEcho(bool)));
194 connect(option_wrap, SIGNAL(toggled(bool)), SLOT(slotTermWrap(bool))); 195 connect(option_wrap, SIGNAL(toggled(bool)), SLOT(slotTermWrap(bool)));
195 connect(conv_inbound, SIGNAL(toggled(bool)), SLOT(slotTermInbound(bool))); 196 connect(conv_inbound, SIGNAL(toggled(bool)), SLOT(slotTermInbound(bool)));
196 connect(conv_outbound, SIGNAL(toggled(bool)), SLOT(slotTermOutbound(bool))); 197 connect(conv_outbound, SIGNAL(toggled(bool)), SLOT(slotTermOutbound(bool)));
197 198
198 return root; 199 return root;
199} 200}
200 201
201void ProfileEditorPlugin::slotConnFlow(int id) 202void ProfileEditorPlugin::slotConnFlow(int id)
202{ 203{
203 switch(id) 204 switch(id)
204 { 205 {
205 case id_flow_hw: 206 case id_flow_hw:
206 m_profile->writeEntry("Flow", IOSerial::FlowHW); 207 m_profile->writeEntry("Flow", IOSerial::FlowHW);
207 break; 208 break;
208 case id_flow_sw: 209 case id_flow_sw:
209 m_profile->writeEntry("Flow", IOSerial::FlowSW); 210 m_profile->writeEntry("Flow", IOSerial::FlowSW);
210 break; 211 break;