Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
1274ba86
Commit
1274ba86
authored
Sep 28, 2005
by
jpbl
Browse files
better handling of TCPSessionIO::connected
parent
b92c4771
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/gui/official/PhoneLineManagerImpl.cpp
View file @
1274ba86
...
...
@@ -19,9 +19,9 @@ PhoneLineManagerImpl::PhoneLineManagerImpl()
}
void
PhoneLineManagerImpl
::
connec
t
()
PhoneLineManagerImpl
::
star
t
()
{
//
mSession.getEvents();
mSession
.
getEvents
();
}
...
...
src/gui/official/PhoneLineManagerImpl.hpp
View file @
1274ba86
...
...
@@ -46,7 +46,7 @@ signals:
void
selected
(
unsigned
int
);
public
slots
:
void
connec
t
();
void
star
t
();
void
sendKey
(
Qt
::
Key
c
);
...
...
src/gui/official/SessionFactory.hpp
0 → 100644
View file @
1274ba86
/**
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Jean-Philippe Barrette-LaPierre
* <jean-philippe.barrette-lapierre@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __FACTORY_HPP__
#define __FACTORY_HPP__
template
<
T
>
struct
Creator
{
virtual
T
*
create
();
};
template
<
typename
T
>
class
Factory
{
public:
Factory
();
~
Factory
();
/**
* This function will set the creator. The
* Factory owns the creator instance.
*/
void
setCreator
(
Creator
<
T
>
*
creator
);
/**
* It ask the creator to create a SessionIO.
* If there's no creator set, it will throw
* a std::logic_error.
*/
T
*
create
();
private:
Creator
<
T
>
*
mCreator
;
}
#include "Factory.inl"
#endif
src/gui/official/SessionIO.hpp
View file @
1274ba86
...
...
@@ -31,7 +31,7 @@
class
SessionIO
:
public
QObject
{
Q_OBJECT
public:
virtual
~
SessionIO
(){}
...
...
src/gui/official/SessionIOFactory.hpp
0 → 100644
View file @
1274ba86
/**
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Jean-Philippe Barrette-LaPierre
* <jean-philippe.barrette-lapierre@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __SESSIONIOFACTORY_HPP__
#define __SESSIONIOFACTORY_HPP__
#include "utilspp/Singleton.hpp"
#include "Factory.hpp"
#include "SessionIO.hpp"
typedef
utilspp
::
SingletonHolder
<
Factory
<
SessionIO
>
>
SessionIOFactory
;
#endif
src/gui/official/TCPSessionIO.cpp
View file @
1274ba86
...
...
@@ -33,6 +33,8 @@ TCPSessionIO::TCPSessionIO(const QString &hostname, quint16 port)
this
,
SLOT
(
receive
()));
QObject
::
connect
(
mSocket
,
SIGNAL
(
connected
()),
this
,
SLOT
(
sendWaitingRequests
()));
QObject
::
connect
(
mSocket
,
SIGNAL
(
connected
()),
this
,
SIGNAL
(
connected
()));
QObject
::
connect
(
mSocket
,
SIGNAL
(
disconnected
()),
this
,
SLOT
(
askReconnect
()));
QObject
::
connect
(
mSocket
,
SIGNAL
(
error
(
QAbstractSocket
::
SocketError
)),
...
...
@@ -92,10 +94,6 @@ TCPSessionIO::sendWaitingRequests()
stream
<<
*
mStack
.
begin
();
mStack
.
pop_front
();
}
if
(
mSocket
->
state
()
==
QAbstractSocket
::
ConnectedState
)
{
emit
connected
();
}
}
void
...
...
src/gui/official/TCPSessionIO.hpp
0 → 100644
View file @
1274ba86
/**
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Jean-Philippe Barrette-LaPierre
* <jean-philippe.barrette-lapierre@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __TCPSESSIONIO_HPP__
#define __TCPSESSIONIO_HPP__
#include <QMutex>
#include <QString>
#include <QTcpSocket>
#include <QTextStream>
#include <list>
#include "SessionIO.hpp"
class
TCPSessionIO
:
public
SessionIO
{
Q_OBJECT
public:
TCPSessionIO
(
const
QString
&
hostname
,
quint16
port
);
virtual
~
TCPSessionIO
();
signals:
void
connected
();
public
slots
:
/**
* This function send the request that we were
* unable to send.
*/
void
sendWaitingRequests
();
/**
* Those function are the actual function
* that write to the socket.
*/
virtual
void
send
(
const
QString
&
request
);
virtual
void
send
(
const
std
::
string
&
request
);
/**
*/
void
askReconnect
();
/**
* This function is called when we have
* incomming data on the socket.
*/
virtual
void
receive
();
/**
* Those function are the actual function
* that read from the socket.
*/
virtual
void
receive
(
QString
&
answer
);
virtual
void
receive
(
std
::
string
&
answer
);
virtual
void
connect
();
private:
QTcpSocket
*
mSocket
;
QString
mHostname
;
quint16
mPort
;
QMutex
mStackMutex
;
std
::
list
<
QString
>
mStack
;
};
#endif
src/gui/official/TCPSessionIOCreator.cpp
View file @
1274ba86
...
...
@@ -11,8 +11,8 @@ TCPSessionIO *
TCPSessionIOCreator
::
create
()
{
TCPSessionIO
*
t
=
new
TCPSessionIO
(
mHostname
,
mPort
);
//
QObject::connect(t, SIGNAL(connected()),
//
&PhoneLineManager::instance(), SLOT(
connec
t()));
QObject
::
connect
(
t
,
SIGNAL
(
connected
()),
&
PhoneLineManager
::
instance
(),
SLOT
(
star
t
()));
t
->
connect
();
return
t
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment