Mercurial > octave
annotate libgui/src/qtinfo/webinfo.cc @ 21203:710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rename guard #ifdef names to use octave_ namespace prefix and file name.
Indent #ifdef blocks.
* Backend.cc, Backend.h, BaseControl.cc, BaseControl.h, ButtonControl.cc,
ButtonControl.h, Canvas.cc, Canvas.h, CheckBoxControl.cc, CheckBoxControl.h,
Container.cc, Container.h, ContextMenu.cc, ContextMenu.h, EditControl.cc,
EditControl.h, Figure.cc, Figure.h, FigureWindow.cc, FigureWindow.h,
GLCanvas.cc, GLCanvas.h, GenericEventNotify.h, KeyMap.cc, KeyMap.h,
ListBoxControl.cc, ListBoxControl.h, Logger.cc, Logger.h, Menu.cc, Menu.h,
MenuContainer.h, MouseModeActionGroup.cc, MouseModeActionGroup.h, Object.cc,
Object.h, ObjectFactory.cc, ObjectFactory.h, ObjectProxy.cc, ObjectProxy.h,
Panel.cc, Panel.h, PopupMenuControl.cc, PopupMenuControl.h,
PushButtonControl.cc, PushButtonControl.h, PushTool.cc, PushTool.h,
QtHandlesUtils.cc, QtHandlesUtils.h, RadioButtonControl.cc,
RadioButtonControl.h, SliderControl.cc, SliderControl.h, TextControl.cc,
TextControl.h, TextEdit.cc, TextEdit.h, ToggleButtonControl.cc,
ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h,
ToolBarButton.cc, ToolBarButton.h, __init_qt__.cc, __init_qt__.h,
annotation-dialog.cc, annotation-dialog.h, gl-select.cc, gl-select.h,
color-picker.cc, color-picker.h, dialog.cc, documentation-dock-widget.cc,
documentation-dock-widget.h, files-dock-widget.cc, files-dock-widget.h,
find-files-dialog.cc, find-files-dialog.h, find-files-model.cc,
find-files-model.h, history-dock-widget.cc, history-dock-widget.h,
file-editor-interface.h, file-editor-tab.cc, file-editor-tab.h, file-editor.cc,
file-editor.h, find-dialog.cc, find-dialog.h, octave-qscintilla.cc,
octave-txt-lexer.cc, main-window.cc, octave-cmd.cc, octave-dock-widget.cc,
octave-gui.cc, octave-interpreter.cc, octave-interpreter.h, octave-qt-link.cc,
octave-qt-link.h, parser.cc, webinfo.cc, resource-manager.cc,
resource-manager.h, settings-dialog.cc, settings-dialog.h, shortcut-manager.cc,
shortcut-manager.h, terminal-dock-widget.cc, terminal-dock-widget.h,
thread-manager.cc, welcome-wizard.cc, welcome-wizard.h, workspace-model.cc,
workspace-view.cc:
Clean up naming and indentation of #ifdef blocks in libgui.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 06 Feb 2016 07:32:37 -0800 |
parents | 9e3b3aca6ead |
children | 40de9f8f23a6 |
rev | line source |
---|---|
16768 | 1 /* |
2 | |
3 Copyright (C) 2009 P. L. Lucas | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19524
diff
changeset
|
4 Copyright (C) 2012-2015 Jacob Dawid |
16768 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
10 Free Software Foundation; either version 3 of the License, or (at your | |
11 option) any later version. | |
12 | |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with Octave; see the file COPYING. If not, see | |
20 <http://www.gnu.org/licenses/>. | |
21 | |
22 */ | |
23 | |
24 // Author: P. L. Lucas | |
18640
a25bbe8c954c
Update Jacob Dawid's email address
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
18555
diff
changeset
|
25 // Author: Jacob Dawid <jacob.dawid@cybercatalyst.com> |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
26 |
15265
f463154f1c1b
provide correct name of info file for the doc viewer (bug #37229)
Torsten <ttl@justmail.de>
parents:
15196
diff
changeset
|
27 #ifdef HAVE_CONFIG_H |
21203
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
20632
diff
changeset
|
28 # include <config.h> |
15265
f463154f1c1b
provide correct name of info file for the doc viewer (bug #37229)
Torsten <ttl@justmail.de>
parents:
15196
diff
changeset
|
29 #endif |
f463154f1c1b
provide correct name of info file for the doc viewer (bug #37229)
Torsten <ttl@justmail.de>
parents:
15196
diff
changeset
|
30 |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
31 #include "webinfo.h" |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
32 #include <QVBoxLayout> |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
33 #include <QHBoxLayout> |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
34 #include <QApplication> |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
35 #include <QClipboard> |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
36 |
15265
f463154f1c1b
provide correct name of info file for the doc viewer (bug #37229)
Torsten <ttl@justmail.de>
parents:
15196
diff
changeset
|
37 #include "file-ops.h" |
f463154f1c1b
provide correct name of info file for the doc viewer (bug #37229)
Torsten <ttl@justmail.de>
parents:
15196
diff
changeset
|
38 #include "help.h" |
f463154f1c1b
provide correct name of info file for the doc viewer (bug #37229)
Torsten <ttl@justmail.de>
parents:
15196
diff
changeset
|
39 #include "defaults.h" |
19899 | 40 #include "resource-manager.h" |
15265
f463154f1c1b
provide correct name of info file for the doc viewer (bug #37229)
Torsten <ttl@justmail.de>
parents:
15196
diff
changeset
|
41 |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
42 |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
43 webinfo::webinfo (QWidget *p) |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
44 : QWidget (p) |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
45 { |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
46 _font_web = font (); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
47 |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
48 QVBoxLayout *vbox_layout = new QVBoxLayout (); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
49 vbox_layout->setMargin (0); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
50 setLayout (vbox_layout); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
51 |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
52 QHBoxLayout *hbox_layout = new QHBoxLayout (); |
17750
94c7b2252490
add more recognizable icons for the font size in the doc browser
Torsten <ttl@justmail.de>
parents:
17744
diff
changeset
|
53 hbox_layout->setMargin (0); |
94c7b2252490
add more recognizable icons for the font size in the doc browser
Torsten <ttl@justmail.de>
parents:
17744
diff
changeset
|
54 hbox_layout->setSpacing (0); |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
55 vbox_layout->addLayout (hbox_layout); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
56 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
57 _tab_bar = new QTabBar (this); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
58 _tab_bar->setSizePolicy (QSizePolicy::Preferred,QSizePolicy::Preferred); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
59 _tab_bar->setExpanding (false); |
16529
faccc20d5f39
allow doc browser tabs to be moved and individually closed
John W. Eaton <jwe@octave.org>
parents:
15494
diff
changeset
|
60 _tab_bar->setTabsClosable (true); |
18235
0eeab61e07d8
smaller height of tabs in the document viewer
Torsten <ttl@justmail.de>
parents:
18185
diff
changeset
|
61 #ifdef HAVE_QTABWIDGET_SETMOVABLE |
16529
faccc20d5f39
allow doc browser tabs to be moved and individually closed
John W. Eaton <jwe@octave.org>
parents:
15494
diff
changeset
|
62 _tab_bar->setMovable (true); |
18235
0eeab61e07d8
smaller height of tabs in the document viewer
Torsten <ttl@justmail.de>
parents:
18185
diff
changeset
|
63 #endif |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
64 hbox_layout->addWidget (_tab_bar); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
65 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
66 _zoom_in_button = new QToolButton (this); |
19899 | 67 _zoom_in_button->setIcon (resource_manager::icon ("zoom-in")); |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
68 hbox_layout->addWidget (_zoom_in_button); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
69 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
70 _zoom_out_button = new QToolButton (this); |
19899 | 71 _zoom_out_button->setIcon (resource_manager::icon ("zoom-out")); |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
72 hbox_layout->addWidget (_zoom_out_button); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
73 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
74 _stacked_widget = new QStackedWidget (this); |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
75 vbox_layout->addWidget (_stacked_widget); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
76 |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
77 hbox_layout = new QHBoxLayout (); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
78 vbox_layout->addLayout (hbox_layout); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
79 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
80 _search_line_edit = new QLineEdit(this); |
15291
7ae14907ae43
build: Add tests for specific Qt functions to configure.ac
Rik <rik@octave.org>
parents:
15287
diff
changeset
|
81 #ifdef HAVE_SETPLACEHOLDERTEXT |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
82 _search_line_edit->setPlaceholderText ( |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
83 tr ("Type here and press \'Return\' to search")); |
15287
8639a450a89e
build: Test for QT setPlaceholderText function before using it.
Rik <rik@octave.org>
parents:
15265
diff
changeset
|
84 #endif |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
85 hbox_layout->addWidget (_search_line_edit); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
86 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
87 _search_check_box = new QCheckBox (tr ("Global search")); |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
88 hbox_layout->addWidget (_search_check_box); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
89 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
90 connect (_tab_bar, SIGNAL (tabCloseRequested (int)), this, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
91 SLOT (close_tab (int))); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
92 connect (_tab_bar, SIGNAL (currentChanged (int)), this, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
93 SLOT (current_tab_changed (int))); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
94 connect (_zoom_in_button, SIGNAL (clicked ()), this, SLOT (zoom_in ())); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
95 connect (_zoom_out_button, SIGNAL (clicked ()), this, SLOT (zoom_out ())); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
96 connect (_search_line_edit, SIGNAL (returnPressed ()), this, SLOT (search ())); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
97 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
98 resize (500, 300); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
99 |
19461
17e6c770e6ac
check existence of uncompressed or compressed info files for doc viewer
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
100 if (! set_info_path (QString::fromStdString (Vinfo_file))) |
18185
d03a6d272fee
display error message in document browser when info file is missing
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
101 { // Info file does not exist |
d03a6d272fee
display error message in document browser when info file is missing
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
102 _search_check_box->setEnabled (false); |
d03a6d272fee
display error message in document browser when info file is missing
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
103 _search_line_edit->setEnabled (false); |
d03a6d272fee
display error message in document browser when info file is missing
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
104 |
d03a6d272fee
display error message in document browser when info file is missing
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
105 QTextBrowser *msg = addNewTab (tr ("Error")); |
19461
17e6c770e6ac
check existence of uncompressed or compressed info files for doc viewer
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
106 QString msg_text = QString ( |
17e6c770e6ac
check existence of uncompressed or compressed info files for doc viewer
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
107 "<html><body><br><br><center><b>%1</b></center></body></html>"). |
17e6c770e6ac
check existence of uncompressed or compressed info files for doc viewer
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
108 arg (tr ("The info file<p>%1<p>or compressed versions do not exist"). |
17e6c770e6ac
check existence of uncompressed or compressed info files for doc viewer
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
109 arg(QString::fromStdString (Vinfo_file))); |
18185
d03a6d272fee
display error message in document browser when info file is missing
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
110 msg->setHtml (msg_text); |
d03a6d272fee
display error message in document browser when info file is missing
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
111 } |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
112 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
113 |
19461
17e6c770e6ac
check existence of uncompressed or compressed info files for doc viewer
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
114 bool |
15300
fd27e10b9b05
pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents:
15291
diff
changeset
|
115 webinfo::set_info_path (const QString& info_path) |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
116 { |
19461
17e6c770e6ac
check existence of uncompressed or compressed info files for doc viewer
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
117 if (_parser.set_info_path (info_path)) |
17e6c770e6ac
check existence of uncompressed or compressed info files for doc viewer
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
118 { |
17e6c770e6ac
check existence of uncompressed or compressed info files for doc viewer
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
119 load_node ("Top"); |
17e6c770e6ac
check existence of uncompressed or compressed info files for doc viewer
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
120 return true; |
17e6c770e6ac
check existence of uncompressed or compressed info files for doc viewer
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
121 } |
17e6c770e6ac
check existence of uncompressed or compressed info files for doc viewer
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
122 else |
17e6c770e6ac
check existence of uncompressed or compressed info files for doc viewer
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
123 return false; |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
124 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
125 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
126 void |
15300
fd27e10b9b05
pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents:
15291
diff
changeset
|
127 webinfo::load_node (const QString& node_name) |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
128 { |
17739
0640892429a8
remove XREF from tab names in the documentation browser
Torsten <ttl@justmail.de>
parents:
17030
diff
changeset
|
129 // no XREF in the tabs |
0640892429a8
remove XREF from tab names in the documentation browser
Torsten <ttl@justmail.de>
parents:
17030
diff
changeset
|
130 QString tab_text = node_name; |
0640892429a8
remove XREF from tab names in the documentation browser
Torsten <ttl@justmail.de>
parents:
17030
diff
changeset
|
131 tab_text.replace("XREF",""); |
0640892429a8
remove XREF from tab names in the documentation browser
Torsten <ttl@justmail.de>
parents:
17030
diff
changeset
|
132 |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
133 //Check if node has been already opened. |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
134 for (int i = 0; i < _tab_bar->count (); i++) |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
135 { |
17739
0640892429a8
remove XREF from tab names in the documentation browser
Torsten <ttl@justmail.de>
parents:
17030
diff
changeset
|
136 if (tab_text == _tab_bar->tabText (i)) |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
137 { |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
138 _tab_bar->setCurrentIndex (i); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
139 return; |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
140 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
141 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
142 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
143 QString text = _parser.search_node (node_name); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
144 int i = _parser.is_ref (node_name); |
17739
0640892429a8
remove XREF from tab names in the documentation browser
Torsten <ttl@justmail.de>
parents:
17030
diff
changeset
|
145 _text_browser = addNewTab (tab_text); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
146 _text_browser->setHtml (_parser.node_text_to_html (text, i - 1, "anchor")); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
147 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
148 if (i != -1) |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
149 { |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
150 _text_browser->scrollToAnchor ("anchor"); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
151 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
152 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
153 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
154 void |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
155 webinfo::link_clicked (const QUrl & link) |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
156 { |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
157 QString node = link.toString (); |
17768
271c0cce0f64
remove XREF from the links in the docuemntation
Torsten <ttl@justmail.de>
parents:
17750
diff
changeset
|
158 if (node.at (0) != '#') |
271c0cce0f64
remove XREF from the links in the docuemntation
Torsten <ttl@justmail.de>
parents:
17750
diff
changeset
|
159 load_node (node); |
271c0cce0f64
remove XREF from the links in the docuemntation
Torsten <ttl@justmail.de>
parents:
17750
diff
changeset
|
160 else |
271c0cce0f64
remove XREF from the links in the docuemntation
Torsten <ttl@justmail.de>
parents:
17750
diff
changeset
|
161 _text_browser->scrollToAnchor (node); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
162 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
163 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
164 void |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
165 webinfo::current_tab_changed (int index) |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
166 { |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
167 QVariant tab_data = _tab_bar->tabData (index); |
15494
05aee5a1ff37
silence some compilation warnings
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15368
diff
changeset
|
168 _text_browser = static_cast<QTextBrowser*> (tab_data.value<void*> ()); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
169 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
170 _stacked_widget->setCurrentIndex (_stacked_widget->indexOf (_text_browser)); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
171 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
172 if (_text_browser->font () != _font_web) |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
173 { |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
174 _text_browser->setFont (_font_web); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
175 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
176 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
177 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
178 QTextBrowser * |
15300
fd27e10b9b05
pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents:
15291
diff
changeset
|
179 webinfo::addNewTab (const QString& name) |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
180 { |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
181 _text_browser = new QTextBrowser (this); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
182 _text_browser->setOpenLinks (false); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
183 _text_browser->show (); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
184 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
185 connect (_text_browser, SIGNAL (anchorClicked (const QUrl &)), this, |
18678
6113e0c6920b
maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents:
18640
diff
changeset
|
186 SLOT (link_clicked (const QUrl &))); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
187 disconnect(_tab_bar, SIGNAL (currentChanged(int)), this, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
188 SLOT (current_tab_changed (int))); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
189 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
190 int ns = _stacked_widget->addWidget (_text_browser); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
191 _stacked_widget->setCurrentIndex (ns); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
192 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
193 int nt = _tab_bar->addTab (name); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
194 _tab_bar->setCurrentIndex (nt); |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
195 QVariant tab_data; |
15494
05aee5a1ff37
silence some compilation warnings
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15368
diff
changeset
|
196 tab_data.setValue (static_cast<void*> (_text_browser)); |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15300
diff
changeset
|
197 _tab_bar->setTabData (nt, tab_data); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
198 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
199 connect (_tab_bar, SIGNAL (currentChanged (int)), this, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
200 SLOT (current_tab_changed (int))); |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
201 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
202 if (_text_browser->font () != _font_web) |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
203 { |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
204 _text_browser->setFont (_font_web); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
205 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
206 return _text_browser; |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
207 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
208 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
209 void |
16529
faccc20d5f39
allow doc browser tabs to be moved and individually closed
John W. Eaton <jwe@octave.org>
parents:
15494
diff
changeset
|
210 webinfo::close_tab (int index) |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
211 { |
16529
faccc20d5f39
allow doc browser tabs to be moved and individually closed
John W. Eaton <jwe@octave.org>
parents:
15494
diff
changeset
|
212 if (_tab_bar->count () > 1) |
faccc20d5f39
allow doc browser tabs to be moved and individually closed
John W. Eaton <jwe@octave.org>
parents:
15494
diff
changeset
|
213 { |
faccc20d5f39
allow doc browser tabs to be moved and individually closed
John W. Eaton <jwe@octave.org>
parents:
15494
diff
changeset
|
214 QVariant tab_data = _tab_bar->tabData (index); |
faccc20d5f39
allow doc browser tabs to be moved and individually closed
John W. Eaton <jwe@octave.org>
parents:
15494
diff
changeset
|
215 QWidget *w = static_cast<QWidget*> (tab_data.value<void*> ()); |
faccc20d5f39
allow doc browser tabs to be moved and individually closed
John W. Eaton <jwe@octave.org>
parents:
15494
diff
changeset
|
216 _stacked_widget->removeWidget (w); |
faccc20d5f39
allow doc browser tabs to be moved and individually closed
John W. Eaton <jwe@octave.org>
parents:
15494
diff
changeset
|
217 delete w; |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
218 |
16529
faccc20d5f39
allow doc browser tabs to be moved and individually closed
John W. Eaton <jwe@octave.org>
parents:
15494
diff
changeset
|
219 _tab_bar->removeTab (index); |
faccc20d5f39
allow doc browser tabs to be moved and individually closed
John W. Eaton <jwe@octave.org>
parents:
15494
diff
changeset
|
220 } |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
221 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
222 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
223 void |
17029
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
224 webinfo::load_ref (const QString &ref_name) |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
225 { |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
226 QString text = _parser.find_ref (ref_name); |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
227 if (text.length () > 0) |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
228 { |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
229 load_node (text); |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
230 } |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
231 else |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
232 { |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
233 // not found |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
234 load_node("Top"); |
17029
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
235 } |
17030
05b8ad3b7d12
Display/focus documentation browser when running command doc 'xxxxx'
John Donoghue <john.donoghue@ieee.org>
parents:
17029
diff
changeset
|
236 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
237 if (_text_browser) |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
238 _text_browser->setFocus(); |
17029
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
239 } |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
240 |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
16881
diff
changeset
|
241 void |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
242 webinfo::search () |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
243 { |
20632
9e3b3aca6ead
prevent doc browser from searching for an empty string (bug 46227)
Torsten <ttl@justmail.de>
parents:
19899
diff
changeset
|
244 if (_search_line_edit->text ().trimmed ().isEmpty ()) |
9e3b3aca6ead
prevent doc browser from searching for an empty string (bug 46227)
Torsten <ttl@justmail.de>
parents:
19899
diff
changeset
|
245 return; // do nothing if search field is empty or only has whitespaces |
9e3b3aca6ead
prevent doc browser from searching for an empty string (bug 46227)
Torsten <ttl@justmail.de>
parents:
19899
diff
changeset
|
246 |
15055
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
247 if (_search_check_box->isChecked ()) |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
248 { |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
249 // Global search |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
250 QString results = _parser.global_search (_search_line_edit->text (), 5); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
251 _text_browser=addNewTab ("Results for: " + _search_line_edit->text ()); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
252 _text_browser->setHtml (results); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
253 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
254 else |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
255 { |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
256 // Local search |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
257 _text_browser->find (_search_line_edit->text ()); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
258 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
259 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
260 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
261 void |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
262 webinfo::zoom_in () |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
263 { |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
264 _font_web.setPointSize (_font_web.pointSize() + 1); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
265 _text_browser->setFont (_font_web); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
266 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
267 |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
268 void |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
269 webinfo::zoom_out () |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
270 { |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
271 _font_web.setPointSize (_font_web.pointSize() - 1); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
272 _text_browser->setFont (_font_web); |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
273 } |
48ae6a7c69c1
Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff
changeset
|
274 |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
275 void |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
276 webinfo::copyClipboard () |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
277 { |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
278 if (_search_line_edit->hasFocus () && _search_line_edit->hasSelectedText ()) |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
279 { |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
280 QClipboard *clipboard = QApplication::clipboard (); |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
281 |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
282 clipboard->setText (_search_line_edit->selectedText ()); |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
283 } |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
284 if (_text_browser->hasFocus ()) |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
285 { |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
286 _text_browser->copy (); |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
287 } |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
288 } |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
289 |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
290 void |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
291 webinfo::selectAll () |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
292 { |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
293 if (_search_line_edit->hasFocus ()) |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
294 { |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
295 _search_line_edit->selectAll (); |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
296 } |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
297 if (_text_browser->hasFocus ()) |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
298 { |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
299 _text_browser->selectAll (); |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
300 } |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
301 } |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
302 |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
303 |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18235
diff
changeset
|
304 void |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
305 webinfo::pasteClipboard () |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
306 { |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
307 if (_search_line_edit->hasFocus ()) |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
308 { |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
309 QClipboard *clipboard = QApplication::clipboard (); |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
310 QString str = clipboard->text (); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17768
diff
changeset
|
311 if (str.length () > 0) |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
312 _search_line_edit->insert (str); |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
313 } |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
314 } |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16768
diff
changeset
|
315 |