author | josef <josef> | 2002-10-07 10:02:58 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-07 10:02:58 (UTC) |
commit | 46171dcd991e8c3bfff8e662b3913f454714560a (patch) (unidiff) | |
tree | c596e53f6b308ffef0f2da1ccf538c79693bd5e5 | |
parent | d4c3a54affe5497b84e48f52d411391818790cba (diff) | |
download | opie-46171dcd991e8c3bfff8e662b3913f454714560a.zip opie-46171dcd991e8c3bfff8e662b3913f454714560a.tar.gz opie-46171dcd991e8c3bfff8e662b3913f454714560a.tar.bz2 |
- load profiles correctly when editing them
- save their general values after editing them
- fix compilation of widget_layer (temporary workaround?)
-rw-r--r-- | noncore/apps/opie-console/configdialog.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/widget_layer.h | 4 |
4 files changed, 19 insertions, 7 deletions
diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp index 23e94b1..655d649 100644 --- a/noncore/apps/opie-console/configdialog.cpp +++ b/noncore/apps/opie-console/configdialog.cpp | |||
@@ -37,66 +37,68 @@ ConfigDialog::ConfigDialog( const Profile::ValueList& lis, QWidget* parent ) | |||
37 | Profile::ValueList::ConstIterator it; | 37 | Profile::ValueList::ConstIterator it; |
38 | for (it = lis.begin(); it != lis.end(); ++it ) { | 38 | for (it = lis.begin(); it != lis.end(); ++it ) { |
39 | new ConfigListItem( lstView, (*it) ); | 39 | new ConfigListItem( lstView, (*it) ); |
40 | } | 40 | } |
41 | } | 41 | } |
42 | } | 42 | } |
43 | ConfigDialog::~ConfigDialog() { | 43 | ConfigDialog::~ConfigDialog() { |
44 | 44 | ||
45 | } | 45 | } |
46 | Profile::ValueList ConfigDialog::list()const { | 46 | Profile::ValueList ConfigDialog::list()const { |
47 | /* iterate over the list */ | 47 | /* iterate over the list */ |
48 | Profile::ValueList lst; | 48 | Profile::ValueList lst; |
49 | QListViewItemIterator it(lstView); | 49 | QListViewItemIterator it(lstView); |
50 | for ( ; it.current(); ++it ) { | 50 | for ( ; it.current(); ++it ) { |
51 | ConfigListItem* item = (ConfigListItem*)it.current(); | 51 | ConfigListItem* item = (ConfigListItem*)it.current(); |
52 | lst.append( item->profile() ); | 52 | lst.append( item->profile() ); |
53 | } | 53 | } |
54 | return lst; | 54 | return lst; |
55 | } | 55 | } |
56 | /* our slots */ | 56 | /* our slots */ |
57 | void ConfigDialog::slotRemove() { | 57 | void ConfigDialog::slotRemove() { |
58 | ConfigListItem* item = (ConfigListItem*)lstView->currentItem(); | 58 | ConfigListItem* item = (ConfigListItem*)lstView->currentItem(); |
59 | if (!item ) | 59 | if (!item ) |
60 | return; | 60 | return; |
61 | 61 | ||
62 | lstView->takeItem( item ); | 62 | lstView->takeItem( item ); |
63 | delete item; | 63 | delete item; |
64 | } | 64 | } |
65 | 65 | ||
66 | void ConfigDialog::slotEdit() { | 66 | void ConfigDialog::slotEdit() { |
67 | Profile p; | 67 | Profile p; |
68 | 68 | ||
69 | if(!lstView->currentItem()) return; | ||
70 | |||
69 | // Load profile | 71 | // Load profile |
70 | // p = currentItem()->profile(); | 72 | p = ((ConfigListItem*)lstView->currentItem())->profile(); |
71 | 73 | ||
72 | ProfileEditorDialog dlg(new MetaFactory(), p); | 74 | ProfileEditorDialog dlg(new MetaFactory(), p); |
73 | 75 | ||
74 | dlg.setCaption("Edit Connection Profile"); | 76 | dlg.setCaption("Edit Connection Profile"); |
75 | dlg.showMaximized(); | 77 | dlg.showMaximized(); |
76 | int ret = dlg.exec(); | 78 | int ret = dlg.exec(); |
77 | 79 | ||
78 | if(ret == QDialog::Accepted) | 80 | if(ret == QDialog::Accepted) |
79 | { | 81 | { |
80 | // if(listView->current()) delete lstView->current(); ... | 82 | // if(listView->current()) delete lstView->current(); ... |
81 | // use dlg.terminal()! | 83 | // use dlg.terminal()! |
82 | new ConfigListItem(lstView, Profile(dlg.prof_name(), dlg.prof_type(), Profile::White, Profile::Black, Profile::VT102)); | 84 | new ConfigListItem(lstView, Profile(dlg.prof_name(), dlg.prof_type(), Profile::White, Profile::Black, Profile::VT102)); |
83 | } | 85 | } |
84 | } | 86 | } |
85 | 87 | ||
86 | 88 | ||
87 | void ConfigDialog::slotAdd() { | 89 | void ConfigDialog::slotAdd() { |
88 | ProfileEditorDialog dlg(new MetaFactory()); | 90 | ProfileEditorDialog dlg(new MetaFactory()); |
89 | 91 | ||
90 | dlg.setCaption("New Connection"); | 92 | dlg.setCaption("New Connection"); |
91 | dlg.showMaximized(); | 93 | dlg.showMaximized(); |
92 | int ret = dlg.exec(); | 94 | int ret = dlg.exec(); |
93 | 95 | ||
94 | if(ret == QDialog::Accepted) | 96 | if(ret == QDialog::Accepted) |
95 | { | 97 | { |
96 | // TODO: Move into general profile save part | 98 | // TODO: Move into general profile save part |
97 | // assignments | 99 | // assignments |
98 | //QString type = dlg.term_type(); | 100 | //QString type = dlg.term_type(); |
99 | //if(type == "VT102") profile = Profile::VT102; | 101 | //if(type == "VT102") profile = Profile::VT102; |
100 | 102 | ||
101 | // get profile from editor | 103 | // get profile from editor |
102 | Profile p = dlg.profile(); | 104 | Profile p = dlg.profile(); |
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index 6d70dfd..768e453 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro | |||
@@ -1,53 +1,55 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | #CONFIG = qt warn_on release | 2 | #CONFIG = qt warn_on release |
3 | CONFIG = qt debug | 3 | CONFIG = qt debug |
4 | DESTDIR = $(OPIEDIR)/bin | 4 | DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = io_layer.h io_serial.h \ | 5 | HEADERS = io_layer.h io_serial.h \ |
6 | file_layer.h sz_transfer.h \ | 6 | file_layer.h sz_transfer.h \ |
7 | metafactory.h \ | 7 | metafactory.h \ |
8 | session.h \ | 8 | session.h \ |
9 | mainwindow.h \ | 9 | mainwindow.h \ |
10 | profile.h \ | 10 | profile.h \ |
11 | profileconfig.h \ | 11 | profileconfig.h \ |
12 | profilemanager.h \ | 12 | profilemanager.h \ |
13 | configwidget.h \ | 13 | configwidget.h \ |
14 | tabwidget.h \ | 14 | tabwidget.h \ |
15 | configdialog.h \ | 15 | configdialog.h \ |
16 | profileeditordialog.h \ | 16 | profileeditordialog.h \ |
17 | profileeditorplugins.h \ | 17 | profileeditorplugins.h \ |
18 | emulation_layer.h \ | 18 | emulation_layer.h \ |
19 | widget.h \ | 19 | widget.h \ |
20 | vt102emulation.h \ | 20 | vt102emulation.h \ |
21 | common.h \ | 21 | common.h \ |
22 | history.h \ | 22 | history.h \ |
23 | screen.h \ | 23 | screen.h \ |
24 | keytrans.h \ | 24 | keytrans.h \ |
25 | widget_layer.h | 25 | widget_layer.h \ |
26 | transferdialog.h | ||
26 | 27 | ||
27 | SOURCES = io_layer.cpp io_serial.cpp \ | 28 | SOURCES = io_layer.cpp io_serial.cpp \ |
28 | file_layer.cpp sz_transfer.cpp \ | 29 | file_layer.cpp sz_transfer.cpp \ |
29 | main.cpp \ | 30 | main.cpp \ |
30 | metafactory.cpp \ | 31 | metafactory.cpp \ |
31 | session.cpp \ | 32 | session.cpp \ |
32 | mainwindow.cpp \ | 33 | mainwindow.cpp \ |
33 | profile.cpp \ | 34 | profile.cpp \ |
34 | profileconfig.cpp \ | 35 | profileconfig.cpp \ |
35 | profilemanager.cpp \ | 36 | profilemanager.cpp \ |
36 | tabwidget.cpp \ | 37 | tabwidget.cpp \ |
37 | configdialog.cpp \ | 38 | configdialog.cpp \ |
38 | profileeditordialog.cpp \ | 39 | profileeditordialog.cpp \ |
39 | profileeditorplugins.cpp \ | 40 | profileeditorplugins.cpp \ |
40 | emulation_layer.cpp \ | 41 | emulation_layer.cpp \ |
41 | widget.cpp \ | 42 | widget.cpp \ |
42 | vt102emulation.cpp \ | 43 | vt102emulation.cpp \ |
43 | history.cpp \ | 44 | history.cpp \ |
44 | screen.cpp \ | 45 | screen.cpp \ |
45 | keytrans.cpp \ | 46 | keytrans.cpp \ |
46 | widget_layer.cpp | 47 | widget_layer.cpp \ |
48 | transferdialog.cpp | ||
47 | 49 | ||
48 | INTERFACES = configurebase.ui editbase.ui | 50 | INTERFACES = configurebase.ui editbase.ui |
49 | INCLUDEPATH += $(OPIEDIR)/include | 51 | INCLUDEPATH += $(OPIEDIR)/include |
50 | DEPENDPATH += $(OPIEDIR)/include | 52 | DEPENDPATH += $(OPIEDIR)/include |
51 | LIBS += -lqpe -lopie | 53 | LIBS += -lqpe -lopie |
52 | TARGET = opie-console | 54 | TARGET = opie-console |
53 | 55 | ||
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index fbe0f23..fc95e56 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -1,64 +1,64 @@ | |||
1 | 1 | ||
2 | #include "profileeditordialog.h" | 2 | #include "profileeditordialog.h" |
3 | 3 | ||
4 | #include "qlayout.h" | 4 | #include "qlayout.h" |
5 | #include "qlineedit.h" | 5 | #include "qlineedit.h" |
6 | #include "qlabel.h" | 6 | #include "qlabel.h" |
7 | #include "qradiobutton.h" | 7 | #include "qradiobutton.h" |
8 | #include "qcombobox.h" | 8 | #include "qcombobox.h" |
9 | #include "qcheckbox.h" | 9 | #include "qcheckbox.h" |
10 | #include "qmessagebox.h" | 10 | #include "qmessagebox.h" |
11 | #include "qbuttongroup.h" | 11 | #include "qbuttongroup.h" |
12 | #include "qstringlist.h" | 12 | #include "qstringlist.h" |
13 | 13 | ||
14 | #include "profileeditorplugins.h" | 14 | #include "profileeditorplugins.h" |
15 | #include "metafactory.h" | 15 | #include "metafactory.h" |
16 | 16 | ||
17 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | 17 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, |
18 | const Profile& prof ) | 18 | const Profile& prof ) |
19 | : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) | 19 | : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) |
20 | { | 20 | { |
21 | initUI(); | 21 | initUI(); |
22 | 22 | ||
23 | // Apply current profile | 23 | // Apply current profile |
24 | // plugin_plugin->load(profile); | 24 | // plugin_plugin->load(profile); |
25 | // ... (reset profile name line edit etc.) | 25 | // ... (reset profile name line edit etc.) |
26 | } | 26 | } |
27 | 27 | ||
28 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | 28 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) |
29 | : QTabDialog(0, 0, TRUE), m_fact( fact ) | 29 | : QTabDialog(0, 0, TRUE), m_fact( fact ) |
30 | { | 30 | { |
31 | // Default profile | 31 | // Default profile |
32 | m_prof = Profile("serial", QString::null, Profile::Black, Profile::White, Profile::VT102); | 32 | m_prof = Profile(QString::null, "serial", Profile::Black, Profile::White, Profile::VT102); |
33 | 33 | ||
34 | initUI(); | 34 | initUI(); |
35 | 35 | ||
36 | // Apply current profile | 36 | // Apply current profile |
37 | // plugin_plugin->load(profile); | 37 | // plugin_plugin->load(profile); |
38 | } | 38 | } |
39 | 39 | ||
40 | Profile ProfileEditorDialog::profile() const | 40 | Profile ProfileEditorDialog::profile() const |
41 | { | 41 | { |
42 | return m_prof; | 42 | return m_prof; |
43 | } | 43 | } |
44 | 44 | ||
45 | void ProfileEditorDialog::initUI() | 45 | void ProfileEditorDialog::initUI() |
46 | { | 46 | { |
47 | QWidget *tabterm, *tabconn, *tabprof; | 47 | QWidget *tabterm, *tabconn, *tabprof; |
48 | 48 | ||
49 | tabprof = new QWidget(this); | 49 | tabprof = new QWidget(this); |
50 | tabterm = new QWidget(this); | 50 | tabterm = new QWidget(this); |
51 | tabconn = new QWidget(this); | 51 | tabconn = new QWidget(this); |
52 | 52 | ||
53 | // for the time being: fake factory | 53 | // for the time being: fake factory |
54 | 54 | ||
55 | m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); | 55 | m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); |
56 | m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); | 56 | m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); |
57 | m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); | 57 | m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); |
58 | 58 | ||
59 | // profile tab | 59 | // profile tab |
60 | 60 | ||
61 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); | 61 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); |
62 | 62 | ||
63 | name_line = new QLineEdit(tabprof); | 63 | name_line = new QLineEdit(tabprof); |
64 | 64 | ||
@@ -165,101 +165,109 @@ void ProfileEditorDialog::initUI() | |||
165 | QHBoxLayout *hbox2 = new QHBoxLayout(vbox, 2); | 165 | QHBoxLayout *hbox2 = new QHBoxLayout(vbox, 2); |
166 | hbox2->add(parity_odd); | 166 | hbox2->add(parity_odd); |
167 | hbox2->add(parity_even); | 167 | hbox2->add(parity_even); |
168 | //vbox->add(group_parity); | 168 | //vbox->add(group_parity); |
169 | 169 | ||
170 | QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); | 170 | QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2); |
171 | vbox2->add(terminal); | 171 | vbox2->add(terminal); |
172 | vbox2->add(terminal_box); | 172 | vbox2->add(terminal_box); |
173 | vbox2->add(size); | 173 | vbox2->add(size); |
174 | QHBoxLayout *hbox3 = new QHBoxLayout(vbox2, 2); | 174 | QHBoxLayout *hbox3 = new QHBoxLayout(vbox2, 2); |
175 | hbox3->add(size_small); | 175 | hbox3->add(size_small); |
176 | hbox3->add(size_medium); | 176 | hbox3->add(size_medium); |
177 | hbox3->add(size_large); | 177 | hbox3->add(size_large); |
178 | //vbox2->add(group_size); | 178 | //vbox2->add(group_size); |
179 | vbox2->add(colour); | 179 | vbox2->add(colour); |
180 | vbox2->add(colour_box); | 180 | vbox2->add(colour_box); |
181 | vbox2->add(conversions); | 181 | vbox2->add(conversions); |
182 | QHBoxLayout *hbox5 = new QHBoxLayout(vbox2, 2); | 182 | QHBoxLayout *hbox5 = new QHBoxLayout(vbox2, 2); |
183 | hbox5->add(conv_inbound); | 183 | hbox5->add(conv_inbound); |
184 | hbox5->add(conv_outbound); | 184 | hbox5->add(conv_outbound); |
185 | vbox2->add(options); | 185 | vbox2->add(options); |
186 | QHBoxLayout *hbox4 = new QHBoxLayout(vbox2, 2); | 186 | QHBoxLayout *hbox4 = new QHBoxLayout(vbox2, 2); |
187 | hbox4->add(option_wrap); | 187 | hbox4->add(option_wrap); |
188 | hbox4->add(option_echo); | 188 | hbox4->add(option_echo); |
189 | 189 | ||
190 | addTab(tabprof, QObject::tr("Profile")); | 190 | addTab(tabprof, QObject::tr("Profile")); |
191 | addTab(tabconn, QObject::tr("Connection")); | 191 | addTab(tabconn, QObject::tr("Connection")); |
192 | addTab(tabterm, QObject::tr("Terminal")); | 192 | addTab(tabterm, QObject::tr("Terminal")); |
193 | 193 | ||
194 | setOkButton(QObject::tr("OK")); | 194 | setOkButton(QObject::tr("OK")); |
195 | setCancelButton(QObject::tr("Cancel")); | 195 | setCancelButton(QObject::tr("Cancel")); |
196 | 196 | ||
197 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); | 197 | // load profile values |
198 | |||
199 | name_line->setText(m_prof.name()); | ||
200 | |||
201 | // signals | ||
198 | 202 | ||
203 | connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel())); | ||
199 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); | 204 | connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int))); |
200 | } | 205 | } |
201 | 206 | ||
202 | ProfileEditorDialog::~ProfileEditorDialog() { | 207 | ProfileEditorDialog::~ProfileEditorDialog() { |
203 | 208 | ||
204 | } | 209 | } |
205 | 210 | ||
206 | void ProfileEditorDialog::slotDevice(int id) | 211 | void ProfileEditorDialog::slotDevice(int id) |
207 | { | 212 | { |
208 | delete plugin_plugin; | 213 | delete plugin_plugin; |
209 | 214 | ||
210 | plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, m_prof); | 215 | plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, m_prof); |
211 | plugin_layout->add(plugin_plugin->widget()); | 216 | plugin_layout->add(plugin_plugin->widget()); |
212 | 217 | ||
213 | // Reload profile associated to device, including e.g. conn_device() | 218 | // Reload profile associated to device, including e.g. conn_device() |
214 | // m_prof = plugin_plugin->profile() | 219 | // m_prof = plugin_plugin->profile() |
215 | // or, keeping the profile name: m_prof->reload(plugin_plugin->profile()) | 220 | // or, keeping the profile name: m_prof->reload(plugin_plugin->profile()) |
216 | 221 | ||
217 | //plugin_plugin->show(); | 222 | //plugin_plugin->show(); |
218 | plugin_plugin->widget()->show(); | 223 | plugin_plugin->widget()->show(); |
219 | } | 224 | } |
220 | 225 | ||
221 | void ProfileEditorDialog::accept() | 226 | void ProfileEditorDialog::accept() |
222 | { | 227 | { |
223 | if(prof_name().isEmpty()) | 228 | if(prof_name().isEmpty()) |
224 | { | 229 | { |
225 | QMessageBox::information(this, | 230 | QMessageBox::information(this, |
226 | QObject::tr("Invalid profile"), | 231 | QObject::tr("Invalid profile"), |
227 | QObject::tr("Please enter a profile name.")); | 232 | QObject::tr("Please enter a profile name.")); |
228 | return; | 233 | return; |
229 | } | 234 | } |
230 | 235 | ||
231 | // Save profile and plugin profile | 236 | // Save profile and plugin profile |
232 | if(plugin_plugin) plugin_plugin->save(); | 237 | if(plugin_plugin) plugin_plugin->save(); |
233 | 238 | ||
239 | // Save general values | ||
240 | m_prof.setName(prof_name()); | ||
241 | |||
234 | QDialog::accept(); | 242 | QDialog::accept(); |
235 | } | 243 | } |
236 | 244 | ||
237 | void ProfileEditorDialog::slotCancel() | 245 | void ProfileEditorDialog::slotCancel() |
238 | { | 246 | { |
239 | reject(); | 247 | reject(); |
240 | } | 248 | } |
241 | 249 | ||
242 | QString ProfileEditorDialog::prof_name() | 250 | QString ProfileEditorDialog::prof_name() |
243 | { | 251 | { |
244 | return name_line->text(); | 252 | return name_line->text(); |
245 | } | 253 | } |
246 | 254 | ||
247 | QString ProfileEditorDialog::prof_type() | 255 | QString ProfileEditorDialog::prof_type() |
248 | { | 256 | { |
249 | QStringList w = m_fact->configWidgets(); | 257 | QStringList w = m_fact->configWidgets(); |
250 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) | 258 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) |
251 | if(device_box->currentText() == m_fact->name((*it))) return (*it); | 259 | if(device_box->currentText() == m_fact->name((*it))) return (*it); |
252 | 260 | ||
253 | return QString::null; | 261 | return QString::null; |
254 | } | 262 | } |
255 | 263 | ||
256 | QString ProfileEditorDialog::conn_device() | 264 | QString ProfileEditorDialog::conn_device() |
257 | { | 265 | { |
258 | //return frame_device_line->text(); | 266 | //return frame_device_line->text(); |
259 | return "/dev/ttyS0"; | 267 | return "/dev/ttyS0"; |
260 | } | 268 | } |
261 | 269 | ||
262 | QString ProfileEditorDialog::term_type() | 270 | QString ProfileEditorDialog::term_type() |
263 | { | 271 | { |
264 | return terminal_box->currentText(); | 272 | return terminal_box->currentText(); |
265 | } | 273 | } |
diff --git a/noncore/apps/opie-console/widget_layer.h b/noncore/apps/opie-console/widget_layer.h index 3cdd6aa..07ec12a 100644 --- a/noncore/apps/opie-console/widget_layer.h +++ b/noncore/apps/opie-console/widget_layer.h | |||
@@ -14,65 +14,65 @@ | |||
14 | #define WIDGET_LAYER_H | 14 | #define WIDGET_LAYER_H |
15 | 15 | ||
16 | // qt includes | 16 | // qt includes |
17 | #include <qapplication.h> | 17 | #include <qapplication.h> |
18 | #include <qtimer.h> | 18 | #include <qtimer.h> |
19 | #include <qkeycode.h> | 19 | #include <qkeycode.h> |
20 | #include <qclipboard.h> | 20 | #include <qclipboard.h> |
21 | 21 | ||
22 | 22 | ||
23 | // opie-console includes | 23 | // opie-console includes |
24 | #include "session.h" | 24 | #include "session.h" |
25 | #include "common.h" | 25 | #include "common.h" |
26 | 26 | ||
27 | class WidgetLayer : public QObject | 27 | class WidgetLayer : public QObject |
28 | { Q_OBJECT | 28 | { Q_OBJECT |
29 | 29 | ||
30 | public: | 30 | public: |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * constructor | 33 | * constructor |
34 | */ | 34 | */ |
35 | WidgetLayer( QObject *parent=0, const char *name=0 ); | 35 | WidgetLayer( QObject *parent=0, const char *name=0 ); |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * destructor | 38 | * destructor |
39 | */ | 39 | */ |
40 | virtual ~WidgetLayer(); | 40 | virtual ~WidgetLayer(); |
41 | 41 | ||
42 | public: | 42 | public: |
43 | /** | 43 | /** |
44 | * sets the image | 44 | * sets the image |
45 | */ | 45 | */ |
46 | virtual void setImage( const Character* const newimg, int lines, int colums ); | 46 | virtual void setImage( const Character* const newimg, int lines, int colums ) = 0; |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * annoy the user | 49 | * annoy the user |
50 | */ | 50 | */ |
51 | void bell(); | 51 | void bell(); |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * return the lines count | 54 | * return the lines count |
55 | */ | 55 | */ |
56 | int lines(){ return m_lines; } | 56 | int lines(){ return m_lines; } |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * return the columns count | 59 | * return the columns count |
60 | */ | 60 | */ |
61 | int columns(){ return m_columns; } | 61 | int columns(){ return m_columns; } |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * insert current selection (currently this is only the clipboard) | 64 | * insert current selection (currently this is only the clipboard) |
65 | */ | 65 | */ |
66 | void insertSelection(); | 66 | void insertSelection(); |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * insert text | 69 | * insert text |
70 | */ | 70 | */ |
71 | void insertText( QString text ); | 71 | void insertText( QString text ); |
72 | /** | 72 | /** |
73 | * set selection (clipboard) to text | 73 | * set selection (clipboard) to text |
74 | */ | 74 | */ |
75 | void setSelection( const QString &text ); | 75 | void setSelection( const QString &text ); |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * paste content of clipboard | 78 | * paste content of clipboard |
@@ -114,65 +114,65 @@ signals: | |||
114 | * selection begin | 114 | * selection begin |
115 | */ | 115 | */ |
116 | void selectionBegin( const int x, const int y ); | 116 | void selectionBegin( const int x, const int y ); |
117 | 117 | ||
118 | /** | 118 | /** |
119 | * selection extended | 119 | * selection extended |
120 | * (from begin (s.a.) to x, y) | 120 | * (from begin (s.a.) to x, y) |
121 | */ | 121 | */ |
122 | void selectionExtended( const int x, const int y ); | 122 | void selectionExtended( const int x, const int y ); |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * selection end | 125 | * selection end |
126 | * bool: preserve line breaks in selection | 126 | * bool: preserve line breaks in selection |
127 | */ | 127 | */ |
128 | void selectionEnd( const bool lineBreakPreserve ); | 128 | void selectionEnd( const bool lineBreakPreserve ); |
129 | 129 | ||
130 | 130 | ||
131 | 131 | ||
132 | // protected methods | 132 | // protected methods |
133 | protected: | 133 | protected: |
134 | 134 | ||
135 | // image operations | 135 | // image operations |
136 | 136 | ||
137 | /** | 137 | /** |
138 | * changes image, to suit new size | 138 | * changes image, to suit new size |
139 | * TODO: find meaningful name! | 139 | * TODO: find meaningful name! |
140 | */ | 140 | */ |
141 | void propagateSize(); | 141 | void propagateSize(); |
142 | 142 | ||
143 | /** | 143 | /** |
144 | * | 144 | * |
145 | */ | 145 | */ |
146 | virtual void calcGeometry(); | 146 | virtual void calcGeometry() = 0; |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * makes an empty image | 149 | * makes an empty image |
150 | */ | 150 | */ |
151 | void makeImage(); | 151 | void makeImage(); |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * clears the image | 154 | * clears the image |
155 | */ | 155 | */ |
156 | void clearImage(); | 156 | void clearImage(); |
157 | 157 | ||
158 | protected slots: | 158 | protected slots: |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * clear selection | 161 | * clear selection |
162 | */ | 162 | */ |
163 | void onClearSelection(); | 163 | void onClearSelection(); |
164 | 164 | ||
165 | 165 | ||
166 | // protected vars | 166 | // protected vars |
167 | protected: | 167 | protected: |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * current Session | 170 | * current Session |
171 | */ | 171 | */ |
172 | Session *m_session; | 172 | Session *m_session; |
173 | 173 | ||
174 | /** | 174 | /** |
175 | * current character image | 175 | * current character image |
176 | */ | 176 | */ |
177 | QArray<Character> m_image; | 177 | QArray<Character> m_image; |
178 | 178 | ||