mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
User manual: overlay search panel
Make search panel floating so that web view does not resize. This commit also addresses following issues: - search now wraps around document - application icon and window title are now back Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8ded16fd1b
commit
7e7a1d29ad
3 changed files with 127 additions and 146 deletions
|
@ -6,7 +6,7 @@
|
||||||
#include "../helpers.h"
|
#include "../helpers.h"
|
||||||
|
|
||||||
UserManual::UserManual(QWidget *parent) :
|
UserManual::UserManual(QWidget *parent) :
|
||||||
QWidget(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::UserManual)
|
ui(new Ui::UserManual)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -21,12 +21,12 @@ UserManual::UserManual(QWidget *parent) :
|
||||||
actionHideSearch->setShortcutContext(Qt::WindowShortcut);
|
actionHideSearch->setShortcutContext(Qt::WindowShortcut);
|
||||||
addAction(actionHideSearch);
|
addAction(actionHideSearch);
|
||||||
|
|
||||||
|
setWindowTitle(tr("User Manual"));
|
||||||
|
|
||||||
ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
|
ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
|
||||||
QString searchPath = getSubsurfaceDataPath("Documentation");
|
QString searchPath = getSubsurfaceDataPath("Documentation");
|
||||||
if (searchPath != "") {
|
if (searchPath != "") {
|
||||||
QUrl url(searchPath.append("/user-manual.html"));
|
QUrl url(searchPath.append("/user-manual.html"));
|
||||||
ui->webView->setWindowTitle(tr("User Manual"));
|
|
||||||
ui->webView->setWindowIcon(QIcon(":/subsurface-icon"));
|
|
||||||
ui->webView->setUrl(url);
|
ui->webView->setUrl(url);
|
||||||
} else {
|
} else {
|
||||||
ui->webView->setHtml(tr("Cannot find the Subsurface manual"));
|
ui->webView->setHtml(tr("Cannot find the Subsurface manual"));
|
||||||
|
@ -56,7 +56,7 @@ void UserManual::hideSearchPanel()
|
||||||
|
|
||||||
void UserManual::search(QString text, QWebPage::FindFlags flags = 0)
|
void UserManual::search(QString text, QWebPage::FindFlags flags = 0)
|
||||||
{
|
{
|
||||||
if (ui->webView->findText(text, flags) || text.length() == 0) {
|
if (ui->webView->findText(text, QWebPage::FindWrapsAroundDocument|flags) || text.length() == 0) {
|
||||||
ui->searchEdit->setStyleSheet("");
|
ui->searchEdit->setStyleSheet("");
|
||||||
} else {
|
} else {
|
||||||
ui->searchEdit->setStyleSheet("QLineEdit{background: red;}");
|
ui->searchEdit->setStyleSheet("QLineEdit{background: red;}");
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Ui {
|
||||||
class UserManual;
|
class UserManual;
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserManual : public QWidget
|
class UserManual : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>UserManual</class>
|
<class>UserManual</class>
|
||||||
<widget class="QWidget" name="UserManual">
|
<widget class="QMainWindow" name="UserManual">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -10,9 +10,14 @@
|
||||||
<height>599</height>
|
<height>599</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<property name="windowIcon">
|
||||||
|
<iconset resource="../subsurface.qrc">
|
||||||
|
<normaloff>:/subsurface-icon</normaloff>:/subsurface-icon</iconset>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralWidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="searchPanel">
|
<widget class="QWidget" name="searchPanel" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -28,9 +33,6 @@
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
|
@ -124,17 +126,11 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWebView" name="webView" native="true">
|
<widget class="QWebView" name="webView" native="true"/>
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>1</horstretch>
|
|
||||||
<verstretch>1</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
@ -143,23 +139,8 @@
|
||||||
<header>qwebview.h</header>
|
<header>qwebview.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources>
|
||||||
<connections>
|
<include location="../subsurface.qrc"/>
|
||||||
<connection>
|
</resources>
|
||||||
<sender>findClose</sender>
|
<connections/>
|
||||||
<signal>clicked()</signal>
|
|
||||||
<receiver>searchPanel</receiver>
|
|
||||||
<slot>hide()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>261</x>
|
|
||||||
<y>568</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>192</x>
|
|
||||||
<y>554</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Add table
Reference in a new issue