helpviewer application source code removed

This commit is contained in:
Jorge Gustavo Rocha 2017-08-11 07:32:34 +02:00
parent 146c0c8c2d
commit c07ac6e67f
6 changed files with 0 additions and 435 deletions

View File

@ -13,7 +13,6 @@ ADD_SUBDIRECTORY(test)
IF (WITH_DESKTOP)
ADD_SUBDIRECTORY(app)
ADD_SUBDIRECTORY(helpviewer)
ADD_SUBDIRECTORY(plugins)
ENDIF(WITH_DESKTOP)

View File

@ -1,95 +0,0 @@
# override default path where built files are put to allow running qgis without installing
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_LIBEXEC_SUBDIR})
########################################################
# Files
SET (HELP_SRCS
main.cpp
qgshelpviewer.cpp
)
SET (HELP_UIS qgshelpviewerbase.ui)
SET (HELP_MOC_HDRS qgshelpviewer.h)
SET (HELP_RCCS ../../images/images.qrc)
IF (WIN32)
IF (MSVC)
SET (HELP_SRCS ${HELP_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/../app/qgis_win32.rc)
ELSE(MSVC)
# Icon for windows MINGW
# Note: can't include .rc directly to source files
# as it's ignored when used MinGW
IF (NOT WINDRES)
FIND_PROGRAM(WINDRES windres)
IF (NOT WINDRES)
MESSAGE(FATAL_ERROR "windres not found - aborting")
ENDIF (NOT WINDRES)
ENDIF (NOT WINDRES)
#############################################################
# application icon
# resource compilation for MinGW
ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/icon.o
COMMAND ${WINDRES} -I${CMAKE_CURRENT_SOURCE_DIR} -i${CMAKE_CURRENT_SOURCE_DIR}/../app/qgis_win32.rc
-o ${CMAKE_CURRENT_BINARY_DIR}/icon.o )
SET(QGIS_APP_SRCS ${QGIS_APP_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
ENDIF (MSVC)
ENDIF (WIN32)
########################################################
# Build
QT5_WRAP_UI (HELP_UIS_H ${HELP_UIS})
QT5_WRAP_CPP (HELP_MOC_SRCS ${HELP_MOC_HDRS})
QT5_ADD_RESOURCES(HELP_RCC_SRCS ${HELP_RCCS})
ADD_EXECUTABLE (qgis_help MACOSX_BUNDLE WIN32 ${HELP_SRCS} ${HELP_MOC_SRCS} ${HELP_UIS_H} ${HELP_RCC_SRCS})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../core
${CMAKE_CURRENT_SOURCE_DIR}/../core/geometry
${CMAKE_CURRENT_SOURCE_DIR}/../core/metadata
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}/src/core
)
INCLUDE_DIRECTORIES(SYSTEM
${SQLITE3_INCLUDE_DIR}
)
TARGET_LINK_LIBRARIES(qgis_help
qgis_core
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTNETWORK_LIBRARY}
${QT_QTSVG_LIBRARY}
${QT_QTXML_LIBRARY}
${OPTIONAL_QTWEBKIT}
${SQLITE3_LIBRARY}
)
IF(APPLE)
SET_TARGET_PROPERTIES(qgis_help PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${QGIS_LIB_DIR}
INSTALL_RPATH_USE_LINK_PATH true
)
ENDIF(APPLE)
########################################################
# Install
INSTALL (TARGETS qgis_help
BUNDLE DESTINATION ${QGIS_BIN_DIR}
RUNTIME DESTINATION ${QGIS_LIBEXEC_DIR}
)
IF (APPLE)
INSTALL (CODE "EXECUTE_PROCESS (COMMAND ln -sfh ../../../${QGIS_FW_SUBDIR} \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${QGIS_BIN_DIR}/qgis_help.app/Contents/Frameworks\")")
INSTALL (CODE "EXECUTE_PROCESS (COMMAND ln -sfh ../../../../${QGIS_LIB_DIR} \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${QGIS_BIN_DIR}/qgis_help.app/Contents/MacOS/lib\")")
ENDIF (APPLE)

View File

@ -1,91 +0,0 @@
/***************************************************************************
main.cpp
Helpviewer main method
-------------------
begin : 2007
copyright : (C) 2007 by Gary E. Sherman
email : sherman@mrcc.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <iostream>
#include <QLocale>
#include <QSettings>
#include <QTranslator>
#include <QLibraryInfo>
#include "qgshelpviewer.h"
#include "qgsapplication.h"
#include "qgslogger.h"
#include "qgsconfig.h"
int main( int argc, char **argv )
{
QgsApplication a( argc, argv, true );
// Set up the QSettings environment must be done after qapp is created
QCoreApplication::setOrganizationName( QStringLiteral( "QGIS" ) );
QCoreApplication::setOrganizationDomain( QStringLiteral( "qgis.org" ) );
QCoreApplication::setApplicationName( QStringLiteral( "QGIS3" ) );
QString myTranslationCode = QLatin1String( "" );
if ( argc == 2 )
{
myTranslationCode = argv[1];
}
if ( !QgsApplication::isRunningFromBuildDir() )
{
#if defined(Q_OS_MACX)
// If we're on Mac, we have the resource library way above us...
a.setPkgDataPath( QgsApplication::prefixPath() + "/../../../../" + QString( QGIS_DATA_SUBDIR ) );
#elif defined(Q_OS_WIN)
a.setPkgDataPath( QgsApplication::prefixPath() + "/" QGIS_DATA_SUBDIR );
#else
a.setPkgDataPath( QgsApplication::prefixPath() + "/../" QGIS_DATA_SUBDIR );
#endif
}
QString i18nPath = QgsApplication::i18nPath();
if ( myTranslationCode.isEmpty() )
{
myTranslationCode = QLocale::system().name();
QSettings settings;
if ( settings.value( QStringLiteral( "locale/overrideFlag" ), false ).toBool() )
{
myTranslationCode = settings.value( QStringLiteral( "locale/userLocale" ), "en_US" ).toString();
}
}
QgsDebugMsg( QString( "Setting translation to %1/qgis_%2" ).arg( i18nPath, myTranslationCode ) );
/* Translation file for QGIS.
*/
QTranslator qgistor( nullptr );
if ( qgistor.load( QStringLiteral( "qgis_" ) + myTranslationCode, i18nPath ) )
{
a.installTranslator( &qgistor );
}
/* Translation file for Qt.
* The strings from the QMenuBar context section are used by Qt/Mac to shift
* the About, Preferences and Quit items to the Mac Application menu.
* These items must be translated identically in both qt_ and qgis_ files.
*/
QTranslator qttor( nullptr );
if ( qttor.load( QStringLiteral( "qt_" ) + myTranslationCode, QLibraryInfo::location( QLibraryInfo::TranslationsPath ) ) )
{
a.installTranslator( &qttor );
}
QgsHelpViewer w;
a.exec();
}

