Skip to content

Commit 09aa63f

Browse files
author
g_j_m
committedJan 28, 2006
Replace Qt3 stuff with Qt4 stuff
git-svn-id: http://svn.osgeo.org/qgis/trunk@4759 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent a1e979e commit 09aa63f

File tree

2 files changed

+27
-23
lines changed

2 files changed

+27
-23
lines changed
 

‎src/core/qgscontexthelp.cpp

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
***************************************************************************/
1818
/* $Id$ */
1919
#include <iostream>
20-
#include <qstring.h>
21-
#include <qdir.h>
22-
#include <q3process.h>
23-
#include <q3socket.h>
20+
21+
#include <QString>
22+
#include <QProcess>
23+
#include <QTcpSocket>
24+
#include <QTextStream>
25+
2426
#include "qgscontexthelp.h"
2527
#include "qgsapplication.h"
26-
//Added by qt3to4:
27-
#include <QTextStream>
28+
2829

2930
// Note: QGSCONTEXTHELP_REUSE must be defined (or not) in qgscontexthelp.h.
3031
// The flag determines if an existing viewer process should be reused or
@@ -50,8 +51,8 @@ QgsContextHelp::QgsContextHelp(int contextId)
5051
mProcess = start(contextId);
5152
#ifdef QGSCONTEXTHELP_REUSE
5253
// Create socket to communicate with process
53-
mSocket = new Q3Socket(this);
54-
connect(mProcess, SIGNAL(readyReadStdout()), SLOT(readPort()));
54+
mSocket = new QTcpSocket(this);
55+
connect(mProcess, SIGNAL(readyReadStandardoutput()), SLOT(readPort()));
5556
#else
5657
// Placeholder for new process if terminating and restarting
5758
mNextProcess = NULL;
@@ -69,22 +70,22 @@ QgsContextHelp::~QgsContextHelp()
6970
delete mProcess;
7071
}
7172

72-
Q3Process *QgsContextHelp::start(int contextId)
73+
QProcess *QgsContextHelp::start(int contextId)
7374
{
7475
// Get the path to the help viewer
7576
QString helpPath = QgsApplication::helpAppPath();
7677
#ifdef QGISDEBUG
7778
std::cout << "Help path is " << helpPath.toLocal8Bit().data() << std::endl;
7879
#endif
7980

80-
Q3Process *process = new Q3Process(helpPath);
8181
QString arg1;
8282
arg1.setNum(contextId);
83-
process->addArgument(arg1);
84-
process->start();
83+
QProcess *process = new QProcess;
84+
process->start(helpPath, QStringList(arg1));
8585

8686
// Delete this object if the process terminates
87-
connect(process, SIGNAL(processExited()), SLOT(processExited()));
87+
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)),
88+
SLOT(processExited()));
8889

8990
// Delete the process if the application quits
9091
connect(qApp, SIGNAL(aboutToQuit()), process, SLOT(tryTerminate()));
@@ -96,10 +97,11 @@ void QgsContextHelp::readPort()
9697
{
9798
#ifdef QGSCONTEXTHELP_REUSE
9899
// Get port and connect socket to process
99-
QString p = mProcess->readLineStdout();
100+
QString p = mProcess->readAllStandardOutput();
100101
Q_UINT16 port = p.toUShort();
101102
mSocket->connectToHost("localhost", port);
102-
disconnect(mProcess, SIGNAL(readyReadStdout()), this, SLOT(readPort()));
103+
disconnect(mProcess, SIGNAL(readyReadStandardOutput()), this,
104+
SLOT(readPort()));
103105
#endif
104106
}
105107

@@ -120,7 +122,7 @@ void QgsContextHelp::showContext(int contextId)
120122
// Start new help viewer process (asynchronous)
121123
mNextProcess = start(contextId);
122124
// Terminate existing help viewer process (asynchronous)
123-
mProcess->tryTerminate();
125+
mProcess->terminate();
124126
#endif
125127
}
126128

‎src/core/qgscontexthelp.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
/* $Id$ */
2020
#ifndef QGSCONTEXTHELP_H
2121
#define QGSCONTEXTHELP_H
22-
#include <qobject.h>
23-
class Q3Process;
24-
class Q3Socket;
22+
#include <QObject>
23+
24+
class QProcess;
25+
class QTcpSocket;
26+
2527
#ifdef Q_OS_MACX
2628
#define QGSCONTEXTHELP_REUSE 1
2729
#endif
@@ -55,17 +57,17 @@ private slots:
5557
//! Destructor
5658
~QgsContextHelp();
5759

58-
Q3Process *start(int contextId);
60+
QProcess *start(int contextId);
5961
void showContext(int contextId);
6062

6163
static QgsContextHelp *gContextHelp; // Singleton instance
62-
Q3Process *mProcess;
64+
QProcess *mProcess;
6365
#ifdef QGSCONTEXTHELP_REUSE
6466
// Communications socket when reusing existing process
65-
Q3Socket *mSocket;
67+
QTcpSocket *mSocket;
6668
#else
6769
// Replacement process when terminating and restarting
68-
Q3Process *mNextProcess;
70+
QProcess *mNextProcess;
6971
#endif
7072
};
7173
#endif //QGSCONTEXTHELP_H

0 commit comments

Comments
 (0)
Please sign in to comment.