Commit 98b9cb16 authored by Mike Kremer's avatar Mike Kremer

Reverted removal of former help browser

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5569 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f7ebd05c
......@@ -76,7 +76,7 @@
#include <OpenFlipper/widgets/aboutWidget/aboutWidget.hh>
#include <OpenFlipper/widgets/loggerWidget/loggerWidget.hh>
#include <OpenFlipper/widgets/optionsWidget/optionsWidget.hh>
#include <OpenFlipper/widgets/helpAssistant/helpAssistant.hh>
#include <OpenFlipper/widgets/helpBrowser/helpWidget.hh>
#include <OpenFlipper/Core/PluginInfo.hh>
......@@ -671,10 +671,10 @@ public:
private:
/// Pointer to the help Browser
HelpAssistant* helpBrowserDeveloper_;
HelpWidget* helpBrowserDeveloper_;
/// Pointer to the help Browser
HelpAssistant* helpBrowserUser_;
HelpWidget* helpBrowserUser_;
/** @} */
......
......@@ -55,20 +55,18 @@ void CoreWidget::showHelpBrowserUser( ) {
return;
if ( helpBrowserUser_ == 0 ) {
helpBrowserUser_ = new HelpAssistant();
helpBrowserUser_ = new HelpWidget( this ,true);
}
helpBrowserUser_->startAssistant("user.qch");
//show the widget centered
// QPoint center;
// center.setX( x() + width() / 2 );
// center.setY( y() + height() / 2 );
//
// helpBrowserUser_->setGeometry(center.x() - helpBrowserUser_->width() / 2,
// center.y() - helpBrowserUser_->height()/ 2, helpBrowserUser_->width(), helpBrowserUser_->height());
//
// helpBrowserUser_->show();
QPoint center;
center.setX( x() + width() / 2 );
center.setY( y() + height() / 2 );
helpBrowserUser_->setGeometry(center.x() - helpBrowserUser_->width() / 2,
center.y() - helpBrowserUser_->height()/ 2, helpBrowserUser_->width(), helpBrowserUser_->height());
helpBrowserUser_->show();
}
......@@ -77,28 +75,19 @@ void CoreWidget::showHelpBrowserDeveloper( ) {
if ( OpenFlipper::Options::nogui() )
return;
if ( helpBrowserUser_ == 0 ) {
helpBrowserUser_ = new HelpAssistant();
if ( helpBrowserDeveloper_ == 0 ) {
helpBrowserDeveloper_ = new HelpWidget( this ,false);
}
helpBrowserUser_->startAssistant("developer.qch");
//show the widget centered
QPoint center;
center.setX( x() + width() / 2 );
center.setY( y() + height() / 2 );
helpBrowserDeveloper_->setGeometry(center.x() - helpBrowserDeveloper_->width() / 2,
center.y() - helpBrowserDeveloper_->height()/ 2, helpBrowserDeveloper_->width(), helpBrowserDeveloper_->height());
// if ( OpenFlipper::Options::nogui() )
// return;
//
// if ( helpBrowserDeveloper_ == 0 ) {
// helpBrowserDeveloper_ = new HelpWidget( this ,false);
// }
//
// //show the widget centered
// QPoint center;
// center.setX( x() + width() / 2 );
// center.setY( y() + height() / 2 );
//
// helpBrowserDeveloper_->setGeometry(center.x() - helpBrowserDeveloper_->width() / 2,
// center.y() - helpBrowserDeveloper_->height()/ 2, helpBrowserDeveloper_->width(), helpBrowserDeveloper_->height());
//
// helpBrowserDeveloper_->show();
helpBrowserDeveloper_->show();
}
......
//=============================================================================
//
// OpenFlipper
// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
// www.openflipper.org
//
//-----------------------------------------------------------------------------
//
// License
//
// OpenFlipper is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
// $Revision: $
// $Author: $
// $Date: $
//
//=============================================================================
#include "helpAssistant.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
#include <QMessageBox>
#include <QProcess>
#include <QLibraryInfo>
#include <QString>
#include <iostream>
HelpAssistant::HelpAssistant() : filename_(0), proc_(0) {
}
HelpAssistant::~HelpAssistant() {
if (proc_ && proc_->state() == QProcess::Running) {
proc_->terminate();
proc_->waitForFinished(3000);
}
delete proc_;
}
bool HelpAssistant::startAssistant(const std::string& _filename) {
filename_ = new QString(_filename.c_str());
if (!proc_)
proc_ = new QProcess();
if (proc_->state() != QProcess::Running) {
QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator();
#if !defined(Q_OS_MAC)
app += QLatin1String("assistant");
#else
app += QLatin1String("Assistant.app/Contents/MacOS/Assistant");
#endif
QStringList args;
args << QLatin1String("-file")
<< OpenFlipper::Options::applicationDirStr()
+ QLatin1String("/Help/") + *filename_
<< QLatin1String("-server");
std::cerr << app.toStdString() << " " << args[0].toStdString() << " " << args[1].toStdString() << std::endl;
proc_->start(app, args);
if (!proc_->waitForStarted()) {
QMessageBox::critical(0, QObject::tr("OpenFlipper Help"),
QObject::tr("Unable to launch Qt Assistant (%1)").arg(app));
return false;
}
// Load page index.html:
QByteArray ba("SetSource ");
ba.append("qthelp://com.trolltech.qmake/doc/index.html");
proc_->write(ba + '\0');
}
return true;
}
//=============================================================================
//
// OpenFlipper
// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
// www.openflipper.org
//
//-----------------------------------------------------------------------------
//
// License
//
// OpenFlipper is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
// $Revision: $
// $Author: $
// $Date: $
//
//=============================================================================
#ifndef HELPASSISTANT_HH_
#define HELPASSISTANT_HH_
class QProcess;
class QString;
#include <string>
class HelpAssistant {
public:
/// Constructor
HelpAssistant();
/// Desctructor
virtual ~HelpAssistant();
/// Start and show help browser
bool startAssistant(const std::string& _filename);
private:
QString* filename_;
QProcess* proc_;
};
#endif /* HELPASSISTANT_HH_ */
#== SYSTEM PART -- DON'T TOUCH ==============================================
include $(ACGMAKE)/Config
#==============================================================================
SUBDIRS = $(call find-subdirs)
PACKAGES := qt4 glut opengl x11 math ACG2 openmesh2
PROJ_LIBS =
MODULES := uic4compat moc4 cxx
#== SYSTEM PART -- DON'T TOUCH ==============================================
include $(ACGMAKE)/Rules
#==============================================================================
#include "findEdit.hh"
#include <QKeyEvent>
findEdit::findEdit(QWidget* parent) : QLineEdit(parent)
{
connect(this, SIGNAL(textEdited(const QString&)), this, SLOT(slotTextEdited(const QString&)) );
}
void findEdit::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
emit find();
else if (event->key() == Qt::Key_F3)
emit find();
else if (event->key() == Qt::Key_Escape)
emit close();
else
QLineEdit::keyPressEvent(event);
}
void findEdit::slotTextEdited(const QString&)
{
emit textEdited();
}
#ifndef FINDEDIT_HH
#define FINDEDIT_HH
#include <QLineEdit>
class findEdit : public QLineEdit
{
Q_OBJECT
signals:
void find();
void close();
void textEdited();
public:
findEdit(QWidget *parent = 0);
protected:
void keyPressEvent( QKeyEvent* event );
private slots:
void slotTextEdited(const QString& /*text*/);
};
#endif //FINDEDIT_HH
This diff is collapsed.
#include "ui_helpWidget.hh"
#include <QtGui>
#include "webView.hh"
#include "findEdit.hh"
class HelpWidget : public QMainWindow, public Ui::HelpWidget
{
Q_OBJECT
public:
HelpWidget(QWidget *parent = 0, bool _user = true);
private:
QString baseDir_;
QString startFile_;
void generateTree();
void setConnections();
QString getTitle(QString htmlFile);
QAction* back_;
QAction* forward_;
webView* currentView_;
private slots:
void loadFinished( bool ok );
void goHome();
void treeClicked(QTreeWidgetItem* item, int column );
void urlChanged(const QUrl& url);
void newTab(QWebView* _webView);
void titleChanged (const QString & title );
void tabChanged (int _index);
void closeCurrentTab();
void duplicateCurrentTab();
//finding
private:
findEdit* findText_;
private slots:
void showFind();
void findNext1();
void findPrev1();
void initFindFrame();
//context menu
private:
QMenu* contextMenu_;
QPoint lastContextMenu_;
private slots:
void showContextMenu(const QPoint& _pos);
void contextOpenTab();
void contextOpenNewTab();
void contextCloseTab();
};
<ui version="4.0" >
<class>HelpWidget</class>
<widget class="QMainWindow" name="HelpWidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>805</width>
<height>680</height>
</rect>
</property>
<property name="windowTitle" >
<string>Help Browser</string>
</property>
<widget class="QWidget" name="centralwidget" >
<layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
<widget class="QSplitter" name="splitter" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<widget class="QTreeWidget" name="tree" >
<property name="sizePolicy" >
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Ignored" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<column>
<property name="text" >
<string>1</string>
</property>
</column>
</widget>
<widget class="QWidget" name="" >
<layout class="QVBoxLayout" name="verticalLayout" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QTabWidget" name="tabs" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Ignored" hsizetype="Ignored" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="baseSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="tab" >
<attribute name="title" >
<string>Tab 1</string>
</attribute>
</widget>
</widget>
</item>
<item>
<widget class="QFrame" name="findFrame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>35</height>
</size>
</property>
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<widget class="QPushButton" name="findNext" >
<property name="geometry" >
<rect>
<x>222</x>
<y>4</y>
<width>53</width>
<height>24</height>
</rect>
</property>
<property name="text" >
<string>Next</string>
</property>
<property name="flat" >
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton" name="findClose" >
<property name="geometry" >
<rect>
<x>4</x>
<y>4</y>
<width>24</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>24</width>
<height>25</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="flat" >
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="findPrev" >
<property name="geometry" >
<rect>
<x>146</x>
<y>4</y>
<width>72</width>
<height>24</height>
</rect>
</property>
<property name="text" >
<string>Previous</string>
</property>
<property name="flat" >
<bool>false</bool>
</property>
</widget>
<widget class="QCheckBox" name="findSensitive" >
<property name="geometry" >
<rect>
<x>279</x>
<y>5</y>
<width>96</width>
<height>23</height>
</rect>
</property>
<property name="text" >
<string>Case Sensitive</string>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>805</width>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menuFile" >
<property name="title" >
<string>File</string>
</property>
<addaction name="actionClose" />
</widget>
<addaction name="menuFile" />
</widget>
<widget class="QStatusBar" name="statusbar" />
<widget class="QToolBar" name="toolBar" >
<property name="windowTitle" >
<string>toolBar</string>
</property>
<attribute name="toolBarArea" >
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak" >
<bool>false</bool>
</attribute>
</widget>
<action name="actionClose" >
<property name="text" >
<string>Close</string>
</property>
</action>
</widget>
<tabstops>
<tabstop>tabs</tabstop>
<tabstop>tree</tabstop>
<tabstop>findNext</tabstop>
<tabstop>findClose</tabstop>
<tabstop>findPrev</tabstop>
<tabstop>findSensitive</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
#include "webView.hh"
#include <QKeyEvent>
webView::webView(QWidget * parent) : QWebView(parent)
{
}
QWebView* webView::createWindow(QWebPage::WebWindowType /*type*/)
{
webView* window = new webView();
emit windowCreated(window);
return window;
}
void webView::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_F && event->modifiers() == Qt::ControlModifier)
emit find();
else if (event->key() == Qt::Key_F3)
emit findNext();
else
QWebView::keyPressEvent(event);
}
#ifndef WEBVIEW_HH
#define WEBVIEW_HH
#include "ui_helpWidget.hh"
#include <QtWebKit>
class webView : public QWebView
{
Q_OBJECT
signals:
void windowCreated(QWebView* _webView);
void find();
void findNext();
public:
webView(QWidget *parent = 0);
protected:
QWebView* createWindow( QWebPage::WebWindowType type );
void keyPressEvent( QKeyEvent* event );
};
#endif //WEBVIEW_HH
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment