Skip to content
Permalink
Browse files
Fix typo which prevented help from being refreshed on a Mac if the co…
…ntext changed while the viewer was open. Also update from Qt3 to 4.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7781 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski committed Dec 14, 2007
1 parent d27ed5d commit 6c6da6a2b5e6c0c8a0c5dd4fef140c567b5be0c1
Showing with 17 additions and 14 deletions.
  1. +1 −1 src/core/qgscontexthelp.cpp
  2. +2 −2 src/helpviewer/main.cpp
  3. +6 −5 src/helpviewer/qgshelpserver.cpp
  4. +8 −6 src/helpviewer/qgshelpserver.h
@@ -52,7 +52,7 @@ QgsContextHelp::QgsContextHelp(int contextId)
#ifdef QGSCONTEXTHELP_REUSE
// Create socket to communicate with process
mSocket = new QTcpSocket(this);
connect(mProcess, SIGNAL(readyReadStandardoutput()), SLOT(readPort()));
connect(mProcess, SIGNAL(readyReadStandardOutput()), SLOT(readPort()));
#else
// Placeholder for new process if terminating and restarting
mNextProcess = NULL;
@@ -34,7 +34,7 @@ int main( int argc, char ** argv )
{
context = argv[1];
}
#ifdef Q_OS_MACX
#ifdef Q_WS_MAC
// If we're on Mac, we have the resource library way above us...
a.setPkgDataPath(QgsApplication::prefixPath()+"/../../../../share/qgis");
#endif
@@ -78,7 +78,7 @@ int main( int argc, char ** argv )
// an additional viewer if one is already running.
QgsHelpContextServer *helpServer = new QgsHelpContextServer();
// Make port number available to client
std::cout << helpServer->port() << std::endl;
std::cout << helpServer->serverPort() << std::endl;
// Pass context request from socket to viewer widget
QObject::connect(helpServer, SIGNAL(setContext(const QString&)),
&w, SLOT(setContext(const QString&)));
@@ -22,30 +22,31 @@
// See qt/tools/assistant/ main.cpp and lib/qassistantclient.cpp (Qt 3.3.4).

QgsHelpContextServer::QgsHelpContextServer(QObject *parent) :
Q3ServerSocket(0x7f01, 0, parent)
QTcpServer(parent)
{
// Superclass listens for localhost connection
listen(QHostAddress::LocalHost, 0);
}

QgsHelpContextServer::~QgsHelpContextServer()
{
// Socket is automatically deleted here because it is a QQbject child
}

void QgsHelpContextServer::newConnection(int socket)
void QgsHelpContextServer::incomingConnection(int socket)
{
// Create socket in response to new connection
QgsHelpContextSocket *helpSocket = new QgsHelpContextSocket(socket, this);
// Pass context from socket upwards
connect(helpSocket, SIGNAL(setContext(const QString&)),
SIGNAL(setContext(const QString&)));
emit newConnection();
}

QgsHelpContextSocket::QgsHelpContextSocket(int socket, QObject *parent) :
Q3Socket(parent, 0)
QTcpSocket(parent)
{
connect(this, SIGNAL(readyRead()), SLOT(readClient()));
setSocket(socket);
setSocketDescriptor(socket);
}

QgsHelpContextSocket::~QgsHelpContextSocket()
@@ -18,20 +18,22 @@
/* $Id$ */
#ifndef QGSHELPSERVER_H
#define QGSHELPSERVER_H
#include <q3serversocket.h>
#include <q3socket.h>
#include <QTcpServer>
#include <QTcpSocket>

/*!
* \class QgsHelpContextServer
* \brief Listens for localhost connection and creates socket.
*/
class QgsHelpContextServer : public Q3ServerSocket
class QgsHelpContextServer : public QTcpServer
{
Q_OBJECT
public:
QgsHelpContextServer(QObject* parent = 0);
QgsHelpContextServer(QObject *parent = 0);
~QgsHelpContextServer();
virtual void newConnection(int socket);

public slots:
void incomingConnection(int socket);

signals:
void setContext(const QString&);
@@ -41,7 +43,7 @@ class QgsHelpContextServer : public Q3ServerSocket
* \class QgsHelpContextSocket
* \brief Receives and passes context numbers to viewer.
*/
class QgsHelpContextSocket : public Q3Socket
class QgsHelpContextSocket : public QTcpSocket
{
Q_OBJECT
public:

0 comments on commit 6c6da6a

Please sign in to comment.