View File

@ -1,122 +0,0 @@
/***************************************************************************
qgshelpviewer.cpp
Simple help browser
-------------------
begin : 2005-07-02
copyright : (C) 2005 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <stdio.h>
#include <QString>
#include <QApplication>
#include <QSettings>
#include "qgshelpviewer.h"
#include "qgsapplication.h"
#include "qgslogger.h"
QgsReaderThread::QgsReaderThread()
: QThread()
{
}
void QgsReaderThread::run()
{
QString help;
char buffer[1024];
while ( fgets( buffer, sizeof buffer, stdin ) )
{
if ( strcmp( buffer, "EOH\n" ) == 0 )
{
emit helpRead( help );
help.clear();
}
else
{
help += QString::fromUtf8( buffer );
}
}
}
QgsHelpViewer::QgsHelpViewer( QWidget *parent, Qt::WindowFlags fl )
: QDialog( parent, fl )
{
setupUi( this );
restorePosition();
mThread = new QgsReaderThread();
mThread->start();
connect( mThread, &QgsReaderThread::helpRead, this, &QgsHelpViewer::showHelp );
}
QgsHelpViewer::~QgsHelpViewer()
{
mThread->terminate();
}
void QgsHelpViewer::showHelp( const QString &help )
{
// Set the browser text to the help contents
QString myStyle = QgsApplication::reportStyleSheet();
QString helpContents = "<head><style>" + myStyle + "</style></head><body>" + help + "</body>";
webView->setHtml( helpContents );
setWindowTitle( tr( "QGIS Help" ) );
#ifndef Q_OS_WIN
setWindowState( windowState() & ~Qt::WindowMinimized );
#endif
raise();
activateWindow();
show();
}
void QgsHelpViewer::fileExit()
{
QApplication::exit();
}
/*
* Window geometry is saved during move and resize events rather then when
* the window is closed because HelpViewer is a subprocess which could be
* closed by the parent process invoking QProcess::terminate(). When this
* happens, the HelpViewer process receives the signal WM_CLOSE on Windows
* and SIGTERM on Mac and Unix. There is no way to catch these using Qt;
* OS specific code must be written. To avoid OS specific code, the window
* geometry is saved as it changes.
*/
void QgsHelpViewer::moveEvent( QMoveEvent *event )
{
Q_UNUSED( event );
saveWindowLocation();
}
void QgsHelpViewer::resizeEvent( QResizeEvent *event )
{
Q_UNUSED( event );
saveWindowLocation();
}
void QgsHelpViewer::restorePosition()
{
QSettings settings;
restoreGeometry( settings.value( QStringLiteral( "HelpViewer/geometry" ) ).toByteArray() );
}
void QgsHelpViewer::saveWindowLocation()
{
QSettings settings;
settings.setValue( QStringLiteral( "HelpViewer/geometry" ), saveGeometry() );
}

View File

@ -1,60 +0,0 @@
/***************************************************************************
qgshelpviewer.h
Simple help browser
-------------------
begin : 2005-07-02
copyright : (C) 2005 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSHELPVIEWER_H
#define QGSHELPVIEWER_H
#include <QDialog>
#include <QThread>
#include "ui_qgshelpviewerbase.h"
class QString;
class QFile;
class QgsReaderThread : public QThread
{
Q_OBJECT
public:
QgsReaderThread();
virtual void run() override;
signals:
void helpRead( const QString &help );
};
class QgsHelpViewer : public QDialog, private Ui::QgsHelpViewerBase
{
Q_OBJECT
public:
QgsHelpViewer( QWidget *parent = nullptr, Qt::WindowFlags = 0 );
~QgsHelpViewer();
public slots:
void showHelp( const QString & );
void fileExit();
protected:
void moveEvent( QMoveEvent *event ) override;
void resizeEvent( QResizeEvent *event ) override;
private:
void restorePosition();
void saveWindowLocation();
QgsReaderThread *mThread = nullptr;
};
#endif // QGSHELPVIEWER_H

View File

@ -1,66 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsHelpViewerBase</class>
<widget class="QDialog" name="QgsHelpViewerBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>514</width>
<height>417</height>
</rect>
</property>
<property name="windowTitle">
<string>QGIS Help</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff/>
</iconset>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTextBrowser" name="webView">
<property name="url" stdset="0">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>QgsHelpViewerBase</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>482</x>
<y>390</y>
</hint>
<hint type="destinationlabel">
<x>508</x>
<y>288</y>
</hint>
</hints>
</connection>
</connections>
</ui>