File: main.cpp

package info (click to toggle)
qgis 0.7.4-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 33,480 kB
  • ctags: 8,836
  • sloc: cpp: 169,088; sh: 8,792; ansic: 1,723; makefile: 1,622; perl: 105
file content (31 lines) | stat: -rw-r--r-- 905 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#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();
}