summaryrefslogtreecommitdiff
authorjosef <josef>2002-10-07 13:32:35 (UTC)
committer josef <josef>2002-10-07 13:32:35 (UTC)
commitfa8df8b9d316f15bc089df5bde7eafb2ef10b36d (patch) (side-by-side diff)
tree8e450fb00ea73504573a35fa782a2a1735aea355
parent68d98791b05217163f97d7c233952df8075416bb (diff)
downloadopie-fa8df8b9d316f15bc089df5bde7eafb2ef10b36d.zip
opie-fa8df8b9d316f15bc089df5bde7eafb2ef10b36d.tar.gz
opie-fa8df8b9d316f15bc089df5bde7eafb2ef10b36d.tar.bz2
- finish factorization :)
- does not work yet, but only minor bugs are left
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp188
-rw-r--r--noncore/apps/opie-console/profileeditordialog.h41
-rw-r--r--noncore/apps/opie-console/profileeditorplugins.cpp303
-rw-r--r--noncore/apps/opie-console/profileeditorplugins.h62
4 files changed, 371 insertions, 223 deletions
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index 78885e1..d98e589 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -1,24 +1,21 @@
#include "profileeditordialog.h"
#include "qlayout.h"
#include "qlineedit.h"
#include "qlabel.h"
-#include "qradiobutton.h"
-#include "qcombobox.h"
-#include "qcheckbox.h"
#include "qmessagebox.h"
-#include "qbuttongroup.h"
#include "qstringlist.h"
+#include "qcombobox.h"
#include "profileeditorplugins.h"
#include "metafactory.h"
ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact,
const Profile& prof )
: QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof )
{
initUI();
// Apply current profile
// plugin_plugin->load(profile);
@@ -72,152 +69,63 @@ void ProfileEditorDialog::initUI()
for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
device_box->insertItem(m_fact->name((*it)));
// connection tab, factory part
plugin_base = new QWidget(tabconn);
plugin_layout = new QHBoxLayout(plugin_base, 0);
plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, m_prof);
plugin_layout->add(plugin_plugin->widget());
// connection tab, general part
- QComboBox *speed_box = new QComboBox(tabconn);
- speed_box->insertItem("115200 baud", id_baud_115200);
- speed_box->insertItem("57600 baud", id_baud_57600);
- speed_box->insertItem("38400 baud", id_baud_38400);
- speed_box->insertItem("19200 baud", id_baud_19200);
- speed_box->insertItem("9600 baud", id_baud_9600);
-
- QLabel *speed = new QLabel(QObject::tr("Speed"), tabconn);
- QLabel *flow = new QLabel(QObject::tr("Flow control"), tabconn);
- QLabel *parity = new QLabel(QObject::tr("Parity"), tabconn);
-
- QButtonGroup *group_flow = new QButtonGroup(tabconn);
- group_flow->hide();
- QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), tabconn);
- QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), tabconn);
- group_flow->insert(flow_hw, id_flow_hw);
- group_flow->insert(flow_sw, id_flow_sw);
-
- QButtonGroup *group_parity = new QButtonGroup(tabconn);
- group_parity->hide();
- QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), tabconn);
- QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), tabconn);
- group_parity->insert(parity_odd, id_parity_odd);
- group_parity->insert(parity_even, id_parity_even);
-
- flow_sw->setChecked(true);
- parity_odd->setChecked(true);
+ QWidget *conn_widget = plugin_plugin->connection_widget();
+ conn_widget->reparent(tabconn, 0, QPoint(), true);
// terminal tab
- QComboBox *terminal_box = new QComboBox(tabterm);
- terminal_box->insertItem("VT 100", id_term_vt100);
- terminal_box->insertItem("VT 220", id_term_vt220);
- terminal_box->insertItem("ANSI", id_term_ansi);
-
- QLabel *terminal = new QLabel(QObject::tr("Terminal type"), tabterm);
- QLabel *colour = new QLabel(QObject::tr("Colour scheme"), tabterm);
- QLabel *size = new QLabel(QObject::tr("Font size"), tabterm);
- QLabel *options = new QLabel(QObject::tr("Options"), tabterm);
- QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), tabterm);
-
- QComboBox *colour_box = new QComboBox(tabterm);
- colour_box->insertItem(QObject::tr("black on white"));
- colour_box->insertItem(QObject::tr("white on black"));
-
- QButtonGroup *group_size = new QButtonGroup(tabterm);
- group_size->hide();
- QRadioButton *size_small = new QRadioButton(QObject::tr("small"), tabterm);
- QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), tabterm);
- QRadioButton *size_large = new QRadioButton(QObject::tr("large"), tabterm);
- group_size->insert(size_small);
- group_size->insert(size_medium);
- group_size->insert(size_large);
-
- QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), tabterm);
- QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), tabterm);
-
- QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), tabterm);
- QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), tabterm);
-
- size_small->setChecked(true);
+ QWidget *term_widget = plugin_plugin->terminal_widget();
+ term_widget->reparent(tabterm, 0, QPoint(), true);
// layouting
QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
vbox3->add(name);
vbox3->add(name_line);
vbox3->addStretch(1);
QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2);
vbox->add(device);
vbox->add(device_box);
vbox->add(plugin_base);
- vbox->add(speed);
- vbox->add(speed_box);
- vbox->add(flow);
- QHBoxLayout *hbox = new QHBoxLayout(vbox, 2);
- hbox->add(flow_hw);
- hbox->add(flow_sw);
- //vbox->add(group_flow);
- vbox->add(parity);
- QHBoxLayout *hbox2 = new QHBoxLayout(vbox, 2);
- hbox2->add(parity_odd);
- hbox2->add(parity_even);
- //vbox->add(group_parity);
+ vbox->add(conn_widget);
QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2);
- vbox2->add(terminal);
- vbox2->add(terminal_box);
- vbox2->add(size);
- QHBoxLayout *hbox3 = new QHBoxLayout(vbox2, 2);
- hbox3->add(size_small);
- hbox3->add(size_medium);
- hbox3->add(size_large);
- //vbox2->add(group_size);
- vbox2->add(colour);
- vbox2->add(colour_box);
- vbox2->add(conversions);
- QHBoxLayout *hbox5 = new QHBoxLayout(vbox2, 2);
- hbox5->add(conv_inbound);
- hbox5->add(conv_outbound);
- vbox2->add(options);
- QHBoxLayout *hbox4 = new QHBoxLayout(vbox2, 2);
- hbox4->add(option_wrap);
- hbox4->add(option_echo);
+ vbox2->add(term_widget);
addTab(tabprof, QObject::tr("Profile"));
addTab(tabconn, QObject::tr("Connection"));
addTab(tabterm, QObject::tr("Terminal"));
setOkButton(QObject::tr("OK"));
setCancelButton(QObject::tr("Cancel"));
// load profile values
name_line->setText(m_prof.name());
// signals
connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel()));
connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int)));
-
- connect(group_flow, SIGNAL(clicked(int)), SLOT(slotConnFlow(int)));
- connect(group_parity, SIGNAL(clicked(int)), SLOT(slotConnParity(int)));
- connect(speed_box, SIGNAL(activated(int)), SLOT(slotConnSpeed(int)));
-
- connect(terminal_box, SIGNAL(activated(int)), SLOT(slotTermTerm(int)));
- connect(group_size, SIGNAL(clicked(int)), SLOT(slotTermFont(int)));
}
ProfileEditorDialog::~ProfileEditorDialog() {
}
void ProfileEditorDialog::slotDevice(int id)
{
delete plugin_plugin;
plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, m_prof);
plugin_layout->add(plugin_plugin->widget());
@@ -258,95 +166,13 @@ QString ProfileEditorDialog::prof_name()
return name_line->text();
}
QString ProfileEditorDialog::prof_type()
{
QStringList w = m_fact->configWidgets();
for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
if(device_box->currentText() == m_fact->name((*it))) return (*it);
return QString::null;
}
-void ProfileEditorDialog::slotConnFlow(int id)
-{
- switch(id)
- {
- case id_flow_hw:
- m_prof.writeEntry("Flow", 0x01);
- break;
- case id_flow_sw:
- m_prof.writeEntry("Flow", 0x02);
- break;
- }
-}
-
-void ProfileEditorDialog::slotConnParity(int id)
-{
- switch(id)
- {
- case id_parity_odd:
- m_prof.writeEntry("Parity", 2);
- break;
- case id_parity_even:
- m_prof.writeEntry("Parity", 1);
- break;
- }
-}
-
-void ProfileEditorDialog::slotConnSpeed(int id)
-{
- switch(id)
- {
-
- case id_baud_115200:
- m_prof.writeEntry("Speed", 115200);
- break;
- case id_baud_57600:
- m_prof.writeEntry("Speed", 57600);
- break;
- case id_baud_38400:
- m_prof.writeEntry("Speed", 38400);
- break;
- case id_baud_19200:
- m_prof.writeEntry("Speed", 19200);
- break;
- case id_baud_9600:
- m_prof.writeEntry("Speed", 9600);
- break;
- }
-}
-
-void ProfileEditorDialog::slotTermTerm(int id)
-{
- switch(id)
- {
-
- case id_term_vt100:
- m_prof.writeEntry("Terminal", 2);
- break;
- case id_term_vt220:
- m_prof.writeEntry("Terminal", 1);
- break;
- case id_term_ansi:
- m_prof.writeEntry("Terminal", 0);
- break;
- }
-}
-
-void ProfileEditorDialog::slotTermFont(int id)
-{
- switch(id)
- {
- case id_size_small:
- m_prof.writeEntry("Font", 0);
- break;
- case id_size_medium:
- m_prof.writeEntry("Font", 1);
- break;
- case id_size_large:
- m_prof.writeEntry("Font", 2);
- break;
- }
-}
-
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h
index a6808d0..18e2ec0 100644
--- a/noncore/apps/opie-console/profileeditordialog.h
+++ b/noncore/apps/opie-console/profileeditordialog.h
@@ -24,71 +24,30 @@ public:
Profile profile()const;
QString prof_name();
QString prof_type();
public slots:
void accept();
//void slotOk();
void slotCancel();
void slotDevice(int id);
- void slotConnFlow(int id);
- void slotConnParity(int id);
- void slotConnSpeed(int id);
- void slotTermTerm(int id);
- void slotTermFont(int id);
-
private:
void initUI();
MetaFactory* m_fact;
EditBase* m_base;
QTabWidget* m_tab;
QHBoxLayout* m_lay;
Profile m_prof;
QLineEdit *name_line;
QComboBox *device_box;
QWidget *plugin_base;
ProfileEditorPlugin *plugin_plugin;
QHBoxLayout *plugin_layout;
-
- enum ParityIds
- {
- id_parity_odd,
- id_parity_even
- };
-
- enum FlowIds
- {
- id_flow_hw,
- id_flow_sw
- };
-
- enum SpeedIds
- {
- id_baud_115200,
- id_baud_57600,
- id_baud_38400,
- id_baud_19200,
- id_baud_9600
- };
-
- enum TermIds
- {
- id_term_vt100,
- id_term_vt220,
- id_term_ansi
- };
-
- enum FontIds
- {
- id_size_small,
- id_size_medium,
- id_size_large
- };
};
#endif
diff --git a/noncore/apps/opie-console/profileeditorplugins.cpp b/noncore/apps/opie-console/profileeditorplugins.cpp
index a11d6b0..32e8235 100644
--- a/noncore/apps/opie-console/profileeditorplugins.cpp
+++ b/noncore/apps/opie-console/profileeditorplugins.cpp
@@ -1,33 +1,326 @@
#include "profileeditorplugins.h"
#include "profile.h"
#include "qframe.h"
#include "qlabel.h"
#include "qlineedit.h"
#include "qlayout.h"
+#include "qcombobox.h"
+#include "qradiobutton.h"
+#include "qcheckbox.h"
+#include "qbuttongroup.h"
+
+#include "io_serial.h"
+
+// Base class
ProfileEditorPlugin::ProfileEditorPlugin(QWidget *parent, Profile p)
{
m_parent = parent;
m_profile = p;
m_widget = NULL;
}
ProfileEditorPlugin::~ProfileEditorPlugin()
{
if(m_widget) delete m_widget;
}
+QWidget *ProfileEditorPlugin::connection_widget()
+{
+ QWidget *root;
+ QVBoxLayout *lroot;
+
+ root = new QWidget();
+
+ // Build GUI
+
+ QComboBox *speed_box = new QComboBox(root);
+ speed_box->insertItem("115200 baud", id_baud_115200);
+ speed_box->insertItem("57600 baud", id_baud_57600);
+ speed_box->insertItem("38400 baud", id_baud_38400);
+ speed_box->insertItem("19200 baud", id_baud_19200);
+ speed_box->insertItem("9600 baud", id_baud_9600);
+
+ QLabel *speedlabel = new QLabel(QObject::tr("Speed"), root);
+ QLabel *flow = new QLabel(QObject::tr("Flow control"), root);
+ QLabel *parity = new QLabel(QObject::tr("Parity"), root);
+
+ QButtonGroup *group_flow = new QButtonGroup(root);
+ group_flow->hide();
+ QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), root);
+ QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), root);
+ group_flow->insert(flow_hw, id_flow_hw);
+ group_flow->insert(flow_sw, id_flow_sw);
+
+ QButtonGroup *group_parity = new QButtonGroup(root);
+ group_parity->hide();
+ QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), root);
+ QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), root);
+ group_parity->insert(parity_odd, id_parity_odd);
+ group_parity->insert(parity_even, id_parity_even);
+
+ // Build Layout
+
+ lroot = new QVBoxLayout(root);
+ lroot->add(speedlabel);
+ lroot->add(speed_box);
+ lroot->add(flow);
+ QHBoxLayout *hbox = new QHBoxLayout(lroot, 2);
+ hbox->add(flow_hw);
+ hbox->add(flow_sw);
+ lroot->add(parity);
+ QHBoxLayout *hbox2 = new QHBoxLayout(lroot, 2);
+ hbox2->add(parity_odd);
+ hbox2->add(parity_even);
+
+ // Apply profile settings
+ int rad_flow = m_profile.readNumEntry("Flow");
+ int rad_parity = m_profile.readNumEntry("Parity");
+ int speed = m_profile.readNumEntry("Speed");
+
+ if(rad_flow == IOSerial::FlowHW) flow_hw->setChecked(true);
+ else flow_sw->setChecked(true);
+ if(rad_parity == IOSerial::ParityEven) parity_even->setChecked(true);
+ else parity_odd->setChecked(true);
+ if(speed == 115200) speed_box->setCurrentItem(id_baud_115200);
+ if(speed == 57600) speed_box->setCurrentItem(id_baud_57600);
+ if(speed == 38400) speed_box->setCurrentItem(id_baud_38400);
+ if(speed == 19200) speed_box->setCurrentItem(id_baud_19200);
+ if(speed == 9600) speed_box->setCurrentItem(id_baud_9600);
+
+ // Signals
+
+ connect(group_flow, SIGNAL(clicked(int)), SLOT(slotConnFlow(int)));
+ connect(group_parity, SIGNAL(clicked(int)), SLOT(slotConnParity(int)));
+ connect(speed_box, SIGNAL(activated(int)), SLOT(slotConnSpeed(int)));
+
+ return root;
+}
+
+QWidget *ProfileEditorPlugin::terminal_widget()
+{
+ QWidget *root;
+ QVBoxLayout *lroot;
+
+ root = new QWidget();
+
+ // Build GUI
+
+ QComboBox *terminal_box = new QComboBox(root);
+ terminal_box->insertItem("VT 100", id_term_vt100);
+ terminal_box->insertItem("VT 220", id_term_vt220);
+ terminal_box->insertItem("ANSI", id_term_ansi);
+
+ QLabel *terminal = new QLabel(QObject::tr("Terminal type"), root);
+ QLabel *colourlabel = new QLabel(QObject::tr("Colour scheme"), root);
+ QLabel *sizelabel = new QLabel(QObject::tr("Font size"), root);
+ QLabel *options = new QLabel(QObject::tr("Options"), root);
+ QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), root);
+
+ QComboBox *colour_box = new QComboBox(root);
+ colour_box->insertItem(QObject::tr("black on white"), id_term_black);
+ colour_box->insertItem(QObject::tr("white on black"), id_term_white);
+
+ QButtonGroup *group_size = new QButtonGroup(root);
+ group_size->hide();
+ QRadioButton *size_small = new QRadioButton(QObject::tr("small"), root);
+ QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), root);
+ QRadioButton *size_large = new QRadioButton(QObject::tr("large"), root);
+ group_size->insert(size_small);
+ group_size->insert(size_medium);
+ group_size->insert(size_large);
+
+ QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), root);
+ QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), root);
+
+ QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), root);
+ QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), root);
+
+ // Build Layout
+
+ lroot = new QVBoxLayout(root, 2);
+ lroot->add(terminal);
+ lroot->add(terminal_box);
+ lroot->add(sizelabel);
+ QHBoxLayout *hbox = new QHBoxLayout(lroot, 2);
+ hbox->add(size_small);
+ hbox->add(size_medium);
+ hbox->add(size_large);
+ lroot->add(colourlabel);
+ lroot->add(colour_box);
+ lroot->add(conversions);
+ QHBoxLayout *hbox2 = new QHBoxLayout(lroot, 2);
+ hbox2->add(conv_inbound);
+ hbox2->add(conv_outbound);
+ lroot->add(options);
+ QHBoxLayout *hbox3 = new QHBoxLayout(lroot, 2);
+ hbox3->add(option_wrap);
+ hbox3->add(option_echo);
+
+ // Apply profile settings
+ int term = m_profile.readNumEntry("Terminal");
+ int colour = m_profile.readNumEntry("Colour");
+ int fontsize = m_profile.readNumEntry("Font");
+ int opt_echo = m_profile.readNumEntry("Echo");
+ int opt_wrap = m_profile.readNumEntry("Wrap");
+ int opt_inbound = m_profile.readNumEntry("Inbound");
+ int opt_outbound = m_profile.readNumEntry("Outbound");
+
+ if(term == Profile::VT102) terminal_box->setCurrentItem(id_term_vt100);
+
+ if(colour == Profile::Black) colour_box->setCurrentItem(id_term_black);
+ if(colour == Profile::White) colour_box->setCurrentItem(id_term_white);
+
+ if(fontsize == Profile::Micro) size_small->setChecked(true);
+ if(fontsize == Profile::Small) size_medium->setChecked(true);
+ if(fontsize == Profile::Medium) size_large->setChecked(true);
+
+ if(opt_echo) option_echo->setChecked(true);
+ if(opt_wrap) option_wrap->setChecked(true);
+ if(opt_inbound) conv_inbound->setChecked(true);
+ if(opt_outbound) conv_outbound->setChecked(true);
+
+ // Signals
+
+ connect(terminal_box, SIGNAL(activated(int)), SLOT(slotTermTerm(int)));
+ connect(colour_box, SIGNAL(activated(int)), SLOT(slotTermColour(int)));
+ connect(group_size, SIGNAL(clicked(int)), SLOT(slotTermFont(int)));
+
+ connect(option_echo, SIGNAL(toggled(bool)), SLOT(slotTermEcho(bool)));
+ connect(option_wrap, SIGNAL(toggled(bool)), SLOT(slotTermWrap(bool)));
+ connect(conv_inbound, SIGNAL(toggled(bool)), SLOT(slotTermInbound(bool)));
+ connect(conv_outbound, SIGNAL(toggled(bool)), SLOT(slotTermOutbound(bool)));
+
+ return root;
+}
+
+void ProfileEditorPlugin::slotConnFlow(int id)
+{
+ switch(id)
+ {
+ case id_flow_hw:
+ m_profile.writeEntry("Flow", IOSerial::FlowHW);
+ break;
+ case id_flow_sw:
+ m_profile.writeEntry("Flow", IOSerial::FlowSW);
+ break;
+ }
+}
+
+void ProfileEditorPlugin::slotConnParity(int id)
+{
+ switch(id)
+ {
+ case id_parity_odd:
+ m_profile.writeEntry("Parity", IOSerial::ParityEven);
+ break;
+ case id_parity_even:
+ m_profile.writeEntry("Parity", IOSerial::ParityOdd);
+ break;
+ }
+}
+
+void ProfileEditorPlugin::slotConnSpeed(int id)
+{
+ switch(id)
+ {
+
+ case id_baud_115200:
+ m_profile.writeEntry("Speed", 115200);
+ break;
+ case id_baud_57600:
+ m_profile.writeEntry("Speed", 57600);
+ break;
+ case id_baud_38400:
+ m_profile.writeEntry("Speed", 38400);
+ break;
+ case id_baud_19200:
+ m_profile.writeEntry("Speed", 19200);
+ break;
+ case id_baud_9600:
+ m_profile.writeEntry("Speed", 9600);
+ break;
+ }
+}
+
+void ProfileEditorPlugin::slotTermTerm(int id)
+{
+ switch(id)
+ {
+ case id_term_vt100:
+ m_profile.writeEntry("Terminal", Profile::VT102);
+ break;
+ case id_term_vt220:
+ m_profile.writeEntry("Terminal", Profile::VT102);
+ break;
+ case id_term_ansi:
+ m_profile.writeEntry("Terminal", Profile::VT102);
+ break;
+ }
+}
+
+void ProfileEditorPlugin::slotTermColour(int id)
+{
+ switch(id)
+ {
+ case id_term_black:
+ m_profile.writeEntry("Colour", Profile::Black);
+ break;
+ case id_term_white:
+ m_profile.writeEntry("Colour", Profile::White);
+ break;
+ }
+}
+
+void ProfileEditorPlugin::slotTermFont(int id)
+{
+ switch(id)
+ {
+ case id_size_small:
+ m_profile.writeEntry("Font", Profile::Micro);
+ break;
+ case id_size_medium:
+ m_profile.writeEntry("Font", Profile::Small);
+ break;
+ case id_size_large:
+ m_profile.writeEntry("Font", Profile::Medium);
+ break;
+ }
+}
+
+void ProfileEditorPlugin::slotTermEcho(bool on)
+{
+ m_profile.writeEntry("Echo", on ? 1 : 0);
+}
+
+void ProfileEditorPlugin::slotTermWrap(bool on)
+{
+ m_profile.writeEntry("Wrap", on ? 1 : 0);
+}
+
+void ProfileEditorPlugin::slotTermInbound(bool on)
+{
+ m_profile.writeEntry("Inbound", on ? 1 : 0);
+}
+
+void ProfileEditorPlugin::slotTermOutbound(bool on)
+{
+ m_profile.writeEntry("Outbound", on ? 1 : 0);
+}
+
+// Inherited classes
+
class ProfileEditorPluginSerial : public ProfileEditorPlugin
{
public:
ProfileEditorPluginSerial(QWidget *parent, Profile p)
: ProfileEditorPlugin(parent, p)
{
}
~ProfileEditorPluginSerial()
{
}
@@ -39,24 +332,27 @@ class ProfileEditorPluginSerial : public ProfileEditorPlugin
QFrame *device_frame = new QFrame(m_parent);
device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame);
device_line = new QLineEdit("/dev/ttyS0", device_frame);
QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2);
vbox_frame->add(frame_device);
vbox_frame->add(device_line);
m_widget = device_frame;
+
+ // Load special settings
+ device_line->setText(m_profile.readEntry("Device"));
}
return m_widget;
}
void save()
{
// special settings
Profile p = m_profile;
p.writeEntry("Device", device_line->text());
}
@@ -84,24 +380,27 @@ class ProfileEditorPluginIrda : public ProfileEditorPlugin
QFrame *device_frame = new QFrame(m_parent);
device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame);
device_line = new QLineEdit("/dev/ircomm0", device_frame);
QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2);
vbox_frame->add(frame_device);
vbox_frame->add(device_line);
m_widget = device_frame;
+
+ // Load special settings
+ device_line->setText(m_profile.readEntry("Device"));
}
return m_widget;
}
void save()
{
// special settings
Profile p = m_profile;
p.writeEntry("Device", device_line->text());
}
@@ -133,24 +432,28 @@ class ProfileEditorPluginModem : public ProfileEditorPlugin
QLabel *frame_number = new QLabel(QObject::tr("Phone number"), device_frame);
device_line = new QLineEdit("/dev/ttyS0", device_frame);
number_line = new QLineEdit(device_frame);
QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2);
vbox_frame->add(frame_device);
vbox_frame->add(device_line);
vbox_frame->add(frame_number);
vbox_frame->add(number_line);
m_widget = device_frame;
+
+ // Load special settings
+ device_line->setText(m_profile.readEntry("Device"));
+ number_line->setText(m_profile.readEntry("Number"));
}
return m_widget;
}
void save()
{
// special settings
Profile p = m_profile;
p.writeEntry("Device", device_line->text());
p.writeEntry("Number", number_line->text());
}
diff --git a/noncore/apps/opie-console/profileeditorplugins.h b/noncore/apps/opie-console/profileeditorplugins.h
index 7e0219b..caec7ba 100644
--- a/noncore/apps/opie-console/profileeditorplugins.h
+++ b/noncore/apps/opie-console/profileeditorplugins.h
@@ -1,33 +1,93 @@
#ifndef PROFILE_EDITOR_PLUGINS_H
#define PROFILE_EDITOR_PLUGINS_H
#include "profile.h"
+#include "qobject.h"
+
class QWidget;
-class ProfileEditorPlugin
+class ProfileEditorPlugin : public QObject
{
+ Q_OBJECT
public:
ProfileEditorPlugin(QWidget *parent, Profile p);
virtual ~ProfileEditorPlugin();
virtual void save() = 0;
virtual QWidget *widget() = 0;
+ QWidget *connection_widget();
+ QWidget *terminal_widget();
+
+ public slots:
+ void slotConnFlow(int id);
+ void slotConnParity(int id);
+ void slotConnSpeed(int id);
+ void slotTermTerm(int id);
+ void slotTermColour(int id);
+ void slotTermFont(int id);
+ void slotTermEcho(bool on);
+ void slotTermWrap(bool on);
+ void slotTermInbound(bool on);
+ void slotTermOutbound(bool on);
+
protected:
QWidget *m_parent, *m_widget;
Profile m_profile;
+
+ private:
+ enum ParityIds
+ {
+ id_parity_odd,
+ id_parity_even
+ };
+
+ enum FlowIds
+ {
+ id_flow_hw,
+ id_flow_sw
+ };
+
+ enum SpeedIds
+ {
+ id_baud_115200,
+ id_baud_57600,
+ id_baud_38400,
+ id_baud_19200,
+ id_baud_9600
+ };
+
+ enum TermIds
+ {
+ id_term_vt100,
+ id_term_vt220,
+ id_term_ansi
+ };
+
+ enum ColourIds
+ {
+ id_term_black,
+ id_term_white
+ };
+
+ enum FontIds
+ {
+ id_size_small,
+ id_size_medium,
+ id_size_large
+ };
};
//#ifdef __cplusplus
//extern "C" {
//#endif
ProfileEditorPlugin *factory_serial(QWidget *parent, const Profile& p);
ProfileEditorPlugin *factory_irda(QWidget *parent, const Profile& p);
ProfileEditorPlugin *factory_modem(QWidget *parent, const Profile& p);
//#ifdef __cplusplus
//}