author | josef <josef> | 2002-10-07 14:25:13 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-07 14:25:13 (UTC) |
commit | add436706a938a71a487db019dcd6ff236207bfc (patch) (side-by-side diff) | |
tree | e774574de70c95f872ba190a502846c0f0bf5130 | |
parent | fa8df8b9d316f15bc089df5bde7eafb2ef10b36d (diff) | |
download | opie-add436706a938a71a487db019dcd6ff236207bfc.zip opie-add436706a938a71a487db019dcd6ff236207bfc.tar.gz opie-add436706a938a71a487db019dcd6ff236207bfc.tar.bz2 |
- first cleanups
- basic load/save works now, but none of the standard widget options is
remembered?
-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditorplugins.cpp | 102 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditorplugins.h | 10 |
5 files changed, 73 insertions, 59 deletions
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp index c5e614d..b69d6da 100644 --- a/noncore/apps/opie-console/metafactory.cpp +++ b/noncore/apps/opie-console/metafactory.cpp @@ -62,3 +62,3 @@ IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { -ProfileEditorPlugin *MetaFactory::newConfigPlugin ( const QString& str, QWidget *parent, const Profile& prof) { +ProfileEditorPlugin *MetaFactory::newConfigPlugin ( const QString& str, QWidget *parent, Profile *prof) { ProfileEditorPlugin *p = NULL; diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h index 8c714b3..216de03 100644 --- a/noncore/apps/opie-console/metafactory.h +++ b/noncore/apps/opie-console/metafactory.h @@ -20,3 +20,3 @@ class MetaFactory { public: - typedef ProfileEditorPlugin* (*configWidget)(QWidget* parent, const Profile&); + typedef ProfileEditorPlugin* (*configWidget)(QWidget* parent, Profile* prof); typedef IOLayer* (*iolayer)(const Profile& ); @@ -38,3 +38,3 @@ public: IOLayer* newIOLayer( const QString&,const Profile& ); - ProfileEditorPlugin *newConfigPlugin ( const QString&, QWidget*, const Profile& ); + ProfileEditorPlugin *newConfigPlugin ( const QString&, QWidget*, Profile* ); diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index d98e589..8e63429 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp @@ -75,3 +75,3 @@ void ProfileEditorDialog::initUI() - plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, m_prof); + plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, &m_prof); plugin_layout->add(plugin_plugin->widget()); @@ -114,2 +114,11 @@ void ProfileEditorDialog::initUI() name_line->setText(m_prof.name()); + for(int i = 0; i < device_box->count(); i++) + { + device_box->setCurrentItem(i); + if(prof_type() == m_prof.ioLayerName()) + { + slotDevice(i); + break; + } + } @@ -129,3 +138,3 @@ void ProfileEditorDialog::slotDevice(int id) - plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, m_prof); + plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, &m_prof); plugin_layout->add(plugin_plugin->widget()); @@ -154,2 +163,3 @@ void ProfileEditorDialog::accept() m_prof.setName(prof_name()); + m_prof.setIOLayer(prof_type()); diff --git a/noncore/apps/opie-console/profileeditorplugins.cpp b/noncore/apps/opie-console/profileeditorplugins.cpp index 32e8235..a0bcab8 100644 --- a/noncore/apps/opie-console/profileeditorplugins.cpp +++ b/noncore/apps/opie-console/profileeditorplugins.cpp @@ -17,3 +17,3 @@ -ProfileEditorPlugin::ProfileEditorPlugin(QWidget *parent, Profile p) +ProfileEditorPlugin::ProfileEditorPlugin(QWidget *parent, Profile *p) { @@ -78,5 +78,6 @@ QWidget *ProfileEditorPlugin::connection_widget() // Apply profile settings - int rad_flow = m_profile.readNumEntry("Flow"); - int rad_parity = m_profile.readNumEntry("Parity"); - int speed = m_profile.readNumEntry("Speed"); + + int rad_flow = m_profile->readNumEntry("Flow"); + int rad_parity = m_profile->readNumEntry("Parity"); + int speed = m_profile->readNumEntry("Speed"); @@ -162,9 +163,10 @@ QWidget *ProfileEditorPlugin::terminal_widget() // 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"); + + 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"); @@ -203,6 +205,6 @@ void ProfileEditorPlugin::slotConnFlow(int id) case id_flow_hw: - m_profile.writeEntry("Flow", IOSerial::FlowHW); + m_profile->writeEntry("Flow", IOSerial::FlowHW); break; case id_flow_sw: - m_profile.writeEntry("Flow", IOSerial::FlowSW); + m_profile->writeEntry("Flow", IOSerial::FlowSW); break; @@ -216,6 +218,6 @@ void ProfileEditorPlugin::slotConnParity(int id) case id_parity_odd: - m_profile.writeEntry("Parity", IOSerial::ParityEven); + m_profile->writeEntry("Parity", IOSerial::ParityEven); break; case id_parity_even: - m_profile.writeEntry("Parity", IOSerial::ParityOdd); + m_profile->writeEntry("Parity", IOSerial::ParityOdd); break; @@ -230,15 +232,15 @@ void ProfileEditorPlugin::slotConnSpeed(int id) case id_baud_115200: - m_profile.writeEntry("Speed", 115200); + m_profile->writeEntry("Speed", 115200); break; case id_baud_57600: - m_profile.writeEntry("Speed", 57600); + m_profile->writeEntry("Speed", 57600); break; case id_baud_38400: - m_profile.writeEntry("Speed", 38400); + m_profile->writeEntry("Speed", 38400); break; case id_baud_19200: - m_profile.writeEntry("Speed", 19200); + m_profile->writeEntry("Speed", 19200); break; case id_baud_9600: - m_profile.writeEntry("Speed", 9600); + m_profile->writeEntry("Speed", 9600); break; @@ -252,9 +254,9 @@ void ProfileEditorPlugin::slotTermTerm(int id) case id_term_vt100: - m_profile.writeEntry("Terminal", Profile::VT102); + m_profile->writeEntry("Terminal", Profile::VT102); break; case id_term_vt220: - m_profile.writeEntry("Terminal", Profile::VT102); + m_profile->writeEntry("Terminal", Profile::VT102); break; case id_term_ansi: - m_profile.writeEntry("Terminal", Profile::VT102); + m_profile->writeEntry("Terminal", Profile::VT102); break; @@ -268,6 +270,6 @@ void ProfileEditorPlugin::slotTermColour(int id) case id_term_black: - m_profile.writeEntry("Colour", Profile::Black); + m_profile->writeEntry("Colour", Profile::Black); break; case id_term_white: - m_profile.writeEntry("Colour", Profile::White); + m_profile->writeEntry("Colour", Profile::White); break; @@ -281,9 +283,9 @@ void ProfileEditorPlugin::slotTermFont(int id) case id_size_small: - m_profile.writeEntry("Font", Profile::Micro); + m_profile->writeEntry("Font", Profile::Micro); break; case id_size_medium: - m_profile.writeEntry("Font", Profile::Small); + m_profile->writeEntry("Font", Profile::Small); break; case id_size_large: - m_profile.writeEntry("Font", Profile::Medium); + m_profile->writeEntry("Font", Profile::Medium); break; @@ -294,3 +296,3 @@ void ProfileEditorPlugin::slotTermEcho(bool on) { - m_profile.writeEntry("Echo", on ? 1 : 0); + m_profile->writeEntry("Echo", on ? 1 : 0); } @@ -299,3 +301,3 @@ void ProfileEditorPlugin::slotTermWrap(bool on) { - m_profile.writeEntry("Wrap", on ? 1 : 0); + m_profile->writeEntry("Wrap", on ? 1 : 0); } @@ -304,3 +306,3 @@ void ProfileEditorPlugin::slotTermInbound(bool on) { - m_profile.writeEntry("Inbound", on ? 1 : 0); + m_profile->writeEntry("Inbound", on ? 1 : 0); } @@ -309,3 +311,3 @@ void ProfileEditorPlugin::slotTermOutbound(bool on) { - m_profile.writeEntry("Outbound", on ? 1 : 0); + m_profile->writeEntry("Outbound", on ? 1 : 0); } @@ -318,3 +320,3 @@ class ProfileEditorPluginSerial : public ProfileEditorPlugin - ProfileEditorPluginSerial(QWidget *parent, Profile p) + ProfileEditorPluginSerial(QWidget *parent, Profile *p) : ProfileEditorPlugin(parent, p) @@ -345,3 +347,5 @@ class ProfileEditorPluginSerial : public ProfileEditorPlugin // Load special settings - device_line->setText(m_profile.readEntry("Device")); + + QString dev = m_profile->readEntry("Device"); + if(!dev.isNull()) device_line->setText(dev); } @@ -354,4 +358,3 @@ class ProfileEditorPluginSerial : public ProfileEditorPlugin // special settings - Profile p = m_profile; - p.writeEntry("Device", device_line->text()); + m_profile->writeEntry("Device", device_line->text()); } @@ -366,3 +369,3 @@ class ProfileEditorPluginIrda : public ProfileEditorPlugin - ProfileEditorPluginIrda(QWidget *parent, Profile p) + ProfileEditorPluginIrda(QWidget *parent, Profile *p) : ProfileEditorPlugin(parent, p) @@ -393,3 +396,4 @@ class ProfileEditorPluginIrda : public ProfileEditorPlugin // Load special settings - device_line->setText(m_profile.readEntry("Device")); + QString dev = m_profile->readEntry("Device"); + if(!dev.isNull()) device_line->setText(dev); } @@ -402,4 +406,3 @@ class ProfileEditorPluginIrda : public ProfileEditorPlugin // special settings - Profile p = m_profile; - p.writeEntry("Device", device_line->text()); + m_profile->writeEntry("Device", device_line->text()); } @@ -414,3 +417,3 @@ class ProfileEditorPluginModem : public ProfileEditorPlugin - ProfileEditorPluginModem(QWidget *parent, Profile p) + ProfileEditorPluginModem(QWidget *parent, Profile *p) : ProfileEditorPlugin(parent, p) @@ -445,4 +448,6 @@ class ProfileEditorPluginModem : public ProfileEditorPlugin // Load special settings - device_line->setText(m_profile.readEntry("Device")); - number_line->setText(m_profile.readEntry("Number")); + QString dev = m_profile->readEntry("Device"); + QString num = m_profile->readEntry("Number"); + if(!dev.isNull()) device_line->setText(dev); + number_line->setText(num); } @@ -455,5 +460,4 @@ class ProfileEditorPluginModem : public ProfileEditorPlugin // special settings - Profile p = m_profile; - p.writeEntry("Device", device_line->text()); - p.writeEntry("Number", number_line->text()); + m_profile->writeEntry("Device", device_line->text()); + m_profile->writeEntry("Number", number_line->text()); } @@ -464,3 +468,3 @@ class ProfileEditorPluginModem : public ProfileEditorPlugin -ProfileEditorPlugin *factory_serial(QWidget *parent, const Profile& p) +ProfileEditorPlugin *factory_serial(QWidget *parent, Profile *p) { @@ -469,3 +473,3 @@ ProfileEditorPlugin *factory_serial(QWidget *parent, const Profile& p) -ProfileEditorPlugin *factory_irda(QWidget *parent, const Profile& p) +ProfileEditorPlugin *factory_irda(QWidget *parent, Profile *p) { @@ -474,3 +478,3 @@ ProfileEditorPlugin *factory_irda(QWidget *parent, const Profile& p) -ProfileEditorPlugin *factory_modem(QWidget *parent, const Profile& p) +ProfileEditorPlugin *factory_modem(QWidget *parent, Profile *p) { diff --git a/noncore/apps/opie-console/profileeditorplugins.h b/noncore/apps/opie-console/profileeditorplugins.h index caec7ba..591163a 100644 --- a/noncore/apps/opie-console/profileeditorplugins.h +++ b/noncore/apps/opie-console/profileeditorplugins.h @@ -13,3 +13,3 @@ class ProfileEditorPlugin : public QObject public: - ProfileEditorPlugin(QWidget *parent, Profile p); + ProfileEditorPlugin(QWidget *parent, Profile *p); @@ -38,3 +38,3 @@ class ProfileEditorPlugin : public QObject QWidget *m_parent, *m_widget; - Profile m_profile; + Profile *m_profile; @@ -87,5 +87,5 @@ class ProfileEditorPlugin : public QObject -ProfileEditorPlugin *factory_serial(QWidget *parent, const Profile& p); -ProfileEditorPlugin *factory_irda(QWidget *parent, const Profile& p); -ProfileEditorPlugin *factory_modem(QWidget *parent, const Profile& p); +ProfileEditorPlugin *factory_serial(QWidget *parent, Profile *p); +ProfileEditorPlugin *factory_irda(QWidget *parent, Profile *p); +ProfileEditorPlugin *factory_modem(QWidget *parent, Profile *p); |