QGIS/helpviewer/main.cpp
timlinux 6a261df356 Merve from 0.7 branch
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4162 c8812cc2-4d05-0410-92ff-de0c093fc19c
2005-11-06 00:15:35 +00:00

32 lines
905 B
C++

#include <iostream>
#include <qapplication.h>
#include <qstring.h>
#include "qgshelpserver.h"
#include "qgshelpviewer.h"
int main( int argc, char ** argv )
{
QApplication a( argc, argv );
QString context = QString::null;
if(argc == 2)
{
context = argv[1];
}
QgsHelpViewer w(context);
w.show();
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
// Create socket for client to send context requests to.
// This allows an existing viewer to be reused rather then creating
// an additional viewer if one is already running.
QgsHelpContextServer *helpServer = new QgsHelpContextServer();
// Make port number available to client
std::cout << helpServer->port() << std::endl;
// Pass context request from socket to viewer widget
QObject::connect(helpServer, SIGNAL(setContext(const QString&)),
&w, SLOT(setContext(const QString&)));
return a.exec();
}