author | harlekin <harlekin> | 2002-10-07 18:10:10 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-07 18:10:10 (UTC) |
commit | 3d7d26f3c6ec040d883f1a1f7137c1ded6d9d76d (patch) (side-by-side diff) | |
tree | 7fdc70be408f3c4ac5160ccf1cbc2e3584630ef9 | |
parent | d55aa591770675008da9e3290617e463a77e4c98 (diff) | |
download | opie-3d7d26f3c6ec040d883f1a1f7137c1ded6d9d76d.zip opie-3d7d26f3c6ec040d883f1a1f7137c1ded6d9d76d.tar.gz opie-3d7d26f3c6ec040d883f1a1f7137c1ded6d9d76d.tar.bz2 |
forgot about a otabwidget speciality
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index be23eff..3843943 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp @@ -22,167 +22,168 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, // plugin_plugin->load(profile); // ... (reset profile name line edit etc.) } ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) : QDialog(0, 0, TRUE), m_fact( fact ) { // Default profile m_prof = Profile(QString::null, "serial", Profile::Black, Profile::White, Profile::VT102); initUI(); // Apply current profile // plugin_plugin->load(profile); } Profile ProfileEditorDialog::profile() const { return m_prof; } void ProfileEditorDialog::initUI() { QVBoxLayout *mainLayout = new QVBoxLayout( this ); OTabWidget *tabWidget = new OTabWidget( this ); mainLayout->add(tabWidget); QWidget *tabterm, *tabconn, *tabprof; tabprof = new QWidget(this); tabterm = new QWidget(this); tabconn = new QWidget(this); // for the time being: fake factory m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); // profile tab QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); name_line = new QLineEdit(tabprof); // connection tab, fixed part QLabel *device = new QLabel(QObject::tr("Device"), tabconn); device_box = new QComboBox(tabconn); QStringList w = m_fact->configWidgets(); 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 QWidget *conn_widget = plugin_plugin->connection_widget(); conn_widget->reparent(tabconn, 0, QPoint(), true); // terminal tab 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(conn_widget); vbox->setStretchFactor(device, 1); vbox->setStretchFactor(device_box, 1); vbox->setStretchFactor(plugin_base, 1); vbox->setStretchFactor(conn_widget, 7); QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); vbox2->add(term_widget); tabWidget->addTab(tabprof, "", QObject::tr("Profile")); tabWidget->addTab(tabconn, "", QObject::tr("Connection")); tabWidget->addTab(tabterm, "", QObject::tr("Terminal")); + tabWidget->setCurrentTab( tabprof ); // load profile values 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; } } // signals connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(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()); // Reload profile associated to device, including e.g. conn_device() // m_prof = plugin_plugin->profile() // or, keeping the profile name: m_prof->reload(plugin_plugin->profile()) //plugin_plugin->show(); plugin_plugin->widget()->show(); } void ProfileEditorDialog::accept() { if(prof_name().isEmpty()) { QMessageBox::information(this, QObject::tr("Invalid profile"), QObject::tr("Please enter a profile name.")); return; } // Save profile and plugin profile if(plugin_plugin) plugin_plugin->save(); // Save general values m_prof.setName(prof_name()); m_prof.setIOLayer(prof_type()); QDialog::accept(); } 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; } |