summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/session.cpp
blob: b7f14c5289f07302746cb52f6075ddb062bcc33a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115


#include "file_layer.h"
#include "emulation_handler.h"
#include "session.h"


Session::Session() {
    m_widget = 0l;
    m_layer = 0l;
    m_emu = 0l;
    m_transfer = 0l;
}
Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay)
    : m_name( na ), m_widget( widget ), m_layer( lay )
{
//    m_widLay = 0l;
//    m_emLay  = 0l;
    m_emu = 0l;
}
Session::~Session() {
    delete m_layer;
    delete m_emu;
    delete m_widget;
    /* the widget layer should be deleted by the m_widget */
}
QString Session::name()const {
    return m_name;
}
QWidgetStack* Session::widgetStack() {
    return m_widget;
}
IOLayer* Session::layer() {
    return m_layer;
}
EmulationHandler* Session::emulationHandler() {
    return m_emu;
}
QWidget* Session::widget() {
    if (!m_emu )
        return 0l;

    return m_emu->widget();
}
Profile Session::profile()const {
    return m_prof;
}
/*
WidgetLayer* Session::emulationWidget() {
    return m_widLay;
}
*/
void Session::connect() {
    if ( !m_layer || !m_emu )
        return;

    QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ),
            m_emu, SLOT(recv(const QByteArray&) ) );
    QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ),
            m_layer, SLOT(send(const QByteArray&) ) );
    QObject::connect(m_emu, SIGNAL(changeSize(int,int) ),
                     m_layer, SLOT(setSize(int,int) ) );
}

void Session::disconnect() {

    if ( !m_layer || !m_emu )
        return;

    QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ),
            m_emu, SLOT(recv(const QByteArray&) ) );
    QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ),
            m_layer, SLOT(send(const QByteArray&) ) );
}

void Session::setName( const QString& na){
    m_name = na;
}

void Session::setWidgetStack( QWidgetStack* wid ) {
    delete m_emu;
    m_emu = 0l;
    delete m_widget;
    /* the EmulationLayer was destroyed... */

    m_widget = wid;
}
void Session::setIOLayer( IOLayer* lay ) {
    delete m_layer;
    m_layer = lay;
}

void Session::setEmulationHandler( EmulationHandler* lay ) {
    delete m_emu;
    m_emu = lay;
}
void Session::setProfile( const Profile& prof ) {
    m_prof = prof;
}
/*
void Session::setEmulationWidget( WidgetLayer* lay ) {
    delete m_widLay;
    m_widLay = lay;
}
*/
void Session::setTransferDialog(QWidget *d)
{
    m_transfer = d;
}

QWidget *Session::transferDialog()
{
    return m_transfer;
}