Skip to content

Commit 0d2c1e8

Browse files
author
telwertowski
committedDec 14, 2007
Fix typo which prevented help from being refreshed on a Mac if the context 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
1 parent 929e4f0 commit 0d2c1e8

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed
 

‎src/core/qgscontexthelp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ QgsContextHelp::QgsContextHelp(int contextId)
5252
#ifdef QGSCONTEXTHELP_REUSE
5353
// Create socket to communicate with process
5454
mSocket = new QTcpSocket(this);
55-
connect(mProcess, SIGNAL(readyReadStandardoutput()), SLOT(readPort()));
55+
connect(mProcess, SIGNAL(readyReadStandardOutput()), SLOT(readPort()));
5656
#else
5757
// Placeholder for new process if terminating and restarting
5858
mNextProcess = NULL;

‎src/helpviewer/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int main( int argc, char ** argv )
3434
{
3535
context = argv[1];
3636
}
37-
#ifdef Q_OS_MACX
37+
#ifdef Q_WS_MAC
3838
// If we're on Mac, we have the resource library way above us...
3939
a.setPkgDataPath(QgsApplication::prefixPath()+"/../../../../share/qgis");
4040
#endif
@@ -78,7 +78,7 @@ int main( int argc, char ** argv )
7878
// an additional viewer if one is already running.
7979
QgsHelpContextServer *helpServer = new QgsHelpContextServer();
8080
// Make port number available to client
81-
std::cout << helpServer->port() << std::endl;
81+
std::cout << helpServer->serverPort() << std::endl;
8282
// Pass context request from socket to viewer widget
8383
QObject::connect(helpServer, SIGNAL(setContext(const QString&)),
8484
&w, SLOT(setContext(const QString&)));

‎src/helpviewer/qgshelpserver.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,31 @@
2222
// See qt/tools/assistant/ main.cpp and lib/qassistantclient.cpp (Qt 3.3.4).
2323

2424
QgsHelpContextServer::QgsHelpContextServer(QObject *parent) :
25-
Q3ServerSocket(0x7f01, 0, parent)
25+
QTcpServer(parent)
2626
{
27-
// Superclass listens for localhost connection
27+
listen(QHostAddress::LocalHost, 0);
2828
}
2929

3030
QgsHelpContextServer::~QgsHelpContextServer()
3131
{
3232
// Socket is automatically deleted here because it is a QQbject child
3333
}
3434

35-
void QgsHelpContextServer::newConnection(int socket)
35+
void QgsHelpContextServer::incomingConnection(int socket)
3636
{
3737
// Create socket in response to new connection
3838
QgsHelpContextSocket *helpSocket = new QgsHelpContextSocket(socket, this);
3939
// Pass context from socket upwards
4040
connect(helpSocket, SIGNAL(setContext(const QString&)),
4141
SIGNAL(setContext(const QString&)));
42+
emit newConnection();
4243
}
4344

4445
QgsHelpContextSocket::QgsHelpContextSocket(int socket, QObject *parent) :
45-
Q3Socket(parent, 0)
46+
QTcpSocket(parent)
4647
{
4748
connect(this, SIGNAL(readyRead()), SLOT(readClient()));
48-
setSocket(socket);
49+
setSocketDescriptor(socket);
4950
}
5051

5152
QgsHelpContextSocket::~QgsHelpContextSocket()

‎src/helpviewer/qgshelpserver.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,22 @@
1818
/* $Id$ */
1919
#ifndef QGSHELPSERVER_H
2020
#define QGSHELPSERVER_H
21-
#include <q3serversocket.h>
22-
#include <q3socket.h>
21+
#include <QTcpServer>
22+
#include <QTcpSocket>
2323

2424
/*!
2525
* \class QgsHelpContextServer
2626
* \brief Listens for localhost connection and creates socket.
2727
*/
28-
class QgsHelpContextServer : public Q3ServerSocket
28+
class QgsHelpContextServer : public QTcpServer
2929
{
3030
Q_OBJECT
3131
public:
32-
QgsHelpContextServer(QObject* parent = 0);
32+
QgsHelpContextServer(QObject *parent = 0);
3333
~QgsHelpContextServer();
34-
virtual void newConnection(int socket);
34+
35+
public slots:
36+
void incomingConnection(int socket);
3537

3638
signals:
3739
void setContext(const QString&);
@@ -41,7 +43,7 @@ class QgsHelpContextServer : public Q3ServerSocket
4143
* \class QgsHelpContextSocket
4244
* \brief Receives and passes context numbers to viewer.
4345
*/
44-
class QgsHelpContextSocket : public Q3Socket
46+
class QgsHelpContextSocket : public QTcpSocket
4547
{
4648
Q_OBJECT
4749
public:

0 commit comments

Comments
 (0)
Please sign in to comment.