Subversion Repositories Scribus

Rev

Rev 4519 | Rev 4905 | 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>
4676 cbradney 36
#include <qtextbrowser.h>
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 QToolButton;
46
class QPopupMenu;
786 cbradney 47
class QSplitter;
2006 subik 48
class QLabel;
49
class QLineEdit;
50
class QPushButton;
2023 subik 51
class QMenuBar;
4519 subik 52
class PrefsContext;
560 cbradney 53
 
2052 subik 54
 
4519 subik 55
//! \brief A structure holding title/file url reference.
2052 subik 56
struct histd {
57
        QString url;
58
        QString title;
59
};
60
 
61
 
4519 subik 62
 
63
/*! \brief Inherited QListViewItem provides double number values sorting.
64
Guides lists contains double values in 1st (0) columns. Standard QListViewItem
65
provides string sorting so I have to create some special number related one ;)
66
\author Petr Vanek <petr@yarpen.cz>
67
 */
68
class SCRIBUS_API HelpListItem : public QListViewItem
69
{
70
public:
71
        //! \brief Only 3 columns here...
72
        HelpListItem(QListView *parent, QString c1, QString c2, QString c3) : QListViewItem(parent, c1, c2, c3){};
73
 
74
        /*! \brief Reimplemented compare method to handle int values.
75
        When is no double in column col parent string compare() is called.
76
        \param i QListViewItem to compare with.
77
        \param col column to sort (1 here)
78
        \param asc ascendent on true.
79
        \retval int -1 for (x lt y), 1 for (x gt y). See Qt docs for more info.
80
         */
81
        int compare(QListViewItem *i, int col, bool asc) const;
82
};
83
 
4676 cbradney 84
/*! \brief Text browser widget used in help browser.
85
On Windows, launch automatically default browser when an http link is clicked
86
*/
87
class SCRIBUS_API TextBrowser : public QTextBrowser
88
{
89
        Q_OBJECT
90
public:
91
        TextBrowser(QWidget * parent = 0, const char * name = 0);
4519 subik 92
 
4676 cbradney 93
public slots:
94
        /*! \brief Sets the name of the displayed document to name.
95
        On Windows, the default web browser is launched if a web link is clicked
96
        */
97
        virtual void setSource(const QString &name);
98
};
99
 
100
 
