author | harlekin <harlekin> | 2002-10-07 18:05:43 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-07 18:05:43 (UTC) |
commit | d55aa591770675008da9e3290617e463a77e4c98 (patch) (side-by-side diff) | |
tree | 93d779cc85298545673f4d5f2ea0fcc7d4d301b7 | |
parent | d25a925e70982b86539b98362ab2cd75c7883110 (diff) | |
download | opie-d55aa591770675008da9e3290617e463a77e4c98.zip opie-d55aa591770675008da9e3290617e463a77e4c98.tar.gz opie-d55aa591770675008da9e3290617e463a77e4c98.tar.bz2 |
reworked config dialog gui a bit and adapted it to opie
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 36 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 25 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditorplugins.cpp | 139 | ||||
-rw-r--r-- | noncore/apps/opie-console/widget_layer.h | 22 |
5 files changed, 110 insertions, 122 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index dce08ca..31f1138 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -16,5 +16,5 @@ MainWindow::MainWindow() { m_sessions.setAutoDelete( TRUE ); m_curSession = 0; - m_manager = new ProfileManager(m_factory); + m_manager = new ProfileManager( m_factory ); m_manager->load(); @@ -97,6 +97,6 @@ void MainWindow::initUI() { * connect to the menu activation */ - connect( m_sessionsPop, SIGNAL(activated(int) ), - this, SLOT(slotProfile(int) ) ); + connect( m_sessionsPop, SIGNAL(activated( int ) ), + this, SLOT(slotProfile( int ) ) ); m_consoleWindow = new TabWidget( this, "blah"); @@ -169,8 +169,8 @@ void MainWindow::slotConfigure() { void MainWindow::slotClose() { - } -void MainWindow::slotProfile(int) { +void MainWindow::slotProfile( int ) { + } diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index 8e63429..be23eff 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp @@ -1,3 +1,4 @@ +#include <opie/otabwidget.h> #include "profileeditordialog.h" @@ -14,5 +15,5 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, const Profile& prof ) - : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) + : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) { initUI(); @@ -24,5 +25,5 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) - : QTabDialog(0, 0, TRUE), m_fact( fact ) + : QDialog(0, 0, TRUE), m_fact( fact ) { // Default profile @@ -42,5 +43,10 @@ Profile ProfileEditorDialog::profile() const void ProfileEditorDialog::initUI() { - QWidget *tabterm, *tabconn, *tabprof; + + QVBoxLayout *mainLayout = new QVBoxLayout( this ); + OTabWidget *tabWidget = new OTabWidget( this ); + mainLayout->add(tabWidget); + + QWidget *tabterm, *tabconn, *tabprof; tabprof = new QWidget(this); @@ -49,5 +55,5 @@ void ProfileEditorDialog::initUI() // 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); @@ -99,17 +105,17 @@ void ProfileEditorDialog::initUI() 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); - addTab(tabprof, QObject::tr("Profile")); - addTab(tabconn, QObject::tr("Connection")); - addTab(tabterm, QObject::tr("Terminal")); - - setOkButton(QObject::tr("OK")); - setCancelButton(QObject::tr("Cancel")); + tabWidget->addTab(tabprof, "", QObject::tr("Profile")); + tabWidget->addTab(tabconn, "", QObject::tr("Connection")); + tabWidget->addTab(tabterm, "", QObject::tr("Terminal")); // load profile values - name_line->setText(m_prof.name()); for(int i = 0; i < device_box->count(); i++) @@ -124,7 +130,5 @@ void ProfileEditorDialog::initUI() // signals - - connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); - connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); + connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); } @@ -167,8 +171,4 @@ void ProfileEditorDialog::accept() } -void ProfileEditorDialog::slotCancel() -{ - reject(); -} QString ProfileEditorDialog::prof_name() diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h index 18e2ec0..8e830f1 100644 --- a/noncore/apps/opie-console/profileeditordialog.h +++ b/noncore/apps/opie-console/profileeditordialog.h @@ -2,5 +2,5 @@ #define PROFILE_EDITOR_DIALOG -#include <qtabdialog.h> +#include <qdialog.h> #include "profile.h" @@ -15,5 +15,5 @@ class QLabel; class ProfileEditorPlugin; -class ProfileEditorDialog : public QTabDialog { +class ProfileEditorDialog : public QDialog { Q_OBJECT public: @@ -24,13 +24,10 @@ public: Profile profile()const; - QString prof_name(); - QString prof_type(); + QString prof_name(); + QString prof_type(); public slots: - void accept(); - //void slotOk(); - void slotCancel(); - - void slotDevice(int id); + void accept(); + void slotDevice(int id); private: @@ -43,10 +40,10 @@ private: Profile m_prof; - QLineEdit *name_line; - QComboBox *device_box; + QLineEdit *name_line; + QComboBox *device_box; - QWidget *plugin_base; - ProfileEditorPlugin *plugin_plugin; - QHBoxLayout *plugin_layout; + QWidget *plugin_base; + ProfileEditorPlugin *plugin_plugin; + QHBoxLayout *plugin_layout; }; diff --git a/noncore/apps/opie-console/profileeditorplugins.cpp b/noncore/apps/opie-console/profileeditorplugins.cpp index b63fa1c..c11c854 100644 --- a/noncore/apps/opie-console/profileeditorplugins.cpp +++ b/noncore/apps/opie-console/profileeditorplugins.cpp @@ -11,4 +11,6 @@ #include "qcheckbox.h" #include "qbuttongroup.h" +#include "qhgroupbox.h" +#include "qvbox.h" #include "io_serial.h" @@ -37,4 +39,5 @@ QWidget *ProfileEditorPlugin::connection_widget() // Build GUI + QLabel *speedlabel = new QLabel(QObject::tr("Speed"), root); QComboBox *speed_box = new QComboBox(root); @@ -45,36 +48,31 @@ QWidget *ProfileEditorPlugin::connection_widget() 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); + QButtonGroup *group_flow = new QButtonGroup(QObject::tr("Flow control"), root); - // Build Layout + QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), group_flow); + QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), group_flow); + + QButtonGroup *group_parity = new QButtonGroup(QObject::tr("Parity"), root); + QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), group_parity); + QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), group_parity); + // Build Layout lroot = new QVBoxLayout(root); lroot->add(speedlabel); lroot->add(speed_box); - lroot->add(flow); - QHBoxLayout *hbox = new QHBoxLayout(lroot, 2); + lroot->setStretchFactor(speedlabel, 1); + lroot->setStretchFactor(speed_box, 1); + + QHBoxLayout *hbox = new QHBoxLayout(group_flow, 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); - + lroot->add(group_flow); + lroot->setStretchFactor(group_flow, 2); + + QHBoxLayout *hboxPar = new QHBoxLayout( group_parity, 2); + hboxPar->add(parity_odd); + hboxPar->add(parity_even); + lroot->add(group_parity); + lroot->setStretchFactor(group_parity, 2); // Apply profile settings @@ -111,4 +109,7 @@ QWidget *ProfileEditorPlugin::terminal_widget() // Build GUI + + QLabel *terminal = new QLabel(QObject::tr("Terminal type"), root); + QComboBox *terminal_box = new QComboBox(root); terminal_box->insertItem("VT 100", id_term_vt100); @@ -116,49 +117,41 @@ QWidget *ProfileEditorPlugin::terminal_widget() 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); - + QLabel *colourlabel = new QLabel(QObject::tr("Colour scheme"), 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); + QButtonGroup *group_size = new QButtonGroup( QObject::tr("Font size"), root ); + QRadioButton *size_small = new QRadioButton(QObject::tr("small"), group_size ); + QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), group_size ); + QRadioButton *size_large = new QRadioButton(QObject::tr("large"), group_size ); - QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), root); - QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), root); + QHGroupBox *group_conv = new QHGroupBox( QObject::tr("Line-break conversions"), root ); + QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), group_conv); + QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), group_conv); - QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), root); - QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), root); + QHGroupBox *group_options = new QHGroupBox( QObject::tr("Options"), root ); + QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), group_options); + QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), group_options); // Build Layout - lroot = new QVBoxLayout(root, 2); - lroot->add(terminal); - lroot->add(terminal_box); - lroot->add(sizelabel); - QHBoxLayout *hbox = new QHBoxLayout(lroot, 2); + + QVBoxLayout *typeBox = new QVBoxLayout( lroot ); + typeBox->add(terminal); + typeBox->add(terminal_box); + + QHBoxLayout *hbox = new QHBoxLayout( group_size, 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); + lroot->add( group_size ); + + QVBoxLayout *colourBox = new QVBoxLayout( lroot ); + colourBox->add(colourlabel); + colourBox->add(colour_box); + + lroot->add(group_conv); + lroot->add(group_options); // Apply profile settings @@ -319,5 +312,5 @@ class ProfileEditorPluginSerial : public ProfileEditorPlugin { public: - + ProfileEditorPluginSerial(QWidget *parent, Profile *p) : ProfileEditorPlugin(parent, p) @@ -333,21 +326,20 @@ class ProfileEditorPluginSerial : public ProfileEditorPlugin if(!m_widget) { - QFrame *device_frame = new QFrame(m_parent); - device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); - QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); + QWidget *device_frame = new QWidget( m_parent ); + QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); - device_line = new QLineEdit("/dev/ttyS0", 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); + QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2); + vbox_frame->add(frame_device); + vbox_frame->add(device_line); - m_widget = device_frame; + m_widget = device_frame; - // Load special settings + // Load special settings - QString dev = m_profile->readEntry("Device"); - if(!dev.isNull()) device_line->setText(dev); + QString dev = m_profile->readEntry("Device"); + if(!dev.isNull()) device_line->setText(dev); } @@ -382,6 +374,6 @@ class ProfileEditorPluginIrda : public ProfileEditorPlugin if(!m_widget) { - QFrame *device_frame = new QFrame(m_parent); - device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); + QWidget *device_frame = new QWidget(m_parent); + QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); @@ -430,6 +422,5 @@ class ProfileEditorPluginModem : public ProfileEditorPlugin if(!m_widget) { - QFrame *device_frame = new QFrame(m_parent); - device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); + QWidget *device_frame = new QWidget(m_parent); QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame); diff --git a/noncore/apps/opie-console/widget_layer.h b/noncore/apps/opie-console/widget_layer.h index 99d248e..adf2038 100644 --- a/noncore/apps/opie-console/widget_layer.h +++ b/noncore/apps/opie-console/widget_layer.h @@ -8,5 +8,5 @@ // // fellow devels: -// just mail me (ibotty@web.de), what you additionally need from the main widget +// just mail me (ibotty@web.de), what you additionally need from the main widget // (or say in chat) @@ -55,5 +55,5 @@ public: * sets the image */ - virtual void setImage( QArray<Character> const newimg, int lines, int colums ); + virtual void setImage( QArray<Character> const newimg, int lines, int colums ) = 0; /** @@ -66,5 +66,5 @@ public: */ int lines() { return m_lines; } - + /** * return the columns count @@ -121,5 +121,5 @@ signals: */ void selectionCleared(); - + /** * selection begin @@ -143,5 +143,5 @@ signals: // protected methods protected: - + // image operations @@ -166,7 +166,7 @@ protected: */ void clearImage(); - + protected slots: - + /** * clear selection @@ -177,5 +177,5 @@ protected slots: // protected vars protected: - + /** * current Session @@ -185,9 +185,9 @@ protected: /** * current character image - * + * * a Character at loc( column, line ) * has the actual index: * ix = line * m_columns + column; - * + * * use loc( x, y ) macro to access. */ @@ -210,5 +210,5 @@ protected: /** - * whether widget is resizing + * whether widget is resizing */ bool m_resizing; |