Sha256: 48526c78ba97dd27a5a6a44d0d9438aa9ece83a98a37be3eed64ce33d123ab4a

Contents?: true

Size: 841 Bytes

Versions: 14

Compression:

Stored size: 841 Bytes

Contents

#include "Server.h"
#include "Connection.h"
#include "WebPageManager.h"

#include <QTcpServer>

Server::Server(QObject *parent) : QObject(parent) {
  m_tcp_server = new QTcpServer(this);
}

bool Server::start() {
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
  QTextStream(stderr) <<
    "WARNING: The next major version of capybara-webkit " <<
    "will require at least version 5.0 of Qt. " <<
    "You're using version " << QT_VERSION_STR << "." << endl;
#endif

  connect(m_tcp_server, SIGNAL(newConnection()), this, SLOT(handleConnection()));
  return m_tcp_server->listen(QHostAddress::LocalHost, 0);
}

quint16 Server::server_port() const {
  return m_tcp_server->serverPort();
}

void Server::handleConnection() {
  QTcpSocket *socket = m_tcp_server->nextPendingConnection();
  new Connection(socket, new WebPageManager(this), this);
}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
capybara-webkit-1.15.1 src/Server.cpp
capybara-webkit-1.15.0 src/Server.cpp
capybara-webkit-1.14.0 src/Server.cpp
capybara-webkit-1.13.0 src/Server.cpp
capybara-webkit-1.12.0 src/Server.cpp
capybara-webkit-1.11.1 src/Server.cpp
capybara-webkit-1.11.0 src/Server.cpp
capybara-webkit-1.10.1 src/Server.cpp
capybara-webkit-1.10.0 src/Server.cpp
capybara-webkit-1.9.0 src/Server.cpp
capybara-webkit-1.8.0 src/Server.cpp
capybara-webkit-1.7.1 src/Server.cpp
capybara-webkit-1.7.0 src/Server.cpp
capybara-webkit-1.6.0 src/Server.cpp