summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Małek <michalm@jabster.pl>2014-08-06 09:46:14 (GMT)
committerMichał Małek <michalm@jabster.pl>2014-08-06 09:46:14 (GMT)
commitd02cc713a9cfe46221ad7045f2d3855d20c666a0 (patch)
treebf01a7533949d8b4ba8a514180d30d2689deddbb
parentc7feb4e99a9f75c5e9f9a9201fcb12bd6a9e7f94 (diff)
Ported KSocketFactory to a plain QTcpSocket
-rw-r--r--libkcddb/asynccddbplookup.cpp5
-rw-r--r--libkcddb/synccddbplookup.cpp12
2 files changed, 8 insertions, 9 deletions
diff --git a/libkcddb/asynccddbplookup.cpp b/libkcddb/asynccddbplookup.cpp
index 12a1ebd..e763b19 100644
--- a/libkcddb/asynccddbplookup.cpp
+++ b/libkcddb/asynccddbplookup.cpp
@@ -22,8 +22,6 @@
#include "asynccddbplookup.h"
#include "logging.h"
-#include <ksocketfactory.h>
-
namespace KCDDB
{
AsyncCDDBPLookup::AsyncCDDBPLookup()
@@ -45,7 +43,8 @@ namespace KCDDB
const TrackOffsetList & trackOffsetList
)
{
- socket_ = KSocketFactory::connectToHost(QLatin1String( "cddbp" ), hostname, port);
+ socket_ = new QTcpSocket;
+ socket_->connectToHost(hostname, port);
connect (socket_, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(slotGotError(QAbstractSocket::SocketError)));
diff --git a/libkcddb/synccddbplookup.cpp b/libkcddb/synccddbplookup.cpp
index 7c402bc..8de04e2 100644
--- a/libkcddb/synccddbplookup.cpp
+++ b/libkcddb/synccddbplookup.cpp
@@ -22,8 +22,7 @@
#include "synccddbplookup.h"
#include "logging.h"
-#include <qstringlist.h>
-#include <ksocketfactory.h>
+#include <QtCore/QStringList>
namespace KCDDB
{
@@ -47,12 +46,13 @@ namespace KCDDB
{
trackOffsetList_ = trackOffsetList;
- socket_ = KSocketFactory::synchronousConnectToHost(QLatin1String( "cddbp" ), hostName, port);
+ socket_ = new QTcpSocket;
+ socket_->connectToHost(hostName, port);
- if ( !socket_->isValid() )
+ if ( !socket_->waitForConnected(30000) )
{
- qCDebug(LIBKCDDB) << "Couldn't connect to " << socket_->peerName() << ":" << socket_->peerPort();
- qCDebug(LIBKCDDB) << "Socket error: " << socket_->errorString();
+ qCDebug(LIBKCDDB) << "Couldn't connect to " << socket_->peerName() << ":" << socket_->peerPort();
+ qCDebug(LIBKCDDB) << "Socket error: " << socket_->errorString();
if ( socket_->error() == QAbstractSocket::HostNotFoundError )
return HostNotFound;