Rev 4458 | Rev 4676 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4430 | cbradney | 1 | /* |
2 | For general Scribus (>=1.3.2) copyright and licensing information please refer |
||
3 | to the COPYING file provided with the program. Following this notice may exist |
||
4 | a copyright and/or license notice that predates the release of Scribus 1.3.2 |
||
5 | for which a new license (GPL+exception) is in place. |
||
6 | */ |
||
564 | cbradney | 7 | /*************************************************************************** |
8 | * Copyright (C) 2004 by Craig Bradney * |
||
9 | * cbradney@zip.com.au * |
||
2052 | subik | 10 | * Copyright (C) 2005 by Petr Vanek * |
11 | * petr@yarpen.cz * |
||
564 | cbradney | 12 | * * |
13 | * This program is free software; you can redistribute it and/or modify * |
||
14 | * it under the terms of the GNU General Public License as published by * |
||
15 | * the Free Software Foundation; either version 2 of the License, or * |
||
16 | * (at your option) any later version. * |
||
17 | * * |
||
18 | * This program is distributed in the hope that it will be useful, * |
||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
21 | * GNU General Public License for more details. * |
||
22 | * * |
||
23 | * You should have received a copy of the GNU General Public License * |
||
24 | * along with this program; if not, write to the * |
||
25 | * Free Software Foundation, Inc., * |
||
26 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
27 | ***************************************************************************/ |
||
560 | cbradney | 28 | |
3 | paul | 29 | #ifndef HELPBROWSER_H |
30 | #define HELPBROWSER_H |
||
31 | |||
560 | cbradney | 32 | #include <qvariant.h> |
3 | paul | 33 | #include <qdialog.h> |
560 | cbradney | 34 | #include <qstring.h> |
4519 | subik | 35 | #include <qlistview.h> |
3 | paul | 36 | |
2969 | craig | 37 | #include "scribusapi.h" |
38 | |||
560 | cbradney | 39 | class QVBoxLayout; |
40 | class QHBoxLayout; |
||
41 | class QGridLayout; |
||
42 | class QSpacerItem; |
||
43 | class QTabWidget; |
||
44 | class QWidget; |
||
45 | class QTextBrowser; |
||
46 | class QToolButton; |
||
47 | class QPopupMenu; |
||
786 | cbradney | 48 | class QSplitter; |
2006 | subik | 49 | class QLabel; |
50 | class QLineEdit; |
||
51 | class QPushButton; |
||
2023 | subik | 52 | class QMenuBar; |
4519 | subik | 53 | class PrefsContext; |
560 | cbradney | 54 | |
2052 | subik | 55 | |
4519 | subik | 56 | //! \brief A structure holding title/file url reference. |
2052 | subik | 57 | struct histd { |
58 | QString url; |
||
59 | QString title; |
||
60 | }; |
||
61 | |||
62 | |||
4519 | subik | 63 | |
64 | /*! \brief Inherited QListViewItem provides double number values sorting. |
||
65 | Guides lists contains double values in 1st (0) columns. Standard QListViewItem |
||
66 | provides string sorting so I have to create some special number related one ;) |
||
67 | \author Petr Vanek <petr@yarpen.cz> |
||
68 | */ |
||
69 | class SCRIBUS_API HelpListItem : public QListViewItem |
||
70 | { |
||
71 | public: |
||
72 | //! \brief Only 3 columns here... |
||
73 | HelpListItem(QListView *parent, QString c1, QString c2, QString c3) : QListViewItem(parent, c1, c2, c3){}; |
||
74 | |||
75 | /*! \brief Reimplemented compare method to handle int values. |
||
76 | When is no double in column col parent string compare() is called. |
||
77 | \param i QListViewItem to compare with. |
||
78 | \param col column to sort (1 here) |
||
79 | \param asc ascendent on true. |
||
80 | \retval int -1 for (x lt y), 1 for (x gt y). See Qt docs for more info. |
||
81 | */ |
||
82 | int compare(QListViewItem *i, int col, bool asc) const; |
||
83 | }; |
||
84 | |||
85 | |||
2052 | subik | 86 | /*! \brief This is the Help dialog for Scribus. */ |
2969 | craig | 87 | class SCRIBUS_API HelpBrowser : public QWidget |
560 | cbradney | 88 | { |
89 | Q_OBJECT |
||
3 | paul | 90 | |
91 | public: |
||
564 | cbradney | 92 | HelpBrowser( QWidget* parent, QString caption, QString guiLangage="en", QString jumpToSection="", QString jumpToFile=""); |
560 | cbradney | 93 | ~HelpBrowser(); |
3 | paul | 94 | |
4458 | subik | 95 | /*! \brief History menu. It's public because of history reader - separate class */ |
2052 | subik | 96 | QPopupMenu* histMenu; |
4458 | subik | 97 | /*! \brief Mapping the documents for history. */ |
2052 | subik | 98 | QMap<int, histd> mHistory; |
4458 | subik | 99 | /*! \brief Set text to the browser |
100 | \param str a QString with text (html) */ |
||
101 | void setText(QString str); |
||
2052 | subik | 102 | |
786 | cbradney | 103 | protected: |
2052 | subik | 104 | //! layouts |
786 | cbradney | 105 | QVBoxLayout* helpBrowsermainLayout; |
106 | QHBoxLayout* helpBrowserLayout; |
||
107 | QHBoxLayout* tabLayout; |
||
108 | QHBoxLayout* buttonLayout; |
||
2006 | subik | 109 | QVBoxLayout* searchingMainLayout; |
110 | QHBoxLayout* searchingButtonLayout; |
||
4458 | subik | 111 | //! \brief History tool buttons |
560 | cbradney | 112 | QToolButton* homeButton; |
4458 | subik | 113 | //! \brief Holds histMenu |
560 | cbradney | 114 | QToolButton* backButton; |
115 | QToolButton* forwButton; |
||
2048 | subik | 116 | //! bookmarks |
117 | QHBoxLayout* bookmarksButtonLayout; |
||
118 | QVBoxLayout* bookmarksMainLayout; |
||
560 | cbradney | 119 | |
4458 | subik | 120 | //! \brief Widget holding the listviews |
560 | cbradney | 121 | QTabWidget* tabWidget; |
4458 | subik | 122 | //! \brief Main table of contents - parent widget |
560 | cbradney | 123 | QWidget* tabContents; |
4458 | subik | 124 | //! \brief Main table of contents |
560 | cbradney | 125 | QListView* listView; |
4458 | subik | 126 | //! \brief There is documentation shown |
560 | cbradney | 127 | QTextBrowser* textBrowser; |
4458 | subik | 128 | //! \brief Rubber bar between ToC and browser |
786 | cbradney | 129 | QSplitter* splitter; |
4458 | subik | 130 | //! \brief Selected language is here. If there is no docs for this language, "en" is used. |
1092 | cbradney | 131 | QString language; |
4458 | subik | 132 | //! \brief searching |
2048 | subik | 133 | QWidget* tabSearching; |
2006 | subik | 134 | QLineEdit* searchingEdit; |
135 | QPushButton* searchingButton; |
||
136 | QListView* searchingView; |
||
4458 | subik | 137 | //! \brief bookmarks |
2048 | subik | 138 | QWidget* tabBookmarks; |
139 | QPushButton* bookmarkButton; |
||
140 | QPushButton* deleteBookmarkButton; |
||
141 | QPushButton* deleteAllBookmarkButton; |
||
142 | QListView* bookmarksView; |
||
4458 | subik | 143 | //! \brief menu |
2023 | subik | 144 | QMenuBar *menuBar; |
560 | cbradney | 145 | |
4458 | subik | 146 | /*! \brief Text to be finded in document */ |
2006 | subik | 147 | QString findText; |
4519 | subik | 148 | /** \brief Configuration structure */ |
149 | PrefsContext* prefs; |
||
2048 | subik | 150 | |
2006 | subik | 151 | /*! \brief Search in doc files in spec. dir. |
152 | It uses directory-recursion. I hope that the documentation will have |
||
153 | only 2-3 level dir structure so it doesn't matter. |
||
154 | \author Petr Vanek <petr@yarpen.cz> */ |
||
155 | void searchingInDirectory(QString); |
||
156 | |||
4458 | subik | 157 | /*! \brief Reads saved bookmarks from external file */ |
2048 | subik | 158 | void readBookmarks(); |
159 | |||
4458 | subik | 160 | /*! \brief Reads saved history of browsing. */ |
2052 | subik | 161 | void readHistory(); |
162 | |||
560 | cbradney | 163 | protected slots: |
164 | virtual void languageChange(); |
||
2006 | subik | 165 | |
4458 | subik | 166 | /*! \brief Load doc file when user select filename in content view. */ |
560 | cbradney | 167 | void itemSelected( QListViewItem *); |
2006 | subik | 168 | |
4458 | subik | 169 | /*! \brief Load doc file when user select filename in search view. |
2006 | subik | 170 | Then it performs some doc-finding and highlighting. |
171 | \author Petr Vanek <petr@yarpen.cz> */ |
||
172 | void itemSearchSelected( QListViewItem *); |
||
560 | cbradney | 173 | void histChosen(int i); |
1092 | cbradney | 174 | void jumpToHelpSection(QString jumpToSection, QString jumpToFile=""); |
560 | cbradney | 175 | void loadHelp(QString filename); |
1092 | cbradney | 176 | void loadMenu(); |
2006 | subik | 177 | |
178 | /*! \brief Performs searching in documentation. |
||
179 | It walks through installed documentation and searching in all text files |
||
180 | \author Petr Vanek <petr@yarpen.cz> */ |
||
181 | void searchingButton_clicked(); |
||
182 | |||
183 | /*! \brief Find text in one document. |
||
184 | Classical ctrl+f searching. |
||
185 | \author Petr Vanek <petr@yarpen.cz> */ |
||
186 | void find(); |
||
187 | |||
188 | /*! \brief Find next occurences of the text in one document. |
||
189 | \author Petr Vanek <petr@yarpen.cz> */ |
||
190 | void findNext(); |
||
2023 | subik | 191 | |
192 | /*! \brief Find previous occurences of the text in one document. |
||
193 | \author Petr Vanek <petr@yarpen.cz> */ |
||
194 | void findPrevious(); |
||
195 | |||
196 | /*! \brief Print the documentation. |
||
197 | Based on the Qt example. |
||
198 | */ |
||
199 | void print(); |
||
200 | |||
4458 | subik | 201 | /*! \brief Add document into bookmarks. */ |
2048 | subik | 202 | void bookmarkButton_clicked(); |
203 | |||
4458 | subik | 204 | /*! \brief Delete selected document from bookmarks. */ |
2048 | subik | 205 | void deleteBookmarkButton_clicked(); |
206 | |||
4458 | subik | 207 | /*! \brief Delete all bookmarks */ |
2048 | subik | 208 | void deleteAllBookmarkButton_clicked(); |
209 | |||
3 | paul | 210 | }; |
211 | |||
212 | #endif // HELPBROWSER_H |
||
2023 | subik | 213 |