author | harlekin <harlekin> | 2002-10-07 18:05:43 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-07 18:05:43 (UTC) |
commit | d55aa591770675008da9e3290617e463a77e4c98 (patch) (unidiff) | |
tree | 93d779cc85298545673f4d5f2ea0fcc7d4d301b7 /noncore/apps/opie-console/profileeditordialog.cpp | |
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
Diffstat (limited to 'noncore/apps/opie-console/profileeditordialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
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,7 +1,8 @@ | |||
1 | 1 | ||
2 | #include <opie/otabwidget.h> | ||
2 | #include "profileeditordialog.h" | 3 | #include "profileeditordialog.h" |
3 | 4 | ||
4 | #include "qlayout.h" | 5 | #include "qlayout.h" |
5 | #include "qlineedit.h" | 6 | #include "qlineedit.h" |
6 | #include "qlabel.h" | 7 | #include "qlabel.h" |
7 | #include "qmessagebox.h" | 8 | #include "qmessagebox.h" |
@@ -10,23 +11,23 @@ | |||
10 | 11 | ||
11 | #include "profileeditorplugins.h" | 12 | #include "profileeditorplugins.h" |
12 | #include "metafactory.h" | 13 | #include "metafactory.h" |
13 | 14 | ||
14 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | 15 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, |
15 | const Profile& prof ) | 16 | const Profile& prof ) |
16 | : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) | 17 | : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) |
17 | { | 18 | { |
18 | initUI(); | 19 | initUI(); |
19 | 20 | ||
20 | // Apply current profile | 21 | // Apply current profile |
21 | // plugin_plugin->load(profile); | 22 | // plugin_plugin->load(profile); |
22 | // ... (reset profile name line edit etc.) | 23 | // ... (reset profile name line edit etc.) |
23 | } | 24 | } |
24 | 25 | ||
25 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | 26 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) |
26 | : QTabDialog(0, 0, TRUE), m_fact( fact ) | 27 | : QDialog(0, 0, TRUE), m_fact( fact ) |
27 | { | 28 | { |
28 | // Default profile | 29 | // Default profile |
29 | m_prof = Profile(QString::null, "serial", Profile::Black, Profile::White, Profile::VT102); | 30 | m_prof = Profile(QString::null, "serial", Profile::Black, Profile::White, Profile::VT102); |
30 | 31 | ||
31 | initUI(); | 32 | initUI(); |
32 | 33 | ||
@@ -38,20 +39,25 @@ Profile ProfileEditorDialog::profile() const | |||
38 | { | 39 | { |
39 | return m_prof; | 40 | return m_prof; |
40 | } | 41 | } |
41 | 42 | ||
42 | void ProfileEditorDialog::initUI() | 43 | void ProfileEditorDialog::initUI() |
43 | { | 44 | { |
44 | QWidget *tabterm, *tabconn, *tabprof; | 45 | |
46 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | ||
47 | OTabWidget *tabWidget = new OTabWidget( this ); | ||
48 | mainLayout->add(tabWidget); | ||
49 | |||
50 | QWidget *tabterm, *tabconn, *tabprof; | ||
45 | 51 | ||
46 | tabprof = new QWidget(this); | 52 | tabprof = new QWidget(this); |
47 | tabterm = new QWidget(this); | 53 | tabterm = new QWidget(this); |
48 | tabconn = new QWidget(this); | 54 | tabconn = new QWidget(this); |
49 | 55 | ||
50 | // for the time being: fake factory | 56 | // for the time being: fake factory |
51 | 57 | ||
52 | m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); | 58 | m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); |
53 | m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); | 59 | m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); |
54 | m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); | 60 | m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); |
55 | 61 | ||
56 | // profile tab | 62 | // profile tab |
57 | 63 | ||
@@ -95,40 +101,38 @@ void ProfileEditorDialog::initUI() | |||
95 | 101 | ||
96 | QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); | 102 | QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2); |
97 | vbox->add(device); | 103 | vbox->add(device); |
98 | vbox->add(device_box); | 104 | vbox->add(device_box); |
99 | vbox->add(plugin_base); | 105 | vbox->add(plugin_base); |
100 | vbox->add(conn_widget); | 106 | vbox->add(conn_widget); |
107 | vbox->setStretchFactor(device, 1); | ||
108 | vbox->setStretchFactor(device_box, 1); | ||
109 | vbox->setStretchFactor(plugin_base, 1); | ||
110 | vbox->setStretchFactor(conn_widget, 7); | ||
101 | 111 | ||
102 | QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); | 112 | QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); |
103 | vbox2->add(term_widget); | 113 | vbox2->add(term_widget); |
104 | 114 | ||
105 | addTab(tabprof, QObject::tr("Profile")); | 115 | tabWidget->addTab(tabprof, "", QObject::tr("Profile")); |
106 | addTab(tabconn, QObject::tr("Connection")); | 116 | tabWidget->addTab(tabconn, "", QObject::tr("Connection")); |
107 | addTab(tabterm, QObject::tr("Terminal")); | 117 | tabWidget->addTab(tabterm, "", QObject::tr("Terminal")); |
108 | |||
109 | setOkButton(QObject::tr("OK")); | ||
110 | setCancelButton(QObject::tr("Cancel")); | ||
111 | 118 | ||
112 | // load profile values | 119 | // load profile values |
113 | |||
114 | name_line->setText(m_prof.name()); | 120 | name_line->setText(m_prof.name()); |
115 | for(int i = 0; i < device_box->count(); i++) | 121 | for(int i = 0; i < device_box->count(); i++) |
116 | { | 122 | { |
117 | device_box->setCurrentItem(i); | 123 | device_box->setCurrentItem(i); |
118 | if(prof_type() == m_prof.ioLayerName()) | 124 | if(prof_type() == m_prof.ioLayerName()) |
119 | { | 125 | { |
120 | slotDevice(i); | 126 | slotDevice(i); |
121 | break; | 127 | break; |
122 | } | 128 | } |
123 | } | 129 | } |
124 | 130 | ||
125 | // signals | 131 | // signals |
126 | 132 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); | |
127 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); | ||
128 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); | ||
129 | } | 133 | } |
130 | 134 | ||
131 | ProfileEditorDialog::~ProfileEditorDialog() { | 135 | ProfileEditorDialog::~ProfileEditorDialog() { |
132 | 136 | ||
133 | } | 137 | } |
134 | 138 | ||
@@ -163,16 +167,12 @@ void ProfileEditorDialog::accept() | |||
163 | m_prof.setName(prof_name()); | 167 | m_prof.setName(prof_name()); |
164 | m_prof.setIOLayer(prof_type()); | 168 | m_prof.setIOLayer(prof_type()); |
165 | 169 | ||
166 | QDialog::accept(); | 170 | QDialog::accept(); |
167 | } | 171 | } |
168 | 172 | ||
169 | void ProfileEditorDialog::slotCancel() | ||
170 | { | ||
171 | reject(); | ||
172 | } | ||
173 | 173 | ||
174 | QString ProfileEditorDialog::prof_name() | 174 | QString ProfileEditorDialog::prof_name() |
175 | { | 175 | { |
176 | return name_line->text(); | 176 | return name_line->text(); |
177 | } | 177 | } |
178 | 178 | ||