00001
00002
00003 #include "file_layer.h"
00004 #include "emulation_handler.h"
00005 #include "session.h"
00006
00007
00008 Session::Session() {
00009 m_widget = 0l;
00010 m_layer = 0l;
00011 m_emu = 0l;
00012 m_transfer = 0l;
00013 }
00014 Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay)
00015 : m_name( na ), m_widget( widget ), m_layer( lay )
00016 {
00017
00018
00019 m_emu = 0l;
00020 }
00021 Session::~Session() {
00022 delete m_layer;
00023 delete m_emu;
00024 delete m_widget;
00025
00026 }
00027 QString Session::name()const {
00028 return m_name;
00029 }
00030 QWidgetStack* Session::widgetStack() {
00031 return m_widget;
00032 }
00033 IOLayer* Session::layer() {
00034 return m_layer;
00035 }
00036 EmulationHandler* Session::emulationHandler() {
00037 return m_emu;
00038 }
00039 QWidget* Session::widget() {
00040 if (!m_emu )
00041 return 0l;
00042
00043 return m_emu->widget();
00044 }
00045 Profile Session::profile()const {
00046 return m_prof;
00047 }
00048
00049
00050
00051
00052
00053 void Session::connect() {
00054 if ( !m_layer || !m_emu )
00055 return;
00056
00057 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ),
00058 m_emu, SLOT(recv(const QByteArray&) ) );
00059 QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ),
00060 m_layer, SLOT(send(const QByteArray&) ) );
00061 QObject::connect(m_emu, SIGNAL(changeSize(int,int) ),
00062 m_layer, SLOT(setSize(int,int) ) );
00063 }
00064
00065 void Session::disconnect() {
00066
00067 if ( !m_layer || !m_emu )
00068 return;
00069
00070 QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ),
00071 m_emu, SLOT(recv(const QByteArray&) ) );
00072 QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ),
00073 m_layer, SLOT(send(const QByteArray&) ) );
00074 }
00075
00076 void Session::setName( const QString& na){
00077 m_name = na;
00078 }
00079
00080 void Session::setWidgetStack( QWidgetStack* wid ) {
00081 delete m_emu;
00082 m_emu = 0l;
00083 delete m_widget;
00084
00085
00086 m_widget = wid;
00087 }
00088 void Session::setIOLayer( IOLayer* lay ) {
00089 delete m_layer;
00090 m_layer = lay;
00091 }
00092
00093 void Session::setEmulationHandler( EmulationHandler* lay ) {
00094 delete m_emu;
00095 m_emu = lay;
00096 }
00097 void Session::setProfile( const Profile& prof ) {
00098 m_prof = prof;
00099 }
00100
00101
00102
00103
00104
00105
00106 void Session::setTransferDialog(QWidget *d)
00107 {
00108 m_transfer = d;
00109 }
00110
00111 QWidget *Session::transferDialog()
00112 {
00113 return m_transfer;
00114 }
00115