2052 subik 101
/*! \brief This is the Help dialog for Scribus. */
2969 craig 102
class SCRIBUS_API HelpBrowser : public QWidget
560 cbradney 103
{
104
        Q_OBJECT
3 paul 105
 
106
public:
564 cbradney 107
        HelpBrowser( QWidget* parent, QString caption, QString guiLangage="en", QString jumpToSection="", QString jumpToFile="");
560 cbradney 108
        ~HelpBrowser();
3 paul 109
 
4458 subik 110
        /*! \brief History menu. It's public because of history reader - separate class */
2052 subik 111
        QPopupMenu* histMenu;
4458 subik 112
        /*! \brief Mapping the documents for history. */
2052 subik 113
        QMap<int, histd> mHistory;
4458 subik 114
        /*! \brief Set text to the browser
115
        \param str a QString with text (html) */
116
        void setText(QString str);
2052 subik 117
 
786 cbradney 118
protected:
2052 subik 119
        //! layouts
786 cbradney 120
        QVBoxLayout* helpBrowsermainLayout;
121
        QHBoxLayout* helpBrowserLayout;
122
        QHBoxLayout* tabLayout;
123
        QHBoxLayout* buttonLayout;
2006 subik 124
        QVBoxLayout* searchingMainLayout;
125
        QHBoxLayout* searchingButtonLayout;
4458 subik 126
        //! \brief History tool buttons
560 cbradney 127
        QToolButton* homeButton;
4458 subik 128
        //! \brief Holds histMenu
560 cbradney 129
        QToolButton* backButton;
130
        QToolButton* forwButton;
2048 subik 131
        //! bookmarks
132
        QHBoxLayout* bookmarksButtonLayout;
133
        QVBoxLayout* bookmarksMainLayout;
560 cbradney 134
 
4458 subik 135
        //! \brief Widget holding the listviews
560 cbradney 136
        QTabWidget* tabWidget;
4458 subik 137
        //! \brief Main table of contents - parent widget
560 cbradney 138
        QWidget* tabContents;
4458 subik 139
        //! \brief Main table of contents
560 cbradney 140
        QListView* listView;
4458 subik 141
        //! \brief There is documentation shown
560 cbradney 142
        QTextBrowser* textBrowser;
4458 subik 143
        //! \brief Rubber bar between ToC and browser
786 cbradney 144
        QSplitter* splitter;
4458 subik 145
        //! \brief Selected language is here. If there is no docs for this language, "en" is used.
1092 cbradney 146
        QString language;
4458 subik 147
        //! \brief searching
2048 subik 148
        QWidget* tabSearching;
2006 subik 149
        QLineEdit* searchingEdit;
150
        QPushButton* searchingButton;
151
        QListView* searchingView;
4458 subik 152
        //! \brief bookmarks
2048 subik 153
        QWidget* tabBookmarks;
154
        QPushButton* bookmarkButton;
155
        QPushButton* deleteBookmarkButton;
156
        QPushButton* deleteAllBookmarkButton;
157
        QListView* bookmarksView;
4458 subik 158
        //! \brief menu
2023 subik 159
        QMenuBar *menuBar;
560 cbradney 160
 
4458 subik 161
        /*! \brief Text to be finded in document */
2006 subik 162
        QString findText;
4519 subik 163
        /** \brief Configuration structure */
164
        PrefsContext* prefs;
2048 subik 165
 
2006 subik 166
        /*! \brief Search in doc files in spec. dir.
167
        It uses directory-recursion. I hope that the documentation will have
168
        only 2-3 level dir structure so it doesn't matter.
169
        \author Petr Vanek <petr@yarpen.cz> */
170
        void searchingInDirectory(QString);
171
 
4458 subik 172
        /*! \brief Reads saved bookmarks from external file */
2048 subik 173
        void readBookmarks();
174
 
4458 subik 175
        /*! \brief Reads saved history of browsing. */
2052 subik 176
        void readHistory();
177
 
560 cbradney 178
protected slots:
179
        virtual void languageChange();
2006 subik 180
 
4458 subik 181
        /*! \brief Load doc file when user select filename in content view. */
560 cbradney 182
        void itemSelected( QListViewItem *);
2006 subik 183
 
4458 subik 184
        /*! \brief Load doc file when user select filename in search view.
2006 subik 185
        Then it performs some doc-finding and highlighting.
186
        \author Petr Vanek <petr@yarpen.cz> */
187
        void itemSearchSelected( QListViewItem *);
560 cbradney 188
        void histChosen(int i);
1092 cbradney 189
        void jumpToHelpSection(QString jumpToSection, QString jumpToFile="");
560 cbradney 190
        void loadHelp(QString filename);
1092 cbradney 191
        void loadMenu();
2006 subik 192
 
193
        /*! \brief Performs searching in documentation.
194
        It walks through installed documentation and searching in all text files
195
        \author Petr Vanek <petr@yarpen.cz> */
196
        void searchingButton_clicked();
197
 
198
        /*! \brief Find text in one document.
199
        Classical ctrl+f searching.
200
        \author Petr Vanek <petr@yarpen.cz> */
201
        void find();
202
 
203
        /*! \brief Find next occurences of the text in one document.
204
        \author Petr Vanek <petr@yarpen.cz> */
205
        void findNext();
2023 subik 206
 
207
        /*! \brief Find previous occurences of the text in one document.
208
        \author Petr Vanek <petr@yarpen.cz> */
209
        void findPrevious();
210
 
211
        /*! \brief Print the documentation.
212
        Based on the Qt example.
213
        */
214
        void print();
215
 
4458 subik 216
        /*! \brief Add document into bookmarks. */
2048 subik 217
        void bookmarkButton_clicked();
218
 
4458 subik 219
        /*! \brief Delete selected document from bookmarks. */
2048 subik 220
        void deleteBookmarkButton_clicked();
221
 
4458 subik 222
        /*! \brief Delete all bookmarks */
2048 subik 223
        void deleteAllBookmarkButton_clicked();
224
 
3 paul 225
};
226
 
227
#endif // HELPBROWSER_H
2023 subik 228