summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Sergey Starosek <sergey.starosek@gmail.com>2014-01-09 20:29:33 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-10 16:12:44 +0700
commit7e7a1d29ad7800b6f3b763f9d230865cd1df441a (patch)
tree910fdababf8fbb2379fd6ee39f175dc21490f556
parent8ded16fd1b1bda46ff20eadd9bd596c45afc96d6 (diff)
downloadsubsurface-7e7a1d29ad7800b6f3b763f9d230865cd1df441a.tar.gz
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>
-rw-r--r--qt-ui/usermanual.cpp8
-rw-r--r--qt-ui/usermanual.h2
-rw-r--r--qt-ui/usermanual.ui263
3 files changed, 127 insertions, 146 deletions
diff --git a/qt-ui/usermanual.cpp b/qt-ui/usermanual.cpp
index 56f0fe1c3..cb9b4da50 100644
--- a/qt-ui/usermanual.cpp
+++ b/qt-ui/usermanual.cpp
@@ -6,7 +6,7 @@
#include "../helpers.h"
UserManual::UserManual(QWidget *parent) :
- QWidget(parent),
+ QMainWindow(parent),
ui(new Ui::UserManual)
{
ui->setupUi(this);
@@ -21,12 +21,12 @@ UserManual::UserManual(QWidget *parent) :
actionHideSearch->setShortcutContext(Qt::WindowShortcut);
addAction(actionHideSearch);
+ setWindowTitle(tr("User Manual"));
+
ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
QString searchPath = getSubsurfaceDataPath("Documentation");
if (searchPath != "") {
QUrl url(searchPath.append("/user-manual.html"));
- ui->webView->setWindowTitle(tr("User Manual"));
- ui->webView->setWindowIcon(QIcon(":/subsurface-icon"));
ui->webView->setUrl(url);
} else {
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)
{
- if (ui->webView->findText(text, flags) || text.length() == 0) {
+ if (ui->webView->findText(text, QWebPage::FindWrapsAroundDocument|flags) || text.length() == 0) {
ui->searchEdit->setStyleSheet("");
} else {
ui->searchEdit->setStyleSheet("QLineEdit{background: red;}");
diff --git a/qt-ui/usermanual.h b/qt-ui/usermanual.h
index f915f4c1e..6c5860206 100644
--- a/qt-ui/usermanual.h
+++ b/qt-ui/usermanual.h
@@ -8,7 +8,7 @@ namespace Ui {
class UserManual;
}
-class UserManual : public QWidget
+class UserManual : public QMainWindow
{
Q_OBJECT
diff --git a/qt-ui/usermanual.ui b/qt-ui/usermanual.ui
index de0784f39..766a0a832 100644
--- a/qt-ui/usermanual.ui
+++ b/qt-ui/usermanual.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>UserManual</class>
- <widget class="QWidget" name="UserManual">
+ <widget class="QMainWindow" name="UserManual">
<property name="geometry">
<rect>
<x>0</x>
@@ -10,130 +10,126 @@
<height>599</height>
</rect>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QFrame" name="searchPanel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>230</width>
- <height>40</height>
- </size>
- </property>
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="spacing">
- <number>0</number>
- </property>
- <property name="leftMargin">
- <number>9</number>
- </property>
- <property name="topMargin">
- <number>9</number>
+ <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>
+ <widget class="QWidget" name="searchPanel" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="rightMargin">
- <number>0</number>
+ <property name="minimumSize">
+ <size>
+ <width>230</width>
+ <height>40</height>
+ </size>
</property>
- <property name="bottomMargin">
- <number>0</number>
+ <property name="autoFillBackground">
+ <bool>true</bool>
</property>
- <item>
- <widget class="QLineEdit" name="searchEdit">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="findPrev">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset theme="go-previous">
- <normaloff/>
- </iconset>
- </property>
- <property name="flat">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="findNext">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset theme="go-next">
- <normaloff/>
- </iconset>
- </property>
- <property name="flat">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="findClose">
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset theme="window-close">
- <normaloff/>
- </iconset>
- </property>
- <property name="flat">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <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>
- </layout>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="topMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLineEdit" name="searchEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="findPrev">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset theme="go-previous">
+ <normaloff/>
+ </iconset>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="findNext">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset theme="go-next">
+ <normaloff/>
+ </iconset>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="findClose">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset theme="window-close">
+ <normaloff/>
+ </iconset>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWebView" name="webView" native="true"/>
+ </item>
+ </layout>
+ </widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
@@ -143,23 +139,8 @@
<header>qwebview.h</header>
</customwidget>
</customwidgets>
- <resources/>
- <connections>
- <connection>
- <sender>findClose</sender>
- <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>
+ <resources>
+ <include location="../subsurface.qrc"/>
+ </resources>
+ <connections/>
</ui>