-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 131 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 5 |
4 files changed, 95 insertions, 52 deletions
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp index 754f34c..04f1cbe 100644 --- a/noncore/apps/opie-console/metafactory.cpp +++ b/noncore/apps/opie-console/metafactory.cpp | |||
@@ -1,26 +1,28 @@ | |||
1 | #include <qpe/config.h> | 1 | #include <qpe/config.h> |
2 | #include "metafactory.h" | 2 | #include "metafactory.h" |
3 | 3 | ||
4 | MetaFactory::MetaFactory() { | 4 | MetaFactory::MetaFactory() { |
5 | } | 5 | } |
6 | MetaFactory::~MetaFactory() { | 6 | MetaFactory::~MetaFactory() { |
7 | 7 | ||
8 | } | 8 | } |
9 | void MetaFactory::addConfigWidgetFactory( const QString& str, | 9 | void MetaFactory::addConfigWidgetFactory( const QString& str, |
10 | const QString& name, | ||
10 | configWidget wid) { | 11 | configWidget wid) { |
12 | m_namemap.insert ( str, name ); | ||
11 | m_confFact.insert( str, wid ); | 13 | m_confFact.insert( str, wid ); |
12 | } | 14 | } |
13 | void MetaFactory::addIOLayerFactory( const QString& str, | 15 | void MetaFactory::addIOLayerFactory( const QString& str, |
14 | iolayer lay) { | 16 | iolayer lay) { |
15 | m_layerFact.insert( str, lay ); | 17 | m_layerFact.insert( str, lay ); |
16 | } | 18 | } |
17 | void MetaFactory::addFileTransferLayer( const QString& str, | 19 | void MetaFactory::addFileTransferLayer( const QString& str, |
18 | filelayer lay) { | 20 | filelayer lay) { |
19 | m_fileFact.insert( str, lay ); | 21 | m_fileFact.insert( str, lay ); |
20 | } | 22 | } |
21 | QStringList MetaFactory::ioLayers()const { | 23 | QStringList MetaFactory::ioLayers()const { |
22 | QStringList list; | 24 | QStringList list; |
23 | QMap<QString, iolayer>::ConstIterator it; | 25 | QMap<QString, iolayer>::ConstIterator it; |
24 | for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { | 26 | for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { |
25 | list << it.key(); | 27 | list << it.key(); |
26 | } | 28 | } |
@@ -43,16 +45,21 @@ QStringList MetaFactory::fileTransferLayers()const { | |||
43 | return list; | 45 | return list; |
44 | } | 46 | } |
45 | IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { | 47 | IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { |
46 | IOLayer* lay = 0l; | 48 | IOLayer* lay = 0l; |
47 | 49 | ||
48 | QMap<QString, iolayer>::Iterator it; | 50 | QMap<QString, iolayer>::Iterator it; |
49 | it = m_layerFact.find( str ); | 51 | it = m_layerFact.find( str ); |
50 | if ( it != m_layerFact.end() ) { | 52 | if ( it != m_layerFact.end() ) { |
51 | lay = (*(it.data()))(prof); | 53 | lay = (*(it.data()))(prof); |
52 | /* | 54 | /* |
53 | iolayer laye = it.data(); | 55 | iolayer laye = it.data(); |
54 | lay = (*laye )(conf);*/ | 56 | lay = (*laye )(conf);*/ |
55 | } | 57 | } |
56 | 58 | ||
57 | return lay; | 59 | return lay; |
58 | } | 60 | } |
61 | |||
62 | QString MetaFactory::name( const QString& str ) { | ||
63 | return m_namemap[str]; | ||
64 | } | ||
65 | |||
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h index bdd2ad2..7fa53c6 100644 --- a/noncore/apps/opie-console/metafactory.h +++ b/noncore/apps/opie-console/metafactory.h | |||
@@ -12,34 +12,38 @@ | |||
12 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
13 | 13 | ||
14 | #include "io_layer.h" | 14 | #include "io_layer.h" |
15 | #include "file_layer.h" | 15 | #include "file_layer.h" |
16 | #include "profile.h" | 16 | #include "profile.h" |
17 | 17 | ||
18 | class MetaFactory { | 18 | class MetaFactory { |
19 | public: | 19 | public: |
20 | typedef QWidget* (*configWidget)(QWidget* parent); | 20 | typedef QWidget* (*configWidget)(QWidget* parent); |
21 | typedef IOLayer* (*iolayer)(const Profile& ); | 21 | typedef IOLayer* (*iolayer)(const Profile& ); |
22 | typedef FileTransferLayer* (*filelayer)(IOLayer*); | 22 | typedef FileTransferLayer* (*filelayer)(IOLayer*); |
23 | 23 | ||
24 | MetaFactory(); | 24 | MetaFactory(); |
25 | ~MetaFactory(); | 25 | ~MetaFactory(); |
26 | 26 | ||
27 | void addConfigWidgetFactory( const QString&, | 27 | void addConfigWidgetFactory( const QString&, |
28 | const QString&, | ||
28 | configWidget ); | 29 | configWidget ); |
29 | void addIOLayerFactory(const QString&, | 30 | void addIOLayerFactory(const QString&, |
30 | iolayer ); | 31 | iolayer ); |
31 | void addFileTransferLayer( const QString&, | 32 | void addFileTransferLayer( const QString&, |
32 | filelayer ); | 33 | filelayer ); |
33 | QStringList ioLayers()const; | 34 | QStringList ioLayers()const; |
34 | QStringList configWidgets()const; | 35 | QStringList configWidgets()const; |
35 | QStringList fileTransferLayers()const; | 36 | QStringList fileTransferLayers()const; |
36 | IOLayer* newIOLayer( const QString&,const Profile& ); | 37 | IOLayer* newIOLayer( const QString&,const Profile& ); |
37 | 38 | ||
39 | QString name( const QString& ); | ||
40 | |||
38 | private: | 41 | private: |
39 | QMap<QString, configWidget> m_confFact; | 42 | QMap<QString, configWidget> m_confFact; |
40 | QMap<QString, iolayer> m_layerFact; | 43 | QMap<QString, iolayer> m_layerFact; |
41 | QMap<QString, filelayer> m_fileFact; | 44 | QMap<QString, filelayer> m_fileFact; |
45 | QMap<QString, QString> m_namemap; | ||
42 | }; | 46 | }; |
43 | 47 | ||
44 | 48 | ||
45 | #endif | 49 | #endif |
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index 849439d..859abdd 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -1,208 +1,238 @@ | |||
1 | 1 | ||
2 | #include "profileeditordialog.h" | 2 | #include "profileeditordialog.h" |
3 | 3 | ||
4 | #include "qlayout.h" | 4 | #include "qlayout.h" |
5 | #include "qlineedit.h" | 5 | #include "qlineedit.h" |
6 | #include "qlabel.h" | 6 | #include "qlabel.h" |
7 | #include "qradiobutton.h" | 7 | #include "qradiobutton.h" |
8 | #include "qcombobox.h" | 8 | #include "qcombobox.h" |
9 | #include "qcheckbox.h" | 9 | #include "qcheckbox.h" |
10 | #include "qmessagebox.h" | 10 | #include "qmessagebox.h" |
11 | #include "qbuttongroup.h" | ||
12 | #include "qstringlist.h" | ||
13 | |||
14 | #include "metafactory.h" | ||
15 | |||
16 | static QWidget *factory_serial(QWidget *parent) | ||
17 | { | ||
18 | QFrame *device_frame = new QFrame(parent); | ||
19 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | ||
20 | |||
21 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | ||
22 | QLabel *frame_number = new QLabel(QObject::tr("Phone number"), device_frame); | ||
23 | frame_number->hide(); | ||
24 | |||
25 | QLineEdit *frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); | ||
26 | QLineEdit *frame_number_line = new QLineEdit(device_frame); | ||
27 | frame_number_line->hide(); | ||
28 | |||
29 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | ||
30 | vbox_frame->add(frame_device); | ||
31 | vbox_frame->add(frame_device_line); | ||
32 | vbox_frame->add(frame_number); | ||
33 | vbox_frame->add(frame_number_line); | ||
34 | |||
35 | return device_frame; | ||
36 | } | ||
37 | |||
38 | static QWidget *factory_irda(QWidget *parent) | ||
39 | { | ||
40 | return NULL; | ||
41 | } | ||
42 | |||
43 | static QWidget *factory_modem(QWidget *parent) | ||
44 | { | ||
45 | return NULL; | ||
46 | } | ||
11 | 47 | ||
12 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | 48 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, |
13 | const Profile& prof ) | 49 | const Profile& prof ) |
14 | : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) | 50 | : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) |
15 | { | 51 | { |
16 | // initUI(); | 52 | // initUI(); |
17 | /* now set the widgets */ | 53 | /* now set the widgets */ |
18 | 54 | ||
19 | } | 55 | } |
20 | 56 | ||
21 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | 57 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) |
22 | : QTabDialog(0, 0, TRUE), m_fact( fact ) | 58 | : QTabDialog(0, 0, TRUE), m_fact( fact ) |
23 | { | 59 | { |
24 | QWidget *tabterm, *tabconn, *tabprof; | 60 | QWidget *tabterm, *tabconn, *tabprof; |
25 | 61 | ||
26 | tabprof = new QWidget(this); | 62 | tabprof = new QWidget(this); |
27 | tabterm = new QWidget(this); | 63 | tabterm = new QWidget(this); |
28 | tabconn = new QWidget(this); | 64 | tabconn = new QWidget(this); |
29 | 65 | ||
66 | // for the time being: fake factory | ||
67 | |||
68 | m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); | ||
69 | m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); | ||
70 | m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); | ||
71 | |||
30 | // profile tab | 72 | // profile tab |
31 | 73 | ||
32 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); | 74 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); |
33 | QLabel *device = new QLabel(QObject::tr("Device"), tabprof); | ||
34 | 75 | ||
35 | name_line = new QLineEdit(tabprof); | 76 | name_line = new QLineEdit(tabprof); |
36 | 77 | ||
37 | device_box = new QComboBox(tabprof); | 78 | // connection tab, fixed part |
38 | device_box->insertItem(QObject::tr("Serial cable")); | ||
39 | device_box->insertItem(QObject::tr("IrDA port")); | ||
40 | device_box->insertItem(QObject::tr("Serial via modem")); | ||
41 | 79 | ||
42 | QFrame *device_frame = new QFrame(tabprof); | 80 | QLabel *device = new QLabel(QObject::tr("Device"), tabconn); |
43 | device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); | ||
44 | 81 | ||
45 | QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); | 82 | device_box = new QComboBox(tabconn); |
46 | frame_number = new QLabel(QObject::tr("Phone number"), device_frame); | ||
47 | frame_number->hide(); | ||
48 | 83 | ||
49 | frame_device_line = new QLineEdit("/dev/ttyS0", device_frame); | 84 | QStringList w = m_fact->configWidgets(); |
50 | frame_number_line = new QLineEdit(device_frame); | 85 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) |
51 | frame_number_line->hide(); | 86 | device_box->insertItem(m_fact->name((*it))); |
52 | 87 | ||
53 | QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); | 88 | // connection tab, factory part |
54 | vbox_frame->add(frame_device); | 89 | QFrame *device_frame = static_cast<QFrame*>(factory_serial(tabconn)); |
55 | vbox_frame->add(frame_device_line); | ||
56 | vbox_frame->add(frame_number); | ||
57 | vbox_frame->add(frame_number_line); | ||
58 | 90 | ||
59 | // connection tab | 91 | // connection tab, general part |
60 | 92 | ||
61 | speed_box = new QComboBox(tabconn); | 93 | speed_box = new QComboBox(tabconn); |
62 | speed_box->insertItem("115200 baud"); | 94 | speed_box->insertItem("115200 baud"); |
63 | speed_box->insertItem("57600 baud"); | 95 | speed_box->insertItem("57600 baud"); |
64 | speed_box->insertItem("38400 baud"); | 96 | speed_box->insertItem("38400 baud"); |
65 | speed_box->insertItem("19200 baud"); | 97 | speed_box->insertItem("19200 baud"); |
66 | speed_box->insertItem("9600 baud"); | 98 | speed_box->insertItem("9600 baud"); |
67 | 99 | ||
68 | QLabel *protocol = new QLabel(QObject::tr("Protocol"), tabconn); | ||
69 | QLabel *speed = new QLabel(QObject::tr("Speed"), tabconn); | 100 | QLabel *speed = new QLabel(QObject::tr("Speed"), tabconn); |
70 | QLabel *flow = new QLabel(QObject::tr("Flow control"), tabconn); | 101 | QLabel *flow = new QLabel(QObject::tr("Flow control"), tabconn); |
71 | QLabel *parity = new QLabel(QObject::tr("Parity"), tabconn); | 102 | QLabel *parity = new QLabel(QObject::tr("Parity"), tabconn); |
72 | 103 | ||
73 | QComboBox *protocol_box = new QComboBox(tabconn); | 104 | QButtonGroup *group_flow = new QButtonGroup(tabconn); |
74 | protocol_box->insertItem(QObject::tr("XModem")); | 105 | group_flow->hide(); |
75 | protocol_box->insertItem(QObject::tr("YModem")); | ||
76 | protocol_box->insertItem(QObject::tr("ZModem")); | ||
77 | |||
78 | QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), tabconn); | 106 | QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), tabconn); |
79 | QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), tabconn); | 107 | QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), tabconn); |
108 | group_flow->insert(flow_hw); | ||
109 | group_flow->insert(flow_sw); | ||
80 | 110 | ||
111 | QButtonGroup *group_parity = new QButtonGroup(tabconn); | ||
112 | group_parity->hide(); | ||
81 | QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), tabconn); | 113 | QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), tabconn); |
82 | QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), tabconn); | 114 | QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), tabconn); |
115 | group_parity->insert(parity_odd); | ||
116 | group_parity->insert(parity_even); | ||
83 | 117 | ||
84 | flow_sw->setChecked(true); | 118 | flow_sw->setChecked(true); |
85 | parity_odd->setChecked(true); | 119 | parity_odd->setChecked(true); |
86 | 120 | ||
87 | // terminal tab | 121 | // terminal tab |
88 | 122 | ||
89 | terminal_box = new QComboBox(tabterm); | 123 | terminal_box = new QComboBox(tabterm); |
90 | terminal_box->insertItem("VT 100"); | 124 | terminal_box->insertItem("VT 100"); |
91 | terminal_box->insertItem("VT 102"); | 125 | terminal_box->insertItem("VT 220"); |
126 | terminal_box->insertItem("ANSI"); | ||
92 | 127 | ||
93 | QLabel *terminal = new QLabel(QObject::tr("Terminal type"), tabterm); | 128 | QLabel *terminal = new QLabel(QObject::tr("Terminal type"), tabterm); |
94 | QLabel *colour = new QLabel(QObject::tr("Colour scheme"), tabterm); | 129 | QLabel *colour = new QLabel(QObject::tr("Colour scheme"), tabterm); |
95 | QLabel *size = new QLabel(QObject::tr("Font size"), tabterm); | 130 | QLabel *size = new QLabel(QObject::tr("Font size"), tabterm); |
96 | QLabel *options = new QLabel(QObject::tr("Options"), tabterm); | 131 | QLabel *options = new QLabel(QObject::tr("Options"), tabterm); |
97 | QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), tabterm); | 132 | QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), tabterm); |
98 | 133 | ||
99 | QComboBox *colour_box = new QComboBox(tabterm); | 134 | QComboBox *colour_box = new QComboBox(tabterm); |
100 | colour_box->insertItem(QObject::tr("black on white")); | 135 | colour_box->insertItem(QObject::tr("black on white")); |
101 | colour_box->insertItem(QObject::tr("white on black")); | 136 | colour_box->insertItem(QObject::tr("white on black")); |
102 | 137 | ||
138 | QButtonGroup *group_size = new QButtonGroup(tabterm); | ||
139 | group_size->hide(); | ||
103 | QRadioButton *size_small = new QRadioButton(QObject::tr("small"), tabterm); | 140 | QRadioButton *size_small = new QRadioButton(QObject::tr("small"), tabterm); |
104 | QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), tabterm); | 141 | QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), tabterm); |
105 | QRadioButton *size_large = new QRadioButton(QObject::tr("large"), tabterm); | 142 | QRadioButton *size_large = new QRadioButton(QObject::tr("large"), tabterm); |
143 | group_size->insert(size_small); | ||
144 | group_size->insert(size_medium); | ||
145 | group_size->insert(size_large); | ||
106 | 146 | ||
107 | QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), tabterm); | 147 | QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), tabterm); |
108 | QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), tabterm); | 148 | QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), tabterm); |
109 | 149 | ||
110 | QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), tabterm); | 150 | QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), tabterm); |
111 | QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), tabterm); | 151 | QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), tabterm); |
112 | 152 | ||
113 | // layouting | 153 | // layouting |
114 | 154 | ||
115 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); | 155 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); |
116 | vbox3->add(name); | 156 | vbox3->add(name); |
117 | vbox3->add(name_line); | 157 | vbox3->add(name_line); |
118 | vbox3->add(device); | 158 | vbox3->addStretch(1); |
119 | vbox3->add(device_box); | ||
120 | vbox3->add(device_frame); | ||
121 | 159 | ||
122 | QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); | 160 | QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); |
123 | vbox->add(protocol); | 161 | vbox->add(device); |
124 | vbox->add(protocol_box); | 162 | vbox->add(device_box); |
163 | vbox->add(device_frame); | ||
125 | vbox->add(speed); | 164 | vbox->add(speed); |
126 | vbox->add(speed_box); | 165 | vbox->add(speed_box); |
127 | vbox->add(flow); | 166 | vbox->add(flow); |
128 | QHBoxLayout *hbox = new QHBoxLayout(vbox, 2); | 167 | QHBoxLayout *hbox = new QHBoxLayout(vbox, 2); |
129 | hbox->add(flow_hw); | 168 | hbox->add(flow_hw); |
130 | hbox->add(flow_sw); | 169 | hbox->add(flow_sw); |
170 | //vbox->add(group_flow); | ||
131 | vbox->add(parity); | 171 | vbox->add(parity); |
132 | QHBoxLayout *hbox2 = new QHBoxLayout(vbox, 2); | 172 | QHBoxLayout *hbox2 = new QHBoxLayout(vbox, 2); |
133 | hbox2->add(parity_odd); | 173 | hbox2->add(parity_odd); |
134 | hbox2->add(parity_even); | 174 | hbox2->add(parity_even); |
175 | //vbox->add(group_parity); | ||
135 | 176 | ||
136 | QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); | 177 | QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); |
137 | vbox2->add(terminal); | 178 | vbox2->add(terminal); |
138 | vbox2->add(terminal_box); | 179 | vbox2->add(terminal_box); |
139 | vbox2->add(size); | 180 | vbox2->add(size); |
140 | QHBoxLayout *hbox3 = new QHBoxLayout(vbox2, 2); | 181 | QHBoxLayout *hbox3 = new QHBoxLayout(vbox2, 2); |
141 | hbox3->add(size_small); | 182 | hbox3->add(size_small); |
142 | hbox3->add(size_medium); | 183 | hbox3->add(size_medium); |
143 | hbox3->add(size_large); | 184 | hbox3->add(size_large); |
185 | //vbox2->add(group_size); | ||
144 | vbox2->add(colour); | 186 | vbox2->add(colour); |
145 | vbox2->add(colour_box); | 187 | vbox2->add(colour_box); |
146 | vbox2->add(conversions); | 188 | vbox2->add(conversions); |
147 | QHBoxLayout *hbox5 = new QHBoxLayout(vbox2, 2); | 189 | QHBoxLayout *hbox5 = new QHBoxLayout(vbox2, 2); |
148 | hbox5->add(conv_inbound); | 190 | hbox5->add(conv_inbound); |
149 | hbox5->add(conv_outbound); | 191 | hbox5->add(conv_outbound); |
150 | vbox2->add(options); | 192 | vbox2->add(options); |
151 | QHBoxLayout *hbox4 = new QHBoxLayout(vbox2, 2); | 193 | QHBoxLayout *hbox4 = new QHBoxLayout(vbox2, 2); |
152 | hbox4->add(option_wrap); | 194 | hbox4->add(option_wrap); |
153 | hbox4->add(option_echo); | 195 | hbox4->add(option_echo); |
154 | 196 | ||
155 | addTab(tabprof, QObject::tr("Profile")); | 197 | addTab(tabprof, QObject::tr("Profile")); |
156 | addTab(tabconn, QObject::tr("Connection")); | 198 | addTab(tabconn, QObject::tr("Connection")); |
157 | addTab(tabterm, QObject::tr("Terminal")); | 199 | addTab(tabterm, QObject::tr("Terminal")); |
158 | 200 | ||
159 | setOkButton(QObject::tr("OK")); | 201 | setOkButton(QObject::tr("OK")); |
160 | setCancelButton(QObject::tr("Cancel")); | 202 | setCancelButton(QObject::tr("Cancel")); |
161 | 203 | ||
162 | connect(this, SIGNAL(applyButtonPressed()), SLOT(slotOk())); | 204 | connect(this, SIGNAL(applyButtonPressed()), SLOT(slotOk())); |
163 | connect(this, SIGNAL(defaultButtonPressed()), SLOT(slotOk())); | 205 | connect(this, SIGNAL(defaultButtonPressed()), SLOT(slotOk())); |
164 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); | 206 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); |
165 | 207 | ||
166 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); | 208 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); |
167 | } | 209 | } |
168 | 210 | ||
169 | ProfileEditorDialog::~ProfileEditorDialog() { | 211 | ProfileEditorDialog::~ProfileEditorDialog() { |
170 | 212 | ||
171 | } | 213 | } |
172 | 214 | ||
173 | void ProfileEditorDialog::slotDevice(int id) | 215 | void ProfileEditorDialog::slotDevice(int id) |
174 | { | 216 | { |
175 | switch(id) | 217 | MetaFactory::configWidget c; |
176 | { | 218 | |
177 | case 0: | 219 | //c = m_fact->; |
178 | frame_device_line->setText("/dev/ttyS0"); | 220 | c = factory_serial; |
179 | frame_number->hide(); | 221 | |
180 | frame_number_line->hide(); | 222 | QFrame *device_frame = static_cast<QFrame*>(c(NULL)); |
181 | break; | ||
182 | case 1: | ||
183 | frame_device_line->setText("/dev/ircomm0"); | ||
184 | frame_number->hide(); | ||
185 | frame_number_line->hide(); | ||
186 | break; | ||
187 | case 2: | ||
188 | frame_device_line->setText("/dev/ttyS0"); | ||
189 | frame_number->show(); | ||
190 | frame_number_line->show(); | ||
191 | break; | ||
192 | } | ||
193 | } | 223 | } |
194 | 224 | ||
195 | void ProfileEditorDialog::slotOk() | 225 | void ProfileEditorDialog::slotOk() |
196 | { | 226 | { |
197 | if(prof_name().isEmpty()) | 227 | if(prof_name().isEmpty()) |
198 | { | 228 | { |
199 | QMessageBox::information(this, | 229 | QMessageBox::information(this, |
200 | QObject::tr("Invalid profile"), | 230 | QObject::tr("Invalid profile"), |
201 | QObject::tr("Please enter a profile name.")); | 231 | QObject::tr("Please enter a profile name.")); |
202 | return; | 232 | return; |
203 | } | 233 | } |
204 | 234 | ||
205 | accept(); | 235 | accept(); |
206 | } | 236 | } |
207 | 237 | ||
208 | void ProfileEditorDialog::slotCancel() | 238 | void ProfileEditorDialog::slotCancel() |
@@ -222,33 +252,34 @@ QString ProfileEditorDialog::prof_type() | |||
222 | case 0: | 252 | case 0: |
223 | return "serial"; | 253 | return "serial"; |
224 | break; | 254 | break; |
225 | case 1: | 255 | case 1: |
226 | return "irda"; | 256 | return "irda"; |
227 | break; | 257 | break; |
228 | case 2: | 258 | case 2: |
229 | return "modem"; | 259 | return "modem"; |
230 | break; | 260 | break; |
231 | } | 261 | } |
232 | 262 | ||
233 | return QString::null; | 263 | return QString::null; |
234 | } | 264 | } |
235 | 265 | ||
236 | QString ProfileEditorDialog::conn_device() | 266 | QString ProfileEditorDialog::conn_device() |
237 | { | 267 | { |
238 | return frame_device_line->text(); | 268 | //return frame_device_line->text(); |
269 | return "serial"; | ||
239 | } | 270 | } |
240 | 271 | ||
241 | int ProfileEditorDialog::conn_baud() | 272 | int ProfileEditorDialog::conn_baud() |
242 | { | 273 | { |
243 | return speed_box->currentText().toInt(); | 274 | return speed_box->currentText().toInt(); |
244 | } | 275 | } |
245 | 276 | ||
246 | int ProfileEditorDialog::conn_parity() | 277 | int ProfileEditorDialog::conn_parity() |
247 | { | 278 | { |
248 | return 0; | 279 | return 0; |
249 | } | 280 | } |
250 | 281 | ||
251 | int ProfileEditorDialog::conn_databits() | 282 | int ProfileEditorDialog::conn_databits() |
252 | { | 283 | { |
253 | return 0; | 284 | return 0; |
254 | } | 285 | } |
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h index f81354c..dfe4490 100644 --- a/noncore/apps/opie-console/profileeditordialog.h +++ b/noncore/apps/opie-console/profileeditordialog.h | |||
@@ -35,22 +35,23 @@ public: | |||
35 | QString term_type(); | 35 | QString term_type(); |
36 | 36 | ||
37 | public slots: | 37 | public slots: |
38 | void slotOk(); | 38 | void slotOk(); |
39 | void slotCancel(); | 39 | void slotCancel(); |
40 | 40 | ||
41 | void slotDevice(int id); | 41 | void slotDevice(int id); |
42 | 42 | ||
43 | private: | 43 | private: |
44 | //void initUI(); | 44 | //void initUI(); |
45 | MetaFactory* m_fact; | 45 | MetaFactory* m_fact; |
46 | EditBase* m_base; | 46 | EditBase* m_base; |
47 | QTabWidget* m_tab; | 47 | QTabWidget* m_tab; |
48 | QHBoxLayout* m_lay; | 48 | QHBoxLayout* m_lay; |
49 | Profile m_prof; | 49 | Profile m_prof; |
50 | 50 | ||
51 | QLabel *frame_number; | 51 | //QLabel *frame_number; |
52 | QLineEdit *name_line, *frame_device_line, *frame_number_line; | 52 | QLineEdit *name_line; |
53 | //QLineEdit *frame_device_line, *frame_number_line; | ||
53 | QComboBox *terminal_box, *speed_box, *device_box; | 54 | QComboBox *terminal_box, *speed_box, *device_box; |
54 | }; | 55 | }; |
55 | 56 | ||
56 | #endif | 57 | #endif |