Diffstat (limited to 'noncore/apps/opie-console/session.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/session.cpp | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp index d32b340..42b0583 100644 --- a/noncore/apps/opie-console/session.cpp +++ b/noncore/apps/opie-console/session.cpp | |||
@@ -3,22 +3,31 @@ | |||
3 | #include "io_layer.h" | 3 | #include "io_layer.h" |
4 | #include "file_layer.h" | 4 | #include "file_layer.h" |
5 | #include "widget.h" | ||
6 | #include "emulation_layer.h" | ||
5 | #include "session.h" | 7 | #include "session.h" |
6 | 8 | ||
9 | |||
7 | Session::Session() { | 10 | Session::Session() { |
8 | m_widget = 0l; | 11 | m_widget = 0l; |
9 | m_layer = 0l; | 12 | m_layer = 0l; |
13 | m_widLay = 0l; | ||
14 | m_emLay = 0l; | ||
10 | } | 15 | } |
11 | Session::Session( const QString& na, QWidget* widget, IOLayer* lay) | 16 | Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay) |
12 | : m_name( na ), m_widget( widget ), m_layer( lay ) | 17 | : m_name( na ), m_widget( widget ), m_layer( lay ) |
13 | { | 18 | { |
19 | m_widLay = 0l; | ||
20 | m_emLay = 0l; | ||
14 | } | 21 | } |
15 | Session::~Session() { | 22 | Session::~Session() { |
16 | delete m_layer; | 23 | delete m_layer; |
24 | delete m_emLay; | ||
17 | delete m_widget; | 25 | delete m_widget; |
26 | /* the widget layer should be deleted by the m_widget */ | ||
18 | } | 27 | } |
19 | QString Session::name()const { | 28 | QString Session::name()const { |
20 | return m_name; | 29 | return m_name; |
21 | } | 30 | } |
22 | QWidget* Session::widget() { | 31 | QWidgetStack* Session::widgetStack() { |
23 | return m_widget; | 32 | return m_widget; |
24 | } | 33 | } |
@@ -26,9 +35,35 @@ IOLayer* Session::layer() { | |||
26 | return m_layer; | 35 | return m_layer; |
27 | } | 36 | } |
37 | EmulationLayer* Session::emulationLayer() { | ||
38 | return m_emLay; | ||
39 | } | ||
40 | Widget* Session::emulationWidget() { | ||
41 | return m_widLay; | ||
42 | } | ||
43 | void Session::connect() { | ||
44 | if ( !m_layer || !m_emLay ) | ||
45 | return; | ||
46 | |||
47 | QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), | ||
48 | m_emLay, SLOT(onRcvBlock(const QByteArray&) ) ); | ||
49 | QObject::connect(m_emLay, SIGNAL(sndBlock(const QByteArray&) ), | ||
50 | m_layer, SLOT(send(const QByteArray&) ) ); | ||
51 | } | ||
52 | void Session::disconnect() { | ||
53 | if ( !m_layer || !m_emLay ) | ||
54 | return; | ||
55 | |||
56 | QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), | ||
57 | m_emLay, SLOT(onRcvBlock(const QByteArray&) ) ); | ||
58 | QObject::disconnect(m_emLay, SIGNAL(sndBlock(const QByteArray&) ), | ||
59 | m_layer, SLOT(send(const QByteArray&) ) ); | ||
60 | } | ||
28 | void Session::setName( const QString& na){ | 61 | void Session::setName( const QString& na){ |
29 | m_name = na; | 62 | m_name = na; |
30 | } | 63 | } |
31 | void Session::setWidget( QWidget* wid ) { | 64 | void Session::setWidgetStack( QWidgetStack* wid ) { |
32 | delete m_widget; | 65 | delete m_widget; |
66 | /* the EmulationLayer was destroyed... */ | ||
67 | delete m_emLay; | ||
33 | m_widget = wid; | 68 | m_widget = wid; |
34 | } | 69 | } |
@@ -37,2 +72,10 @@ void Session::setIOLayer( IOLayer* lay ) { | |||
37 | m_layer = lay; | 72 | m_layer = lay; |
38 | } | 73 | } |
74 | void Session::setEmulationLayer( EmulationLayer* lay ) { | ||
75 | delete m_emLay; | ||
76 | m_emLay = lay; | ||
77 | } | ||
78 | void Session::setEmulationWidget( Widget* lay ) { | ||
79 | delete m_widLay; | ||
80 | m_widLay = lay; | ||
81 | } | ||