Skip to content

Commit

Permalink
Fix typo which prevented help from being refreshed on a Mac if the co…
Browse files Browse the repository at this point in the history
…ntext changed while the viewer was open. Also update from Qt3 to 4.

git-svn-id: http://svn.osgeo.org/qgis/trunk@7781 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski committed Dec 14, 2007
1 parent 929e4f0 commit 0d2c1e8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/core/qgscontexthelp.cpp
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/helpviewer/main.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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&)));
Expand Down
11 changes: 6 additions & 5 deletions src/helpviewer/qgshelpserver.cpp
Expand Up @@ -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()
Expand Down
14 changes: 8 additions & 6 deletions src/helpviewer/qgshelpserver.h
Expand Up @@ -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&);
Expand All @@ -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:
Expand Down

0 comments on commit 0d2c1e8

Please sign in to comment.