diff options
245 files changed, 5401 insertions, 17277 deletions
@@ -44,7 +44,6 @@ my %modules = ( # path to module name map "Qt3Support" => "$basedir/src/qt3support", "ActiveQt" => "$basedir/src/activeqt/container;$basedir/src/activeqt/control;$basedir/src/activeqt/shared", "QtTest" => "$basedir/src/testlib", - "QtAssistant" => "$basedir/tools/assistant/compat/lib", "QtHelp" => "$basedir/tools/assistant/lib", "QtDesigner" => "$basedir/tools/designer/src/lib", "QtUiTools" => "$basedir/tools/designer/src/uitools", @@ -678,7 +677,7 @@ my @ignore_for_master_contents = ( "qt.h", "qpaintdevicedefs.h" ); my @ignore_for_include_check = ( "qatomic.h" ); my @ignore_for_qt_begin_header_check = ( "qiconset.h", "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qt_windows.h" ); my @ignore_for_qt_begin_namespace_check = ( "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qatomic_arch.h", "qatomic_windowsce.h", "qt_windows.h", "qatomic_macosx.h" ); -my @ignore_for_qt_module_check = ( "$modules{QtCore}/arch", "$modules{QtCore}/global", "$modules{QtSql}/drivers", "$modules{QtTest}", "$modules{QtAssistant}", "$modules{QtDesigner}", "$modules{QtUiTools}", "$modules{QtDBus}", "$modules{phonon}" ); +my @ignore_for_qt_module_check = ( "$modules{QtCore}/arch", "$modules{QtCore}/global", "$modules{QtSql}/drivers", "$modules{QtTest}", "$modules{QtDesigner}", "$modules{QtUiTools}", "$modules{QtDBus}", "$modules{phonon}" ); foreach (@modules_to_sync) { #iteration info diff --git a/demos/browser/browsermainwindow.cpp b/demos/browser/browsermainwindow.cpp index ed36c25..8c2ed89 100644 --- a/demos/browser/browsermainwindow.cpp +++ b/demos/browser/browsermainwindow.cpp @@ -433,10 +433,8 @@ void BrowserMainWindow::setupMenu() QMenu *toolsMenu = menuBar()->addMenu(tr("&Tools")); toolsMenu->addAction(tr("Web &Search"), this, SLOT(slotWebSearch()), QKeySequence(tr("Ctrl+K", "Web Search"))); -#ifndef Q_CC_MINGW a = toolsMenu->addAction(tr("Enable Web &Inspector"), this, SLOT(slotToggleInspector(bool))); a->setCheckable(true); -#endif QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt())); diff --git a/dist/changes-4.7.0 b/dist/changes-4.7.0 new file mode 100644 index 0000000..92f5244 --- /dev/null +++ b/dist/changes-4.7.0 @@ -0,0 +1,122 @@ +Qt 4.7 introduces many new features and improvements as well as bugfixes +over the 4.6.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + + http://doc.trolltech.com/4.7 + +The Qt version 4.7 series is binary compatible with the 4.6.x series. +Applications compiled for 4.6 will continue to run with 4.7. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Task Tracker: + + http://www.qtsoftware.com/developer/task-tracker + +Each of these identifiers can be entered in the task tracker to obtain more +information about a particular change. + +**************************************************************************** +* General * +**************************************************************************** + +General Improvements +-------------------- + +- Documentation and Examples + +Third party components +---------------------- + + +**************************************************************************** +* Library * +**************************************************************************** + + +**************************************************************************** +* Database Drivers * +**************************************************************************** + + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + +Qt for Linux/X11 +---------------- + + +Qt for Windows +-------------- + + +Qt for Mac OS X +--------------- + + +Qt for Embedded Linux +--------------------- + + +Qt for Windows CE +----------------- + + +**************************************************************************** +* Compiler Specific Changes * +**************************************************************************** + + +**************************************************************************** +* Tools * +**************************************************************************** + +- Build System + +- Assistant + + +- Designer + + +- Linguist + - Linguist GUI + + - lupdate + + - lrelease + + +- rcc + + +- moc + + +- uic + + +- uic3 + + +- qmake + + +- configure + + +- qtconfig + + +- qt3to4 + + +**************************************************************************** +* Plugins * +**************************************************************************** + + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index 8ba106c..bc6ae98 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -87,30 +87,30 @@ \header \o {4,1} Qt's Libraries \row - \o \l {QtAssistant} \o \l {QAxContainer} \o \l {QAxServer} \o \l {QtCore} - \row \o \l {QtDBus} + \row \o \l {QtDesigner} \o \l {QtGui} \o \l {QtHelp} - \row \o \l {QtNetwork} + \row \o \l {QtOpenGL} \o \l {QtScript} \o \l {QtScriptTools} - \row \o \l {QtSql} + \row \o \l {QtSvg} \o \l {QtWebKit} \o \l {QtXml} - \row \o \l {QtXmlPatterns} + \row \o \l {Phonon Module}{Phonon} \o \l {Qt3Support} - \o + \o \l {} + \o \l {} \endtable Since Qt is not a system library, it has to be redistributed along diff --git a/doc/src/development/assistant-manual.qdoc b/doc/src/development/assistant-manual.qdoc index c4eb615..8a10c5f 100644 --- a/doc/src/development/assistant-manual.qdoc +++ b/doc/src/development/assistant-manual.qdoc @@ -638,12 +638,19 @@ file in the \c{file} tags. It is possible to specify a different file or any language. The icon defined by the \c{icon} tags is applied to any language. \row - \o \c{<cacheDirectory>} - \o Specified as a path relative to the directory given by - QDesktopServices::DataLocation, the cache path is used to store index files + \o \c{<cacheDirectory base="collection|default">} + \o The cache directory is used to store index files needed for the full text search and a copy of the collection file. - The copy is needed because \QA stores all its settings in the collection file; - i.e., it must be writable for the user. + The copy is needed because \QA stores all its settings in the collection file; i.e., it must be writable for the user. + The directory is specified as a relative path. + If the \c{base} attribute is set to "collection", the path is + relative to the directory the collection file resides in. + If the attribute is set to "default" or if it is missing, + the path is relative to the directory given by + QDesktopServices::DataLocation. The first form is useful for + collections that are used in a "mobile" way, e.g. carried around + on a USB stick. + \endtable In addition to those \QA specific tags, the tags for generating and registering @@ -677,9 +684,6 @@ to make Assistant listen to your application, turn on its remote control functionality by passing the \c{-enableRemoteControl} command line option. - \warning The trailing '\0' must be appended separately to the QByteArray, - e.g., \c{QByteArray("command" + '\0')}. - The following example shows how this can be done: \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 2 @@ -690,6 +694,9 @@ \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 3 + Note that the trailing newline character is required to mark the end + of the input. + The following commands can be used to control \QA: \table @@ -727,13 +734,20 @@ \o Selects the item in the contents widget which corresponds to the currently displayed page. \row - \o \c{setCurrentFilter} + \o \c{setCurrentFilter <filter>} \o Selects the specified filter and updates the visual representation accordingly. \row \o \c{expandToc <Depth>} \o Expands the table of contents tree to the given depth. If depth - is less than 1, the tree will be collapsed completely. + is 0, the tree will be collapsed completely. If depth is -1, + the tree will be expanded completely. + \row + \o \c{register <help file>} + \o Adds the given Qt compressed help file to the collection. + \row + \o \c{unregister <help file>} + \o Removes the given Qt compressed help file from the collection. \endtable If you want to send several commands within a short period of time, it is diff --git a/doc/src/examples/contextsensitivehelp.qdoc b/doc/src/examples/contextsensitivehelp.qdoc new file mode 100644 index 0000000..668fa36 --- /dev/null +++ b/doc/src/examples/contextsensitivehelp.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example help/contextsensitivehelp + \title Context-Sensitive Help Example + + This example shows how to use the services of the QHelpEngineCore class. +*/ diff --git a/doc/src/getting-started/demos.qdoc b/doc/src/getting-started/demos.qdoc index 03e5aa6..6974634 100644 --- a/doc/src/getting-started/demos.qdoc +++ b/doc/src/getting-started/demos.qdoc @@ -46,7 +46,7 @@ \previouspage Qt Examples \contentspage How to Learn Qt - \nextpage What's New in Qt 4.6 + \nextpage What's New in Qt 4.7 This is the list of demonstrations in Qt's \c demos directory. These are larger and more complicated programs than the diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index 6b4ec61..9cda95a 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -1218,6 +1218,8 @@ \list \o \l{help/simpletextviewer}{Simple Text Viewer}\raisedaster + \o \l{help/remotecontrol}{Remote Control} + \o \l{help/contextsensitivehelp}{Context-Sensitive Help} \endlist Examples marked with an asterisk (*) are fully documented. diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 5f95c5a..e7f8fb9 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -740,9 +740,9 @@ If you are using pre-built binaries, follow the instructions given in the \l{http://www.microsoft.com/downloads/details.aspx?FamilyId=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&displaylang=en}{here} to avoid runtime conflicts. - If you are using a source code package of Qt, you must first install Perl so - that the syncqt script invoked by configure can be executed. You can download - this \l{http://www.activestate/downloads/}{here}. + If you are using a source edition of Qt, you must first install Perl so + that the syncqt script invoked by configure can be executed. You can download + this \l{http://www.activestate.com/downloads/}{here}. To build Qt with Phonon on Windows, you require: diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index 7c3b4a1..0a603ce 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -60,7 +60,7 @@ <ul> <li><a href="installation.html">Installation</a> and <a href="how-to-learn-qt.html">First Steps with Qt</a></li> <li><a href="tutorials.html">Tutorials</a> and <a href="examples.html">Examples</a></li> - <li><a href="demos.html">Demonstrations</a> and <a href="qt4-6-intro.html"><b>New in Qt 4.6</b></a></li> + <li><a href="demos.html">Demonstrations</a> and <a href="qt4-7-intro.html"><b>New in Qt 4.7</b></a></li> </ul> </td> <td valign="top"> diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index 44d6ed6..48e1358 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -1080,13 +1080,3 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." \endlegalese */ - -/*! - \page qtassistant.html - \title QtAssistant - - This module is no longer needed. Use the QtHelp module to integrate documentation - into your application. - - \sa {QtHelp} -*/ diff --git a/doc/src/snippets/code/doc_src_assistant-manual.qdoc b/doc/src/snippets/code/doc_src_assistant-manual.qdoc index 7438365..96aa71d 100644 --- a/doc/src/snippets/code/doc_src_assistant-manual.qdoc +++ b/doc/src/snippets/code/doc_src_assistant-manual.qdoc @@ -58,7 +58,7 @@ assistant -collectionFile file <cacheDirectory>mycompany/myapplication</cacheDirectory> <aboutMenuText> <text>About My Application</text> - <text language="de">ber meine Applikation...</text> + <text language="de">Über meine Applikation...</text> </aboutMenuText> <aboutDialog> <file>about.txt</file> @@ -95,8 +95,7 @@ if (!process->waitForStarted()) //! [3] QByteArray ba; -ba.append("setSource qthelp://com.mycompany.1_0_0/doc/index.html"); -ba.append('\0'); +ba.append("setSource qthelp://com.mycompany.1_0_0/doc/index.html\n"); process->write(ba); //! [3] @@ -105,8 +104,7 @@ process->write(ba); QByteArray ba; ba.append("hide bookmarks;"); ba.append("hide index;"); -ba.append("setSource qthelp://com.mycompany.1_0_0/doc/index.html"); -ba.append('\0'); +ba.append("setSource qthelp://com.mycompany.1_0_0/doc/index.html\n"); process->write(ba); //! [4] diff --git a/examples/assistant/README b/examples/assistant/README deleted file mode 100644 index 85f5a43..0000000 --- a/examples/assistant/README +++ /dev/null @@ -1,38 +0,0 @@ -Support for interactive help is provided by the Qt Assistant application. -Developers can take advantages of the facilities it offers to display -specially-prepared documentation to users of their applications. - - -The example launcher provided with Qt can be used to explore each of the -examples in this directory. - -Documentation for these examples can be found via the Tutorial and Examples -link in the main Qt documentation. - - -Finding the Qt Examples and Demos launcher -========================================== - -On Windows: - -The launcher can be accessed via the Windows Start menu. Select the menu -entry entitled "Qt Examples and Demos" entry in the submenu containing -the Qt tools. - -On Mac OS X: - -For the binary distribution, the qtdemo executable is installed in the -/Developer/Applications/Qt directory. For the source distribution, it is -installed alongside the other Qt tools on the path specified when Qt is -configured. - -On Unix/Linux: - -The qtdemo executable is installed alongside the other Qt tools on the path -specified when Qt is configured. - -On all platforms: - -The source code for the launcher can be found in the demos/qtdemo directory -in the Qt package. This example is built at the same time as the Qt libraries, -tools, examples, and demonstrations. diff --git a/examples/assistant/assistant.pro b/examples/assistant/assistant.pro deleted file mode 100644 index ff1f947..0000000 --- a/examples/assistant/assistant.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = simpletextviewer - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/assistant -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS assistant.pro README -sources.path = $$[QT_INSTALL_EXAMPLES]/assistant -INSTALLS += target sources - -symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/assistant/simpletextviewer/documentation/about.txt b/examples/assistant/simpletextviewer/documentation/about.txt deleted file mode 100644 index eeab35f..0000000 --- a/examples/assistant/simpletextviewer/documentation/about.txt +++ /dev/null @@ -1,9 +0,0 @@ -The Simple Text Viewer enables the user to select and view existing -files. - -HTML files is displayed using rich text, while other files are -presented as plain text. The application provides a file dialog -allowing the user to search for files using wildcard matching. The -search is performed within in the specified directory, and the user is -given an option to browse the existing file system to find the -relevant directory. diff --git a/examples/assistant/simpletextviewer/documentation/browse.html b/examples/assistant/simpletextviewer/documentation/browse.html deleted file mode 100644 index 987abf3..0000000 --- a/examples/assistant/simpletextviewer/documentation/browse.html +++ /dev/null @@ -1,34 +0,0 @@ -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <title>Browse</title> - </head> - <body style="font-size:12pt;font-family:helvetica"> - - <p><center><h2>Browse</h2></center></p> - - <p> - The file dialog let you browse the current file system to - specify the directory in which the file you want to open - resides. - Note that only the specified directory will be searched, any - subdirectories will simply be ignored. - </p> - - <br /> - <br /> - <table align="center" cellpadding="2" cellspacing="1" border="0" width="100%"> - <tr valign="top" bgcolor="#f0f0f0"> - <td><center><img src="images/browse.png" /></center></td> - </tr> - </table> - - <br /> - <br /> - <p> - See also: <a href="filedialog.html">File Dialog</a>, <a href="wildcardmatching.html">Wildcard Matching</a>, - <a href="findfile.html">Find File</a> - </p> - </body> -</html> - diff --git a/examples/assistant/simpletextviewer/documentation/filedialog.html b/examples/assistant/simpletextviewer/documentation/filedialog.html deleted file mode 100644 index afa65ed..0000000 --- a/examples/assistant/simpletextviewer/documentation/filedialog.html +++ /dev/null @@ -1,48 +0,0 @@ -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <title>File Dialog</title> - </head> - <body style="font-size:12pt;font-family:helvetica"> - - <p><center><h2>File Dialog</h2></center></p> - - <p> - In the file dialog you can name a particular file name, or - search for files using wildcard matching, i.e. specify a - file name containing wildcards. In addition you must specify - the directory in which the file you search for resides. - </p> - - <br /> - <br /> - <table align="center" cellpadding="2" cellspacing="1" border="0" width="100%"> - <tr valign="top" bgcolor="#f0f0f0"> - <td><center><img src="images/filedialog.png" /></center></td> - </tr> - </table> - - <br /> - <br /> - <p> - By default the dialog will search for all files (*) in the - current directory (the directory the application is run from). - </p> - - <p> - When editing the file name and directory parameters, an - overview of the matching files are displayed in the - dialog. The overview is updated whenever the parameters - change. - </p> - - <br /> - <br /> - <p> - See also: <a href="browse.html">Browse</a>, <a href="wildcardmatching.html">Wildcard Matching</a>, - <a href="findfile.html">Find File</a> - </p> - </body> -</html> - - diff --git a/examples/assistant/simpletextviewer/documentation/findfile.html b/examples/assistant/simpletextviewer/documentation/findfile.html deleted file mode 100644 index 32e0147..0000000 --- a/examples/assistant/simpletextviewer/documentation/findfile.html +++ /dev/null @@ -1,32 +0,0 @@ -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <title>Find File</title> - </head> - <body style="font-size:12pt;font-family:helvetica"> - - <p><center><h2>Find File</h2></center></p> - - <p> - To open and view a file in the Simple Text Viewer, select the - 'Open...' option in the 'File' menu. The application will then - provide you with a file dialog that you can use to search for - any existing file. - </p> - - <br /> - <br /> - <table align="center" cellpadding="2" cellspacing="1" border="0" width="100%"> - <tr valign="top" bgcolor="#f0f0f0"> - <td><center><img src="images/fadedfilemenu.png" /></center></td> - </tr> - </table> - - <br /> - <br /> - <p> - See also: <a href="openfile.html">Open File</a>, <a href="filedialog.html">File Dialog</a> - </p> - </body> -</html> - diff --git a/examples/assistant/simpletextviewer/documentation/images/browse.png b/examples/assistant/simpletextviewer/documentation/images/browse.png Binary files differdeleted file mode 100644 index 86db6b1..0000000 --- a/examples/assistant/simpletextviewer/documentation/images/browse.png +++ /dev/null diff --git a/examples/assistant/simpletextviewer/documentation/images/fadedfilemenu.png b/examples/assistant/simpletextviewer/documentation/images/fadedfilemenu.png Binary files differdeleted file mode 100644 index fde0e43..0000000 --- a/examples/assistant/simpletextviewer/documentation/images/fadedfilemenu.png +++ /dev/null diff --git a/examples/assistant/simpletextviewer/documentation/images/filedialog.png b/examples/assistant/simpletextviewer/documentation/images/filedialog.png Binary files differdeleted file mode 100644 index 883a33a..0000000 --- a/examples/assistant/simpletextviewer/documentation/images/filedialog.png +++ /dev/null diff --git a/examples/assistant/simpletextviewer/documentation/images/handbook.png b/examples/assistant/simpletextviewer/documentation/images/handbook.png Binary files differdeleted file mode 100644 index 3bd2b92..0000000 --- a/examples/assistant/simpletextviewer/documentation/images/handbook.png +++ /dev/null diff --git a/examples/assistant/simpletextviewer/documentation/images/mainwindow.png b/examples/assistant/simpletextviewer/documentation/images/mainwindow.png Binary files differdeleted file mode 100644 index c28d5e9..0000000 --- a/examples/assistant/simpletextviewer/documentation/images/mainwindow.png +++ /dev/null diff --git a/examples/assistant/simpletextviewer/documentation/images/open.png b/examples/assistant/simpletextviewer/documentation/images/open.png Binary files differdeleted file mode 100644 index 1e5bba3..0000000 --- a/examples/assistant/simpletextviewer/documentation/images/open.png +++ /dev/null diff --git a/examples/assistant/simpletextviewer/documentation/images/wildcard.png b/examples/assistant/simpletextviewer/documentation/images/wildcard.png Binary files differdeleted file mode 100644 index 6e83a56..0000000 --- a/examples/assistant/simpletextviewer/documentation/images/wildcard.png +++ /dev/null diff --git a/examples/assistant/simpletextviewer/documentation/index.html b/examples/assistant/simpletextviewer/documentation/index.html deleted file mode 100644 index 5a7b1d5..0000000 --- a/examples/assistant/simpletextviewer/documentation/index.html +++ /dev/null @@ -1,41 +0,0 @@ -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <title>Manual</title> - </head> - <body style="font-size:12pt;font-family:helvetica"> - - <p><center><h2>Simple Text Viewer</h2></center></p> - - <p> - The Simple Text Viewer enables the user to select and view - existing files. - </p> - - <p><center> - <img src="images/mainwindow.png" /> - </center></p> - - <p> - HTML files is displayed using rich text, while - other files are presented as plain text. The application - provides a file dialog allowing the user to search for files - using wildcard matching. The search is performed within in the - specified directory, and the user is given an option to browse - the existing file system to find the relevant directory. - </p> - - <ul> - <li><a href="findfile.html">Find File</a></li> - <ul> - <li><a href="filedialog.html">File Dialog</a></li> - <li><a href="wildcardmatching.html">WildCard Matching</a></li> - <li><a href="browse.html">Browse</a></li> - </ul> - <li><a href="openfile.html">Open File</a></li> - </ul> - </body> -</html> - - - diff --git a/examples/assistant/simpletextviewer/documentation/intro.html b/examples/assistant/simpletextviewer/documentation/intro.html deleted file mode 100644 index 2e2aa40..0000000 --- a/examples/assistant/simpletextviewer/documentation/intro.html +++ /dev/null @@ -1,28 +0,0 @@ -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <title>Manual</title> - </head> - <body style="font-size:12pt;font-family:helvetica"> - - <p><center><h2>Simple Text Viewer</h2></center></p> - - <p> - The Simple Text Viewer enables the user to select and view - existing files. - </p> - - <p><center> - <img src="images/mainwindow.png" /> - </center></p> - - <p> - The application provides its own custom documentation that is - available through the <b>Help</b> menu in the main window's menubar - and through the <b>Help</b> button in the application's find file - dialog. - </p> - - </body> -</html> - diff --git a/examples/assistant/simpletextviewer/documentation/openfile.html b/examples/assistant/simpletextviewer/documentation/openfile.html deleted file mode 100644 index e172de9..0000000 --- a/examples/assistant/simpletextviewer/documentation/openfile.html +++ /dev/null @@ -1,36 +0,0 @@ -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <title>Open File</title> - </head> - <body style="font-size:12pt;font-family:helvetica"> - - <p><center><h2>Open File</h2></center></p> - - <p> - Once the file you want to view appears in the dialog's - display, you can open it in two different ways. - </p> - - <p> - By pressing the 'Open' button the currently selected file will - be opened. By default, the first file in the list of matching - files is selected. Another way of opening a file is to simply - double click the displayed file name. - </p> - - <br /> - <br /> - <table align="center" cellpadding="2" cellspacing="1" border="0" width="100%"> - <tr valign="top" bgcolor="#f0f0f0"> - <td><center><img src="images/open.png" /></center></td> - </tr> - </table> - - <br /> - <br /> - <p> - See also: <a href="findfile.html">Find File</a> - </p> - </body> -</html> diff --git a/examples/assistant/simpletextviewer/documentation/simpletextviewer.adp b/examples/assistant/simpletextviewer/documentation/simpletextviewer.adp deleted file mode 100644 index 660df4f..0000000 --- a/examples/assistant/simpletextviewer/documentation/simpletextviewer.adp +++ /dev/null @@ -1,40 +0,0 @@ -<!DOCTYPE DCF> - -<assistantconfig version="3.2.0"> - -<profile> - <property name="name">simpletextviewer</property> - <property name="title">Simple Text Viewer</property> - <property name="applicationicon">images/handbook.png</property> - <property name="startpage">index.html</property> - <property name="aboutmenutext">About Simple Text Viewer</property> - <property name="abouturl">about.txt</property> - <property name="assistantdocs">.</property> -</profile> - -<DCF ref="index.html" icon="images/handbook.png" title="Simple Text Viewer"> - <section ref="./findfile.html" title="Find File"> - <keyword ref="./index.html">Display</keyword> - <keyword ref="./index.html">Rich text</keyword> - <keyword ref="./index.html">Plain text</keyword> - <keyword ref="./findfile.html">Find</keyword> - <keyword ref="./findfile.html">File menu</keyword> - <keyword ref="./filedialog.html">File name</keyword> - <keyword ref="./filedialog.html">File dialog</keyword> - <keyword ref="./wildcardmatching.html">File globbing</keyword> - <keyword ref="./wildcardmatching.html">Wildcard matching</keyword> - <keyword ref="./wildcardmatching.html">Wildcard syntax</keyword> - <keyword ref="./browse.html">Browse</keyword> - <keyword ref="./browse.html">Directory</keyword> - <keyword ref="./openfile.html">Open</keyword> - <keyword ref="./openfile.html">Select</keyword> - - <section ref="./filedialog.html" title="File Dialog" /> - <section ref="./wildcardmatching.html" title="Wildcard Matching" /> - <section ref="./browse.html" title="Browse" /> - </section> - <section ref="./openfile.html" title="Open File" /> -</DCF> - -</assistantconfig> - diff --git a/examples/assistant/simpletextviewer/documentation/wildcardmatching.html b/examples/assistant/simpletextviewer/documentation/wildcardmatching.html deleted file mode 100644 index eb1839a..0000000 --- a/examples/assistant/simpletextviewer/documentation/wildcardmatching.html +++ /dev/null @@ -1,57 +0,0 @@ -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <title>Wildcard Matching</title> - </head> - <body style="font-size:12pt;font-family:helvetica"> - - <p><center><h2>Wildcard Matching</h2></center></p> - - <p> - Most command shells such as bash or cmd.exe support "file - globbing", the ability to identify a group of files by using - wildcards. - - <br /> - <br /> - <table align="center" cellpadding="2" cellspacing="1" border="0" width="100%"> - <tr valign="top" bgcolor="#f0f0f0"> - <td><center><img src="images/wildcard.png" /></center></td> - </tr> - </table> - - <br /> - <br /> - <p> - Wildcard matching provides four features: - </p> - - <ul> - <li>Any character represents itself apart from those - mentioned below. Thus 'c' matches the character 'c'. - </li> - <li>The '?' character matches any single character.</li> - <li>The '*' matches zero or more of any characters.</li> - <li>Sets of characters can be represented in square brackets. - Within the character class, like outside, backslash - has no special meaning. - </li> - </ul> - - <p> - For example we could identify HTML files with - <code>*.html</code>. This will match zero or more characters - followed by a dot followed by 'h', 't', 'm' and 'l'. - </p> - - <br /> - <br /> - <p> - See also: <a href="browse.html">Browse</a>, <a href="filedialog.html">File Dialog</a>, - <a href="findfile.html">Find File</a> - </p> - </body> -</html> - - - diff --git a/examples/assistant/simpletextviewer/findfiledialog.cpp b/examples/assistant/simpletextviewer/findfiledialog.cpp deleted file mode 100644 index 939d90a..0000000 --- a/examples/assistant/simpletextviewer/findfiledialog.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtGui> - -#include "findfiledialog.h" - -//! [0] -FindFileDialog::FindFileDialog(QTextEdit *editor, QAssistantClient *assistant, - QWidget *parent) - : QDialog(parent) -{ - currentAssistantClient = assistant; - currentEditor = editor; -//! [0] - - createButtons(); - createComboBoxes(); - createFilesTree(); - createLabels(); - createLayout(); - - directoryComboBox->addItem(QDir::toNativeSeparators(QDir::currentPath())); - fileNameComboBox->addItem("*"); - findFiles(); - - setWindowTitle(tr("Find File")); -//! [1] -} -//! [1] - -void FindFileDialog::browse() -{ - QString currentDirectory = directoryComboBox->currentText(); - QString newDirectory = QFileDialog::getExistingDirectory(this, - tr("Select Directory"), currentDirectory); - if (!newDirectory.isEmpty()) { - directoryComboBox->addItem(QDir::toNativeSeparators(newDirectory)); - directoryComboBox->setCurrentIndex(directoryComboBox->count() - 1); - update(); - } -} - -//! [2] -void FindFileDialog::help() -{ - currentAssistantClient->showPage(QLibraryInfo::location(QLibraryInfo::ExamplesPath) + - QDir::separator() + "assistant/simpletextviewer/documentation/filedialog.html"); -} -//! [2] - -void FindFileDialog::openFile(QTreeWidgetItem *item) -{ - if (!item) { - item = foundFilesTree->currentItem(); - if (!item) - return; - } - - QString fileName = item->text(0); - QString path = directoryComboBox->currentText() + QDir::separator(); - - QFile file(path + fileName); - if (file.open(QIODevice::ReadOnly)) { - QString data(file.readAll()); - - if (fileName.endsWith(".html")) - currentEditor->setHtml(data); - else - currentEditor->setPlainText(data); - } - close(); -} - -void FindFileDialog::update() -{ - findFiles(); - buttonBox->button(QDialogButtonBox::Open)->setEnabled( - foundFilesTree->topLevelItemCount() > 0); -} - -void FindFileDialog::findFiles() -{ - QRegExp filePattern(fileNameComboBox->currentText() + "*"); - filePattern.setPatternSyntax(QRegExp::Wildcard); - - QDir directory(directoryComboBox->currentText()); - - QStringList allFiles = directory.entryList(QDir::Files | QDir::NoSymLinks); - QStringList matchingFiles; - - foreach (QString file, allFiles) { - if (filePattern.exactMatch(file)) - matchingFiles << file; - } - showFiles(matchingFiles); -} - -void FindFileDialog::showFiles(const QStringList &files) -{ - foundFilesTree->clear(); - - for (int i = 0; i < files.count(); ++i) { - QTreeWidgetItem *item = new QTreeWidgetItem(foundFilesTree); - item->setText(0, files[i]); - } - - if (files.count() > 0) - foundFilesTree->setCurrentItem(foundFilesTree->topLevelItem(0)); -} - -void FindFileDialog::createButtons() -{ - browseButton = new QToolButton; - browseButton->setText(tr("...")); - connect(browseButton, SIGNAL(clicked()), this, SLOT(browse())); - - buttonBox = new QDialogButtonBox(QDialogButtonBox::Open - | QDialogButtonBox::Cancel - | QDialogButtonBox::Help); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(openFile())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(help())); -} - -void FindFileDialog::createComboBoxes() -{ - directoryComboBox = new QComboBox; - fileNameComboBox = new QComboBox; - - fileNameComboBox->setEditable(true); - fileNameComboBox->setSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Preferred); - - directoryComboBox->setMinimumContentsLength(30); - directoryComboBox->setSizeAdjustPolicy( - QComboBox::AdjustToMinimumContentsLength); - directoryComboBox->setSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Preferred); - - connect(fileNameComboBox, SIGNAL(editTextChanged(QString)), - this, SLOT(update())); - connect(directoryComboBox, SIGNAL(currentIndexChanged(QString)), - this, SLOT(update())); -} - -void FindFileDialog::createFilesTree() -{ - foundFilesTree = new QTreeWidget; - foundFilesTree->setColumnCount(1); - foundFilesTree->setHeaderLabels(QStringList(tr("Matching Files"))); - foundFilesTree->setRootIsDecorated(false); - foundFilesTree->setSelectionMode(QAbstractItemView::SingleSelection); - - connect(foundFilesTree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), - this, SLOT(openFile(QTreeWidgetItem*))); -} - -void FindFileDialog::createLabels() -{ - directoryLabel = new QLabel(tr("Search in:")); - fileNameLabel = new QLabel(tr("File name (including wildcards):")); -} - -void FindFileDialog::createLayout() -{ - QHBoxLayout *fileLayout = new QHBoxLayout; - fileLayout->addWidget(fileNameLabel); - fileLayout->addWidget(fileNameComboBox); - - QHBoxLayout *directoryLayout = new QHBoxLayout; - directoryLayout->addWidget(directoryLabel); - directoryLayout->addWidget(directoryComboBox); - directoryLayout->addWidget(browseButton); - - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addLayout(fileLayout); - mainLayout->addLayout(directoryLayout); - mainLayout->addWidget(foundFilesTree); - mainLayout->addStretch(); - mainLayout->addWidget(buttonBox); - setLayout(mainLayout); -} diff --git a/examples/assistant/simpletextviewer/findfiledialog.h b/examples/assistant/simpletextviewer/findfiledialog.h deleted file mode 100644 index aac27f1..0000000 --- a/examples/assistant/simpletextviewer/findfiledialog.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef FINDFILEDIALOG_H -#define FINDFILEDIALOG_H - -#include <QAssistantClient> -#include <QDialog> - -QT_BEGIN_NAMESPACE -class QComboBox; -class QDialogButtonBox; -class QLabel; -class QTextEdit; -class QToolButton; -class QTreeWidget; -class QTreeWidgetItem; -QT_END_NAMESPACE - -//! [0] -class FindFileDialog : public QDialog -{ - Q_OBJECT - -public: - FindFileDialog(QTextEdit *editor, QAssistantClient *assistant, - QWidget *parent = 0); - -private slots: - void browse(); - void help(); - void openFile(QTreeWidgetItem *item = 0); - void update(); - -private: - void findFiles(); - void showFiles(const QStringList &files); - - void createButtons(); - void createComboBoxes(); - void createFilesTree(); - void createLabels(); - void createLayout(); - - QAssistantClient *currentAssistantClient; - QTextEdit *currentEditor; - QTreeWidget *foundFilesTree; - - QComboBox *directoryComboBox; - QComboBox *fileNameComboBox; - - QLabel *directoryLabel; - QLabel *fileNameLabel; - - QDialogButtonBox *buttonBox; - - QToolButton *browseButton; -}; -//! [0] - -#endif diff --git a/examples/assistant/simpletextviewer/mainwindow.cpp b/examples/assistant/simpletextviewer/mainwindow.cpp deleted file mode 100644 index 03eab02..0000000 --- a/examples/assistant/simpletextviewer/mainwindow.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtGui> - -#include "mainwindow.h" -#include "findfiledialog.h" - -//! [0] -MainWindow::MainWindow() -{ - textViewer = new QTextEdit; - textViewer->setReadOnly(true); - QFile file("documentation/intro.html"); - if (file.open(QIODevice::ReadOnly)) - textViewer->setHtml(file.readAll()); - - setCentralWidget(textViewer); - - createActions(); - createMenus(); - - initializeAssistant(); - - setWindowTitle(tr("Simple Text Viewer")); - resize(750, 400); -} -//! [0] - -//! [1] -void MainWindow::closeEvent(QCloseEvent *) -{ - if (assistantClient) - assistantClient->closeAssistant(); -} -//! [1] - -void MainWindow::about() -{ - QMessageBox::about(this, tr("About Simple Text Viewer"), - tr("This example demonstrates how to use\n" \ - "Qt Assistant as help system for your\n" \ - "own application.")); -} - -//! [2] -void MainWindow::assistant() -{ - assistantClient->showPage(QLibraryInfo::location(QLibraryInfo::ExamplesPath) + - QDir::separator() + - "assistant/simpletextviewer/documentation/index.html"); -} -//! [2] - -//! [3] -void MainWindow::open() -{ - FindFileDialog dialog(textViewer, assistantClient); - dialog.exec(); -} -//! [3] - -void MainWindow::createActions() -{ - assistantAct = new QAction(tr("Help Contents"), this); - assistantAct->setShortcuts(QKeySequence::HelpContents); - connect(assistantAct, SIGNAL(triggered()), this, SLOT(assistant())); - - openAct = new QAction(tr("&Open..."), this); - openAct->setShortcuts(QKeySequence::Open); - connect(openAct, SIGNAL(triggered()), this, SLOT(open())); - - clearAct = new QAction(tr("&Clear"), this); - clearAct->setShortcut(tr("Ctrl+C")); - connect(clearAct, SIGNAL(triggered()), textViewer, SLOT(clear())); - - exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcuts(QKeySequence::Quit); - connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); - - aboutAct = new QAction(tr("&About"), this); - connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); - - aboutQtAct = new QAction(tr("About &Qt"), this); - connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); -} - -void MainWindow::createMenus() -{ - fileMenu = new QMenu(tr("&File"), this); - fileMenu->addAction(openAct); - fileMenu->addAction(clearAct); - fileMenu->addSeparator(); - fileMenu->addAction(exitAct); - - helpMenu = new QMenu(tr("&Help"), this); - helpMenu->addAction(assistantAct); - helpMenu->addSeparator(); - helpMenu->addAction(aboutAct); - helpMenu->addAction(aboutQtAct); - - - menuBar()->addMenu(fileMenu); - menuBar()->addMenu(helpMenu); -} - -//! [4] -void MainWindow::initializeAssistant() -{ - assistantClient = new QAssistantClient(QLibraryInfo::location(QLibraryInfo::BinariesPath), this); - - QStringList arguments; - arguments << "-profile" << QString("documentation") + QDir::separator() + QString("simpletextviewer.adp"); - assistantClient->setArguments(arguments); -} -//! [4] diff --git a/examples/assistant/simpletextviewer/simpletextviewer.pro b/examples/assistant/simpletextviewer/simpletextviewer.pro deleted file mode 100644 index 2c0eada..0000000 --- a/examples/assistant/simpletextviewer/simpletextviewer.pro +++ /dev/null @@ -1,18 +0,0 @@ -CONFIG += assistant - -QT += network - -HEADERS = mainwindow.h \ - findfiledialog.h -SOURCES = main.cpp \ - mainwindow.cpp \ - findfiledialog.cpp - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/assistant/simpletextviewer -sources.files = $$SOURCES $$HEADERS $$RESOURCES documentation *.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/assistant/simpletextviewer -INSTALLS += target sources - -symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - diff --git a/examples/examples.pro b/examples/examples.pro index d11e36b..3678cc0 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -48,10 +48,10 @@ contains(QT_CONFIG, phonon):!static: SUBDIRS += phonon contains(QT_CONFIG, webkit): SUBDIRS += webkit embedded:SUBDIRS += qws !wince*:!symbian: { - !contains(QT_EDITION, Console):contains(QT_BUILD_PARTS, tools):SUBDIRS += designer - contains(QT_BUILD_PARTS, tools):SUBDIRS += assistant qtestlib help + !contains(QT_EDITION, Console):contains(QT_BUILD_PARTS, tools):SUBDIRS += designer + contains(QT_BUILD_PARTS, tools):SUBDIRS += qtestlib help } else { - contains(QT_BUILD_PARTS, tools):SUBDIRS += qtestlib + contains(QT_BUILD_PARTS, tools):SUBDIRS += qtestlib } contains(QT_CONFIG, opengl): SUBDIRS += opengl contains(QT_CONFIG, openvg): SUBDIRS += openvg diff --git a/examples/help/remotecontrol/remotecontrol.cpp b/examples/help/remotecontrol/remotecontrol.cpp index 2492298..b51d8f7 100644 --- a/examples/help/remotecontrol/remotecontrol.cpp +++ b/examples/help/remotecontrol/remotecontrol.cpp @@ -123,7 +123,7 @@ void RemoteControl::sendCommand(const QString &cmd) { if (process->state() != QProcess::Running) return; - process->write(cmd.toLocal8Bit() + '\0'); + process->write(cmd.toLocal8Bit() + '\n'); } void RemoteControl::on_indexButton_clicked() diff --git a/examples/help/simpletextviewer/assistant.cpp b/examples/help/simpletextviewer/assistant.cpp index 7d779f3..3acc193 100644 --- a/examples/help/simpletextviewer/assistant.cpp +++ b/examples/help/simpletextviewer/assistant.cpp @@ -73,7 +73,7 @@ void Assistant::showDocumentation(const QString &page) QByteArray ba("SetSource "); ba.append("qthelp://com.trolltech.examples.simpletextviewer/doc/"); - proc->write(ba + page.toLocal8Bit() + '\0'); + proc->write(ba + page.toLocal8Bit() + '\n'); } //! [1] diff --git a/examples/webkit/fancybrowser/main.cpp b/examples/webkit/fancybrowser/main.cpp index cf98b51..23f9713 100644 --- a/examples/webkit/fancybrowser/main.cpp +++ b/examples/webkit/fancybrowser/main.cpp @@ -45,7 +45,12 @@ int main(int argc, char * argv[]) { QApplication app(argc, argv); - MainWindow browser; - browser.show(); + QUrl url; + if (argc > 1) + url = QUrl(argv[1]); + else + url = QUrl("http://www.google.com/ncr"); + MainWindow *browser = new MainWindow(url); + browser->show(); return app.exec(); } diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp index 852d981..1a4c765 100644 --- a/examples/webkit/fancybrowser/mainwindow.cpp +++ b/examples/webkit/fancybrowser/mainwindow.cpp @@ -45,7 +45,7 @@ //! [1] -MainWindow::MainWindow() +MainWindow::MainWindow(const QUrl& url) { progress = 0; @@ -60,7 +60,7 @@ MainWindow::MainWindow() //! [2] view = new QWebView(this); - view->load(QUrl("http://www.google.com/ncr")); + view->load(url); connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation())); connect(view, SIGNAL(titleChanged(QString)), SLOT(adjustTitle())); connect(view, SIGNAL(loadProgress(int)), SLOT(setProgress(int))); @@ -78,6 +78,11 @@ MainWindow::MainWindow() toolBar->addWidget(locationEdit); //! [2] + QMenu *viewMenu = menuBar()->addMenu(tr("&View")); + QAction* viewSourceAction = new QAction("Page Source", this); + connect(viewSourceAction, SIGNAL(triggered()), SLOT(viewSource())); + viewMenu->addAction(viewSourceAction); + //! [3] QMenu *effectMenu = menuBar()->addMenu(tr("&Effect")); effectMenu->addAction("Highlight all links", this, SLOT(highlightAllLinks())); @@ -100,6 +105,23 @@ MainWindow::MainWindow() } //! [3] +void MainWindow::viewSource() +{ + QNetworkAccessManager* accessManager = view->page()->networkAccessManager(); + QNetworkRequest request(view->url()); + QNetworkReply* reply = accessManager->get(request); + connect(reply, SIGNAL(finished()), this, SLOT(slotSourceDownloaded())); +} + +void MainWindow::slotSourceDownloaded() +{ + QNetworkReply* reply = qobject_cast<QNetworkReply*>(const_cast<QObject*>(sender())); + QTextEdit* textEdit = new QTextEdit(NULL); + textEdit->setAttribute(Qt::WA_DeleteOnClose); + textEdit->show(); + textEdit->setPlainText(reply->readAll()); +} + //! [4] void MainWindow::adjustLocation() { diff --git a/examples/webkit/fancybrowser/mainwindow.h b/examples/webkit/fancybrowser/mainwindow.h index 08439c1..d3f8e7e 100644 --- a/examples/webkit/fancybrowser/mainwindow.h +++ b/examples/webkit/fancybrowser/mainwindow.h @@ -52,7 +52,7 @@ class MainWindow : public QMainWindow Q_OBJECT public: - MainWindow(); + MainWindow(const QUrl& url); protected slots: @@ -62,6 +62,9 @@ protected slots: void setProgress(int p); void finishLoading(bool); + void viewSource(); + void slotSourceDownloaded(); + void highlightAllLinks(); void rotateImages(bool invert); void removeGifImages(); diff --git a/mkspecs/features/assistant.prf b/mkspecs/features/assistant.prf deleted file mode 100644 index 25e5d4d..0000000 --- a/mkspecs/features/assistant.prf +++ /dev/null @@ -1,9 +0,0 @@ - -INCLUDEPATH = $$QMAKE_INCDIR_QT/QtAssistant $$INCLUDEPATH - -mac:!static:contains(QT_CONFIG, qt_framework) { - qtAddLibrary(QtAssistant) -} else { - qtAddLibrary(QtAssistantClient) -} -QT += network diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 670e3a0..f51c046 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -544,7 +544,6 @@ UnixMakefileGenerator::processPrlFiles() { QList<QMakeLocalFileName> libdirs, frameworkdirs; frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks")); - frameworkdirs.append(QMakeLocalFileName("/Library/Frameworks")); const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_FRAMEWORKPATH_FLAGS", "QMAKE_LFLAGS", "QMAKE_LIBS", QString() }; for(int i = 0; !lflags[i].isNull(); i++) { QStringList &l = project->values(lflags[i]); diff --git a/qmake/option.cpp b/qmake/option.cpp index 9577a28..4eb14e2 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -136,6 +136,20 @@ static Option::QMAKE_MODE default_mode(QString progname) return Option::QMAKE_GENERATE_MAKEFILE; } +static QString detectProjectFile(const QString &path) +{ + QString ret; + QDir dir(path); + if(dir.exists(dir.dirName() + Option::pro_ext)) { + ret = dir.filePath(dir.dirName()) + Option::pro_ext; + } else { //last try.. + QStringList profiles = dir.entryList(QStringList("*" + Option::pro_ext)); + if(profiles.count() == 1) + ret = dir.filePath(profiles.at(0)); + } + return ret; +} + QString project_builtin_regx(); bool usage(const char *a0) { @@ -322,12 +336,18 @@ Option::parseCommandLine(int argc, char **argv, int skip) if(!fi.makeAbsolute()) //strange arg = fi.filePath(); if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || - Option::qmake_mode == Option::QMAKE_GENERATE_PRL) + Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { + if(fi.isDir()) { + QString proj = detectProjectFile(arg); + if (!proj.isNull()) + arg = proj; + } Option::mkfile::project_files.append(arg); - else if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) + } else if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { Option::projfile::project_dirs.append(arg); - else + } else { handled = false; + } } if(!handled) { return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; @@ -494,15 +514,9 @@ Option::init(int argc, char **argv) //try REALLY hard to do it for them, lazy.. if(Option::mkfile::project_files.isEmpty()) { - QString pwd = qmake_getpwd(), - proj = pwd + "/" + pwd.right(pwd.length() - (pwd.lastIndexOf('/') + 1)) + Option::pro_ext; - if(QFile::exists(proj)) { + QString proj = detectProjectFile(qmake_getpwd()); + if(!proj.isNull()) Option::mkfile::project_files.append(proj); - } else { //last try.. - QStringList profiles = QDir(pwd).entryList(QStringList("*" + Option::pro_ext)); - if(profiles.count() == 1) - Option::mkfile::project_files.append(pwd + "/" + profiles[0]); - } #ifndef QT_BUILD_QMAKE_LIBRARY if(Option::mkfile::project_files.isEmpty()) { usage(argv[0]); diff --git a/src/3rdparty/clucene/src/CLucene/index/SegmentTermDocs.cpp b/src/3rdparty/clucene/src/CLucene/index/SegmentTermDocs.cpp index f4c5e3a..50951e9 100644 --- a/src/3rdparty/clucene/src/CLucene/index/SegmentTermDocs.cpp +++ b/src/3rdparty/clucene/src/CLucene/index/SegmentTermDocs.cpp @@ -112,47 +112,51 @@ CL_NS_DEF(index) return _freq; } - bool SegmentTermDocs::next() { - while (true) { - if (count == df) - return false; - uint32_t docCode = freqStream->readVInt(); - _doc += docCode >> 1; //unsigned shift - if ((docCode & 1) != 0) // if low bit is set - _freq = 1; // _freq is one - else - _freq = freqStream->readVInt(); // else read _freq - count++; - - if ( (deletedDocs == NULL) || (deletedDocs->get(_doc) == false ) ) - break; - skippingDoc(); +bool SegmentTermDocs::next() +{ + while (true) { + if (count == df) + return false; + + uint32_t docCode = freqStream->readVInt(); + _doc += docCode >> 1; //unsigned shift + if ((docCode & 1) != 0) // if low bit is set + _freq = 1; // _freq is one + else + _freq = freqStream->readVInt(); // else read _freq + count++; + + if (deletedDocs == NULL || (_doc >= 0 && !deletedDocs->get(_doc))) + break; + skippingDoc(); } return true; - } +} - int32_t SegmentTermDocs::read(int32_t* docs, int32_t* freqs, int32_t length) { + +int32_t SegmentTermDocs::read(int32_t* docs, int32_t* freqs, int32_t length) +{ int32_t i = 0; -//todo: one optimization would be to get the pointer buffer for ram or mmap dirs -//and iterate over them instead of using readByte() intensive functions. - while (i<length && count < df) { - uint32_t docCode = freqStream->readVInt(); - _doc += docCode >> 1; - if ((docCode & 1) != 0) // if low bit is set - _freq = 1; // _freq is one - else - _freq = freqStream->readVInt(); // else read _freq - count++; - - if (deletedDocs == NULL || !deletedDocs->get(_doc)) { - docs[i] = _doc; - freqs[i] = _freq; - i++; - } + // TODO: one optimization would be to get the pointer buffer for ram or mmap + // dirs and iterate over them instead of using readByte() intensive functions. + while (i < length && count < df) { + uint32_t docCode = freqStream->readVInt(); + _doc += docCode >> 1; + if ((docCode & 1) != 0) // if low bit is set + _freq = 1; // _freq is one + else + _freq = freqStream->readVInt(); // else read _freq + count++; + + if (deletedDocs == NULL || (_doc >= 0 && !deletedDocs->get(_doc))) { + docs[i] = _doc; + freqs[i] = _freq; + i++; + } } return i; - } +} bool SegmentTermDocs::skipTo(const int32_t target){ if (df >= skipInterval) { // optimized case diff --git a/src/3rdparty/clucene/src/CLucene/index/Term.cpp b/src/3rdparty/clucene/src/CLucene/index/Term.cpp index fc32e44..5ff7bb2 100644 --- a/src/3rdparty/clucene/src/CLucene/index/Term.cpp +++ b/src/3rdparty/clucene/src/CLucene/index/Term.cpp @@ -153,7 +153,10 @@ int32_t Term::compareTo(const Term* other) const if (_field == other->_field) return _tcscmp(_text, other->_text); - return _tcscmp(_field, other->_field); + int32_t ret = _tcscmp(_field, other->_field); + if (ret == 0) + ret = _tcscmp(_text, other->_text); + return ret; } TCHAR* Term::toString() const diff --git a/src/3rdparty/clucene/src/CLucene/queryParser/MultiFieldQueryParser.cpp b/src/3rdparty/clucene/src/CLucene/queryParser/MultiFieldQueryParser.cpp index ea93ec4..b57896b 100644 --- a/src/3rdparty/clucene/src/CLucene/queryParser/MultiFieldQueryParser.cpp +++ b/src/3rdparty/clucene/src/CLucene/queryParser/MultiFieldQueryParser.cpp @@ -21,51 +21,62 @@ CL_NS_USE(analysis) CL_NS_DEF(queryParser) -MultiFieldQueryParser::MultiFieldQueryParser(const TCHAR** fields, CL_NS(analysis)::Analyzer* a, BoostMap* boosts): - QueryParser(NULL,a) +MultiFieldQueryParser::MultiFieldQueryParser(const TCHAR** fields, + CL_NS(analysis)::Analyzer* analyzer, BoostMap* boosts) + : QueryParser(NULL, analyzer) { this->fields = fields; this->boosts = boosts; } -MultiFieldQueryParser::~MultiFieldQueryParser(){ + +MultiFieldQueryParser::~MultiFieldQueryParser() +{ } //static -Query* MultiFieldQueryParser::parse(const TCHAR* query, const TCHAR** fields, Analyzer* analyzer) +Query* MultiFieldQueryParser::parse(const TCHAR* query, const TCHAR** fields, + Analyzer* analyzer) { BooleanQuery* bQuery = _CLNEW BooleanQuery(); int32_t i = 0; - while ( fields[i] != NULL ){ - Query* q = QueryParser::parse(query, fields[i], analyzer); - bQuery->add(q, true, false, false); - + while (fields[i] != NULL){ + Query* q = QueryParser::parse(query, fields[i], analyzer); + if (q && (q->getQueryName() != _T("BooleanQuery") + || ((BooleanQuery*)q)->getClauseCount() > 0)) { + bQuery->add(q , true, false, false); + } else { + _CLDELETE(q); + } i++; } return bQuery; } //static -Query* MultiFieldQueryParser::parse(const TCHAR* query, const TCHAR** fields, const uint8_t* flags, Analyzer* analyzer) +Query* MultiFieldQueryParser::parse(const TCHAR* query, const TCHAR** fields, + const uint8_t* flags, Analyzer* analyzer) { BooleanQuery* bQuery = _CLNEW BooleanQuery(); int32_t i = 0; - while ( fields[i] != NULL ) - { - Query* q = QueryParser::parse(query, fields[i], analyzer); - uint8_t flag = flags[i]; - switch (flag) - { - case MultiFieldQueryParser::REQUIRED_FIELD: - bQuery->add(q, true, true, false); - break; - case MultiFieldQueryParser::PROHIBITED_FIELD: - bQuery->add(q, true, false, true); - break; - default: - bQuery->add(q, true, false, false); - break; + while ( fields[i] != NULL ) { + Query* q = QueryParser::parse(query, fields[i], analyzer); + if (q && (q->getQueryName() != _T("BooleanQuery") + || ((BooleanQuery*)q)->getClauseCount() > 0)) { + uint8_t flag = flags[i]; + switch (flag) { + case MultiFieldQueryParser::REQUIRED_FIELD: + bQuery->add(q, true, true, false); + break; + case MultiFieldQueryParser::PROHIBITED_FIELD: + bQuery->add(q, true, false, true); + break; + default: + bQuery->add(q, true, false, false); + break; + } + } else { + _CLDELETE(q); } - i++; } return bQuery; diff --git a/src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp b/src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp index e9659cf..5f96e91 100644 --- a/src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp +++ b/src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp @@ -91,7 +91,7 @@ QString FSDirectory::FSLock::toString() const // # pragma mark -- FSDirectory::FSIndexInput FSDirectory::FSIndexInput::FSIndexInput(const QString& path, int32_t bufferSize) - : BufferedIndexInput(bufferSize) + : BufferedIndexInput(bufferSize) { CND_PRECONDITION(!path.isEmpty(), "path is NULL"); @@ -155,7 +155,7 @@ FSDirectory::FSIndexInput::FSIndexInput(const FSIndexInput& other) if (other.handle == NULL) _CLTHROWA(CL_ERR_NullPointer, "other handle is null"); - SCOPED_LOCK_MUTEX(other.handle->THIS_LOCK) + SCOPED_LOCK_MUTEX(*other.handle->THIS_LOCK) _pos = other.handle->_fpos; handle = _CL_POINTER(other.handle); @@ -169,7 +169,30 @@ FSDirectory::FSIndexInput::~FSIndexInput() void FSDirectory::FSIndexInput::close() { BufferedIndexInput::close(); +#ifdef _LUCENE_THREADMUTEX + if (handle != NULL) { + // Here we have a bit of a problem... We need to lock the handle to + // ensure that we can safely delete the handle... But if we delete the + // handle, then the scoped unlock, won't be able to unlock the mutex... + + // take a reference of the lock object... + _LUCENE_THREADMUTEX* mutex = handle->THIS_LOCK; + //lock the mutex + mutex->lock(); + + // determine if we are about to delete the handle... + bool doUnlock = (handle->__cl_refcount > 1); + // decdelete (deletes if refcount is down to 0) + _CLDECDELETE(handle); + + if (doUnlock) + mutex->unlock(); + else + delete mutex; + } +#else _CLDECDELETE(handle); +#endif } IndexInput* FSDirectory::FSIndexInput::clone() const @@ -186,7 +209,7 @@ void FSDirectory::FSIndexInput::seekInternal(const int64_t position) void FSDirectory::FSIndexInput::readInternal(uint8_t* b, const int32_t len) { - SCOPED_LOCK_MUTEX(handle->THIS_LOCK) + SCOPED_LOCK_MUTEX(*handle->THIS_LOCK) CND_PRECONDITION(handle != NULL, "shared file handle has closed"); CND_PRECONDITION(handle->fhandle.isOpen(), "file is not open"); @@ -214,8 +237,10 @@ void FSDirectory::FSIndexInput::readInternal(uint8_t* b, const int32_t len) FSDirectory::FSIndexInput::SharedHandle::SharedHandle() : _fpos(0) , _length(0) - { +#ifdef _LUCENE_THREADMUTEX + THIS_LOCK = new _LUCENE_THREADMUTEX; +#endif } FSDirectory::FSIndexInput::SharedHandle::~SharedHandle() diff --git a/src/3rdparty/clucene/src/CLucene/store/FSDirectory.h b/src/3rdparty/clucene/src/CLucene/store/FSDirectory.h index 1302edf..e967380 100644 --- a/src/3rdparty/clucene/src/CLucene/store/FSDirectory.h +++ b/src/3rdparty/clucene/src/CLucene/store/FSDirectory.h @@ -147,7 +147,7 @@ private: void close(); IndexInput* clone() const; - + int64_t length() { return handle->_length; } @@ -174,7 +174,7 @@ private: int64_t _length; QFile fhandle; - DEFINE_MUTEX(THIS_LOCK) + DEFINE_MUTEX(*THIS_LOCK) }; SharedHandle* handle; int64_t _pos; diff --git a/src/3rdparty/clucene/src/CLucene/util/bufferedstream.h b/src/3rdparty/clucene/src/CLucene/util/bufferedstream.h index 2455d5e..b73ad98 100644 --- a/src/3rdparty/clucene/src/CLucene/util/bufferedstream.h +++ b/src/3rdparty/clucene/src/CLucene/util/bufferedstream.h @@ -28,7 +28,9 @@ #include "streambase.h" #include "inputstreambuffer.h" + #include <cassert> +#include <stdio.h> namespace jstreams { diff --git a/src/3rdparty/phonon/ds9/qevr9.h b/src/3rdparty/phonon/ds9/qevr9.h new file mode 100644 index 0000000..8599fce --- /dev/null +++ b/src/3rdparty/phonon/ds9/qevr9.h @@ -0,0 +1,143 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <d3d9.h> + +#define DXVA2_ProcAmp_Brightness 1 +#define DXVA2_ProcAmp_Contrast 2 +#define DXVA2_ProcAmp_Hue 4 +#define DXVA2_ProcAmp_Saturation 8 + +typedef enum { + MFVideoARMode_None = 0x00000000, + MFVideoARMode_PreservePicture = 0x00000001, + MFVideoARMode_PreservePixel = 0x00000002, + MFVideoARMode_NonLinearStretch = 0x00000004, + MFVideoARMode_Mask = 0x00000007 +} MFVideoAspectRatioMode; + +typedef struct { + float left; + float top; + float right; + float bottom; +} MFVideoNormalizedRect; + +typedef struct { + UINT DeviceCaps; + D3DPOOL InputPool; + UINT NumForwardRefSamples; + UINT NumBackwardRefSamples; + UINT Reserved; + UINT DeinterlaceTechnology; + UINT ProcAmpControlCaps; + UINT VideoProcessorOperations; + UINT NoiseFilterTechnology; + UINT DetailFilterTechnology; +} DXVA2_VideoProcessorCaps; + +typedef struct { + union { + struct { + USHORT Fraction; + SHORT Value; + }; + LONG ll; + }; +} DXVA2_Fixed32; + +typedef struct { + DXVA2_Fixed32 MinValue; + DXVA2_Fixed32 MaxValue; + DXVA2_Fixed32 DefaultValue; + DXVA2_Fixed32 StepSize; +} DXVA2_ValueRange; + +typedef struct { + DXVA2_Fixed32 Brightness; + DXVA2_Fixed32 Contrast; + DXVA2_Fixed32 Hue; + DXVA2_Fixed32 Saturation; +} DXVA2_ProcAmpValues; + +DXVA2_Fixed32 DXVA2FloatToFixed(const float _float_) +{ + DXVA2_Fixed32 _fixed_; + _fixed_.Fraction = LOWORD(_float_ * 0x10000); + _fixed_.Value = HIWORD(_float_ * 0x10000); + return _fixed_; +} + +float DXVA2FixedToFloat(const DXVA2_Fixed32 _fixed_) +{ + return (FLOAT)_fixed_.Value + (FLOAT)_fixed_.Fraction / 0x10000; +} + +#undef INTERFACE +#define INTERFACE IMFVideoDisplayControl +DECLARE_INTERFACE_(IMFVideoDisplayControl, IUnknown) +{ + STDMETHOD(GetNativeVideoSize)(THIS_ SIZE* pszVideo, SIZE* pszARVideo) PURE; + STDMETHOD(GetIdealVideoSize)(THIS_ SIZE* pszMin, SIZE* pszMax) PURE; + STDMETHOD(SetVideoPosition)(THIS_ const MFVideoNormalizedRect* pnrcSource, const LPRECT prcDest) PURE; + STDMETHOD(GetVideoPosition)(THIS_ MFVideoNormalizedRect* pnrcSource, LPRECT prcDest) PURE; + STDMETHOD(SetAspectRatioMode)(THIS_ DWORD dwAspectRatioMode) PURE; + STDMETHOD(GetAspectRatioMode)(THIS_ DWORD* pdwAspectRatioMode) PURE; + STDMETHOD(SetVideoWindow)(THIS_ HWND hwndVideo) PURE; + STDMETHOD(GetVideoWindow)(THIS_ HWND* phwndVideo) PURE; + STDMETHOD(RepaintVideo)(THIS_) PURE; + STDMETHOD(GetCurrentImage)(THIS_ BITMAPINFOHEADER* pBih, BYTE** pDib, DWORD* pcbDib, LONGLONG* pTimeStamp) PURE; + STDMETHOD(SetBorderColor)(THIS_ COLORREF Clr) PURE; + STDMETHOD(GetBorderColor)(THIS_ COLORREF* pClr) PURE; + STDMETHOD(SetRenderingPrefs)(THIS_ DWORD dwRenderFlags) PURE; + STDMETHOD(GetRenderingPrefs)(THIS_ DWORD* pdwRenderFlags) PURE; + STDMETHOD(SetFullScreen)(THIS_ BOOL fFullscreen) PURE; + STDMETHOD(GetFullScreen)(THIS_ BOOL* pfFullscreen) PURE; +}; +#undef INTERFACE +#define INTERFACE IMFVideoMixerControl +DECLARE_INTERFACE_(IMFVideoMixerControl, IUnknown) +{ + STDMETHOD(SetStreamZOrder)(THIS_ DWORD dwStreamID, DWORD dwZ) PURE; + STDMETHOD(GetStreamZOrder)(THIS_ DWORD dwStreamID, DWORD* pdwZ) PURE; + STDMETHOD(SetStreamOutputRect)(THIS_ DWORD dwStreamID, const MFVideoNormalizedRect* pnrcOutput) PURE; + STDMETHOD(GetStreamOutputRect)(THIS_ DWORD dwStreamID, MFVideoNormalizedRect* pnrcOutput) PURE; +}; +#undef INTERFACE +#define INTERFACE IMFVideoProcessor +DECLARE_INTERFACE_(IMFVideoProcessor, IUnknown) +{ + STDMETHOD(GetAvailableVideoProcessorModes)(THIS_ UINT* lpdwNumProcessingModes, GUID** ppVideoProcessingModes) PURE; + STDMETHOD(GetVideoProcessorCaps)(THIS_ LPGUID lpVideoProcessorMode, DXVA2_VideoProcessorCaps* lpVideoProcessorCaps) PURE; + STDMETHOD(GetVideoProcessorMode)(THIS_ LPGUID lpMode) PURE; + STDMETHOD(SetVideoProcessorMode)(THIS_ LPGUID lpMode) PURE; + STDMETHOD(GetProcAmpRange)(THIS_ DWORD dwProperty, DXVA2_ValueRange* pPropRange) PURE; + STDMETHOD(GetProcAmpValues)(THIS_ DWORD dwFlags, DXVA2_ProcAmpValues* Values) PURE; + STDMETHOD(SetProcAmpValues)(THIS_ DWORD dwFlags, DXVA2_ProcAmpValues* pValues) PURE; + STDMETHOD(GetFilteringRange)(THIS_ DWORD dwProperty, DXVA2_ValueRange* pPropRange) PURE; + STDMETHOD(GetFilteringValue)(THIS_ DWORD dwProperty, DXVA2_Fixed32* pValue) PURE; + STDMETHOD(SetFilteringValue)(THIS_ DWORD dwProperty, DXVA2_Fixed32* pValue) PURE; + STDMETHOD(GetBackgroundColor)(THIS_ COLORREF* lpClrBkg) PURE; + STDMETHOD(SetBackgroundColor)(THIS_ COLORREF ClrBkg) PURE; +}; +#undef INTERFACE +#define INTERFACE IMFGetService +DECLARE_INTERFACE_(IMFGetService, IUnknown) +{ + STDMETHOD(GetService)(THIS_ REFGUID guidService, REFIID riid, LPVOID* ppvObject) PURE; +}; +#undef INTERFACE diff --git a/src/3rdparty/phonon/ds9/videorenderer_default.cpp b/src/3rdparty/phonon/ds9/videorenderer_default.cpp new file mode 100644 index 0000000..9d82255 --- /dev/null +++ b/src/3rdparty/phonon/ds9/videorenderer_default.cpp @@ -0,0 +1,153 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + + +#include "videorenderer_default.h" + +#ifndef QT_NO_PHONON_VIDEO + +#include <QtGui/QWidget> +#include <QtGui/QPainter> + +#include <uuids.h> + +QT_BEGIN_NAMESPACE + + +namespace Phonon +{ + namespace DS9 + { + VideoRendererDefault::~VideoRendererVMR9() + { + } + + bool VideoRendererDefault::isNative() const + { + return true; + } + + + VideoRendererDefault::VideoRendererDefault(QWidget *target) : m_target(target) + { + m_target->setAttribute(Qt::WA_PaintOnScreen, true); + m_filter = Filter(CLSID_VideoRenderer, IID_IBaseFilter); + } + + QSize VideoRendererDefault::videoSize() const + { + LONG w = 0, + h = 0; + ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); + if (basic) { + basic->GetVideoSize( &w, &h); + } + return QSize(w, h); + } + + void VideoRendererDefault::repaintCurrentFrame(QWidget * /*target*/, const QRect & /*rect*/) + { + //nothing to do here: the renderer paints everything + } + + void VideoRendererDefault::notifyResize(const QSize &size, Phonon::VideoWidget::AspectRatio aspectRatio, + Phonon::VideoWidget::ScaleMode scaleMode) + { + if (!isActive()) { + ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); + if (basic) { + basic->SetDestinationPosition(0, 0, 0, 0); + } + return; + } + + ComPointer<IVideoWindow> video(m_filter, IID_IVideoWindow); + + OAHWND owner; + HRESULT hr = video->get_Owner(&owner); + if (FAILED(hr)) { + return; + } + + const OAHWND newOwner = reinterpret_cast<OAHWND>(m_target->winId()); + if (owner != newOwner) { + video->put_Owner(newOwner); + video->put_MessageDrain(newOwner); + video->put_WindowStyle(WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); + } + + //make sure the widget takes the whole size of the parent + video->SetWindowPosition(0, 0, size.width(), size.height()); + + const QSize vsize = videoSize(); + internalNotifyResize(size, vsize, aspectRatio, scaleMode); + + ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); + if (basic) { + basic->SetDestinationPosition(m_dstX, m_dstY, m_dstWidth, m_dstHeight); + } + } + + void VideoRendererDefault::applyMixerSettings(qreal /*brightness*/, qreal /*contrast*/, qreal /*m_hue*/, qreal /*saturation*/) + { + //this can't be supported for the default renderer + } + + QImage VideoRendererDefault::snapshot() const + { + ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); + if (basic) { + LONG bufferSize = 0; + //1st we get the buffer size + basic->GetCurrentImage(&bufferSize, 0); + + QByteArray buffer; + buffer.resize(bufferSize); + HRESULT hr = basic->GetCurrentImage(&bufferSize, reinterpret_cast<long*>(buffer.data())); + + if (SUCCEEDED(hr)) { + + const BITMAPINFOHEADER *bmi = reinterpret_cast<const BITMAPINFOHEADER*>(buffer.constData()); + + const int w = qAbs(bmi->biWidth), + h = qAbs(bmi->biHeight); + + // Create image and copy data into image. + QImage ret(w, h, QImage::Format_RGB32); + + if (!ret.isNull()) { + const char *data = buffer.constData() + bmi->biSize; + const int bytes_per_line = w * sizeof(QRgb); + for (int y = h - 1; y >= 0; --y) { + qMemCopy(ret.scanLine(y), //destination + data, //source + bytes_per_line); + data += bytes_per_line; + } + } + return ret; + } + } + return QImage(); + } + + } +} + +QT_END_NAMESPACE + +#endif //QT_NO_PHONON_VIDEO diff --git a/src/3rdparty/phonon/ds9/videorenderer_default.h b/src/3rdparty/phonon/ds9/videorenderer_default.h new file mode 100644 index 0000000..43768d9 --- /dev/null +++ b/src/3rdparty/phonon/ds9/videorenderer_default.h @@ -0,0 +1,55 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef PHONON_VIDEORENDERER_DEFAULT_H +#define PHONON_VIDEORENDERER_DEFAULT_H + +#include "abstractvideorenderer.h" + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_PHONON_VIDEO + +namespace Phonon +{ + namespace DS9 + { + class VideoRendererDefault : public AbstractVideoRenderer + { + public: + VideoRendererDefault(QWidget *target); + ~VideoRendererDefault(); + + //Implementation from AbstractVideoRenderer + void repaintCurrentFrame(QWidget *target, const QRect &rect); + void notifyResize(const QSize&, Phonon::VideoWidget::AspectRatio, Phonon::VideoWidget::ScaleMode); + QSize videoSize() const; + QImage snapshot() const; + void applyMixerSettings(qreal brightness, qreal contrast, qreal m_hue, qreal saturation); + bool isNative() const; + private: + QWidget *m_target; + }; + } +} + +#endif //QT_NO_PHONON_VIDEO + +QT_END_NAMESPACE + +#endif + diff --git a/src/3rdparty/phonon/ds9/videorenderer_evr.cpp b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp new file mode 100644 index 0000000..d23d9ce --- /dev/null +++ b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp @@ -0,0 +1,215 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + + +#include "videorenderer_evr.h" +#include "qevr9.h" + +#ifndef QT_NO_PHONON_VIDEO + +#include <QtGui/QWidget> +#include <QtGui/QPainter> + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ + namespace DS9 + { + //we have to define them here because not all compilers/sdk have them + static const GUID MR_VIDEO_RENDER_SERVICE = {0x1092a86c, 0xab1a, 0x459a, {0xa3, 0x36, 0x83, 0x1f, 0xbc, 0x4d, 0x11, 0xff} }; + static const GUID MR_VIDEO_MIXER_SERVICE = { 0x73cd2fc, 0x6cf4, 0x40b7, {0x88, 0x59, 0xe8, 0x95, 0x52, 0xc8, 0x41, 0xf8} }; + static const IID IID_IMFVideoDisplayControl = {0xa490b1e4, 0xab84, 0x4d31, {0xa1, 0xb2, 0x18, 0x1e, 0x03, 0xb1, 0x07, 0x7a} }; + static const IID IID_IMFVideoMixerControl = {0xA5C6C53F, 0xC202, 0x4aa5, {0x96, 0x95, 0x17, 0x5B, 0xA8, 0xC5, 0x08, 0xA5} }; + static const IID IID_IMFVideoProcessor = {0x6AB0000C, 0xFECE, 0x4d1f, {0xA2, 0xAC, 0xA9, 0x57, 0x35, 0x30, 0x65, 0x6E} }; + static const IID IID_IMFGetService = {0xFA993888, 0x4383, 0x415A, {0xA9, 0x30, 0xDD, 0x47, 0x2A, 0x8C, 0xF6, 0xF7} }; + static const GUID CLSID_EnhancedVideoRenderer = {0xfa10746c, 0x9b63, 0x4b6c, {0xbc, 0x49, 0xfc, 0x30, 0xe, 0xa5, 0xf2, 0x56} }; + + template <typename T> ComPointer<T> getService(const Filter &filter, REFGUID guidService, REFIID riid) + { + //normally we should use IID_IMFGetService but this introduces another dependency + //so here we simply define our own IId with the same value + ComPointer<IMFGetService> getService(filter, IID_IMFGetService); + Q_ASSERT(getService); + T *ptr = 0; + HRESULT hr = getService->GetService(guidService, riid, reinterpret_cast<void **>(&ptr)); + if (!SUCCEEDED(hr) || ptr == 0) + Q_ASSERT(!SUCCEEDED(hr) && ptr != 0); + ComPointer<T> service(ptr); + return service; + } + + VideoRendererEVR::~VideoRendererEVR() + { + } + + bool VideoRendererEVR::isNative() const + { + return true; + } + + VideoRendererEVR::VideoRendererEVR(QWidget *target) : m_target(target) + { + m_filter = Filter(CLSID_EnhancedVideoRenderer, IID_IBaseFilter); + if (!m_filter) { + return; + } + + ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + + filterControl->SetVideoWindow(reinterpret_cast<HWND>(target->winId())); + filterControl->SetAspectRatioMode(MFVideoARMode_None); // We're in control of the size + } + + QImage VideoRendererEVR::snapshot() const + { + // This will always capture black areas where no video is drawn, if any are present. + // Due to the hack in notifyResize() + ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + if (filterControl) { + BITMAPINFOHEADER bmi; + BYTE *buffer = 0; + DWORD bufferSize; + LONGLONG timeStamp; + + bmi.biSize = sizeof(BITMAPINFOHEADER); + + HRESULT hr = filterControl->GetCurrentImage(&bmi, &buffer, &bufferSize, &timeStamp); + if (SUCCEEDED(hr)) { + + const int w = qAbs(bmi.biWidth), + h = qAbs(bmi.biHeight); + + // Create image and copy data into image. + QImage ret(w, h, QImage::Format_RGB32); + + if (!ret.isNull()) { + uchar *data = buffer; + const int bytes_per_line = w * sizeof(QRgb); + for (int y = h - 1; y >= 0; --y) { + qMemCopy(ret.scanLine(y), //destination + data, //source + bytes_per_line); + data += bytes_per_line; + } + } + ::CoTaskMemFree(buffer); + return ret; + } + } + return QImage(); + } + + QSize VideoRendererEVR::videoSize() const + { + SIZE nativeSize; + SIZE aspectRatioSize; + + ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + + filterControl->GetNativeVideoSize(&nativeSize, &aspectRatioSize); + + return QSize(nativeSize.cx, nativeSize.cy); + } + + void VideoRendererEVR::repaintCurrentFrame(QWidget *target, const QRect &rect) + { + // repaint the video + ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + // All failed results can be safely ignored + filterControl->RepaintVideo(); + } + + void VideoRendererEVR::notifyResize(const QSize &size, Phonon::VideoWidget::AspectRatio aspectRatio, + Phonon::VideoWidget::ScaleMode scaleMode) + { + if (!isActive()) { + RECT dummyRect = { 0, 0, 0, 0}; + ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + filterControl->SetVideoPosition(0, &dummyRect); + return; + } + + const QSize vsize = videoSize(); + internalNotifyResize(size, vsize, aspectRatio, scaleMode); + + RECT dstRectWin = { 0, 0, size.width(), size.height()}; + + // Resize the Stream output rect instead of the destination rect. + // Hacky workaround for flicker in the areas outside of the destination rect + // This way these areas don't exist + MFVideoNormalizedRect streamOutputRect = { float(m_dstX) / float(size.width()), float(m_dstY) / float(size.height()), + float(m_dstWidth + m_dstX) / float(size.width()), float(m_dstHeight + m_dstY) / float(size.height())}; + + ComPointer<IMFVideoMixerControl> filterMixer = getService<IMFVideoMixerControl>(m_filter, MR_VIDEO_MIXER_SERVICE, IID_IMFVideoMixerControl); + ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + + filterMixer->SetStreamOutputRect(0, &streamOutputRect); + filterControl->SetVideoPosition(0, &dstRectWin); + } + + void VideoRendererEVR::applyMixerSettings(qreal brightness, qreal contrast, qreal hue, qreal saturation) + { + InputPin sink = BackendNode::pins(m_filter, PINDIR_INPUT).first(); + OutputPin source; + if (FAILED(sink->ConnectedTo(source.pparam()))) { + return; //it must be connected to work + } + + // Get the "Video Processor" (used for brightness/contrast/saturation/hue) + ComPointer<IMFVideoProcessor> processor = getService<IMFVideoProcessor>(m_filter, MR_VIDEO_MIXER_SERVICE, IID_IMFVideoProcessor); + Q_ASSERT(processor); + + DXVA2_ValueRange contrastRange; + DXVA2_ValueRange brightnessRange; + DXVA2_ValueRange saturationRange; + DXVA2_ValueRange hueRange; + + if (FAILED(processor->GetProcAmpRange(DXVA2_ProcAmp_Contrast, &contrastRange))) + return; + if (FAILED(processor->GetProcAmpRange(DXVA2_ProcAmp_Brightness, &brightnessRange))) + return; + if (FAILED(processor->GetProcAmpRange(DXVA2_ProcAmp_Saturation, &saturationRange))) + return; + if (FAILED(processor->GetProcAmpRange(DXVA2_ProcAmp_Hue, &hueRange))) + return; + + DXVA2_ProcAmpValues values; + + values.Contrast = DXVA2FloatToFixed(((contrast < 0 + ? DXVA2FixedToFloat(contrastRange.MinValue) : DXVA2FixedToFloat(contrastRange.MaxValue)) + - DXVA2FixedToFloat(contrastRange.DefaultValue)) * qAbs(contrast) + DXVA2FixedToFloat(contrastRange.DefaultValue)); + values.Brightness = DXVA2FloatToFixed(((brightness < 0 + ? DXVA2FixedToFloat(brightnessRange.MinValue) : DXVA2FixedToFloat(brightnessRange.MaxValue)) + - DXVA2FixedToFloat(brightnessRange.DefaultValue)) * qAbs(brightness) + DXVA2FixedToFloat(brightnessRange.DefaultValue)); + values.Saturation = DXVA2FloatToFixed(((saturation < 0 + ? DXVA2FixedToFloat(saturationRange.MinValue) : DXVA2FixedToFloat(saturationRange.MaxValue)) + - DXVA2FixedToFloat(saturationRange.DefaultValue)) * qAbs(saturation) + DXVA2FixedToFloat(saturationRange.DefaultValue)); + values.Hue = DXVA2FloatToFixed(((hue < 0 + ? DXVA2FixedToFloat(hueRange.MinValue) : DXVA2FixedToFloat(hueRange.MaxValue)) + - DXVA2FixedToFloat(hueRange.DefaultValue)) * qAbs(hue) + DXVA2FixedToFloat(hueRange.DefaultValue)); + + //finally set the settings + processor->SetProcAmpValues(DXVA2_ProcAmp_Contrast | DXVA2_ProcAmp_Brightness | DXVA2_ProcAmp_Saturation | DXVA2_ProcAmp_Hue, &values); + + } + } +} + +QT_END_NAMESPACE + +#endif //QT_NO_PHONON_VIDEO diff --git a/src/3rdparty/phonon/ds9/videorenderer_evr.h b/src/3rdparty/phonon/ds9/videorenderer_evr.h new file mode 100644 index 0000000..229c36d --- /dev/null +++ b/src/3rdparty/phonon/ds9/videorenderer_evr.h @@ -0,0 +1,56 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef PHONON_VIDEORENDERER_EVR_H +#define PHONON_VIDEORENDERER_EVR_H + +#include "abstractvideorenderer.h" +#include "compointer.h" + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_PHONON_VIDEO + +namespace Phonon +{ + namespace DS9 + { + class VideoRendererEVR : public AbstractVideoRenderer + { + public: + VideoRendererEVR(QWidget *target); + ~VideoRendererEVR(); + + //Implementation from AbstractVideoRenderer + void repaintCurrentFrame(QWidget *target, const QRect &rect); + void notifyResize(const QSize&, Phonon::VideoWidget::AspectRatio, Phonon::VideoWidget::ScaleMode); + QSize videoSize() const; + QImage snapshot() const; + void applyMixerSettings(qreal brightness, qreal contrast, qreal m_hue, qreal saturation); + bool isNative() const; + private: + QWidget *m_target; + }; + } +} + +#endif //QT_NO_PHONON_VIDEO + +QT_END_NAMESPACE + +#endif + diff --git a/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp b/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp index 81ebb8b..545b31e 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp +++ b/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp @@ -22,14 +22,9 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <QtGui/QWidget> #include <QtGui/QPainter> -#include <QtCore/QTimerEvent> -#ifndef Q_OS_WINCE #include <d3d9.h> #include <vmr9.h> -#else -#include <uuids.h> -#endif QT_BEGIN_NAMESPACE @@ -48,116 +43,10 @@ namespace Phonon } -#ifdef Q_OS_WINCE - VideoRendererVMR9::VideoRendererVMR9(QWidget *target) : m_target(target) - { - m_target->setAttribute(Qt::WA_PaintOnScreen, true); - m_filter = Filter(CLSID_VideoRenderer, IID_IBaseFilter); - } - - QSize VideoRendererVMR9::videoSize() const - { - LONG w = 0, - h = 0; - ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); - if (basic) { - basic->GetVideoSize( &w, &h); - } - return QSize(w, h); - } - - void VideoRendererVMR9::repaintCurrentFrame(QWidget * /*target*/, const QRect & /*rect*/) - { - //nothing to do here: the renderer paints everything - } - - void VideoRendererVMR9::notifyResize(const QSize &size, Phonon::VideoWidget::AspectRatio aspectRatio, - Phonon::VideoWidget::ScaleMode scaleMode) - { - if (!isActive()) { - ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); - if (basic) { - basic->SetDestinationPosition(0, 0, 0, 0); - } - return; - } - - ComPointer<IVideoWindow> video(m_filter, IID_IVideoWindow); - - OAHWND owner; - HRESULT hr = video->get_Owner(&owner); - if (FAILED(hr)) { - return; - } - - const OAHWND newOwner = reinterpret_cast<OAHWND>(m_target->winId()); - if (owner != newOwner) { - video->put_Owner(newOwner); - video->put_MessageDrain(newOwner); - video->put_WindowStyle(WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); - } - - //make sure the widget takes the whole size of the parent - video->SetWindowPosition(0, 0, size.width(), size.height()); - - const QSize vsize = videoSize(); - internalNotifyResize(size, vsize, aspectRatio, scaleMode); - - ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); - if (basic) { - basic->SetDestinationPosition(m_dstX, m_dstY, m_dstWidth, m_dstHeight); - } - } - - void VideoRendererVMR9::applyMixerSettings(qreal /*brightness*/, qreal /*contrast*/, qreal /*m_hue*/, qreal /*saturation*/) - { - //this can't be supported for WinCE - } - - QImage VideoRendererVMR9::snapshot() const - { - ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); - if (basic) { - LONG bufferSize = 0; - //1st we get the buffer size - basic->GetCurrentImage(&bufferSize, 0); - - QByteArray buffer; - buffer.resize(bufferSize); - HRESULT hr = basic->GetCurrentImage(&bufferSize, reinterpret_cast<long*>(buffer.data())); - - if (SUCCEEDED(hr)) { - - const BITMAPINFOHEADER *bmi = reinterpret_cast<const BITMAPINFOHEADER*>(buffer.constData()); - - const int w = qAbs(bmi->biWidth), - h = qAbs(bmi->biHeight); - - // Create image and copy data into image. - QImage ret(w, h, QImage::Format_RGB32); - - if (!ret.isNull()) { - const char *data = buffer.constData() + bmi->biSize; - const int bytes_per_line = w * sizeof(QRgb); - for (int y = h - 1; y >= 0; --y) { - qMemCopy(ret.scanLine(y), //destination - data, //source - bytes_per_line); - data += bytes_per_line; - } - } - return ret; - } - } - return QImage(); - } - -#else VideoRendererVMR9::VideoRendererVMR9(QWidget *target) : m_target(target) { m_filter = Filter(CLSID_VideoMixingRenderer9, IID_IBaseFilter); if (!m_filter) { - qWarning("the video widget could not be initialized correctly"); return; } @@ -325,7 +214,6 @@ namespace Phonon //finally set the settings mixer->SetProcAmpControl(0, &ctrl); } -#endif } } diff --git a/src/3rdparty/phonon/ds9/videorenderer_vmr9.h b/src/3rdparty/phonon/ds9/videorenderer_vmr9.h index 4eb237e..516d79d 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_vmr9.h +++ b/src/3rdparty/phonon/ds9/videorenderer_vmr9.h @@ -19,7 +19,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #define PHONON_VIDEORENDERER_VMR9_H #include "abstractvideorenderer.h" -#include "compointer.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/ds9/videowidget.cpp b/src/3rdparty/phonon/ds9/videowidget.cpp index 091be16..59abb04 100644 --- a/src/3rdparty/phonon/ds9/videowidget.cpp +++ b/src/3rdparty/phonon/ds9/videowidget.cpp @@ -24,7 +24,12 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include "mediaobject.h" +#ifndef Q_OS_WINCE +#include "videorenderer_evr.h" #include "videorenderer_vmr9.h" +#else +#include "videorenderer_default.h" +#endif #include "videorenderer_soft.h" QT_BEGIN_NAMESPACE @@ -349,14 +354,29 @@ namespace Phonon int index = graphIndex * 2 + type; if (m_renderers[index] == 0 && autoCreate) { AbstractVideoRenderer *renderer = 0; - if (type == Native) { + if (type == Native) { +#ifndef Q_OS_WINCE + renderer = new VideoRendererEVR(m_widget); + if (renderer->getFilter() == 0) { + delete renderer; + //EVR not present, let's try VMR + renderer = new VideoRendererVMR9(m_widget); + if (renderer->getFilter() == 0) { + //instanciating the renderer might fail + m_noNativeRendererSupported = true; + delete renderer; + renderer = 0; + } + } +#else renderer = new VideoRendererVMR9(m_widget); if (renderer->getFilter() == 0) { - //instanciating the renderer might fail with error VFW_E_DDRAW_CAPS_NOT_SUITABLE (0x80040273) + //instanciating the renderer might fail m_noNativeRendererSupported = true; delete renderer; renderer = 0; } +#endif } if (renderer == 0) { diff --git a/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp b/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp index 7237e91..bf5be6d 100644 --- a/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp +++ b/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp @@ -67,8 +67,6 @@ static const char qt_meta_stringdata_Phonon__ObjectDescriptionModel_Visualizatio namespace Phonon { -#if !defined(Q_CC_MINGW) || __MINGW32_MAJOR_VERSION >= 4 - template<> const QMetaObject ObjectDescriptionModel<AudioOutputDeviceType>::staticMetaObject = { { &QAbstractListModel::staticMetaObject, qt_meta_stringdata_Phonon__ObjectDescriptionModel_AudioOutputDeviceType, qt_meta_data_Phonon__ObjectDescriptionModel, 0 } @@ -139,7 +137,6 @@ int ObjectDescriptionModel<type>::qt_metacall(QMetaObject::Call _c, int _id, voi return QAbstractListModel::qt_metacall(_c, _id, _a); } */ -#endif int ObjectDescriptionModelData::rowCount(const QModelIndex &parent) const { @@ -365,8 +362,6 @@ QStringList ObjectDescriptionModelData::mimeTypes(ObjectDescriptionType type) co return QStringList(QLatin1String("application/x-phonon-objectdescription") + QString::number(static_cast<int>(type))); } -#if !defined(Q_CC_MINGW) || __MINGW32_MAJOR_VERSION >= 4 -#if !defined(Q_CC_MSVC) || _MSC_VER > 1300 || defined(Q_CC_INTEL) #define INSTANTIATE_META_FUNCTIONS(type) \ template const QMetaObject *ObjectDescriptionModel<type>::metaObject() const; \ template void *ObjectDescriptionModel<type>::qt_metacast(const char *) @@ -376,7 +371,6 @@ INSTANTIATE_META_FUNCTIONS(AudioCaptureDeviceType); INSTANTIATE_META_FUNCTIONS(EffectType); INSTANTIATE_META_FUNCTIONS(AudioChannelType); INSTANTIATE_META_FUNCTIONS(SubtitleType); -#endif /*INSTANTIATE_META_FUNCTIONS(VideoOutputDeviceType); INSTANTIATE_META_FUNCTIONS(VideoCaptureDeviceType); INSTANTIATE_META_FUNCTIONS(AudioCodecType); @@ -384,7 +378,6 @@ INSTANTIATE_META_FUNCTIONS(VideoCodecType); INSTANTIATE_META_FUNCTIONS(ContainerFormatType); INSTANTIATE_META_FUNCTIONS(VisualizationType); */ -#endif //Q_CC_MINGW } // namespace Phonon #endif //QT_NO_PHONON_OBJECTDESCRIPTIONMODEL diff --git a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h index 96187c3..8fd622f 100644 --- a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h +++ b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h @@ -195,13 +195,6 @@ and existing builds. */ public: Q_OBJECT_CHECK -/* MinGW 3.4.x gives an ICE when trying to instantiate one of the - ObjectDescriptionModel<foo> classes because it can't handle - half exported classes correct. gcc 4.3.x has a fix for this but - we currently there's no official gcc 4.3 on windows available. - Because of this we need this little hack - */ -#if !defined(Q_CC_MINGW) || __MINGW32_MAJOR_VERSION >= 4 /** \internal */ static PHONON_TEMPLATE_CLASS_MEMBER_EXPORT const QMetaObject staticMetaObject; /** \internal */ @@ -209,7 +202,6 @@ and existing builds. */ /** \internal */ PHONON_TEMPLATE_CLASS_MEMBER_EXPORT void *qt_metacast(const char *_clname); //int qt_metacall(QMetaObject::Call _c, int _id, void **_a); -#endif /** * Returns the number of rows in the model. This value corresponds diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index abdafc3..ffbaa28 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -44,11 +44,11 @@ #include <stddef.h> -#define QT_VERSION_STR "4.6.2" +#define QT_VERSION_STR "4.7.0" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x040602 +#define QT_VERSION 0x040700 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index 82d3b79..27f7632 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -48,6 +48,7 @@ #include <stdio.h> #include <ctype.h> #include <stdlib.h> +#include "qendian.h" QT_BEGIN_NAMESPACE @@ -672,24 +673,12 @@ QDataStream &QDataStream::operator>>(qint16 &i) { i = 0; CHECK_STREAM_PRECOND(*this) - if (noswap) { - if (dev->read((char *)&i, 2) != 2) { - i = 0; - setStatus(ReadPastEnd); - } + if (dev->read((char *)&i, 2) != 2) { + i = 0; + setStatus(ReadPastEnd); } else { - union { - qint16 val1; - char val2[2]; - } x; - char *p = x.val2; - char b[2]; - if (dev->read(b, 2) == 2) { - *p++ = b[1]; - *p = b[0]; - i = x.val1; - } else { - setStatus(ReadPastEnd); + if (!noswap) { + i = qbswap(i); } } return *this; @@ -715,26 +704,12 @@ QDataStream &QDataStream::operator>>(qint32 &i) { i = 0; CHECK_STREAM_PRECOND(*this) - if (noswap) { - if (dev->read((char *)&i, 4) != 4) { - i = 0; - setStatus(ReadPastEnd); - } - } else { // swap bytes - union { - qint32 val1; - char val2[4]; - } x; - char *p = x.val2; - char b[4]; - if (dev->read(b, 4) == 4) { - *p++ = b[3]; - *p++ = b[2]; - *p++ = b[1]; - *p = b[0]; - i = x.val1; - } else { - setStatus(ReadPastEnd); + if (dev->read((char *)&i, 4) != 4) { + i = 0; + setStatus(ReadPastEnd); + } else { + if (!noswap) { + i = qbswap(i); } } return *this; @@ -763,31 +738,14 @@ QDataStream &QDataStream::operator>>(qint64 &i) quint32 i1, i2; *this >> i2 >> i1; i = ((quint64)i1 << 32) + i2; - } else if (noswap) { // no conversion needed + } else { if (dev->read((char *)&i, 8) != 8) { i = qint64(0); setStatus(ReadPastEnd); - } - } else { // swap bytes - union { - qint64 val1; - char val2[8]; - } x; - - char *p = x.val2; - char b[8]; - if (dev->read(b, 8) == 8) { - *p++ = b[7]; - *p++ = b[6]; - *p++ = b[5]; - *p++ = b[4]; - *p++ = b[3]; - *p++ = b[2]; - *p++ = b[1]; - *p = b[0]; - i = x.val1; } else { - setStatus(ReadPastEnd); + if (!noswap) { + i = qbswap(i); + } } } return *this; @@ -827,27 +785,17 @@ QDataStream &QDataStream::operator>>(float &f) f = 0.0f; CHECK_STREAM_PRECOND(*this) - if (noswap) { - if (dev->read((char *)&f, 4) != 4) { - f = 0.0f; - setStatus(ReadPastEnd); - } - } else { // swap bytes - union { - float val1; - char val2[4]; - } x; - - char *p = x.val2; - char b[4]; - if (dev->read(b, 4) == 4) { - *p++ = b[3]; - *p++ = b[2]; - *p++ = b[1]; - *p = b[0]; + if (dev->read((char *)&f, 4) != 4) { + f = 0.0f; + setStatus(ReadPastEnd); + } else { + if (!noswap) { + union { + float val1; + quint32 val2; + } x; + x.val2 = qbswap(*reinterpret_cast<quint32 *>(&f)); f = x.val1; - } else { - setStatus(ReadPastEnd); } } return *this; @@ -880,30 +828,17 @@ QDataStream &QDataStream::operator>>(double &f) f = 0.0; CHECK_STREAM_PRECOND(*this) #ifndef Q_DOUBLE_FORMAT - if (noswap) { - if (dev->read((char *)&f, 8) != 8) { - f = 0.0; - setStatus(ReadPastEnd); - } - } else { // swap bytes - union { - double val1; - char val2[8]; - } x; - char *p = x.val2; - char b[8]; - if (dev->read(b, 8) == 8) { - *p++ = b[7]; - *p++ = b[6]; - *p++ = b[5]; - *p++ = b[4]; - *p++ = b[3]; - *p++ = b[2]; - *p++ = b[1]; - *p = b[0]; + if (dev->read((char *)&f, 8) != 8) { + f = 0.0; + setStatus(ReadPastEnd); + } else { + if (!noswap) { + union { + double val1; + quint64 val2; + } x; + x.val2 = qbswap(*reinterpret_cast<quint64 *>(&f)); f = x.val1; - } else { - setStatus(ReadPastEnd); } } #else @@ -1075,20 +1010,10 @@ QDataStream &QDataStream::operator<<(qint8 i) QDataStream &QDataStream::operator<<(qint16 i) { CHECK_STREAM_PRECOND(*this) - if (noswap) { - dev->write((char *)&i, sizeof(qint16)); - } else { // swap bytes - union { - qint16 val1; - char val2[2]; - } x; - x.val1 = i; - char *p = x.val2; - char b[2]; - b[1] = *p++; - b[0] = *p; - dev->write(b, 2); + if (!noswap) { + i = qbswap(i); } + dev->write((char *)&i, sizeof(qint16)); return *this; } @@ -1102,22 +1027,10 @@ QDataStream &QDataStream::operator<<(qint16 i) QDataStream &QDataStream::operator<<(qint32 i) { CHECK_STREAM_PRECOND(*this) - if (noswap) { - dev->write((char *)&i, sizeof(qint32)); - } else { // swap bytes - union { - qint32 val1; - char val2[4]; - } x; - x.val1 = i; - char *p = x.val2; - char b[4]; - b[3] = *p++; - b[2] = *p++; - b[1] = *p++; - b[0] = *p; - dev->write(b, 4); + if (!noswap) { + i = qbswap(i); } + dev->write((char *)&i, sizeof(qint32)); return *this; } @@ -1143,25 +1056,11 @@ QDataStream &QDataStream::operator<<(qint64 i) quint32 i1 = i & 0xffffffff; quint32 i2 = i >> 32; *this << i2 << i1; - } else if (noswap) { // no conversion needed + } else { + if (!noswap) { + i = qbswap(i); + } dev->write((char *)&i, sizeof(qint64)); - } else { // swap bytes - union { - qint64 val1; - char val2[8]; - } x; - x.val1 = i; - char *p = x.val2; - char b[8]; - b[7] = *p++; - b[6] = *p++; - b[5] = *p++; - b[4] = *p++; - b[3] = *p++; - b[2] = *p++; - b[1] = *p++; - b[0] = *p; - dev->write(b, 8); } return *this; } @@ -1205,22 +1104,16 @@ QDataStream &QDataStream::operator<<(float f) CHECK_STREAM_PRECOND(*this) float g = f; // fixes float-on-stack problem - if (noswap) { // no conversion needed - dev->write((char *)&g, sizeof(float)); - } else { // swap bytes + if (!noswap) { union { float val1; - char val2[4]; + quint32 val2; } x; - x.val1 = f; - char *p = x.val2; - char b[4]; - b[3] = *p++; - b[2] = *p++; - b[1] = *p++; - b[0] = *p; - dev->write(b, 4); + x.val1 = g; + x.val2 = qbswap(x.val2); + g = x.val1; } + dev->write((char *)&g, sizeof(float)); return *this; } @@ -1244,26 +1137,16 @@ QDataStream &QDataStream::operator<<(double f) CHECK_STREAM_PRECOND(*this) #ifndef Q_DOUBLE_FORMAT - if (noswap) { - dev->write((char *)&f, sizeof(double)); - } else { + if (!noswap) { union { double val1; - char val2[8]; + quint64 val2; } x; x.val1 = f; - char *p = x.val2; - char b[8]; - b[7] = *p++; - b[6] = *p++; - b[5] = *p++; - b[4] = *p++; - b[3] = *p++; - b[2] = *p++; - b[1] = *p++; - b[0] = *p; - dev->write(b, 8); + x.val2 = qbswap(x.val2); + f = x.val1; } + dev->write((char *)&f, sizeof(double)); #else union { double val1; diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h index afc16bc..ec4ba2f 100644 --- a/src/corelib/io/qdatastream.h +++ b/src/corelib/io/qdatastream.h @@ -84,10 +84,11 @@ public: Qt_4_3 = 9, Qt_4_4 = 10, Qt_4_5 = 11, - Qt_4_6 = 12 -#if QT_VERSION >= 0x040700 -#error Add the datastream version for this Qt version + Qt_4_6 = 12, Qt_4_7 = Qt_4_6 +#if QT_VERSION >= 0x040800 +#error Add the datastream version for this Qt version + Qt_4_8 = Qt_4_7 #endif }; diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index bec0075..ca01eb2 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -66,10 +66,6 @@ #include <ctype.h> #include <limits.h> #define SECURITY_WIN32 -#ifdef Q_CC_MINGW -// A workaround for a certain version of MinGW, the define UNICODE_STRING. -#include <subauth.h> -#endif #include <security.h> #ifndef _INTPTR_T_DEFINED diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index 27ab105..cc5bf97 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -189,8 +189,8 @@ public: QList<QObject *> pendingChildInsertedEvents; #else // preserve binary compatibility with code compiled without Qt 3 support - // ### why? - QList<QObject *> unused; + // keeping the binary layout stable helps the Qt Creator debugger + void *unused; #endif QList<QPointer<QObject> > eventFilters; diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 7112043..02c0aa1 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -629,6 +629,22 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) .arg((QT_VERSION & 0xff00) >> 8) .arg(QLIBRARY_AS_DEBUG ? QLatin1String("debug") : QLatin1String("false")) .arg(fileName); +#ifdef Q_WS_MAC + // On Mac, add the application arch to the reg key in order to + // cache plugin information separately for each arch. This prevents + // Qt from wrongly caching plugin load failures when the archs + // don't match. +#if defined(__x86_64__) + regkey += QLatin1String("-x86_64"); +#elif defined(__i386__) + regkey += QLatin1String("-i386"); +#elif defined(__ppc64__) + regkey += QLatin1String("-ppc64"); +#elif defined(__ppc__) + regkey += QLatin1String("-ppc"); +#endif +#endif // Q_WS_MAC + QStringList reg; #ifndef QT_NO_SETTINGS if (!settings) { diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index b9dd4d1..c1470c4 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -55,6 +55,7 @@ #include "qtools_p.h" #include "qhash.h" #include "qdebug.h" +#include "qendian.h" #ifdef Q_OS_MAC #include <private/qcore_mac_p.h> @@ -7306,7 +7307,7 @@ QDataStream &operator>>(QDataStream &in, QString &str) != (QSysInfo::ByteOrder == QSysInfo::BigEndian)) { ushort *data = reinterpret_cast<ushort *>(str.data()); while (len--) { - *data = (*data >> 8) | (*data << 8); + *data = qbswap(*data); ++data; } } diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri index 63f64a2..4e1b9a7 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/gui/dialogs/dialogs.pri @@ -50,7 +50,8 @@ HEADERS += \ } win32 { - HEADERS += dialogs/qwizard_win_p.h + HEADERS += dialogs/qwizard_win_p.h \ + dialogs/qfiledialog_win_p.h SOURCES += dialogs/qdialogsbinarycompat_win.cpp \ dialogs/qfiledialog_win.cpp \ dialogs/qpagesetupdialog_win.cpp \ diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp index 5a7ace9..7dcdc3f 100644 --- a/src/gui/dialogs/qfiledialog_win.cpp +++ b/src/gui/dialogs/qfiledialog_win.cpp @@ -58,19 +58,6 @@ # include <private/qmutexpool_p.h> #endif -#include <shlobj.h> -//At some point we can hope that mingw will support that interface -#if !defined(Q_WS_WINCE) && !defined(Q_CC_MINGW) -#include <shobjidl.h> -#endif - -#include <objbase.h> - -#if defined(__IFileDialog_INTERFACE_DEFINED__) \ - && defined(__IFileOpenDialog_INTERFACE_DEFINED__) -#define USE_COMMON_ITEM_DIALOG -#endif - #ifdef Q_WS_WINCE #include <commdlg.h> # ifndef BFFM_SETSELECTION @@ -89,6 +76,12 @@ typedef struct qt_priv_browseinfo { int iImage; } qt_BROWSEINFO; bool qt_priv_ptr_valid = false; +#else +#include "qfiledialog_win_p.h" +//we have to declare them here because they're not present for all SDK/compilers +static const IID QT_IID_IFileOpenDialog = {0xd57c7288, 0xd4ad, 0x4768, {0xbe, 0x02, 0x9d, 0x96, 0x95, 0x32, 0xd9, 0x60} }; +static const IID QT_IID_IShellItem = {0x43826d1e, 0xe718, 0x42ee, {0xbc, 0x55, 0xa1, 0xe2, 0x61, 0xc3, 0x7b, 0xfe} }; +static const CLSID QT_CLSID_FileOpenDialog = {0xdc1c5a9c, 0xe88a, 0x4dde, {0xa5, 0xa1, 0x60, 0xf8, 0x2a, 0x20, 0xae, 0xf7} }; #endif @@ -421,7 +414,7 @@ QString qt_win_get_save_file_name(const QFileDialogArgs &args, } -#if defined(USE_COMMON_ITEM_DIALOG) +#ifndef Q_WS_WINCE typedef HRESULT (WINAPI *PtrSHCreateItemFromParsingName)(PCWSTR pszPath, IBindCtx *pbc, REFIID riid, void **ppv); static PtrSHCreateItemFromParsingName pSHCreateItemFromParsingName = 0; @@ -481,9 +474,8 @@ static bool qt_win_set_IFileDialogOptions(IFileDialog *pfd, tInitDir = QDir::toNativeSeparators(initialDirectory); if (!tInitDir.isEmpty()) { IShellItem *psiDefaultFolder; - hr = pSHCreateItemFromParsingName((wchar_t*)tInitDir.utf16(), - NULL, - IID_PPV_ARGS(&psiDefaultFolder)); + hr = pSHCreateItemFromParsingName((wchar_t*)tInitDir.utf16(), NULL, QT_IID_IShellItem, + reinterpret_cast<void**>(&psiDefaultFolder)); if (SUCCEEDED(hr)) { hr = pfd->SetFolder(psiDefaultFolder); @@ -522,7 +514,7 @@ static bool qt_win_set_IFileDialogOptions(IFileDialog *pfd, return SUCCEEDED(hr); } -QStringList qt_win_CID_get_open_file_names(const QFileDialogArgs &args, +static QStringList qt_win_CID_get_open_file_names(const QFileDialogArgs &args, QString *initialDirectory, const QStringList &filterList, QString *selectedFilter, @@ -534,11 +526,9 @@ QStringList qt_win_CID_get_open_file_names(const QFileDialogArgs &args, modal_widget.setParent(args.parent, Qt::Window); QApplicationPrivate::enterModal(&modal_widget); // Multiple selection is allowed only in IFileOpenDialog. - IFileOpenDialog *pfd = 0; - HRESULT hr = CoCreateInstance(CLSID_FileOpenDialog, - NULL, - CLSCTX_INPROC_SERVER, - IID_PPV_ARGS(&pfd)); + IFileOpenDialog *pfd; + HRESULT hr = CoCreateInstance(QT_CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, QT_IID_IFileOpenDialog, + reinterpret_cast<void**>(&pfd)); if (SUCCEEDED(hr)) { qt_win_set_IFileDialogOptions(pfd, args.selection, @@ -643,7 +633,7 @@ QStringList qt_win_get_open_file_names(const QFileDialogArgs &args, // multiple files belonging to different folders from these search results, the // GetOpenFileName() will return only one folder name for all the files. To retrieve // the correct path for all selected files, we have to use Common Item Dialog interfaces. -#if defined(USE_COMMON_ITEM_DIALOG) +#ifndef Q_WS_WINCE if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) return qt_win_CID_get_open_file_names(args, initialDirectory, filterLst, selectedFilter, idx); #endif diff --git a/src/gui/dialogs/qfiledialog_win_p.h b/src/gui/dialogs/qfiledialog_win_p.h new file mode 100644 index 0000000..6d8c7c9 --- /dev/null +++ b/src/gui/dialogs/qfiledialog_win_p.h @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <shlobj.h> +#include <objbase.h> +#if !defined(QFILEDIAG_WIN_P_H) && !defined(__shobjidl_h__) + +//these are the interface declarations needed for the file dialog on Vista and up + +//At some point we can hope that all compilers/sdk will support that interface +//and we won't have to declare it ourselves + +//declarations +typedef DWORD SICHINTF; +#define FOS_OVERWRITEPROMPT 0x2 +#define FOS_STRICTFILETYPES 0x4 +#define FOS_NOCHANGEDIR 0x8 +#define FOS_PICKFOLDERS 0x20 +#define FOS_FORCEFILESYSTEM 0x40 +#define FOS_ALLNONSTORAGEITEMS 0x80 +#define FOS_NOVALIDATE 0x100 +#define FOS_ALLOWMULTISELECT 0x200 +#define FOS_PATHMUSTEXIST 0x800 +#define FOS_FILEMUSTEXIST 0x1000 +#define FOS_CREATEPROMPT 0x2000 +#define FOS_SHAREAWARE 0x4000 +#define FOS_NOREADONLYRETURN 0x8000 +#define FOS_NOTESTFILECREATE 0x10000 +#define FOS_HIDEMRUPLACES 0x20000 +#define FOS_HIDEPINNEDPLACES 0x40000 +#define FOS_NODEREFERENCELINKS 0x100000 +#define FOS_DONTADDTORECENT 0x2000000 +#define FOS_FORCESHOWHIDDEN 0x10000000 +#define FOS_DEFAULTNOMINIMODE 0x20000000 +#define FOS_FORCEPREVIEWPANEON 0x40000000 + +typedef int GETPROPERTYSTOREFLAGS; +#define GPS_DEFAULT 0x00000000 +#define GPS_HANDLERPROPERTIESONLY 0x00000001 +#define GPS_READWRITE 0x00000002 +#define GPS_TEMPORARY 0x00000004 +#define GPS_FASTPROPERTIESONLY 0x00000008 +#define GPS_OPENSLOWITEM 0x00000010 +#define GPS_DELAYCREATION 0x00000020 +#define GPS_BESTEFFORT 0x00000040 +#define GPS_MASK_VALID 0x0000007F + +//the enums +typedef enum { + SIATTRIBFLAGS_AND = 0x1, + SIATTRIBFLAGS_OR = 0x2, + SIATTRIBFLAGS_APPCOMPAT = 0x3, + SIATTRIBFLAGS_MASK = 0x3 +} SIATTRIBFLAGS; +typedef enum { + SIGDN_NORMALDISPLAY = 0x00000000, + SIGDN_PARENTRELATIVEPARSING = 0x80018001, + SIGDN_PARENTRELATIVEFORADDRESSBAR = 0x8001c001, + SIGDN_DESKTOPABSOLUTEPARSING = 0x80028000, + SIGDN_PARENTRELATIVEEDITING = 0x80031001, + SIGDN_DESKTOPABSOLUTEEDITING = 0x8004c000, + SIGDN_FILESYSPATH = 0x80058000, + SIGDN_URL = 0x80068000 +} SIGDN; +typedef enum { + FDAP_BOTTOM = 0x00000000, + FDAP_TOP = 0x00000001 +} FDAP; +typedef enum { + FDESVR_DEFAULT = 0x00000000, + FDESVR_ACCEPT = 0x00000001, + FDESVR_REFUSE = 0x00000002 +} FDE_SHAREVIOLATION_RESPONSE; +typedef FDE_SHAREVIOLATION_RESPONSE FDE_OVERWRITE_RESPONSE; + +//the structs +typedef struct { + LPCWSTR pszName; + LPCWSTR pszSpec; +} COMDLG_FILTERSPEC; +typedef struct { + GUID fmtid; + DWORD pid; +} PROPERTYKEY; +DECLARE_INTERFACE(IFileDialogEvents); +DECLARE_INTERFACE_(IShellItem, IUnknown) +{ + STDMETHOD(BindToHandler)(THIS_ IBindCtx *pbc, REFGUID bhid, REFIID riid, void **ppv) PURE; + STDMETHOD(GetParent)(THIS_ IShellItem **ppsi) PURE; + STDMETHOD(GetDisplayName)(THIS_ SIGDN sigdnName, LPWSTR *ppszName) PURE; + STDMETHOD(GetAttributes)(THIS_ SFGAOF sfgaoMask, SFGAOF *psfgaoAttribs) PURE; + STDMETHOD(Compare)(THIS_ IShellItem *psi, SICHINTF hint, int *piOrder) PURE; +}; +DECLARE_INTERFACE_(IShellItemFilter, IUnknown) +{ + STDMETHOD(IncludeItem)(THIS_ IShellItem *psi) PURE; + STDMETHOD(GetEnumFlagsForItem)(THIS_ IShellItem *psi, SHCONTF *pgrfFlags) PURE; +}; +DECLARE_INTERFACE_(IEnumShellItems, IUnknown) +{ + STDMETHOD(Next)(THIS_ ULONG celt, IShellItem **rgelt, ULONG *pceltFetched) PURE; + STDMETHOD(Skip)(THIS_ ULONG celt) PURE; + STDMETHOD(Reset)(THIS_) PURE; + STDMETHOD(Clone)(THIS_ IEnumShellItems **ppenum) PURE; +}; +DECLARE_INTERFACE_(IShellItemArray, IUnknown) +{ + STDMETHOD(BindToHandler)(THIS_ IBindCtx *pbc, REFGUID rbhid, REFIID riid, void **ppvOut) PURE; + STDMETHOD(GetPropertyStore)(THIS_ GETPROPERTYSTOREFLAGS flags, REFIID riid, void **ppv) PURE; + STDMETHOD(GetPropertyDescriptionList)(THIS_ const PROPERTYKEY *keyType, REFIID riid, void **ppv) PURE; + STDMETHOD(GetAttributes)(THIS_ SIATTRIBFLAGS dwAttribFlags, SFGAOF sfgaoMask, SFGAOF *psfgaoAttribs) PURE; + STDMETHOD(GetCount)(THIS_ DWORD *pdwNumItems) PURE; + STDMETHOD(GetItemAt)(THIS_ DWORD dwIndex, IShellItem **ppsi) PURE; + STDMETHOD(EnumItems)(THIS_ IEnumShellItems **ppenumShellItems) PURE; +}; +DECLARE_INTERFACE_(IModalWindow, IUnknown) +{ + STDMETHOD(Show)(THIS_ HWND hwndParent) PURE; +}; +DECLARE_INTERFACE_(IFileDialog, IModalWindow) +{ + STDMETHOD(SetFileTypes)(THIS_ UINT cFileTypes, const COMDLG_FILTERSPEC *rgFilterSpec) PURE; + STDMETHOD(SetFileTypeIndex)(THIS_ UINT iFileType) PURE; + STDMETHOD(GetFileTypeIndex)(THIS_ UINT *piFileType) PURE; + STDMETHOD(Advise)(THIS_ IFileDialogEvents *pfde, DWORD *pdwCookie) PURE; + STDMETHOD(Unadvise)(THIS_ DWORD dwCookie) PURE; + STDMETHOD(SetOptions)(THIS_ DWORD fos) PURE; + STDMETHOD(GetOptions)(THIS_ DWORD *pfos) PURE; + STDMETHOD(SetDefaultFolder)(THIS_ IShellItem *psi) PURE; + STDMETHOD(SetFolder)(THIS_ IShellItem *psi) PURE; + STDMETHOD(GetFolder)(THIS_ IShellItem **ppsi) PURE; + STDMETHOD(GetCurrentSelection)(THIS_ IShellItem **ppsi) PURE; + STDMETHOD(SetFileName)(THIS_ LPCWSTR pszName) PURE; + STDMETHOD(GetFileName)(THIS_ LPWSTR *pszName) PURE; + STDMETHOD(SetTitle)(THIS_ LPCWSTR pszTitle) PURE; + STDMETHOD(SetOkButtonLabel)(THIS_ LPCWSTR pszText) PURE; + STDMETHOD(SetFileNameLabel)(THIS_ LPCWSTR pszLabel) PURE; + STDMETHOD(GetResult)(THIS_ IShellItem **ppsi) PURE; + STDMETHOD(AddPlace)(THIS_ IShellItem *psi, FDAP fdap) PURE; + STDMETHOD(SetDefaultExtension)(THIS_ LPCWSTR pszDefaultExtension) PURE; + STDMETHOD(Close)(THIS_ HRESULT hr) PURE; + STDMETHOD(SetClientGuid)(THIS_ REFGUID guid) PURE; + STDMETHOD(ClearClientData)(THIS_) PURE; + STDMETHOD(SetFilter)(THIS_ IShellItemFilter *pFilter) PURE; +}; +DECLARE_INTERFACE_(IFileDialogEvents, IUnknown) +{ + STDMETHOD(OnFileOk)(THIS_ IFileDialog *pfd) PURE; + STDMETHOD(OnFolderChanging)(THIS_ IFileDialog *pfd, IShellItem *psiFolder) PURE; + STDMETHOD(OnFolderChange)(THIS_ IFileDialog *pfd) PURE; + STDMETHOD(OnSelectionChange)(THIS_ IFileDialog *pfd) PURE; + STDMETHOD(OnShareViolation)(THIS_ IFileDialog *pfd, IShellItem *psi, FDE_SHAREVIOLATION_RESPONSE *pResponse) PURE; + STDMETHOD(OnTypeChange)(THIS_ IFileDialog *pfd) PURE; + STDMETHOD(OnOverwrite)(THIS_ IFileDialog *pfd, IShellItem *psi, FDE_OVERWRITE_RESPONSE *pResponse) PURE; +}; +DECLARE_INTERFACE_(IFileOpenDialog, IFileDialog) +{ + STDMETHOD(GetResults)(THIS_ IShellItemArray **ppenum) PURE; + STDMETHOD(GetSelectedItems)(THIS_ IShellItemArray **ppsai) PURE; +}; +#endif
\ No newline at end of file diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp index 5ccd33d..fa0c99f 100644 --- a/src/gui/dialogs/qprintdialog_win.cpp +++ b/src/gui/dialogs/qprintdialog_win.cpp @@ -52,7 +52,7 @@ #include <private/qprintengine_win_p.h> #include <private/qprinter_p.h> -#if defined(Q_CC_MINGW) && !defined(PD_NOCURRENTPAGE) +#if !defined(PD_NOCURRENTPAGE) #define PD_NOCURRENTPAGE 0x00800000 #define PD_RESULT_PRINT 1 #define PD_RESULT_APPLY 2 diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index f823fdc..5626485 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1084,6 +1084,9 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect) if (widget->testAttribute(Qt::WA_PendingResizeEvent) || !widget->testAttribute(Qt::WA_WState_Created)) sendResizeEvents(widget); + widget->d_func()->prepareToRender(QRegion(), + QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask); + QRect r(rect); if (r.width() < 0) r.setWidth(widget->width() - rect.x()); @@ -1094,8 +1097,8 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect) return QPixmap(); QPixmap res(r.size()); - widget->render(&res, QPoint(), r, - QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask); + widget->d_func()->render(&res, QPoint(), r, QWidget::DrawWindowBackground + | QWidget::DrawChildren | QWidget::IgnoreMask, true); return res; } diff --git a/src/gui/inputmethod/qwininputcontext_p.h b/src/gui/inputmethod/qwininputcontext_p.h index 08cc3d2..d5bedf4 100644 --- a/src/gui/inputmethod/qwininputcontext_p.h +++ b/src/gui/inputmethod/qwininputcontext_p.h @@ -56,7 +56,7 @@ #include "QtGui/qinputcontext.h" #include "QtCore/qt_windows.h" -#if defined(Q_CC_MINGW) && !defined(IMR_RECONVERTSTRING) +#if !defined(IMR_RECONVERTSTRING) typedef struct tagRECONVERTSTRING { DWORD dwSize; DWORD dwVersion; diff --git a/src/gui/kernel/qaction.h b/src/gui/kernel/qaction.h index 4341367..538b04f 100644 --- a/src/gui/kernel/qaction.h +++ b/src/gui/kernel/qaction.h @@ -246,6 +246,9 @@ private: friend class QMenuBar; friend class QShortcutMap; friend class QToolButton; +#ifdef Q_WS_MAC + friend void qt_mac_clear_status_text(QAction *action); +#endif }; QT_BEGIN_INCLUDE_NAMESPACE diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 12fe797..9a639c1 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -924,6 +924,14 @@ void QApplicationPrivate::initialize() // Set up which span functions should be used in raster engine... qInitDrawhelperAsm(); +#ifdef QT_MAC_USE_COCOA + // Use the raster graphics system by default on Cocoa, override with + // -graphicssystem native + if (graphics_system_name.isEmpty()) { + graphics_system_name = QLatin1String("raster"); + } +#endif + #if !defined(Q_WS_X11) && !defined(Q_WS_QWS) // initialize the graphics system - on X11 this is initialized inside // qt_init() in qapplication_x11.cpp because of several reasons. diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index ede87de..eed76e5 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -4851,90 +4851,7 @@ void QWidget::unsetCursor() void QWidget::render(QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, RenderFlags renderFlags) { - Q_D(QWidget); - if (!target) { - qWarning("QWidget::render: null pointer to paint device"); - return; - } - - const bool inRenderWithPainter = d->extra && d->extra->inRenderWithPainter; - QRegion paintRegion = !inRenderWithPainter ? d->prepareToRender(sourceRegion, renderFlags) - : sourceRegion; - if (paintRegion.isEmpty()) - return; - -#ifndef Q_WS_MAC - QPainter *oldSharedPainter = inRenderWithPainter ? d->sharedPainter() : 0; - - // Use the target's shared painter if set (typically set when doing - // "other->render(widget);" in the widget's paintEvent. - if (target->devType() == QInternal::Widget) { - QWidgetPrivate *targetPrivate = static_cast<QWidget *>(target)->d_func(); - if (targetPrivate->extra && targetPrivate->extra->inRenderWithPainter) { - QPainter *targetPainter = targetPrivate->sharedPainter(); - if (targetPainter && targetPainter->isActive()) - d->setSharedPainter(targetPainter); - } - } -#endif - - // Use the target's redirected device if set and adjust offset and paint - // region accordingly. This is typically the case when people call render - // from the paintEvent. - QPoint offset = targetOffset; - offset -= paintRegion.boundingRect().topLeft(); - QPoint redirectionOffset; - QPaintDevice *redirected = 0; - - if (target->devType() == QInternal::Widget) - redirected = static_cast<QWidget *>(target)->d_func()->redirected(&redirectionOffset); - if (!redirected) - redirected = QPainter::redirected(target, &redirectionOffset); - - if (redirected) { - target = redirected; - offset -= redirectionOffset; - } - - if (!inRenderWithPainter) { // Clip handled by shared painter (in qpainter.cpp). - if (QPaintEngine *targetEngine = target->paintEngine()) { - const QRegion targetSystemClip = targetEngine->systemClip(); - if (!targetSystemClip.isEmpty()) - paintRegion &= targetSystemClip.translated(-offset); - } - } - - // Set backingstore flags. - int flags = QWidgetPrivate::DrawPaintOnScreen | QWidgetPrivate::DrawInvisible; - if (renderFlags & DrawWindowBackground) - flags |= QWidgetPrivate::DrawAsRoot; - - if (renderFlags & DrawChildren) - flags |= QWidgetPrivate::DrawRecursive; - else - flags |= QWidgetPrivate::DontSubtractOpaqueChildren; - -#ifdef Q_WS_QWS - flags |= QWidgetPrivate::DontSetCompositionMode; -#endif - - if (target->devType() == QInternal::Printer) { - QPainter p(target); - d->render_helper(&p, targetOffset, paintRegion, renderFlags); - return; - } - -#ifndef Q_WS_MAC - // Render via backingstore. - d->drawWidget(target, paintRegion, offset, flags, d->sharedPainter()); - - // Restore shared painter. - if (oldSharedPainter) - d->setSharedPainter(oldSharedPainter); -#else - // Render via backingstore (no shared painter). - d->drawWidget(target, paintRegion, offset, flags, 0); -#endif + d_func()->render(target, targetOffset, sourceRegion, renderFlags, false); } /*! @@ -5380,6 +5297,97 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP } } +void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset, + const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, + bool readyToRender) +{ + Q_Q(QWidget); + if (!target) { + qWarning("QWidget::render: null pointer to paint device"); + return; + } + + const bool inRenderWithPainter = extra && extra->inRenderWithPainter; + QRegion paintRegion = !inRenderWithPainter && !readyToRender + ? prepareToRender(sourceRegion, renderFlags) + : sourceRegion; + if (paintRegion.isEmpty()) + return; + +#ifndef Q_WS_MAC + QPainter *oldSharedPainter = inRenderWithPainter ? sharedPainter() : 0; + + // Use the target's shared painter if set (typically set when doing + // "other->render(widget);" in the widget's paintEvent. + if (target->devType() == QInternal::Widget) { + QWidgetPrivate *targetPrivate = static_cast<QWidget *>(target)->d_func(); + if (targetPrivate->extra && targetPrivate->extra->inRenderWithPainter) { + QPainter *targetPainter = targetPrivate->sharedPainter(); + if (targetPainter && targetPainter->isActive()) + setSharedPainter(targetPainter); + } + } +#endif + + // Use the target's redirected device if set and adjust offset and paint + // region accordingly. This is typically the case when people call render + // from the paintEvent. + QPoint offset = targetOffset; + offset -= paintRegion.boundingRect().topLeft(); + QPoint redirectionOffset; + QPaintDevice *redirected = 0; + + if (target->devType() == QInternal::Widget) + redirected = static_cast<QWidget *>(target)->d_func()->redirected(&redirectionOffset); + if (!redirected) + redirected = QPainter::redirected(target, &redirectionOffset); + + if (redirected) { + target = redirected; + offset -= redirectionOffset; + } + + if (!inRenderWithPainter) { // Clip handled by shared painter (in qpainter.cpp). + if (QPaintEngine *targetEngine = target->paintEngine()) { + const QRegion targetSystemClip = targetEngine->systemClip(); + if (!targetSystemClip.isEmpty()) + paintRegion &= targetSystemClip.translated(-offset); + } + } + + // Set backingstore flags. + int flags = DrawPaintOnScreen | DrawInvisible; + if (renderFlags & QWidget::DrawWindowBackground) + flags |= DrawAsRoot; + + if (renderFlags & QWidget::DrawChildren) + flags |= DrawRecursive; + else + flags |= DontSubtractOpaqueChildren; + +#ifdef Q_WS_QWS + flags |= DontSetCompositionMode; +#endif + + if (target->devType() == QInternal::Printer) { + QPainter p(target); + render_helper(&p, targetOffset, paintRegion, renderFlags); + return; + } + +#ifndef Q_WS_MAC + // Render via backingstore. + drawWidget(target, paintRegion, offset, flags, sharedPainter()); + + // Restore shared painter. + if (oldSharedPainter) + setSharedPainter(oldSharedPainter); +#else + // Render via backingstore (no shared painter). + drawWidget(target, paintRegion, offset, flags, 0); +#endif +} + void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList& siblings, int index, const QRegion &rgn, const QPoint &offset, int flags #ifdef Q_BACKINGSTORE_SUBSURFACES diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index b1eb3c3..c9d655c 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -384,6 +384,8 @@ public: QRegion prepareToRender(const QRegion ®ion, QWidget::RenderFlags renderFlags); void render_helper(QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags); + void render(QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, + QWidget::RenderFlags renderFlags, bool readyToRender); void drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter = 0, QWidgetBackingStore *backingStore = 0); diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 739a70b..2a1d336 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -5662,10 +5662,16 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons OSType iconType = 0; switch (standardIcon) { case QStyle::SP_MessageBoxQuestion: + iconType = kQuestionMarkIcon; + break; case QStyle::SP_MessageBoxInformation: + iconType = kAlertNoteIcon; + break; case QStyle::SP_MessageBoxWarning: + iconType = kAlertCautionIcon; + break; case QStyle::SP_MessageBoxCritical: - iconType = kGenericApplicationIcon; + iconType = kAlertStopIcon; break; case SP_DesktopIcon: iconType = kDesktopIcon; diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 97d69b2..30c3805 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3132,7 +3132,6 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai p->drawLine(opt->rect.topLeft(), opt->rect.bottomLeft()); } break; case PE_FrameStatusBarItem: - QCommonStyle::drawPrimitive(pe, opt, p, w); break; case PE_IndicatorTabClose: { bool hover = (opt->state & State_MouseOver); diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp index 9f3b6e1..2032fd9 100644 --- a/src/gui/util/qdesktopservices_win.cpp +++ b/src/gui/util/qdesktopservices_win.cpp @@ -59,7 +59,7 @@ # endif #endif -#if defined(Q_CC_MINGW) && !defined(CSIDL_MYMUSIC) +#ifndef CSIDL_MYMUSIC #define CSIDL_MYMUSIC 13 #define CSIDL_MYVIDEO 14 #endif diff --git a/src/gui/widgets/qcocoamenu_mac.mm b/src/gui/widgets/qcocoamenu_mac.mm index a7e0b79..ce85919 100644 --- a/src/gui/widgets/qcocoamenu_mac.mm +++ b/src/gui/widgets/qcocoamenu_mac.mm @@ -46,6 +46,7 @@ #import <private/qcocoamenuloader_mac_p.h> #include <private/qt_cocoa_helpers_mac_p.h> #include <private/qapplication_p.h> +#include <private/qaction_p.h> #include <QtGui/QMenu> @@ -70,6 +71,7 @@ QT_USE_NAMESPACE self = [super init]; if (self) { qmenu = menu; + previousAction = 0; [self setAutoenablesItems:NO]; [self setDelegate:self]; } @@ -81,13 +83,20 @@ QT_USE_NAMESPACE Q_UNUSED(menu); if (!item) { - // ### According to the docs everything will be highlighted. Not sure what we should do in - // Qt, so just return. + if (previousAction) { + qt_mac_clear_status_text(previousAction); + previousAction = 0; + } return; } - if (QAction *action = reinterpret_cast<QAction *>([item tag])) + if (QAction *action = reinterpret_cast<QAction *>([item tag])) { + QMenu *qtmenu = static_cast<QT_MANGLE_NAMESPACE(QCocoaMenu) *>(menu)->qmenu; + previousAction = action; action->activate(QAction::Hover); + qt_mac_menu_emit_hovered(qtmenu, action); + action->showStatusText(0); // 0 widget -> action's parent + } } - (void)menuWillOpen:(NSMenu*)menu; @@ -100,9 +109,13 @@ QT_USE_NAMESPACE qt_mac_menu_collapseSeparators(menu, qtmenu->separatorsCollapsible()); } -- (void)menuWillClose:(NSMenu*)menu; +- (void)menuDidClose:(NSMenu*)menu; { qt_mac_emit_menuSignals(((QT_MANGLE_NAMESPACE(QCocoaMenu) *)menu)->qmenu, false); + if (previousAction) { + qt_mac_clear_status_text(previousAction); + previousAction = 0; + } } - (BOOL)hasShortcut:(NSMenu *)menu forKey:(NSString *)key forModifiers:(NSUInteger)modifier @@ -194,6 +207,18 @@ void qt_mac_emit_menuSignals(QMenu *menu, bool show) } qt_mac_menus_open_count += delta; } + +void qt_mac_clear_status_text(QAction *action) +{ + action->d_func()->showStatusText(0, QString()); +} + +void qt_mac_menu_emit_hovered(QMenu *menu, QAction *action) +{ + emit menu->hovered(action); +} + + QT_END_NAMESPACE #endif diff --git a/src/gui/widgets/qcocoamenu_mac_p.h b/src/gui/widgets/qcocoamenu_mac_p.h index 9f50c40..23ea705 100644 --- a/src/gui/widgets/qcocoamenu_mac_p.h +++ b/src/gui/widgets/qcocoamenu_mac_p.h @@ -52,6 +52,7 @@ #include "qmacdefines_mac.h" #ifdef QT_MAC_USE_COCOA +#include <qpointer.h> #import <Cocoa/Cocoa.h> QT_FORWARD_DECLARE_CLASS(QMenu) @@ -61,7 +62,7 @@ QT_FORWARD_DECLARE_CLASS(QMenu) @protocol NSMenuDelegate <NSObject> - (void)menu:(NSMenu*)menu willHighlightItem:(NSMenuItem*)item; - (void)menuWillOpen:(NSMenu*)menu; -- (void)menuWillClose:(NSMenu*)menu; +- (void)menuDidClose:(NSMenu*)menu; - (BOOL)hasShortcut:(NSMenu *)menu forKey:(NSString *)key forModifiers:(NSUInteger)modifier whichItem:(NSMenuItem**)outItem; @end @@ -71,6 +72,7 @@ QT_FORWARD_DECLARE_CLASS(QMenu) @interface QT_MANGLE_NAMESPACE(QCocoaMenu) : NSMenu <NSMenuDelegate> { QMenu *qmenu; + QPointer<QAction> previousAction; } - (id)initWithQMenu:(QMenu*)menu; - (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action; diff --git a/src/gui/widgets/qmenu.h b/src/gui/widgets/qmenu.h index 5a6a5c7..28bd859 100644 --- a/src/gui/widgets/qmenu.h +++ b/src/gui/widgets/qmenu.h @@ -415,6 +415,7 @@ private: friend OSStatus qt_mac_menu_event(EventHandlerCallRef, EventRef, void *); friend bool qt_mac_activate_action(OSMenuRef, uint, QAction::ActionEvent, bool); friend void qt_mac_emit_menuSignals(QMenu *, bool); + friend void qt_mac_menu_emit_hovered(QMenu *menu, QAction *action); #endif }; diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 22e8255..7559311 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -1947,7 +1947,8 @@ void QTabBar::changeEvent(QEvent *event) { Q_D(QTabBar); if (event->type() == QEvent::StyleChange) { - d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this)); + if (!d->elideModeSetByUser) + d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this)); if (!d->useScrollButtonsSetByUser) d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this); d->refresh(); @@ -1980,6 +1981,7 @@ void QTabBar::setElideMode(Qt::TextElideMode mode) { Q_D(QTabBar); d->elideMode = mode; + d->elideModeSetByUser = true; d->refresh(); } diff --git a/src/gui/widgets/qtabbar_p.h b/src/gui/widgets/qtabbar_p.h index 7588035..83636e6 100644 --- a/src/gui/widgets/qtabbar_p.h +++ b/src/gui/widgets/qtabbar_p.h @@ -75,7 +75,7 @@ class QTabBarPrivate : public QWidgetPrivate public: QTabBarPrivate() :currentIndex(-1), pressedIndex(-1), shape(QTabBar::RoundedNorth), layoutDirty(false), - drawBase(true), scrollOffset(0), useScrollButtonsSetByUser(false) , expanding(true), closeButtonOnTabs(false), + drawBase(true), scrollOffset(0), elideModeSetByUser(false), useScrollButtonsSetByUser(false), expanding(true), closeButtonOnTabs(false), selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false), movingTab(0) #ifdef Q_WS_MAC @@ -186,6 +186,7 @@ public: void makeVisible(int index); QSize iconSize; Qt::TextElideMode elideMode; + bool elideModeSetByUser; bool useScrollButtons; bool useScrollButtonsSetByUser; diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index 0a8ea5d..be4339c 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -533,6 +533,12 @@ QByteArray QNetworkReply::rawHeader(const QByteArray &headerName) const return QByteArray(); } +const QList<QNetworkReply::RawHeaderPair>& QNetworkReply::rawHeaderPairs() const +{ + Q_D(const QNetworkReply); + return d->rawHeaders; +} + /*! Returns a list of headers fields that were sent by the remote server, in the order that they were sent. Duplicate headers are diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index 5be4cce..5db4985 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -128,6 +128,9 @@ public: QList<QByteArray> rawHeaderList() const; QByteArray rawHeader(const QByteArray &headerName) const; + typedef QPair<QByteArray, QByteArray> RawHeaderPair; + const QList<RawHeaderPair>& rawHeaderPairs() const; + // attributes QVariant attribute(QNetworkRequest::Attribute code) const; diff --git a/src/plugins/phonon/ds9/ds9.pro b/src/plugins/phonon/ds9/ds9.pro index 786338a..301808e 100644 --- a/src/plugins/phonon/ds9/ds9.pro +++ b/src/plugins/phonon/ds9/ds9.pro @@ -22,7 +22,6 @@ HEADERS += \ $$PHONON_DS9_DIR/mediaobject.h \ $$PHONON_DS9_DIR/videowidget.h \ $$PHONON_DS9_DIR/videorenderer_soft.h \ - $$PHONON_DS9_DIR/videorenderer_vmr9.h \ $$PHONON_DS9_DIR/volumeeffect.h \ $$PHONON_DS9_DIR/qbasefilter.h \ $$PHONON_DS9_DIR/qpin.h \ @@ -45,7 +44,6 @@ SOURCES += \ $$PHONON_DS9_DIR/mediaobject.cpp \ $$PHONON_DS9_DIR/videowidget.cpp \ $$PHONON_DS9_DIR/videorenderer_soft.cpp \ - $$PHONON_DS9_DIR/videorenderer_vmr9.cpp \ $$PHONON_DS9_DIR/volumeeffect.cpp \ $$PHONON_DS9_DIR/qbasefilter.cpp \ $$PHONON_DS9_DIR/qpin.cpp \ @@ -53,6 +51,14 @@ SOURCES += \ $$PHONON_DS9_DIR/qaudiocdreader.cpp \ $$PHONON_DS9_DIR/qmeminputpin.cpp +#the EVR renderer (only available on desktop) +!wince*:SOURCES += $$PHONON_DS9_DIR/videorenderer_evr.cpp \ + $$PHONON_DS9_DIR/videorenderer_vmr9.cpp +!wince*:HEADERS += $$PHONON_DS9_DIR/qevr9.h \ + $$PHONON_DS9_DIR/videorenderer_evr.h \ + $$PHONON_DS9_DIR/videorenderer_vmr9.h +wince*:SOURCES += $$PHONON_DS9_DIR/videorenderer_default.cpp +wince*:HEADERS += $$PHONON_DS9_DIR/videorenderer_default.h target.path = $$[QT_INSTALL_PLUGINS]/phonon_backend INSTALLS += target diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri index 3af8b40..3dd3d2e 100644 --- a/src/plugins/qpluginbase.pri +++ b/src/plugins/qpluginbase.pri @@ -1,6 +1,6 @@ TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.6.2 + VERSION=4.7.0 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/src/qbase.pri b/src/qbase.pri index d9832a1..22a57db 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -4,7 +4,7 @@ INCLUDEPATH *= $$QMAKE_INCDIR_QT/$$TARGET #just for today to have some compat isEmpty(QT_ARCH):!isEmpty(ARCH):QT_ARCH=$$ARCH #another compat that will rot for change #215700 TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.6.2 + VERSION=4.7.0 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/tests/arthur/lance/widgets.h b/tests/arthur/lance/widgets.h index 88e0726..f7d3268 100644 --- a/tests/arthur/lance/widgets.h +++ b/tests/arthur/lance/widgets.h @@ -236,7 +236,12 @@ public: } if (m_render_view.isNull()) { - m_render_view = T::window()->windowSurface()->grabWidget(this); + + if (T::window()->windowSurface()) + m_render_view = T::window()->windowSurface()->grabWidget(this); + else + m_render_view = QPixmap::grabWidget(this); + m_render_view.save("renderView.png"); } } diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/respfile/lupdatecmd new file mode 100644 index 0000000..6f198ab --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/lupdatecmd @@ -0,0 +1,2 @@ +# Add the command that lupdate should run here. If it can't find anything it will default to +lupdate -silent @sources.lst -ts @tsfiles.lst diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/respfile/project.ts.result new file mode 100644 index 0000000..3a864a2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/project.ts.result @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>Dialog2</name> + <message> + <location filename="source1.cpp" line="47"/> + <source>func1</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="source2.cpp" line="47"/> + <source>func2</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/examples/assistant/simpletextviewer/main.cpp b/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp index 6e38406..3327d1e 100644 --- a/examples/assistant/simpletextviewer/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -39,14 +39,11 @@ ** ****************************************************************************/ -#include <QApplication> +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! -#include "mainwindow.h" - -int main(int argc, char *argv[]) +void Dialog2::func3() { - QApplication app(argc, argv); - MainWindow window; - window.show(); - return app.exec(); + tr("func1"); } + diff --git a/examples/assistant/simpletextviewer/mainwindow.h b/tests/auto/linguist/lupdate/testdata/good/respfile/source2.cpp index 14f0679..f284a61 100644 --- a/examples/assistant/simpletextviewer/mainwindow.h +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/source2.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -39,53 +39,11 @@ ** ****************************************************************************/ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! -#include <QAssistantClient> -#include <QMainWindow> -#include <QTextEdit> - -class MainWindow : public QMainWindow +void Dialog2::func3() { - Q_OBJECT - -public: - MainWindow(); - -private slots: - void about(); -//! [0] - void assistant(); -//! [0] - void open(); - -protected: -//! [1] - void closeEvent(QCloseEvent *event); -//! [1] - -private: - void createActions(); - void createMenus(); -//! [2] - void initializeAssistant(); -//! [2] - -//! [3] - QAssistantClient *assistantClient; -//! [3] - QTextEdit *textViewer; - - QMenu *fileMenu; - QMenu *helpMenu; - - QAction *assistantAct; - QAction *clearAct; - QAction *openAct; - QAction *exitAct; - QAction *aboutAct; - QAction *aboutQtAct; -}; + tr("func2"); +} -#endif diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/sources.lst b/tests/auto/linguist/lupdate/testdata/good/respfile/sources.lst new file mode 100644 index 0000000..430937e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/sources.lst @@ -0,0 +1,2 @@ +source1.cpp +source2.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/tsfiles.lst b/tests/auto/linguist/lupdate/testdata/good/respfile/tsfiles.lst new file mode 100644 index 0000000..f3eb71f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/tsfiles.lst @@ -0,0 +1 @@ +project.ts diff --git a/tests/auto/networkdata/README b/tests/auto/networkdata/README new file mode 100644 index 0000000..e8748cc --- /dev/null +++ b/tests/auto/networkdata/README @@ -0,0 +1 @@ +This directory contains network test data diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp index d1b2ea5..76903e5 100644 --- a/tests/auto/qdom/tst_qdom.cpp +++ b/tests/auto/qdom/tst_qdom.cpp @@ -476,10 +476,6 @@ void tst_QDom::save() void tst_QDom::initTestCase() { -#ifdef Q_CC_MINGW - QSKIP("Our current test machine, arsia, is too slow for this auto test.", SkipAll); -#endif - QFile file(SRCDIR "testdata/excludedCodecs.txt"); QVERIFY(file.open(QIODevice::ReadOnly|QIODevice::Text)); @@ -1676,7 +1672,7 @@ void tst_QDom::appendDocumentNode() const doc.appendChild(elem); - Q_ASSERT(!xml.isNull()); + QVERIFY(!xml.isNull()); const QString expected(QLatin1String("<document>\n<test_elem name=\"value\"/>\n</document>\n")); elem.appendChild(xml); diff --git a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp index 0122d43..12ddff1 100644 --- a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp @@ -193,186 +193,208 @@ void tst_QEasingCurve::valueForProgress_data() // integer values and avoid fp inaccuracies QTest::newRow("Linear") << int(QEasingCurve::Linear) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.1 << 0.2 << 0.3 << 0.4 << 0.5 << 0.6 << 0.7 << 0.8 << 0.9 << 1); + << (RealList() << 0.0000 << 0.1000 << 0.2000 << 0.3000 << 0.4000 << 0.5000 << 0.6000 << 0.7000 << 0.8000 << 0.9000 << 1.0000); QTest::newRow("InQuad") << int(QEasingCurve::InQuad) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.01 << 0.04 << 0.09 << 0.16 << 0.25 << 0.36 << 0.49 << 0.64 << 0.81 << 1); + << (RealList() << 0.0000 << 0.0100 << 0.0400 << 0.0900 << 0.1600 << 0.2500 << 0.3600 << 0.4900 << 0.6400 << 0.8100 << 1.0000); QTest::newRow("OutQuad") << int(QEasingCurve::OutQuad) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.19 << 0.36 << 0.51 << 0.64 << 0.75 << 0.84 << 0.91 << 0.96 << 0.99 << 1); + << (RealList() << 0.0000 << 0.1900 << 0.3600 << 0.5100 << 0.6400 << 0.7500 << 0.8400 << 0.9100 << 0.9600 << 0.9900 << 1.0000); QTest::newRow("InOutQuad") << int(QEasingCurve::InOutQuad) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.02 << 0.08 << 0.18 << 0.32 << 0.5 << 0.68 << 0.82 << 0.92 << 0.98 << 1); + << (RealList() << 0.0000 << 0.0200 << 0.0800 << 0.1800 << 0.3200 << 0.5000 << 0.6800 << 0.8200 << 0.9200 << 0.9800 << 1.0000); QTest::newRow("OutInQuad") << int(QEasingCurve::OutInQuad) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.18 << 0.32 << 0.42 << 0.48 << 0.5 << 0.52 << 0.58 << 0.68 << 0.82 << 1); + << (RealList() << 0.0000 << 0.1800 << 0.3200 << 0.4200 << 0.4800 << 0.5000 << 0.5200 << 0.5800 << 0.6800 << 0.8200 << 1.0000); QTest::newRow("InCubic") << int(QEasingCurve::InCubic) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.001 << 0.008 << 0.027 << 0.064 << 0.125 << 0.216 << 0.343 << 0.512 << 0.729 << 1); + << (RealList() << 0.0000 << 0.0010 << 0.0080 << 0.0270 << 0.0640 << 0.1250 << 0.2160 << 0.3430 << 0.5120 << 0.7290 << 1.0000); QTest::newRow("OutCubic") << int(QEasingCurve::OutCubic) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.271 << 0.488 << 0.657 << 0.784 << 0.875 << 0.936 << 0.973 << 0.992 << 0.999 << 1); + << (RealList() << 0.0000 << 0.2710 << 0.4880 << 0.6570 << 0.7840 << 0.8750 << 0.9360 << 0.9730 << 0.9920 << 0.9990 << 1.0000); QTest::newRow("InOutCubic") << int(QEasingCurve::InOutCubic) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.004 << 0.032 << 0.108 << 0.256 << 0.5 << 0.744 << 0.892 << 0.968 << 0.996 << 1); + << (RealList() << 0.0000 << 0.0040 << 0.0320 << 0.1080 << 0.2560 << 0.5000 << 0.7440 << 0.8920 << 0.9680 << 0.9960 << 1.0000); QTest::newRow("OutInCubic") << int(QEasingCurve::OutInCubic) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.244 << 0.392 << 0.468 << 0.496 << 0.5 << 0.504 << 0.532 << 0.608 << 0.756 << 1); + << (RealList() << 0.0000 << 0.2440 << 0.3920 << 0.4680 << 0.4960 << 0.5000 << 0.5040 << 0.5320 << 0.6080 << 0.7560 << 1.0000); QTest::newRow("InQuart") << int(QEasingCurve::InQuart) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.0001 << 0.0016 << 0.0081 << 0.0256 << 0.0625 << 0.1296 << 0.2401 << 0.4096 << 0.6561 << 1); + << (RealList() << 0.0000 << 0.0001 << 0.0016 << 0.0081 << 0.0256 << 0.0625 << 0.1296 << 0.2401 << 0.4096 << 0.6561 << 1.0000); QTest::newRow("OutQuart") << int(QEasingCurve::OutQuart) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.3439 << 0.5904 << 0.7599 << 0.8704 << 0.9375 << 0.9744 << 0.9919 << 0.9984 << 0.9999 << 1); + << (RealList() << 0.0000 << 0.3439 << 0.5904 << 0.7599 << 0.8704 << 0.9375 << 0.9744 << 0.9919 << 0.9984 << 0.9999 << 1.0000); QTest::newRow("InOutQuart") << int(QEasingCurve::InOutQuart) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.0008 << 0.0128 << 0.0648 << 0.2048 << 0.5 << 0.7952 << 0.9352 << 0.9872 << 0.9992 << 1); + << (RealList() << 0.0000 << 0.0008 << 0.0128 << 0.0648 << 0.2048 << 0.5000 << 0.7952 << 0.9352 << 0.9872 << 0.9992 << 1.0000); QTest::newRow("OutInQuart") << int(QEasingCurve::OutInQuart) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.2952 << 0.4352 << 0.4872 << 0.4992 << 0.5 << 0.5008 << 0.5128 << 0.5648 << 0.7048 << 1); + << (RealList() << 0.0000 << 0.2952 << 0.4352 << 0.4872 << 0.4992 << 0.5000 << 0.5008 << 0.5128 << 0.5648 << 0.7048 << 1.0000); QTest::newRow("InQuint") << int(QEasingCurve::InQuint) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 1e-05 << 0.00032 << 0.00243 << 0.01024 << 0.03125 << 0.07776 << 0.1681 << 0.3277 << 0.5905 << 1); + << (RealList() << 0.0000 << 0.0000 << 0.0003 << 0.0024 << 0.0102 << 0.0313 << 0.0778 << 0.1681 << 0.3277 << 0.5905 << 1.0000); QTest::newRow("OutQuint") << int(QEasingCurve::OutQuint) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.4095 << 0.6723 << 0.8319 << 0.9222 << 0.9688 << 0.9898 << 0.9976 << 0.9997 << 1 << 1); + << (RealList() << 0.0000 << 0.4095 << 0.6723 << 0.8319 << 0.9222 << 0.9688 << 0.9898 << 0.9976 << 0.9997 << 1.0000 << 1.0000); QTest::newRow("InOutQuint") << int(QEasingCurve::InOutQuint) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.00016 << 0.00512 << 0.03888 << 0.1638 << 0.5 << 0.8362 << 0.9611 << 0.9949 << 0.9998 << 1); + << (RealList() << 0.0000 << 0.0002 << 0.0051 << 0.0389 << 0.1638 << 0.5000 << 0.8362 << 0.9611 << 0.9949 << 0.9998 << 1.0000); QTest::newRow("OutInQuint") << int(QEasingCurve::OutInQuint) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.3362 << 0.4611 << 0.4949 << 0.4998 << 0.5 << 0.5002 << 0.5051 << 0.5389 << 0.6638 << 1); + << (RealList() << 0.0000 << 0.3362 << 0.4611 << 0.4949 << 0.4998 << 0.5000 << 0.5002 << 0.5051 << 0.5389 << 0.6638 << 1.0000); QTest::newRow("InSine") << int(QEasingCurve::InSine) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.01231 << 0.04894 << 0.109 << 0.191 << 0.2929 << 0.4122 << 0.546 << 0.691 << 0.8436 << 1); + << (RealList() << 0.0000 << 0.0123 << 0.0489 << 0.1090 << 0.1910 << 0.2929 << 0.4122 << 0.5460 << 0.6910 << 0.8436 << 1.0000); QTest::newRow("OutSine") << int(QEasingCurve::OutSine) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.1564 << 0.309 << 0.454 << 0.5878 << 0.7071 << 0.809 << 0.891 << 0.9511 << 0.9877 << 1); + << (RealList() << 0.0000 << 0.1564 << 0.3090 << 0.4540 << 0.5878 << 0.7071 << 0.8090 << 0.8910 << 0.9511 << 0.9877 << 1.0000); QTest::newRow("InOutSine") << int(QEasingCurve::InOutSine) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.02447 << 0.09549 << 0.2061 << 0.3455 << 0.5 << 0.6545 << 0.7939 << 0.9045 << 0.9755 << 1); + << (RealList() << 0.0000 << 0.0245 << 0.0955 << 0.2061 << 0.3455 << 0.5000 << 0.6545 << 0.7939 << 0.9045 << 0.9755 << 1.0000); QTest::newRow("OutInSine") << int(QEasingCurve::OutInSine) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.1545 << 0.2939 << 0.4045 << 0.4755 << 0.5 << 0.5245 << 0.5955 << 0.7061 << 0.8455 << 1); + << (RealList() << 0.0000 << 0.1545 << 0.2939 << 0.4045 << 0.4755 << 0.5000 << 0.5245 << 0.5955 << 0.7061 << 0.8455 << 1.0000); QTest::newRow("InExpo") << int(QEasingCurve::InExpo) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.0009531 << 0.002906 << 0.006812 << 0.01462 << 0.03025 << 0.0615 << 0.124 << 0.249 << 0.499 << 1); + << (RealList() << 0.0000 << 0.0010 << 0.0029 << 0.0068 << 0.0146 << 0.0303 << 0.0615 << 0.1240 << 0.2490 << 0.4990 << 1.0000); QTest::newRow("OutExpo") << int(QEasingCurve::OutExpo) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.5005 << 0.7507 << 0.8759 << 0.9384 << 0.9697 << 0.9854 << 0.9932 << 0.9971 << 0.999 << 1); + << (RealList() << 0.0000 << 0.5005 << 0.7507 << 0.8759 << 0.9384 << 0.9697 << 0.9854 << 0.9932 << 0.9971 << 0.9990 << 1.0000); QTest::newRow("InOutExpo") << int(QEasingCurve::InOutExpo) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.001453 << 0.007312 << 0.03075 << 0.1245 << 0.5002 << 0.8754 << 0.9692 << 0.9927 << 0.9985 << 1); + << (RealList() << 0.0000 << 0.0015 << 0.0073 << 0.0308 << 0.1245 << 0.5003 << 0.8754 << 0.9692 << 0.9927 << 0.9985 << 1.0000); QTest::newRow("OutInExpo") << int(QEasingCurve::OutInExpo) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.3754 << 0.4692 << 0.4927 << 0.4985 << 0.5 << 0.5015 << 0.5073 << 0.5308 << 0.6245 << 1); + << (RealList() << 0.0000 << 0.3754 << 0.4692 << 0.4927 << 0.4985 << 0.5000 << 0.5015 << 0.5073 << 0.5308 << 0.6245 << 1.0000); QTest::newRow("InCirc") << int(QEasingCurve::InCirc) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.005013 << 0.0202 << 0.04606 << 0.08348 << 0.134 << 0.2 << 0.2859 << 0.4 << 0.5641 << 1); + << (RealList() << 0.0000 << 0.0050 << 0.0202 << 0.0461 << 0.0835 << 0.1340 << 0.2000 << 0.2859 << 0.4000 << 0.5641 << 1.0000); QTest::newRow("OutCirc") << int(QEasingCurve::OutCirc) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.4359 << 0.6 << 0.7141 << 0.8 << 0.866 << 0.9165 << 0.9539 << 0.9798 << 0.995 << 1); + << (RealList() << 0.0000 << 0.4359 << 0.6000 << 0.7141 << 0.8000 << 0.8660 << 0.9165 << 0.9539 << 0.9798 << 0.9950 << 1.0000); QTest::newRow("InOutCirc") << int(QEasingCurve::InOutCirc) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.0101 << 0.04174 << 0.1 << 0.2 << 0.5 << 0.8 << 0.9 << 0.9583 << 0.9899 << 1); + << (RealList() << 0.0000 << 0.0101 << 0.0417 << 0.1000 << 0.2000 << 0.5000 << 0.8000 << 0.9000 << 0.9583 << 0.9899 << 1.0000); QTest::newRow("OutInCirc") << int(QEasingCurve::OutInCirc) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.3 << 0.4 << 0.4583 << 0.4899 << 0.5 << 0.5101 << 0.5417 << 0.6 << 0.7 << 1); + << (RealList() << 0.0000 << 0.3000 << 0.4000 << 0.4583 << 0.4899 << 0.5000 << 0.5101 << 0.5417 << 0.6000 << 0.7000 << 1.0000); QTest::newRow("InElastic") << int(QEasingCurve::InElastic) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.001953 << -0.001953 << -0.003906 << 0.01562 << -0.01562 << -0.03125 << 0.125 << -0.125 << -0.25 << 1); + << (RealList() << 0.0000 << 0.0020 << -0.0020 << -0.0039 << 0.0156 << -0.0156 << -0.0313 << 0.1250 << -0.1250 << -0.2500 << 1.0000); QTest::newRow("OutElastic") << int(QEasingCurve::OutElastic) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 1.25 << 1.125 << 0.875 << 1.031 << 1.016 << 0.9844 << 1.004 << 1.002 << 0.998 << 1); + << (RealList() << 0.0000 << 1.2500 << 1.1250 << 0.8750 << 1.0313 << 1.0156 << 0.9844 << 1.0039 << 1.0020 << 0.9980 << 1.0000); QTest::newRow("InOutElastic") << int(QEasingCurve::InOutElastic) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << -0.0009766 << 0.007812 << -0.01563 << -0.0625 << 0.5 << 1.062 << 1.016 << 0.9922 << 1.001 << 1); + << (RealList() << 0.0000 << -0.0010 << 0.0078 << -0.0156 << -0.0625 << 0.5000 << 1.0625 << 1.0156 << 0.9922 << 1.0010 << 1.0000); QTest::newRow("OutInElastic") << int(QEasingCurve::OutInElastic) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.375 << 0.5625 << 0.4922 << 0.498 << 0.5 << 0.4961 << 0.5078 << 0.5313 << 0.25 << 1); + << (RealList() << 0.0000 << 0.3750 << 0.5625 << 0.4922 << 0.4980 << 0.5000 << 0.4961 << 0.5078 << 0.5313 << 0.2500 << 1.0000); QTest::newRow("InBack") << int(QEasingCurve::InBack) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << -0.01431 << -0.04645 << -0.0802 << -0.09935 << -0.0877 << -0.02903 << 0.09287 << 0.2942 << 0.5912 << 1); + << (RealList() << 0.0000 << -0.0143 << -0.0465 << -0.0802 << -0.0994 << -0.0877 << -0.0290 << 0.0929 << 0.2942 << 0.5912 << 1.0000); QTest::newRow("OutBack") << int(QEasingCurve::OutBack) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.4088 << 0.7058 << 0.9071 << 1.029 << 1.088 << 1.099 << 1.08 << 1.046 << 1.014 << 1); + << (RealList() << 0.0000 << 0.4088 << 0.7058 << 0.9071 << 1.0290 << 1.0877 << 1.0994 << 1.0802 << 1.0465 << 1.0143 << 1.0000); QTest::newRow("InOutBack") << int(QEasingCurve::InOutBack) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << -0.03752 << -0.09256 << -0.07883 << 0.08993 << 0.5 << 0.9101 << 1.079 << 1.093 << 1.038 << 1); + << (RealList() << 0.0000 << -0.0375 << -0.0926 << -0.0788 << 0.0899 << 0.5000 << 0.9101 << 1.0788 << 1.0926 << 1.0375 << 1.0000); QTest::newRow("OutInBack") << int(QEasingCurve::OutInBack) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.3529 << 0.5145 << 0.5497 << 0.5232 << 0.5 << 0.4768 << 0.4503 << 0.4855 << 0.6471 << 1); + << (RealList() << 0.0000 << 0.3529 << 0.5145 << 0.5497 << 0.5232 << 0.5000 << 0.4768 << 0.4503 << 0.4855 << 0.6471 << 1.0000); QTest::newRow("InBounce") << int(QEasingCurve::InBounce) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.01188 << 0.06 << 0.06937 << 0.2275 << 0.2344 << 0.09 << 0.3194 << 0.6975 << 0.9244 << 1); + << (RealList() << 0.0000 << 0.0119 << 0.0600 << 0.0694 << 0.2275 << 0.2344 << 0.0900 << 0.3194 << 0.6975 << 0.9244 << 1.0000); QTest::newRow("OutBounce") << int(QEasingCurve::OutBounce) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.07563 << 0.3025 << 0.6806 << 0.91 << 0.7656 << 0.7725 << 0.9306 << 0.94 << 0.9881 << 1); + << (RealList() << 0.0000 << 0.0756 << 0.3025 << 0.6806 << 0.9100 << 0.7656 << 0.7725 << 0.9306 << 0.9400 << 0.9881 << 1.0000); QTest::newRow("InOutBounce") << int(QEasingCurve::InOutBounce) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.03 << 0.1138 << 0.045 << 0.3488 << 0.5 << 0.6512 << 0.955 << 0.8862 << 0.97 << 1); + << (RealList() << 0.0000 << 0.0300 << 0.1138 << 0.0450 << 0.3488 << 0.5000 << 0.6512 << 0.9550 << 0.8863 << 0.9700 << 1.0000); QTest::newRow("OutInBounce") << int(QEasingCurve::OutInBounce) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.1513 << 0.41 << 0.2725 << 0.44 << 0.5 << 0.56 << 0.7275 << 0.59 << 0.8488 << 1); + << (RealList() << 0.0000 << 0.1513 << 0.4100 << 0.2725 << 0.4400 << 0.5000 << 0.5600 << 0.7275 << 0.5900 << 0.8488 << 1.0000); QTest::newRow("InCurve") << int(QEasingCurve::InCurve) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.02447 << 0.1059 << 0.2343 << 0.3727 << 0.5 << 0.6055 << 0.7 << 0.8 << 0.9 << 1); + << (RealList() << 0.0000 << 0.0245 << 0.1059 << 0.2343 << 0.3727 << 0.5000 << 0.6055 << 0.7000 << 0.8000 << 0.9000 << 1.0000); QTest::newRow("OutCurve") << int(QEasingCurve::OutCurve) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.1 << 0.2 << 0.3 << 0.3945 << 0.5 << 0.6273 << 0.7657 << 0.8941 << 0.9755 << 1); + << (RealList() << 0.0000 << 0.1000 << 0.2000 << 0.3000 << 0.3945 << 0.5000 << 0.6273 << 0.7657 << 0.8941 << 0.9755 << 1.0000); QTest::newRow("SineCurve") << int(QEasingCurve::SineCurve) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0 << 0.09549 << 0.3455 << 0.6545 << 0.9045 << 1 << 0.9045 << 0.6545 << 0.3455 << 0.09549 << 0); + << (RealList() << 0.0000 << 0.0955 << 0.3455 << 0.6545 << 0.9045 << 1.0000 << 0.9045 << 0.6545 << 0.3455 << 0.0955 << 0.0000); QTest::newRow("CosineCurve") << int(QEasingCurve::CosineCurve) << (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100) - << (RealList() << 0.5 << 0.7939 << 0.9755 << 0.9755 << 0.7939 << 0.5 << 0.2061 << 0.02447 << 0.02447 << 0.2061 << 0.5); + << (RealList() << 0.5000 << 0.7939 << 0.9755 << 0.9755 << 0.7939 << 0.5000 << 0.2061 << 0.0245 << 0.0245 << 0.2061 << 0.5000); } +/* + "fixedpoint" number that is scaled up by 10000. + This is to work around two bugs (precision and rounding error) in QString::setNum(). + It does not trim off trailing zeros. This is good, just to emphasize the precision. +*/ +QString fixedToString(int value) +{ + QString str; + if (value < 0) { + str+= QLatin1Char('-'); + value = -value; + } + + QString digitArg(QLatin1String("%1.")); + for (int i = 10000; i >= 1; i/=10) { + int digit = value/i; + value -= digit*i; + str.append(digitArg.arg(digit)); + digitArg = QLatin1String("%1"); + } + return str; +} void tst_QEasingCurve::valueForProgress() { @@ -390,7 +412,7 @@ void tst_QEasingCurve::valueForProgress() for (int t = 0; t <= 100; t+= 10) { qreal ease = curve.valueForProgress(t/qreal(100)); strInputs += QString::fromAscii(" << %1").arg(t); - strOutputs += " << " + QString().setNum(ease, 'g', 4); + strOutputs += " << " + fixedToString(qRound(ease*10000)); } QString str = QString::fromAscii(" QTest::newRow(\"%1\") << int(QEasingCurve::%2)\n" " << (IntList() %3)\n" @@ -409,26 +431,13 @@ void tst_QEasingCurve::valueForProgress() QFETCH(RealList, expected); QEasingCurve curve((QEasingCurve::Type)type); + // in theory the baseline should't have an error of more than 0.00005 due to how its rounded, + // but due to FP imprecision, we have to adjust the error a bit more. + const qreal errorBound = 0.00006; for (int i = 0; i < at.count(); ++i) { - qreal ease = curve.valueForProgress(at.at(i)/qreal(100)); - // converting ease to 4 precision qreal to match the generated samples - qreal easeConv = qreal(QString().setNum(ease, 'g', 4).toDouble()); - qreal ex = expected.at(i); - - // the least significant digit it is still subject to rounding errors - qreal error = easeConv - ex; - qreal errorbound = 0.00001; -#if defined( Q_OS_WINCE ) || defined( Q_OS_SYMBIAN ) - // exception values for WINCE(this test should be rewritten, as it only freezes the status quo of QEasingCurve - // The failing (2) values are explicitly excepted here: - // The source values for the comparison table should remain untruncated double and the - // error bound checking function dynamic. Also the source values should come from a "trusted" source and not - // from QEasingCurve itself. - if ((type == int(QEasingCurve::InOutBounce) && (i == 8 || i == 6) ) || (type == int(QEasingCurve::OutExpo) && i == 2)) - errorbound = 0.0002; -#endif - // accept the potential rounding error in the least significant digit - QVERIFY(error <= errorbound ); + const qreal ex = expected.at(i); + const qreal error = qAbs(ex - curve.valueForProgress(at.at(i)/qreal(100))); + QVERIFY(error <= errorBound); } #endif } diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 8bcd5e8..d6bf900 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -47,6 +47,7 @@ #include <qmatrix.h> #include <qdesktopwidget.h> #include <qpaintengine.h> +#include <qtreewidget.h> #include <qsplashscreen.h> #include <private/qpixmapdata_p.h> @@ -795,14 +796,32 @@ void tst_QPixmap::drawBitmap() void tst_QPixmap::grabWidget() { QWidget widget; - widget.setPalette(Qt::green); - widget.resize(128, 128); + QImage image(128, 128, QImage::Format_ARGB32_Premultiplied); + for (int row = 0; row < image.height(); ++row) { + QRgb *line = reinterpret_cast<QRgb *>(image.scanLine(row)); + for (int col = 0; col < image.width(); ++col) + line[col] = qRgb(rand() & 255, row, col); + } - QPixmap expected(64, 64); - expected.fill(Qt::green); + QPalette pal = widget.palette(); + pal.setBrush(QPalette::Window, QBrush(image)); + widget.setPalette(pal); + widget.resize(128, 128); + QPixmap expected = QPixmap::fromImage(QImage(image.scanLine(64) + 64 * 4, 64, 64, image.bytesPerLine(), image.format())); QPixmap actual = QPixmap::grabWidget(&widget, QRect(64, 64, 64, 64)); QVERIFY(lenientCompare(actual, expected)); + + actual = QPixmap::grabWidget(&widget, 64, 64); + QVERIFY(lenientCompare(actual, expected)); + + // Make sure a widget that is not yet shown is grabbed correctly. + QTreeWidget widget2; + actual = QPixmap::grabWidget(&widget2); + widget2.show(); + expected = QPixmap::grabWidget(&widget2); + + QVERIFY(lenientCompare(actual, expected)); } void tst_QPixmap::grabWindow() diff --git a/tests/auto/qsharedpointer/externaltests.cpp b/tests/auto/qsharedpointer/externaltests.cpp index eb2f27d..7eae3c1 100644 --- a/tests/auto/qsharedpointer/externaltests.cpp +++ b/tests/auto/qsharedpointer/externaltests.cpp @@ -671,14 +671,9 @@ namespace QTest { make.setProcessChannelMode(channelMode); -#if defined(Q_OS_WIN) && !defined(Q_CC_MINGW) - make.start(QLatin1String("nmake.exe"), args); - make.waitForStarted(); -#else static const char makes[] = -# ifdef Q_CC_MINGW - "mingw32-make.exe\0" -# endif + "nmake.exe\0" //for visual c++ + "mingw32-make.exe\0" //for mingw "gmake\0" "make\0"; for (const char *p = makes; *p; p += strlen(p) + 1) { @@ -686,7 +681,6 @@ namespace QTest { if (make.waitForStarted()) break; } -#endif if (make.state() != QProcess::Running) { exitCode = 255; diff --git a/tests/auto/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp index d980efa..72f9dd3 100644 --- a/tests/auto/qtabbar/tst_qtabbar.cpp +++ b/tests/auto/qtabbar/tst_qtabbar.cpp @@ -273,6 +273,9 @@ void tst_QTabBar::setElideMode() if (tabElideMode != -128) tabBar.setElideMode(Qt::TextElideMode(tabElideMode)); QTEST(int(tabBar.elideMode()), "expectedMode"); + // Make sure style sheet does not override user set mode + tabBar.setStyleSheet("QWidget { background-color: #ABA8A6;}"); + QTEST(int(tabBar.elideMode()), "expectedMode"); } void tst_QTabBar::setUsesScrollButtons_data() diff --git a/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp index e38a2bc..0e57306 100644 --- a/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp +++ b/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp @@ -580,7 +580,7 @@ void tst_QXmlSimpleReader::inputFromSocket() QSKIP("Symbian: Skipped due to problems in Open C and QtNetwork", SkipAll); #endif -#if defined(Q_OS_WIN32) && (defined(Q_CC_INTEL) || defined(Q_CC_MINGW) || defined(Q_CC_MSVC_NET)) +#if defined(Q_OS_WIN32) && (defined(Q_CC_INTEL) || defined(Q_CC_MSVC_NET)) QSKIP("Regression caused by QHOstInfo change 294548, see task 202231.", SkipAll); #endif QTcpSocket sock; diff --git a/tests/auto/selftests/expected_cmptest.txt b/tests/auto/selftests/expected_cmptest.txt index 1b65adf..e9f94c9 100644 --- a/tests/auto/selftests/expected_cmptest.txt +++ b/tests/auto/selftests/expected_cmptest.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Cmptest ********* -Config: Using QTest library 4.6.2, Qt 4.6.2 +Config: Using QTest library 4.7.0, Qt 4.7.0 PASS : tst_Cmptest::initTestCase() PASS : tst_Cmptest::compare_boolfuncs() PASS : tst_Cmptest::compare_pointerfuncs() diff --git a/tests/auto/selftests/expected_crashes_3.txt b/tests/auto/selftests/expected_crashes_3.txt index aabe83d..3aced25 100644 --- a/tests/auto/selftests/expected_crashes_3.txt +++ b/tests/auto/selftests/expected_crashes_3.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Crashes ********* -Config: Using QTest library 4.6.2, Qt 4.6.2 +Config: Using QTest library 4.7.0, Qt 4.7.0 PASS : tst_Crashes::initTestCase() QFATAL : tst_Crashes::crash() Received signal 11 FAIL! : tst_Crashes::crash() Received a fatal error. diff --git a/tests/auto/selftests/expected_longstring.txt b/tests/auto/selftests/expected_longstring.txt index 3fe237a..a6ad5d0 100644 --- a/tests/auto/selftests/expected_longstring.txt +++ b/tests/auto/selftests/expected_longstring.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_LongString ********* -Config: Using QTest library 4.6.2, Qt 4.6.2 +Config: Using QTest library 4.7.0, Qt 4.7.0 PASS : tst_LongString::initTestCase() FAIL! : tst_LongString::failWithLongString() Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. diff --git a/tests/auto/selftests/expected_maxwarnings.txt b/tests/auto/selftests/expected_maxwarnings.txt index 8bafeff..908bd5d 100644 --- a/tests/auto/selftests/expected_maxwarnings.txt +++ b/tests/auto/selftests/expected_maxwarnings.txt @@ -1,5 +1,5 @@ ********* Start testing of MaxWarnings ********* -Config: Using QTest library 4.6.2, Qt 4.6.2 +Config: Using QTest library 4.7.0, Qt 4.7.0 PASS : MaxWarnings::initTestCase() QWARN : MaxWarnings::warn() 0 QWARN : MaxWarnings::warn() 1 diff --git a/tests/auto/selftests/expected_skip.txt b/tests/auto/selftests/expected_skip.txt index c4ef92d..4345a6c 100644 --- a/tests/auto/selftests/expected_skip.txt +++ b/tests/auto/selftests/expected_skip.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Skip ********* -Config: Using QTest library 4.6.2, Qt 4.6.2 +Config: Using QTest library 4.7.0, Qt 4.7.0 PASS : tst_Skip::initTestCase() SKIP : tst_Skip::test() skipping all Loc: [/home/rmcgover/depot/qt-git/mainline/tests/auto/selftests/skip/tst_skip.cpp(68)] diff --git a/tests/auto/symbols/tst_symbols.cpp b/tests/auto/symbols/tst_symbols.cpp index e30481a..70abc43 100644 --- a/tests/auto/symbols/tst_symbols.cpp +++ b/tests/auto/symbols/tst_symbols.cpp @@ -100,7 +100,6 @@ void tst_Symbols::globalObjects() #ifndef Q_OS_LINUX QSKIP("Linux-specific test", SkipAll); #endif - QSKIP("Test disabled, we're not fixing these issues in this Qt version", SkipAll); // these are regexps for global objects that are allowed in Qt QStringList whitelist = QStringList() diff --git a/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index faacec4..01285d1 100644 --- a/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/tests/benchmarks/qvector/main.cpp b/tests/benchmarks/qvector/main.cpp new file mode 100644 index 0000000..65e7609 --- /dev/null +++ b/tests/benchmarks/qvector/main.cpp @@ -0,0 +1,426 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QVector> +#include <QDebug> +#include <QtTest> + +#include "qrawvector.h" + +#include <vector> + +/* + +Code generated by g++ 4.3.3. The lines marked with '!' are the ones that get +executed inside the loop. Using the external 's' causes some load making the +loop resembling a 'simple inner loop' in 'real' applications. + + +qvector_mutable_read_access: + +.L166: +! movl -16(%ebp), %edx +! movl (%edx), %eax +! subl $1, %eax +! je .L165 + movl 4(%edx), %eax + movl %eax, 8(%esp) + movl 8(%edx), %eax + movl %esi, (%esp) + movl %eax, 4(%esp) + call _ZN4myns7QVectorIdE7reallocEii +.L165: +! movl -16(%ebp), %eax +! fldl s +! faddl 16(%eax,%ebx,8) +! addl $1, %ebx +! cmpl $10000, %ebx +! fstpl s +! jne .L166 + + +qvector_const_read_access: + + movl -16(%ebp), %edx + xorl %eax, %eax +.L183: +! fldl s +! faddl 16(%edx,%eax,8) +! addl $1, %eax +! cmpl $10000, %eax +! fstpl s +! jne .L183 + + +stdvector_const_read_access and stdvector_mutable_read_access and +qrawvector_const_read_access and qrawvector_mutable_read_access: + + xorl %eax, %eax +.L64: +! fldl s +! faddl (%ebx,%eax,8) +! addl $1, %eax +! cmpl $10000, %eax +! fstpl s +! jne .L64 + + + +Behaviour varies with small modifications, but total is more or +less stable: + +qrawvector_mutable_read_access, using size() instead of N: + +.L145: +! faddl (%edx,%eax,8) +! addl $1, %eax +! cmpl %ecx, %eax +! fstl s +! jne .L145 +! fstp %st(0) + + +qrawvector_mutable_read_access, counting backward: + +.L145: +! faddl (%edx,%eax,8) +! subl $1, %eax +! cmpl $-1, %eax +! fstl s +! jne .L145 + + +qrawvector_mutable_read_access, counting backward, using size(): + +.L146: +! faddl (%edx) +! addl $1, %eax +! subl $8, %edx +! cmpl %ecx, %eax +! fstl s +! jne .L146 + + + +*/ + + +/* + +//////////////////////////////////////////////////////////////////// + +time ./tst_vector qvector_const_read_access +real 0m12.912s +user 0m12.401s +sys 0m0.016s + +time ./tst_vector qvector_mutable_read_access +real 0m38.566s +user 0m36.754s +sys 0m0.008s + + +time ./tst_vector stdvector_mutable_read_access +real 0m12.736s +user 0m12.665s +sys 0m0.004s + + +//////////////////////////////////////////////////////////////////// + +time ./tst_vector qvector_fill_and_return +real 0m28.778s +user 0m28.522s +sys 0m0.012s + +time ./tst_vector stdvector_fill_and_return +real 0m26.675s +user 0m26.558s +sys 0m0.012s + +time ./tst_vector qrawvector_fill_and_return +real 0m23.370s +user 0m23.269s +sys 0m0.008s + + + +*/ + + + +#define TEST_RETURN 1 + +// For some reason, both 'plain' and '-callgrind' create strange results +// (like varying instruction count for the same assembly code) +// So replace it by a plain loop and measure wall clock time. +//#undef QBENCHMARK +//#define QBENCHMARK for (int j = 0; j != 10000; ++j) + +class tst_QVector: public QObject +{ + Q_OBJECT + +private slots: + void calibration(); + + // Pure Qt solution + void qvector_separator() { qWarning() << "QVector results: "; } + void qvector_const_read_access(); + void qvector_mutable_read_access(); + #ifdef TEST_RETURN + void qvector_fill_and_return(); + void qvector_fill_and_return2(); + #endif + + // Purre Standard solution + void stdvector() { qWarning() << "std::vector results: "; } + void stdvector_const_read_access(); + void stdvector_mutable_read_access(); + #ifdef TEST_RETURN + void stdvector_fill_and_return(); + void stdvector_fill_and_return2(); + #endif + + // Build using std, pass as QVector + void mixedvector() { qWarning() << "mixed results: "; } + #ifdef TEST_RETURN + void mixedvector_fill_and_return(); + void mixedvector_fill_and_return2(); + #endif + + // Alternative implementation + void qrawvector_separator() { qWarning() << "QRawVector results: "; } + void qrawvector_const_read_access(); + void qrawvector_mutable_read_access(); + #ifdef TEST_RETURN + void qrawvector_fill_and_return(); + void qrawvector_fill_and_return2(); + #endif +}; + +const int N = 1000000; +extern double s; + +void tst_QVector::calibration() +{ + QVector<double> v(N); + for (int i = 0; i != N; ++i) + v[i] = i; + QBENCHMARK { + for (int i = 0; i != N; ++i) + s += i; + } +} + +///////////////////// QVector ///////////////////// + +void tst_QVector::qvector_const_read_access() +{ + QVector<double> v(N); + for (int i = 0; i != N; ++i) + v[i] = i; + + const QVector<double> &vc = v; + QBENCHMARK { + for (int i = 0; i != N; ++i) + s += vc[i]; + } +} + +void tst_QVector::qvector_mutable_read_access() +{ + QVector<double> v(N); + for (int i = 0; i != N; ++i) + v[i] = i; + + QBENCHMARK { + for (int i = 0; i != N; ++i) + s += v[i]; + } +} + +#ifdef TEST_RETURN +extern QVector<double> qvector_fill_and_return_helper(); +extern QVector<double> qvector_fill_and_return_helper2(); + +void tst_QVector::qvector_fill_and_return() +{ + QBENCHMARK { + QVector<double> v = qvector_fill_and_return_helper(); + s += v[1]; + } +} + +void tst_QVector::qvector_fill_and_return2() +{ + QBENCHMARK { + QVector<double> v = qvector_fill_and_return_helper2(); + s += v[1]; + } +} +#endif + + +///////////////////// QRawVector ///////////////////// + +void tst_QVector::qrawvector_const_read_access() +{ + QRawVector<double> v(N); + for (int i = 0; i != N; ++i) + v[i] = i; + + const QRawVector<double> &vc = v; + QBENCHMARK { + for (int i = vc.size(); --i >= 0;) + s += vc[i]; + } +} + +void tst_QVector::qrawvector_mutable_read_access() +{ + QRawVector<double> v(N); + for (int i = 0; i != N; ++i) + v[i] = i; + + QBENCHMARK { + for (int i = 0; i != N; ++i) + s += v[i]; + } +} + +#ifdef TEST_RETURN +extern QVector<double> qrawvector_fill_and_return_helper(); +extern QVector<double> qrawvector_fill_and_return_helper2(); + +void tst_QVector::qrawvector_fill_and_return() +{ + QBENCHMARK { + QVector<double> v = qrawvector_fill_and_return_helper(); + s += v[1]; + } +} + +void tst_QVector::qrawvector_fill_and_return2() +{ + QBENCHMARK { + QVector<double> v = qrawvector_fill_and_return_helper(); + s += v[1]; + } +} +#endif + + +///////////////////// std::vector ///////////////////// + +void tst_QVector::stdvector_const_read_access() +{ + std::vector<double> v(N); + for (int i = 0; i != N; ++i) + v[i] = i; + + const std::vector<double> &vc = v; + QBENCHMARK { + for (int i = 0; i != N; ++i) + s += vc[i]; + } +} + +void tst_QVector::stdvector_mutable_read_access() +{ + std::vector<double> v(N); + for (int i = 0; i != N; ++i) + v[i] = i; + + QBENCHMARK { + for (int i = 0; i != N; ++i) + s += v[i]; + } +} + +#ifdef TEST_RETURN +extern std::vector<double> stdvector_fill_and_return_helper(); +extern std::vector<double> stdvector_fill_and_return_helper2(); + +void tst_QVector::stdvector_fill_and_return() +{ + QBENCHMARK { + std::vector<double> v = stdvector_fill_and_return_helper(); + s += v[1]; + } +} + +void tst_QVector::stdvector_fill_and_return2() +{ + QBENCHMARK { + std::vector<double> v = stdvector_fill_and_return_helper2(); + s += v[1]; + } +} +#endif + +///////////////////// mixed vector ///////////////////// + + +#ifdef TEST_RETURN +extern QVector<double> mixedvector_fill_and_return_helper(); +extern QVector<double> mixedvector_fill_and_return_helper2(); + +void tst_QVector::mixedvector_fill_and_return() +{ + QBENCHMARK { + std::vector<double> v = stdvector_fill_and_return_helper(); + s += v[1]; + } +} + +void tst_QVector::mixedvector_fill_and_return2() +{ + QBENCHMARK { + std::vector<double> v = stdvector_fill_and_return_helper2(); + s += v[1]; + } +} +#endif + +QTEST_MAIN(tst_QVector) + +#include "main.moc" diff --git a/tests/benchmarks/qvector/outofline.cpp b/tests/benchmarks/qvector/outofline.cpp new file mode 100644 index 0000000..d1d72b0 --- /dev/null +++ b/tests/benchmarks/qvector/outofline.cpp @@ -0,0 +1,41 @@ + +#include <QVector> +#include <vector> +#include "qrawvector.h" + +const int N = 1000000; +double s = 0; + +QVector<double> qvector_fill_and_return_helper() +{ + QVector<double> v(N); + for (int i = 0; i != N; ++i) + v[i] = i; + return v; +} + +QVector<double> qrawvector_fill_and_return_helper() +{ + QRawVector<double> v(N); + for (int i = 0; i != N; ++i) + v[i] = i; + return v.mutateToVector(); +} + +QVector<double> mixedvector_fill_and_return_helper() +{ + std::vector<double> v(N); + for (int i = 0; i != N; ++i) + v[i] = i; + return QVector<double>::fromStdVector(v); +} + + +std::vector<double> stdvector_fill_and_return_helper() +{ + std::vector<double> v(N); + for (int i = 0; i != N; ++i) + v[i] = i; + return v; +} + diff --git a/tests/benchmarks/qvector/qrawvector.h b/tests/benchmarks/qvector/qrawvector.h new file mode 100644 index 0000000..15421eb --- /dev/null +++ b/tests/benchmarks/qvector/qrawvector.h @@ -0,0 +1,742 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QRAWVECTOR_H +#define QRAWVECTOR_H + +#include <QtCore/qiterator.h> +#include <QtCore/qdebug.h> +#include <QtCore/qatomic.h> +#include <QtCore/qalgorithms.h> +#include <QtCore/qlist.h> + +#ifndef QT_NO_STL +#include <iterator> +#include <vector> +#endif +#include <stddef.h> +#include <stdlib.h> +#include <string.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + + + +template <typename T> +class QRawVector +{ + struct Data : QVectorData { T array[1]; }; + + T *m_begin; + int m_size; + int m_alloc; + +public: + //static Data dummy; + //int headerOffset() { return (char*)&dummy.array - (char*)&dummy; } + inline int headerOffset() const { + // gcc complains about: return offsetof(Data, array); and also + // does not like '0' in the expression below. + return (char *)&(((Data *)(1))->array) - (char *)1; + } + inline Data *toBase(T *begin) const + { return (Data*)((char*)begin - headerOffset()); } + inline T *fromBase(void *d) const + { return (T*)((char*)d + headerOffset()); } + inline QRawVector() + { m_begin = fromBase(0); m_alloc = m_size = 0; realloc(m_size, m_alloc, true); } + explicit QRawVector(int size); + QRawVector(int size, const T &t); + inline QRawVector(const QRawVector<T> &v) + { m_begin = v.m_begin; m_alloc = v.m_alloc; m_size = v.m_size; realloc(m_size, m_alloc, true); } + inline ~QRawVector() { free(m_begin, m_size); } + QRawVector<T> &operator=(const QRawVector<T> &v); + bool operator==(const QRawVector<T> &v) const; + inline bool operator!=(const QRawVector<T> &v) const { return !(*this == v); } + + inline int size() const { return m_size; } + + inline bool isEmpty() const { return m_size == 0; } + + void resize(int size); + + inline int capacity() const { return m_alloc; } + void reserve(int size); + inline void squeeze() { realloc(m_size, m_size, false); } + + inline T *data() { return m_begin; } + inline const T *data() const { return m_begin; } + inline const T *constData() const { return m_begin; } + void clear(); + + const T &at(int i) const; + T &operator[](int i); + const T &operator[](int i) const; + void append(const T &t); + void prepend(const T &t); + void insert(int i, const T &t); + void insert(int i, int n, const T &t); + void replace(int i, const T &t); + void remove(int i); + void remove(int i, int n); + + QRawVector<T> &fill(const T &t, int size = -1); + + int indexOf(const T &t, int from = 0) const; + int lastIndexOf(const T &t, int from = -1) const; + bool contains(const T &t) const; + int count(const T &t) const; + +#ifdef QT_STRICT_ITERATORS + class iterator { + public: + T *i; + typedef std::random_access_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef T *pointer; + typedef T &reference; + + inline iterator() : i(0) {} + inline iterator(T *n) : i(n) {} + inline iterator(const iterator &o): i(o.i){} + inline T &operator*() const { return *i; } + inline T *operator->() const { return i; } + inline T &operator[](int j) const { return *(i + j); } + inline bool operator==(const iterator &o) const { return i == o.i; } + inline bool operator!=(const iterator &o) const { return i != o.i; } + inline bool operator<(const iterator& other) const { return i < other.i; } + inline bool operator<=(const iterator& other) const { return i <= other.i; } + inline bool operator>(const iterator& other) const { return i > other.i; } + inline bool operator>=(const iterator& other) const { return i >= other.i; } + inline iterator &operator++() { ++i; return *this; } + inline iterator operator++(int) { T *n = i; ++i; return n; } + inline iterator &operator--() { i--; return *this; } + inline iterator operator--(int) { T *n = i; i--; return n; } + inline iterator &operator+=(int j) { i+=j; return *this; } + inline iterator &operator-=(int j) { i-=j; return *this; } + inline iterator operator+(int j) const { return iterator(i+j); } + inline iterator operator-(int j) const { return iterator(i-j); } + inline int operator-(iterator j) const { return i - j.i; } + }; + friend class iterator; + + class const_iterator { + public: + T *i; + typedef std::random_access_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + + inline const_iterator() : i(0) {} + inline const_iterator(T *n) : i(n) {} + inline const_iterator(const const_iterator &o): i(o.i) {} + inline explicit const_iterator(const iterator &o): i(o.i) {} + inline const T &operator*() const { return *i; } + inline const T *operator->() const { return i; } + inline const T &operator[](int j) const { return *(i + j); } + inline bool operator==(const const_iterator &o) const { return i == o.i; } + inline bool operator!=(const const_iterator &o) const { return i != o.i; } + inline bool operator<(const const_iterator& other) const { return i < other.i; } + inline bool operator<=(const const_iterator& other) const { return i <= other.i; } + inline bool operator>(const const_iterator& other) const { return i > other.i; } + inline bool operator>=(const const_iterator& other) const { return i >= other.i; } + inline const_iterator &operator++() { ++i; return *this; } + inline const_iterator operator++(int) { T *n = i; ++i; return n; } + inline const_iterator &operator--() { i--; return *this; } + inline const_iterator operator--(int) { T *n = i; i--; return n; } + inline const_iterator &operator+=(int j) { i+=j; return *this; } + inline const_iterator &operator-=(int j) { i+=j; return *this; } + inline const_iterator operator+(int j) const { return const_iterator(i+j); } + inline const_iterator operator-(int j) const { return const_iterator(i-j); } + inline int operator-(const_iterator j) const { return i - j.i; } + }; + friend class const_iterator; +#else + // STL-style + typedef T *iterator; + typedef const T *const_iterator; +#endif + inline iterator begin() { return m_begin; } + inline const_iterator begin() const { return m_begin; } + inline const_iterator constBegin() const { return m_begin; } + inline iterator end() { return m_begin + m_size; } + inline const_iterator end() const { return m_begin + m_size; } + inline const_iterator constEnd() const { return m_begin + m_size; } + iterator insert(iterator before, int n, const T &x); + inline iterator insert(iterator before, const T &x) { return insert(before, 1, x); } + iterator erase(iterator begin, iterator end); + inline iterator erase(iterator pos) { return erase(pos, pos+1); } + + // more Qt + inline int count() const { return m_size; } + inline T& first() { Q_ASSERT(!isEmpty()); return *begin(); } + inline const T &first() const { Q_ASSERT(!isEmpty()); return *begin(); } + inline T& last() { Q_ASSERT(!isEmpty()); return *(end()-1); } + inline const T &last() const { Q_ASSERT(!isEmpty()); return *(end()-1); } + inline bool startsWith(const T &t) const { return !isEmpty() && first() == t; } + inline bool endsWith(const T &t) const { return !isEmpty() && last() == t; } + QRawVector<T> mid(int pos, int length = -1) const; + + T value(int i) const; + T value(int i, const T &defaultValue) const; + + // STL compatibility + typedef T value_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; + typedef value_type &reference; + typedef const value_type &const_reference; + typedef ptrdiff_t difference_type; + typedef iterator Iterator; + typedef const_iterator ConstIterator; + typedef int size_type; + inline void push_back(const T &t) { append(t); } + inline void push_front(const T &t) { prepend(t); } + void pop_back() { Q_ASSERT(!isEmpty()); erase(end()-1); } + void pop_front() { Q_ASSERT(!isEmpty()); erase(begin()); } + inline bool empty() const { return m_size == 0; } + inline T &front() { return first(); } + inline const_reference front() const { return first(); } + inline reference back() { return last(); } + inline const_reference back() const { return last(); } + + // comfort + QRawVector<T> &operator+=(const QRawVector<T> &l); + inline QRawVector<T> operator+(const QRawVector<T> &l) const + { QRawVector n = *this; n += l; return n; } + inline QRawVector<T> &operator+=(const T &t) + { append(t); return *this; } + inline QRawVector<T> &operator<< (const T &t) + { append(t); return *this; } + inline QRawVector<T> &operator<<(const QRawVector<T> &l) + { *this += l; return *this; } + + QList<T> toList() const; + + //static QRawVector<T> fromList(const QList<T> &list); + +#ifndef QT_NO_STL + static inline QRawVector<T> fromStdVector(const std::vector<T> &vector) + { QRawVector<T> tmp; qCopy(vector.begin(), vector.end(), std::back_inserter(tmp)); return tmp; } + inline std::vector<T> toStdVector() const + { std::vector<T> tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; } +#endif + +private: + T *allocate(int alloc); + void realloc(int size, int alloc, bool ref); + void free(T *begin, int size); + int sizeOfTypedData() { + // this is more or less the same as sizeof(Data), except that it doesn't + // count the padding at the end + return reinterpret_cast<const char *>(&(reinterpret_cast<const Data *>(this))->array[1]) - reinterpret_cast<const char *>(this); + } + static inline int alignOfTypedData() + { +#ifdef Q_ALIGNOF + return qMax<int>(sizeof(void*), Q_ALIGNOF(Data)); +#else + return 0; +#endif + } + +public: + QVector<T> mutateToVector() + { + Data *d = toBase(m_begin); + d->ref = 1; + d->alloc = m_alloc; + d->size = m_size; + d->sharable = 0; + d->capacity = 0; + + QVector<T> v; + *reinterpret_cast<QVectorData **>(&v) = d; + m_begin = fromBase(0); + m_size = m_alloc = 0; + return v; + } +}; + + +template <typename T> +void QRawVector<T>::reserve(int asize) +{ if (asize > m_alloc) realloc(m_size, asize, false); } +template <typename T> +void QRawVector<T>::resize(int asize) +{ realloc(asize, (asize > m_alloc || (asize < m_size && asize < (m_alloc >> 1))) + ? QVectorData::grow(sizeOfTypedData(), asize, sizeof(T), QTypeInfo<T>::isStatic) + : m_alloc, false); } +template <typename T> +inline void QRawVector<T>::clear() +{ *this = QRawVector<T>(); } +template <typename T> +inline const T &QRawVector<T>::at(int i) const +{ Q_ASSERT_X(i >= 0 && i < m_size, "QRawVector<T>::at", "index out of range"); + return m_begin[i]; } +template <typename T> +inline const T &QRawVector<T>::operator[](int i) const +{ Q_ASSERT_X(i >= 0 && i < m_size, "QRawVector<T>::operator[]", "index out of range"); + return m_begin[i]; } +template <typename T> +inline T &QRawVector<T>::operator[](int i) +{ Q_ASSERT_X(i >= 0 && i < m_size, "QRawVector<T>::operator[]", "index out of range"); + return data()[i]; } +template <typename T> +inline void QRawVector<T>::insert(int i, const T &t) +{ Q_ASSERT_X(i >= 0 && i <= m_size, "QRawVector<T>::insert", "index out of range"); + insert(begin() + i, 1, t); } +template <typename T> +inline void QRawVector<T>::insert(int i, int n, const T &t) +{ Q_ASSERT_X(i >= 0 && i <= m_size, "QRawVector<T>::insert", "index out of range"); + insert(begin() + i, n, t); } +template <typename T> +inline void QRawVector<T>::remove(int i, int n) +{ Q_ASSERT_X(i >= 0 && n >= 0 && i + n <= m_size, "QRawVector<T>::remove", "index out of range"); + erase(begin() + i, begin() + i + n); } +template <typename T> +inline void QRawVector<T>::remove(int i) +{ Q_ASSERT_X(i >= 0 && i < m_size, "QRawVector<T>::remove", "index out of range"); + erase(begin() + i, begin() + i + 1); } +template <typename T> +inline void QRawVector<T>::prepend(const T &t) +{ insert(begin(), 1, t); } + +template <typename T> +inline void QRawVector<T>::replace(int i, const T &t) +{ + Q_ASSERT_X(i >= 0 && i < m_size, "QRawVector<T>::replace", "index out of range"); + const T copy(t); + data()[i] = copy; +} + +template <typename T> +QRawVector<T> &QRawVector<T>::operator=(const QRawVector<T> &v) +{ + if (this != &v) { + free(m_begin, m_size); + m_alloc = v.m_alloc; + m_size = v.m_size; + m_begin = v.m_begin; + realloc(m_size, m_alloc, true); + } + return *this; +} + +template <typename T> +inline T *QRawVector<T>::allocate(int aalloc) +{ + QVectorData *d = QVectorData::allocate(sizeOfTypedData() + (aalloc - 1) * sizeof(T), alignOfTypedData()); + Q_CHECK_PTR(d); + return fromBase(d); +} + +template <typename T> +QRawVector<T>::QRawVector(int asize) +{ + m_size = m_alloc = asize; + m_begin = allocate(asize); + if (QTypeInfo<T>::isComplex) { + T *b = m_begin; + T *i = m_begin + m_size; + while (i != b) + new (--i) T; + } else { + qMemSet(m_begin, 0, asize * sizeof(T)); + } +} + +template <typename T> +QRawVector<T>::QRawVector(int asize, const T &t) +{ + m_size = m_alloc = asize; + m_begin = allocate(asize); + T *i = m_begin + m_size; + while (i != m_begin) + new (--i) T(t); +} + +template <typename T> +void QRawVector<T>::free(T *begin, int size) +{ + if (QTypeInfo<T>::isComplex) { + T *i = begin + size; + while (i-- != begin) + i->~T(); + } + Data *x = toBase(begin); + x->free(x, alignOfTypedData()); +} + +template <typename T> +void QRawVector<T>::realloc(int asize, int aalloc, bool ref) +{ + if (QTypeInfo<T>::isComplex && asize < m_size && !ref) { + // call the destructor on all objects that need to be + // destroyed when shrinking + T *pOld = m_begin + m_size; + while (asize < m_size) { + (--pOld)->~T(); + --m_size; + } + } + + int xalloc = m_alloc; + int xsize = m_size; + bool changed = false; + T *xbegin = m_begin; + if (aalloc != xalloc || ref) { + // (re)allocate memory + if (QTypeInfo<T>::isStatic) { + xbegin = allocate(aalloc); + xsize = 0; + changed = true; + } else if (ref) { + xbegin = allocate(aalloc); + if (QTypeInfo<T>::isComplex) { + xsize = 0; + } else { + ::memcpy(xbegin, m_begin, qMin(aalloc, xalloc) * sizeof(T)); + xsize = m_size; + } + changed = true; + } else { + QT_TRY { + QVectorData *mem = QVectorData::reallocate( + toBase(m_begin), sizeOfTypedData() + (aalloc - 1) * sizeof(T), + sizeOfTypedData() ++ (xalloc - 1) * sizeof(T), alignOfTypedData()); + Q_CHECK_PTR(mem); + xbegin = fromBase(mem); + xsize = m_size; + } QT_CATCH (const std::bad_alloc &) { + if (aalloc > xalloc) // ignore the error in case we are just shrinking. + QT_RETHROW; + } + } + xalloc = aalloc; + } + + if (QTypeInfo<T>::isComplex) { + QT_TRY { + T *pOld = m_begin + xsize; + T *pNew = xbegin + xsize; + // copy objects from the old array into the new array + while (xsize < qMin(asize, m_size)) { + new (pNew++) T(*pOld++); + ++xsize; + } + // construct all new objects when growing + while (xsize < asize) { + new (pNew++) T; + ++xsize; + } + } QT_CATCH (...) { + free(xbegin, xsize); + QT_RETHROW; + } + + } else if (asize > xsize) { + // initialize newly allocated memory to 0 + qMemSet(xbegin + xsize, 0, (asize - xsize) * sizeof(T)); + } + xsize = asize; + + if (changed) { + if (!ref) + free(m_begin, m_size); + } + m_alloc = xalloc; + m_size = xsize; + m_begin = xbegin; +} + +template<typename T> +Q_OUTOFLINE_TEMPLATE T QRawVector<T>::value(int i) const +{ + return (i < 0 || i >= m_size) ? T() : m_begin[i]; +} +template<typename T> +Q_OUTOFLINE_TEMPLATE T QRawVector<T>::value(int i, const T &defaultValue) const +{ + return (i < 0 || i >= m_size) ? defaultValue : m_begin[i]; +} + +template <typename T> +void QRawVector<T>::append(const T &t) +{ + if (m_size + 1 > m_alloc) { + const T copy(t); + realloc(m_size, QVectorData::grow(sizeOfTypedData(), m_size + 1, sizeof(T), + QTypeInfo<T>::isStatic), false); + if (QTypeInfo<T>::isComplex) + new (m_begin + m_size) T(copy); + else + m_begin[m_size] = copy; + } else { + if (QTypeInfo<T>::isComplex) + new (m_begin + m_size) T(t); + else + m_begin[m_size] = t; + } + ++m_size; +} + +template <typename T> +Q_TYPENAME QRawVector<T>::iterator QRawVector<T>::insert(iterator before, size_type n, const T &t) +{ + int offset = int(before - m_begin); + if (n != 0) { + const T copy(t); + if (m_size + n > m_alloc) + realloc(m_size, QVectorData::grow(sizeOfTypedData(), m_size + n, sizeof(T), + QTypeInfo<T>::isStatic), false); + if (QTypeInfo<T>::isStatic) { + T *b = m_begin + m_size; + T *i = m_begin + m_size + n; + while (i != b) + new (--i) T; + i = m_begin + m_size; + T *j = i + n; + b = m_begin + offset; + while (i != b) + *--j = *--i; + i = b+n; + while (i != b) + *--i = copy; + } else { + T *b = m_begin + offset; + T *i = b + n; + memmove(i, b, (m_size - offset) * sizeof(T)); + while (i != b) + new (--i) T(copy); + } + m_size += n; + } + return m_begin + offset; +} + +template <typename T> +Q_TYPENAME QRawVector<T>::iterator QRawVector<T>::erase(iterator abegin, iterator aend) +{ + int f = int(abegin - m_begin); + int l = int(aend - m_begin); + int n = l - f; + if (QTypeInfo<T>::isComplex) { + qCopy(m_begin + l, m_begin + m_size, m_begin + f); + T *i = m_begin + m_size; + T *b = m_begin + m_size - n; + while (i != b) { + --i; + i->~T(); + } + } else { + memmove(m_begin + f, m_begin + l, (m_size - l) * sizeof(T)); + } + m_size -= n; + return m_begin + f; +} + +template <typename T> +bool QRawVector<T>::operator==(const QRawVector<T> &v) const +{ + if (m_size != v.m_size) + return false; + T* b = m_begin; + T* i = b + m_size; + T* j = v.m_begin + m_size; + while (i != b) + if (!(*--i == *--j)) + return false; + return true; +} + +template <typename T> +QRawVector<T> &QRawVector<T>::fill(const T &from, int asize) +{ + const T copy(from); + resize(asize < 0 ? m_size : asize); + if (m_size) { + T *i = m_begin + m_size; + T *b = m_begin; + while (i != b) + *--i = copy; + } + return *this; +} + +template <typename T> +QRawVector<T> &QRawVector<T>::operator+=(const QRawVector &l) +{ + int newSize = m_size + l.m_size; + realloc(m_size, newSize, false); + + T *w = m_begin + newSize; + T *i = l.m_begin + l.m_size; + T *b = l.m_begin; + while (i != b) { + if (QTypeInfo<T>::isComplex) + new (--w) T(*--i); + else + *--w = *--i; + } + m_size = newSize; + return *this; +} + +template <typename T> +int QRawVector<T>::indexOf(const T &t, int from) const +{ + if (from < 0) + from = qMax(from + m_size, 0); + if (from < m_size) { + T* n = m_begin + from - 1; + T* e = m_begin + m_size; + while (++n != e) + if (*n == t) + return n - m_begin; + } + return -1; +} + +template <typename T> +int QRawVector<T>::lastIndexOf(const T &t, int from) const +{ + if (from < 0) + from += m_size; + else if (from >= m_size) + from = m_size-1; + if (from >= 0) { + T* b = m_begin; + T* n = m_begin + from + 1; + while (n != b) { + if (*--n == t) + return n - b; + } + } + return -1; +} + +template <typename T> +bool QRawVector<T>::contains(const T &t) const +{ + T* b = m_begin; + T* i = m_begin + m_size; + while (i != b) + if (*--i == t) + return true; + return false; +} + +template <typename T> +int QRawVector<T>::count(const T &t) const +{ + int c = 0; + T* b = m_begin; + T* i = m_begin + m_size; + while (i != b) + if (*--i == t) + ++c; + return c; +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE QRawVector<T> QRawVector<T>::mid(int pos, int length) const +{ + if (length < 0) + length = size() - pos; + if (pos == 0 && length == size()) + return *this; + QRawVector<T> copy; + if (pos + length > size()) + length = size() - pos; + for (int i = pos; i < pos + length; ++i) + copy += at(i); + return copy; +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE QList<T> QRawVector<T>::toList() const +{ + QList<T> result; + for (int i = 0; i < size(); ++i) + result.append(at(i)); + return result; +} + + +/*template <typename T> +Q_OUTOFLINE_TEMPLATE QRawVector<T> QList<T>::toVector() const +{ + QRawVector<T> result(size()); + for (int i = 0; i < size(); ++i) + result[i] = at(i); + return result; +} + +template <typename T> +QRawVector<T> QRawVector<T>::fromList(const QList<T> &list) +{ + return list.toVector(); +} + +template <typename T> +QList<T> QList<T>::fromVector(const QRawVector<T> &vector) +{ + return vector.toList(); +} +*/ + +Q_DECLARE_SEQUENTIAL_ITERATOR(RawVector) +Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(RawVector) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QRAWVECTOR_H diff --git a/tests/benchmarks/qvector/qvector.pro b/tests/benchmarks/qvector/qvector.pro new file mode 100644 index 0000000..adb30c9 --- /dev/null +++ b/tests/benchmarks/qvector/qvector.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TARGET = tst_vector +QT = core +INCLUDEPATH += . +SOURCES += main.cpp outofline.cpp outofline2.cpp +CONFIG += release diff --git a/tools/assistant/assistant.pro b/tools/assistant/assistant.pro index 08d0d4b..97196b2 100644 --- a/tools/assistant/assistant.pro +++ b/tools/assistant/assistant.pro @@ -3,6 +3,4 @@ CONFIG += ordered SUBDIRS += lib/fulltextsearch \ lib \ - tools \ - compat \ - compat/lib \
\ No newline at end of file + tools diff --git a/tools/assistant/compat/Info_mac.plist b/tools/assistant/compat/Info_mac.plist deleted file mode 100644 index b1e6336..0000000 --- a/tools/assistant/compat/Info_mac.plist +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> -<plist version="0.9"> -<dict> - <key>CFBundleIconFile</key> - <string>@ICON@</string> - <key>CFBundlePackageType</key> - <string>APPL</string> - <key>CFBundleGetInfoString</key> - <string>Created by Qt/QMake</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleIdentifier</key> - <string>com.trolltech.assistant-compat</string> - <key>CFBundleExecutable</key> - <string>@EXECUTABLE@</string> -</dict> -</plist> diff --git a/tools/assistant/compat/assistant.icns b/tools/assistant/compat/assistant.icns Binary files differdeleted file mode 100644 index 6291dd3..0000000 --- a/tools/assistant/compat/assistant.icns +++ /dev/null diff --git a/tools/assistant/compat/assistant.ico b/tools/assistant/compat/assistant.ico Binary files differdeleted file mode 100644 index 9e1b83f..0000000 --- a/tools/assistant/compat/assistant.ico +++ /dev/null diff --git a/tools/assistant/compat/assistant.pro b/tools/assistant/compat/assistant.pro deleted file mode 100644 index e865d6b..0000000 --- a/tools/assistant/compat/assistant.pro +++ /dev/null @@ -1,84 +0,0 @@ -include($$QT_SOURCE_TREE/tools/shared/fontpanel/fontpanel.pri) - -TEMPLATE = app -LANGUAGE = C++ -TARGET = assistant_adp - -CONFIG += qt warn_on - -unix:contains(QT_CONFIG, dbus):QT += dbus - -build_all:!build_pass { - CONFIG -= build_all - CONFIG += release -} -QT += xml network - -PROJECTNAME = Assistant -DESTDIR = ../../../bin - -FORMS += helpdialog.ui \ - mainwindow.ui \ - tabbedbrowser.ui \ - topicchooser.ui - -SOURCES += main.cpp \ - helpwindow.cpp \ - topicchooser.cpp \ - docuparser.cpp \ - index.cpp \ - profile.cpp \ - config.cpp \ - helpdialog.cpp \ - mainwindow.cpp \ - tabbedbrowser.cpp \ - fontsettingsdialog.cpp - -HEADERS += helpwindow.h \ - topicchooser.h \ - docuparser.h \ - index.h \ - profile.h \ - helpdialog.h \ - mainwindow.h \ - tabbedbrowser.h \ - config.h \ - fontsettingsdialog.h - -RESOURCES += assistant.qrc - -contains(QT_PRODUCT, OpenSource.*):DEFINES *= QT_OPENSOURCE -DEFINES += QT_KEYWORDS -#DEFINES += QT_PALMTOPCENTER_DOCS - -win32 { - !wince*:LIBS += -lshell32 - RC_FILE = assistant.rc -} - -mac { - ICON = assistant.icns - TARGET = Assistant_adp - QMAKE_INFO_PLIST = Info_mac.plist -} - -target.path=$$[QT_INSTALL_BINS] -INSTALLS += target - -TRANSLATIONS = assistant_de.ts - -unix:!contains(QT_CONFIG, zlib):LIBS += -lz - -contains(CONFIG, static): { - win32 { - exists($$[QT_INSTALL_PLUGINS]/imageformats/qjpeg.lib) { - QTPLUGIN += qjpeg - DEFINES += USE_STATIC_JPEG_PLUGIN - } - } else { - exists($$[QT_INSTALL_PLUGINS]/imageformats/qjpeg.a) { - QTPLUGIN += qjpeg - DEFINES += USE_STATIC_JPEG_PLUGIN - } - } -} diff --git a/tools/assistant/compat/assistant.qrc b/tools/assistant/compat/assistant.qrc deleted file mode 100644 index dae1f48..0000000 --- a/tools/assistant/compat/assistant.qrc +++ /dev/null @@ -1,37 +0,0 @@ -<RCC> - <qresource prefix="/trolltech/assistant" > - <file>images/assistant-128.png</file> - <file>images/assistant.png</file> - <file>images/close.png</file> - <file>images/designer.png</file> - <file>images/linguist.png</file> - <file>images/mac/addtab.png</file> - <file>images/mac/book.png</file> - <file>images/mac/closetab.png</file> - <file>images/mac/editcopy.png</file> - <file>images/mac/find.png</file> - <file>images/mac/home.png</file> - <file>images/mac/next.png</file> - <file>images/mac/prev.png</file> - <file>images/mac/print.png</file> - <file>images/mac/synctoc.png</file> - <file>images/mac/whatsthis.png</file> - <file>images/mac/zoomin.png</file> - <file>images/mac/zoomout.png</file> - <file>images/qt.png</file> - <file>images/win/addtab.png</file> - <file>images/win/book.png</file> - <file>images/win/closetab.png</file> - <file>images/win/editcopy.png</file> - <file>images/win/find.png</file> - <file>images/win/home.png</file> - <file>images/win/next.png</file> - <file>images/win/previous.png</file> - <file>images/win/print.png</file> - <file>images/win/synctoc.png</file> - <file>images/win/whatsthis.png</file> - <file>images/win/zoomin.png</file> - <file>images/win/zoomout.png</file> - <file>images/wrap.png</file> - </qresource> -</RCC> diff --git a/tools/assistant/compat/assistant.rc b/tools/assistant/compat/assistant.rc deleted file mode 100644 index b4786ce..0000000 --- a/tools/assistant/compat/assistant.rc +++ /dev/null @@ -1 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "assistant.ico" diff --git a/tools/assistant/compat/compat.pro b/tools/assistant/compat/compat.pro deleted file mode 100644 index 1086f4c..0000000 --- a/tools/assistant/compat/compat.pro +++ /dev/null @@ -1,84 +0,0 @@ -include($$QT_SOURCE_TREE/tools/shared/fontpanel/fontpanel.pri) - -TEMPLATE = app -LANGUAGE = C++ -TARGET = assistant_adp - -CONFIG += qt warn_on - -unix:contains(QT_CONFIG, dbus):QT += dbus - -build_all:!build_pass { - CONFIG -= build_all - CONFIG += release -} -QT += xml network - -PROJECTNAME = Assistant -DESTDIR = ../../../bin - -FORMS += helpdialog.ui \ - mainwindow.ui \ - tabbedbrowser.ui \ - topicchooser.ui - -SOURCES += main.cpp \ - helpwindow.cpp \ - topicchooser.cpp \ - docuparser.cpp \ - index.cpp \ - profile.cpp \ - config.cpp \ - helpdialog.cpp \ - mainwindow.cpp \ - tabbedbrowser.cpp \ - fontsettingsdialog.cpp - -HEADERS += helpwindow.h \ - topicchooser.h \ - docuparser.h \ - index.h \ - profile.h \ - helpdialog.h \ - mainwindow.h \ - tabbedbrowser.h \ - config.h \ - fontsettingsdialog.h - -RESOURCES += assistant.qrc - -contains(QT_PRODUCT, OpenSource.*):DEFINES *= QT_OPENSOURCE -DEFINES += QT_KEYWORDS -#DEFINES += QT_PALMTOPCENTER_DOCS - -win32 { - LIBS += -lshell32 - RC_FILE = assistant.rc -} - -mac { - ICON = assistant.icns - TARGET = Assistant_adp -# QMAKE_INFO_PLIST = Info_mac.plist -} - -target.path=$$[QT_INSTALL_BINS] -INSTALLS += target - -TRANSLATIONS = assistant_de.ts - -unix:!contains(QT_CONFIG, zlib):LIBS += -lz - -contains(CONFIG, static): { - win32 { - exists($$[QT_INSTALL_PLUGINS]/imageformats/qjpeg.lib) { - QTPLUGIN += qjpeg - DEFINES += USE_STATIC_JPEG_PLUGIN - } - } else { - exists($$[QT_INSTALL_PLUGINS]/imageformats/qjpeg.a) { - QTPLUGIN += qjpeg - DEFINES += USE_STATIC_JPEG_PLUGIN - } - } -} diff --git a/tools/assistant/compat/config.cpp b/tools/assistant/compat/config.cpp deleted file mode 100644 index 1faef42..0000000 --- a/tools/assistant/compat/config.cpp +++ /dev/null @@ -1,438 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "config.h" -#include "profile.h" -#include "docuparser.h" - -#include <QApplication> -#include <QDesktopWidget> -#include <QLibraryInfo> -#include <QFont> -#include <QFontInfo> -#include <QDir> -#include <QFile> -#include <QFileInfo> -#include <QSettings> -#include <QList> - -QT_BEGIN_NAMESPACE - -static Config *static_configuration = 0; - -inline QString getVersionString() -{ - return QString::number( (QT_VERSION >> 16) & 0xff ) - + QLatin1String(".") + QString::number( (QT_VERSION >> 8) & 0xff ); -} - -Config::Config() - : profil( 0 ), hideSidebar( false ), rebuildDocs(true) -{ - if( !static_configuration ) { - static_configuration = this; - } else { - qWarning( "Multiple configurations not allowed!" ); - } -} - -Config *Config::loadConfig(const QString &profileFileName) -{ - Config *config = new Config(); - - if (profileFileName.isEmpty()) { // no profile - if (!config->defaultProfileExists()) { - config->profil = Profile::createDefaultProfile(); - config->saveProfile(config->profil); - } else { - config->profil = new Profile(); - } - config->loadDefaultProfile(); - config->load(); - return config; - } - - QFile file(profileFileName); - if (!file.exists()) { - qWarning( "File does not exist: %s", qPrintable(profileFileName) ); - return 0; - } - DocuParser *parser = DocuParser::createParser( profileFileName ); - if (!parser) { - qWarning( "Failed to create parser for file: %s", qPrintable(profileFileName) ); - return 0; - } - if (parser->parserVersion() < DocuParser::Qt320) { - qWarning( "File does not contain profile information" ); - return 0; - } - DocuParser320 *profileParser = static_cast<DocuParser320*>(parser); - parser->parse(&file); - config->profil = profileParser->profile(); - if (!config->profil) { - qWarning( "Config::loadConfig(), no profile in: %s", qPrintable(profileFileName) ); - return 0; - } - config->profil->setProfileType(Profile::UserProfile); - config->profil->setDocuParser(profileParser); - config->load(); - return config; -} - -Config *Config::configuration() -{ - Q_ASSERT( static_configuration ); - return static_configuration; -} - -void Config::load() -{ - const QString key = getVersionString() + QLatin1String("/"); - - bool isDefaultProfile = profil->props[QLatin1String("name")] == QLatin1String("default"); - const QString pKey = isDefaultProfile ? QString::fromLatin1(QT_VERSION_STR) - : getVersionString(); - - const QString profkey = pKey + QLatin1String("/Profile/") + profil->props[QLatin1String("name")] + QLatin1String("/"); - - QSettings settings; - - home = profil->props[QLatin1String("startpage")];; - if (home.isEmpty() && isDefaultProfile) - home = QLibraryInfo::location(QLibraryInfo::DocumentationPath) + QLatin1String("/html/index.html"); - src = settings.value( profkey + QLatin1String("Source") ).toStringList(); - sideBar = settings.value( key + QLatin1String("SideBarPage") ).toInt(); - if (qApp->type() != QApplication::Tty) - winGeometry = settings.value(key + QLatin1String("windowGeometry")).toByteArray(); - - mainWinState = settings.value(key + QLatin1String("MainWindowState")).toByteArray(); - pointFntSize = settings.value(key + QLatin1String("FontSize"), qApp->font().pointSizeF()).toDouble(); - rebuildDocs = settings.value( key + QLatin1String("RebuildDocDB"), true ).toBool(); - - profileNames = settings.value( key + QLatin1String("Profile") ).toStringList(); - - m_fontSettings.windowFont = qVariantValue<QFont>(settings.value(key + QLatin1String("windowfont"), qApp->font())); - m_fontSettings.browserFont = qVariantValue<QFont>(settings.value(key + QLatin1String("browserfont"), qApp->font())); - m_fontSettings.useWindowFont = settings.value(key + QLatin1String("usewindowfont"), false).toBool(); - m_fontSettings.useBrowserFont = settings.value(key + QLatin1String("usebrowserfont"), false).toBool(); - m_fontSettings.windowWritingSystem = static_cast<QFontDatabase::WritingSystem>( - settings.value(key + QLatin1String("windowwritingsystem"), QFontDatabase::Latin).toInt()); - m_fontSettings.browserWritingSystem = static_cast<QFontDatabase::WritingSystem>( - settings.value(key + QLatin1String("browserwritingsystem"), QFontDatabase::Latin).toInt()); - - m_fontSettings.browserFont.setPointSizeF(pointFntSize); -} - -void Config::save() -{ - saveSettings(); - saveProfile( profil ); -} - -void Config::saveSettings() -{ - const QString key = getVersionString() + QLatin1String("/"); - - const QString pKey = (profil->props[QLatin1String("name")] == QLatin1String("default")) - ? QString::fromLatin1(QT_VERSION_STR) - : getVersionString(); - - const QString profkey = pKey + QLatin1String("/Profile/") + profil->props[QLatin1String("name")] + QLatin1String("/"); - - QSettings settings; - - settings.setValue( profkey + QLatin1String("Source"), src ); - settings.setValue( key + QLatin1String("SideBarPage"), sideBarPage() ); - if (qApp->type() != QApplication::Tty) - settings.setValue(key + QLatin1String("windowGeometry"), winGeometry); - - settings.setValue( key + QLatin1String("MainWindowState"), mainWinState ); - settings.setValue( key + QLatin1String("FontSize"), pointFntSize); - settings.setValue( key + QLatin1String("RebuildDocDB"), rebuildDocs ); - - settings.setValue(key + QLatin1String("windowfont"), m_fontSettings.windowFont); - settings.setValue(key + QLatin1String("browserfont"), m_fontSettings.browserFont); - settings.setValue(key + QLatin1String("usewindowfont"), m_fontSettings.useWindowFont); - settings.setValue(key + QLatin1String("usebrowserfont"), m_fontSettings.useBrowserFont); - settings.setValue(key + QLatin1String("windowwritingsystem"), m_fontSettings.windowWritingSystem); - settings.setValue(key + QLatin1String("browserwritingsystem"), m_fontSettings.browserWritingSystem); -} - -#ifdef ASSISTANT_DEBUG -static void dumpmap( const QMap<QString,QString> &m, const QString &header ) -{ - qDebug( header ); - QMap<QString,QString>::ConstIterator it = m.begin(); - while (it != m.end()) { - qDebug( " " + it.key() + ":\t\t" + *it ); - ++it; - } -} -#endif - -bool Config::defaultProfileExists() -{ - QSettings settings; - const QString profKey = QLatin1String(QT_VERSION_STR) + QLatin1String("/Profile/default/"); - - if (settings.contains(profKey + QLatin1String("DocFiles")) - && settings.contains(profKey + QLatin1String("Titles")) - && settings.contains(profKey + QLatin1String("ImageDirs"))) { - QStringList dcfs = settings.value(profKey + QLatin1String("DocFiles") ).toStringList(); - foreach (QString file, dcfs) { - if (file == Profile::storableFilePath(file)) - return true; - } - } - return false; -} - -void Config::loadDefaultProfile() -{ - QSettings settings; - const QString profKey = QLatin1String(QT_VERSION_STR) + QLatin1String("/Profile/default/"); - - if (!defaultProfileExists()) - return; - - // Override the defaults with settings in registry. - profil->icons.clear(); - profil->indexPages.clear(); - profil->imageDirs.clear(); - profil->docs.clear(); - profil->dcfTitles.clear(); - - QStringList titles = settings.value( profKey + QLatin1String("Titles") ).toStringList(); - QStringList iconLst = settings.value( profKey + QLatin1String("DocIcons") ).toStringList(); - QStringList indexLst = settings.value( profKey + QLatin1String("IndexPages") ).toStringList(); - QStringList imgDirLst = settings.value( profKey + QLatin1String("ImageDirs") ).toStringList(); - QStringList dcfs = settings.value( profKey + QLatin1String("DocFiles") ).toStringList(); - profil->props[QLatin1String("name")] = QLatin1String("default"); - - QString filePath; - QStringList::ConstIterator it = titles.constBegin(); - QStringList::ConstIterator iconIt = iconLst.constBegin(); - QStringList::ConstIterator indexIt = indexLst.constBegin(); - QStringList::ConstIterator imageIt = imgDirLst.constBegin(); - QStringList::ConstIterator dcfIt = dcfs.constBegin(); - while((it != titles.constEnd()) - && (iconIt != iconLst.constEnd()) - && (indexIt != indexLst.constEnd()) - && (imageIt != imgDirLst.constEnd()) - && (dcfIt != dcfs.constEnd())) { - profil->addDCFIcon( *it, *iconIt ); - profil->addDCFIndexPage(*it, Profile::loadableFilePath(*indexIt)); - profil->addDCFImageDir( *it, *imageIt ); - profil->addDCFTitle(Profile::loadableFilePath(*dcfIt), *it); - ++it, ++iconIt, ++indexIt, ++imageIt, ++dcfIt; - } -#if ASSISTANT_DEBUG - dumpmap( profil->icons, QLatin1String("Icons") ); - dumpmap( profil->indexPages, QLatin1String("IndexPages") ); - dumpmap( profil->imageDirs, QLatin1String("ImageDirs") ); - dumpmap( profil->dcfTitles, QLatin1String("dcfTitles") ); - qDebug( "Docfiles: \n " + profil->docs.join( "\n " ) ); -#endif -} - -void Config::saveProfile( Profile *profile ) -{ - if (profil->profileType() == Profile::UserProfile) - return; - - const QString key = (profile->props[QLatin1String("name")] == QLatin1String("default")) - ? QString::fromLatin1(QT_VERSION_STR) - : getVersionString(); - - const QString profKey = key + QLatin1String("/Profile/") + profile->props[QLatin1String("name")] + QLatin1String("/"); - - QString path = QLibraryInfo::location(QLibraryInfo::DocumentationPath).replace(QLatin1String("\\"), QLatin1String("/")); - QStringList indexes, icons, imgDirs, dcfs; - QStringList titles = profile->dcfTitles.keys(); - QStringList::ConstIterator it = titles.constBegin(); - QString filePath; - for ( ; it != titles.constEnd(); ++it ) { - - indexes << Profile::storableFilePath(profile->indexPages[*it]); - icons << profile->icons[*it]; - imgDirs << profile->imageDirs[*it]; - dcfs << Profile::storableFilePath(profile->dcfTitles[*it]); - } - - QSettings settings; - settings.setValue( profKey + QLatin1String("Titles"), titles ); - settings.setValue( profKey + QLatin1String("DocFiles"), dcfs ); - settings.setValue( profKey + QLatin1String("IndexPages"), indexes ); - settings.setValue( profKey + QLatin1String("DocIcons"), icons ); - settings.setValue( profKey + QLatin1String("ImageDirs"), imgDirs ); - -#if ASSISTANT_DEBUG - qDebug() << "Titles:\n - " << ((QStringList*)&titles)->join("\n - "); - qDebug() << "Docfiles:\n - " << dcfs.join("\n - " ); - qDebug() << "IndexPages:\n - " << indexes.join("\n - "); - qDebug() << "DocIcons:\n - " << icons.join("\n - " ); - qDebug() << "ImageDirs:\n - " << imgDirs.join("\n - " ); -#endif -} - -QStringList Config::mimePaths() -{ - static QStringList lst; - - if( lst.count() > 0 ) - return lst; - - for (QMap<QString,QString>::ConstIterator it = profil->dcfTitles.constBegin(); - it != profil->dcfTitles.constEnd(); ++it ) { - - // Mime source for .dcf file path - QFileInfo info( *it ); - QString dcfPath = info.absolutePath(); - if (!lst.contains(dcfPath)) - lst << dcfPath; - - // Image dir for .dcf - QString imgDir = QDir::toNativeSeparators( dcfPath + QDir::separator() - + profil->imageDirs[it.key()] ); - if (!lst.contains(imgDir)) - lst << imgDir; - } - return lst; -} - -QStringList Config::profiles() const -{ - return profileNames; -} - -QString Config::title() const -{ - QString s = profil->props[QLatin1String("title")]; - if (s.isEmpty()) - s = QObject::tr("Qt Assistant by Nokia"); - return s; -} - -QString Config::aboutApplicationMenuText() const -{ - return profil->props[QLatin1String("aboutmenutext")]; -} - -QString Config::aboutURL() const -{ - return profil->props[QLatin1String("abouturl")]; -} - -QString Config::homePage() const -{ - return home.isEmpty() ? profil->props[QLatin1String("startpage")] : home; -} - -QStringList Config::source() const -{ - return src.size() == 0 ? QStringList(profil->props[QLatin1String("startpage")]) : src; -} - -QStringList Config::docFiles() const -{ - return profil->docs; -} - -QPixmap Config::docIcon( const QString &title ) const -{ - // ### To allow qdoc generated dcf files to reference the doc icons from qmake_image_col - QString name = profil->icons[title]; - QString resName = QLatin1String(":/trolltech/assistant/images/") + name; - - if (QFile::exists(resName)) - return QPixmap(resName); - - if (name.startsWith(QLatin1String("file:"))) - name = name.mid(5); - return QPixmap(name); -} - -QPixmap Config::applicationIcon() const -{ - QString name = profil->props[QLatin1String("applicationicon")]; - QString resName = QLatin1String(":/trolltech/assistant/images/") + name; - - if (QFile::exists(resName)) - return QPixmap(resName); - - if (name.startsWith(QLatin1String("file:"))) - name = name.mid(5); - return QPixmap(name); -} - -QStringList Config::docTitles() const -{ - return QStringList(profil->indexPages.keys()); -} - -QString Config::docImageDir( const QString &docfile ) const -{ - return profil->imageDirs[docfile]; -} - -QString Config::indexPage( const QString &title ) const -{ - return profil->indexPages[title]; -} - -void Config::hideSideBar( bool b ) -{ - hideSidebar = b; -} - -bool Config::sideBarHidden() const -{ - return hideSidebar; -} - -QString Config::assistantDocPath() const -{ - return profil->props[QLatin1String("assistantdocs")].isEmpty() - ? QLibraryInfo::location(QLibraryInfo::DocumentationPath) + QLatin1String("/html") - : profil->props[QLatin1String("assistantdocs")]; -} - -QT_END_NAMESPACE diff --git a/tools/assistant/compat/config.h b/tools/assistant/compat/config.h deleted file mode 100644 index 498e6bb..0000000 --- a/tools/assistant/compat/config.h +++ /dev/null @@ -1,165 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CONFIG_H -#define CONFIG_H - -#include "profile.h" - -#include <QString> -#include <QStringList> -#include <QPixmap> -#include <QMap> - -#include <QtGui/QFont> -#include <QtGui/QFontDatabase> - -QT_BEGIN_NAMESPACE - -class Profile; - -struct FontSettings -{ - FontSettings() : useWindowFont(false), useBrowserFont(false), - windowWritingSystem(QFontDatabase::Latin), browserWritingSystem(QFontDatabase::Latin) - { } - - QFont windowFont; - QFont browserFont; - - bool useWindowFont; - bool useBrowserFont; - - QFontDatabase::WritingSystem windowWritingSystem; - QFontDatabase::WritingSystem browserWritingSystem; -}; - -class Config -{ -public: - - Config(); - - void load(); - void save(); - Profile *profile() const { return profil; } - QString profileName() const { return profil->props[QLatin1String("name")]; } - bool validProfileName() const; - void hideSideBar( bool b ); - bool sideBarHidden() const; - QStringList mimePaths(); - - // From profile, read only - QStringList docFiles() const; - QStringList docTitles() const; - QString indexPage( const QString &title ) const; - QString docImageDir( const QString &title ) const; - QPixmap docIcon( const QString &title ) const; - - QStringList profiles() const; - QString title() const; - QString aboutApplicationMenuText() const; - QString aboutURL() const; - QPixmap applicationIcon() const; - - // From QSettings, read / write - QString homePage() const; - void setHomePage( const QString &hom ) { home = hom; } - - QStringList source() const; - void setSource( const QStringList &s ) { src = s; } - - int sideBarPage() const { return sideBar; } - void setSideBarPage( int sbp ) { sideBar = sbp; } - - QByteArray windowGeometry() const { return winGeometry; } - void setWindowGeometry( const QByteArray &geometry ) { winGeometry = geometry; } - - QByteArray mainWindowState() const { return mainWinState; } - void setMainWindowState( const QByteArray &state ) { mainWinState = state; } - - qreal fontPointSize() const { return pointFntSize; } - void setFontPointSize(qreal size) - { - pointFntSize = size; - m_fontSettings.useBrowserFont = true; - m_fontSettings.browserFont.setPointSizeF(size); - } - - FontSettings fontSettings() { return m_fontSettings; } - void setFontSettings(const FontSettings &settings) { m_fontSettings = settings; } - - QString assistantDocPath() const; - - bool docRebuild() const { return rebuildDocs; } - void setDocRebuild( bool rb ) { rebuildDocs = rb; } - - void saveProfile( Profile *profile ); - void loadDefaultProfile(); - bool defaultProfileExists(); - - static Config *configuration(); - static Config *loadConfig(const QString &profileFileName); - -private: - Config( const Config &c ); - Config& operator=( const Config &c ); - - void saveSettings(); - -private: - Profile *profil; - - QStringList profileNames; - QString home; - QStringList src; - QByteArray mainWinState; - QByteArray winGeometry; - qreal pointFntSize; - int sideBar; - bool hideSidebar; - bool rebuildDocs; - FontSettings m_fontSettings; -}; - -QT_END_NAMESPACE - -#endif // CONFIG_H diff --git a/tools/assistant/compat/docuparser.cpp b/tools/assistant/compat/docuparser.cpp deleted file mode 100644 index db2f824..0000000 --- a/tools/assistant/compat/docuparser.cpp +++ /dev/null @@ -1,433 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "docuparser.h" -#include "profile.h" - -#include <QDir> -#include <QFile> -#include <QFileInfo> -#include <QRegExp> -#include <QString> -#include <QDataStream> - -QT_BEGIN_NAMESPACE - -QDataStream &operator>>(QDataStream &s, ContentItem &ci) -{ - s >> ci.title; - s >> ci.reference; - s >> ci.depth; - return s; -} - -QDataStream &operator<<(QDataStream &s, const ContentItem &ci) -{ - s << ci.title; - s << ci.reference; - s << ci.depth; - return s; -} - -const QString DocuParser::DocumentKey = QLatin1String("/Qt Assistant/") + QLatin1String(QT_VERSION_STR) + QLatin1String("/"); - -DocuParser *DocuParser::createParser(const QString &fileName) -{ - QFile file(fileName); - if(!file.open(QFile::ReadOnly)) { - return 0; - } - - QString str; - int maxlen = 1024; - int majVer = 0, minVer = 0, serVer = 0; - static QRegExp re(QLatin1String("assistantconfig +version=\"(\\d)\\.(\\d)\\.(\\d)\""), Qt::CaseInsensitive); - Q_ASSERT(re.isValid()); - while(!(str = QLatin1String(file.readLine(maxlen))).isEmpty()) { - if(re.indexIn(str) >= 0) { - majVer = re.cap(1).toInt(); - minVer = re.cap(2).toInt(); - serVer = re.cap(3).toInt(); - break; - } - } - - if (majVer < 3 || (majVer == 3 && minVer < 2)) { - return new DocuParser310; - } - - return new DocuParser320; -} - - -bool DocuParser::parse(QFile *file) -{ - QXmlInputSource source(file); - QXmlSimpleReader reader; - reader.setContentHandler(this); - reader.setErrorHandler(this); - setFileName(QFileInfo(*file).absoluteFilePath()); - return reader.parse(source); -} - - -QString DocuParser::errorProtocol() const -{ - return errorProt; -} - - -QList<ContentItem> DocuParser::getContentItems() -{ - return contentList; -} - - -QList<IndexItem*> DocuParser::getIndexItems() -{ - return indexList; -} - -QString DocuParser::absolutify(const QString &name, bool makeUrl) const -{ - if (!name.isEmpty()) { - QString s = name; - s.replace(QLatin1String("\\"), QLatin1String("/")); - QFileInfo orgPath(name); - if(orgPath.isRelative()) - s = QFileInfo(fname).path() + QLatin1Char('/') + name; - if (makeUrl) - s.prepend(QLatin1String("file:")); - return s; - } - return name; -} - - -void DocuParser310::addTo(Profile *p) -{ - p->addDCFTitle(fname, docTitle); - p->addDCFIcon(docTitle, iconName); - p->addDCFIndexPage(docTitle, conURL); -} - - -bool DocuParser310::startDocument() -{ - state = StateInit; - errorProt = QLatin1String(""); - - contentRef = QLatin1String(""); - indexRef = QLatin1String(""); - depth = 0; - - contentList.clear(); - qDeleteAll(indexList); - indexList.clear(); - - return true; -} - - -bool DocuParser310::startElement(const QString &, const QString &, - const QString &qname, - const QXmlAttributes &attr) -{ - if (qname == QLatin1String("DCF") && state == StateInit) { - state = StateContent; - contentRef = absolutify(attr.value(QLatin1String("ref")), false); - conURL = contentRef; - docTitle = attr.value(QLatin1String("title")); - iconName = absolutify(attr.value(QLatin1String("icon")), false); - contentList.append(ContentItem(docTitle, absolutify(contentRef), depth)); - } else if (qname == QLatin1String("section") && (state == StateContent || state == StateSect)) { - state = StateSect; - contentRef = absolutify(attr.value(QLatin1String("ref"))); - title = attr.value(QLatin1String("title")); - depth++; - contentList.append(ContentItem(title, contentRef, depth)); - } else if (qname == QLatin1String("keyword") && state == StateSect) { - state = StateKeyword; - indexRef = absolutify(attr.value(QLatin1String("ref"))); - } else - return false; - return true; -} - -bool DocuParser310::endElement(const QString &nameSpace, const QString &localName, - const QString &qName) -{ - Q_UNUSED(nameSpace); - Q_UNUSED(localName); - Q_UNUSED(qName); - - switch(state) { - case StateInit: - break; - case StateContent: - state = StateInit; - break; - case StateSect: - state = --depth ? StateSect : StateContent; - break; - case StateKeyword: - state = StateSect; - break; - default: - break; - } - return true; -} - - -bool DocuParser310::characters(const QString& ch) -{ - QString str = ch.simplified(); - if (str.isEmpty()) - return true; - - switch (state) { - case StateInit: - case StateContent: - case StateSect: - return false; - break; - case StateKeyword: - indexList.append(new IndexItem(str, indexRef)); - break; - default: - return false; - } - return true; -} - - -bool DocuParser310::fatalError(const QXmlParseException& exception) -{ - errorProt += QString::fromLatin1("fatal parsing error: %1 in line %2, column %3\n") - .arg(exception.message()) - .arg(exception.lineNumber()) - .arg(exception.columnNumber()); - - return QXmlDefaultHandler::fatalError(exception); -} - - -DocuParser320::DocuParser320() - : prof(new Profile) -{ -} - - -void DocuParser320::addTo(Profile *p) -{ - QMap<QString,QString>::ConstIterator it; - - for (it = prof->dcfTitles.constBegin(); it != prof->dcfTitles.constEnd(); ++it) - p->dcfTitles[it.key()] = *it; - - for (it = prof->icons.constBegin(); it != prof->icons.constEnd(); ++it) - p->icons[it.key()] = *it; - - for (it = prof->indexPages.constBegin(); it != prof->indexPages.constEnd(); ++it) - p->indexPages[it.key()] = *it; -} - - -bool DocuParser320::startDocument() -{ - state = StateInit; - errorProt = QLatin1String(""); - - contentRef = QLatin1String(""); - indexRef = QLatin1String(""); - depth = 0; - contentList.clear(); - indexList.clear(); - - prof->addDCF(fname); - - return true; -} - -bool DocuParser320::startElement(const QString &, const QString &, - const QString &qname, - const QXmlAttributes &attr) -{ - QString lower = qname.toLower(); - - switch(state) { - - case StateInit: - if(lower == QLatin1String("assistantconfig")) - state = StateDocRoot; - break; - - case StateDocRoot: - if(lower == QLatin1String("dcf")) { - state = StateContent; - contentRef = absolutify(attr.value(QLatin1String("ref"))); - conURL = contentRef; - docTitle = attr.value(QLatin1String("title")); - iconName = absolutify(attr.value(QLatin1String("icon"))); - contentList.append(ContentItem(docTitle, contentRef, depth)); - } else if(lower == QLatin1String("profile")) { - state = StateProfile; - } - break; - - case StateSect: - if (lower == QLatin1String("keyword") && state == StateSect) { - state = StateKeyword; - indexRef = absolutify(attr.value(QLatin1String("ref"))); - break; - } // else if (lower == "section") - case StateContent: - if(lower == QLatin1String("section")) { - state = StateSect; - contentRef = absolutify(attr.value(QLatin1String("ref"))); - title = attr.value(QLatin1String("title")); - depth++; - contentList.append(ContentItem(title, contentRef, depth)); - } - break; - - case StateProfile: - if(lower == QLatin1String("property")) { - state = StateProperty; - propertyName = attr.value(QLatin1String("name")); - } - break; - - case StateProperty: - break; - - default: - break; - } - - return true; -} - -bool DocuParser320::endElement(const QString &nameSpace, - const QString &localName, - const QString &qName) -{ - Q_UNUSED(nameSpace); - Q_UNUSED(localName); - Q_UNUSED(qName); - - switch(state) { - case StateInit: - break; - case StateDocRoot: - state = StateInit; - break; - case StateProfile: - state = StateDocRoot; - break; - case StateProperty: - state = StateProfile; - if(propertyName.isEmpty() || propertyValue.isEmpty()) - return false; - { - static const QStringList lst = QStringList() - << QLatin1String("startpage") << QLatin1String("abouturl") - << QLatin1String("applicationicon") << QLatin1String("assistantdocs"); - - if (lst.contains(propertyName)) - propertyValue = absolutify(propertyValue); - } - prof->addProperty(propertyName, propertyValue); - break; - case StateContent: - if(!iconName.isEmpty()) - prof->addDCFIcon(docTitle, iconName); - if(contentRef.isEmpty()) - return false; - prof->addDCFIndexPage(docTitle, conURL); - prof->addDCFTitle(fname, docTitle); - state = StateDocRoot; - break; - case StateSect: - state = --depth ? StateSect : StateContent; - break; - case StateKeyword: - state = StateSect; - break; - } - return true; -} - -bool DocuParser320::characters(const QString& ch) -{ - QString str = ch.simplified(); - if (str.isEmpty()) - return true; - - switch (state) { - case StateInit: - case StateContent: - case StateSect: - return false; - break; - case StateKeyword: - indexList.append(new IndexItem(str, indexRef)); - break; - case StateProperty: - propertyValue = ch; - break; - default: - return false; - } - return true; -} - -bool DocuParser320::fatalError(const QXmlParseException& exception) -{ - errorProt += QString::fromLatin1("fatal parsing error: %1 in line %2, column %3\n") - .arg(exception.message()) - .arg(exception.lineNumber()) - .arg(exception.columnNumber()); - return QXmlDefaultHandler::fatalError(exception); -} - -QT_END_NAMESPACE diff --git a/tools/assistant/compat/docuparser.h b/tools/assistant/compat/docuparser.h deleted file mode 100644 index 7c7692e..0000000 --- a/tools/assistant/compat/docuparser.h +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DOCUPARSER_H -#define DOCUPARSER_H - -#include <QList> -#include <QMap> -#include <QXmlDefaultHandler> -#include <QXmlAttributes> -#include <QXmlParseException> - -QT_BEGIN_NAMESPACE - -class Profile; - -struct ContentItem { - ContentItem() - : title( QString() ), reference( QString() ), depth( 0 ) {} - ContentItem( const QString &t, const QString &r, int d ) - : title( t ), reference( r ), depth( d ) {} - QString title; - QString reference; - int depth; - Q_DUMMY_COMPARISON_OPERATOR(ContentItem) -}; - -QDataStream &operator>>( QDataStream &s, ContentItem &ci ); -QDataStream &operator<<( QDataStream &s, const ContentItem &ci ); - -struct IndexItem { - IndexItem( const QString &k, const QString &r ) - : keyword( k ), reference( r ) {} - QString keyword; - QString reference; -}; - - - -class DocuParser : public QXmlDefaultHandler -{ -public: - enum ParserVersion { Qt310, Qt320 }; - // Since We don't want problems with documentation - // from version to version, this string stores the correct - // version string to save documents. - static const QString DocumentKey; - - static DocuParser *createParser( const QString &fileName ); - - virtual bool parse( QFile *file ); - - QList<ContentItem> getContentItems(); - QList<IndexItem*> getIndexItems(); - - QString errorProtocol() const; - QString contentsURL() const { return conURL; } - - virtual ParserVersion parserVersion() const = 0; - virtual void addTo( Profile *p ) = 0; - - QString fileName() const { return fname; } - void setFileName( const QString &file ) { fname = file; } - -protected: - QString absolutify( const QString &input, bool makeUrl = true ) const; - - QString contentRef, indexRef, errorProt, conURL; - QString docTitle, title, iconName; - QList<ContentItem> contentList; - QList<IndexItem*> indexList; - QString fname; -}; - - -class DocuParser310 : public DocuParser -{ -public: - enum States{ StateInit, StateContent, StateSect, StateKeyword }; - - bool startDocument(); - bool startElement( const QString&, const QString&, const QString& , - const QXmlAttributes& ); - bool endElement( const QString&, const QString&, const QString& ); - bool characters( const QString & ); - bool fatalError( const QXmlParseException& exception ); - - virtual ParserVersion parserVersion() const { return Qt310; } - virtual void addTo( Profile *p ); - -private: - States state; - int depth; -}; - - -class DocuParser320 : public DocuParser -{ -public: - enum States { StateInit, StateDocRoot, StateProfile, StateProperty, - StateContent, StateSect, StateKeyword }; - - DocuParser320(); - - bool startDocument(); - bool startElement( const QString&, const QString&, const QString& , - const QXmlAttributes& ); - bool endElement( const QString&, const QString&, const QString& ); - bool characters( const QString & ); - bool fatalError( const QXmlParseException& exception ); - - virtual ParserVersion parserVersion() const { return Qt320; } - virtual void addTo( Profile *p ); - Profile *profile() const { return prof; } - -private: - - States state; - int depth; - int docfileCounter; - QString propertyValue; - QString propertyName; - Profile *prof; -}; - -QT_END_NAMESPACE - -#endif // DOCUPARSER_H diff --git a/tools/assistant/compat/fontsettingsdialog.cpp b/tools/assistant/compat/fontsettingsdialog.cpp deleted file mode 100644 index 31a3241..0000000 --- a/tools/assistant/compat/fontsettingsdialog.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "fontsettingsdialog.h" -#include "fontpanel.h" -#include "config.h" - -#include <QtGui/QLabel> -#include <QtGui/QComboBox> -#include <QtGui/QHBoxLayout> -#include <QtGui/QVBoxLayout> -#include <QtGui/QApplication> -#include <QtGui/QStackedWidget> -#include <QtGui/QDialogButtonBox> - -QT_BEGIN_NAMESPACE - -FontSettingsDialog::FontSettingsDialog(QWidget *parent) - : QDialog(parent) - , m_windowFontPanel(new FontPanel(this)) - , m_browserFontPanel(new FontPanel(this)) - , m_dialogButtonBox(new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel)) -{ - setModal(true); - setWindowTitle(tr("Font Settings")); - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - - QVBoxLayout *mainVLayout = new QVBoxLayout(this); - QHBoxLayout *hboxLayout = new QHBoxLayout; - mainVLayout->addLayout(hboxLayout); - - QLabel *label = new QLabel(tr("Font settings for:"), this); - label->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - hboxLayout->addWidget(label); - QComboBox *comboBox = new QComboBox(this); - comboBox->addItem(tr("Browser")); - comboBox->addItem(tr("Application")); - hboxLayout->addWidget(comboBox); - - m_windowFontPanel->setCheckable(true); - m_browserFontPanel->setCheckable(true); - - const QString customSettings(tr("Use custom settings")); - m_windowFontPanel->setTitle(customSettings); - m_browserFontPanel->setTitle(customSettings); - - QStackedWidget *stackWidget = new QStackedWidget(this); - stackWidget->addWidget(m_browserFontPanel); - stackWidget->addWidget(m_windowFontPanel); - - mainVLayout->addWidget(stackWidget); - mainVLayout->addWidget(m_dialogButtonBox); - - connect(m_dialogButtonBox , SIGNAL(rejected()), this, SLOT(reject())); - connect(m_dialogButtonBox , SIGNAL(accepted()), this, SLOT(accept())); - connect(comboBox, SIGNAL(activated(int)), stackWidget, SLOT(setCurrentIndex(int))); -} - -FontSettingsDialog::~FontSettingsDialog() -{ - // nothing todo -} - -bool FontSettingsDialog::showDialog(FontSettings *settings) -{ - setupFontSettingsDialog(settings); - - if (exec() != Accepted) - return false; - - updateFontSettings(settings); - return true; -} - -void FontSettingsDialog::updateFontSettings(FontSettings *settings) -{ - settings->useWindowFont = m_windowFontPanel->isChecked(); - settings->useBrowserFont = m_browserFontPanel->isChecked(); - - settings->windowFont = settings->useWindowFont ? m_windowFontPanel->selectedFont() : qApp->font(); - settings->browserFont = settings->useBrowserFont ? m_browserFontPanel->selectedFont() : qApp->font(); - - settings->windowWritingSystem = settings->useWindowFont ? m_windowFontPanel->writingSystem() : QFontDatabase::Latin; - settings->browserWritingSystem = settings->useBrowserFont ? m_browserFontPanel->writingSystem() : QFontDatabase::Latin; -} - -void FontSettingsDialog::setupFontSettingsDialog(const FontSettings *settings) -{ - m_windowFontPanel->setSelectedFont(settings->windowFont); - m_browserFontPanel->setSelectedFont(settings->browserFont); - - m_windowFontPanel->setWritingSystem(settings->windowWritingSystem); - m_browserFontPanel->setWritingSystem(settings->browserWritingSystem); - - m_windowFontPanel->setChecked(settings->useWindowFont); - m_browserFontPanel->setChecked(settings->useBrowserFont); -} - -QT_END_NAMESPACE diff --git a/tools/assistant/compat/helpdialog.cpp b/tools/assistant/compat/helpdialog.cpp deleted file mode 100644 index 23c1bfc..0000000 --- a/tools/assistant/compat/helpdialog.cpp +++ /dev/null @@ -1,1331 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "helpdialog.h" -#include "helpwindow.h" -#include "topicchooser.h" -#include "docuparser.h" -#include "mainwindow.h" -#include "config.h" -#include "tabbedbrowser.h" - -#include <QtGui> -#include <QtDebug> -#include <QtCore/QVarLengthArray> - -#include <stdlib.h> -#include <limits.h> - -QT_BEGIN_NAMESPACE - -enum -{ - LinkRole = Qt::UserRole + 1000 -}; - -static bool verifyDirectory(const QString &str) -{ - QFileInfo dirInfo(str); - if (!dirInfo.exists()) - return QDir().mkdir(str); - if (!dirInfo.isDir()) { - qWarning("'%s' exists but is not a directory", str.toLatin1().constData()); - return false; - } - return true; -} - -struct IndexKeyword { - IndexKeyword(const QString &kw, const QString &l) - : keyword(kw), link(l) {} - IndexKeyword() : keyword(QString()), link(QString()) {} - bool operator<(const IndexKeyword &ik) const { - return keyword.toLower() < ik.keyword.toLower(); - } - bool operator<=(const IndexKeyword &ik) const { - return keyword.toLower() <= ik.keyword.toLower(); - } - bool operator>(const IndexKeyword &ik) const { - return keyword.toLower() > ik.keyword.toLower(); - } - Q_DUMMY_COMPARISON_OPERATOR(IndexKeyword) - QString keyword; - QString link; -}; - -QDataStream &operator>>(QDataStream &s, IndexKeyword &ik) -{ - s >> ik.keyword; - s >> ik.link; - return s; -} - -QDataStream &operator<<(QDataStream &s, const IndexKeyword &ik) -{ - s << ik.keyword; - s << ik.link; - return s; -} - -QValidator::State SearchValidator::validate(QString &str, int &) const -{ - for (int i = 0; i < (int) str.length(); ++i) { - QChar c = str[i]; - if (!c.isLetterOrNumber() && c != QLatin1Char('\'') && c != QLatin1Char('`') - && c != QLatin1Char('\"') && c != QLatin1Char(' ') && c != QLatin1Char('-') && c != QLatin1Char('_') - && c!= QLatin1Char('*')) - return QValidator::Invalid; - } - return QValidator::Acceptable; -} - -class IndexListModel: public QStringListModel -{ -public: - IndexListModel(QObject *parent = 0) - : QStringListModel(parent) {} - - void clear() { contents.clear(); setStringList(QStringList()); } - - QString description(int index) const { return stringList().at(index); } - QStringList links(int index) const { return contents.values(stringList().at(index)); } - void addLink(const QString &description, const QString &link) { contents.insert(description, link); } - - void publish() { filter(QString(), QString()); } - - QModelIndex filter(const QString &s, const QString &real); - - virtual Qt::ItemFlags flags(const QModelIndex &index) const - { return QStringListModel::flags(index) & ~Qt::ItemIsEditable; } - -private: - QMultiMap<QString, QString> contents; -}; - -bool caseInsensitiveLessThan(const QString &as, const QString &bs) -{ - const QChar *a = as.unicode(); - const QChar *b = bs.unicode(); - if (a == 0) - return true; - if (b == 0) - return false; - if (a == b) - return false; - int l=qMin(as.length(),bs.length()); - while (l-- && QChar::toLower(a->unicode()) == QChar::toLower(b->unicode())) - a++,b++; - if (l==-1) - return (as.length() < bs.length()); - return QChar::toLower(a->unicode()) < QChar::toLower(b->unicode()); -} - -/** - * \a real is kinda a hack for the smart search, need a way to match a regexp to an item - * How would you say the best match for Q.*Wiget is QWidget? - */ -QModelIndex IndexListModel::filter(const QString &s, const QString &real) -{ - QStringList list; - - int goodMatch = -1; - int perfectMatch = -1; - if (s.isEmpty()) - perfectMatch = 0; - - const QRegExp regExp(s, Qt::CaseInsensitive); - QMultiMap<QString, QString>::iterator it = contents.begin(); - QString lastKey; - for (; it != contents.end(); ++it) { - if (it.key() == lastKey) - continue; - lastKey = it.key(); - const QString key = it.key(); - if (key.contains(regExp) || key.contains(s, Qt::CaseInsensitive)) { - list.append(key); - if (perfectMatch == -1 && (key.startsWith(real, Qt::CaseInsensitive))) { - if (goodMatch == -1) - goodMatch = list.count() - 1; - if (real.length() == key.length()){ - perfectMatch = list.count() - 1; - } - } else if (perfectMatch > -1 && s == key) { - perfectMatch = list.count() - 1; - } - } - } - - int bestMatch = perfectMatch; - if (bestMatch == -1) - bestMatch = goodMatch; - bestMatch = qMax(0, bestMatch); - - // sort the new list - QString match; - if (bestMatch >= 0 && list.count() > bestMatch) - match = list[bestMatch]; - qSort(list.begin(), list.end(), caseInsensitiveLessThan); - setStringList(list); - for (int i = 0; i < list.size(); ++i) { - if (list.at(i) == match){ - bestMatch = i; - break; - } - } - return index(bestMatch, 0, QModelIndex()); -} - -HelpNavigationListItem::HelpNavigationListItem(QListWidget *ls, const QString &txt) - : QListWidgetItem(txt, ls) -{ -} - -void HelpNavigationListItem::addLink(const QString &link) -{ - QString lnk = HelpDialog::removeAnchorFromLink(link); - if (linkList.filter(lnk, Qt::CaseInsensitive).count() > 0) - return; - linkList << link; -} - -HelpDialog::HelpDialog(QWidget *parent, MainWindow *h) - : QWidget(parent), lwClosed(false), help(h) -{ - ui.setupUi(this); - ui.listContents->setUniformRowHeights(true); - ui.listContents->header()->setStretchLastSection(false); - ui.listContents->header()->setResizeMode(QHeaderView::ResizeToContents); - ui.listBookmarks->setUniformRowHeights(true); - ui.listBookmarks->header()->setStretchLastSection(false); - ui.listBookmarks->header()->setResizeMode(QHeaderView::ResizeToContents); - - indexModel = new IndexListModel(this); - ui.listIndex->setModel(indexModel); - ui.listIndex->setLayoutMode(QListView::Batched); - ui.listBookmarks->setItemHidden(ui.listBookmarks->headerItem(), true); - ui.listContents->setItemHidden(ui.listContents->headerItem(), true); - ui.searchButton->setShortcut(QKeySequence(Qt::ALT|Qt::SHIFT|Qt::Key_S)); -} - -void HelpDialog::initialize() -{ - connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int))); - - connect(ui.listContents, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(showTopic(QTreeWidgetItem*))); - connect(ui.listContents, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showTreeItemMenu(QPoint))); - ui.listContents->viewport()->installEventFilter(this); - - connect(ui.editIndex, SIGNAL(returnPressed()), this, SLOT(showTopic())); - connect(ui.editIndex, SIGNAL(textEdited(QString)), this, SLOT(searchInIndex(QString))); - - connect(ui.listIndex, SIGNAL(activated(QModelIndex)), this, SLOT(showTopic())); - connect(ui.listIndex, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showIndexItemMenu(QPoint))); - - connect(ui.listBookmarks, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(showTopic(QTreeWidgetItem*))); - connect(ui.listBookmarks, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showTreeItemMenu(QPoint))); - - connect(ui.termsEdit, SIGNAL(textChanged(QString)), this, SLOT(updateSearchButton(QString))); - - connect(ui.resultBox, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showListItemMenu(QPoint))); - - cacheFilesPath = QDir::homePath() + QLatin1String("/.assistant"); //### Find a better location for the dbs - - ui.editIndex->installEventFilter(this); - - ui.framePrepare->hide(); - connect(qApp, SIGNAL(lastWindowClosed()), SLOT(lastWinClosed())); - - ui.termsEdit->setValidator(new SearchValidator(ui.termsEdit)); - - actionOpenCurrentTab = new QAction(this); - actionOpenCurrentTab->setText(tr("Open Link in Current Tab")); - - actionOpenLinkInNewWindow = new QAction(this); - actionOpenLinkInNewWindow->setText(tr("Open Link in New Window")); - - actionOpenLinkInNewTab = new QAction(this); - actionOpenLinkInNewTab->setText(tr("Open Link in New Tab")); - - itemPopup = new QMenu(this); - itemPopup->addAction(actionOpenCurrentTab); - itemPopup->addAction(actionOpenLinkInNewWindow); - itemPopup->addAction(actionOpenLinkInNewTab); - - ui.tabWidget->setElideMode(Qt::ElideNone); - - contentList.clear(); - - initDoneMsgShown = false; - fullTextIndex = 0; - indexDone = false; - titleMapDone = false; - contentsInserted = false; - bookmarksInserted = false; - setupTitleMap(); - -} - -void HelpDialog::processEvents() -{ - qApp->processEvents(QEventLoop::ExcludeUserInputEvents); -} - - -void HelpDialog::lastWinClosed() -{ - lwClosed = true; -} - -void HelpDialog::removeOldCacheFiles(bool onlyFulltextSearchIndex) -{ - if (!verifyDirectory(cacheFilesPath)) { - qWarning("Failed to created assistant directory"); - return; - } - QString pname = QLatin1String(".") + Config::configuration()->profileName(); - - QStringList fileList; - fileList << QLatin1String("indexdb40.dict") - << QLatin1String("indexdb40.doc"); - - if (!onlyFulltextSearchIndex) - fileList << QLatin1String("indexdb40") << QLatin1String("contentdb40"); - - QStringList::iterator it = fileList.begin(); - for (; it != fileList.end(); ++it) { - if (QFile::exists(cacheFilesPath + QDir::separator() + *it + pname)) { - QFile f(cacheFilesPath + QDir::separator() + *it + pname); - f.remove(); - } - } -} - -void HelpDialog::timerEvent(QTimerEvent *e) -{ - Q_UNUSED(e); - static int opacity = 255; - help->setWindowOpacity((opacity-=4)/255.0); - if (opacity<=0) - qApp->quit(); -} - - -void HelpDialog::loadIndexFile() -{ - if (indexDone) - return; - - setCursor(Qt::WaitCursor); - indexDone = true; - ui.labelPrepare->setText(tr("Prepare...")); - ui.framePrepare->show(); - processEvents(); - - QProgressBar *bar = ui.progressPrepare; - bar->setMaximum(100); - bar->setValue(0); - - keywordDocuments.clear(); - QList<IndexKeyword> lst; - QFile indexFile(cacheFilesPath + QDir::separator() + QLatin1String("indexdb40.") + - Config::configuration()->profileName()); - if (!indexFile.open(QFile::ReadOnly)) { - buildKeywordDB(); - processEvents(); - if (lwClosed) - return; - if (!indexFile.open(QFile::ReadOnly)) { - QMessageBox::warning(help, tr("Qt Assistant"), tr("Failed to load keyword index file\n" - "Assistant will not work!")); -#if defined Q_WS_WIN || defined Q_WS_MACX - startTimer(50); -#endif - return; - } - } - - QDataStream ds(&indexFile); - quint32 fileAges; - ds >> fileAges; - if (fileAges != getFileAges()) { - indexFile.close(); - buildKeywordDB(); - if (!indexFile.open(QFile::ReadOnly)) { - QMessageBox::warning(help, tr("Qt Assistant"), - tr("Cannot open the index file %1").arg(QFileInfo(indexFile).absoluteFilePath())); - return; - } - ds.setDevice(&indexFile); - ds >> fileAges; - } - ds >> lst; - indexFile.close(); - - bar->setValue(bar->maximum()); - processEvents(); - - for (int i=0; i<lst.count(); ++i) { - const IndexKeyword &idx = lst.at(i); - indexModel->addLink(idx.keyword, idx.link); - - keywordDocuments << HelpDialog::removeAnchorFromLink(idx.link); - } - - indexModel->publish(); - - ui.framePrepare->hide(); - showInitDoneMessage(); - setCursor(Qt::ArrowCursor); -} - -quint32 HelpDialog::getFileAges() -{ - QStringList addDocuFiles = Config::configuration()->docFiles(); - QStringList::const_iterator i = addDocuFiles.constBegin(); - - quint32 fileAges = 0; - for (; i != addDocuFiles.constEnd(); ++i) { - QFileInfo fi(*i); - if (fi.exists()) - fileAges += fi.lastModified().toTime_t(); - } - - return fileAges; -} - -void HelpDialog::buildKeywordDB() -{ - QStringList addDocuFiles = Config::configuration()->docFiles(); - QStringList::iterator i = addDocuFiles.begin(); - - // Set up an indeterminate progress bar. - ui.labelPrepare->setText(tr("Prepare...")); - ui.progressPrepare->setMaximum(0); - ui.progressPrepare->setMinimum(0); - ui.progressPrepare->setValue(0); - processEvents(); - - QList<IndexKeyword> lst; - quint32 fileAges = 0; - for (i = addDocuFiles.begin(); i != addDocuFiles.end(); ++i) { - QFile file(*i); - if (!file.exists()) { - QMessageBox::warning(this, tr("Warning"), - tr("Documentation file %1 does not exist!\n" - "Skipping file.").arg(QFileInfo(file).absoluteFilePath())); - continue; - } - fileAges += QFileInfo(file).lastModified().toTime_t(); - DocuParser *handler = DocuParser::createParser(*i); - bool ok = handler->parse(&file); - file.close(); - if (!ok){ - QString msg = QString::fromLatin1("In file %1:\n%2") - .arg(QFileInfo(file).absoluteFilePath()) - .arg(handler->errorProtocol()); - QMessageBox::critical(this, tr("Parse Error"), tr(msg.toUtf8())); - delete handler; - continue; - } - - QList<IndexItem*> indLst = handler->getIndexItems(); - int counter = 0; - foreach (IndexItem *indItem, indLst) { - QFileInfo fi(indItem->reference); - lst.append(IndexKeyword(indItem->keyword, indItem->reference)); - - if (++counter%100 == 0) { - if (ui.progressPrepare) - ui.progressPrepare->setValue(counter); - processEvents(); - if (lwClosed) { - return; - } - } - } - delete handler; - } - if (!lst.isEmpty()) - qSort(lst); - - QFile indexout(cacheFilesPath + QDir::separator() + QLatin1String("indexdb40.") - + Config::configuration()->profileName()); - if (verifyDirectory(cacheFilesPath) && indexout.open(QFile::WriteOnly)) { - QDataStream s(&indexout); - s << fileAges; - s << lst; - indexout.close(); - } -} - -void HelpDialog::setupTitleMap() -{ - if (titleMapDone) - return; - - bool needRebuild = false; - if (Config::configuration()->profileName() == QLatin1String("default")) { - const QStringList docuFiles = Config::configuration()->docFiles(); - for (QStringList::ConstIterator it = docuFiles.begin(); it != docuFiles.end(); ++it) { - if (!QFile::exists(*it)) { - Config::configuration()->saveProfile(Profile::createDefaultProfile()); - Config::configuration()->loadDefaultProfile(); - needRebuild = true; - break; - } - } - } - - if (Config::configuration()->docRebuild() || needRebuild) { - removeOldCacheFiles(); - Config::configuration()->setDocRebuild(false); - Config::configuration()->saveProfile(Config::configuration()->profile()); - } - if (contentList.isEmpty()) - getAllContents(); - - titleMapDone = true; - titleMap.clear(); - for (QList<QPair<QString, ContentList> >::Iterator it = contentList.begin(); it != contentList.end(); ++it) { - ContentList lst = (*it).second; - foreach (ContentItem item, lst) { - titleMap[item.reference] = item.title.trimmed(); - } - } - processEvents(); -} - -void HelpDialog::getAllContents() -{ - QFile contentFile(cacheFilesPath + QDir::separator() + QLatin1String("contentdb40.") - + Config::configuration()->profileName()); - contentList.clear(); - if (!contentFile.open(QFile::ReadOnly)) { - buildContentDict(); - return; - } - - QDataStream ds(&contentFile); - quint32 fileAges; - ds >> fileAges; - if (fileAges != getFileAges()) { - contentFile.close(); - removeOldCacheFiles(true); - buildContentDict(); - return; - } - QString key; - QList<ContentItem> lst; - while (!ds.atEnd()) { - ds >> key; - ds >> lst; - contentList += qMakePair(key, QList<ContentItem>(lst)); - } - contentFile.close(); - processEvents(); - -} - -void HelpDialog::buildContentDict() -{ - QStringList docuFiles = Config::configuration()->docFiles(); - - quint32 fileAges = 0; - for (QStringList::iterator it = docuFiles.begin(); it != docuFiles.end(); ++it) { - QFile file(*it); - if (!file.exists()) { - QMessageBox::warning(this, tr("Warning"), - tr("Documentation file %1 does not exist!\n" - "Skipping file.").arg(QFileInfo(file).absoluteFilePath())); - continue; - } - fileAges += QFileInfo(file).lastModified().toTime_t(); - DocuParser *handler = DocuParser::createParser(*it); - if (!handler) { - QMessageBox::warning(this, tr("Warning"), - tr("Documentation file %1 is not compatible!\n" - "Skipping file.").arg(QFileInfo(file).absoluteFilePath())); - continue; - } - bool ok = handler->parse(&file); - file.close(); - if (ok) { - contentList += qMakePair(*it, QList<ContentItem>(handler->getContentItems())); - delete handler; - } else { - QString msg = QString::fromLatin1("In file %1:\n%2") - .arg(QFileInfo(file).absoluteFilePath()) - .arg(handler->errorProtocol()); - QMessageBox::critical(this, tr("Parse Error"), tr(msg.toUtf8())); - continue; - } - } - - QFile contentOut(cacheFilesPath + QDir::separator() + QLatin1String("contentdb40.") - + Config::configuration()->profileName()); - if (contentOut.open(QFile::WriteOnly)) { - QDataStream s(&contentOut); - s << fileAges; - for (QList<QPair<QString, ContentList> >::Iterator it = contentList.begin(); it != contentList.end(); ++it) { - s << *it; - } - contentOut.close(); - } -} - -void HelpDialog::currentTabChanged(int index) -{ - QString s = ui.tabWidget->widget(index)->objectName(); - if (s == QLatin1String("indexPage")) - QTimer::singleShot(0, this, SLOT(loadIndexFile())); - else if (s == QLatin1String("bookmarkPage")) - insertBookmarks(); - else if (s == QLatin1String("contentPage")) - QTimer::singleShot(0, this, SLOT(insertContents())); - else if (s == QLatin1String("searchPage")) - QTimer::singleShot(0, this, SLOT(setupFullTextIndex())); -} - -void HelpDialog::showInitDoneMessage() -{ - if (initDoneMsgShown) - return; - initDoneMsgShown = true; - help->statusBar()->showMessage(tr("Done"), 3000); -} - -void HelpDialog::showTopic(QTreeWidgetItem *item) -{ - if (item) - showTopic(); -} - -void HelpDialog::showTopic() -{ - QString tabName = ui.tabWidget->currentWidget()->objectName(); - - if (tabName == QLatin1String("indexPage")) - showIndexTopic(); - else if (tabName == QLatin1String("bookmarkPage")) - showBookmarkTopic(); - else if (tabName == QLatin1String("contentPage")) - showContentsTopic(); -} - -void HelpDialog::showIndexTopic() -{ - int row = ui.listIndex->currentIndex().row(); - if (row == -1 || row >= indexModel->rowCount()) - return; - - QString description = indexModel->description(row); - QStringList links = indexModel->links(row); - - bool blocked = ui.editIndex->blockSignals(true); - ui.editIndex->setText(description); - ui.editIndex->blockSignals(blocked); - - if (links.count() == 1) { - emit showLink(links.first()); - } else { - qSort(links); - QStringList::Iterator it = links.begin(); - QStringList linkList; - QStringList linkNames; - for (; it != links.end(); ++it) { - linkList << *it; - linkNames << titleOfLink(*it); - } - QString link = TopicChooser::getLink(this, linkNames, linkList, description); - if (!link.isEmpty()) - emit showLink(link); - } - - ui.listIndex->setCurrentIndex(indexModel->index(indexModel->stringList().indexOf(description))); - ui.listIndex->scrollTo(ui.listIndex->currentIndex(), QAbstractItemView::PositionAtTop); -} - -void HelpDialog::searchInIndex(const QString &searchString) -{ - QRegExp atoz(QLatin1String("[A-Z]")); - int matches = searchString.count(atoz); - if (matches > 0 && !searchString.contains(QLatin1String(".*"))) - { - int start = 0; - QString newSearch; - for (; matches > 0; --matches) { - int match = searchString.indexOf(atoz, start+1); - if (match <= start) - continue; - newSearch += searchString.mid(start, match-start); - newSearch += QLatin1String(".*"); - start = match; - } - newSearch += searchString.mid(start); - ui.listIndex->setCurrentIndex(indexModel->filter(newSearch, searchString)); - } - else - ui.listIndex->setCurrentIndex(indexModel->filter(searchString, searchString)); -} - -QString HelpDialog::titleOfLink(const QString &link) -{ - QString s = HelpDialog::removeAnchorFromLink(link); - s = titleMap[s]; - if (s.isEmpty()) - return link; - return s; -} - -bool HelpDialog::eventFilter(QObject * o, QEvent * e) -{ - if (o == ui.editIndex && e->type() == QEvent::KeyPress) { - switch (static_cast<QKeyEvent*>(e)->key()) { - case Qt::Key_Up: - case Qt::Key_Down: - case Qt::Key_PageDown: - case Qt::Key_PageUp: - QApplication::sendEvent(ui.listIndex, e); - break; - - default: - break; - } - } else if (o == ui.listContents->viewport()) { - if (e->type() == QEvent::MouseButtonRelease) { - QMouseEvent *me = static_cast<QMouseEvent*>(e); - if (me->button() == Qt::LeftButton) { - QTreeWidgetItem *item = ui.listContents->itemAt(me->pos()); - QRect vRect = ui.listContents->visualItemRect(item); - - // only show topic if we clicked an item - if (item && vRect.contains(me->pos())) - showTopic(item); - } - } - } - - return QWidget::eventFilter(o, e); -} - -void HelpDialog::addBookmark() -{ - if (!bookmarksInserted) - insertBookmarks(); - QString link = help->browsers()->currentBrowser()->source().toString(); - QString title = help->browsers()->currentBrowser()->documentTitle(); - if (title.isEmpty()) - title = titleOfLink(link); - - QTreeWidgetItem *i = new QTreeWidgetItem(ui.listBookmarks, 0); - i->setText(0, title); - i->setData(0, LinkRole, link); - ui.buttonRemove->setEnabled(true); - saveBookmarks(); - help->updateBookmarkMenu(); -} - -void HelpDialog::on_buttonAdd_clicked() -{ - addBookmark(); -} - -void HelpDialog::on_buttonRemove_clicked() -{ - if (!ui.listBookmarks->currentItem()) - return; - - delete ui.listBookmarks->currentItem(); - saveBookmarks(); - if (ui.listBookmarks->topLevelItemCount() != 0) { - ui.listBookmarks->setCurrentItem(ui.listBookmarks->topLevelItem(0)); - } - ui.buttonRemove->setEnabled(ui.listBookmarks->topLevelItemCount() > 0); - help->updateBookmarkMenu(); -} - -void HelpDialog::insertBookmarks() -{ - if (bookmarksInserted) - return; - bookmarksInserted = true; - ui.listBookmarks->clear(); - QFile f(cacheFilesPath + QDir::separator() + QLatin1String("bookmarks.") - + Config::configuration()->profileName()); - if (!f.open(QFile::ReadOnly)) - return; - QTextStream ts(&f); - while (!ts.atEnd()) { - QTreeWidgetItem *i = new QTreeWidgetItem(ui.listBookmarks, 0); - i->setText(0, ts.readLine()); - i->setData(0, LinkRole, ts.readLine()); - } - ui.buttonRemove->setEnabled(ui.listBookmarks->topLevelItemCount() > 0); - help->updateBookmarkMenu(); - showInitDoneMessage(); -} - -void HelpDialog::showBookmarkTopic() -{ - if (!ui.listBookmarks->currentItem()) - return; - - QTreeWidgetItem *i = (QTreeWidgetItem*)ui.listBookmarks->currentItem(); - emit showLink(i->data(0, LinkRole).toString()); -} - -static void store(QTreeWidgetItem *i, QTextStream &ts) -{ - ts << i->text(0) << endl; - ts << i->data(0, LinkRole).toString() << endl; - - for (int index = 0; index < i->childCount(); ++index) - store(i->child(index), ts); -} - -static void store(QTreeWidget *tw, QTextStream &ts) -{ - for (int index = 0; index < tw->topLevelItemCount(); ++index) - store(tw->topLevelItem(index), ts); -} - -void HelpDialog::saveBookmarks() -{ - QFile f(cacheFilesPath + QDir::separator() + QLatin1String("bookmarks.") - + Config::configuration()->profileName()); - if (!f.open(QFile::WriteOnly)) - return; - - QTextStream ts(&f); - store(ui.listBookmarks, ts); - f.close(); -} - -void HelpDialog::insertContents() -{ -#ifdef Q_WS_MAC - static const QLatin1String IconPath(":/trolltech/assistant/images/mac/book.png"); -#else - static const QLatin1String IconPath(":/trolltech/assistant/images/win/book.png"); -#endif - if (contentsInserted) - return; - - if (contentList.isEmpty()) - getAllContents(); - - contentsInserted = true; - ui.listContents->clear(); - setCursor(Qt::WaitCursor); - if (!titleMapDone) - setupTitleMap(); - -#if 0 // ### port me - ui.listContents->setSorting(-1); -#endif - - for (QList<QPair<QString, ContentList> >::Iterator it = contentList.begin(); it != contentList.end(); ++it) { - QTreeWidgetItem *newEntry = 0; - - QTreeWidgetItem *contentEntry = 0; - QStack<QTreeWidgetItem*> stack; - stack.clear(); - int depth = 0; - bool root = false; - - const int depthSize = 32; - QVarLengthArray<QTreeWidgetItem*, depthSize> lastItem(depthSize); - - ContentList lst = (*it).second; - for (ContentList::ConstIterator it = lst.constBegin(); it != lst.constEnd(); ++it) { - ContentItem item = *it; - if (item.depth == 0) { - lastItem[0] = 0; - newEntry = new QTreeWidgetItem(ui.listContents, 0); - newEntry->setIcon(0, QIcon(IconPath)); - newEntry->setText(0, item.title); - newEntry->setData(0, LinkRole, item.reference); - stack.push(newEntry); - depth = 1; - root = true; - } - else{ - if ((item.depth > depth) && root) { - depth = item.depth; - stack.push(contentEntry); - } - if (item.depth == depth) { - if (lastItem.capacity() == depth) - lastItem.resize(depth + depthSize); - contentEntry = new QTreeWidgetItem(stack.top(), lastItem[ depth ]); - lastItem[ depth ] = contentEntry; - contentEntry->setText(0, item.title); - contentEntry->setData(0, LinkRole, item.reference); - } - else if (item.depth < depth) { - stack.pop(); - depth--; - item = *(--it); - } - } - } - processEvents(); - } - setCursor(Qt::ArrowCursor); - showInitDoneMessage(); -} - -void HelpDialog::showContentsTopic() -{ - QTreeWidgetItem *i = (QTreeWidgetItem*)ui.listContents->currentItem(); - if (!i) - return; - emit showLink(i->data(0, LinkRole).toString()); -} - -QTreeWidgetItem * HelpDialog::locateLink(QTreeWidgetItem *item, const QString &link) -{ - QTreeWidgetItem *child = 0; -#ifdef Q_OS_WIN - Qt::CaseSensitivity checkCase = Qt::CaseInsensitive; -#else - Qt::CaseSensitivity checkCase = Qt::CaseSensitive; -#endif - for (int i = 0, childCount = item->childCount(); i<childCount; i++) { - child = item->child(i); - ///check whether it is this item - if (link.startsWith(child->data(0, LinkRole).toString(), checkCase)) - break; - //check if the link is a child of this item - else if (child->childCount()) { - child = locateLink(child, link); - if (child) - break; - } - child = 0; - } - return child; -} - -void HelpDialog::locateContents(const QString &link) -{ - //ensure the TOC is filled - if (!contentsInserted) - insertContents(); -#ifdef Q_OS_WIN - Qt::CaseSensitivity checkCase = Qt::CaseInsensitive; -#else - Qt::CaseSensitivity checkCase = Qt::CaseSensitive; -#endif - QString findLink(link); - //Installations on a windows local drive will give the 'link' as <file:///C:/xxx> - //and the contents in the TOC will be <file:C:/xxx>. - //But on others the 'link' of format <file:///root/xxx> - //and the contents in the TOC will be <file:/root/xxx>. - if (findLink.contains(QLatin1String("file:///"))) { - if (findLink[9] == QLatin1Char(':')) //on windows drives - findLink.replace(0, 8, QLatin1String("file:")); - else - findLink.replace(0, 8, QLatin1String("file:/")); - } - - bool topLevel = false; - QTreeWidgetItem *item = 0; - int totalItems = ui.listContents->topLevelItemCount(); - - for (int i = 0; i < totalItems; i++ ) { - // first see if we are one of the top level items - item = (QTreeWidgetItem*)ui.listContents->topLevelItem(i); - if (findLink.startsWith(item->data(0, LinkRole).toString(), checkCase)) { - topLevel = true; - break; - } - } - - if (!topLevel) { - // now try to find it in the sublevel items - for (int n = 0; n < totalItems; ++n) { - item = (QTreeWidgetItem*)ui.listContents->topLevelItem(n); - item = locateLink(item, findLink); - if (item) - break; - } - } - - //remove the old selection - QList<QTreeWidgetItem *> selected = ui.listContents->selectedItems(); - foreach(QTreeWidgetItem *sel, selected) - ui.listContents->setItemSelected(sel, false); - - //set the TOC item and show - ui.listContents->setCurrentItem(item); - ui.listContents->setItemSelected(item, true); - ui.listContents->scrollToItem(item); -} - -void HelpDialog::toggleContents() -{ - if (!isVisible() || ui.tabWidget->currentIndex() != 0) { - ui.tabWidget->setCurrentIndex(0); - parentWidget()->show(); - } - else - parentWidget()->hide(); -} - -void HelpDialog::toggleIndex() -{ - if (!isVisible() || ui.tabWidget->currentIndex() != 1 || !ui.editIndex->hasFocus()) { - ui.tabWidget->setCurrentIndex(1); - parentWidget()->show(); - ui.editIndex->setFocus(); - } - else - parentWidget()->hide(); -} - -void HelpDialog::toggleBookmarks() -{ - if (!isVisible() || ui.tabWidget->currentIndex() != 2) { - ui.tabWidget->setCurrentIndex(2); - parentWidget()->show(); - } - else - parentWidget()->hide(); -} - -void HelpDialog::toggleSearch() -{ - if (!isVisible() || ui.tabWidget->currentIndex() != 3) { - ui.tabWidget->setCurrentIndex(3); - parentWidget()->show(); - } - else - parentWidget()->hide(); -} - -void HelpDialog::setupFullTextIndex() -{ - if (fullTextIndex) - return; - - QString pname = Config::configuration()->profileName(); - fullTextIndex = new Index(QStringList(), QDir::homePath()); // ### Is this correct ? - if (!verifyDirectory(cacheFilesPath)) { - QMessageBox::warning(help, tr("Qt Assistant"), - tr("Failed to save fulltext search index\n" - "Assistant will not work!")); - return; - } - fullTextIndex->setDictionaryFile(cacheFilesPath + QDir::separator() + QLatin1String("indexdb40.dict.") + pname); - fullTextIndex->setDocListFile(cacheFilesPath + QDir::separator() + QLatin1String("indexdb40.doc.") + pname); - processEvents(); - - connect(fullTextIndex, SIGNAL(indexingProgress(int)), - this, SLOT(setIndexingProgress(int))); - QFile f(cacheFilesPath + QDir::separator() + QLatin1String("indexdb40.dict.") + pname); - if (!f.exists()) { - QString doc; - QSet<QString> documentSet; - QMap<QString, QString>::ConstIterator it = titleMap.constBegin(); - for (; it != titleMap.constEnd(); ++it) { - doc = HelpDialog::removeAnchorFromLink(it.key()); - if (!doc.isEmpty()) - documentSet.insert(doc); - } - loadIndexFile(); - for ( QStringList::Iterator it = keywordDocuments.begin(); it != keywordDocuments.end(); ++it ) { - if (!(*it).isEmpty()) - documentSet.insert(*it); - } - fullTextIndex->setDocList( documentSet.toList() ); - - help->statusBar()->clearMessage(); - setCursor(Qt::WaitCursor); - ui.labelPrepare->setText(tr("Indexing files...")); - ui.progressPrepare->setMaximum(100); - ui.progressPrepare->reset(); - ui.progressPrepare->show(); - ui.framePrepare->show(); - processEvents(); - if (fullTextIndex->makeIndex() == -1) - return; - fullTextIndex->writeDict(); - ui.progressPrepare->setValue(100); - ui.framePrepare->hide(); - setCursor(Qt::ArrowCursor); - showInitDoneMessage(); - } else { - setCursor(Qt::WaitCursor); - help->statusBar()->showMessage(tr("Reading dictionary...")); - processEvents(); - fullTextIndex->readDict(); - help->statusBar()->showMessage(tr("Done"), 3000); - setCursor(Qt::ArrowCursor); - } - keywordDocuments.clear(); -} - -void HelpDialog::setIndexingProgress(int prog) -{ - ui.progressPrepare->setValue(prog); - processEvents(); -} - -void HelpDialog::startSearch() -{ - QString str = ui.termsEdit->text(); - str = str.simplified(); - str = str.replace(QLatin1String("\'"), QLatin1String("\"")); - str = str.replace(QLatin1String("`"), QLatin1String("\"")); - QString buf = str; - str = str.replace(QLatin1String("-"), QLatin1String(" ")); - str = str.replace(QRegExp(QLatin1String("\\s[\\S]?\\s")), QLatin1String(" ")); - terms = str.split(QLatin1Char(' ')); - QStringList termSeq; - QStringList seqWords; - QStringList::iterator it = terms.begin(); - for (; it != terms.end(); ++it) { - (*it) = (*it).simplified(); - (*it) = (*it).toLower(); - (*it) = (*it).replace(QLatin1String("\""), QLatin1String("")); - } - if (str.contains(QLatin1Char('\"'))) { - if ((str.count(QLatin1Char('\"')))%2 == 0) { - int beg = 0; - int end = 0; - QString s; - beg = str.indexOf(QLatin1Char('\"'), beg); - while (beg != -1) { - beg++; - end = str.indexOf(QLatin1Char('\"'), beg); - s = str.mid(beg, end - beg); - s = s.toLower(); - s = s.simplified(); - if (s.contains(QLatin1Char('*'))) { - QMessageBox::warning(this, tr("Full Text Search"), - tr("Using a wildcard within phrases is not allowed.")); - return; - } - seqWords += s.split(QLatin1Char(' ')); - termSeq << s; - beg = str.indexOf(QLatin1Char('\"'), end + 1); - } - } else { - QMessageBox::warning(this, tr("Full Text Search"), - tr("The closing quotation mark is missing.")); - return; - } - } - setCursor(Qt::WaitCursor); - foundDocs.clear(); - foundDocs = fullTextIndex->query(terms, termSeq, seqWords); - QString msg = tr("%n document(s) found.", "", foundDocs.count()); - help->statusBar()->showMessage(tr(msg.toUtf8()), 3000); - ui.resultBox->clear(); - for (it = foundDocs.begin(); it != foundDocs.end(); ++it) - ui.resultBox->addItem(fullTextIndex->getDocumentTitle(*it)); - - terms.clear(); - bool isPhrase = false; - QString s; - for (int i = 0; i < (int)buf.length(); ++i) { - if (buf[i] == QLatin1Char('\"')) { - isPhrase = !isPhrase; - s = s.simplified(); - if (!s.isEmpty()) - terms << s; - s = QLatin1String(""); - } else if (buf[i] == QLatin1Char(' ') && !isPhrase) { - s = s.simplified(); - if (!s.isEmpty()) - terms << s; - s = QLatin1String(""); - } else - s += buf[i]; - } - if (!s.isEmpty()) - terms << s; - - setCursor(Qt::ArrowCursor); -} - -void HelpDialog::on_helpButton_clicked() -{ - emit showLink(MainWindow::urlifyFileName( - Config::configuration()->assistantDocPath() + - QLatin1String("/assistant-manual.html#full-text-searching"))); -} - -void HelpDialog::on_resultBox_itemActivated(QListWidgetItem *item) -{ - showResultPage(item); -} - -void HelpDialog::showResultPage(QListWidgetItem *item) -{ - if (item) - emit showSearchLink(foundDocs[ui.resultBox->row(item)], terms); -} - -void HelpDialog::showIndexItemMenu(const QPoint &pos) -{ - QListView *listView = qobject_cast<QListView*>(sender()); - if (!listView) - return; - - QModelIndex idx = listView->indexAt(pos); - if (!idx.isValid()) - return; - - QAction *action = itemPopup->exec(listView->viewport()->mapToGlobal(pos)); - if (action == actionOpenCurrentTab) { - showTopic(); - } else if (action) { - HelpWindow *hw = help->browsers()->currentBrowser(); - QString itemName = idx.data().toString(); - ui.editIndex->setText(itemName); - QStringList links = indexModel->links(idx.row()); - if (links.count() == 1) { - if (action == actionOpenLinkInNewWindow) - hw->openLinkInNewWindow(links.first()); - else - hw->openLinkInNewPage(links.first()); - } else { - QStringList::Iterator it = links.begin(); - QStringList linkList; - QStringList linkNames; - for (; it != links.end(); ++it) { - linkList << *it; - linkNames << titleOfLink(*it); - } - QString link = TopicChooser::getLink(this, linkNames, linkList, itemName); - if (!link.isEmpty()) { - if (action == actionOpenLinkInNewWindow) - hw->openLinkInNewWindow(link); - else - hw->openLinkInNewPage(link); - } - } - } -} - -void HelpDialog::showListItemMenu(const QPoint &pos) -{ - QListWidget *listWidget = qobject_cast<QListWidget*>(sender()); - if (!listWidget) - return; - QListWidgetItem *item = listWidget->itemAt(pos); - if (!item) - return; - - QAction *action = itemPopup->exec(listWidget->viewport()->mapToGlobal(pos)); - if (action == actionOpenCurrentTab) { - showResultPage(item); - } else if (action) { - HelpWindow *hw = help->browsers()->currentBrowser(); - QString link = foundDocs[ui.resultBox->row(item)]; - if (action == actionOpenLinkInNewWindow) - hw->openLinkInNewWindow(link); - else - hw->openLinkInNewPage(link); - } -} - -void HelpDialog::showTreeItemMenu(const QPoint &pos) -{ - QTreeWidget *treeWidget = qobject_cast<QTreeWidget*>(sender()); - - if (!treeWidget) - return; - - QTreeWidgetItem *item = treeWidget->itemAt(pos); - - if (!item) - return; - - QAction *action = itemPopup->exec(treeWidget->viewport()->mapToGlobal(pos)); - if (action == actionOpenCurrentTab) { - if (ui.tabWidget->currentWidget()->objectName() == QLatin1String("contentPage")) - showContentsTopic(); - else - showBookmarkTopic(); - } else if (action) { - QTreeWidgetItem *i = (QTreeWidgetItem*)item; - if (action == actionOpenLinkInNewWindow) - help->browsers()->currentBrowser()->openLinkInNewWindow(i->data(0, LinkRole).toString()); - else - help->browsers()->currentBrowser()->openLinkInNewPage(i->data(0, LinkRole).toString()); - } -} - -void HelpDialog::on_termsEdit_returnPressed() -{ - startSearch(); -} - -void HelpDialog::updateSearchButton(const QString &txt) -{ - ui.searchButton->setDisabled(txt.isEmpty()); -} - -void HelpDialog::on_searchButton_clicked() -{ - startSearch(); -} - -QString HelpDialog::removeAnchorFromLink(const QString &link) -{ - int i = link.length(); - int j = link.lastIndexOf(QLatin1Char('/')); - int l = link.lastIndexOf(QDir::separator()); - if (l > j) - j = l; - if (j > -1) { - QString fileName = link.mid(j+1); - int k = fileName.lastIndexOf(QLatin1Char('#')); - if (k > -1) - i = j + k + 1; - } - return link.left(i); -} - -QT_END_NAMESPACE diff --git a/tools/assistant/compat/helpdialog.h b/tools/assistant/compat/helpdialog.h deleted file mode 100644 index 4e1bac2..0000000 --- a/tools/assistant/compat/helpdialog.h +++ /dev/null @@ -1,184 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef HELPDIALOG_H -#define HELPDIALOG_H - -#include "ui_helpdialog.h" -#include "index.h" -#include "helpwindow.h" -#include "docuparser.h" - -#include <QList> -#include <QPair> -#include <QListWidget> -#include <QTreeWidget> -#include <QMap> -#include <QStringList> -#include <QValidator> -#include <qmenu.h> -#include <QHash> - -QT_BEGIN_NAMESPACE - -class QProgressBar; -class MainWindow; -class QTextBrowser; -class IndexListModel; - -class HelpNavigationListItem : public QListWidgetItem -{ -public: - HelpNavigationListItem(QListWidget *ls, const QString &txt); - - void addLink(const QString &link); - QStringList links() const { return linkList; } -private: - QStringList linkList; - -}; - -class SearchValidator : public QValidator -{ - Q_OBJECT -public: - SearchValidator(QObject *parent) - : QValidator(parent) {} - ~SearchValidator() {} - QValidator::State validate(QString &str, int &) const; -}; - -class HelpDialog : public QWidget -{ - Q_OBJECT -public: - HelpDialog(QWidget *parent, MainWindow *h); - - inline QTabWidget *tabWidget() const - { return ui.tabWidget; } - - QString titleOfLink(const QString &link); - bool eventFilter(QObject *, QEvent *); - bool lastWindowClosed() { return lwClosed; } - - void timerEvent(QTimerEvent *e); - static QString removeAnchorFromLink(const QString &link); - -signals: - void showLink(const QString &s); - void showSearchLink(const QString &s, const QStringList &terms); - -public slots: - void initialize(); - void startSearch(); - void addBookmark(); - void currentTabChanged(int index); - void locateContents(const QString &link); - -private slots: - void on_buttonAdd_clicked(); - void on_buttonRemove_clicked(); - void on_termsEdit_returnPressed(); - void on_helpButton_clicked(); - void on_searchButton_clicked(); - void on_resultBox_itemActivated(QListWidgetItem*); - void updateSearchButton(const QString &txt); - - void showResultPage(QListWidgetItem *); - - void showTopic(QTreeWidgetItem *); - void loadIndexFile(); - void insertContents(); - void setupFullTextIndex(); - void showTopic(); - void searchInIndex(const QString &s); - void toggleContents(); - void toggleIndex(); - void toggleBookmarks(); - void toggleSearch(); - void lastWinClosed(); - void setIndexingProgress(int prog); - void showListItemMenu(const QPoint &pos); - void showIndexItemMenu(const QPoint &pos); - void showTreeItemMenu(const QPoint &pos); - void insertBookmarks(); - void processEvents(); - -private: - typedef QList<ContentItem> ContentList; - void removeOldCacheFiles(bool onlyFulltextSearchIndex = false); - void buildKeywordDB(); - quint32 getFileAges(); - void showIndexTopic(); - void showBookmarkTopic(); - void setupTitleMap(); - void saveBookmarks(); - void showContentsTopic(); - void showInitDoneMessage(); - void buildContentDict(); - QTreeWidgetItem * locateLink(QTreeWidgetItem *item, const QString &link); - -private: - Ui::HelpDialog ui; - - IndexListModel *indexModel; - QMap<QString, QString> titleMap; - bool indexDone, bookmarksInserted, titleMapDone, contentsInserted; - bool lwClosed; - MainWindow *help; - QString documentationPath; - Index *fullTextIndex; - QStringList terms, foundDocs; - bool initDoneMsgShown; - void getAllContents(); - QList<QPair<QString, ContentList> > contentList; - QMenu *itemPopup; - QString cacheFilesPath; - QStringList keywordDocuments; - - QAction *actionOpenCurrentTab; - QAction *actionOpenLinkInNewWindow; - QAction *actionOpenLinkInNewTab; -}; - -QT_END_NAMESPACE - -#endif // HELPDIALOG_H diff --git a/tools/assistant/compat/helpdialog.ui b/tools/assistant/compat/helpdialog.ui deleted file mode 100644 index 0fc8817..0000000 --- a/tools/assistant/compat/helpdialog.ui +++ /dev/null @@ -1,404 +0,0 @@ -<ui version="4.0" > - <author></author> - <comment>********************************************************************* -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -*********************************************************************</comment> - <exportmacro></exportmacro> - <class>HelpDialog</class> - <widget class="QWidget" name="HelpDialog" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>274</width> - <height>417</height> - </rect> - </property> - <property name="windowTitle" > - <string>Help</string> - </property> - <property name="whatsThis" > - <string><b>Help</b><p>Choose the topic you want help on from the contents list, or search the index for keywords.</p></string> - </property> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QTabWidget" name="tabWidget" > - <property name="whatsThis" > - <string>Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.</string> - </property> - <widget class="QWidget" name="contentPage" > - <attribute name="title" > - <string>Con&tents</string> - </attribute> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>5</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QTreeWidget" name="listContents" > - <property name="contextMenuPolicy" > - <enum>Qt::CustomContextMenu</enum> - </property> - <property name="whatsThis" > - <string><b>Help topics organized by category.</b><p>Double-click an item to see the topics in that category. To view a topic, just double-click it.</p></string> - </property> - <property name="rootIsDecorated" > - <bool>true</bool> - </property> - <property name="uniformRowHeights" > - <bool>true</bool> - </property> - <column> - <property name="text" > - <string>column 1</string> - </property> - </column> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="indexPage" > - <attribute name="title" > - <string>&Index</string> - </attribute> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>5</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="TextLabel1" > - <property name="text" > - <string>&Look For:</string> - </property> - <property name="buddy" > - <cstring>editIndex</cstring> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="editIndex" > - <property name="toolTip" > - <string>Enter keyword</string> - </property> - <property name="whatsThis" > - <string><b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p></string> - </property> - </widget> - </item> - <item> - <widget class="QListView" name="listIndex" > - <property name="contextMenuPolicy" > - <enum>Qt::CustomContextMenu</enum> - </property> - <property name="whatsThis" > - <string><b>List of available help topics.</b><p>Double-click on an item to open its help page. If more than one is found, you must specify which page you want.</p></string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="bookmarkPage" > - <attribute name="title" > - <string>&Bookmarks</string> - </attribute> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>5</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QTreeWidget" name="listBookmarks" > - <property name="contextMenuPolicy" > - <enum>Qt::CustomContextMenu</enum> - </property> - <property name="whatsThis" > - <string>Displays the list of bookmarks.</string> - </property> - <property name="uniformRowHeights" > - <bool>true</bool> - </property> - <column> - <property name="text" > - <string>column 1</string> - </property> - </column> - </widget> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="buttonAdd" > - <property name="toolTip" > - <string>Add new bookmark</string> - </property> - <property name="whatsThis" > - <string>Add the currently displayed page as a new bookmark.</string> - </property> - <property name="text" > - <string>&New</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="buttonRemove" > - <property name="toolTip" > - <string>Delete bookmark</string> - </property> - <property name="whatsThis" > - <string>Delete the selected bookmark.</string> - </property> - <property name="text" > - <string>&Delete</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="searchPage" > - <attribute name="title" > - <string>&Search</string> - </attribute> - <layout class="QGridLayout" > - <property name="margin" > - <number>5</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="3" column="0" > - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="0" column="0" > - <widget class="QLabel" name="TextLabel1_2" > - <property name="text" > - <string>Searching f&or:</string> - </property> - <property name="buddy" > - <cstring>termsEdit</cstring> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QLineEdit" name="termsEdit" > - <property name="toolTip" > - <string>Enter searchword(s)</string> - </property> - <property name="whatsThis" > - <string><b>Enter search word(s).</b><p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.</p></string> - </property> - </widget> - </item> - <item row="5" column="0" > - <widget class="QListWidget" name="resultBox" > - <property name="contextMenuPolicy" > - <enum>Qt::CustomContextMenu</enum> - </property> - <property name="whatsThis" > - <string><b>Found documents</b><p>This list contains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p></string> - </property> - </widget> - </item> - <item row="4" column="0" > - <widget class="QLabel" name="TextLabel2" > - <property name="text" > - <string>Found &Documents:</string> - </property> - <property name="buddy" > - <cstring>resultBox</cstring> - </property> - </widget> - </item> - <item row="2" column="0" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QPushButton" name="helpButton" > - <property name="toolTip" > - <string>Display the help page</string> - </property> - <property name="whatsThis" > - <string>Display the help page for the full text search.</string> - </property> - <property name="text" > - <string>He&lp</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>61</width> - <height>21</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="searchButton" > - <property name="toolTip" > - <string>Start searching</string> - </property> - <property name="whatsThis" > - <string>Pressing this button starts the search.</string> - </property> - <property name="text" > - <string>&Search</string> - </property> - <property name="enabled" > - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <widget class="QFrame" name="framePrepare" > - <property name="frameShape" > - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Raised</enum> - </property> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>3</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="labelPrepare" > - <property name="text" > - <string>Preparing...</string> - </property> - </widget> - </item> - <item> - <widget class="QProgressBar" name="progressPrepare" /> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <pixmapfunction></pixmapfunction> - <tabstops> - <tabstop>tabWidget</tabstop> - <tabstop>listContents</tabstop> - <tabstop>editIndex</tabstop> - <tabstop>listIndex</tabstop> - <tabstop>listBookmarks</tabstop> - <tabstop>buttonAdd</tabstop> - <tabstop>buttonRemove</tabstop> - <tabstop>termsEdit</tabstop> - <tabstop>searchButton</tabstop> - <tabstop>helpButton</tabstop> - <tabstop>resultBox</tabstop> - </tabstops> - <resources/> - <connections/> -</ui> diff --git a/tools/assistant/compat/helpwindow.cpp b/tools/assistant/compat/helpwindow.cpp deleted file mode 100644 index 6674342..0000000 --- a/tools/assistant/compat/helpwindow.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "helpwindow.h" -#include "mainwindow.h" -#include "tabbedbrowser.h" -#include "helpdialog.h" -#include "config.h" - -#include <QApplication> -#include <QClipboard> -#include <QUrl> -#include <QMessageBox> -#include <QDir> -#include <QFile> -#include <QProcess> -#include <QAction> -#include <QFileInfo> -#include <QFont> -#include <QtEvents> -#include <QTextStream> -#include <QTextCodec> -#include <QStatusBar> -#include <QTextCursor> -#include <QTextObject> -#include <QTextLayout> -#include <QtDebug> -#include <qdesktopservices.h> - -#include <QtGui/QClipboard> -#include <QtGui/QApplication> - -#if defined(Q_OS_WIN32) -# include <windows.h> -#endif - -QT_BEGIN_NAMESPACE - -HelpWindow::HelpWindow(MainWindow *w, QWidget *parent) - : QTextBrowser(parent) - , mw(w) - , blockScroll(false) - , shiftPressed(false) - , newWindow(false) -{ - FontSettings settings = Config::configuration()->fontSettings(); - setFont(settings.browserFont); - - connect(this, SIGNAL(copyAvailable(bool)), w, SLOT(copyAvailable(bool))); -} - -void HelpWindow::setSource(const QUrl &name) -{ - if (name.isValid()) { - if (name.scheme() == QLatin1String("http") || name.scheme() == QLatin1String("ftp") - || name.scheme() == QLatin1String("mailto") || name.path().endsWith(QLatin1String("pdf"))) { - bool launched = QDesktopServices::openUrl(name); - if (!launched) { - QMessageBox::information(mw, tr("Help"), - tr("Unable to launch web browser.\n"), - tr("OK")); - } - return; - } - - QFileInfo fi(name.toLocalFile()); - if (name.scheme() == QLatin1String("file") && fi.exists()) { - if (newWindow || (shiftPressed && hasFocus())) { - shiftPressed = false; - mw->saveSettings(); - MainWindow *nmw = new MainWindow; - nmw->move(mw->geometry().topLeft()); - nmw->show(); - - if (mw->isMaximized()) - nmw->showMaximized(); - - nmw->setup(); - nmw->showLink(name.toString()); - } else { - QTextBrowser::setSource(name); - QTextBrowser::scrollToAnchor(name.fragment()); - } - return; - } - } - - mw->statusBar()->showMessage(tr("Failed to open link: '%1'").arg(name.toString()), 5000); - setHtml(tr("<div align=\"center\"><h1>The page could not be found</h1><br>" - "<h3>'%1'</h3></div>").arg(name.toString())); - mw->browsers()->updateTitle(tr("Error...")); -} - -void HelpWindow::openLinkInNewWindow() -{ - if (lastAnchor.isEmpty()) - return; - newWindow = true; - setSource(lastAnchor); - newWindow = false; -} - -void HelpWindow::openLinkInNewWindow(const QString &link) -{ - lastAnchor = link; - openLinkInNewWindow(); -} - -void HelpWindow::openLinkInNewPage() -{ - if(lastAnchor.isEmpty()) - return; - mw->browsers()->newTab(lastAnchor); - lastAnchor.clear(); -} - -void HelpWindow::openLinkInNewPage(const QString &link) -{ - lastAnchor = link; - openLinkInNewPage(); -} - -bool HelpWindow::hasAnchorAt(const QPoint& pos) -{ - lastAnchor = anchorAt(pos); - if (lastAnchor.isEmpty()) - return false; - lastAnchor = source().resolved(lastAnchor).toString(); - if (lastAnchor.at(0) == QLatin1Char('#')) { - QString src = source().toString(); - int hsh = src.indexOf(QLatin1Char('#')); - lastAnchor = (hsh>=0 ? src.left(hsh) : src) + lastAnchor; - } - return true; -} - -void HelpWindow::contextMenuEvent(QContextMenuEvent *e) -{ - QMenu menu(QLatin1String(""), 0); - - QUrl link; - QAction *copyAnchorAction = 0; - if (hasAnchorAt(e->pos())) { - link = anchorAt(e->pos()); - if (link.isRelative()) - link = source().resolved(link); - copyAnchorAction = menu.addAction(tr("Copy &Link Location")); - copyAnchorAction->setEnabled(!link.isEmpty() && link.isValid()); - - menu.addAction(tr("Open Link in New Tab"), - this, SLOT(openLinkInNewPage())); - menu.addAction(tr("Open Link in New Window\tShift+LMB"), - this, SLOT(openLinkInNewWindow())); - } - mw->setupPopupMenu(&menu); - QAction *action = menu.exec(e->globalPos()); - if (action == copyAnchorAction) - QApplication::clipboard()->setText(link.toString()); -} - -void HelpWindow::mouseReleaseEvent(QMouseEvent *e) -{ - if (e->button() == Qt::XButton1) { - QTextBrowser::backward(); - return; - } - - if (e->button() == Qt::XButton2) { - QTextBrowser::forward(); - return; - } - - if (e->button() == Qt::MidButton && hasAnchorAt(e->pos())) { - openLinkInNewPage(); - return; - } - QTextBrowser::mouseReleaseEvent(e); -} - -void HelpWindow::blockScrolling(bool b) -{ - blockScroll = b; -} - -void HelpWindow::ensureCursorVisible() -{ - if (!blockScroll) - QTextBrowser::ensureCursorVisible(); -} - -void HelpWindow::mousePressEvent(QMouseEvent *e) -{ - shiftPressed = e->modifiers() & Qt::ShiftModifier; - if (!(shiftPressed && hasAnchorAt(e->pos()))) - QTextBrowser::mousePressEvent(e); -} - -void HelpWindow::keyPressEvent(QKeyEvent *e) -{ - shiftPressed = e->modifiers() & Qt::ShiftModifier; - QTextBrowser::keyPressEvent(e); -} - -bool HelpWindow::isKDERunning() const -{ - return !qgetenv("KDE_FULL_SESSION").isEmpty(); -} - -QT_END_NAMESPACE diff --git a/tools/assistant/compat/helpwindow.h b/tools/assistant/compat/helpwindow.h deleted file mode 100644 index c20a21f..0000000 --- a/tools/assistant/compat/helpwindow.h +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef HELPWINDOW_H -#define HELPWINDOW_H - -#include <QTextBrowser> - -QT_BEGIN_NAMESPACE - -class MainWindow; -class QKeyEvent; -class QMime; -class QMouseEvent; -class QMenu; - -class HelpWindow : public QTextBrowser -{ - Q_OBJECT -public: - HelpWindow( MainWindow *m, QWidget *parent = 0); - void setSource( const QUrl &name ); - void blockScrolling( bool b ); - void openLinkInNewWindow( const QString &link ); - void openLinkInNewPage( const QString &link ); - void addMimePath( const QString &path ); - - void mousePressEvent(QMouseEvent *e); - void keyPressEvent(QKeyEvent *); - -signals: - void chooseWebBrowser(); - void choosePDFReader(); - -protected: - virtual void contextMenuEvent(QContextMenuEvent *e); - virtual void mouseReleaseEvent(QMouseEvent *e); - -protected slots: - void ensureCursorVisible(); - -private slots: - void openLinkInNewWindow(); - void openLinkInNewPage(); - - bool isKDERunning() const; - -private: - bool hasAnchorAt(const QPoint& pos); - - MainWindow *mw; - QString lastAnchor; - bool blockScroll; - bool shiftPressed; - bool newWindow; - bool fwdAvail; - bool backAvail; -}; - -QT_END_NAMESPACE - -#endif // HELPWINDOW_H diff --git a/tools/assistant/compat/images/assistant-128.png b/tools/assistant/compat/images/assistant-128.png Binary files differdeleted file mode 100644 index f05949f..0000000 --- a/tools/assistant/compat/images/assistant-128.png +++ /dev/null diff --git a/tools/assistant/compat/images/assistant.png b/tools/assistant/compat/images/assistant.png Binary files differdeleted file mode 100644 index ea4d1e7..0000000 --- a/tools/assistant/compat/images/assistant.png +++ /dev/null diff --git a/tools/assistant/compat/images/close.png b/tools/assistant/compat/images/close.png Binary files differdeleted file mode 100644 index 540694e..0000000 --- a/tools/assistant/compat/images/close.png +++ /dev/null diff --git a/tools/assistant/compat/images/designer.png b/tools/assistant/compat/images/designer.png Binary files differdeleted file mode 100644 index 72c42e7..0000000 --- a/tools/assistant/compat/images/designer.png +++ /dev/null diff --git a/tools/assistant/compat/images/linguist.png b/tools/assistant/compat/images/linguist.png Binary files differdeleted file mode 100644 index d388cbd..0000000 --- a/tools/assistant/compat/images/linguist.png +++ /dev/null diff --git a/tools/assistant/compat/images/mac/addtab.png b/tools/assistant/compat/images/mac/addtab.png Binary files differdeleted file mode 100644 index 20928fb..0000000 --- a/tools/assistant/compat/images/mac/addtab.png +++ /dev/null diff --git a/tools/assistant/compat/images/mac/book.png b/tools/assistant/compat/images/mac/book.png Binary files differdeleted file mode 100644 index 7a3204c..0000000 --- a/tools/assistant/compat/images/mac/book.png +++ /dev/null diff --git a/tools/assistant/compat/images/mac/closetab.png b/tools/assistant/compat/images/mac/closetab.png Binary files differdeleted file mode 100644 index ab9d669..0000000 --- a/tools/assistant/compat/images/mac/closetab.png +++ /dev/null diff --git a/tools/assistant/compat/images/mac/editcopy.png b/tools/assistant/compat/images/mac/editcopy.png Binary files differdeleted file mode 100644 index f551364..0000000 --- a/tools/assistant/compat/images/mac/editcopy.png +++ /dev/null diff --git a/tools/assistant/compat/images/mac/find.png b/tools/assistant/compat/images/mac/find.png Binary files differdeleted file mode 100644 index 3561745..0000000 --- a/tools/assistant/compat/images/mac/find.png +++ /dev/null diff --git a/tools/assistant/compat/images/mac/home.png b/tools/assistant/compat/images/mac/home.png Binary files differdeleted file mode 100644 index 78d94da..0000000 --- a/tools/assistant/compat/images/mac/home.png +++ /dev/null diff --git a/tools/assistant/compat/images/mac/next.png b/tools/assistant/compat/images/mac/next.png Binary files differdeleted file mode 100644 index a585cab..0000000 --- a/tools/assistant/compat/images/mac/next.png +++ /dev/null diff --git a/tools/assistant/compat/images/mac/prev.png b/tools/assistant/compat/images/mac/prev.png Binary files differdeleted file mode 100644 index 612fb34..0000000 --- a/tools/assistant/compat/images/mac/prev.png +++ /dev/null diff --git a/tools/assistant/compat/images/mac/print.png b/tools/assistant/compat/images/mac/print.png Binary files differdeleted file mode 100644 index 10ca56c..0000000 --- a/tools/assistant/compat/images/mac/print.png +++ /dev/null diff --git a/tools/assistant/compat/images/mac/synctoc.png b/tools/assistant/compat/images/mac/synctoc.png Binary files differdeleted file mode 100644 index 067fa94..0000000 --- a/tools/assistant/compat/images/mac/synctoc.png +++ /dev/null diff --git a/tools/assistant/compat/images/mac/whatsthis.png b/tools/assistant/compat/images/mac/whatsthis.png Binary files differdeleted file mode 100644 index 5b7078f..0000000 --- a/tools/assistant/compat/images/mac/whatsthis.png +++ /dev/null diff --git a/tools/assistant/compat/images/mac/zoomin.png b/tools/assistant/compat/images/mac/zoomin.png Binary files differdeleted file mode 100644 index d46f5af..0000000 --- a/tools/assistant/compat/images/mac/zoomin.png +++ /dev/null diff --git a/tools/assistant/compat/images/mac/zoomout.png b/tools/assistant/compat/images/mac/zoomout.png Binary files differdeleted file mode 100644 index 4632656..0000000 --- a/tools/assistant/compat/images/mac/zoomout.png +++ /dev/null diff --git a/tools/assistant/compat/images/qt.png b/tools/assistant/compat/images/qt.png Binary files differdeleted file mode 100644 index 2dc6716..0000000 --- a/tools/assistant/compat/images/qt.png +++ /dev/null diff --git a/tools/assistant/compat/images/win/addtab.png b/tools/assistant/compat/images/win/addtab.png Binary files differdeleted file mode 100644 index 4bb0feb..0000000 --- a/tools/assistant/compat/images/win/addtab.png +++ /dev/null diff --git a/tools/assistant/compat/images/win/book.png b/tools/assistant/compat/images/win/book.png Binary files differdeleted file mode 100644 index 09ec4d3..0000000 --- a/tools/assistant/compat/images/win/book.png +++ /dev/null diff --git a/tools/assistant/compat/images/win/closetab.png b/tools/assistant/compat/images/win/closetab.png Binary files differdeleted file mode 100644 index ef9e020..0000000 --- a/tools/assistant/compat/images/win/closetab.png +++ /dev/null diff --git a/tools/assistant/compat/images/win/editcopy.png b/tools/assistant/compat/images/win/editcopy.png Binary files differdeleted file mode 100644 index 1121b47..0000000 --- a/tools/assistant/compat/images/win/editcopy.png +++ /dev/null diff --git a/tools/assistant/compat/images/win/find.png b/tools/assistant/compat/images/win/find.png Binary files differdeleted file mode 100644 index 6ea35e9..0000000 --- a/tools/assistant/compat/images/win/find.png +++ /dev/null diff --git a/tools/assistant/compat/images/win/home.png b/tools/assistant/compat/images/win/home.png Binary files differdeleted file mode 100644 index b1c6ae1..0000000 --- a/tools/assistant/compat/images/win/home.png +++ /dev/null diff --git a/tools/assistant/compat/images/win/next.png b/tools/assistant/compat/images/win/next.png Binary files differdeleted file mode 100644 index 8df4127..0000000 --- a/tools/assistant/compat/images/win/next.png +++ /dev/null diff --git a/tools/assistant/compat/images/win/previous.png b/tools/assistant/compat/images/win/previous.png Binary files differdeleted file mode 100644 index 0780bc2..0000000 --- a/tools/assistant/compat/images/win/previous.png +++ /dev/null diff --git a/tools/assistant/compat/images/win/print.png b/tools/assistant/compat/images/win/print.png Binary files differdeleted file mode 100644 index ba7c02d..0000000 --- a/tools/assistant/compat/images/win/print.png +++ /dev/null diff --git a/tools/assistant/compat/images/win/synctoc.png b/tools/assistant/compat/images/win/synctoc.png Binary files differdeleted file mode 100644 index da301bc..0000000 --- a/tools/assistant/compat/images/win/synctoc.png +++ /dev/null diff --git a/tools/assistant/compat/images/win/whatsthis.png b/tools/assistant/compat/images/win/whatsthis.png Binary files differdeleted file mode 100644 index 623cad6..0000000 --- a/tools/assistant/compat/images/win/whatsthis.png +++ /dev/null diff --git a/tools/assistant/compat/images/win/zoomin.png b/tools/assistant/compat/images/win/zoomin.png Binary files differdeleted file mode 100644 index 2e586fc..0000000 --- a/tools/assistant/compat/images/win/zoomin.png +++ /dev/null diff --git a/tools/assistant/compat/images/win/zoomout.png b/tools/assistant/compat/images/win/zoomout.png Binary files differdeleted file mode 100644 index a736d39..0000000 --- a/tools/assistant/compat/images/win/zoomout.png +++ /dev/null diff --git a/tools/assistant/compat/images/wrap.png b/tools/assistant/compat/images/wrap.png Binary files differdeleted file mode 100644 index 90f18d9..0000000 --- a/tools/assistant/compat/images/wrap.png +++ /dev/null diff --git a/tools/assistant/compat/index.cpp b/tools/assistant/compat/index.cpp deleted file mode 100644 index ff54626..0000000 --- a/tools/assistant/compat/index.cpp +++ /dev/null @@ -1,581 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "index.h" - -#include <QFile> -#include <QDir> -#include <QStringList> -#include <QApplication> -#include <QByteArray> -#include <QTextStream> -#include <QtAlgorithms> -#include <QUrl> -#include <QTextCodec> -#include <ctype.h> -#include <QTextDocument> - -QT_BEGIN_NAMESPACE - -struct Term { - Term() : frequency(-1) {} - Term( const QString &t, int f, QVector<Document> l ) : term( t ), frequency( f ), documents( l ) {} - QString term; - int frequency; - QVector<Document>documents; - bool operator<( const Term &i2 ) const { return frequency < i2.frequency; } -}; - -QDataStream &operator>>( QDataStream &s, Document &l ) -{ - s >> l.docNumber; - s >> l.frequency; - return s; -} - -QDataStream &operator<<( QDataStream &s, const Document &l ) -{ - s << (qint16)l.docNumber; - s << (qint16)l.frequency; - return s; -} - -Index::Index( const QString &dp, const QString &hp ) - : QObject( 0 ), docPath( dp ) -{ - Q_UNUSED(hp); - - alreadyHaveDocList = false; - lastWindowClosed = false; - connect( qApp, SIGNAL(lastWindowClosed()), - this, SLOT(setLastWinClosed()) ); -} - -Index::Index( const QStringList &dl, const QString &hp ) - : QObject( 0 ) -{ - Q_UNUSED(hp); - docList = dl; - alreadyHaveDocList = true; - lastWindowClosed = false; - connect( qApp, SIGNAL(lastWindowClosed()), - this, SLOT(setLastWinClosed()) ); -} - -void Index::setLastWinClosed() -{ - lastWindowClosed = true; -} - -void Index::setDictionaryFile( const QString &f ) -{ - dictFile = f; -} - -void Index::setDocListFile( const QString &f ) -{ - docListFile = f; -} - -void Index::setDocList( const QStringList &lst ) -{ - docList = lst; -} - -int Index::makeIndex() -{ - if ( !alreadyHaveDocList ) - setupDocumentList(); - if ( docList.isEmpty() ) - return 1; - QStringList::Iterator it = docList.begin(); - int steps = docList.count() / 100; - if ( !steps ) - steps++; - int prog = 0; - for ( int i = 0; it != docList.end(); ++it, ++i ) { - if ( lastWindowClosed ) { - return -1; - } - QUrl url(*it); - parseDocument( url.toLocalFile(), i ); - if ( i%steps == 0 ) { - prog++; - emit indexingProgress( prog ); - } - } - return 0; -} - -void Index::setupDocumentList() -{ - QDir d( docPath ); - QStringList filters; - filters.append(QLatin1String("*.html")); - QStringList lst = d.entryList(filters); - QStringList::ConstIterator it = lst.constBegin(); - for ( ; it != lst.constEnd(); ++it ) - docList.append( QLatin1String("file:") + docPath + QLatin1String("/") + *it ); -} - -void Index::insertInDict( const QString &str, int docNum ) -{ - if ( str == QLatin1String("amp") || str == QLatin1String("nbsp")) - return; - Entry *e = 0; - if ( dict.count() ) - e = dict[ str ]; - - if ( e ) { - if ( e->documents.last().docNumber != docNum ) - e->documents.append( Document(docNum, 1 ) ); - else - e->documents.last().frequency++; - } else { - dict.insert( str, new Entry( docNum ) ); - } -} - -QString Index::getCharsetForDocument(QFile *file) -{ - QTextStream s(file); - QString contents = s.readAll(); - - QString encoding; - int start = contents.indexOf(QLatin1String("<meta"), 0, Qt::CaseInsensitive); - if (start > 0) { - int end = contents.indexOf(QLatin1String(">"), start); - QString meta = contents.mid(start+5, end-start); - meta = meta.toLower(); - QRegExp r(QLatin1String("charset=([^\"\\s]+)")); - if (r.indexIn(meta) != -1) { - encoding = r.cap(1); - } - } - - file->seek(0); - if (encoding.isEmpty()) - return QLatin1String("utf-8"); - return encoding; -} - -void Index::parseDocument( const QString &filename, int docNum ) -{ - QFile file( filename ); - if ( !file.open(QFile::ReadOnly) ) { - qWarning( "can not open file %s", qPrintable(filename) ); - return; - } - - QTextStream s(&file); - QString en = getCharsetForDocument(&file); - s.setCodec(QTextCodec::codecForName(en.toLatin1().constData())); - - QString text = s.readAll(); - if (text.isNull()) - return; - - bool valid = true; - const QChar *buf = text.unicode(); - QChar str[64]; - QChar c = buf[0]; - int j = 0; - int i = 0; - while ( j < text.length() ) { - if ( c == QLatin1Char('<') || c == QLatin1Char('&') ) { - valid = false; - if ( i > 1 ) - insertInDict( QString(str,i), docNum ); - i = 0; - c = buf[++j]; - continue; - } - if ( ( c == QLatin1Char('>') || c == QLatin1Char(';') ) && !valid ) { - valid = true; - c = buf[++j]; - continue; - } - if ( !valid ) { - c = buf[++j]; - continue; - } - if ( ( c.isLetterOrNumber() || c == QLatin1Char('_') ) && i < 63 ) { - str[i] = c.toLower(); - ++i; - } else { - if ( i > 1 ) - insertInDict( QString(str,i), docNum ); - i = 0; - } - c = buf[++j]; - } - if ( i > 1 ) - insertInDict( QString(str,i), docNum ); - file.close(); -} - -void Index::writeDict() -{ - QFile f( dictFile ); - if ( !f.open(QFile::WriteOnly ) ) - return; - QDataStream s( &f ); - for(QHash<QString, Entry *>::Iterator it = dict.begin(); it != dict.end(); ++it) { - s << it.key(); - s << it.value()->documents.count(); - s << it.value()->documents; - } - f.close(); - writeDocumentList(); -} - -void Index::writeDocumentList() -{ - QFile f( docListFile ); - if ( !f.open(QFile::WriteOnly ) ) - return; - QDataStream s( &f ); - s << docList; -} - -void Index::readDict() -{ - QFile f( dictFile ); - if ( !f.open(QFile::ReadOnly ) ) - return; - - dict.clear(); - QDataStream s( &f ); - QString key; - int numOfDocs; - QVector<Document> docs; - while ( !s.atEnd() ) { - s >> key; - s >> numOfDocs; - docs.resize(numOfDocs); - s >> docs; - dict.insert( key, new Entry( docs ) ); - } - f.close(); - readDocumentList(); -} - -void Index::readDocumentList() -{ - QFile f( docListFile ); - if ( !f.open(QFile::ReadOnly ) ) - return; - QDataStream s( &f ); - s >> docList; -} - -QStringList Index::query( const QStringList &terms, const QStringList &termSeq, const QStringList &seqWords ) -{ - QList<Term> termList; - for (QStringList::ConstIterator it = terms.begin(); it != terms.end(); ++it ) { - Entry *e = 0; - if ( (*it).contains(QLatin1Char('*')) ) { - QVector<Document> wcts = setupDummyTerm( getWildcardTerms( *it ) ); - termList.append( Term(QLatin1String("dummy"), wcts.count(), wcts ) ); - } else if ( dict[ *it ] ) { - e = dict[ *it ]; - termList.append( Term( *it, e->documents.count(), e->documents ) ); - } else { - return QStringList(); - } - } - if ( !termList.count() ) - return QStringList(); - qSort(termList); - - QVector<Document> minDocs = termList.takeFirst().documents; - for(QList<Term>::Iterator it = termList.begin(); it != termList.end(); ++it) { - Term *t = &(*it); - QVector<Document> docs = t->documents; - for(QVector<Document>::Iterator minDoc_it = minDocs.begin(); minDoc_it != minDocs.end(); ) { - bool found = false; - for (QVector<Document>::ConstIterator doc_it = docs.constBegin(); doc_it != docs.constEnd(); ++doc_it ) { - if ( (*minDoc_it).docNumber == (*doc_it).docNumber ) { - (*minDoc_it).frequency += (*doc_it).frequency; - found = true; - break; - } - } - if ( !found ) - minDoc_it = minDocs.erase( minDoc_it ); - else - ++minDoc_it; - } - } - - QStringList results; - qSort( minDocs ); - if ( termSeq.isEmpty() ) { - for(QVector<Document>::Iterator it = minDocs.begin(); it != minDocs.end(); ++it) - results << docList.at((int)(*it).docNumber); - return results; - } - - QString fileName; - for(QVector<Document>::Iterator it = minDocs.begin(); it != minDocs.end(); ++it) { - fileName = docList[ (int)(*it).docNumber ]; - if ( searchForPattern( termSeq, seqWords, fileName ) ) - results << fileName; - } - return results; -} - -QString Index::getDocumentTitle( const QString &fullFileName ) -{ - QUrl url(fullFileName); - QString fileName = url.toLocalFile(); - - if (documentTitleCache.contains(fileName)) - return documentTitleCache.value(fileName); - - QFile file( fileName ); - if ( !file.open( QFile::ReadOnly ) ) { - qWarning( "cannot open file %s", qPrintable(fileName) ); - return fileName; - } - QTextStream s( &file ); - QString text = s.readAll(); - - int start = text.indexOf(QLatin1String("<title>"), 0, Qt::CaseInsensitive) + 7; - int end = text.indexOf(QLatin1String("</title>"), 0, Qt::CaseInsensitive); - - QString title = tr("Untitled"); - if (end - start > 0) { - title = text.mid(start, end - start); - if (Qt::mightBeRichText(title)) { - QTextDocument doc; - doc.setHtml(title); - title = doc.toPlainText(); - } - } - documentTitleCache.insert(fileName, title); - return title; -} - -QStringList Index::getWildcardTerms( const QString &term ) -{ - QStringList lst; - QStringList terms = split( term ); - QStringList::Iterator iter; - - for(QHash<QString, Entry*>::Iterator it = dict.begin(); it != dict.end(); ++it) { - int index = 0; - bool found = false; - QString text( it.key() ); - for ( iter = terms.begin(); iter != terms.end(); ++iter ) { - if ( *iter == QLatin1String("*") ) { - found = true; - continue; - } - if ( iter == terms.begin() && (*iter)[0] != text[0] ) { - found = false; - break; - } - index = text.indexOf( *iter, index ); - if ( *iter == terms.last() && index != (int)text.length()-1 ) { - index = text.lastIndexOf( *iter ); - if ( index != (int)text.length() - (int)(*iter).length() ) { - found = false; - break; - } - } - if ( index != -1 ) { - found = true; - index += (*iter).length(); - continue; - } else { - found = false; - break; - } - } - if ( found ) - lst << text; - } - - return lst; -} - -QStringList Index::split( const QString &str ) -{ - QStringList lst; - int j = 0; - int i = str.indexOf(QLatin1Char('*'), j ); - - if (str.startsWith(QLatin1String("*"))) - lst << QLatin1String("*"); - - while ( i != -1 ) { - if ( i > j && i <= (int)str.length() ) { - lst << str.mid( j, i - j ); - lst << QLatin1String("*"); - } - j = i + 1; - i = str.indexOf(QLatin1Char('*'), j ); - } - - int l = str.length() - 1; - if ( str.mid( j, l - j + 1 ).length() > 0 ) - lst << str.mid( j, l - j + 1 ); - - return lst; -} - -QVector<Document> Index::setupDummyTerm( const QStringList &terms ) -{ - QList<Term> termList; - for (QStringList::ConstIterator it = terms.begin(); it != terms.end(); ++it) { - Entry *e = 0; - if ( dict[ *it ] ) { - e = dict[ *it ]; - termList.append( Term( *it, e->documents.count(), e->documents ) ); - } - } - QVector<Document> maxList(0); - if ( !termList.count() ) - return maxList; - qSort(termList); - - maxList = termList.takeLast().documents; - for(QList<Term>::Iterator it = termList.begin(); it != termList.end(); ++it) { - Term *t = &(*it); - QVector<Document> docs = t->documents; - for (QVector<Document>::iterator docIt = docs.begin(); docIt != docs.end(); ++docIt ) { - if ( maxList.indexOf( *docIt ) == -1 ) - maxList.append( *docIt ); - } - } - return maxList; -} - -void Index::buildMiniDict( const QString &str ) -{ - if ( miniDict[ str ] ) - miniDict[ str ]->positions.append( wordNum ); - ++wordNum; -} - -bool Index::searchForPattern( const QStringList &patterns, const QStringList &words, const QString &fileName ) -{ - QUrl url(fileName); - QString fName = url.toLocalFile(); - QFile file( fName ); - if ( !file.open( QFile::ReadOnly ) ) { - qWarning( "cannot open file %s", qPrintable(fName) ); - return false; - } - - wordNum = 3; - miniDict.clear(); - QStringList::ConstIterator cIt = words.begin(); - for ( ; cIt != words.end(); ++cIt ) - miniDict.insert( *cIt, new PosEntry( 0 ) ); - - QTextStream s( &file ); - QString text = s.readAll(); - bool valid = true; - const QChar *buf = text.unicode(); - QChar str[64]; - QChar c = buf[0]; - int j = 0; - int i = 0; - while ( j < text.length() ) { - if ( c == QLatin1Char('<') || c == QLatin1Char('&') ) { - valid = false; - if ( i > 1 ) - buildMiniDict( QString(str,i) ); - i = 0; - c = buf[++j]; - continue; - } - if ( ( c == QLatin1Char('>') || c == QLatin1Char(';') ) && !valid ) { - valid = true; - c = buf[++j]; - continue; - } - if ( !valid ) { - c = buf[++j]; - continue; - } - if ( ( c.isLetterOrNumber() || c == QLatin1Char('_') ) && i < 63 ) { - str[i] = c.toLower(); - ++i; - } else { - if ( i > 1 ) - buildMiniDict( QString(str,i) ); - i = 0; - } - c = buf[++j]; - } - if ( i > 1 ) - buildMiniDict( QString(str,i) ); - file.close(); - - QStringList::ConstIterator patIt = patterns.begin(); - QStringList wordLst; - QList<uint> a, b; - QList<uint>::iterator aIt; - for ( ; patIt != patterns.end(); ++patIt ) { - wordLst = (*patIt).split(QLatin1Char(' ')); - a = miniDict[ wordLst[0] ]->positions; - for ( int j = 1; j < (int)wordLst.count(); ++j ) { - b = miniDict[ wordLst[j] ]->positions; - aIt = a.begin(); - while ( aIt != a.end() ) { - if ( b.contains( *aIt + 1 )) { - (*aIt)++; - ++aIt; - } else { - aIt = a.erase( aIt ); - } - } - } - } - if ( a.count() ) - return true; - return false; -} - -QT_END_NAMESPACE diff --git a/tools/assistant/compat/index.h b/tools/assistant/compat/index.h deleted file mode 100644 index 9dd6d54..0000000 --- a/tools/assistant/compat/index.h +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INDEX_H -#define INDEX_H - -#include <QStringList> -#include <QHash> -#include <QDataStream> -#include <QObject> -#include <QList> -#include <QFile> -#include <QVector> - -QT_BEGIN_NAMESPACE - -struct Document { - Document( int d, int f ) : docNumber( d ), frequency( f ) {} - Document() : docNumber( -1 ), frequency( 0 ) {} - bool operator==( const Document &doc ) const { - return docNumber == doc.docNumber; - } - bool operator<( const Document &doc ) const { - return frequency > doc.frequency; - } - bool operator<=( const Document &doc ) const { - return frequency >= doc.frequency; - } - bool operator>( const Document &doc ) const { - return frequency < doc.frequency; - } - qint16 docNumber; - qint16 frequency; -}; - -QDataStream &operator>>( QDataStream &s, Document &l ); -QDataStream &operator<<( QDataStream &s, const Document &l ); - -class Index : public QObject -{ - Q_OBJECT -public: - struct Entry { - Entry( int d ) { documents.append( Document( d, 1 ) ); } - Entry( QVector<Document> l ) : documents( l ) {} - QVector<Document> documents; - }; - struct PosEntry { - PosEntry( int p ) { positions.append( p ); } - QList<uint> positions; - }; - - Index( const QString &dp, const QString &hp ); - Index( const QStringList &dl, const QString &hp ); - void writeDict(); - void readDict(); - int makeIndex(); - QStringList query( const QStringList&, const QStringList&, const QStringList& ); - QString getDocumentTitle( const QString& ); - void setDictionaryFile( const QString& ); - void setDocListFile( const QString& ); - void setDocList( const QStringList & ); - -signals: - void indexingProgress( int ); - -private slots: - void setLastWinClosed(); - -private: - void setupDocumentList(); - void parseDocument( const QString&, int ); - void insertInDict( const QString&, int ); - void writeDocumentList(); - void readDocumentList(); - QStringList getWildcardTerms( const QString& ); - QStringList split( const QString& ); - QVector<Document> setupDummyTerm( const QStringList& ); - bool searchForPattern( const QStringList&, const QStringList&, const QString& ); - void buildMiniDict( const QString& ); - QString getCharsetForDocument(QFile *); - QStringList docList; - QHash<QString, Entry*> dict; - QHash<QString, PosEntry*> miniDict; - uint wordNum; - QString docPath; - QString dictFile, docListFile; - bool alreadyHaveDocList; - bool lastWindowClosed; - QHash<QString, QString> documentTitleCache; -}; - -#endif - -QT_END_NAMESPACE diff --git a/tools/assistant/compat/lib/lib.pro b/tools/assistant/compat/lib/lib.pro deleted file mode 100644 index e50d470..0000000 --- a/tools/assistant/compat/lib/lib.pro +++ /dev/null @@ -1,78 +0,0 @@ -TEMPLATE = lib -QT += network -TARGET = QtAssistantClient -isEmpty(QT_MAJOR_VERSION) { - VERSION=4.3.0 -} else { - VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} -} - -CONFIG += qt warn_on -mac|win32:CONFIG += debug_and_release -mac:unix:CONFIG += explicitlib -CONFIG -= dll - -HEADERS = qassistantclient.h \ - qassistantclient_global.h -SOURCES = qassistantclient.cpp - -DESTDIR = ../../../../lib -DLLDESTDIR = ../../../../bin - -unix { - QMAKE_CFLAGS += $$QMAKE_CFLAGS_SHLIB - QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_SHLIB -} - -DEFINES += QT_ASSISTANT_CLIENT_LIBRARY -contains(CONFIG, static) { - DEFINES += QT_ASSISTANT_CLIENT_STATIC -} - -#load up the headers info -CONFIG += qt_install_headers -HEADERS_PRI = $$QT_BUILD_TREE/include/QtAssistant/headers.pri -include($$HEADERS_PRI, "", true)|clear(HEADERS_PRI) - -#mac frameworks -mac:!static:contains(QT_CONFIG, qt_framework) { - TARGET = QtAssistant # Change the name to match the headers - QMAKE_FRAMEWORK_BUNDLE_NAME = $$TARGET - CONFIG += lib_bundle qt_no_framework_direct_includes qt_framework - CONFIG(debug, debug|release) { - !build_pass:CONFIG += build_all - } else { #release - !debug_and_release|build_pass { - CONFIG -= qt_install_headers #no need to install these as well - FRAMEWORK_HEADERS.version = Versions - FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES - FRAMEWORK_HEADERS.path = Headers - } - QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS - } -} - -TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #done towards the end - -target.path=$$[QT_INSTALL_LIBS] -INSTALLS += target -win32 { - dlltarget.path=$$[QT_INSTALL_BINS] - INSTALLS += dlltarget -} - -qt_install_headers { - assistant_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES - assistant_headers.path = $$[QT_INSTALL_HEADERS]/QtAssistant - INSTALLS += assistant_headers -} - -unix { - CONFIG += create_pc - QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS] - QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/QtAssistant - QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS] - QMAKE_PKGCONFIG_DESTDIR = pkgconfig - QMAKE_PKGCONFIG_REQUIRES += QtNetwork -} - diff --git a/tools/assistant/compat/lib/qassistantclient.cpp b/tools/assistant/compat/lib/qassistantclient.cpp deleted file mode 100644 index 72d0a92..0000000 --- a/tools/assistant/compat/lib/qassistantclient.cpp +++ /dev/null @@ -1,446 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qassistantclient.h" - -#include <qtcpsocket.h> -#include <qtextstream.h> -#include <qtimer.h> -#include <qfileinfo.h> -#include <qmap.h> - -QT_BEGIN_NAMESPACE - -class QAssistantClientPrivate -{ - friend class QAssistantClient; - QStringList arguments; -}; - -static QMap<const QAssistantClient*,QAssistantClientPrivate*> *dpointers = 0; - -static QAssistantClientPrivate *data( const QAssistantClient *client, bool create=false ) -{ - if( !dpointers ) - dpointers = new QMap<const QAssistantClient*,QAssistantClientPrivate*>; - QAssistantClientPrivate *d = (*dpointers)[client]; - if( !d && create ) { - d = new QAssistantClientPrivate; - dpointers->insert( client, d ); - } - return d; -} - -/*! - \class QAssistantClient - \obsolete - \brief The QAssistantClient class provides a means of using Qt - Assistant as an application's help tool. - - \ingroup helpsystem - - \bold{Note:} \e{This class is obsolete and only required when using - the old Qt Assistant, now called assistant_adp. If you want to use - the new Qt Assistant as a remote help viewer, simple create a - QProcess instance and specify \tt{assistant} as its executable. - The following code shows how to start Qt Assistant and request a - certain page to be shown:} - - \snippet doc/src/snippets/code/tools_assistant_compat_lib_qassistantclient.cpp 0 - - \e{For a complete example using the Qt Assistant remotely, see the \l - {help/remotecontrol}{Remote Control} example.} - - In order to make Qt Assistant act as a customized help tool for - your application, you must provide your application with a - QAssistantClient object in addition to a \l - {assistant-manual.html} {Qt Assistant Document Profile} (\c .adp - file) and the associated documentation. - - Note that the QAssistantClient class is not included in the Qt - library. To use it you must add the following line to your pro - file: - - \snippet doc/src/snippets/code/tools_assistant_compat_lib_qassistantclient.cpp 1 - - A QAssistantClient instance can open or close Qt Assistant - whenever it is required. - - Once you have created a QAssistantClient instance, specifying the - path to the Qt Assistant executable, using Qt Assistant is - simple: You can either call the openAssistant() slot to show the - defined start page of the documentation, or you can call the - showPage() slot to show a particular help page. When you call - openAssistant() and showPage(), Qt Assistant will be launched if - it isn't already running. When Qt Assistant is running, the - isOpen() function returns true. - - When calling showPage() the Qt Assistant instance will also be - brought to the foreground if its hidden. The showPage() slot can - be called multiple times, while calling openAssistant() several - times without closing the application in between, will have no - effect. - - You can close Qt Assistant at any time using the closeAssistant() - slot. When you call openAssistant(), or you call showPage() - without a previous call to openAssistant(), the assistantOpened() - signal is emitted. Similarly when closeAssistant() is called, - assistantClosed() is emitted. In either case, if an error occurs, - error() is emitted. - - One QAssistantClient instance interacts with one Qt Assistant - instance, so every time you call openAssistant(), showPage() or - closeAssistant() they are applied to the particular Qt Assistant - instance associated with the QAssistantClient. - - Qt Assistant's documentation set can be altered using the command - line arguments that are passed to the application when it is - launched. When started without any options, Qt Assistant displays - a default set of documentation. When Qt is installed, the default - documentation set in Qt Assistant contains the Qt reference - documentation as well as the tools that come with Qt, such as \QD - and \c qmake. - - Use the setArguments() function to specify the command line - arguments. You can add or remove documentation from Qt Assistant - by adding and removing the relevant content files: The command - line arguments are \c {-addContentFile file.dcf} and \c - {-removeContentFile file.dcf} respectively. You can make Qt - Assistant run customized documentation sets that are separate from - the Qt documentation, by specifying a profile: \c {-profile - myapplication.adp}. The profile format can also be used to alter - several of Qt Assistant's properties such as its title and - startpage. - - The Documentation Content File (\c .dcf) and Qt Assistant - Documentation Profile (\c .adp) formats are documented in the \l - {assistant-manual.html}{Qt Assistant Manual}. - - For a complete example using the QAssistantClient class, see the - \e{Simple Text Viewer} example. The example shows how you can make - Qt Assistant act as a customized help tool for your application - using the QAssistantClient class combined with a Qt Assistant - Document Profile. - - \sa {Qt Assistant Manual}, {Simple Text Viewer Example} -*/ - -/*! - \fn void QAssistantClient::assistantOpened() - - This signal is emitted when Qt Assistant is opened and the - client-server communication is set up. - - \sa openAssistant(), showPage() -*/ - -/*! - \fn void QAssistantClient::assistantClosed() - - This signal is emitted when the connection to Qt Assistant is - closed. This happens when the user exits Qt Assistant, if an - error in the server or client occurs, or if closeAssistant() is - called. - - \sa closeAssistant() -*/ - -/*! - \fn void QAssistantClient::error( const QString &message ) - - This signal is emitted if Qt Assistant cannot be started, or if an - error occurs during the initialization of the connection between - Qt Assistant and the calling application. The \a message provides an - explanation of the error. -*/ - -/*! - Constructs an assistant client with the specified \a parent. For - systems other than Mac OS, \a path specifies the path to the Qt - Assistant executable. For Mac OS, \a path specifies a directory - containing a valid assistant.app bundle. If \a path is the empty - string, the system path (\c{%PATH%} or \c $PATH) is used. -*/ -QAssistantClient::QAssistantClient( const QString &path, QObject *parent ) - : QObject( parent ), host ( QLatin1String("localhost") ) -{ -#if defined(Q_OS_MAC) - const QString assistant = QLatin1String("Assistant_adp"); -#else - const QString assistant = QLatin1String("assistant_adp"); -#endif - - if ( path.isEmpty() ) - assistantCommand = assistant; - else { - QFileInfo fi( path ); - if ( fi.isDir() ) - assistantCommand = path + QLatin1String("/") + assistant; - else - assistantCommand = path; - } - -#if defined(Q_OS_MAC) - assistantCommand += QLatin1String(".app/Contents/MacOS/Assistant_adp"); -#endif - - socket = new QTcpSocket( this ); - connect( socket, SIGNAL(connected()), - SLOT(socketConnected()) ); - connect( socket, SIGNAL(disconnected()), - SLOT(socketConnectionClosed()) ); - connect( socket, SIGNAL(error(QAbstractSocket::SocketError)), - SLOT(socketError()) ); - opened = false; - proc = new QProcess( this ); - port = 0; - pageBuffer = QLatin1String(""); - connect( proc, SIGNAL(readyReadStandardError()), - this, SLOT(readStdError()) ); - connect( proc, SIGNAL(error(QProcess::ProcessError)), - this, SLOT(procError(QProcess::ProcessError)) ); -} - -/*! - Destroys the assistant client object. -*/ -QAssistantClient::~QAssistantClient() -{ - if ( proc->state() == QProcess::Running ) - proc->terminate(); - - if( dpointers ) { - QAssistantClientPrivate *d = (*dpointers)[ this ]; - if ( d ) { - dpointers->remove(this); - delete d; - if( dpointers->isEmpty() ) { - delete dpointers; - dpointers = 0; - } - } - } -} - -/*! - Opens Qt Assistant, i.e. sets up the client-server communication - between the application and Qt Assistant, and shows the start page - specified by the current \l {assistant-manual.html} - {Qt Assistant Document Profile}. If there is no specfied profile, - and Qt is installed, the default start page is the Qt Reference - Documentation's index page. - - If the connection is already established, this function does - nothing. Use the showPage() function to show another page. If an - error occurs, the error() signal is emitted. - - \sa showPage(), assistantOpened() -*/ -void QAssistantClient::openAssistant() -{ - if ( proc->state() == QProcess::Running ) - return; - - QStringList args; - args.append(QLatin1String("-server")); - if( !pageBuffer.isEmpty() ) { - args.append( QLatin1String("-file") ); - args.append( pageBuffer ); - } - - QAssistantClientPrivate *d = data( this ); - if( d ) { - QStringList::ConstIterator it = d->arguments.constBegin(); - while( it!=d->arguments.constEnd() ) { - args.append( *it ); - ++it; - } - } - - connect( proc, SIGNAL(readyReadStandardOutput()), - this, SLOT(readPort()) ); - - proc->start(assistantCommand, args); -} - -void QAssistantClient::procError(QProcess::ProcessError err) -{ - switch (err) - { - case QProcess::FailedToStart: - emit error( tr( "Failed to start Qt Assistant." ) ); - break; - case QProcess::Crashed: - emit error( tr( "Qt Assistant crashed." ) ); - break; - default: - emit error( tr( "Error while running Qt Assistant." ) ); - } -} - -void QAssistantClient::readPort() -{ - QString p(QString::fromLatin1(proc->readAllStandardOutput())); - quint16 port = p.toUShort(); - if ( port == 0 ) { - emit error( tr( "Cannot connect to Qt Assistant." ) ); - return; - } - socket->connectToHost( host, port ); - disconnect( proc, SIGNAL(readyReadStandardOutput()), - this, SLOT(readPort()) ); -} - -/*! - Closes the Qt Assistant instance. - - \sa openAssistant(), assistantClosed() -*/ -void QAssistantClient::closeAssistant() -{ - if ( !opened ) - return; - - bool blocked = proc->blockSignals(true); - proc->terminate(); - if (!proc->waitForFinished(2000)) { - // If the process hasn't died after 2 seconds, - // we kill it, causing it to exit immediately. - proc->kill(); - } - proc->blockSignals(blocked); -} - -/*! - Brings Qt Assistant to the foreground showing the given \a page. - The \a page parameter is a path to an HTML file - (e.g., QLatin1String("/home/pasquale/superproduct/docs/html/intro.html")). - - If Qt Assistant hasn't been opened yet, this function will call - the openAssistant() slot with the specified page as the start - page. - - \note The first time Qt Assistant is started, its window will open - in front of the application's windows. Subsequent calls to this function - will only load the specified pages in Qt Assistant and will not display - its window in front of the application's windows. - - \sa openAssistant() -*/ -void QAssistantClient::showPage( const QString &page ) -{ - if (opened) { - QTextStream os( socket ); - os << page << QLatin1String("\n"); - } else { - pageBuffer = page; - - if (proc->state() == QProcess::NotRunning) { - openAssistant(); - pageBuffer.clear(); - return; - } - } -} - -/*! - \property QAssistantClient::open - \brief whether Qt Assistant is open - -*/ -bool QAssistantClient::isOpen() const -{ - return opened; -} - -void QAssistantClient::socketConnected() -{ - opened = true; - if ( !pageBuffer.isEmpty() ) - showPage( pageBuffer ); - emit assistantOpened(); -} - -void QAssistantClient::socketConnectionClosed() -{ - opened = false; - emit assistantClosed(); -} - -void QAssistantClient::socketError() -{ - QAbstractSocket::SocketError err = socket->error(); - if (err == QTcpSocket::ConnectionRefusedError) - emit error( tr( "Could not connect to Assistant: Connection refused" ) ); - else if (err == QTcpSocket::HostNotFoundError) - emit error( tr( "Could not connect to Assistant: Host not found" ) ); - else if (err != QTcpSocket::RemoteHostClosedError) - emit error( tr( "Communication error" ) ); -} - -void QAssistantClient::readStdError() -{ - QString errmsg = QString::fromLatin1(proc->readAllStandardError()); - - if (!errmsg.isEmpty()) - emit error( errmsg.simplified() ); -} - -/*! - \fn void QAssistantClient::setArguments(const QStringList &arguments) - - Sets the command line \a arguments that are passed to Qt Assistant - when it is launched. - - The command line arguments can be used to alter Qt Assistant's - documentation set. When started without any options, Qt Assistant - displays a default set of documentation. When Qt is installed, the - default documentation set in Qt Assistant contains the Qt - reference documentation as well as the tools that come with Qt, - such as Qt Designer and qmake. -*/ -void QAssistantClient::setArguments( const QStringList &args ) -{ - QAssistantClientPrivate *d = data( this, true ); - d->arguments = args; -} - -QT_END_NAMESPACE diff --git a/tools/assistant/compat/lib/qassistantclient.h b/tools/assistant/compat/lib/qassistantclient.h deleted file mode 100644 index fc8bb5b..0000000 --- a/tools/assistant/compat/lib/qassistantclient.h +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QASSISTANTCLIENT_H -#define QASSISTANTCLIENT_H - -#include <QtCore/QObject> -#include <QtCore/QStringList> -#include <QtCore/QProcess> -#include <QtCore/qglobal.h> -#include <QtAssistant/qassistantclient_global.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QTcpSocket; - -class QT_ASSISTANT_CLIENT_EXPORT QAssistantClient : public QObject -{ - Q_OBJECT - Q_PROPERTY( bool open READ isOpen ) - -public: - QAssistantClient( const QString &path, QObject *parent = 0); - ~QAssistantClient(); - - bool isOpen() const; - - void setArguments( const QStringList &args ); - -public Q_SLOTS: - virtual void openAssistant(); - virtual void closeAssistant(); - virtual void showPage( const QString &page ); - -Q_SIGNALS: - void assistantOpened(); - void assistantClosed(); - void error( const QString &msg ); - -private Q_SLOTS: - void socketConnected(); - void socketConnectionClosed(); - void readPort(); - void procError(QProcess::ProcessError err); - void socketError(); - void readStdError(); - -private: - QTcpSocket *socket; - QProcess *proc; - quint16 port; - QString host, assistantCommand, pageBuffer; - bool opened; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/tools/assistant/compat/main.cpp b/tools/assistant/compat/main.cpp deleted file mode 100644 index c16c52e..0000000 --- a/tools/assistant/compat/main.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mainwindow.h" -#include "helpdialog.h" -#include "config.h" - -#include <QTcpServer> -#include <QTcpSocket> -#include <QApplication> -#include <QPixmap> -#include <QStringList> -#include <QDir> -#include <QMessageBox> -#include <QPointer> -#include <QTranslator> -#include <QLibraryInfo> -#include <QLocale> -#include <stdlib.h> -#include <stdio.h> - -#if defined(USE_STATIC_JPEG_PLUGIN) - #include <QtPlugin> - Q_IMPORT_PLUGIN(qjpeg) -#endif - -#define INDEX_CHECK( text ) if( i+1 >= argc ) { fprintf(stderr, "%s\n", text); return 1; } - -QT_BEGIN_NAMESPACE - -#if !defined(QT_NO_DBUS) && defined(Q_OS_UNIX) -QT_BEGIN_INCLUDE_NAMESPACE -#include <QtDBus/QDBusConnection> -#include <QtDBus/QDBusAbstractAdaptor> -#include <QtDBus/QDBusObjectPath> -#include "tabbedbrowser.h" -QT_END_INCLUDE_NAMESPACE - -class HelpWindowAdaptor : public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "com.trolltech.Assistant.HelpWindow") - - Q_PROPERTY(QString source READ source WRITE setSource) - -public: - HelpWindowAdaptor(HelpWindow *w) : QDBusAbstractAdaptor(w), helpWindow(w) - { - setAutoRelaySignals(true); - } - -public Q_SLOTS: - inline QString source() const { return helpWindow->source().toString(); } - inline void setSource(const QString &src) { helpWindow->setSource(src); } - - inline void clearHistory() { helpWindow->clearHistory(); } - inline void backward() { helpWindow->backward(); } - inline void forward() { helpWindow->forward(); } - inline void reload() { helpWindow->reload(); } - inline void home() { helpWindow->home(); } - -private: - HelpWindow *helpWindow; -}; - -class AssistantAdaptor : public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "com.trolltech.Assistant.HelpViewer") - -public: - AssistantAdaptor(MainWindow *mw) : QDBusAbstractAdaptor(mw), mw(mw) - { - QDBusConnection connection = QDBusConnection::sessionBus(); - connection.registerService(QLatin1String("com.trolltech.Assistant")); - connection.registerObject(QLatin1String("/Assistant"), mw); - } - -public slots: - void showLink(const QString &link) { mw->showLink(link); } - QDBusObjectPath createNewTab(); - QDBusObjectPath currentTab(); - -private: - QDBusObjectPath pathForBrowser(HelpWindow *window); - MainWindow *mw; -}; - -QDBusObjectPath AssistantAdaptor::createNewTab() -{ - HelpWindow *window = mw->browsers()->newBackgroundTab(); - return pathForBrowser(window); -} - -QDBusObjectPath AssistantAdaptor::currentTab() -{ - HelpWindow *window = mw->browsers()->currentBrowser(); - return pathForBrowser(window); -} - -QDBusObjectPath AssistantAdaptor::pathForBrowser(HelpWindow *window) -{ - int index = mw->browsers()->browsers().indexOf(window); - if (index == -1) - return QDBusObjectPath(); - - QString name(QLatin1String("/Assistant/Tabs/")); - name += QString::number(index); - QDBusObjectPath path(name); - - if (!window->findChild<HelpWindowAdaptor *>()) { - (void)new HelpWindowAdaptor(window); - QDBusConnection::sessionBus().registerObject(name, window); - } - - return path; -} - -#endif // QT_NO_DBUS - -class AssistantSocket : public QTcpSocket -{ - Q_OBJECT -public: - AssistantSocket( int sock, QObject *parent = 0 ); - ~AssistantSocket() {} - -signals: - void showLinkRequest( const QString& ); - -private slots: - void readClient(); - void connectionClosed(); -}; - - -class AssistantServer : public QTcpServer -{ - Q_OBJECT -public: - AssistantServer( QObject* parent = 0 ); - quint16 getPort() const; - -signals: - void showLinkRequest( const QString& ); - void newConnect(); - -public slots: - virtual void incomingConnection( int socket ); - -private: - quint16 p; -}; - -AssistantSocket::AssistantSocket( int sock, QObject *parent ) - : QTcpSocket( parent ) -{ - connect( this, SIGNAL(readyRead()), SLOT(readClient()) ); - connect( this, SIGNAL(disconnected()), SLOT(connectionClosed()) ); - setSocketDescriptor( sock ); -} - -void AssistantSocket::readClient() -{ - QString link = QString(); - while ( canReadLine() ) - link = QLatin1String(readLine()); - if ( !link.isNull() ) { - link = link.replace(QLatin1String("\n"), QLatin1String("")); - link = link.replace(QLatin1String("\r"), QLatin1String("")); - QFileInfo fi(link); - link = fi.absoluteFilePath(); - emit showLinkRequest( link ); - } -} - -void AssistantSocket::connectionClosed() -{ - deleteLater(); -} - -AssistantServer::AssistantServer( QObject *parent ) - : QTcpServer( parent ) -{ - listen(QHostAddress::LocalHost, 0); - if ( !isListening() ) { - QMessageBox::critical( 0, tr( "Qt Assistant" ), - tr( "Failed to bind to port %1" ).arg( serverPort() ) ); - exit( 1 ); - } - p = serverPort(); -} - -quint16 AssistantServer::getPort() const -{ - return p; -} - -void AssistantServer::incomingConnection( int socket ) -{ - AssistantSocket *as = new AssistantSocket( socket, this ); - connect( as, SIGNAL(showLinkRequest(QString)), - this, SIGNAL(showLinkRequest(QString)) ); - emit newConnect(); -} - -int runAssistant( int argc, char ** argv ) -{ - bool withGUI = true; -#ifndef Q_WS_WIN - if ( argc > 1 ) { - QString arg = QString::fromLocal8Bit(argv[1]); - arg = arg.toLower(); - if ( arg == QLatin1String("-addcontentfile") - || arg == QLatin1String("-removecontentfile") - || arg == QLatin1String("-help") - || arg == QLatin1String("/?") - ) - withGUI = false; - } -#endif - QApplication a(argc, argv, withGUI); - a.setOrganizationName(QLatin1String("Trolltech")); - a.setApplicationName(QLatin1String("Assistant")); - - QString resourceDir; - AssistantServer *as = 0; - QStringList catlist; - QString file, profileName, aDocPath; - bool server = false; - bool hideSidebar = false; - bool configLoaded = false; - if ( argc == 2 ) { - file = QString::fromLocal8Bit(argv[1]); - if (file.startsWith(QLatin1String("-")) || file == QLatin1String("/?")) { - file.clear(); - } else { - QFileInfo fi(file); - file = fi.absoluteFilePath(); - file = MainWindow::urlifyFileName(file); - } - } - if ( file.isEmpty() ) { - for ( int i = 1; i < argc; i++ ) { - QString opt = QString::fromLocal8Bit(argv[i]).toLower(); - if ( opt == QLatin1String("-file") ) { - INDEX_CHECK( "Missing file argument!" ); - i++; - file = QFile::decodeName(argv[i]); - } else if ( opt == QLatin1String("-server") ) { - server = true; - } else if ( opt == QLatin1String("-profile") ) { - INDEX_CHECK( "Missing profile argument!" ); - profileName = QFile::decodeName(argv[++i]); - } else if ( opt == QLatin1String("-addcontentfile") ) { - INDEX_CHECK( "Missing content file!" ); - Config *c = Config::loadConfig(QString()); - QFileInfo file( QFile::decodeName(argv[i+1]) ); - if( !file.exists() ) { - fprintf(stderr, "Could not locate content file: %s\n", qPrintable(file.absoluteFilePath())); - return 1; - } - DocuParser *parser = DocuParser::createParser( file.absoluteFilePath() ); - if( parser ) { - QFile f( QFile::decodeName(argv[i+1]) ); - if( !parser->parse( &f ) ) { - fprintf(stderr, "Failed to parse file: %s\n", qPrintable(file.absoluteFilePath())); - return 1; - } - parser->addTo( c->profile() ); - c->setDocRebuild( true ); - c->save(); - } - return 0; - } else if ( opt == QLatin1String("-removecontentfile") ) { - INDEX_CHECK("Missing content file!"); - Config *c = Config::loadConfig(QString()); - Profile *profile = c->profile(); - QString contentFile = QString::fromLocal8Bit(argv[i+i]); - QStringList entries; -#ifdef Q_WS_WIN - contentFile.replace(QLatin1Char('\\'), QLatin1Char('/')); - entries = profile->docs.filter(contentFile, Qt::CaseInsensitive); -#else - entries = profile->docs.filter(contentFile); -#endif - if (entries.count() == 0) { - fprintf(stderr, "Could not locate content file: %s\n", qPrintable(contentFile)); - return 1; - } else if (entries.count() > 1) { - fprintf(stderr, "More than one entry matching file name found, " - "please specify full path to file"); - return 1; - } else { - QFileInfo file(entries[0]); - if( !file.exists() ) { - fprintf(stderr, "Could not locate content file: %s\n", qPrintable(file.absoluteFilePath())); - return 1; - } - profile->removeDocFileEntry( file.absoluteFilePath() ); - c->setDocRebuild( true ); - c->save(); - } - return 0; - } else if ( QString( QLatin1String(argv[i]) ).toLower() == QLatin1String("-docpath") ) { - INDEX_CHECK( "Missing path!" ); - QDir dir(QString::fromLocal8Bit(argv[i+1])); - if ( dir.exists() ) { - Config *c = Config::loadConfig(QString()); - c->saveProfile(Profile::createDefaultProfile(dir.absolutePath())); - c->loadDefaultProfile(); - c->setDocRebuild(true); - c->save(); - configLoaded = true; - ++i; - } else { - fprintf(stderr, "The specified path does not exist!\n"); - return 1; - } - } else if ( opt == QLatin1String("-hidesidebar") ) { - hideSidebar = true; - } else if ( opt == QLatin1String("-help") || opt == QLatin1String("/?") ) { - QString helpText = QLatin1String( "Usage: assistant [option]\n" - "Options:\n" - " -file Filename assistant opens the specified file\n" - " -server reads commands from a socket after\n" - " assistant has started\n" - " -profile fileName starts assistant and displays the\n" - " profile specified in the file fileName.\n" - " -addContentFile file adds the content file 'file' to the set of\n" - " documentation available by default\n" - " -removeContentFile file removes the content file 'file' from the\n" - " documentation available by default\n" - " -docPath path sets the Qt documentation root path to\n" - " 'path' and starts assistant\n" - " -hideSidebar assistant will hide the sidebar.\n" - " -resourceDir assistant will load translations from\n" - " this directory.\n" - " -help shows this help."); -#ifdef Q_WS_WIN - QMessageBox::information( 0, QLatin1String("Qt Assistant"), - QLatin1String("<pre>") + helpText + QLatin1String("</pre>") ); -#else - fprintf(stdout, "%s\n", qPrintable(helpText)); -#endif - exit( 0 ); - } else if ( opt == QLatin1String("-resourcedir") ) { - INDEX_CHECK( "Missing resource directory argument!" ); - resourceDir = QFile::decodeName( argv[++i] ); - } else { - fprintf(stderr, "Unrecognized option %s. Try -help to get help.\n", qPrintable(opt)); - return 1; - } - } - } - - if( resourceDir.isNull() ) - resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); - - QTranslator translator( 0 ); - translator.load( QLatin1String("assistant_adp_") + QLocale::system().name(), resourceDir ); - a.installTranslator( &translator ); - - QTranslator qtTranslator( 0 ); - qtTranslator.load( QLatin1String("qt_") + QLocale::system().name(), resourceDir ); - a.installTranslator( &qtTranslator ); - - Config *conf = 0; - if (configLoaded) - conf = Config::configuration(); - else - conf = Config::loadConfig( profileName ); - if (!conf) { - fprintf( stderr, "Profile '%s' does not exist!\n", profileName.toLatin1().constData() ); - fflush( stderr ); - return -1; - } - - QStringList links = conf->source(); - conf->hideSideBar( hideSidebar ); - - QPointer<MainWindow> mw = new MainWindow(); - mw->setObjectName(QLatin1String("Assistant")); - - if ( server ) { - as = new AssistantServer(); - printf("%d\n", as->serverPort() ); - fflush( stdout ); - as->connect( as, SIGNAL(showLinkRequest(QString)), - mw, SLOT(showLinkFromClient(QString)) ); - } - -#if !defined(QT_NO_DBUS) && defined(Q_OS_UNIX) - new AssistantAdaptor(mw); -#endif // QT_NO_DBUS - - FontSettings settings = conf->fontSettings(); - if (mw->font() != settings.windowFont) - a.setFont(settings.windowFont, "QWidget"); - -#ifdef Q_WS_MAC - // Make sure AssitantClient shows the window in front. - mw->raise(); -#endif - mw->show(); - - if (!file.isEmpty()) - mw->showLink( MainWindow::urlifyFileName(file) ); - else if (file.isEmpty()) - mw->showLinks( links ); - - a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); - - int appExec = a.exec(); - delete (MainWindow*)mw; - return appExec; -} - -QT_END_NAMESPACE - -int main( int argc, char ** argv ) -{ - Q_INIT_RESOURCE(assistant); - return QT_PREPEND_NAMESPACE(runAssistant)(argc, argv); -} - -#include "main.moc" diff --git a/tools/assistant/compat/mainwindow.cpp b/tools/assistant/compat/mainwindow.cpp deleted file mode 100644 index 76143a5..0000000 --- a/tools/assistant/compat/mainwindow.cpp +++ /dev/null @@ -1,885 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mainwindow.h" -#include "tabbedbrowser.h" -#include "helpdialog.h" -#include "config.h" -#include "fontsettingsdialog.h" - -#include <QDockWidget> -#include <QDir> -#include <QTimer> -#include <QStatusBar> -#include <QShortcut> -#include <QMessageBox> -#include <QPainter> -#include <QEventLoop> -#include <QtEvents> -#include <QFontDatabase> -#include <QWhatsThis> -#include <QTextDocumentFragment> -#include <QLibraryInfo> -#include <QPrinter> -#include <QPrintDialog> -#include <QAbstractTextDocumentLayout> -#include <QTextDocument> -#include <QTextObject> -#include <QFileDialog> -#include <QThread> - -QT_BEGIN_NAMESPACE - -QList<MainWindow*> MainWindow::windows; - -#if defined(Q_WS_WIN) -extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; -#endif - -MainWindow::MainWindow() -{ - setUnifiedTitleAndToolBarOnMac(true); - ui.setupUi(this); - -#if defined(Q_WS_WIN) - // Workaround for QMimeSourceFactory failing in QFileInfo::isReadable() for - // certain user configs. See task: 34372 - qt_ntfs_permission_lookup = 0; -#endif - setupCompleted = false; - - goActions = QList<QAction*>(); - goActionDocFiles = new QMap<QAction*,QString>; - - windows.append(this); - tabs = new TabbedBrowser(this); - connect(tabs, SIGNAL(tabCountChanged(int)), this, SLOT(updateTabActions(int))); - setCentralWidget(tabs); - - Config *config = Config::configuration(); - - updateProfileSettings(); - - dw = new QDockWidget(this); - dw->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - dw->setWindowTitle(tr("Sidebar")); - dw->setObjectName(QLatin1String("sidebar")); - helpDock = new HelpDialog(dw, this); - dw->setWidget(helpDock); - - addDockWidget(Qt::LeftDockWidgetArea, dw); - - // read geometry configuration - setupGoActions(); - - restoreGeometry(config->windowGeometry()); - restoreState(config->mainWindowState()); - if (config->sideBarHidden()) - dw->hide(); - - tabs->setup(); - QTimer::singleShot(0, this, SLOT(setup())); -#if defined(Q_WS_MAC) - QMenu *windowMenu = new QMenu(tr("&Window"), this); - menuBar()->insertMenu(ui.helpMenu->menuAction(), windowMenu); - windowMenu->addAction(tr("Minimize"), this, - SLOT(showMinimized()), QKeySequence(tr("Ctrl+M"))); - // Use the same forward and backward browser shortcuts as Safari and Internet Explorer do - // on the Mac. This means that if you have access to one of those cool Intellimice, the thing - // works just fine, since that's how Microsoft hacked it. - ui.actionGoPrevious->setShortcut(QKeySequence(Qt::CTRL|Qt::Key_Left)); - ui.actionGoNext->setShortcut(QKeySequence(Qt::CTRL|Qt::Key_Right)); - - static const QLatin1String MacIconPath(":/trolltech/assistant/images/mac"); - ui.actionGoNext->setIcon(QIcon(MacIconPath + QLatin1String("/next.png"))); - ui.actionGoPrevious->setIcon(QIcon(MacIconPath + QLatin1String("/prev.png"))); - ui.actionGoHome->setIcon(QIcon(MacIconPath + QLatin1String("/home.png"))); - ui.actionEditCopy->setIcon(QIcon(MacIconPath + QLatin1String("/editcopy.png"))); - ui.actionEditCopy->setIcon(QIcon(MacIconPath + QLatin1String("/editcopy.png"))); - ui.actionEditFind->setIcon(QIcon(MacIconPath + QLatin1String("/find.png"))); - ui.actionFilePrint->setIcon(QIcon(MacIconPath + QLatin1String("/print.png"))); - ui.actionZoomOut->setIcon(QIcon(MacIconPath + QLatin1String("/zoomout.png"))); - ui.actionZoomIn->setIcon(QIcon(MacIconPath + QLatin1String("/zoomin.png"))); - ui.actionSyncToc->setIcon(QIcon(MacIconPath + QLatin1String("/synctoc.png"))); - ui.actionHelpWhatsThis->setIcon(QIcon(MacIconPath + QLatin1String("/whatsthis.png"))); -#elif defined(Q_WS_X11) - ui.actionGoNext->setIcon(QIcon::fromTheme("go-next" , ui.actionGoNext->icon())); - ui.actionGoPrevious->setIcon(QIcon::fromTheme("go-previous" , ui.actionGoPrevious->icon())); - ui.actionGoHome->setIcon(QIcon::fromTheme("user-home" , ui.actionGoHome->icon())); - ui.actionEditCopy->setIcon(QIcon::fromTheme("edit-copy" , ui.actionEditCopy->icon())); - ui.actionEditFind->setIcon(QIcon::fromTheme("edit-find" , ui.actionEditFind->icon())); - ui.actionFilePrint->setIcon(QIcon::fromTheme("document-print" , ui.actionFilePrint->icon())); - ui.actionZoomOut->setIcon(QIcon::fromTheme("zoom-out" , ui.actionZoomOut->icon())); - ui.actionZoomIn->setIcon(QIcon::fromTheme("zoom-in" , ui.actionZoomIn->icon())); - ui.actionSyncToc->setIcon(QIcon::fromTheme("view-refresh" , ui.actionSyncToc->icon())); -#endif -} - -MainWindow::~MainWindow() -{ - windows.removeAll(this); - delete goActionDocFiles; -} - -void MainWindow::setup() -{ - if(setupCompleted) - return; - - qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); - statusBar()->showMessage(tr("Initializing Qt Assistant...")); - setupCompleted = true; - helpDock->initialize(); - connect(ui.actionGoPrevious, SIGNAL(triggered()), tabs, SLOT(backward())); - connect(ui.actionGoNext, SIGNAL(triggered()), tabs, SLOT(forward())); - connect(ui.actionEditCopy, SIGNAL(triggered()), tabs, SLOT(copy())); - connect(ui.actionFileExit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); - connect(ui.actionAddBookmark, SIGNAL(triggered()), - helpDock, SLOT(addBookmark())); - connect(helpDock, SIGNAL(showLink(QString)), - this, SLOT(showLink(QString))); - connect(helpDock, SIGNAL(showSearchLink(QString,QStringList)), - this, SLOT(showSearchLink(QString,QStringList))); - - connect(ui.bookmarkMenu, SIGNAL(triggered(QAction*)), - this, SLOT(showBookmark(QAction*))); - connect(ui.actionZoomIn, SIGNAL(triggered()), tabs, SLOT(zoomIn())); - connect(ui.actionZoomOut, SIGNAL(triggered()), tabs, SLOT(zoomOut())); - - connect(ui.actionOpenPage, SIGNAL(triggered()), tabs, SLOT(newTab())); - connect(ui.actionClosePage, SIGNAL(triggered()), tabs, SLOT(closeTab())); - connect(ui.actionNextPage, SIGNAL(triggered()), tabs, SLOT(nextTab())); - connect(ui.actionPrevPage, SIGNAL(triggered()), tabs, SLOT(previousTab())); - - -#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) - QShortcut *acc = new QShortcut(tr("SHIFT+CTRL+="), this); - connect(acc, SIGNAL(activated()), ui.actionZoomIn, SIGNAL(triggered())); -#endif - - connect(new QShortcut(tr("Ctrl+T"), this), SIGNAL(activated()), helpDock, SLOT(toggleContents())); - connect(new QShortcut(tr("Ctrl+I"), this), SIGNAL(activated()), helpDock, SLOT(toggleIndex())); - connect(new QShortcut(tr("Ctrl+B"), this), SIGNAL(activated()), helpDock, SLOT(toggleBookmarks())); - connect(new QShortcut(tr("Ctrl+S"), this), SIGNAL(activated()), helpDock, SLOT(toggleSearch())); - connect(new QShortcut(tr("Ctrl+]"), this), SIGNAL(activated()), tabs, SLOT(nextTab())); - connect(new QShortcut(tr("Ctrl+["), this), SIGNAL(activated()), tabs, SLOT(previousTab())); - - Config *config = Config::configuration(); - - setupBookmarkMenu(); - - QAction *viewsAction = createPopupMenu()->menuAction(); - viewsAction->setText(tr("Views")); - ui.viewMenu->addAction(viewsAction); - - const int tabIndex = config->sideBarPage(); - helpDock->tabWidget()->setCurrentIndex(tabIndex); - // The tab index is 0 by default, so we need to force an upate - // to poulate the contents in this case. - if (tabIndex == 0) - helpDock->currentTabChanged(tabIndex); - - ui.actionEditFind->setShortcut(QKeySequence::Find); - ui.actionEditFindNext->setShortcut(QKeySequence::FindNext); - ui.actionEditFindPrev->setShortcut(QKeySequence::FindPrevious); - - QObject::connect(ui.actionEditFind, SIGNAL(triggered()), tabs, SLOT(find())); - QObject::connect(ui.actionEditFindNext, SIGNAL(triggered()), tabs, SLOT(findNext())); - QObject::connect(ui.actionEditFindPrev, SIGNAL(triggered()), tabs, SLOT(findPrevious())); - connect(ui.actionEditFont_Settings, SIGNAL(triggered()), this, SLOT(showFontSettingsDialog())); - - qApp->restoreOverrideCursor(); - ui.actionGoPrevious->setEnabled(false); - ui.actionGoNext->setEnabled(false); - ui.actionEditCopy->setEnabled(false); - - // set the current selected item in the treeview - helpDialog()->locateContents(tabs->currentBrowser()->source().toString()); - connect(tabs, SIGNAL(browserUrlChanged(QString)), helpDock, SLOT(locateContents(QString))); -} - -void MainWindow::browserTabChanged() -{ - HelpWindow *win = tabs->currentBrowser(); - if (win) { - QTextCursor cursor(win->textCursor()); - ui.actionEditCopy->setEnabled(cursor.hasSelection()); - ui.actionGoPrevious->setEnabled(win->isBackwardAvailable()); - ui.actionGoNext->setEnabled(win->isForwardAvailable()); - } -} - -void MainWindow::copyAvailable(bool yes) -{ - ui.actionEditCopy->setEnabled(yes); -} - -void MainWindow::updateTabActions(int index) -{ - bool enabled = (index > 1) ? true : false; - ui.actionPrevPage->setEnabled(enabled); - ui.actionNextPage->setEnabled(enabled); - ui.actionClosePage->setEnabled(enabled); -} - -void MainWindow::setupGoActions() -{ - Config *config = Config::configuration(); - QStringList titles = config->docTitles(); - QAction *action = 0; - - static bool separatorInserted = false; - - foreach (QAction *a, goActions) { - ui.goMenu->removeAction(a); - ui.goActionToolbar->removeAction(a); - } - qDeleteAll(goActions); - goActions.clear(); - goActionDocFiles->clear(); - - int addCount = 0; - - foreach (QString title, titles) { - QPixmap pix = config->docIcon(title); - if(!pix.isNull()) { - if(!separatorInserted) { - ui.goMenu->addSeparator(); - separatorInserted = true; - } - action = new QAction(this); - action->setText(title); - action->setWhatsThis(tr("Displays the main page of a specific documentation set.")); - action->setIcon(QIcon(pix)); - ui.goMenu->addAction(action); - ui.goActionToolbar->addAction(action); - goActions.append(action); - goActionDocFiles->insert(action, config->indexPage(title)); - connect(action, SIGNAL(triggered()), - this, SLOT(showGoActionLink())); - ++addCount; - } - } - if(!addCount) - ui.goActionToolbar->hide(); - else - ui.goActionToolbar->show(); - -} - -bool MainWindow::insertActionSeparator() -{ - ui.goMenu->addSeparator(); - ui.Toolbar->addSeparator(); - return true; -} - -void MainWindow::closeEvent(QCloseEvent *e) -{ - saveSettings(); - e->accept(); -} - -void MainWindow::about() -{ - QMessageBox box(this); - - box.setText(QString::fromLatin1("<center><img src=\":/trolltech/assistant/images/assistant-128.png\">" - "<h3>%1</h3>" - "<p>Version %2</p></center>" - "<p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p>") - .arg(tr("Qt Assistant")).arg(QLatin1String(QT_VERSION_STR))); - box.setWindowTitle(tr("Qt Assistant")); - box.setIcon(QMessageBox::NoIcon); - box.exec(); -} - -void MainWindow::on_actionAboutApplication_triggered() -{ - QString url = Config::configuration()->aboutURL(); - if (url == QLatin1String("about_qt")) { - QMessageBox::aboutQt(this, QLatin1String("Qt Assistant")); - return; - } - QString text; - if (url.startsWith(QLatin1String("file:"))) - url = url.mid(5); - QFile file(url); - if(file.exists() && file.open(QFile::ReadOnly)) - text = QString::fromUtf8(file.readAll()); - if(text.isNull()) - text = tr("Failed to open about application contents in file: '%1'").arg(url); - - QFileInfo fi(file); - QString path = QDir::cleanPath(fi.absolutePath()); - if (!QDir::searchPaths(QLatin1String("aboutImages")).contains(path)) - QDir::addSearchPath(QLatin1String("aboutImages"), path); - - QMessageBox box(this); - box.setText(text); - box.setWindowTitle(Config::configuration()->aboutApplicationMenuText()); - box.setIcon(QMessageBox::NoIcon); - box.exec(); -} - -void MainWindow::on_actionAboutAssistant_triggered() -{ - about(); -} - -void MainWindow::on_actionGoHome_triggered() -{ - QString home = MainWindow::urlifyFileName(Config::configuration()->homePage()); - showLink(home); -} - -QString MainWindow::urlifyFileName(const QString &fileName) -{ - QString name = fileName; - QUrl url(name); - -#if defined(Q_OS_WIN32) - if (!url.isValid() || url.scheme().isEmpty() || url.scheme().toLower() != QLatin1String("file:")) { - int i = name.indexOf(QLatin1Char('#')); - QString anchor = name.mid(i); - name = name.toLower(); - if (i > -1) - name.replace(i, anchor.length(), anchor); - name.replace(QLatin1Char('\\'), QLatin1Char('/')); - foreach (QFileInfo drive, QDir::drives()) { - if (name.startsWith(drive.absolutePath().toLower())) { - name = QLatin1String("file:") + name; - break; - } - } - } -#else - if (!url.isValid() || url.scheme().isEmpty()) - name.prepend(QLatin1String("file:")); -#endif - return name; -} - -#ifndef QT_NO_PRINTER -class PrintThread : public QThread -{ - QPrinter _printer; - QTextDocument *_document; - -public: - PrintThread(QObject *parent) - : QThread(parent), _printer(QPrinter::HighResolution), _document(0) - { - } - ~PrintThread() - { - wait(); - } - - QPrinter *printer() - { - return &_printer; - } - - void start(QTextDocument *document) - { - _document = document->clone(); - _document->moveToThread(this); - QThread::start(); - } - -protected: - void run() - { - _document->print(printer()); - delete _document; - _document = 0; - } -}; -#endif //QT_NO_PRINTER - -void MainWindow::on_actionFilePrint_triggered() -{ -#ifndef QT_NO_PRINTER - if (!QFontDatabase::supportsThreadedFontRendering()) { - QPrinter printer(QPrinter::HighResolution); - - QPrintDialog dlg(&printer, this); - if (dlg.exec() == QDialog::Accepted) { - qApp->setOverrideCursor(Qt::WaitCursor); - tabs->currentBrowser()->document()->print(&printer); - qApp->restoreOverrideCursor(); - } - return; - } - - PrintThread *thread = new PrintThread(this); - - QPrintDialog dlg(thread->printer(), this); - if (dlg.exec() == QDialog::Accepted) { - connect(thread, SIGNAL(finished()), SLOT(printingFinished())); - connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); - - qApp->setOverrideCursor(Qt::BusyCursor); - thread->start(tabs->currentBrowser()->document()); - } else { - delete thread; - } -#else - Q_ASSERT("No printing support"); -#endif -} - -void MainWindow::printingFinished() -{ - qApp->restoreOverrideCursor(); -} - -void MainWindow::updateBookmarkMenu() -{ - for(QList<MainWindow*>::Iterator it = windows.begin(); it != windows.end(); ++it) - (*it)->setupBookmarkMenu(); -} - -void MainWindow::setupBookmarkMenu() -{ - ui.bookmarkMenu->clear(); - bookmarks.clear(); - ui.bookmarkMenu->addAction(ui.actionAddBookmark); - - QFile f(QDir::homePath() + QLatin1String("/.assistant/bookmarks.") + - Config::configuration()->profileName()); - if (!f.open(QFile::ReadOnly)) - return; - QTextStream ts(&f); - ui.bookmarkMenu->addSeparator(); - while (!ts.atEnd()) { - QString title = ts.readLine(); - QString link = ts.readLine(); - bookmarks.insert(ui.bookmarkMenu->addAction(title), link); - } -} - -void MainWindow::showBookmark(QAction *action) -{ - if (bookmarks.contains(action)) - showLink(bookmarks.value(action)); -} - -void MainWindow::showLinkFromClient(const QString &link) -{ - setWindowState(windowState() & ~Qt::WindowMinimized); - raise(); - activateWindow(); - QString l = MainWindow::urlifyFileName(link); - showLink(l); - if (isMinimized()) - showNormal(); -} - -void MainWindow::showLink(const QString &link) -{ - if(link.isEmpty()) - qWarning("The link is empty!"); - - // don't fill the history with the same url more then once - if (link == tabs->currentBrowser()->source().toString()) - return; - - QUrl url(link); - QFileInfo fi(url.toLocalFile()); - tabs->setSource(url.toString()); - tabs->currentBrowser()->setFocus(); -} - -void MainWindow::showLinks(const QStringList &links) -{ - if (links.size() == 0) { - qWarning("MainWindow::showLinks() - Empty link"); - return; - } - - if (links.size() == 1) { - showLink(MainWindow::urlifyFileName(links.first())); - return; - } - - QStringList::ConstIterator it = links.begin(); - // Initial showing, The tab is empty so update that without creating it first - if (!tabs->currentBrowser()->source().isValid()) { - QPair<HelpWindow*, QString> browser; - browser.first = tabs->currentBrowser(); - browser.second = links.first(); - pendingBrowsers.append(browser); - tabs->setTitle(tabs->currentBrowser(), tr("...")); - } - ++it; - - while(it != links.end()) { - QPair<HelpWindow*, QString> browser; - browser.first = tabs->newBackgroundTab(); - browser.second = *it; - pendingBrowsers.append(browser); - ++it; - } - - startTimer(50); - return; -} - -void MainWindow::removePendingBrowser(HelpWindow *win) -{ - if (!pendingBrowsers.count()) - return; - - QMutableListIterator<QPair<HelpWindow*, QString> > it(pendingBrowsers); - while (it.hasNext()) { - QPair<HelpWindow*, QString> browser = it.next(); - if (browser.first == win) { - it.remove(); - break; - } - } -} - -void MainWindow::timerEvent(QTimerEvent *e) -{ - QPair<HelpWindow*, QString> browser = pendingBrowsers.first(); - pendingBrowsers.pop_front(); - - if (pendingBrowsers.size() == 0) - killTimer(e->timerId()); - - browser.first->setSource(MainWindow::urlifyFileName(browser.second)); -} - -void MainWindow::showQtHelp() -{ - showLink(QLibraryInfo::location(QLibraryInfo::DocumentationPath) + - QLatin1String("/html/index.html")); -} - -MainWindow* MainWindow::newWindow() -{ - saveSettings(); - MainWindow *mw = new MainWindow; - mw->move(geometry().topLeft()); - if (isMaximized()) - mw->showMaximized(); - else - mw->show(); - mw->on_actionGoHome_triggered(); - return mw; -} - -void MainWindow::saveSettings() -{ - Config *config = Config::configuration(); - - config->setSideBarPage(helpDock->tabWidget()->currentIndex()); - config->setWindowGeometry(saveGeometry()); - config->setMainWindowState(saveState()); - - // Create list of the tab urls - QStringList lst; - QList<HelpWindow*> browsers = tabs->browsers(); - foreach (HelpWindow *browser, browsers) - lst << browser->source().toString(); - config->setSource(lst); - config->save(); -} - -TabbedBrowser* MainWindow::browsers() const -{ - return tabs; -} - -void MainWindow::showSearchLink(const QString &link, const QStringList &terms) -{ - HelpWindow * hw = tabs->currentBrowser(); - hw->blockScrolling(true); - hw->setCursor(Qt::WaitCursor); - if (hw->source() == link) - hw->reload(); - else - showLink(link); - hw->setCursor(Qt::ArrowCursor); - - hw->viewport()->setUpdatesEnabled(false); - - QTextCharFormat marker; - marker.setForeground(Qt::red); - - QTextCursor firstHit; - - QTextCursor c = hw->textCursor(); - c.beginEditBlock(); - foreach (QString term, terms) { - c.movePosition(QTextCursor::Start); - hw->setTextCursor(c); - - bool found = hw->find(term, QTextDocument::FindWholeWords); - while (found) { - QTextCursor hit = hw->textCursor(); - if (firstHit.isNull() || hit.position() < firstHit.position()) - firstHit = hit; - - hit.mergeCharFormat(marker); - found = hw->find(term, QTextDocument::FindWholeWords); - } - } - - if (firstHit.isNull()) { - firstHit = hw->textCursor(); - firstHit.movePosition(QTextCursor::Start); - } - firstHit.clearSelection(); - c.endEditBlock(); - hw->setTextCursor(firstHit); - - hw->blockScrolling(false); - hw->viewport()->setUpdatesEnabled(true); -} - - -void MainWindow::showGoActionLink() -{ - const QObject *origin = sender(); - if(!origin || - QString::fromLatin1(origin->metaObject()->className()) != QString::fromLatin1("QAction")) - return; - - QAction *action = (QAction*) origin; - QString docfile = *(goActionDocFiles->find(action)); - showLink(MainWindow::urlifyFileName(docfile)); -} - -void MainWindow::on_actionHelpAssistant_triggered() -{ - showLink(Config::configuration()->assistantDocPath() + QLatin1String("/assistant-manual.html")); -} - -HelpDialog* MainWindow::helpDialog() const -{ - return helpDock; -} - -void MainWindow::backwardAvailable(bool enable) -{ - ui.actionGoPrevious->setEnabled(enable); -} - -void MainWindow::forwardAvailable(bool enable) -{ - ui.actionGoNext->setEnabled(enable); -} - -void MainWindow::updateProfileSettings() -{ - Config *config = Config::configuration(); -#ifndef Q_WS_MAC - setWindowIcon(config->applicationIcon()); -#endif - ui.helpMenu->clear(); - //ui.helpMenu->addAction(ui.actionHelpAssistant); - //ui.helpMenu->addSeparator(); - ui.helpMenu->addAction(ui.actionAboutAssistant); - if (!config->aboutApplicationMenuText().isEmpty()) - ui.helpMenu->addAction(ui.actionAboutApplication); - ui.helpMenu->addSeparator(); - ui.helpMenu->addAction(ui.actionHelpWhatsThis); - - ui.actionAboutApplication->setText(config->aboutApplicationMenuText()); - - if(!config->title().isNull()) - setWindowTitle(config->title()); -} - -void MainWindow::setupPopupMenu(QMenu *m) -{ - m->addAction(ui.actionNewWindow); - m->addAction(ui.actionOpenPage); - m->addAction(ui.actionClosePage); - m->addSeparator(); - m->addAction(ui.actionSaveAs); - m->addSeparator(); - m->addAction(ui.actionGoPrevious); - m->addAction(ui.actionGoNext); - m->addAction(ui.actionGoHome); - m->addSeparator(); - m->addAction(ui.actionZoomIn); - m->addAction(ui.actionZoomOut); - m->addSeparator(); - m->addAction(ui.actionEditCopy); - m->addAction(ui.actionEditFind); -} - -void MainWindow::on_actionSyncToc_triggered() -{ - HelpWindow *w = tabs->currentBrowser(); - if(w) { - qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); - QString link = w->source().toString(); - helpDock->locateContents(link); - helpDock->tabWidget()->setCurrentIndex(0); - qApp->restoreOverrideCursor(); - } -} - -void MainWindow::on_actionNewWindow_triggered() -{ - newWindow()->show(); -} - -void MainWindow::on_actionClose_triggered() -{ - close(); -} - -void MainWindow::on_actionHelpWhatsThis_triggered() -{ - QWhatsThis::enterWhatsThisMode(); -} - -void MainWindow::on_actionSaveAs_triggered() -{ - QString fileName; - QUrl url = tabs->currentBrowser()->source(); - if (url.isValid()) { - QFileInfo fi(url.toLocalFile()); - fileName = fi.fileName(); - } - fileName = QFileDialog::getSaveFileName(this, tr("Save Page"), fileName); - if (fileName.isEmpty()) - return; - - QFile file(fileName); - if (!file.open(QIODevice::WriteOnly)) { - QMessageBox::critical(this, tr("Save Page"), tr("Cannot open file for writing!")); - return; - } - - QFileInfo fi(fileName); - QString fn = fi.fileName(); - int i = fn.lastIndexOf(QLatin1Char('.')); - if (i > -1) - fn = fn.left(i); - QString relativeDestPath = fn + QLatin1String("_images"); - QDir destDir(fi.absolutePath() + QDir::separator() + relativeDestPath); - bool imgDirAvailable = destDir.exists(); - if (!imgDirAvailable) - imgDirAvailable = destDir.mkdir(destDir.absolutePath()); - - // save images - QTextDocument *doc = tabs->currentBrowser()->document()->clone(); - if (url.isValid() && imgDirAvailable) { - QTextBlock::iterator it; - for (QTextBlock block = doc->begin(); block != doc->end(); block = block.next()) { - for (it = block.begin(); !(it.atEnd()); ++it) { - QTextFragment fragment = it.fragment(); - if (fragment.isValid()) { - QTextImageFormat fm = fragment.charFormat().toImageFormat(); - if (fm.isValid() && !fm.name().isEmpty()) { - QUrl imagePath = tabs->currentBrowser()->source().resolved(fm.name()); - if (!imagePath.isValid()) - continue; - QString from = imagePath.toLocalFile(); - QString destName = fm.name(); - int j = destName.lastIndexOf(QLatin1Char('/')); - if (j > -1) - destName = destName.mid(j+1); - QFileInfo info(from); - if (info.exists()) { - if (!QFile::copy(from, destDir.absolutePath() - + QDir::separator() + destName)) - continue; - fm.setName(QLatin1String("./") + relativeDestPath + QLatin1String("/") + destName); - QTextCursor cursor(doc); - cursor.setPosition(fragment.position()); - cursor.setPosition(fragment.position() + fragment.length(), - QTextCursor::KeepAnchor); - cursor.setCharFormat(fm); - } - } - } - } - } - } - QString src = doc->toHtml(QByteArray("utf-8")); - QTextStream s(&file); - s.setCodec("utf-8"); - s << src; - s.flush(); - file.close(); -} - -void MainWindow::showFontSettingsDialog() -{ - Config *config = Config::configuration(); - FontSettings settings = config->fontSettings(); - - { // It is important that the dialog be deleted before UI mode changes. - FontSettingsDialog dialog; - if (!dialog.showDialog(&settings)) - return; - } - - config->setFontPointSize(settings.browserFont.pointSizeF()); - config->setFontSettings(settings); - - updateApplicationFontSettings(settings); -} - -void MainWindow::updateApplicationFontSettings(FontSettings &settings) -{ - QFont font = settings.windowFont; - if (this->font() != font) - qApp->setFont(font, "QWidget"); - - font = settings.browserFont; - QList<HelpWindow*> browsers = tabs->browsers(); - foreach (HelpWindow *browser, browsers) { - if (browser->font() != font) - browser->setFont(font); - } -} - -QT_END_NAMESPACE diff --git a/tools/assistant/compat/mainwindow.h b/tools/assistant/compat/mainwindow.h deleted file mode 100644 index a08064d..0000000 --- a/tools/assistant/compat/mainwindow.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include "ui_mainwindow.h" -#include "config.h" - -#include <QPointer> -#include <QMap> - -QT_BEGIN_NAMESPACE - -class TabbedBrowser; -class HelpDialog; -class HelpWindow; -class QMenu; -class QDockWidget; - -class MainWindow : public QMainWindow -{ - Q_OBJECT -public: - MainWindow(); - virtual ~MainWindow(); - - TabbedBrowser *browsers() const; - HelpDialog *helpDialog() const; - - void setupPopupMenu(QMenu *menu); - static QString urlifyFileName(const QString &fileName); - - void removePendingBrowser(HelpWindow *win); - -public slots: - MainWindow *newWindow(); - - void setup(); - void showLink(const QString &link); - void showLinks(const QStringList &links); - void saveSettings(); - void updateBookmarkMenu(); - void printingFinished(); - -private slots: - void on_actionNewWindow_triggered(); - void on_actionGoHome_triggered(); - void on_actionFilePrint_triggered(); - void on_actionClose_triggered(); - void on_actionHelpWhatsThis_triggered(); - void on_actionHelpAssistant_triggered(); - void on_actionAboutApplication_triggered(); - void on_actionAboutAssistant_triggered(); - void on_actionSaveAs_triggered(); - void on_actionSyncToc_triggered(); - - void about(); - void setupBookmarkMenu(); - void showBookmark(QAction *action); - void showLinkFromClient(const QString &link); - void showQtHelp(); - void showSearchLink(const QString &link, const QStringList &terms); - void showGoActionLink(); - void updateProfileSettings(); - void backwardAvailable(bool); - void forwardAvailable(bool); - - void browserTabChanged(); - void copyAvailable(bool yes); - void updateTabActions(int index); - void showFontSettingsDialog(); - -protected: - void closeEvent(QCloseEvent *); - void timerEvent(QTimerEvent *); - -private: - void setupGoActions(); - bool insertActionSeparator(); - void updateApplicationFontSettings(FontSettings &settings); - -private: - Ui::MainWindow ui; - - QList<QAction*> goActions; - uint setupCompleted:1; - TabbedBrowser *tabs; - QMap<QAction*, QString> bookmarks; - HelpDialog *helpDock; - QDockWidget *dw; - static QList<MainWindow*> windows; - QMap<QAction*,QString> *goActionDocFiles; - QList<QPair<HelpWindow*,QString> > pendingBrowsers; -}; - -#endif // MAINWINDOW_H - -QT_END_NAMESPACE diff --git a/tools/assistant/compat/mainwindow.ui b/tools/assistant/compat/mainwindow.ui deleted file mode 100644 index 535e27e..0000000 --- a/tools/assistant/compat/mainwindow.ui +++ /dev/null @@ -1,457 +0,0 @@ -<ui version="4.0" > - <comment>********************************************************************* -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -*********************************************************************</comment> - <class>MainWindow</class> - <widget class="QMainWindow" name="MainWindow" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>949</width> - <height>670</height> - </rect> - </property> - <property name="windowTitle" > - <string>Qt Assistant by Nokia</string> - </property> - <widget class="QWidget" name="__qt_central_widget" /> - <widget class="QToolBar" name="Toolbar" > - <property name="windowTitle" > - <string>Toolbar</string> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <attribute name="toolBarArea" > - <enum>TopToolBarArea</enum> - </attribute> - <attribute name="toolBarBreak" > - <bool>false</bool> - </attribute> - <addaction name="actionGoPrevious" /> - <addaction name="actionGoNext" /> - <addaction name="actionGoHome" /> - <addaction name="actionSyncToc" /> - <addaction name="separator" /> - <addaction name="actionEditCopy" /> - <addaction name="actionEditFind" /> - <addaction name="actionFilePrint" /> - <addaction name="separator" /> - <addaction name="actionZoomIn" /> - <addaction name="actionZoomOut" /> - <addaction name="separator" /> - <addaction name="actionHelpWhatsThis" /> - </widget> - <widget class="QToolBar" name="goActionToolbar" > - <property name="windowTitle" > - <string>Go</string> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <attribute name="toolBarArea" > - <enum>TopToolBarArea</enum> - </attribute> - <attribute name="toolBarBreak" > - <bool>false</bool> - </attribute> - </widget> - <widget class="QMenuBar" name="menubar" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>949</width> - <height>29</height> - </rect> - </property> - <widget class="QMenu" name="helpMenu" > - <property name="title" > - <string>&Help</string> - </property> - <addaction name="actionHelpAssistant" /> - <addaction name="separator" /> - <addaction name="actionAboutAssistant" /> - <addaction name="actionAboutApplication" /> - <addaction name="separator" /> - <addaction name="actionHelpWhatsThis" /> - </widget> - <widget class="QMenu" name="fileMenu" > - <property name="title" > - <string>&File</string> - </property> - <addaction name="actionNewWindow" /> - <addaction name="actionOpenPage" /> - <addaction name="actionClosePage" /> - <addaction name="separator" /> - <addaction name="actionSaveAs" /> - <addaction name="separator" /> - <addaction name="actionFilePrint" /> - <addaction name="separator" /> - <addaction name="actionClose" /> - <addaction name="actionFileExit" /> - </widget> - <widget class="QMenu" name="bookmarkMenu" > - <property name="title" > - <string>Boo&kmarks</string> - </property> - </widget> - <widget class="QMenu" name="goMenu" > - <property name="title" > - <string>&Go</string> - </property> - <addaction name="actionGoPrevious" /> - <addaction name="actionGoNext" /> - <addaction name="actionGoHome" /> - <addaction name="actionSyncToc" /> - <addaction name="separator" /> - <addaction name="actionNextPage" /> - <addaction name="actionPrevPage" /> - </widget> - <widget class="QMenu" name="viewMenu" > - <property name="title" > - <string>&View</string> - </property> - <addaction name="actionZoomIn" /> - <addaction name="actionZoomOut" /> - </widget> - <widget class="QMenu" name="editMenu" > - <property name="title" > - <string>&Edit</string> - </property> - <addaction name="actionEditCopy" /> - <addaction name="actionEditFind" /> - <addaction name="actionEditFindNext" /> - <addaction name="actionEditFindPrev" /> - <addaction name="separator" /> - <addaction name="actionEditFont_Settings" /> - </widget> - <addaction name="fileMenu" /> - <addaction name="editMenu" /> - <addaction name="viewMenu" /> - <addaction name="goMenu" /> - <addaction name="bookmarkMenu" /> - <addaction name="helpMenu" /> - </widget> - <action name="actionFilePrint" > - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/win/print.png</iconset> - </property> - <property name="text" > - <string>&Print...</string> - </property> - <property name="whatsThis" > - <string>Print the currently displayed page.</string> - </property> - <property name="shortcut" > - <string>Ctrl+P</string> - </property> - </action> - <action name="actionFileExit" > - <property name="text" > - <string>E&xit</string> - </property> - <property name="whatsThis" > - <string>Quit Qt Assistant.</string> - </property> - <property name="shortcut" > - <string>Ctrl+Q</string> - </property> - <property name="menuRole" > - <enum>QAction::QuitRole</enum> - </property> - </action> - <action name="actionEditCopy" > - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/win/editcopy.png</iconset> - </property> - <property name="text" > - <string>&Copy</string> - </property> - <property name="whatsThis" > - <string>Copy the selected text to the clipboard.</string> - </property> - <property name="shortcut" > - <string>Ctrl+C</string> - </property> - </action> - <action name="actionEditFind" > - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/win/find.png</iconset> - </property> - <property name="text" > - <string>&Find in Text...</string> - </property> - <property name="whatsThis" > - <string>Open the Find dialog. Qt Assistant will search the currently displayed page for the text you enter.</string> - </property> - <property name="shortcut" > - <string>Ctrl+F</string> - </property> - </action> - <action name="actionEditFindNext" > - <property name="text" > - <string>Find &Next</string> - </property> - <property name="shortcut" > - <string>F3</string> - </property> - </action> - <action name="actionEditFindPrev" > - <property name="text" > - <string>Find &Previous</string> - </property> - <property name="shortcut" > - <string>Shift+F3</string> - </property> - </action> - <action name="actionGoHome" > - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/win/home.png</iconset> - </property> - <property name="text" > - <string>&Home</string> - </property> - <property name="whatsThis" > - <string>Go to the home page. Qt Assistant's home page is the Qt Reference Documentation.</string> - </property> - <property name="shortcut" > - <string>Ctrl+Home</string> - </property> - </action> - <action name="actionGoPrevious" > - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/win/previous.png</iconset> - </property> - <property name="text" > - <string>&Previous</string> - </property> - <property name="whatsThis" > - <string>Go to the previous page.</string> - </property> - <property name="shortcut" > - <string>Alt+Left</string> - </property> - </action> - <action name="actionGoNext" > - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/win/next.png</iconset> - </property> - <property name="text" > - <string>&Next</string> - </property> - <property name="whatsThis" > - <string>Go to the next page.</string> - </property> - <property name="shortcut" > - <string>Alt+Right</string> - </property> - </action> - <action name="actionAboutAssistant" > - <property name="text" > - <string>About Qt Assistant</string> - </property> - <property name="whatsThis" > - <string>Display further information about Qt Assistant.</string> - </property> - <property name="menuRole" > - <enum>QAction::AboutRole</enum> - </property> - </action> - <action name="actionAboutApplication" > - <property name="text" > - <string>About Qt</string> - </property> - <property name="menuRole" > - <enum>QAction::AboutQtRole</enum> - </property> - </action> - <action name="actionZoomIn" > - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/win/zoomin.png</iconset> - </property> - <property name="text" > - <string>Zoom &in</string> - </property> - <property name="whatsThis" > - <string>Zoom in on the document, i.e. increase the font size.</string> - </property> - <property name="shortcut" > - <string>Ctrl++</string> - </property> - </action> - <action name="actionZoomOut" > - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/win/zoomout.png</iconset> - </property> - <property name="text" > - <string>Zoom &out</string> - </property> - <property name="whatsThis" > - <string>Zoom out on the document, i.e. decrease the font size.</string> - </property> - <property name="shortcut" > - <string>Ctrl+-</string> - </property> - </action> - <action name="actionNewWindow" > - <property name="text" > - <string>New Window</string> - </property> - <property name="whatsThis" > - <string>Open a new window.</string> - </property> - <property name="shortcut" > - <string>Ctrl+N</string> - </property> - </action> - <action name="actionClose" > - <property name="text" > - <string>&Close</string> - </property> - <property name="whatsThis" > - <string>Close the current window.</string> - </property> - <property name="shortcut" > - <string>Ctrl+W</string> - </property> - </action> - <action name="actionAddBookmark" > - <property name="text" > - <string>&Add Bookmark</string> - </property> - <property name="whatsThis" > - <string>Add the currently displayed page as a new bookmark.</string> - </property> - </action> - <action name="actionHelpWhatsThis" > - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/win/whatsthis.png</iconset> - </property> - <property name="text" > - <string>What's This?</string> - </property> - <property name="statusTip" > - <string>"What's This?" context sensitive help.</string> - </property> - <property name="whatsThis" > - <string>"What's This?" context sensitive help.</string> - </property> - <property name="shortcut" > - <string>Shift+F1</string> - </property> - </action> - <action name="actionOpenPage" > - <property name="text" > - <string>Add Tab</string> - </property> - <property name="shortcut" > - <string>Ctrl+Alt+N</string> - </property> - </action> - <action name="actionNextPage" > - <property name="text" > - <string>Next Tab</string> - </property> - <property name="shortcut" > - <string>Ctrl+Alt+Right</string> - </property> - </action> - <action name="actionPrevPage" > - <property name="text" > - <string>Previous Tab</string> - </property> - <property name="shortcut" > - <string>Ctrl+Alt+Left</string> - </property> - </action> - <action name="actionClosePage" > - <property name="text" > - <string>Close Tab</string> - </property> - <property name="shortcut" > - <string>Ctrl+Alt+Q</string> - </property> - </action> - <action name="actionHelpAssistant" > - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/assistant.png</iconset> - </property> - <property name="text" > - <string>Qt Assistant Manual</string> - </property> - <property name="shortcut" > - <string>F1</string> - </property> - </action> - <action name="actionSaveAs" > - <property name="text" > - <string>Save Page As...</string> - </property> - <property name="shortcut" > - <string>Ctrl+Alt+S</string> - </property> - </action> - <action name="actionSyncToc" > - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/win/synctoc.png</iconset> - </property> - <property name="text" > - <string>Sync with Table of Contents</string> - </property> - <property name="whatsThis" > - <string>Select the page in contents tab.</string> - </property> - </action> - <action name="actionEditFont_Settings" > - <property name="text" > - <string>Font Settings...</string> - </property> - <property name="menuRole" > - <enum>QAction::PreferencesRole</enum> - </property> - </action> - </widget> - <resources> - <include location="assistant.qrc" /> - </resources> - <connections/> -</ui> diff --git a/tools/assistant/compat/profile.cpp b/tools/assistant/compat/profile.cpp deleted file mode 100644 index 2878a20..0000000 --- a/tools/assistant/compat/profile.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "profile.h" -#include <QTextCodec> -#include <QFileInfo> -#include <QRegExp> -#include <QDir> -#include <QList> -#include <QLibraryInfo> - -QT_BEGIN_NAMESPACE - -#define QT_TITLE QLatin1String("Qt Reference Documentation") -#define DESIGNER_TITLE QLatin1String("Qt Designer Manual") -#define ASSISTANT_TITLE QLatin1String("Qt Assistant Manual") -#define LINGUIST_TITLE QLatin1String("Qt Linguist Manual") -#define QMAKE_TITLE QLatin1String("qmake Manual") - -Profile *Profile::createDefaultProfile(const QString &docPath) -{ - QString path = QLibraryInfo::location(QLibraryInfo::DocumentationPath); - if (!docPath.isEmpty()) - path = docPath; - path = QDir::cleanPath(path) + QLatin1String("/html/"); - - Profile *profile = new Profile; - profile->valid = true; - profile->type = DefaultProfile; - profile->props[QLatin1String("name")] = QLatin1String("default"); - profile->props[QLatin1String("applicationicon")] = QLatin1String("assistant.png"); - profile->props[QLatin1String("aboutmenutext")] = QLatin1String("About Qt"); - profile->props[QLatin1String("abouturl")] = QLatin1String("about_qt"); - profile->props[QLatin1String("basepath")] = path; - profile->props[QLatin1String("startpage")] = path + QLatin1String("index.html"); - - profile->addDCFTitle( path + QLatin1String("qt.dcf"), QT_TITLE ); - profile->addDCFTitle( path + QLatin1String("designer.dcf"), DESIGNER_TITLE ); - profile->addDCFTitle( path + QLatin1String("assistant.dcf"), ASSISTANT_TITLE ); - profile->addDCFTitle( path + QLatin1String("linguist.dcf"), LINGUIST_TITLE ); - profile->addDCFTitle( path + QLatin1String("qmake.dcf"), QMAKE_TITLE ); - - profile->addDCFIcon( QT_TITLE, QLatin1String("qt.png") ); - profile->addDCFIcon( DESIGNER_TITLE, QLatin1String("designer.png") ); - profile->addDCFIcon( ASSISTANT_TITLE, QLatin1String("assistant.png") ); - profile->addDCFIcon( LINGUIST_TITLE, QLatin1String("linguist.png") ); - - profile->addDCFIndexPage( QT_TITLE, path + QLatin1String("index.html") ); - profile->addDCFIndexPage( DESIGNER_TITLE, path + QLatin1String("designer-manual.html") ); - profile->addDCFIndexPage( ASSISTANT_TITLE, path + QLatin1String("assistant-manual.html") ); - profile->addDCFIndexPage( LINGUIST_TITLE, path + QLatin1String("linguist-manual.html") ); - profile->addDCFIndexPage( QMAKE_TITLE, path + QLatin1String("qmake-manual.html") ); - - profile->addDCFImageDir( QT_TITLE, QLatin1String("../../gif/") ); - profile->addDCFImageDir( DESIGNER_TITLE, QLatin1String("../../gif/") ); - profile->addDCFImageDir( ASSISTANT_TITLE, QLatin1String("../../gif/") ); - profile->addDCFImageDir( LINGUIST_TITLE, QLatin1String("../../gif/") ); - profile->addDCFImageDir( QMAKE_TITLE, QLatin1String("../../gif/") ); - - return profile; -} - -Profile::Profile() - : valid( true ), dparser( 0 ) -{ - type = DefaultProfile; -} - -bool Profile::isValid() const -{ - return valid; -} - -void Profile::addDCFTitle(const QString &dcf, const QString &title) -{ - QString absdcf = QFileInfo(dcf).absoluteFilePath(); - dcfTitles[title] = absdcf; - if (!docs.contains(absdcf)) - docs << absdcf; -} - -void Profile::addDCF(const QString &docfile) -{ - if( !docs.contains( docfile ) == 0 ) - docs << docfile; -} - -void Profile::addDCFIcon(const QString docfile, const QString &icon) -{ - icons[docfile] = icon; -} - -void Profile::addDCFIndexPage(const QString title, const QString &indexPage) -{ - indexPages[title] = indexPage; -} - -void Profile::addDCFImageDir(const QString docfile, const QString &imgDir) -{ - imageDirs[docfile] = imgDir; -} - -void Profile::addProperty(const QString &name, const QString &value) -{ - props[name] = value; -} - -bool Profile::hasDocFile(const QString &name) -{ - return docs.contains( name ); -} - -void Profile::removeDocFileEntry(const QString &docfile) -{ - docs.removeAll(docfile); - QStringList titles; - - for( QMap<QString,QString>::Iterator it = dcfTitles.begin(); - it != dcfTitles.end(); ++it ) { - if( (*it) == docfile ) { - indexPages.remove( *it ); - icons.remove( *it ); - imageDirs.remove( *it ); - titles << it.key(); - } - } - - for( QStringList::ConstIterator title = titles.constBegin(); - title != titles.constEnd(); ++title ) - dcfTitles.remove( *title ); - -#ifdef ASSISTANT_DEBUG - qDebug() << "docs:\n - " << docs.join("\n - "); - qDebug() << "titles:\n - " << titles.join("\n - "); - qDebug() << "keys:\n - " << ((QStringList*)&(dcfTitles.keys()))->join("\n - "); - qDebug() << "values:\n - " << ((QStringList*)&(dcfTitles.values()))->join("\n - "); -#endif -} - -QString Profile::storableFilePath(const QString &fileName) -{ - QString path = QLibraryInfo::location(QLibraryInfo::DocumentationPath).replace(QLatin1String("\\"), QLatin1String("/")); - QString fName = fileName; - if (fName.startsWith(path)) - fName.replace(0, path.length(), QLatin1String("$DOCPATH$")); - return fName; -} - -QString Profile::loadableFilePath(const QString &fileName) -{ - QString path = QLibraryInfo::location(QLibraryInfo::DocumentationPath).replace(QLatin1String("\\"), QLatin1String("/")); - QString fName = fileName; - if (fName.startsWith(QLatin1String("$DOCPATH$"))) - fName.replace(0, 9, path); - return fName; -} - -QT_END_NAMESPACE diff --git a/tools/assistant/compat/profile.h b/tools/assistant/compat/profile.h deleted file mode 100644 index 1aa9719..0000000 --- a/tools/assistant/compat/profile.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PROFILE_H -#define PROFILE_H - -#include <QFileInfo> -#include <QString> -#include <QStringList> -#include <QMap> - -QT_BEGIN_NAMESPACE - -class DocuParser; - -class Profile -{ -public: - enum ProfileType { DefaultProfile, UserProfile }; - Profile(); - - bool isValid() const; - - void addDCF( const QString &docfile ); - void addDCFIcon( const QString title, const QString &icon ); - void addDCFIndexPage( const QString title, const QString &indexPage ); - void addDCFImageDir( const QString title, const QString &imgDir ); - void addDCFTitle( const QString &dcf, const QString &title ); - void addProperty( const QString &name, const QString &value ); - bool hasDocFile( const QString &docFile ); - void removeDocFileEntry( const QString &title ); - - ProfileType profileType() const { return type; } - void setProfileType( ProfileType t ) { type = t; } - - DocuParser *docuParser() const { return dparser; } - void setDocuParser( DocuParser *dp ) { dparser = dp; } - - static Profile* createDefaultProfile(const QString &docPath = QString()); - static QString makeRelativePath(const QString &base, const QString &path); - static QString storableFilePath(const QString &fileName); - static QString loadableFilePath(const QString &fileName); - - uint valid:1; - ProfileType type; - DocuParser *dparser; - QMap<QString,QString> props; - QMap<QString,QString> icons; - QMap<QString,QString> indexPages; - QMap<QString,QString> imageDirs; - QMap<QString,QString> dcfTitles; - QStringList docs; -}; - -QT_END_NAMESPACE - -#endif // PROFILE_H diff --git a/tools/assistant/compat/tabbedbrowser.cpp b/tools/assistant/compat/tabbedbrowser.cpp deleted file mode 100644 index c3c1572..0000000 --- a/tools/assistant/compat/tabbedbrowser.cpp +++ /dev/null @@ -1,530 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "tabbedbrowser.h" -#include "mainwindow.h" -#include "helpwindow.h" -#include "config.h" - -#include <QStyleOptionTab> -#include <QToolTip> -#include <QFileInfo> -#include <QToolButton> -#include <QPixmap> -#include <QIcon> -#include <QStyle> -#include <QTimer> -#include <QStackedWidget> -#include <QTimer> -#include <QTextBlock> -#include <QKeyEvent> - -QT_BEGIN_NAMESPACE - -#ifdef Q_WS_MAC -const QLatin1String ImageLocation(":trolltech/assistant/images/mac/"); -#else -const QLatin1String ImageLocation(":trolltech/assistant/images/win/"); -#endif - -TabbedBrowser::TabbedBrowser(MainWindow *parent) - : QWidget(parent) -{ - ui.setupUi(this); - init(); - - QStackedWidget *stack = qFindChild<QStackedWidget*>(ui.tab); - Q_ASSERT(stack); - stack->setContentsMargins(0, 0, 0, 0); - connect(stack, SIGNAL(currentChanged(int)), parent, SLOT(browserTabChanged())); - - QPalette p = palette(); - p.setColor(QPalette::Inactive, QPalette::Highlight, - p.color(QPalette::Active, QPalette::Highlight)); - p.setColor(QPalette::Inactive, QPalette::HighlightedText, - p.color(QPalette::Active, QPalette::HighlightedText)); - setPalette(p); -} - -TabbedBrowser::~TabbedBrowser() -{ -} - -MainWindow *TabbedBrowser::mainWindow() const -{ - return static_cast<MainWindow*>(parentWidget()); -} - -void TabbedBrowser::forward() -{ - currentBrowser()->forward(); - emit browserUrlChanged(currentBrowser()->source().toString()); -} - -void TabbedBrowser::backward() -{ - currentBrowser()->backward(); - emit browserUrlChanged(currentBrowser()->source().toString()); -} - -void TabbedBrowser::setSource( const QString &ref ) -{ - HelpWindow * win = currentBrowser(); - win->setSource(ref); -} - -void TabbedBrowser::reload() -{ - currentBrowser()->reload(); -} - -void TabbedBrowser::home() -{ - currentBrowser()->home(); -} - -HelpWindow *TabbedBrowser::currentBrowser() const -{ - return static_cast<HelpWindow*>(ui.tab->currentWidget()); -} - -void TabbedBrowser::nextTab() -{ - if(ui.tab->currentIndex()<=ui.tab->count()-1) - ui.tab->setCurrentIndex(ui.tab->currentIndex()+1); -} - -void TabbedBrowser::previousTab() -{ - int idx = ui.tab->currentIndex()-1; - if(idx>=0) - ui.tab->setCurrentIndex(idx); -} - -HelpWindow *TabbedBrowser::createHelpWindow() -{ - MainWindow *mainWin = mainWindow(); - HelpWindow *win = new HelpWindow(mainWin, 0); - win->setFrameStyle(QFrame::NoFrame); - win->setPalette(palette()); - win->setSearchPaths(Config::configuration()->mimePaths()); - ui.tab->addTab(win, tr("...")); - connect(win, SIGNAL(highlighted(QString)), - (const QObject*) (mainWin->statusBar()), SLOT(showMessage(QString))); - connect(win, SIGNAL(backwardAvailable(bool)), - mainWin, SLOT(backwardAvailable(bool))); - connect(win, SIGNAL(forwardAvailable(bool)), - mainWin, SLOT(forwardAvailable(bool))); - connect(win, SIGNAL(sourceChanged(QUrl)), this, SLOT(sourceChanged())); - - ui.tab->cornerWidget(Qt::TopRightCorner)->setEnabled(ui.tab->count() > 1); - win->installEventFilter(this); - win->viewport()->installEventFilter(this); - ui.editFind->installEventFilter(this); - return win; -} - -HelpWindow *TabbedBrowser::newBackgroundTab() -{ - HelpWindow *win = createHelpWindow(); - emit tabCountChanged(ui.tab->count()); - return win; -} - -void TabbedBrowser::newTab(const QString &lnk) -{ - QString link(lnk); - if(link.isNull()) { - HelpWindow *w = currentBrowser(); - if(w) - link = w->source().toString(); - } - HelpWindow *win = createHelpWindow(); - ui.tab->setCurrentIndex(ui.tab->indexOf(win)); - if(!link.isNull()) { - win->setSource(link); - } - - emit tabCountChanged(ui.tab->count()); -} - -void TabbedBrowser::zoomIn() -{ - currentBrowser()->zoomIn(); - Config::configuration()->setFontPointSize(currentBrowser()->font().pointSizeF()); -} - -void TabbedBrowser::zoomOut() -{ - currentBrowser()->zoomOut(); - Config::configuration()->setFontPointSize(currentBrowser()->font().pointSizeF()); -} - -void TabbedBrowser::init() -{ - - lastCurrentTab = 0; - while(ui.tab->count()) { - QWidget *page = ui.tab->widget(0); - ui.tab->removeTab(0); - delete page; - } - - connect(ui.tab, SIGNAL(currentChanged(int)), - this, SLOT(transferFocus())); - - QTabBar *tabBar = qFindChild<QTabBar*>(ui.tab); - QStyleOptionTab opt; - if (tabBar) { - opt.init(tabBar); - opt.shape = tabBar->shape(); - tabBar->setContextMenuPolicy(Qt::CustomContextMenu); - connect(tabBar, SIGNAL(customContextMenuRequested(QPoint)), SLOT(openTabMenu(QPoint))); - } - - // workaround for sgi style - QPalette pal = palette(); - pal.setColor(QPalette::Active, QPalette::Button, pal.color(QPalette::Active, QPalette::Window)); - pal.setColor(QPalette::Disabled, QPalette::Button, pal.color(QPalette::Disabled, QPalette::Window)); - pal.setColor(QPalette::Inactive, QPalette::Button, pal.color(QPalette::Inactive, QPalette::Window)); - - QToolButton *newTabButton = new QToolButton(this); - ui.tab->setCornerWidget(newTabButton, Qt::TopLeftCorner); - newTabButton->setCursor(Qt::ArrowCursor); - newTabButton->setAutoRaise(true); - newTabButton->setIcon(QIcon(ImageLocation + QLatin1String("addtab.png"))); - QObject::connect(newTabButton, SIGNAL(clicked()), this, SLOT(newTab())); - newTabButton->setToolTip(tr("Add page")); - - QToolButton *closeTabButton = new QToolButton(this); - closeTabButton->setPalette(pal); - ui.tab->setCornerWidget(closeTabButton, Qt::TopRightCorner); - closeTabButton->setCursor(Qt::ArrowCursor); - closeTabButton->setAutoRaise(true); - closeTabButton->setIcon(QIcon(ImageLocation + QLatin1String("closetab.png"))); - QObject::connect(closeTabButton, SIGNAL(clicked()), this, SLOT(closeTab())); - closeTabButton->setToolTip(tr("Close page")); - closeTabButton->setEnabled(false); - - QObject::connect(ui.toolClose, SIGNAL(clicked()), ui.frameFind, SLOT(hide())); - QObject::connect(ui.toolPrevious, SIGNAL(clicked()), this, SLOT(findPrevious())); - QObject::connect(ui.toolNext, SIGNAL(clicked()), this, SLOT(findNext())); - QObject::connect(ui.editFind, SIGNAL(returnPressed()), this, SLOT(findNext())); - QObject::connect(ui.editFind, SIGNAL(textEdited(QString)), - this, SLOT(find(QString))); - ui.frameFind->setVisible(false); - ui.labelWrapped->setVisible(false); - autoHideTimer = new QTimer(this); - autoHideTimer->setInterval(5000); - autoHideTimer->setSingleShot(true); - QObject::connect(autoHideTimer, SIGNAL(timeout()), ui.frameFind, SLOT(hide())); -} - -void TabbedBrowser::updateTitle(const QString &title) -{ - ui.tab->setTabText(ui.tab->indexOf(currentBrowser()), title.trimmed()); -} - -void TabbedBrowser::newTab() -{ - newTab(QString()); -} - -void TabbedBrowser::transferFocus() -{ - if(currentBrowser()) { - currentBrowser()->setFocus(); - } - mainWindow()->setWindowTitle(Config::configuration()->title() - + QLatin1String(" - ") - + currentBrowser()->documentTitle()); -} - -void TabbedBrowser::initHelpWindow(HelpWindow * /*win*/) -{ -} - -void TabbedBrowser::setup() -{ - newTab(QString()); -} - -void TabbedBrowser::copy() -{ - currentBrowser()->copy(); -} - -void TabbedBrowser::closeTab() -{ - if(ui.tab->count()==1) - return; - HelpWindow *win = currentBrowser(); - mainWindow()->removePendingBrowser(win); - ui.tab->removeTab(ui.tab->indexOf(win)); - QTimer::singleShot(0, win, SLOT(deleteLater())); - ui.tab->cornerWidget(Qt::TopRightCorner)->setEnabled(ui.tab->count() > 1); - emit tabCountChanged(ui.tab->count()); -} - -QStringList TabbedBrowser::sources() const -{ - QStringList lst; - int cnt = ui.tab->count(); - for(int i=0; i<cnt; i++) { - lst.append(((QTextBrowser*) ui.tab->widget(i))->source().toString()); - } - return lst; -} - -QList<HelpWindow*> TabbedBrowser::browsers() const -{ - QList<HelpWindow*> list; - for (int i=0; i<ui.tab->count(); ++i) { - Q_ASSERT(qobject_cast<HelpWindow*>(ui.tab->widget(i))); - list.append(static_cast<HelpWindow*>(ui.tab->widget(i))); - } - return list; -} - -void TabbedBrowser::sourceChanged() -{ - HelpWindow *win = qobject_cast<HelpWindow *>(QObject::sender()); - Q_ASSERT(win); - QString docTitle(win->documentTitle()); - if (docTitle.isEmpty()) - docTitle = QLatin1String("..."); - // Make the classname in the title a bit more visible (otherwise - // we just see the "Qt 4.0 : Q..." which isn't really helpful ;-) - QString qtTitle = QLatin1String("Qt ") + QString::number( (QT_VERSION >> 16) & 0xff ) - + QLatin1String(".") + QString::number( (QT_VERSION >> 8) & 0xff ) - + QLatin1String(": "); - if (docTitle.startsWith(qtTitle)) - docTitle = docTitle.mid(qtTitle.length()); - setTitle(win, docTitle); - ui.frameFind->hide(); - ui.labelWrapped->hide(); - win->setTextCursor(win->cursorForPosition(QPoint(0, 0))); -} - -void TabbedBrowser::setTitle(HelpWindow *win, const QString &title) -{ - const QString tt = title.trimmed(); - ui.tab->setTabText(ui.tab->indexOf(win), tt); - if (win == currentBrowser()) - mainWindow()->setWindowTitle(Config::configuration()->title() + QLatin1String(" - ") + tt); -} - -void TabbedBrowser::keyPressEvent(QKeyEvent *e) -{ - int key = e->key(); - QString ttf = ui.editFind->text(); - QString text = e->text(); - - if (ui.frameFind->isVisible()) { - switch (key) { - case Qt::Key_Escape: - ui.frameFind->hide(); - ui.labelWrapped->hide(); - return; - case Qt::Key_Backspace: - ttf.chop(1); - break; - case Qt::Key_Return: - case Qt::Key_Enter: - // Return/Enter key events are not accepted by QLineEdit - return; - default: - if (text.isEmpty()) { - QWidget::keyPressEvent(e); - return; - } - ttf += text; - } - } else { - if (text.isEmpty() || text[0].isSpace() || !text[0].isPrint()) { - QWidget::keyPressEvent(e); - return; - } - if (text.startsWith(QLatin1Char('/'))) { - ui.editFind->clear(); - find(); - return; - } - ttf = text; - ui.frameFind->show(); - } - - ui.editFind->setText(ttf); - find(ttf, false, false); -} - -void TabbedBrowser::findNext() -{ - find(ui.editFind->text(), true, false); -} - -void TabbedBrowser::findPrevious() -{ - find(ui.editFind->text(), false, true); -} - -void TabbedBrowser::find() -{ - ui.frameFind->show(); - ui.editFind->setFocus(Qt::ShortcutFocusReason); - ui.editFind->selectAll(); - autoHideTimer->stop(); -} - -void TabbedBrowser::find(QString ttf, bool forward, bool backward) -{ - HelpWindow *browser = currentBrowser(); - QTextDocument *doc = browser->document(); - QString oldText = ui.editFind->text(); - QTextCursor c = browser->textCursor(); - QTextDocument::FindFlags options; - QPalette p = ui.editFind->palette(); - p.setColor(QPalette::Active, QPalette::Base, Qt::white); - - if (c.hasSelection()) - c.setPosition(forward ? c.position() : c.anchor(), QTextCursor::MoveAnchor); - - QTextCursor newCursor = c; - - if (!ttf.isEmpty()) { - if (backward) - options |= QTextDocument::FindBackward; - - if (ui.checkCase->isChecked()) - options |= QTextDocument::FindCaseSensitively; - - if (ui.checkWholeWords->isChecked()) - options |= QTextDocument::FindWholeWords; - - newCursor = doc->find(ttf, c, options); - ui.labelWrapped->hide(); - - if (newCursor.isNull()) { - QTextCursor ac(doc); - ac.movePosition(options & QTextDocument::FindBackward - ? QTextCursor::End : QTextCursor::Start); - newCursor = doc->find(ttf, ac, options); - if (newCursor.isNull()) { - p.setColor(QPalette::Active, QPalette::Base, QColor(255, 102, 102)); - newCursor = c; - } else - ui.labelWrapped->show(); - } - } - - if (!ui.frameFind->isVisible()) - ui.frameFind->show(); - browser->setTextCursor(newCursor); - ui.editFind->setPalette(p); - if (!ui.editFind->hasFocus()) - autoHideTimer->start(); -} - -bool TabbedBrowser::eventFilter(QObject *o, QEvent *e) -{ - if (o == ui.editFind) { - if (e->type() == QEvent::FocusIn && autoHideTimer->isActive()) - autoHideTimer->stop(); - } else if (e->type() == QEvent::KeyPress && ui.frameFind->isVisible()) { // assume textbrowser - QKeyEvent *ke = static_cast<QKeyEvent *>(e); - if (ke->key() == Qt::Key_Space) { - keyPressEvent(ke); - return true; - } - } - - return QWidget::eventFilter(o, e); -} - -void TabbedBrowser::openTabMenu(const QPoint& pos) -{ - QTabBar *tabBar = qFindChild<QTabBar*>(ui.tab); - - QMenu m(QLatin1String(""), tabBar); - QAction *new_action = m.addAction(tr("New Tab")); - QAction *close_action = m.addAction(tr("Close Tab")); - QAction *close_others_action = m.addAction(tr("Close Other Tabs")); - - if (tabBar->count() == 1) { - close_action->setEnabled(false); - close_others_action->setEnabled(false); - } - - QAction *action_picked = m.exec(tabBar->mapToGlobal(pos)); - if (!action_picked) - return; - - if (action_picked == new_action) { - newTab(); - return; - } - - QList<HelpWindow*> windowList = browsers(); - for (int i = 0; i < tabBar->count(); ++i) { - if (tabBar->tabRect(i).contains(pos)) { - HelpWindow *win = static_cast<HelpWindow*>(ui.tab->widget(i)); - if (action_picked == close_action) { - mainWindow()->removePendingBrowser(win); - QTimer::singleShot(0, win, SLOT(deleteLater())); - } - windowList.removeOne(win); - break; - } - } - - if (action_picked == close_others_action) { - foreach (HelpWindow* win, windowList) { - mainWindow()->removePendingBrowser(win); - QTimer::singleShot(0, win, SLOT(deleteLater())); - windowList.removeOne(win); - } - } - - ui.tab->cornerWidget(Qt::TopRightCorner)->setEnabled(windowList.count() > 1); - emit tabCountChanged(windowList.count()); -} - -QT_END_NAMESPACE diff --git a/tools/assistant/compat/tabbedbrowser.h b/tools/assistant/compat/tabbedbrowser.h deleted file mode 100644 index 0e32505..0000000 --- a/tools/assistant/compat/tabbedbrowser.h +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TABBEDBROWSER_H -#define TABBEDBROWSER_H - -#include "ui_tabbedbrowser.h" - -QT_BEGIN_NAMESPACE - -class MainWindow; -class HelpWindow; -class QStyleSheet; -class QMimeSourceFactory; -class QTimer; - -class TabbedBrowser : public QWidget -{ - Q_OBJECT -public: - TabbedBrowser(MainWindow *parent); - virtual ~TabbedBrowser(); - - MainWindow *mainWindow() const; - HelpWindow *currentBrowser() const; - QStringList sources() const; - QList<HelpWindow*> browsers() const; - - HelpWindow* newBackgroundTab(); - HelpWindow* createHelpWindow(); - - void setTitle(HelpWindow*, const QString &); - -signals: - void tabCountChanged(int count); - void browserUrlChanged(const QString &link); - -protected: - void keyPressEvent(QKeyEvent *); - bool eventFilter(QObject *o, QEvent *e); - -public slots: - void init(); - void forward(); - void backward(); - void setSource(const QString &ref); - void reload(); - void home(); - void nextTab(); - void previousTab(); - void newTab(const QString &lnk); - void zoomIn(); - void zoomOut(); - void updateTitle(const QString &title); - void newTab(); - void transferFocus(); - void initHelpWindow(HelpWindow *win); - void setup(); - void copy(); - void closeTab(); - void sourceChanged(); - - void find(); - void findNext(); - void findPrevious(); - -private slots: - void find(QString, bool forward = false, bool backward = false); - void openTabMenu(const QPoint& pos); - -private: - Ui::TabbedBrowser ui; - QWidget *lastCurrentTab; - QFont tabFont; - - QString fixedFontFam; - QColor lnkColor; - bool underlineLnk; - QTimer *autoHideTimer; -}; - -QT_END_NAMESPACE - -#endif // TABBEDBROWSER_H diff --git a/tools/assistant/compat/tabbedbrowser.ui b/tools/assistant/compat/tabbedbrowser.ui deleted file mode 100644 index 411f145..0000000 --- a/tools/assistant/compat/tabbedbrowser.ui +++ /dev/null @@ -1,233 +0,0 @@ -<ui version="4.0" > - <author></author> - <comment>********************************************************************* -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -*********************************************************************</comment> - <exportmacro></exportmacro> - <class>TabbedBrowser</class> - <widget class="QWidget" name="TabbedBrowser" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>710</width> - <height>664</height> - </rect> - </property> - <property name="windowTitle" > - <string>TabbedBrowser</string> - </property> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>0</number> - </property> - <item> - <widget class="QTabWidget" name="tab" > - <widget class="QWidget" name="frontpage" > - <attribute name="title" > - <string>Untitled</string> - </attribute> - <layout class="QGridLayout" > - <property name="margin" > - <number>8</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - </layout> - </widget> - </widget> - </item> - <item> - <widget class="QFrame" name="frameFind" > - <property name="frameShape" > - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Raised</enum> - </property> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QToolButton" name="toolClose" > - <property name="text" > - <string/> - </property> - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/close.png</iconset> - </property> - <property name="autoRaise" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="editFind" > - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize" > - <size> - <width>150</width> - <height>0</height> - </size> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="toolPrevious" > - <property name="text" > - <string>Previous</string> - </property> - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/win/previous.png</iconset> - </property> - <property name="toolButtonStyle" > - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="toolNext" > - <property name="minimumSize" > - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text" > - <string>Next</string> - </property> - <property name="icon" > - <iconset resource="assistant.qrc" >:/trolltech/assistant/images/win/next.png</iconset> - </property> - <property name="toolButtonStyle" > - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise" > - <bool>true</bool> - </property> - <property name="arrowType" > - <enum>Qt::NoArrow</enum> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="checkCase" > - <property name="text" > - <string>Case Sensitive</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="checkWholeWords" > - <property name="text" > - <string>Whole words</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="labelWrapped" > - <property name="minimumSize" > - <size> - <width>0</width> - <height>20</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>105</width> - <height>20</height> - </size> - </property> - <property name="text" > - <string><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped</string> - </property> - <property name="textFormat" > - <enum>Qt::RichText</enum> - </property> - <property name="scaledContents" > - <bool>true</bool> - </property> - <property name="alignment" > - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>81</width> - <height>21</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <pixmapfunction></pixmapfunction> - <resources> - <include location="assistant.qrc" /> - </resources> - <connections/> -</ui> diff --git a/tools/assistant/compat/topicchooser.cpp b/tools/assistant/compat/topicchooser.cpp deleted file mode 100644 index b2e7e98..0000000 --- a/tools/assistant/compat/topicchooser.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "topicchooser.h" - -#include <QLabel> -#include <QListWidget> -#include <QPushButton> - -QT_BEGIN_NAMESPACE - -TopicChooser::TopicChooser(QWidget *parent, const QStringList &lnkNames, - const QStringList &lnks, const QString &title) - : QDialog(parent), links(lnks), linkNames(lnkNames) -{ - ui.setupUi(this); - - ui.label->setText(tr("Choose a topic for <b>%1</b>").arg(title)); - ui.listbox->addItems(linkNames); - if (ui.listbox->count() != 0) - ui.listbox->setCurrentRow(0); - ui.listbox->setFocus(); -} - -QString TopicChooser::link() const -{ - if (ui.listbox->currentRow() == -1) - return QString(); - QString s = ui.listbox->item(ui.listbox->currentRow())->text(); - if (s.isEmpty()) - return s; - int i = linkNames.indexOf(s); - return links[i]; -} - -QString TopicChooser::getLink(QWidget *parent, const QStringList &lnkNames, - const QStringList &lnks, const QString &title) -{ - TopicChooser *dlg = new TopicChooser(parent, lnkNames, lnks, title); - QString lnk; - if (dlg->exec() == QDialog::Accepted) - lnk = dlg->link(); - delete dlg; - return lnk; -} - -void TopicChooser::on_buttonDisplay_clicked() -{ - accept(); -} - -void TopicChooser::on_buttonCancel_clicked() -{ - reject(); -} - -void TopicChooser::on_listbox_itemActivated(QListWidgetItem *item) -{ - Q_UNUSED(item); - accept(); -} - -QT_END_NAMESPACE diff --git a/tools/assistant/compat/topicchooser.ui b/tools/assistant/compat/topicchooser.ui deleted file mode 100644 index 18ff61b..0000000 --- a/tools/assistant/compat/topicchooser.ui +++ /dev/null @@ -1,162 +0,0 @@ -<ui version="4.0" > - <comment>********************************************************************* -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Assistant of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -*********************************************************************</comment> - <class>TopicChooser</class> - <widget class="QDialog" name="TopicChooser" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>391</width> - <height>223</height> - </rect> - </property> - <property name="windowTitle" > - <string>Choose Topic</string> - </property> - <property name="whatsThis" > - <string>Select a topic from the list and click the <b>Display</b>-button to open the online help.</string> - </property> - <property name="sizeGripEnabled" > - <bool>true</bool> - </property> - <layout class="QVBoxLayout" > - <property name="spacing" > - <number>6</number> - </property> - <property name="leftMargin" > - <number>11</number> - </property> - <property name="topMargin" > - <number>11</number> - </property> - <property name="rightMargin" > - <number>11</number> - </property> - <property name="bottomMargin" > - <number>11</number> - </property> - <item> - <widget class="QLabel" name="label" > - <property name="text" > - <string>&Topics</string> - </property> - <property name="buddy" > - <cstring>listbox</cstring> - </property> - </widget> - </item> - <item> - <widget class="QListWidget" name="listbox" > - <property name="whatsThis" > - <string>Displays a list of available help topics for the keyword.</string> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="spacing" > - <number>6</number> - </property> - <property name="leftMargin" > - <number>0</number> - </property> - <property name="topMargin" > - <number>0</number> - </property> - <property name="rightMargin" > - <number>0</number> - </property> - <property name="bottomMargin" > - <number>0</number> - </property> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="buttonDisplay" > - <property name="whatsThis" > - <string>Open the topic selected in the list.</string> - </property> - <property name="text" > - <string>&Display</string> - </property> - <property name="autoDefault" > - <bool>true</bool> - </property> - <property name="default" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="buttonCancel" > - <property name="whatsThis" > - <string>Close the Dialog.</string> - </property> - <property name="text" > - <string>&Close</string> - </property> - <property name="autoDefault" > - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/tools/assistant/lib/lib.pro b/tools/assistant/lib/lib.pro index 51933de..26d3456 100644 --- a/tools/assistant/lib/lib.pro +++ b/tools/assistant/lib/lib.pro @@ -23,7 +23,6 @@ unix:QMAKE_PKGCONFIG_REQUIRES += QtNetwork \ QtSql \ QtXml LIBS_PRIVATE += -l$$qclucene - RESOURCES += helpsystem.qrc SOURCES += qhelpenginecore.cpp \ qhelpengine.cpp \ @@ -41,6 +40,7 @@ SOURCES += qhelpenginecore.cpp \ qhelpsearchindexwriter_default.cpp \ qhelpsearchindexreader_default.cpp \ qhelpsearchindexreader.cpp \ + qclucenefieldnames.cpp \ qhelp_global.cpp # access to clucene @@ -63,7 +63,8 @@ HEADERS += qhelpenginecore.h \ qhelpsearchindex_default_p.h \ qhelpsearchindexwriter_default_p.h \ qhelpsearchindexreader_default_p.h \ - qhelpsearchindexreader_p.h + qhelpsearchindexreader_p.h \ + qclucenefieldnames_p.h # access to clucene HEADERS += qhelpsearchindexwriter_clucene_p.h \ diff --git a/tools/assistant/compat/fontsettingsdialog.h b/tools/assistant/lib/qclucenefieldnames.cpp index 6599d2a..1a94291 100644 --- a/tools/assistant/compat/fontsettingsdialog.h +++ b/tools/assistant/lib/qclucenefieldnames.cpp @@ -39,39 +39,21 @@ ** ****************************************************************************/ -#ifndef _FONT_SETTINGS_DIALOG_H_ -#define _FONT_SETTINGS_DIALOG_H_ - -#include <QtCore/QObject> -#include <QtGui/QDialog> +#include "qclucenefieldnames_p.h" QT_BEGIN_NAMESPACE -class FontPanel; -struct FontSettings; -class QDialogButtonBox; - -class FontSettingsDialog : public QDialog -{ - Q_OBJECT - -public: - FontSettingsDialog(QWidget *parent = 0); - ~FontSettingsDialog(); - - bool showDialog(FontSettings *settings); - -private: - void updateFontSettings(FontSettings *settings); - void setupFontSettingsDialog(const FontSettings *settings); - -private: - FontPanel *m_windowFontPanel; - FontPanel *m_browserFontPanel; - QDialogButtonBox *m_dialogButtonBox; -}; - -#endif // _FONT_SETTINGS_DIALOG_H_ - +namespace qt { +namespace fulltextsearch { +namespace clucene { +const QString AttributeField(QLatin1String("attribute")); +const QString ContentField(QLatin1String("content")); +const QString NamespaceField(QLatin1String("namespace")); +const QString PathField(QLatin1String("path")); +const QString TitleField(QLatin1String("title")); +const QString TitleTokenizedField(QLatin1String("titleTokenized")); +} // namespace clucene +} // namespace fulltextsearch +} // namespace qt QT_END_NAMESPACE diff --git a/tools/assistant/compat/topicchooser.h b/tools/assistant/lib/qclucenefieldnames_p.h index fef57df..489832f 100644 --- a/tools/assistant/compat/topicchooser.h +++ b/tools/assistant/lib/qclucenefieldnames_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -39,39 +39,27 @@ ** ****************************************************************************/ -#ifndef TOPICCHOOSER_H -#define TOPICCHOOSER_H +#ifndef QCLUCENEFIELDNAMES_P_H +#define QCLUCENEFIELDNAMES_P_H -#include "ui_topicchooser.h" - -#include <QDialog> -#include <QStringList> +#include <QtCore/QtGlobal> +#include <QtCore/QString> QT_BEGIN_NAMESPACE -class TopicChooser : public QDialog -{ - Q_OBJECT -public: - TopicChooser(QWidget *parent, const QStringList &lnkNames, - const QStringList &lnks, const QString &title); - - QString link() const; - - static QString getLink(QWidget *parent, const QStringList &lnkNames, - const QStringList &lnks, const QString &title); - -private slots: - void on_buttonDisplay_clicked(); - void on_buttonCancel_clicked(); - void on_listbox_itemActivated(QListWidgetItem *item); - -private: - Ui::TopicChooser ui; - QString theLink; - QStringList links, linkNames; -}; - -#endif // TOPICCHOOSER_H +namespace qt { +namespace fulltextsearch { +namespace clucene { + extern const QString AttributeField; + extern const QString ContentField; + extern const QString NamespaceField; + extern const QString PathField; + extern const QString TitleField; + extern const QString TitleTokenizedField; +} // namespace clucene +} // namespace fulltextsearch +} // namespace qt QT_END_NAMESPACE + +#endif // QCLUCENEFIELDNAMES_P_H diff --git a/tools/assistant/lib/qhelp_global.cpp b/tools/assistant/lib/qhelp_global.cpp index 539b504..e6a26c4 100644 --- a/tools/assistant/lib/qhelp_global.cpp +++ b/tools/assistant/lib/qhelp_global.cpp @@ -86,17 +86,17 @@ QString QHelpGlobal::codecFromData(const QByteArray &data) QString QHelpGlobal::codecFromHtmlData(const QByteArray &data) { - QString content = QString::fromUtf8(data.constData(), data.size()); - int start = content.indexOf(QLatin1String("<meta"), 0, Qt::CaseInsensitive); + QString head = QString::fromUtf8(data.constData(), qMin(1000, data.size())); + int start = head.indexOf(QLatin1String("<meta"), 0, Qt::CaseInsensitive); if (start > 0) { int end; QRegExp r(QLatin1String("charset=([^\"\\s]+)")); while (start != -1) { - end = content.indexOf(QLatin1Char('>'), start) + 1; - const QString &meta = content.mid(start, end - start).toLower(); + end = head.indexOf(QLatin1Char('>'), start) + 1; + const QString &meta = head.mid(start, end - start).toLower(); if (r.indexIn(meta) != -1) return r.cap(1); - start = content.indexOf(QLatin1String("<meta"), end, + start = head.indexOf(QLatin1String("<meta"), end, Qt::CaseInsensitive); } } @@ -105,8 +105,8 @@ QString QHelpGlobal::codecFromHtmlData(const QByteArray &data) QString QHelpGlobal::codecFromXmlData(const QByteArray &data) { - QString content = QString::fromUtf8(data.constData(), data.size()); + QString head = QString::fromUtf8(data.constData(), qMin(1000, data.size())); const QRegExp encodingExp(QLatin1String("^\\s*<\\?xml version=" "\"\\d\\.\\d\" encoding=\"([^\"]+)\"\\?>.*")); - return encodingExp.exactMatch(content) ? encodingExp.cap(1) : QString(); + return encodingExp.exactMatch(head) ? encodingExp.cap(1) : QString(); } diff --git a/tools/assistant/lib/qhelpcollectionhandler.cpp b/tools/assistant/lib/qhelpcollectionhandler.cpp index fe0c417..9fdbd8e 100644 --- a/tools/assistant/lib/qhelpcollectionhandler.cpp +++ b/tools/assistant/lib/qhelpcollectionhandler.cpp @@ -308,10 +308,8 @@ bool QHelpCollectionHandler::addCustomFilter(const QString &filterName, m_query.prepare(QLatin1String("SELECT Id FROM FilterNameTable WHERE Name=?")); m_query.bindValue(0, filterName); m_query.exec(); - while (m_query.next()) { + if (m_query.next()) nameId = m_query.value(0).toInt(); - break; - } m_query.exec(QLatin1String("SELECT Id, Name FROM FilterAttributeTable")); QStringList idsToInsert = attributes; diff --git a/tools/assistant/lib/qhelpenginecore.cpp b/tools/assistant/lib/qhelpenginecore.cpp index 0911d59..0fceaaa 100644 --- a/tools/assistant/lib/qhelpenginecore.cpp +++ b/tools/assistant/lib/qhelpenginecore.cpp @@ -406,8 +406,9 @@ QStringList QHelpEngineCore::customFilters() const /*! Adds the new custom filter \a filterName. The filter attributes - are specified by \a attributes. The function returns false if - the filter can not be added, e.g. when the filter already exists. + are specified by \a attributes. If the filter already exists, + its attribute set is replaced. The function returns true if + the operation succeeded, otherwise it returns false. \sa customFilters(), removeCustomFilter() */ diff --git a/tools/assistant/lib/qhelpgenerator.cpp b/tools/assistant/lib/qhelpgenerator.cpp index 324f67d..a193134 100644 --- a/tools/assistant/lib/qhelpgenerator.cpp +++ b/tools/assistant/lib/qhelpgenerator.cpp @@ -47,6 +47,7 @@ #include <QtCore/QFileInfo> #include <QtCore/QDir> #include <QtCore/QDebug> +#include <QtCore/QSet> #include <QtCore/QVariant> #include <QtCore/QDateTime> #include <QtCore/QTextCodec> @@ -824,4 +825,68 @@ bool QHelpGenerator::insertMetaData(const QMap<QString, QVariant> &metaData) return true; } +bool QHelpGenerator::checkLinks(const QHelpDataInterface &helpData) +{ + /* + * Step 1: Gather the canoncal file paths of all files in the project. + * We use a set, because there will be a lot of look-ups. + */ + QSet<QString> files; + foreach (const QHelpDataFilterSection &filterSection, helpData.filterSections()) { + foreach (const QString &file, filterSection.files()) { + QFileInfo fileInfo(helpData.rootPath() + QDir::separator() + file); + const QString &canonicalFileName = fileInfo.canonicalFilePath(); + if (!fileInfo.exists()) + emit warning(tr("File '%1' does not exist.").arg(file)); + else + files.insert(canonicalFileName); + } + } + + /* + * Step 2: Check the hypertext and image references of all HTML files. + * Note that we don't parse the files, but simply grep for the + * respective HTML elements. Therefore. contents that are e.g. + * commented out can cause false warning. + */ + bool allLinksOk = true; + foreach (const QString &fileName, files) { + if (!fileName.endsWith(QLatin1String("html")) + && !fileName.endsWith(QLatin1String("htm"))) + continue; + QFile htmlFile(fileName); + if (!htmlFile.open(QIODevice::ReadOnly)) { + emit warning(tr("File '%1' cannot be opened.").arg(fileName)); + continue; + } + const QRegExp linkPattern(QLatin1String("<(?:a href|img src)=\"?([^#\">]+)[#\">]")); + QTextStream stream(&htmlFile); + const QString codec = QHelpGlobal::codecFromData(htmlFile.read(1000)); + stream.setCodec(QTextCodec::codecForName(codec.toLatin1().constData())); + const QString &content = stream.readAll(); + QStringList invalidLinks; + for (int pos = linkPattern.indexIn(content); pos != -1; + pos = linkPattern.indexIn(content, pos + 1)) { + const QString& linkedFileName = linkPattern.cap(1); + if (linkedFileName.contains(QLatin1String("://"))) + continue; + const QString curDir = QFileInfo(fileName).dir().path(); + const QString &canonicalLinkedFileName = + QFileInfo(curDir + QDir::separator() + linkedFileName).canonicalFilePath(); + if (!files.contains(canonicalLinkedFileName) + && !invalidLinks.contains(canonicalLinkedFileName)) { + emit warning(tr("File '%1' contains an invalid link to file '%2'"). + arg(fileName).arg(linkedFileName)); + allLinksOk = false; + invalidLinks.append(canonicalLinkedFileName); + } + } + } + + if (!allLinksOk) + d->error = tr("Invalid links in HTML files."); + return allLinksOk; +} + QT_END_NAMESPACE + diff --git a/tools/assistant/lib/qhelpgenerator_p.h b/tools/assistant/lib/qhelpgenerator_p.h index c589e25..21c04f5 100644 --- a/tools/assistant/lib/qhelpgenerator_p.h +++ b/tools/assistant/lib/qhelpgenerator_p.h @@ -74,6 +74,7 @@ public: bool generate(QHelpDataInterface *helpData, const QString &outputFileName); + bool checkLinks(const QHelpDataInterface &helpData); QString error() const; Q_SIGNALS: diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp index b5bec44..ee6dcfb 100644 --- a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp +++ b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp @@ -39,16 +39,19 @@ ** ****************************************************************************/ -#include "qhelpenginecore.h" -#include "fulltextsearch/qsearchable_p.h" -#include "fulltextsearch/qqueryparser_p.h" #include "fulltextsearch/qindexreader_p.h" +#include "fulltextsearch/qqueryparser_p.h" +#include "fulltextsearch/qsearchable_p.h" +#include "qclucenefieldnames_p.h" +#include "qhelpenginecore.h" + #include "qhelpsearchindexreader_clucene_p.h" #include <QtCore/QDir> #include <QtCore/QSet> #include <QtCore/QString> #include <QtCore/QFileInfo> +#include <QtCore/QSharedPointer> #include <QtCore/QStringList> #include <QtCore/QTextStream> #include <QtCore/QMutexLocker> @@ -108,64 +111,88 @@ void QHelpSearchIndexReaderClucene::run() #if !defined(QT_NO_EXCEPTIONS) try { #endif - QCLuceneBooleanQuery booleanQuery; + QCLuceneBooleanQuery booleanQueryTitle; + QCLuceneBooleanQuery booleanQueryContent; QCLuceneStandardAnalyzer analyzer; - if (!buildQuery(booleanQuery, queryList, analyzer)) { + const QStringList& attribList = + engine.filterAttributes(engine.currentFilter()); + bool titleQueryIsValid = buildQuery(queryList, TitleTokenizedField, + attribList, booleanQueryTitle, analyzer); + bool contentQueryIsValid = buildQuery(queryList, ContentField, + attribList, booleanQueryContent, analyzer); + if (!titleQueryIsValid && !contentQueryIsValid) { emit searchingFinished(0); return; } - const QStringList attribList = engine.filterAttributes(engine.currentFilter()); - if (!attribList.isEmpty()) { - QCLuceneQuery* query = QCLuceneQueryParser::parse(QLatin1String("+") - + attribList.join(QLatin1String(" +")), QLatin1String("attribute"), analyzer); + QCLuceneIndexSearcher indexSearcher(indexPath); - if (!query) { + // QCLuceneHits object must be allocated on the heap, because + // there is no default constructor. + QSharedPointer<QCLuceneHits> titleHits; + QSharedPointer<QCLuceneHits> contentHits; + if (titleQueryIsValid) { + titleHits = QSharedPointer<QCLuceneHits>(new QCLuceneHits( + indexSearcher.search(booleanQueryTitle))); + } + if (contentQueryIsValid) { + contentHits = QSharedPointer<QCLuceneHits>(new QCLuceneHits( + indexSearcher.search(booleanQueryContent))); + } + bool boost = true; + if ((titleHits.isNull() || titleHits->length() == 0) + && (contentHits.isNull() || contentHits->length() == 0)) { + booleanQueryTitle = QCLuceneBooleanQuery(); + booleanQueryContent = QCLuceneBooleanQuery(); + titleQueryIsValid = + buildTryHarderQuery(queryList, TitleTokenizedField, + attribList, booleanQueryTitle, analyzer); + contentQueryIsValid = + buildTryHarderQuery(queryList, ContentField, attribList, + booleanQueryContent, analyzer); + if (!titleQueryIsValid && !contentQueryIsValid) { emit searchingFinished(0); return; } - booleanQuery.add(query, true, true, false); - } - - QCLuceneIndexSearcher indexSearcher(indexPath); - QCLuceneHits hits = indexSearcher.search(booleanQuery); - - bool boost = true; - QCLuceneBooleanQuery tryHarderQuery; - if (hits.length() == 0) { - if (buildTryHarderQuery(tryHarderQuery, queryList, analyzer)) { - if (!attribList.isEmpty()) { - QCLuceneQuery* query = QCLuceneQueryParser::parse(QLatin1String("+") - + attribList.join(QLatin1String(" +")), QLatin1String("attribute"), - analyzer); - tryHarderQuery.add(query, true, true, false); - } - hits = indexSearcher.search(tryHarderQuery); - boost = (hits.length() == 0); + if (titleQueryIsValid) { + titleHits = QSharedPointer<QCLuceneHits>(new QCLuceneHits( + indexSearcher.search(booleanQueryTitle))); + } + if (contentQueryIsValid) { + contentHits = QSharedPointer<QCLuceneHits>(new QCLuceneHits( + indexSearcher.search(booleanQueryContent))); } + boost = false; } + QList<QSharedPointer<QCLuceneHits> > cluceneHitsList; + if (!titleHits.isNull()) + cluceneHitsList.append(titleHits); + if (!contentHits.isNull()) + cluceneHitsList.append(contentHits); QSet<QString> pathSet; QCLuceneDocument document; const QStringList namespaceList = engine.registeredDocumentations(); - for (qint32 i = 0; i < hits.length(); i++) { - document = hits.document(i); - const QString path = document.get(QLatin1String("path")); - if (!pathSet.contains(path) && namespaceList.contains( - document.get(QLatin1String("namespace")), Qt::CaseInsensitive)) { - pathSet.insert(path); - hitList.append(qMakePair(path, document.get(QLatin1String("title")))); - } - document.clear(); + foreach (QSharedPointer<QCLuceneHits> hits, cluceneHitsList) { + for (qint32 i = 0; i < hits->length(); i++) { + document = hits->document(i); + const QString path = document.get(PathField); + if (!pathSet.contains(path) && namespaceList.contains( + document.get(NamespaceField), Qt::CaseInsensitive)) { + pathSet.insert(path); + hitList.append(qMakePair(path, document.get(TitleField))); + } + document.clear(); - mutex.lock(); - if (m_cancel) { + mutex.lock(); + if (m_cancel) { + mutex.unlock(); + emit searchingFinished(0); + return; + } mutex.unlock(); - emit searchingFinished(0); - return; } - mutex.unlock(); } indexSearcher.close(); @@ -185,144 +212,205 @@ void QHelpSearchIndexReaderClucene::run() } } -bool QHelpSearchIndexReaderClucene::defaultQuery(const QString &term, QCLuceneBooleanQuery &booleanQuery, - QCLuceneStandardAnalyzer &analyzer) +bool QHelpSearchIndexReaderClucene::buildQuery( + const QList<QHelpSearchQuery> &queries, const QString &fieldName, + const QStringList &filterAttributes, QCLuceneBooleanQuery &booleanQuery, + QCLuceneAnalyzer &analyzer) { - const QLatin1String c("content"); - const QLatin1String t("titleTokenized"); - - QCLuceneQuery *query = QCLuceneQueryParser::parse(term, c, analyzer); - QCLuceneQuery *query2 = QCLuceneQueryParser::parse(term, t, analyzer); - if (query && query2) { - booleanQuery.add(query, true, false, false); - booleanQuery.add(query2, true, false, false); - return true; + bool queryIsValid = false; + foreach (const QHelpSearchQuery &query, queries) { + if (fieldName != ContentField && isNegativeQuery(query)) { + queryIsValid = false; + break; + } + switch (query.fieldName) { + case QHelpSearchQuery::FUZZY: + if (addFuzzyQuery(query, fieldName, booleanQuery, analyzer)) + queryIsValid = true; + break; + case QHelpSearchQuery::WITHOUT: + if (fieldName != ContentField) + return false; + if (addWithoutQuery(query, fieldName, booleanQuery)) + queryIsValid = true; + break; + case QHelpSearchQuery::PHRASE: + if (addPhraseQuery(query, fieldName, booleanQuery)) + queryIsValid = true; + break; + case QHelpSearchQuery::ALL: + if (addAllQuery(query, fieldName, booleanQuery)) + queryIsValid = true; + break; + case QHelpSearchQuery::DEFAULT: + if (addDefaultQuery(query, fieldName, true, booleanQuery, analyzer)) + queryIsValid = true; + break; + case QHelpSearchQuery::ATLEAST: + if (addAtLeastQuery(query, fieldName, booleanQuery, analyzer)) + queryIsValid = true; + break; + default: + Q_ASSERT(!"Invalid field name"); + } } - return false; + if (queryIsValid && !filterAttributes.isEmpty()) { + queryIsValid = + addAttributesQuery(filterAttributes, booleanQuery, analyzer); + } + + return queryIsValid; } -bool QHelpSearchIndexReaderClucene::buildQuery(QCLuceneBooleanQuery &booleanQuery, - const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer) +bool QHelpSearchIndexReaderClucene::buildTryHarderQuery( + const QList<QHelpSearchQuery> &queries, const QString &fieldName, + const QStringList &filterAttributes, QCLuceneBooleanQuery &booleanQuery, + QCLuceneAnalyzer &analyzer) { - foreach (const QHelpSearchQuery query, queryList) { - switch (query.fieldName) { - case QHelpSearchQuery::FUZZY: { - const QLatin1String fuzzy("~"); - foreach (const QString &term, query.wordList) { - if (term.isEmpty() - || !defaultQuery(term.toLower() + fuzzy, booleanQuery, analyzer)) { - return false; - } - } - } break; - - case QHelpSearchQuery::WITHOUT: { - QStringList stopWords = QCLuceneStopAnalyzer().englishStopWords(); - foreach (const QString &term, query.wordList) { - if (stopWords.contains(term, Qt::CaseInsensitive)) - continue; - - QCLuceneQuery *query = new QCLuceneTermQuery(QCLuceneTerm( - QLatin1String("content"), term.toLower())); - QCLuceneQuery *query2 = new QCLuceneTermQuery(QCLuceneTerm( - QLatin1String("titleTokenized"), term.toLower())); - - if (query && query2) { - booleanQuery.add(query, true, false, true); - booleanQuery.add(query2, true, false, true); - } else { - return false; - } - } - } break; - - case QHelpSearchQuery::PHRASE: { - const QString &term = query.wordList.at(0).toLower(); - if (term.contains(QLatin1Char(' '))) { - QStringList termList = term.split(QLatin1String(" ")); - QCLucenePhraseQuery *q = new QCLucenePhraseQuery(); - QStringList stopWords = QCLuceneStopAnalyzer().englishStopWords(); - foreach (const QString &term, termList) { - if (!stopWords.contains(term, Qt::CaseInsensitive)) - q->addTerm(QCLuceneTerm(QLatin1String("content"), term.toLower())); - } - booleanQuery.add(q, true, true, false); - } else { - QCLuceneQuery *query = new QCLuceneTermQuery(QCLuceneTerm( - QLatin1String("content"), term.toLower())); - QCLuceneQuery *query2 = new QCLuceneTermQuery(QCLuceneTerm( - QLatin1String("titleTokenized"), term.toLower())); - - if (query && query2) { - booleanQuery.add(query, true, true, false); - booleanQuery.add(query2, true, false, false); - } else { - return false; - } - } - } break; + if (queries.isEmpty()) + return false; + const QHelpSearchQuery &query = queries.front(); + if (query.fieldName != QHelpSearchQuery::DEFAULT) + return false; + if (isNegativeQuery(query)) + return false; + if (!addDefaultQuery(query, fieldName, false, booleanQuery, analyzer)) + return false; + if (filterAttributes.isEmpty()) + return true; + return addAttributesQuery(filterAttributes, booleanQuery, analyzer); +} - case QHelpSearchQuery::ALL: { - QStringList stopWords = QCLuceneStopAnalyzer().englishStopWords(); - foreach (const QString &term, query.wordList) { - if (stopWords.contains(term, Qt::CaseInsensitive)) - continue; +bool QHelpSearchIndexReaderClucene::isNegativeQuery(const QHelpSearchQuery &query) const +{ + const QString &search = query.wordList.join(" "); + return search.contains('!') || search.contains('-') + || search.contains(QLatin1String(" NOT ")); +} - QCLuceneQuery *query = new QCLuceneTermQuery(QCLuceneTerm( - QLatin1String("content"), term.toLower())); +bool QHelpSearchIndexReaderClucene::addFuzzyQuery(const QHelpSearchQuery &query, + const QString &fieldName, QCLuceneBooleanQuery &booleanQuery, + QCLuceneAnalyzer &analyzer) +{ + bool queryIsValid = false; + const QLatin1String fuzzy("~"); + foreach (const QString &term, query.wordList) { + if (!term.isEmpty()) { + QCLuceneQuery *lQuery = + QCLuceneQueryParser::parse(term + fuzzy, fieldName, analyzer); + if (lQuery != 0) { + booleanQuery.add(lQuery, true, false, false); + queryIsValid = true; + } + } + } + return queryIsValid; +} - if (query) { - booleanQuery.add(query, true, true, false); - } else { - return false; - } - } - } break; +bool QHelpSearchIndexReaderClucene::addWithoutQuery(const QHelpSearchQuery &query, + const QString &fieldName, QCLuceneBooleanQuery &booleanQuery) +{ + bool queryIsValid = false; + const QStringList &stopWords = QCLuceneStopAnalyzer().englishStopWords(); + foreach (const QString &term, query.wordList) { + if (stopWords.contains(term, Qt::CaseInsensitive)) + continue; + QCLuceneQuery *lQuery = new QCLuceneTermQuery(QCLuceneTerm( + fieldName, term.toLower())); + booleanQuery.add(lQuery, true, false, true); + queryIsValid = true; + } + return queryIsValid; +} - case QHelpSearchQuery::DEFAULT: { - foreach (const QString &term, query.wordList) { - QCLuceneQuery *query = QCLuceneQueryParser::parse(term.toLower(), - QLatin1String("content"), analyzer); +bool QHelpSearchIndexReaderClucene::addPhraseQuery(const QHelpSearchQuery &query, + const QString &fieldName, QCLuceneBooleanQuery &booleanQuery) +{ + bool queryIsValid = false; + const QString &term = query.wordList.at(0).toLower(); + if (term.contains(QLatin1Char(' '))) { + const QStringList termList = term.split(QLatin1String(" ")); + QCLucenePhraseQuery *q = new QCLucenePhraseQuery(); + const QStringList stopWords = QCLuceneStopAnalyzer().englishStopWords(); + foreach (const QString &term, termList) { + if (!stopWords.contains(term, Qt::CaseInsensitive)) + q->addTerm(QCLuceneTerm(fieldName, term.toLower())); + } + if (!q->getTerms().isEmpty()) { + booleanQuery.add(q, true, true, false); + queryIsValid = true; + } + } else { + QCLuceneQuery *lQuery = new QCLuceneTermQuery(QCLuceneTerm( + fieldName, term.toLower())); + booleanQuery.add(lQuery, true, true, false); + queryIsValid = true; + } + return queryIsValid; +} - if (query) - booleanQuery.add(query, true, true, false); - } - } break; +bool QHelpSearchIndexReaderClucene::addAllQuery(const QHelpSearchQuery &query, + const QString &fieldName, QCLuceneBooleanQuery &booleanQuery) +{ + bool queryIsValid = false; + const QStringList &stopWords = QCLuceneStopAnalyzer().englishStopWords(); + foreach (const QString &term, query.wordList) { + if (stopWords.contains(term, Qt::CaseInsensitive)) + continue; + QCLuceneQuery *lQuery = new QCLuceneTermQuery(QCLuceneTerm( + fieldName, term.toLower())); + booleanQuery.add(lQuery, true, true, false); + queryIsValid = true; + } + return queryIsValid; +} - case QHelpSearchQuery::ATLEAST: { - foreach (const QString &term, query.wordList) { - if (term.isEmpty() || !defaultQuery(term.toLower(), booleanQuery, analyzer)) - return false; - } - } +bool QHelpSearchIndexReaderClucene::addDefaultQuery(const QHelpSearchQuery &query, + const QString &fieldName, bool allTermsRequired, + QCLuceneBooleanQuery &booleanQuery, + QCLuceneAnalyzer &analyzer) +{ + bool queryIsValid = false; + foreach (const QString &term, query.wordList) { + QCLuceneQuery *lQuery = + QCLuceneQueryParser::parse(term.toLower(), fieldName, analyzer); + if (lQuery) { + booleanQuery.add(lQuery, true, allTermsRequired, false); + queryIsValid = true; } } - - return true; + return queryIsValid; } -bool QHelpSearchIndexReaderClucene::buildTryHarderQuery(QCLuceneBooleanQuery &booleanQuery, - const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer) +bool QHelpSearchIndexReaderClucene::addAtLeastQuery( + const QHelpSearchQuery &query, const QString &fieldName, + QCLuceneBooleanQuery &booleanQuery, QCLuceneAnalyzer &analyzer) { - bool retVal = false; - foreach (const QHelpSearchQuery query, queryList) { - switch (query.fieldName) { - default: break; - case QHelpSearchQuery::DEFAULT: { - foreach (const QString &term, query.wordList) { - QCLuceneQuery *query = QCLuceneQueryParser::parse(term.toLower(), - QLatin1String("content"), analyzer); - - if (query) { - retVal = true; - booleanQuery.add(query, true, false, false); - } - } - } break; + bool queryIsValid = false; + foreach (const QString &term, query.wordList) { + if (!term.isEmpty()) { + QCLuceneQuery *lQuery = + QCLuceneQueryParser::parse(term, fieldName, analyzer); + if (lQuery) { + booleanQuery.add(lQuery, true, false, false); + queryIsValid = true; + } } } - return retVal; + return queryIsValid; +} + +bool QHelpSearchIndexReaderClucene::addAttributesQuery( + const QStringList &filterAttributes, QCLuceneBooleanQuery &booleanQuery, + QCLuceneAnalyzer &analyzer) +{ + QCLuceneQuery* lQuery = QCLuceneQueryParser::parse(QLatin1String("+") + + filterAttributes.join(QLatin1String(" +")), AttributeField, analyzer); + if (!lQuery) + return false; + booleanQuery.add(lQuery, true, true, false); + return true; } void QHelpSearchIndexReaderClucene::boostSearchHits(const QHelpEngineCore &engine, @@ -336,21 +424,22 @@ void QHelpSearchIndexReaderClucene::boostSearchHits(const QHelpEngineCore &engin QCLuceneStandardAnalyzer analyzer; QCLuceneQuery *parsedQuery = QCLuceneQueryParser::parse( - joinedQuery, QLatin1String("content"), analyzer); + joinedQuery, ContentField, analyzer); if (parsedQuery) { joinedQuery = parsedQuery->toString(); delete parsedQuery; } - int length = QString(QLatin1String("content:")).length(); - int index = joinedQuery.indexOf(QLatin1String("content:")); + const QString contentString(ContentField + QLatin1String(":")); + int length = contentString.length(); + int index = joinedQuery.indexOf(contentString); QString term; int nextIndex = 0; QStringList searchTerms; while (index != -1) { - nextIndex = joinedQuery.indexOf(QLatin1String("content:"), index + 1); + nextIndex = joinedQuery.indexOf(contentString, index + 1); term = joinedQuery.mid(index + length, nextIndex - (length + index)).simplified(); if (term.startsWith(QLatin1String("\"")) && term.endsWith(QLatin1String("\""))) { diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h index 3e3b9dd..04c0088 100644 --- a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h +++ b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h @@ -53,16 +53,19 @@ // We mean it. // -#include "qhelpsearchindexreader_p.h" +#include <QtCore/QList> +#include <QtCore/QString> +#include <QtCore/QStringList> #include "fulltextsearch/qanalyzer_p.h" #include "fulltextsearch/qquery_p.h" +#include "qhelpsearchindexreader_p.h" QT_BEGIN_NAMESPACE namespace qt { - namespace fulltextsearch { - namespace clucene { +namespace fulltextsearch { +namespace clucene { class QHelpSearchIndexReaderClucene : public QHelpSearchIndexReader { @@ -74,18 +77,38 @@ public: private: void run(); - bool defaultQuery(const QString &term, QCLuceneBooleanQuery &booleanQuery, - QCLuceneStandardAnalyzer &analyzer); - bool buildQuery(QCLuceneBooleanQuery &booleanQuery, const QList<QHelpSearchQuery> &queryList, - QCLuceneStandardAnalyzer &analyzer); - bool buildTryHarderQuery(QCLuceneBooleanQuery &booleanQuery, - const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer); void boostSearchHits(const QHelpEngineCore &engine, QList<QHelpSearchEngine::SearchHit> &hitList, const QList<QHelpSearchQuery> &queryList); + bool buildQuery(const QList<QHelpSearchQuery> &queries, + const QString &fieldName, + const QStringList &filterAttributes, + QCLuceneBooleanQuery &booleanQuery, + QCLuceneAnalyzer &analyzer); + bool buildTryHarderQuery(const QList<QHelpSearchQuery> &queries, + const QString &fieldName, + const QStringList &filterAttributes, + QCLuceneBooleanQuery &booleanQuery, + QCLuceneAnalyzer &analyzer); + bool addFuzzyQuery(const QHelpSearchQuery &query, const QString &fieldName, + QCLuceneBooleanQuery &booleanQuery, QCLuceneAnalyzer &analyzer); + bool addWithoutQuery(const QHelpSearchQuery &query, const QString &fieldName, + QCLuceneBooleanQuery &booleanQuery); + bool addPhraseQuery(const QHelpSearchQuery &query, const QString &fieldName, + QCLuceneBooleanQuery &booleanQuery); + bool addAllQuery(const QHelpSearchQuery &query, const QString &fieldName, + QCLuceneBooleanQuery &booleanQuery); + bool addDefaultQuery(const QHelpSearchQuery &query, const QString &fieldName, + bool allTermsRequired, QCLuceneBooleanQuery &booleanQuery, + QCLuceneAnalyzer &analyzer); + bool addAtLeastQuery(const QHelpSearchQuery &query, const QString &fieldName, + QCLuceneBooleanQuery &booleanQuery, QCLuceneAnalyzer &analyzer); + bool addAttributesQuery(const QStringList &filterAttributes, + QCLuceneBooleanQuery &booleanQuery, QCLuceneAnalyzer &analyzer); + bool isNegativeQuery(const QHelpSearchQuery &query) const; }; - } // namespace clucene - } // namespace fulltextsearch +} // namespace clucene +} // namespace fulltextsearch } // namespace qt QT_END_NAMESPACE diff --git a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp index e3cc2b0..b65ba2a 100644 --- a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp +++ b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include "qclucenefieldnames_p.h" #include "qhelpenginecore.h" #include "qhelp_global.h" #include "fulltextsearch/qhits_p.h" @@ -407,17 +408,17 @@ public: QString parsedTitle = QHelpGlobal::documentTitle(data); if(!parsedData.isEmpty()) { - document->add(new QCLuceneField(QLatin1String("content"), + document->add(new QCLuceneField(ContentField, parsedData,QCLuceneField::INDEX_TOKENIZED)); - document->add(new QCLuceneField(QLatin1String("path"), fileName, + document->add(new QCLuceneField(PathField, fileName, QCLuceneField::STORE_YES | QCLuceneField::INDEX_UNTOKENIZED)); - document->add(new QCLuceneField(QLatin1String("title"), parsedTitle, + document->add(new QCLuceneField(TitleField, parsedTitle, QCLuceneField::STORE_YES | QCLuceneField::INDEX_UNTOKENIZED)); - document->add(new QCLuceneField(QLatin1String("titleTokenized"), parsedTitle, + document->add(new QCLuceneField(TitleTokenizedField, parsedTitle, QCLuceneField::STORE_YES | QCLuceneField::INDEX_TOKENIZED)); - document->add(new QCLuceneField(QLatin1String("namespace"), namespaceName, + document->add(new QCLuceneField(NamespaceField, namespaceName, QCLuceneField::STORE_YES | QCLuceneField::INDEX_UNTOKENIZED)); - document->add(new QCLuceneField(QLatin1String("attribute"), attributes, + document->add(new QCLuceneField(AttributeField, attributes, QCLuceneField::STORE_YES | QCLuceneField::INDEX_TOKENIZED)); return true; } @@ -713,9 +714,7 @@ void QHelpSearchIndexWriter::run() if (indexMap.contains(namespaceName)) { // make sure we really have content indexed for namespace - // NOTE: Extra variable just for GCC 3.3.5 - QLatin1String key("namespace"); - QCLuceneTermQuery query(QCLuceneTerm(key, namespaceName)); + QCLuceneTermQuery query(QCLuceneTerm(NamespaceField, namespaceName)); QCLuceneIndexSearcher indexSearcher(indexPath); QCLuceneHits hits = indexSearcher.search(query); if (hits.length() <= 0) @@ -858,8 +857,7 @@ void QHelpSearchIndexWriter::removeDocuments(const QString &indexPath, return; QCLuceneIndexReader reader = QCLuceneIndexReader::open(indexPath); - reader.deleteDocuments(QCLuceneTerm(QLatin1String("namespace"), - namespaceName)); + reader.deleteDocuments(QCLuceneTerm(NamespaceField, namespaceName)); reader.close(); } diff --git a/tools/assistant/lib/qhelpsearchquerywidget.cpp b/tools/assistant/lib/qhelpsearchquerywidget.cpp index b614cb4..cb7b1ef 100644 --- a/tools/assistant/lib/qhelpsearchquerywidget.cpp +++ b/tools/assistant/lib/qhelpsearchquerywidget.cpp @@ -136,33 +136,6 @@ private: #endif } - QString escapeString(const QString &text) - { - QString retValue = text; - const QString escape(QLatin1String("\\")); - QStringList escapableCharsList; - escapableCharsList << QLatin1String("\\") << QLatin1String("+") - << QLatin1String("-") << QLatin1String("!") << QLatin1String("(") - << QLatin1String(")") << QLatin1String(":") << QLatin1String("^") - << QLatin1String("[") << QLatin1String("]") << QLatin1String("{") - << QLatin1String("}") << QLatin1String("~"); - - // make sure we won't end up with an empty string - foreach (const QString escapeChar, escapableCharsList) { - if (retValue.contains(escapeChar)) - retValue.replace(escapeChar, QLatin1String("")); - } - if (retValue.trimmed().isEmpty()) - return retValue; - - retValue = text; // now realy escape the string... - foreach (const QString escapeChar, escapableCharsList) { - if (retValue.contains(escapeChar)) - retValue.replace(escapeChar, escape + escapeChar); - } - return retValue; - } - QStringList buildTermList(const QString query) { bool s = false; @@ -311,14 +284,14 @@ private slots: #else if (defaultQuery->isEnabled()) { queryList.append(QHelpSearchQuery(QHelpSearchQuery::DEFAULT, - buildTermList(escapeString(defaultQuery->text())))); + buildTermList(defaultQuery->text()))); } else { const QRegExp exp(QLatin1String("\\s+")); QStringList lst = similarQuery->text().split(exp, QString::SkipEmptyParts); if (!lst.isEmpty()) { QStringList fuzzy; foreach (const QString term, lst) - fuzzy += buildTermList(escapeString(term)); + fuzzy += buildTermList(term); queryList.append(QHelpSearchQuery(QHelpSearchQuery::FUZZY, fuzzy)); } @@ -326,13 +299,13 @@ private slots: if (!lst.isEmpty()) { QStringList without; foreach (const QString term, lst) - without.append(escapeString(term)); + without.append(term); queryList.append(QHelpSearchQuery(QHelpSearchQuery::WITHOUT, without)); } if (!exactQuery->text().isEmpty()) { QString phrase = exactQuery->text().remove(QLatin1Char('\"')); - phrase = escapeString(phrase.simplified()); + phrase = phrase.simplified(); queryList.append(QHelpSearchQuery(QHelpSearchQuery::PHRASE, QStringList(phrase))); } @@ -340,7 +313,7 @@ private slots: if (!lst.isEmpty()) { QStringList all; foreach (const QString term, lst) - all.append(escapeString(term)); + all.append(term); queryList.append(QHelpSearchQuery(QHelpSearchQuery::ALL, all)); } @@ -348,7 +321,7 @@ private slots: if (!lst.isEmpty()) { QStringList atLeast; foreach (const QString term, lst) - atLeast += buildTermList(escapeString(term)); + atLeast += buildTermList(term); queryList.append(QHelpSearchQuery(QHelpSearchQuery::ATLEAST, atLeast)); } } diff --git a/tools/assistant/tools/assistant/assistant.pro b/tools/assistant/tools/assistant/assistant.pro index 1a7e874..81677c3 100644 --- a/tools/assistant/tools/assistant/assistant.pro +++ b/tools/assistant/tools/assistant/assistant.pro @@ -1,86 +1,75 @@ include($$QT_SOURCE_TREE/tools/shared/fontpanel/fontpanel.pri) - TEMPLATE = app LANGUAGE = C++ TARGET = assistant - -contains(QT_CONFIG, webkit) { - QT += webkit -} - -CONFIG += qt warn_on help - +contains(QT_CONFIG, webkit):QT += webkit +CONFIG += qt \ + warn_on \ + help QT += network - PROJECTNAME = Assistant DESTDIR = ../../../../bin - -target.path=$$[QT_INSTALL_BINS] +target.path = $$[QT_INSTALL_BINS] INSTALLS += target -### Work around a qmake issue when statically linking to -### not-yet-installed plugins +# ## Work around a qmake issue when statically linking to +# ## not-yet-installed plugins LIBS += -L$$QT_BUILD_TREE/plugins/sqldrivers - HEADERS += helpviewer.h \ - mainwindow.h \ - indexwindow.h \ - topicchooser.h \ - contentwindow.h \ - searchwidget.h \ - preferencesdialog.h \ - filternamedialog.h \ - centralwidget.h \ - installdialog.h \ - bookmarkmanager.h \ - remotecontrol.h \ - cmdlineparser.h \ - aboutdialog.h \ - qtdocinstaller.h - -win32 { - HEADERS += remotecontrol_win.h -} - + mainwindow.h \ + indexwindow.h \ + topicchooser.h \ + contentwindow.h \ + searchwidget.h \ + preferencesdialog.h \ + filternamedialog.h \ + centralwidget.h \ + installdialog.h \ + bookmarkmanager.h \ + remotecontrol.h \ + cmdlineparser.h \ + aboutdialog.h \ + qtdocinstaller.h \ + xbelsupport.h \ + ../shared/collectionconfiguration.h +win32:HEADERS += remotecontrol_win.h SOURCES += helpviewer.cpp \ - main.cpp \ - mainwindow.cpp \ - indexwindow.cpp \ - topicchooser.cpp \ - contentwindow.cpp \ - searchwidget.cpp \ - preferencesdialog.cpp \ - filternamedialog.cpp \ - centralwidget.cpp \ - installdialog.cpp \ - bookmarkmanager.cpp \ - remotecontrol.cpp \ - cmdlineparser.cpp \ - aboutdialog.cpp \ - qtdocinstaller.cpp - + main.cpp \ + mainwindow.cpp \ + indexwindow.cpp \ + topicchooser.cpp \ + contentwindow.cpp \ + searchwidget.cpp \ + preferencesdialog.cpp \ + filternamedialog.cpp \ + centralwidget.cpp \ + installdialog.cpp \ + bookmarkmanager.cpp \ + remotecontrol.cpp \ + cmdlineparser.cpp \ + aboutdialog.cpp \ + qtdocinstaller.cpp \ + xbelsupport.cpp \ + ../shared/collectionconfiguration.cpp FORMS += topicchooser.ui \ - preferencesdialog.ui \ - filternamedialog.ui \ - installdialog.ui \ - bookmarkdialog.ui - -RESOURCES += assistant.qrc assistant_images.qrc - -win32 { + preferencesdialog.ui \ + filternamedialog.ui \ + installdialog.ui \ + bookmarkdialog.ui +RESOURCES += assistant.qrc \ + assistant_images.qrc +win32 { !wince*:LIBS += -lshell32 RC_FILE = assistant.rc } - -mac { +mac { ICON = assistant.icns TARGET = Assistant QMAKE_INFO_PLIST = Info_mac.plist } - -contains(CONFIG, static): { +contains(CONFIG, static): { SQLPLUGINS = $$unique(sql-plugins) - contains(SQLPLUGINS, sqlite): { + contains(SQLPLUGINS, sqlite): { QTPLUGIN += qsqlite DEFINES += USE_STATIC_SQLITE_PLUGIN } diff --git a/tools/assistant/tools/assistant/assistant.qch b/tools/assistant/tools/assistant/assistant.qch Binary files differindex 78fe9f3..e6d5299 100644 --- a/tools/assistant/tools/assistant/assistant.qch +++ b/tools/assistant/tools/assistant/assistant.qch diff --git a/tools/assistant/tools/assistant/assistant_images.qrc b/tools/assistant/tools/assistant/assistant_images.qrc index 58e03b5..34918c0 100644 --- a/tools/assistant/tools/assistant/assistant_images.qrc +++ b/tools/assistant/tools/assistant/assistant_images.qrc @@ -4,6 +4,7 @@ <file>images/assistant-128.png</file> <file>images/assistant.png</file> <file>images/wrap.png</file> + <file>images/bookmark.png</file> #mac <file>images/mac/addtab.png</file> <file>images/mac/book.png</file> diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp index 0ce1b9d..331ea4b 100644 --- a/tools/assistant/tools/assistant/bookmarkmanager.cpp +++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp @@ -41,6 +41,7 @@ #include "bookmarkmanager.h" #include "centralwidget.h" +#include "../shared/collectionconfiguration.h" #include <QtGui/QMenu> #include <QtGui/QIcon> @@ -153,8 +154,8 @@ void BookmarkDialog::addNewFolder() const QString &name = index.data().toString(); ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name)); + renameFolder(index, newFolder); } - ui.treeView->setFocus(); } void BookmarkDialog::toolButtonClicked() @@ -246,14 +247,19 @@ void BookmarkDialog::customContextMenuRequested(const QPoint &point) if (index.isValid()) name = index.data().toString(); ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name)); + } else if (picked == renameItem) { + renameFolder(index, proxyIndex); } - else if (picked == renameItem) { - BookmarkModel *model = bookmarkManager->treeBookmarkModel(); - if (QStandardItem *item = model->itemFromIndex(proxyIndex)) { - item->setEditable(true); - ui.treeView->edit(index); - item->setEditable(false); - } +} + +void BookmarkDialog::renameFolder(const QModelIndex &index, + const QModelIndex &proxyIndex) +{ + const BookmarkModel * const model = bookmarkManager->treeBookmarkModel(); + if (QStandardItem *item = model->itemFromIndex(proxyIndex)) { + item->setEditable(true); + ui.treeView->edit(index); + item->setEditable(false); } } @@ -307,7 +313,7 @@ bool BookmarkDialog::eventFilter(QObject *object, QEvent *e) } -// #pragma mark -- BookmarkWidget +// BookmarkWidget BookmarkWidget::BookmarkWidget(BookmarkManager *manager, QWidget *parent, @@ -607,7 +613,7 @@ bool BookmarkWidget::eventFilter(QObject *object, QEvent *e) } -// #pragma mark -- BookmarkModel +// BookmarkModel BookmarkModel::BookmarkModel(int rows, int columns, QObject *parent) @@ -635,7 +641,7 @@ Qt::ItemFlags BookmarkModel::flags(const QModelIndex &index) const } -// #pragma mark -- BookmarkManager +// BookmarkManager BookmarkManager::BookmarkManager(QHelpEngineCore *_helpEngine) @@ -645,6 +651,7 @@ BookmarkManager::BookmarkManager(QHelpEngineCore *_helpEngine) , helpEngine(_helpEngine) { folderIcon = QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon); + bookmarkIcon = QIcon(QLatin1String(":/trolltech/assistant/images/bookmark.png")); connect(treeModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(itemChanged(QStandardItem*))); @@ -676,7 +683,7 @@ void BookmarkManager::saveBookmarks() QDataStream stream(&bookmarks, QIODevice::WriteOnly); readBookmarksRecursive(treeModel->invisibleRootItem(), stream, 0); - helpEngine->setCustomValue(QLatin1String("Bookmarks"), bookmarks); + CollectionConfiguration::setBookmarks(*helpEngine, bookmarks); } QStringList BookmarkManager::bookmarkFolders() const @@ -754,6 +761,7 @@ void BookmarkManager::addNewBookmark(const QModelIndex &index, { QStandardItem *item = new QStandardItem(name); item->setEditable(false); + item->setIcon(bookmarkIcon); item->setData(false, Qt::UserRole + 11); item->setData(url, Qt::UserRole + 10); @@ -827,8 +835,7 @@ void BookmarkManager::setupBookmarkModels() QList<int> lastDepths; QList<QStandardItem*> parents; - QByteArray ba = - helpEngine->customValue(QLatin1String("Bookmarks")).toByteArray(); + QByteArray ba = CollectionConfiguration::bookmarks(*helpEngine); QDataStream stream(ba); while (!stream.atEnd()) { stream >> depth >> name >> type >> expanded; @@ -853,10 +860,12 @@ void BookmarkManager::setupBookmarkModels() } } - if (type == QLatin1String("Folder")) - item->setIcon(folderIcon); - else + if (type != QLatin1String("Folder")) { + item->setIcon(bookmarkIcon); listModel->appendRow(item->clone()); + } else { + item->setIcon(folderIcon); + } } } diff --git a/tools/assistant/tools/assistant/bookmarkmanager.h b/tools/assistant/tools/assistant/bookmarkmanager.h index da36833..71a1778 100644 --- a/tools/assistant/tools/assistant/bookmarkmanager.h +++ b/tools/assistant/tools/assistant/bookmarkmanager.h @@ -90,6 +90,7 @@ private slots: private: bool eventFilter(QObject *object, QEvent *e); + void renameFolder(const QModelIndex &index, const QModelIndex &proxyIndex); private: QString m_url; @@ -202,6 +203,7 @@ private: private: QString oldText; QIcon folderIcon; + QIcon bookmarkIcon; BookmarkModel *treeModel; BookmarkModel *listModel; diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 0b177ae..b5fe262 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -44,6 +44,7 @@ #include "searchwidget.h" #include "mainwindow.h" #include "preferencesdialog.h" +#include "../shared/collectionconfiguration.h" #include <QtCore/QDir> #include <QtCore/QEvent> @@ -296,28 +297,23 @@ CentralWidget::~CentralWidget() if (!engine.setupData()) return; - QString zoomCount; - QString currentPages; - QLatin1Char separator('|'); + QStringList zoomFactors; + QStringList currentPages; bool searchAttached = m_searchWidget->isAttached(); int i = searchAttached ? 1 : 0; for (; i < tabWidget->count(); ++i) { HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(i)); if (viewer && viewer->source().isValid()) { - currentPages += viewer->source().toString() + separator; - zoomCount += QString::number(viewer->zoom()) + separator; + currentPages << viewer->source().toString(); + zoomFactors << QString::number(viewer->zoom()); } } - engine.setCustomValue(QLatin1String("LastTabPage"), lastTabPage); - engine.setCustomValue(QLatin1String("LastShownPages"), currentPages); - engine.setCustomValue(QLatin1String("SearchWasAttached"), searchAttached); -#if !defined(QT_NO_WEBKIT) - engine.setCustomValue(QLatin1String("LastPagesZoomWebView"), zoomCount); -#else - engine.setCustomValue(QLatin1String("LastPagesZoomTextBrowser"), zoomCount); -#endif + CollectionConfiguration::setLastTabPage(engine, lastTabPage); + CollectionConfiguration::setLastShownPages(engine, currentPages); + CollectionConfiguration::setSearchWasAttached(engine, searchAttached); + CollectionConfiguration::setLastZoomFactors(engine, zoomFactors); } CentralWidget *CentralWidget::instance() @@ -427,16 +423,14 @@ void CentralWidget::setSource(const QUrl &url) void CentralWidget::setupWidget() { - int option = helpEngine->customValue(QLatin1String("StartOption"), - ShowLastPages).toInt(); - + int option = CollectionConfiguration::startOption(*helpEngine); if (option != ShowLastPages) { QString homePage; if (option == ShowHomePage) { - homePage = helpEngine->customValue(QLatin1String("defaultHomepage"), - QLatin1String("help")).toString(); - homePage = helpEngine->customValue(QLatin1String("homepage"), - homePage).toString(); + // TODO: Can this fall-back logic go into the wrapper class? + homePage = CollectionConfiguration::homePage(*helpEngine); + if (homePage.isEmpty()) + homePage = CollectionConfiguration::defaultHomePage(*helpEngine); } if (option == ShowBlankPage) homePage = QLatin1String("about:blank"); @@ -448,11 +442,8 @@ void CentralWidget::setupWidget() void CentralWidget::setLastShownPages() { - const QLatin1String key("LastShownPages"); - QString value = helpEngine->customValue(key, QString()).toString(); - const QStringList lastShownPageList = value.split(QLatin1Char('|'), - QString::SkipEmptyParts); - + const QStringList lastShownPageList = + CollectionConfiguration::lastShownPages(*helpEngine); const int pageCount = lastShownPageList.count(); if (pageCount == 0) { if (usesDefaultCollection) @@ -462,37 +453,27 @@ void CentralWidget::setLastShownPages() return; } -#if !defined(QT_NO_WEBKIT) - const QLatin1String zoom("LastPagesZoomWebView"); -#else - const QLatin1String zoom("LastPagesZoomTextBrowser"); -#endif - - value = helpEngine->customValue(zoom, QString()).toString(); - QVector<QString> zoomVector = value.split(QLatin1Char('|'), - QString::SkipEmptyParts).toVector(); + QStringList zoomFactors = + CollectionConfiguration::lastZoomFactors(*helpEngine); + while (zoomFactors.count() < pageCount) + zoomFactors.append(CollectionConfiguration::DefaultZoomFactor); - const int zoomCount = zoomVector.count(); - zoomVector.insert(zoomCount, pageCount - zoomCount, QLatin1String("0.0")); - - QVector<QString>::const_iterator zIt = zoomVector.constBegin(); + QStringList::const_iterator zIt = zoomFactors.constBegin(); QStringList::const_iterator it = lastShownPageList.constBegin(); for (; it != lastShownPageList.constEnd(); ++it, ++zIt) setSourceInNewTab((*it), (*zIt).toFloat()); - const QLatin1String lastTab("LastTabPage"); - int tab = helpEngine->customValue(lastTab, 1).toInt(); + int tab = CollectionConfiguration::lastTabPage(*helpEngine); - const QLatin1String searchKey("SearchWasAttached"); const bool searchIsAttached = m_searchWidget->isAttached(); - const bool searchWasAttached = helpEngine->customValue(searchKey).toBool(); + const bool searchWasAttached = + CollectionConfiguration::searchWasAttached(*helpEngine); if (searchWasAttached && !searchIsAttached) - tabWidget->setCurrentIndex(--tab); + --tab; else if (!searchWasAttached && searchIsAttached) - tabWidget->setCurrentIndex(++tab); - else - tabWidget->setCurrentIndex(tab); + ++tab; + tabWidget->setCurrentIndex(tab); } bool CentralWidget::hasSelection() const @@ -550,18 +531,17 @@ void CentralWidget::print() initPrinter(); - QPrintDialog *dlg = new QPrintDialog(printer, this); + QPrintDialog dlg(printer, this); #if defined(QT_NO_WEBKIT) if (viewer->textCursor().hasSelection()) - dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection); + dlg.addEnabledOption(QAbstractPrintDialog::PrintSelection); #endif - dlg->addEnabledOption(QAbstractPrintDialog::PrintPageRange); - dlg->addEnabledOption(QAbstractPrintDialog::PrintCollateCopies); - dlg->setWindowTitle(tr("Print Document")); - if (dlg->exec() == QDialog::Accepted) { + dlg.addEnabledOption(QAbstractPrintDialog::PrintPageRange); + dlg.addEnabledOption(QAbstractPrintDialog::PrintCollateCopies); + dlg.setWindowTitle(tr("Print Document")); + if (dlg.exec() == QDialog::Accepted) { viewer->print(printer); } - delete dlg; #endif } @@ -1002,7 +982,7 @@ void CentralWidget::updateBrowserFont() int i = searchAttached ? 1 : 0; getBrowserFontFor(tabWidget->widget(i), &font); - for ( ; i < tabWidget->count(); ++i) + for (; i < tabWidget->count(); ++i) setBrowserFontFor(tabWidget->widget(i), font); } @@ -1143,6 +1123,17 @@ CentralWidget::highlightSearchTerms() #endif } + +void CentralWidget::closeTabs(const QList<int> &indices) +{ + QList<int> sortedIndices = indices; + qSort(sortedIndices); + for (int i = sortedIndices.count(); --i >= 0;) + closeTabAt(sortedIndices.at(i)); + if (availableHelpViewer() == 0) + setSource(QUrl(QLatin1String("about:blank"))); +} + void CentralWidget::closeTabAt(int index) { HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(index)); @@ -1164,7 +1155,7 @@ QMap<int, QString> CentralWidget::currentSourceFileList() const void CentralWidget::getBrowserFontFor(QWidget *viewer, QFont *font) { const QLatin1String key("useBrowserFont"); - if (!helpEngine->customValue(key, false).toBool()) { + if (!CollectionConfiguration::usesBrowserFont(*helpEngine)) { *font = qApp->font(); // case for QTextBrowser and SearchWidget #if !defined(QT_NO_WEBKIT) QWebView *view = qobject_cast<QWebView*> (viewer); @@ -1175,8 +1166,7 @@ void CentralWidget::getBrowserFontFor(QWidget *viewer, QFont *font) } #endif } else { - *font = qVariantValue<QFont>(helpEngine->customValue( - QLatin1String("browserFont"))); + *font = CollectionConfiguration::browserFont(*helpEngine); } } diff --git a/tools/assistant/tools/assistant/centralwidget.h b/tools/assistant/tools/assistant/centralwidget.h index 6c23190..c2cb698 100644 --- a/tools/assistant/tools/assistant/centralwidget.h +++ b/tools/assistant/tools/assistant/centralwidget.h @@ -42,6 +42,7 @@ #ifndef CENTRALWIDGET_H #define CENTRALWIDGET_H +#include <QtCore/QList> #include <QtCore/QUrl> #include <QtCore/QPoint> #include <QtCore/QObject> @@ -134,6 +135,7 @@ public: int availableHelpViewer() const; bool enableTabCloseAction() const; + void closeTabs(const QList<int> &indices); void closeTabAt(int index); QMap<int, QString> currentSourceFileList() const; diff --git a/tools/assistant/tools/assistant/cmdlineparser.cpp b/tools/assistant/tools/assistant/cmdlineparser.cpp index 38814a5..30db7a0 100644 --- a/tools/assistant/tools/assistant/cmdlineparser.cpp +++ b/tools/assistant/tools/assistant/cmdlineparser.cpp @@ -46,21 +46,7 @@ QT_BEGIN_NAMESPACE -#define CHECK_NEXT_ARG \ - ++i < arguments.count() && !arguments.at(i).startsWith(QLatin1String("-")) - -CmdLineParser::CmdLineParser() - : m_enableRemoteControl(false), - m_contents(Untouched), - m_index(Untouched), - m_bookmarks(Untouched), - m_search(Untouched), - m_register(None), - m_removeSearchIndex(false), - m_copy(false), - m_quiet(false) -{ - m_helpMessage = QLatin1String( +const QString CmdLineParser::m_helpMessage = QLatin1String( "Usage: assistant [Options]\n\n" "-collectionFile file Uses the specified collection\n" " file instead of the default one\n" @@ -89,152 +75,62 @@ CmdLineParser::CmdLineParser() " status message.\n" "-help Displays this help.\n" ); -} -CmdLineParser::Result CmdLineParser::parse(const QStringList &arguments) -{ - QString error; - bool showHelp = false; - for (int j=1; j<arguments.count(); ++j) { - if (arguments.at(j).toLower() == QLatin1String("-quiet")) { +CmdLineParser::CmdLineParser(const QStringList &arguments) + : m_pos(0), + m_enableRemoteControl(false), + m_contents(Untouched), + m_index(Untouched), + m_bookmarks(Untouched), + m_search(Untouched), + m_register(None), + m_removeSearchIndex(false), + m_quiet(false) +{ + for (int i = 1; i < arguments.count(); ++i) { + const QString &arg = arguments.at(i); + if (arg.toLower() == "-quiet") m_quiet = true; - break; - } + else + m_arguments.append(arg); } +} - for (int i=1; i<arguments.count(); ++i) { - QString arg = arguments.at(i).toLower(); - if (arg == QLatin1String("-collectionfile")) { - if (CHECK_NEXT_ARG) { - m_collectionFile = getFileName(arguments.at(i)); - if (m_collectionFile.isEmpty()) { - error = QObject::tr("The specified collection file does not exist!"); - break; - } - } else { - error = QObject::tr("Missing collection file!"); - break; - } - } else if (arg == QLatin1String("-showurl")) { - if (CHECK_NEXT_ARG) { - QUrl url(arguments.at(i)); - if (url.isValid()) { - m_url = url; - } else { - error = QObject::tr("Invalid URL!"); - break; - } - } else { - error = QObject::tr("Missing URL!"); - break; - } - } else if (arg == QLatin1String("-enableremotecontrol")) { +CmdLineParser::Result CmdLineParser::parse() +{ + bool showHelp = false; + + while (m_error.isEmpty() && hasMoreArgs()) { + const QString &arg = nextArg().toLower(); + if (arg == QLatin1String("-collectionfile")) + handleCollectionFileOption(); + else if (arg == QLatin1String("-showurl")) + handleShowUrlOption(); + else if (arg == QLatin1String("-enableremotecontrol")) m_enableRemoteControl = true; - } else if (arg == QLatin1String("-show")) { - if (CHECK_NEXT_ARG) { - arg = arguments.at(i).toLower(); - if (arg == QLatin1String("contents")) { - m_contents = Show; - } else if (arg == QLatin1String("index")) { - m_index = Show; - } else if (arg == QLatin1String("bookmarks")) { - m_bookmarks = Show; - } else if (arg == QLatin1String("search")) { - m_search = Show; - } else { - error = QObject::tr("Unknown widget: %1").arg(arg); - break; - } - } else { - error = QObject::tr("Missing widget!"); - break; - } - } else if (arg == QLatin1String("-hide")) { - if (CHECK_NEXT_ARG) { - arg = arguments.at(i).toLower(); - if (arg == QLatin1String("contents")) { - m_contents = Hide; - } else if (arg == QLatin1String("index")) { - m_index = Hide; - } else if (arg == QLatin1String("bookmarks")) { - m_bookmarks = Hide; - } else if (arg == QLatin1String("search")) { - m_search = Hide; - } else { - error = QObject::tr("Unknown widget: %1").arg(arg); - break; - } - } else { - error = QObject::tr("Missing widget!"); - break; - } - } else if (arg == QLatin1String("-activate")) { - if (CHECK_NEXT_ARG) { - arg = arguments.at(i).toLower(); - if (arg == QLatin1String("contents")) { - m_contents = Activate; - } else if (arg == QLatin1String("index")) { - m_index = Activate; - } else if (arg == QLatin1String("bookmarks")) { - m_bookmarks = Activate; - } else if (arg == QLatin1String("search")) { - m_search = Activate; - } else { - error = QObject::tr("Unknown widget: %1").arg(arg); - break; - } - } else { - error = QObject::tr("Missing widget!"); - break; - } - } else if (arg == QLatin1String("-register")) { - if (CHECK_NEXT_ARG) { - m_helpFile = getFileName(arguments.at(i)); - if (m_helpFile.isEmpty()) { - error = QObject::tr("The specified Qt help file does not exist!"); - break; - } - m_register = Register; - } else { - error = QObject::tr("Missing help file!"); - break; - } - } else if (arg == QLatin1String("-unregister")) { - if (CHECK_NEXT_ARG) { - m_helpFile = getFileName(arguments.at(i)); - if (m_helpFile.isEmpty()) { - error = QObject::tr("The specified Qt help file does not exist!"); - break; - } - m_register = Unregister; - } else { - error = QObject::tr("Missing help file!"); - break; - } - } else if (arg == QLatin1String("-setcurrentfilter")) { - if (CHECK_NEXT_ARG) { - m_currentFilter = arguments.at(i); - } else { - error = QObject::tr("Missing filter argument!"); - break; - } - } else if (arg == QLatin1String("-remove-search-index")) { + else if (arg == QLatin1String("-show")) + handleShowOption(); + else if (arg == QLatin1String("-hide")) + handleHideOption(); + else if (arg == QLatin1String("-activate")) + handleActivateOption(); + else if (arg == QLatin1String("-register")) + handleRegisterOption(); + else if (arg == QLatin1String("-unregister")) + handleUnregisterOption(); + else if (arg == QLatin1String("-setcurrentfilter")) + handleSetCurrentFilterOption(); + else if (arg == QLatin1String("-remove-search-index")) m_removeSearchIndex = true; - } else if (arg == QLatin1String("-quiet")) { - continue; - } else if (arg == QLatin1String("-help")) { + else if (arg == QLatin1String("-help")) showHelp = true; - } else if (arg == QLatin1String("-copy")) { - m_copy = true; - } else { - error = QObject::tr("Unknown option: %1").arg(arg); - break; - } + else + m_error = tr("Unknown option: %1").arg(arg); } - if (!error.isEmpty()) { - showMessage(error + QLatin1String("\n\n\n") + m_helpMessage, true); + if (!m_error.isEmpty()) { + showMessage(m_error + QLatin1String("\n\n\n") + m_helpMessage, true); return Error; } else if (showHelp) { showMessage(m_helpMessage, false); @@ -243,6 +139,110 @@ CmdLineParser::Result CmdLineParser::parse(const QStringList &arguments) return Ok; } +bool CmdLineParser::hasMoreArgs() const +{ + return m_pos < m_arguments.count(); +} + +const QString &CmdLineParser::nextArg() +{ + Q_ASSERT(hasMoreArgs()); + return m_arguments.at(m_pos++); +} + +void CmdLineParser::handleCollectionFileOption() +{ + if (hasMoreArgs()) { + const QString &fileName = nextArg(); + m_collectionFile = getFileName(fileName); + if (m_collectionFile.isEmpty()) + m_error = tr("The collection file '%1' does not exist!"). + arg(fileName); + } else { + m_error = tr("Missing collection file!"); + } +} + +void CmdLineParser::handleShowUrlOption() +{ + if (hasMoreArgs()) { + const QString &urlString = nextArg(); + QUrl url(urlString); + if (url.isValid()) { + m_url = url; + } else + m_error = tr("Invalid URL '%1'!").arg(urlString); + } else { + m_error = tr("Missing URL!"); + } +} + +void CmdLineParser::handleShowOption() +{ + handleShowOrHideOrActivateOption(Show); +} + +void CmdLineParser::handleHideOption() +{ + handleShowOrHideOrActivateOption(Hide); +} + +void CmdLineParser::handleActivateOption() +{ + handleShowOrHideOrActivateOption(Activate); +} + +void CmdLineParser::handleShowOrHideOrActivateOption(ShowState state) +{ + if (hasMoreArgs()) { + const QString &widget = nextArg().toLower(); + if (widget == QLatin1String("contents")) + m_contents = state; + else if (widget == QLatin1String("index")) + m_index = state; + else if (widget == QLatin1String("bookmarks")) + m_bookmarks = state; + else if (widget == QLatin1String("search")) + m_search = state; + else + m_error = tr("Unknown widget: %1").arg(widget); + } else { + m_error = tr("Missing widget!"); + } +} + +void CmdLineParser::handleRegisterOption() +{ + handleRegisterOrUnregisterOption(Register); +} + +void CmdLineParser::handleUnregisterOption() +{ + handleRegisterOrUnregisterOption(Unregister); +} + +void CmdLineParser::handleRegisterOrUnregisterOption(RegisterState state) +{ + if (hasMoreArgs()) { + const QString &fileName = nextArg(); + m_helpFile = getFileName(fileName); + if (m_helpFile.isEmpty()) + m_error = tr("The Qt help file '%1' does not exist!").arg(fileName); + else + m_register = state; + } else { + m_error = tr("Missing help file!"); + } +} + +void CmdLineParser::handleSetCurrentFilterOption() +{ + if (hasMoreArgs()) + m_currentFilter = nextArg(); + else + m_error = tr("Missing filter argument!"); +} + QString CmdLineParser::getFileName(const QString &fileName) { QFileInfo fi(fileName); diff --git a/tools/assistant/tools/assistant/cmdlineparser.h b/tools/assistant/tools/assistant/cmdlineparser.h index 17707cb..fbd7c1d 100644 --- a/tools/assistant/tools/assistant/cmdlineparser.h +++ b/tools/assistant/tools/assistant/cmdlineparser.h @@ -42,6 +42,7 @@ #ifndef CMDLINEPARSER_H #define CMDLINEPARSER_H +#include <QtCore/QCoreApplication> #include <QtCore/QStringList> #include <QtCore/QUrl> @@ -49,13 +50,14 @@ QT_BEGIN_NAMESPACE class CmdLineParser { + Q_DECLARE_TR_FUNCTIONS(CmdLineParser) public: enum Result {Ok, Help, Error}; enum ShowState {Untouched, Show, Hide, Activate}; enum RegisterState {None, Register, Unregister}; - CmdLineParser(); - Result parse(const QStringList &arguments); + CmdLineParser(const QStringList &arguments); + Result parse(); void setCollectionFile(const QString &file); QString collectionFile() const; @@ -71,14 +73,26 @@ public: RegisterState registerRequest() const; QString helpFile() const; - bool copy() const { return m_copy; } - void showMessage(const QString &msg, bool error); private: QString getFileName(const QString &fileName); + bool hasMoreArgs() const; + const QString &nextArg(); + void handleCollectionFileOption(); + void handleShowUrlOption(); + void handleShowOption(); + void handleHideOption(); + void handleActivateOption(); + void handleShowOrHideOrActivateOption(ShowState state); + void handleRegisterOption(); + void handleUnregisterOption(); + void handleRegisterOrUnregisterOption(RegisterState state); + void handleSetCurrentFilterOption(); - QString m_helpMessage; + QStringList m_arguments; + int m_pos; + static const QString m_helpMessage; QString m_collectionFile; QString m_cloneFile; QString m_helpFile; @@ -92,8 +106,8 @@ private: RegisterState m_register; QString m_currentFilter; bool m_removeSearchIndex; - bool m_copy; bool m_quiet; + QString m_error; }; QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/contentwindow.cpp b/tools/assistant/tools/assistant/contentwindow.cpp index 4640673..5852d3d 100644 --- a/tools/assistant/tools/assistant/contentwindow.cpp +++ b/tools/assistant/tools/assistant/contentwindow.cpp @@ -89,6 +89,7 @@ bool ContentWindow::syncToContent(const QUrl& url) void ContentWindow::expandTOC() { + Q_ASSERT(m_expandDepth >= -2); if (m_expandDepth > -2) { expandToDepth(m_expandDepth); m_expandDepth = -2; @@ -97,11 +98,14 @@ void ContentWindow::expandTOC() void ContentWindow::expandToDepth(int depth) { + Q_ASSERT(depth >= -2); m_expandDepth = depth; if (depth == -1) m_contentWidget->expandAll(); + else if (depth == 0) + m_contentWidget->collapseAll(); else - m_contentWidget->expandToDepth(depth); + m_contentWidget->expandToDepth(depth - 1); } void ContentWindow::focusInEvent(QFocusEvent *e) diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf index b8726a4..3b4b5f8 100644 --- a/tools/assistant/tools/assistant/doc/assistant.qdocconf +++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf @@ -12,5 +12,5 @@ HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \ "<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \ "<td width=\"30%\" align=\"left\">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \ "<td width=\"40%\" align=\"center\">Trademarks</td>\n" \ - "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.6.2</div></td>\n" \ + "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.7.0</div></td>\n" \ "</tr></table></div></address>" diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp index be6245a..7ff2a72 100644 --- a/tools/assistant/tools/assistant/helpviewer.cpp +++ b/tools/assistant/tools/assistant/helpviewer.cpp @@ -41,6 +41,7 @@ #include "helpviewer.h" #include "centralwidget.h" +#include "../shared/collectionconfiguration.h" #include <QtCore/QDir> #include <QtCore/QEvent> @@ -63,6 +64,12 @@ QT_BEGIN_NAMESPACE +namespace { + const QString PageNotFoundMessage = + QObject::tr("<title>Error 404...</title><div align=\"center\"><br><br>" + "<h1>The page could not be found</h1><br><h3>'%1'</h3></div>"); +} + #if !defined(QT_NO_WEBKIT) class HelpNetworkReply : public QNetworkReply @@ -151,8 +158,10 @@ QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/, mimeType = QLatin1String("text/html"); } - const QByteArray &ba = helpEngine->fileData(url); - return new HelpNetworkReply(request, ba.isEmpty() ? " " : ba, mimeType); + const QByteArray &data = helpEngine->findFile(url).isValid() + ? helpEngine->fileData(url) + : PageNotFoundMessage.arg(url.toString()).toUtf8(); + return new HelpNetworkReply(request, data, mimeType); } class HelpPage : public QWebPage @@ -325,19 +334,6 @@ void HelpViewer::zoomOut(qreal range) setTextSizeMultiplier(qMax(0.0, textSizeMultiplier() - range / 10.0)); } -void HelpViewer::home() -{ - QString homepage = helpEngine->customValue(QLatin1String("homepage"), - QLatin1String("")).toString(); - - if (homepage.isEmpty()) { - homepage = helpEngine->customValue(QLatin1String("defaultHomepage"), - QLatin1String("help")).toString(); - } - - setSource(homepage); -} - void HelpViewer::wheelEvent(QWheelEvent *e) { if (e->modifiers() & Qt::ControlModifier) { @@ -426,9 +422,7 @@ void HelpViewer::setSource(const QUrl &url) "assistantinternal-1.0.0/assistant/assistant.html"))); } else { QTextBrowser::setSource(url); - setHtml(tr("<title>Error 404...</title><div align=\"center\"><br><br>" - "<h1>The page could not be found</h1><br><h3>'%1'</h3></div>") - .arg(url.toString())); + setHtml(PageNotFoundMessage.arg(url.toString())); emit sourceChanged(url); } } @@ -597,19 +591,6 @@ void HelpViewer::keyPressEvent(QKeyEvent *e) QTextBrowser::keyPressEvent(e); } -void HelpViewer::home() -{ - QString homepage = helpEngine->customValue(QLatin1String("homepage"), - QLatin1String("")).toString(); - - if (homepage.isEmpty()) { - homepage = helpEngine->customValue(QLatin1String("defaultHomepage"), - QLatin1String("help")).toString(); - } - - setSource(homepage); -} - void HelpViewer::wheelEvent(QWheelEvent *e) { if (e->modifiers() == Qt::CTRL) { @@ -623,4 +604,12 @@ void HelpViewer::wheelEvent(QWheelEvent *e) #endif // !defined(QT_NO_WEBKIT) +void HelpViewer::home() +{ + QString homePage = CollectionConfiguration::homePage(*helpEngine); + if (homePage.isEmpty()) + homePage = CollectionConfiguration::defaultHomePage(*helpEngine); + setSource(homePage); +} + QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/images/bookmark.png b/tools/assistant/tools/assistant/images/bookmark.png Binary files differnew file mode 100644 index 0000000..57e57e3 --- /dev/null +++ b/tools/assistant/tools/assistant/images/bookmark.png diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp index 7a957e2..2c0d4a8 100644 --- a/tools/assistant/tools/assistant/main.cpp +++ b/tools/assistant/tools/assistant/main.cpp @@ -56,6 +56,7 @@ #include <QtSql/QSqlDatabase> +#include "../shared/collectionconfiguration.h" #include "mainwindow.h" #include "cmdlineparser.h" @@ -66,97 +67,38 @@ QT_USE_NAMESPACE Q_IMPORT_PLUGIN(qsqlite) #endif +namespace { + void updateLastPagesOnUnregister(QHelpEngineCore& helpEngine, const QString& nsName) { - int lastPage = helpEngine.customValue(QLatin1String("LastTabPage")).toInt(); - - QLatin1String sep("|"); - QLatin1String pages("LastShownPages"); -#if !defined(QT_NO_WEBKIT) - QLatin1String zoom("LastPagesZoomWebView"); -#else - QLatin1String zoom("LastPagesZoomTextBrowser"); -#endif - - QStringList currentPages = - helpEngine.customValue(pages).toString(). - split(QLatin1Char('|'), QString::SkipEmptyParts); - + int lastPage = CollectionConfiguration::lastTabPage(helpEngine); + QStringList currentPages = CollectionConfiguration::lastShownPages(helpEngine); if (!currentPages.isEmpty()) { - QVector<QString>zoomList = helpEngine.customValue(zoom).toString(). - split(sep, QString::SkipEmptyParts).toVector(); - if (zoomList.isEmpty()) - zoomList.fill(QLatin1String("0.0"), currentPages.size()); - else if(zoomList.count() < currentPages.count()) { - zoomList.insert(zoomList.count(), - currentPages.count() - zoomList.count(), QLatin1String("0.0")); - } + QStringList zoomList = CollectionConfiguration::lastZoomFactors(helpEngine); + while (zoomList.count() < currentPages.count()) + zoomList.append(CollectionConfiguration::DefaultZoomFactor); for (int i = currentPages.count(); --i >= 0;) { if (QUrl(currentPages.at(i)).host() == nsName) { - zoomList.remove(i); + zoomList.removeAt(i); currentPages.removeAt(i); lastPage = (lastPage == (i + 1)) ? 1 : lastPage; } } - helpEngine.setCustomValue(pages, currentPages.join(sep)); - helpEngine.setCustomValue(QLatin1String("LastTabPage"), lastPage); - helpEngine.setCustomValue(zoom, QStringList(zoomList.toList()).join(sep)); + CollectionConfiguration::setLastShownPages(helpEngine, currentPages); + CollectionConfiguration::setLastTabPage(helpEngine, lastPage); + CollectionConfiguration::setLastZoomFactors(helpEngine, zoomList); } } bool updateUserCollection(QHelpEngineCore& user, const QHelpEngineCore& caller) { - const uint callerCollectionCreationTime = caller. - customValue(QLatin1String("CreationTime"), 0).toUInt(); - const uint userCollectionCreationTime = user. - customValue(QLatin1String("CreationTime"), 1).toUInt(); - - if (callerCollectionCreationTime <= userCollectionCreationTime) + if (!CollectionConfiguration::isNewer(caller, user)) return false; - - user.setCustomValue(QLatin1String("CreationTime"), - callerCollectionCreationTime); - user.setCustomValue(QLatin1String("WindowTitle"), - caller.customValue(QLatin1String("WindowTitle"))); - user.setCustomValue(QLatin1String("LastShownPages"), - caller.customValue(QLatin1String("LastShownPages"))); -#if !defined(QT_NO_WEBKIT) - const QLatin1String zoomKey("LastPagesZoomWebView"); -#else - const QLatin1String zoomKey("LastPagesZoomTextBrowser"); -#endif - user.setCustomValue(zoomKey, caller.customValue(zoomKey)); - user.setCustomValue(QLatin1String("CurrentFilter"), - caller.customValue(QLatin1String("CurrentFilter"))); - user.setCustomValue(QLatin1String("CacheDirectory"), - caller.customValue(QLatin1String("CacheDirectory"))); - user.setCustomValue(QLatin1String("EnableFilterFunctionality"), - caller.customValue(QLatin1String("EnableFilterFunctionality"))); - user.setCustomValue(QLatin1String("HideFilterFunctionality"), - caller.customValue(QLatin1String("HideFilterFunctionality"))); - user.setCustomValue(QLatin1String("EnableDocumentationManager"), - caller.customValue(QLatin1String("EnableDocumentationManager"))); - user.setCustomValue(QLatin1String("EnableAddressBar"), - caller.customValue(QLatin1String("EnableAddressBar"))); - user.setCustomValue(QLatin1String("HideAddressBar"), - caller.customValue(QLatin1String("HideAddressBar"))); - user.setCustomValue(QLatin1String("ApplicationIcon"), - caller.customValue(QLatin1String("ApplicationIcon"))); - user.setCustomValue(QLatin1String("AboutMenuTexts"), - caller.customValue(QLatin1String("AboutMenuTexts"))); - user.setCustomValue(QLatin1String("AboutIcon"), - caller.customValue(QLatin1String("AboutIcon"))); - user.setCustomValue(QLatin1String("AboutTexts"), - caller.customValue(QLatin1String("AboutTexts"))); - user.setCustomValue(QLatin1String("AboutImages"), - caller.customValue(QLatin1String("AboutImages"))); - user.setCustomValue(QLatin1String("defaultHomepage"), - caller.customValue(QLatin1String("defaultHomepage"))); - + CollectionConfiguration::copyConfiguration(caller, user); return true; } @@ -187,6 +129,8 @@ QString indexFilesFolder(const QString &collectionFile) return indexFilesFolder; } +} // Anonymous namespace. + int main(int argc, char *argv[]) { #ifndef Q_OS_WIN @@ -209,8 +153,8 @@ int main(int argc, char *argv[]) #endif a.addLibraryPath(a.applicationDirPath() + QLatin1String("/plugins")); - CmdLineParser cmd; - CmdLineParser::Result res = cmd.parse(a.arguments()); + CmdLineParser cmd(a.arguments()); + CmdLineParser::Result res = cmd.parse(); if (res == CmdLineParser::Help) return 0; else if (res == CmdLineParser::Error) @@ -246,7 +190,7 @@ int main(int argc, char *argv[]) return -1; } } - help.setCustomValue(QLatin1String("DocUpdate"), true); + CollectionConfiguration::setDocUpdatePending(help, true); return 0; } @@ -292,9 +236,12 @@ int main(int argc, char *argv[]) } QString fileName = QFileInfo(cmdCollectionFile).fileName(); - QString dir = MainWindow::collectionFileDirectory(false, - caller.customValue(QLatin1String("CacheDirectory"), - QString()).toString()); + const QString &cacheDir = CollectionConfiguration::cacheDir(caller); + const QString dir = !cacheDir.isEmpty() + && CollectionConfiguration::cacheDirIsRelativeToCollection(caller) + ? QFileInfo(cmdCollectionFile).dir().absolutePath() + + QDir::separator() + cacheDir + : MainWindow::collectionFileDirectory(false, cacheDir); bool collectionFileExists = true; QFileInfo fi(dir + QDir::separator() + fileName); @@ -310,8 +257,7 @@ int main(int argc, char *argv[]) QHelpEngineCore user(fi.absoluteFilePath()); if (user.setupData()) { // some docs might have been un/registered - bool docUpdate = caller. - customValue(QLatin1String("DocUpdate"), false).toBool(); + bool docUpdate = CollectionConfiguration::docUpdatePending(caller); // update in case the passed collection file changed if (updateUserCollection(user, caller)) @@ -337,7 +283,7 @@ int main(int argc, char *argv[]) user.unregisterDocumentation(doc); } - caller.setCustomValue(QLatin1String("DocUpdate"), false); + CollectionConfiguration::setDocUpdatePending(caller, false); } } } diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index 0dbf813..f05f337 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -52,10 +52,13 @@ #include "aboutdialog.h" #include "searchwidget.h" #include "qtdocinstaller.h" +#include "xbelsupport.h" +#include "../shared/collectionconfiguration.h" #include <QtCore/QDir> #include <QtCore/QTimer> #include <QtCore/QDebug> +#include <QtCore/QFileSystemWatcher> #include <QtCore/QResource> #include <QtCore/QByteArray> #include <QtCore/QTextStream> @@ -76,6 +79,7 @@ #include <QtGui/QProgressBar> #include <QtGui/QDesktopServices> #include <QtGui/QToolButton> +#include <QtGui/QFileDialog> #include <QtHelp/QHelpEngine> #include <QtHelp/QHelpSearchEngine> @@ -91,6 +95,7 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) , m_cmdLine(cmdLine) , m_progressWidget(0) , m_qtDocInstaller(0) + , m_qchWatcher(new QFileSystemWatcher(this)) , m_connectedInitSignals(false) { setToolButtonStyle(Qt::ToolButtonFollowStyle); @@ -148,10 +153,11 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) connect(m_bookmarkManager, SIGNAL(bookmarksChanged()), this, SLOT(updateBookmarkMenu())); - setWindowTitle(m_helpEngine->customValue(QLatin1String("WindowTitle"), - defWindowTitle).toString()); - QByteArray iconArray = m_helpEngine->customValue(QLatin1String("ApplicationIcon"), - QByteArray()).toByteArray(); + const QString windowTitle = + CollectionConfiguration::windowTitle(*m_helpEngine); + setWindowTitle(windowTitle.isEmpty() ? defWindowTitle : windowTitle); + QByteArray iconArray = + CollectionConfiguration::applicationIcon(*m_helpEngine); if (iconArray.size() > 0) { QPixmap pix; pix.loadFromData(iconArray); @@ -165,11 +171,11 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) // Show the widget here, otherwise the restore geometry and state won't work // on x11. show(); - QByteArray ba(m_helpEngine->customValue(QLatin1String("MainWindow")).toByteArray()); + QByteArray ba(CollectionConfiguration::mainWindow(*m_helpEngine)); if (!ba.isEmpty()) restoreState(ba); - ba = m_helpEngine->customValue(QLatin1String("MainWindowGeometry")).toByteArray(); + ba = CollectionConfiguration::mainWindowGeometry(*m_helpEngine); if (!ba.isEmpty()) { restoreGeometry(ba); } else { @@ -179,14 +185,14 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) resize(QSize(800, 600)); } - if (!m_helpEngine->customValue(QLatin1String("useAppFont")).isValid()) { - m_helpEngine->setCustomValue(QLatin1String("useAppFont"), false); - m_helpEngine->setCustomValue(QLatin1String("useBrowserFont"), false); - m_helpEngine->setCustomValue(QLatin1String("appFont"), qApp->font()); - m_helpEngine->setCustomValue(QLatin1String("appWritingSystem"), + if (!CollectionConfiguration::hasFontSettings(*m_helpEngine)) { + CollectionConfiguration::setUseAppFont(*m_helpEngine, false); + CollectionConfiguration::setUseBrowserFont(*m_helpEngine, false); + CollectionConfiguration::setAppFont(*m_helpEngine, qApp->font()); + CollectionConfiguration::setAppWritingSystem(*m_helpEngine, QFontDatabase::Latin); - m_helpEngine->setCustomValue(QLatin1String("browserFont"), qApp->font()); - m_helpEngine->setCustomValue(QLatin1String("browserWritingSystem"), + CollectionConfiguration::setBrowserFont(*m_helpEngine, qApp->font()); + CollectionConfiguration::setBrowserWritingSystem(*m_helpEngine, QFontDatabase::Latin); } else { updateApplicationFont(); @@ -196,7 +202,7 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) QTimer::singleShot(0, this, SLOT(insertLastPages())); if (m_cmdLine->enableRemoteControl()) - (void)new RemoteControl(this, m_helpEngine); + (void)new RemoteControl(this, m_helpEngine, m_qchWatcher); if (m_cmdLine->contents() == CmdLineParser::Show) showContents(); @@ -235,6 +241,13 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) QTimer::singleShot(0, this, SLOT(lookForNewQtDocumentation())); else checkInitState(); + + foreach(const QString &ns, m_helpEngine->registeredDocumentations()) { + const QString &docFile = m_helpEngine->documentationFileName(ns); + m_qchWatcher->addPath(docFile); + connect(m_qchWatcher, SIGNAL(fileChanged(QString)), this, + SLOT(qchFileChanged(QString))); + } } setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North); } @@ -253,8 +266,8 @@ bool MainWindow::usesDefaultCollection() const void MainWindow::closeEvent(QCloseEvent *e) { m_bookmarkManager->saveBookmarks(); - m_helpEngine->setCustomValue(QLatin1String("MainWindow"), saveState()); - m_helpEngine->setCustomValue(QLatin1String("MainWindowGeometry"), + CollectionConfiguration::setMainWindow(*m_helpEngine, saveState()); + CollectionConfiguration::setMainWindowGeometry(*m_helpEngine, saveGeometry()); QMainWindow::closeEvent(e); @@ -295,18 +308,20 @@ bool MainWindow::initHelpDB() } QHelpEngineCore hc(fi.absoluteFilePath()); hc.setupData(); - hc.unregisterDocumentation(intern); - hc.registerDocumentation(helpFile); + const QString internalFile = hc.documentationFileName(intern); + if (hc.unregisterDocumentation(intern)) + m_qchWatcher->removePath(internalFile); + if (hc.registerDocumentation(helpFile)) + m_qchWatcher->addPath(helpFile); needsSetup = true; } - const QLatin1String unfiltered("UnfilteredFilterInserted"); - if (1 != m_helpEngine->customValue(unfiltered).toInt()) { + if (!CollectionConfiguration::unfilteredInserted(*m_helpEngine)) { { QHelpEngineCore hc(collectionFile); hc.setupData(); hc.addCustomFilter(tr("Unfiltered"), QStringList()); - hc.setCustomValue(unfiltered, 1); + CollectionConfiguration::setUnfilteredInserted(hc); } m_helpEngine->blockSignals(true); @@ -315,22 +330,25 @@ bool MainWindow::initHelpDB() needsSetup = true; } - if (needsSetup) + if (needsSetup) { m_helpEngine->setupData(); + Q_ASSERT(m_qchWatcher->files().count() + == m_helpEngine->registeredDocumentations().count()); + } return true; } void MainWindow::lookForNewQtDocumentation() { - m_qtDocInstaller = new QtDocInstaller(m_helpEngine->collectionFile()); + m_qtDocInstaller = + new QtDocInstaller(m_helpEngine->collectionFile(), m_qchWatcher); connect(m_qtDocInstaller, SIGNAL(errorMessage(QString)), this, SLOT(displayInstallationError(QString))); connect(m_qtDocInstaller, SIGNAL(docsInstalled(bool)), this, SLOT(qtDocumentationInstalled(bool))); - QString versionKey = QString(QLatin1String("qtVersion%1$$$qt")). - arg(QLatin1String(QT_VERSION_STR)); - if (m_helpEngine->customValue(versionKey, 0).toInt() != 1) + if (CollectionConfiguration::qtDocInfo(*m_helpEngine, QLatin1String("qt")). + count() != 2) statusBar()->showMessage(tr("Looking for Qt Documentation...")); m_qtDocInstaller->installDocs(); } @@ -374,13 +392,17 @@ void MainWindow::checkInitState() void MainWindow::updateBookmarkMenu() { if (m_bookmarkManager) { + m_bookmarkMenu->removeAction(m_importBookmarkAction); + m_bookmarkMenu->removeAction(m_exportBookmarkAction); m_bookmarkMenu->removeAction(m_bookmarkMenuAction); - + m_bookmarkMenu->clear(); - + + m_bookmarkMenu->addAction(m_importBookmarkAction); + m_bookmarkMenu->addAction(m_exportBookmarkAction); m_bookmarkMenu->addAction(m_bookmarkMenuAction); m_bookmarkMenu->addSeparator(); - + m_bookmarkManager->fillBookmarkMenu(m_bookmarkMenu); } } @@ -437,8 +459,12 @@ void MainWindow::setupActions() m_closeTabAction->setShortcuts(QKeySequence::Close); QAction *tmp = menu->addAction(tr("&Quit"), this, SLOT(close())); - tmp->setShortcut(QKeySequence::Quit); tmp->setMenuRole(QAction::QuitRole); +#ifdef Q_OS_WIN + tmp->setShortcut(QKeySequence(tr("CTRL+Q"))); +#else + tmp->setShortcut(QKeySequence::Quit); +#endif menu = menuBar()->addMenu(tr("&Edit")); m_copyAction = menu->addAction(tr("&Copy selected Text"), m_centralWidget, @@ -529,6 +555,10 @@ void MainWindow::setupActions() << QKeySequence(Qt::CTRL + Qt::Key_PageUp)); m_bookmarkMenu = menuBar()->addMenu(tr("&Bookmarks")); + m_importBookmarkAction = m_bookmarkMenu->addAction(tr("Import..."), + this, SLOT(importBookmarks())); + m_exportBookmarkAction = m_bookmarkMenu->addAction(tr("Export..."), + this, SLOT(exportBookmarks())); m_bookmarkMenuAction = m_bookmarkMenu->addAction(tr("Add Bookmark..."), this, SLOT(addBookmark())); m_bookmarkMenuAction->setShortcut(tr("CTRL+D")); @@ -633,8 +663,7 @@ QMenu *MainWindow::toolBarMenu() void MainWindow::setupFilterToolbar() { - if (!m_helpEngine-> - customValue(QLatin1String("EnableFilterFunctionality"), true).toBool()) + if (!CollectionConfiguration::filterFunctionalityEnabled(*m_helpEngine)) return; m_filterCombo = new QComboBox(this); @@ -647,8 +676,7 @@ void MainWindow::setupFilterToolbar() this)); filterToolBar->addWidget(m_filterCombo); - const QLatin1String hideFilter("HideFilterFunctionality"); - if (m_helpEngine->customValue(hideFilter, true).toBool()) + if (!CollectionConfiguration::filterToolbarVisible(*m_helpEngine)) filterToolBar->hide(); toolBarMenu()->addAction(filterToolBar->toggleViewAction()); @@ -664,7 +692,7 @@ void MainWindow::setupFilterToolbar() void MainWindow::setupAddressToolbar() { - if (!m_helpEngine->customValue(QLatin1String("EnableAddressBar"), true).toBool()) + if (!CollectionConfiguration::addressBarEnabled(*m_helpEngine)) return; m_addressLineEdit = new QLineEdit(this); @@ -676,7 +704,7 @@ void MainWindow::setupAddressToolbar() this)); addressToolBar->addWidget(m_addressLineEdit); - if (m_helpEngine->customValue(QLatin1String("HideAddressBar"), true).toBool()) + if (!CollectionConfiguration::addressBarVisible(*m_helpEngine)) addressToolBar->hide(); toolBarMenu()->addAction(addressToolBar->toggleViewAction()); @@ -692,8 +720,7 @@ void MainWindow::setupAddressToolbar() void MainWindow::updateAboutMenuText() { if (m_helpEngine) { - QByteArray ba = m_helpEngine->customValue(QLatin1String("AboutMenuTexts"), - QByteArray()).toByteArray(); + QByteArray ba = CollectionConfiguration::aboutMenuTexts(*m_helpEngine); if (ba.size() > 0) { QString lang; QString str; @@ -769,7 +796,7 @@ void MainWindow::showTopicChooser(const QMap<QString, QUrl> &links, void MainWindow::showPreferences() { - PreferencesDialog dia(m_helpEngine, this); + PreferencesDialog dia(m_helpEngine, m_qchWatcher, this); connect(&dia, SIGNAL(updateApplicationFont()), this, SLOT(updateApplicationFont())); @@ -807,8 +834,7 @@ void MainWindow::showAboutDialog() { QByteArray contents; if (m_helpEngine) { - QByteArray ba = m_helpEngine->customValue(QLatin1String("AboutTexts"), - QByteArray()).toByteArray(); + QByteArray ba = CollectionConfiguration::aboutTexts(*m_helpEngine); if (!ba.isEmpty()) { QString lang; QByteArray cba; @@ -834,11 +860,9 @@ void MainWindow::showAboutDialog() QByteArray iconArray; if (!contents.isEmpty()) { - iconArray = m_helpEngine->customValue(QLatin1String("AboutIcon"), - QByteArray()).toByteArray(); + iconArray = CollectionConfiguration::aboutIcon(*m_helpEngine); QByteArray resources = - m_helpEngine->customValue(QLatin1String("AboutImages"), - QByteArray()).toByteArray(); + CollectionConfiguration::aboutImages(*m_helpEngine); QPixmap pix; pix.loadFromData(iconArray); aboutDia.setText(QString::fromUtf8(contents), resources); @@ -861,41 +885,84 @@ void MainWindow::showAboutDialog() aboutDia.exec(); } +void MainWindow::setContentsVisible(bool visible) +{ + if (visible) + showContents(); + else + hideContents(); +} + void MainWindow::showContents() { activateDockWidget(m_contentWindow); } +void MainWindow::hideContents() +{ + m_contentWindow->parentWidget()->hide(); +} + +void MainWindow::setIndexVisible(bool visible) +{ + if (visible) + showIndex(); + else + hideIndex(); +} + void MainWindow::showIndex() { activateDockWidget(m_indexWindow); } +void MainWindow::hideIndex() +{ + m_indexWindow->parentWidget()->hide(); +} + +void MainWindow::setBookmarksVisible(bool visible) +{ + if (visible) + showBookmarks(); + else + hideBookmarks(); +} + + void MainWindow::showBookmarks() { activateDockWidget(m_bookmarkWidget); } -void MainWindow::activateDockWidget(QWidget *w) +void MainWindow::hideBookmarks() { - w->parentWidget()->show(); - w->parentWidget()->raise(); - w->setFocus(); + m_bookmarkWidget->parentWidget()->hide(); } -void MainWindow::hideContents() +void MainWindow::setSearchVisible(bool visible) { - m_contentWindow->parentWidget()->hide(); + if (visible) + showSearch(); + else + hideSearch(); } -void MainWindow::hideIndex() +void MainWindow::showSearch() { - m_indexWindow->parentWidget()->hide(); + m_centralWidget->activateSearchWidget(); } -void MainWindow::hideBookmarks() +void MainWindow::hideSearch() { - m_bookmarkWidget->parentWidget()->hide(); + m_centralWidget->removeSearchWidget(); +} + +void MainWindow::activateDockWidget(QWidget *w) +{ + w->parentWidget()->show(); + w->parentWidget()->raise(); + w->setFocus(); } void MainWindow::setIndexString(const QString &str) @@ -916,26 +983,16 @@ void MainWindow::activateCurrentCentralWidgetTab() m_centralWidget->activateTab(); } -void MainWindow::showSearch() -{ - m_centralWidget->activateSearchWidget(); -} - void MainWindow::showSearchWidget() { m_centralWidget->activateSearchWidget(true); } -void MainWindow::hideSearch() -{ - m_centralWidget->removeSearchWidget(); -} - void MainWindow::updateApplicationFont() { QFont font = qApp->font(); - if (m_helpEngine->customValue(QLatin1String("useAppFont")).toBool()) - font = qVariantValue<QFont>(m_helpEngine->customValue(QLatin1String("appFont"))); + if (CollectionConfiguration::usesAppFont(*m_helpEngine)) + font = CollectionConfiguration::appFont(*m_helpEngine); qApp->setFont(font, "QWidget"); } @@ -960,6 +1017,7 @@ void MainWindow::filterDocumentation(const QString &customFilter) void MainWindow::expandTOC(int depth) { + Q_ASSERT(depth >= -1); m_contentWindow->expandToDepth(depth); } @@ -1035,6 +1093,41 @@ QString MainWindow::defaultHelpCollectionFileName() arg(QLatin1String(QT_VERSION_STR)); } +void MainWindow::importBookmarks() +{ + const QString &fileName = QFileDialog::getOpenFileName(0, tr("Open File"), + QDir::currentPath(), tr("Files (*.xbel)")); + + if (fileName.isEmpty()) + return; + + QFile file(fileName); + if (file.open(QIODevice::ReadOnly)) { + XbelReader reader(m_bookmarkManager->treeBookmarkModel(), + m_bookmarkManager->listBookmarkModel()); + reader.readFromFile(&file); + } +} + +void MainWindow::exportBookmarks() +{ + QString fileName = QFileDialog::getSaveFileName(0, tr("Save File"), + "untitled.xbel", tr("Files (*.xbel)")); + + QLatin1String suffix(".xbel"); + if (!fileName.endsWith(suffix)) + fileName.append(suffix); + + QFile file(fileName); + if (file.open(QIODevice::WriteOnly)) { + XbelWriter writer(m_bookmarkManager->treeBookmarkModel()); + writer.writeToFile(&file); + } else { + QMessageBox::information(this, tr("Qt Assistant"), + tr("Unable to save bookmarks."), tr("OK")); + } +} + void MainWindow::currentFilterChanged(const QString &filter) { const int index = m_filterCombo->findText(filter); @@ -1042,4 +1135,33 @@ void MainWindow::currentFilterChanged(const QString &filter) m_filterCombo->setCurrentIndex(index); } +void MainWindow::qchFileChanged(const QString &fileName) +{ + /* + * We don't use QHelpEngineCore::namespaceName(fileName), because the file + * may not exist anymore or contain a different namespace. + */ + QString ns; + foreach (const QString &curNs, m_helpEngine->registeredDocumentations()) { + if (m_helpEngine->documentationFileName(curNs) == fileName) { + ns = curNs; + break; + } + } + + /* + * We can't do an assertion here, because QFileSystemWatcher may send the + * signal more than once. + */ + if (ns.isEmpty()) + return; + + CentralWidget* widget = CentralWidget::instance(); + widget->closeTabs(widget->currentSourceFileList().keys(ns)); + if (m_helpEngine->unregisterDocumentation(ns) && + (!QFileInfo(fileName).exists() + || !m_helpEngine->registerDocumentation(fileName))) + m_qchWatcher->removePath(fileName); +} + QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/mainwindow.h b/tools/assistant/tools/assistant/mainwindow.h index 8a9b572..8672526 100644 --- a/tools/assistant/tools/assistant/mainwindow.h +++ b/tools/assistant/tools/assistant/mainwindow.h @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE class QAction; +class QFileSystemWatcher; class QLineEdit; class QComboBox; class QMenu; @@ -76,10 +77,6 @@ public: static QString defaultHelpCollectionFileName(); public: - void hideContents(); - void hideIndex(); - void hideBookmarks(); - void hideSearch(); void setIndexString(const QString &str); void expandTOC(int depth); bool usesDefaultCollection() const; @@ -88,16 +85,20 @@ signals: void initDone(); public slots: - void showContents(); - void showIndex(); - void showBookmarks(); - void showSearch(); + void setContentsVisible(bool visible); + void setIndexVisible(bool visible); + void setBookmarksVisible(bool visible); + void setSearchVisible(bool visible); void showSearchWidget(); void syncContents(); void activateCurrentCentralWidgetTab(); void currentFilterChanged(const QString &filter); private slots: + void showContents(); + void showIndex(); + void showBookmarks(); + void showSearch(); void insertLastPages(); void addBookmark(); void gotoAddress(); @@ -119,10 +120,14 @@ private slots: void displayInstallationError(const QString &errorMessage); void qtDocumentationInstalled(bool newDocsInstalled); void checkInitState(); + void qchFileChanged(const QString &fileName); void updateBookmarkMenu(); void showBookmark(QAction *action); + void importBookmarks(); + void exportBookmarks(); + private: bool initHelpDB(); void setupActions(); @@ -133,6 +138,10 @@ private: void setupAddressToolbar(); QMenu *toolBarMenu(); QWidget *setupBookmarkWidget(); + void hideContents(); + void hideIndex(); + void hideBookmarks(); + void hideSearch(); QHelpEngine *m_helpEngine; CentralWidget *m_centralWidget; @@ -163,11 +172,14 @@ private: QMenu *m_toolBarMenu; QMenu *m_bookmarkMenu; QAction *m_bookmarkMenuAction; + QAction *m_importBookmarkAction; + QAction *m_exportBookmarkAction; CmdLineParser *m_cmdLine; QWidget *m_progressWidget; QtDocInstaller *m_qtDocInstaller; + QFileSystemWatcher * const m_qchWatcher; bool m_connectedInitSignals; }; diff --git a/tools/assistant/tools/assistant/preferencesdialog.cpp b/tools/assistant/tools/assistant/preferencesdialog.cpp index ca12d8f..f7de9e9 100644 --- a/tools/assistant/tools/assistant/preferencesdialog.cpp +++ b/tools/assistant/tools/assistant/preferencesdialog.cpp @@ -45,8 +45,10 @@ #include "fontpanel.h" #include "centralwidget.h" #include "aboutdialog.h" +#include "../shared/collectionconfiguration.h" -#include <QtAlgorithms> +#include <QtCore/QtAlgorithms> +#include <QtCore/QFileSystemWatcher> #include <QtGui/QHeaderView> #include <QtGui/QFileDialog> @@ -60,11 +62,13 @@ QT_BEGIN_NAMESPACE -PreferencesDialog::PreferencesDialog(QHelpEngineCore *helpEngine, QWidget *parent) +PreferencesDialog::PreferencesDialog(QHelpEngineCore *helpEngine, + QFileSystemWatcher *qchWatcher, QWidget *parent) : QDialog(parent) , m_helpEngine(helpEngine) , m_appFontChanged(false) , m_browserFontChanged(false) + , m_qchWatcher(qchWatcher) { m_ui.setupUi(this); @@ -73,11 +77,10 @@ PreferencesDialog::PreferencesDialog(QHelpEngineCore *helpEngine, QWidget *paren connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); - QLatin1String key("EnableFilterFunctionality"); - m_hideFiltersTab = !m_helpEngine->customValue(key, true).toBool(); - - key = QLatin1String("EnableDocumentationManager"); - m_hideDocsTab = !m_helpEngine->customValue(key, true).toBool(); + m_hideFiltersTab = + !CollectionConfiguration::filterFunctionalityEnabled(*m_helpEngine); + m_hideDocsTab = + !CollectionConfiguration::documentationManagerEnabled(*m_helpEngine); if (!m_hideFiltersTab) { m_ui.attributeWidget->header()->hide(); @@ -118,27 +121,22 @@ PreferencesDialog::PreferencesDialog(QHelpEngineCore *helpEngine, QWidget *paren PreferencesDialog::~PreferencesDialog() { - QLatin1String key(""); if (m_appFontChanged) { - key = QLatin1String("appFont"); - m_helpEngine->setCustomValue(key, m_appFontPanel->selectedFont()); - - key = QLatin1String("useAppFont"); - m_helpEngine->setCustomValue(key, m_appFontPanel->isChecked()); - - key = QLatin1String("appWritingSystem"); - m_helpEngine->setCustomValue(key, m_appFontPanel->writingSystem()); + CollectionConfiguration::setAppFont(*m_helpEngine, + m_appFontPanel->selectedFont()); + CollectionConfiguration::setUseAppFont(*m_helpEngine, + m_appFontPanel->isChecked()); + CollectionConfiguration::setAppWritingSystem(*m_helpEngine, + m_appFontPanel->writingSystem()); } if (m_browserFontChanged) { - key = QLatin1String("browserFont"); - m_helpEngine->setCustomValue(key, m_browserFontPanel->selectedFont()); - - key = QLatin1String("useBrowserFont"); - m_helpEngine->setCustomValue(key, m_browserFontPanel->isChecked()); - - key = QLatin1String("browserWritingSystem"); - m_helpEngine->setCustomValue(key, m_browserFontPanel->writingSystem()); + CollectionConfiguration::setBrowserFont(*m_helpEngine, + m_browserFontPanel->selectedFont()); + CollectionConfiguration::setUseBrowserFont(*m_helpEngine, + m_browserFontPanel->isChecked()); + CollectionConfiguration::setBrowserWritingSystem(*m_helpEngine, + m_browserFontPanel->writingSystem()); } if (m_appFontChanged || m_browserFontChanged) { @@ -149,10 +147,10 @@ PreferencesDialog::~PreferencesDialog() QString homePage = m_ui.homePageLineEdit->text(); if (homePage.isEmpty()) homePage = QLatin1String("help"); - m_helpEngine->setCustomValue(QLatin1String("homepage"), homePage); + CollectionConfiguration::setHomePage(*m_helpEngine, homePage); int option = m_ui.helpStartComboBox->currentIndex(); - m_helpEngine->setCustomValue(QLatin1String("StartOption"), option); + CollectionConfiguration::setStartOption(*m_helpEngine, option); } void PreferencesDialog::showDialog() @@ -275,7 +273,11 @@ void PreferencesDialog::addDocumentationLocal() continue; } - m_helpEngine->registerDocumentation(fileName); + if (m_helpEngine->registerDocumentation(fileName)) { + m_qchWatcher->addPath(fileName); + Q_ASSERT(m_qchWatcher->files().count() + == m_helpEngine->registeredDocumentations().count()); + } m_ui.registeredDocsListWidget->addItem(nameSpace); m_regDocs.append(nameSpace); m_unregDocs.removeAll(nameSpace); @@ -378,17 +380,15 @@ void PreferencesDialog::applyChanges() } } - qSort(m_TabsToClose); - CentralWidget* widget = CentralWidget::instance(); - for (int i = m_TabsToClose.count(); --i >= 0;) - widget->closeTabAt(m_TabsToClose.at(i)); - if (widget->availableHelpViewer()== 0) - widget->setSource(QUrl(QLatin1String("about:blank"))); - - if (m_unregDocs.count()) { - foreach (const QString &doc, m_unregDocs) - m_helpEngine->unregisterDocumentation(doc); + CentralWidget::instance()->closeTabs(m_TabsToClose); + + foreach (const QString &doc, m_unregDocs) { + const QString docFile = m_helpEngine->documentationFileName(doc); + if (m_helpEngine->unregisterDocumentation(doc)) + m_qchWatcher->removePath(docFile); } + Q_ASSERT(m_qchWatcher->files().count() + == m_helpEngine->registeredDocumentations().count()); if (filtersWereChanged || m_regDocs.count() || m_unregDocs.count()) m_helpEngine->setupData(); @@ -411,31 +411,26 @@ void PreferencesDialog::updateFontSettingsPage() const QString customSettings(tr("Use custom settings")); m_appFontPanel->setTitle(customSettings); - QLatin1String key = QLatin1String("appFont"); - QFont font = qVariantValue<QFont>(m_helpEngine->customValue(key)); + QFont font = CollectionConfiguration::appFont(*m_helpEngine); m_appFontPanel->setSelectedFont(font); - key = QLatin1String("appWritingSystem"); - QFontDatabase::WritingSystem system = static_cast<QFontDatabase::WritingSystem> - (m_helpEngine->customValue(key).toInt()); + QFontDatabase::WritingSystem system = + CollectionConfiguration::appWritingSystem(*m_helpEngine); m_appFontPanel->setWritingSystem(system); - key = QLatin1String("useAppFont"); - m_appFontPanel->setChecked(m_helpEngine->customValue(key).toBool()); + m_appFontPanel->setChecked(CollectionConfiguration:: + usesAppFont(*m_helpEngine)); m_browserFontPanel->setTitle(customSettings); - key = QLatin1String("browserFont"); - font = qVariantValue<QFont>(m_helpEngine->customValue(key)); + font = CollectionConfiguration::browserFont(*m_helpEngine); m_browserFontPanel->setSelectedFont(font); - key = QLatin1String("browserWritingSystem"); - system = static_cast<QFontDatabase::WritingSystem> - (m_helpEngine->customValue(key).toInt()); + system = CollectionConfiguration::browserWritingSystem(*m_helpEngine); m_browserFontPanel->setWritingSystem(system); - key = QLatin1String("useBrowserFont"); - m_browserFontPanel->setChecked(m_helpEngine->customValue(key).toBool()); + m_browserFontPanel->setChecked(CollectionConfiguration:: + usesBrowserFont(*m_helpEngine)); connect(m_appFontPanel, SIGNAL(toggled(bool)), this, SLOT(appFontSettingToggled(bool))); @@ -481,17 +476,12 @@ void PreferencesDialog::browserFontSettingChanged(int index) void PreferencesDialog::updateOptionsPage() { - QString homepage = m_helpEngine->customValue(QLatin1String("homepage"), - QLatin1String("")).toString(); - - if (homepage.isEmpty()) { - homepage = m_helpEngine->customValue(QLatin1String("defaultHomepage"), - QLatin1String("help")).toString(); - } - m_ui.homePageLineEdit->setText(homepage); + QString homePage = CollectionConfiguration::homePage(*m_helpEngine); + if (homePage.isEmpty()) + homePage = CollectionConfiguration::defaultHomePage(*m_helpEngine); + m_ui.homePageLineEdit->setText(homePage); - int option = m_helpEngine->customValue(QLatin1String("StartOption"), - ShowLastPages).toInt(); + int option = CollectionConfiguration::startOption(*m_helpEngine); m_ui.helpStartComboBox->setCurrentIndex(option); connect(m_ui.blankPageButton, SIGNAL(clicked()), this, SLOT(setBlankPage())); @@ -515,9 +505,8 @@ void PreferencesDialog::setCurrentPage() void PreferencesDialog::setDefaultPage() { - QString homepage = m_helpEngine->customValue(QLatin1String("defaultHomepage"), - QLatin1String("help")).toString(); - m_ui.homePageLineEdit->setText(homepage); + QString homePage = CollectionConfiguration::defaultHomePage(*m_helpEngine); + m_ui.homePageLineEdit->setText(homePage); } QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/preferencesdialog.h b/tools/assistant/tools/assistant/preferencesdialog.h index 9ad6b6a..2e74fd6 100644 --- a/tools/assistant/tools/assistant/preferencesdialog.h +++ b/tools/assistant/tools/assistant/preferencesdialog.h @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE class FontPanel; +class QFileSystemWatcher; class QHelpEngineCore; enum { @@ -61,7 +62,8 @@ class PreferencesDialog : public QDialog Q_OBJECT public: - PreferencesDialog(QHelpEngineCore *helpEngine, QWidget *parent = 0); + PreferencesDialog(QHelpEngineCore *helpEngine, + QFileSystemWatcher *qchWatcher, QWidget *parent = 0); ~PreferencesDialog(); void showDialog(); @@ -107,6 +109,7 @@ private: FontPanel *m_browserFontPanel; bool m_appFontChanged; bool m_browserFontChanged; + QFileSystemWatcher * const m_qchWatcher; }; QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/qtdocinstaller.cpp b/tools/assistant/tools/assistant/qtdocinstaller.cpp index 652f630..7355750 100644 --- a/tools/assistant/tools/assistant/qtdocinstaller.cpp +++ b/tools/assistant/tools/assistant/qtdocinstaller.cpp @@ -42,12 +42,16 @@ #include <QtCore/QDir> #include <QtCore/QLibraryInfo> #include <QtCore/QDateTime> +#include <QtCore/QFileSystemWatcher> #include <QtHelp/QHelpEngineCore> +#include "../shared/collectionconfiguration.h" #include "qtdocinstaller.h" QT_BEGIN_NAMESPACE -QtDocInstaller::QtDocInstaller(const QString &collectionFile) +QtDocInstaller::QtDocInstaller(const QString &collectionFile, + QFileSystemWatcher *qchWatcher) + : m_qchWatcher(qchWatcher) { m_abort = false; m_collectionFile = collectionFile; @@ -97,14 +101,10 @@ void QtDocInstaller::run() bool QtDocInstaller::installDoc(const QString &name, QHelpEngineCore *helpEngine) { - QString versionKey = QString(QLatin1String("qtVersion%1$$$%2")). - arg(QLatin1String(QT_VERSION_STR)).arg(name); - - QString info = helpEngine->customValue(versionKey, QString()).toString(); - QStringList lst = info.split(QLatin1String("|")); + QStringList lst = CollectionConfiguration::qtDocInfo(*helpEngine, name); QDateTime dt; - if (lst.count() && !lst.first().isEmpty()) + if (!lst.isEmpty() && !lst.first().isEmpty()) dt = QDateTime::fromString(lst.first(), Qt::ISODate); QString qchFile; @@ -116,14 +116,14 @@ bool QtDocInstaller::installDoc(const QString &name, QHelpEngineCore *helpEngine const QStringList files = dir.entryList(QStringList() << QLatin1String("*.qch")); if (files.isEmpty()) { - helpEngine->setCustomValue(versionKey, QDateTime().toString(Qt::ISODate) - + QLatin1String("|")); + CollectionConfiguration::setQtDocInfo(*helpEngine, name, + QStringList(QDateTime().toString(Qt::ISODate))); return false; } foreach (const QString &f, files) { if (f.startsWith(name)) { QFileInfo fi(dir.absolutePath() + QDir::separator() + f); - if (dt.isValid() && fi.lastModified().toString(Qt::ISODate) == dt.toString(Qt::ISODate) + if (dt.isValid() && fi.lastModified().toTime_t() == dt.toTime_t() && qchFile == fi.absoluteFilePath()) return false; @@ -131,17 +131,27 @@ bool QtDocInstaller::installDoc(const QString &name, QHelpEngineCore *helpEngine if (namespaceName.isEmpty()) continue; - if (helpEngine->registeredDocumentations().contains(namespaceName)) - helpEngine->unregisterDocumentation(namespaceName); + if (helpEngine->registeredDocumentations().contains(namespaceName)) { + const QString docFile = + helpEngine->documentationFileName(namespaceName); + if (helpEngine->unregisterDocumentation(namespaceName)) + m_qchWatcher->removePath(docFile); + } if (!helpEngine->registerDocumentation(fi.absoluteFilePath())) { emit errorMessage( tr("The file %1 could not be registered successfully!\n\nReason: %2") .arg(fi.absoluteFilePath()).arg(helpEngine->error())); + } else { + m_qchWatcher->addPath(fi.absoluteFilePath()); } - helpEngine->setCustomValue(versionKey, fi.lastModified().toString(Qt::ISODate) - + QLatin1String("|") + fi.absoluteFilePath()); + Q_ASSERT(m_qchWatcher->files().count() + == helpEngine->registeredDocumentations().count()); + + CollectionConfiguration::setQtDocInfo(*helpEngine, name, + QStringList() << fi.lastModified().toString(Qt::ISODate) + << fi.absoluteFilePath()); return true; } } diff --git a/tools/assistant/tools/assistant/qtdocinstaller.h b/tools/assistant/tools/assistant/qtdocinstaller.h index 05606f9..46e548a 100644 --- a/tools/assistant/tools/assistant/qtdocinstaller.h +++ b/tools/assistant/tools/assistant/qtdocinstaller.h @@ -47,6 +47,7 @@ QT_BEGIN_NAMESPACE +class QFileSystemWatcher; class QHelpEngineCore; class QtDocInstaller : public QThread @@ -54,7 +55,7 @@ class QtDocInstaller : public QThread Q_OBJECT public: - QtDocInstaller(const QString &collectionFile); + QtDocInstaller(const QString &collectionFile, QFileSystemWatcher *qchWatcher); ~QtDocInstaller(); void installDocs(); @@ -70,6 +71,7 @@ private: bool m_abort; QString m_collectionFile; QMutex m_mutex; + QFileSystemWatcher * const m_qchWatcher; }; QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/remotecontrol.cpp b/tools/assistant/tools/assistant/remotecontrol.cpp index 5fa7432..d0ff430 100644 --- a/tools/assistant/tools/assistant/remotecontrol.cpp +++ b/tools/assistant/tools/assistant/remotecontrol.cpp @@ -44,6 +44,8 @@ #include "centralwidget.h" #include <QtCore/QFile> +#include <QtCore/QFileInfo> +#include <QtCore/QFileSystemWatcher> #include <QtCore/QThread> #include <QtCore/QTextStream> #include <QtCore/QSocketNotifier> @@ -97,21 +99,23 @@ void StdInListenerWin::run() #endif while (ok) { - ok = ReadFile(hStdinDup, chBuf, 4096, &dwRead, NULL); + ok = ReadFile(hStdinDup, chBuf, sizeof(chBuf), &dwRead, NULL); if (ok && dwRead != 0) - emit receivedCommand(QString::fromLocal8Bit(chBuf)); + emit receivedCommand(QString::fromLocal8Bit(chBuf, dwRead)); } } #endif -RemoteControl::RemoteControl(MainWindow *mainWindow, QHelpEngine *helpEngine) +RemoteControl::RemoteControl(MainWindow *mainWindow, QHelpEngine *helpEngine, + QFileSystemWatcher *qchWatcher) : QObject(mainWindow) , m_mainWindow(mainWindow) , m_helpEngine(helpEngine) , m_debug(false) , m_caching(true) , m_syncContents(false) - , m_expandTOC(-3) + , m_expandTOC(-2) + , m_qchWatcher(qchWatcher) { connect(m_mainWindow, SIGNAL(initDone()), this, SLOT(applyCache())); @@ -147,113 +151,176 @@ void RemoteControl::handleCommandString(const QString &cmdString) { QStringList cmds = cmdString.split(QLatin1Char(';')); QStringList::const_iterator it = cmds.constBegin(); - QString cmdLine, cmd, arg; while (it != cmds.constEnd()) { - cmdLine = (*it).trimmed(); - cmd = cmdLine; - arg.clear(); - int i = cmdLine.indexOf(QLatin1Char(' ')); - if (i > 0) { - cmd = cmdLine.left(i); - arg = cmdLine.mid(i+1); - } - cmd = cmd.toLower(); + QString cmd, arg; + splitInputString(*it, cmd, arg); if (m_debug) QMessageBox::information(0, tr("Debugging Remote Control"), tr("Received Command: %1 %2").arg(cmd).arg(arg)); - if (cmd == QLatin1String("debug")) { - if (arg == QLatin1String("on")) - m_debug = true; - else - m_debug = false; - } else if (cmd == QLatin1String("show")) { - if (arg.toLower() == QLatin1String("contents")) { - m_mainWindow->showContents(); - } else if (arg.toLower() == QLatin1String("index")) { - m_mainWindow->showIndex(); - } else if (arg.toLower() == QLatin1String("bookmarks")) { - m_mainWindow->showBookmarks(); - } else if (arg.toLower() == QLatin1String("search")) { - m_mainWindow->showSearch(); - } - } else if (cmd == QLatin1String("hide")) { - if (arg.toLower() == QLatin1String("contents")) { - m_mainWindow->hideContents(); - } else if (arg.toLower() == QLatin1String("index")) { - m_mainWindow->hideIndex(); - } else if (arg.toLower() == QLatin1String("bookmarks")) { - m_mainWindow->hideBookmarks(); - } else if (arg.toLower() == QLatin1String("search")) { - m_mainWindow->hideSearch(); - } - } else if (cmd == QLatin1String("setsource")) { - QUrl url(arg); - if (url.isValid()) { - if (url.isRelative()) - url = CentralWidget::instance()->currentSource().resolved(url); - if (m_caching) { - clearCache(); - m_setSource = url; - } else { - CentralWidget::instance()->setSource(url); - } - } - } else if (cmd == QLatin1String("synccontents")) { - if (m_caching) - m_syncContents = true; - else - m_mainWindow->syncContents(); - } else if (cmd == QLatin1String("activatekeyword")) { - if (m_caching) { - clearCache(); - m_activateKeyword = arg; - } else { - m_mainWindow->setIndexString(arg); - if (!arg.isEmpty()) - m_helpEngine->indexWidget()->activateCurrentItem(); - } - } else if (cmd == QLatin1String("activateidentifier")) { - if (m_caching) { - clearCache(); - m_activateIdentifier = arg; - } else { - QMap<QString, QUrl> links = - m_helpEngine->linksForIdentifier(arg); - if (links.count()) - CentralWidget::instance()->setSource(links.constBegin().value()); - } - } else if (cmd == QLatin1String("expandtoc")) { - bool ok = false; - int depth = -1; - if (!arg.isEmpty()) - depth = arg.toInt(&ok); - if (!ok) - depth = -1; - - if (m_caching) - m_expandTOC = depth; - else - m_mainWindow->expandTOC(depth); - } else if (cmd == QLatin1String("setcurrentfilter")) { - if (!m_helpEngine->customFilters().contains(arg)) - return; - if (m_caching) { - clearCache(); - m_currentFilter = arg; - } else { - m_helpEngine->setCurrentFilter(arg); - } - } else { + if (cmd == QLatin1String("debug")) + handleDebugCommand(arg); + else if (cmd == QLatin1String("show")) + handleShowOrHideCommand(arg, true); + else if (cmd == QLatin1String("hide")) + handleShowOrHideCommand(arg, false); + else if (cmd == QLatin1String("setsource")) + handleSetSourceCommand(arg); + else if (cmd == QLatin1String("synccontents")) + handleSyncContentsCommand(); + else if (cmd == QLatin1String("activatekeyword")) + handleActivateKeywordCommand(arg); + else if (cmd == QLatin1String("activateidentifier")) + handleActivateIdentifierCommand(arg); + else if (cmd == QLatin1String("expandtoc")) + handleExpandTocCommand(arg); + else if (cmd == QLatin1String("setcurrentfilter")) + handleSetCurrentFilterCommand(arg); + else if (cmd == QLatin1String("register")) + handleRegisterCommand(arg); + else if (cmd == QLatin1String("unregister")) + handleUnregisterCommand(arg); + else return; - } + ++it; } m_mainWindow->raise(); m_mainWindow->activateWindow(); } +void RemoteControl::splitInputString(const QString &input, QString &cmd, + QString &arg) +{ + QString cmdLine = input.trimmed(); + int i = cmdLine.indexOf(QLatin1Char(' ')); + cmd = cmdLine.left(i); + arg = cmdLine.mid(i+1); + cmd = cmd.toLower(); +} + +void RemoteControl::handleDebugCommand(const QString &arg) +{ + m_debug = arg == QLatin1String("on"); +} + +void RemoteControl::handleShowOrHideCommand(const QString &arg, bool show) +{ + if (arg.toLower() == QLatin1String("contents")) + m_mainWindow->setContentsVisible(show); + else if (arg.toLower() == QLatin1String("index")) + m_mainWindow->setIndexVisible(show); + else if (arg.toLower() == QLatin1String("bookmarks")) + m_mainWindow->setBookmarksVisible(show); + else if (arg.toLower() == QLatin1String("search")) + m_mainWindow->setSearchVisible(show); +} + +void RemoteControl::handleSetSourceCommand(const QString &arg) +{ + QUrl url(arg); + if (url.isValid()) { + if (url.isRelative()) + url = CentralWidget::instance()->currentSource().resolved(url); + if (m_caching) { + clearCache(); + m_setSource = url; + } else { + CentralWidget::instance()->setSource(url); + } + } +} + +void RemoteControl::handleSyncContentsCommand() +{ + if (m_caching) + m_syncContents = true; + else + m_mainWindow->syncContents(); +} + +void RemoteControl::handleActivateKeywordCommand(const QString &arg) +{ + if (m_caching) { + clearCache(); + m_activateKeyword = arg; + } else { + m_mainWindow->setIndexString(arg); + if (!arg.isEmpty()) + m_helpEngine->indexWidget()->activateCurrentItem(); + } +} + +void RemoteControl::handleActivateIdentifierCommand(const QString &arg) +{ + if (m_caching) { + clearCache(); + m_activateIdentifier = arg; + } else { + const QMap<QString, QUrl> &links = + m_helpEngine->linksForIdentifier(arg); + if (!links.isEmpty()) + CentralWidget::instance()->setSource(links.constBegin().value()); + } +} + +void RemoteControl::handleExpandTocCommand(const QString &arg) +{ + bool ok = false; + int depth = -2; + if (!arg.isEmpty()) + depth = arg.toInt(&ok); + if (!ok || depth < -2) + depth = -2; + + if (m_caching) + m_expandTOC = depth; + else if (depth != -2) + m_mainWindow->expandTOC(depth); +} + +void RemoteControl::handleSetCurrentFilterCommand(const QString &arg) +{ + if (m_helpEngine->customFilters().contains(arg)) { + if (m_caching) { + clearCache(); + m_currentFilter = arg; + } else { + m_helpEngine->setCurrentFilter(arg); + } + } +} + +void RemoteControl::handleRegisterCommand(const QString &arg) +{ + const QString &absFileName = QFileInfo(arg).absoluteFilePath(); + if (m_helpEngine->registeredDocumentations(). + contains(QHelpEngineCore::namespaceName(absFileName))) + return; + if (m_helpEngine->registerDocumentation(absFileName)) { + m_qchWatcher->addPath(absFileName); + m_helpEngine->setupData(); + Q_ASSERT(m_qchWatcher->files().count() + == m_helpEngine->registeredDocumentations().count()); + } +} + +void RemoteControl::handleUnregisterCommand(const QString &arg) +{ + const QString &absFileName = QFileInfo(arg).absoluteFilePath(); + const QString &ns = QHelpEngineCore::namespaceName(absFileName); + if (m_helpEngine->registeredDocumentations().contains(ns)) { + CentralWidget* widget = CentralWidget::instance(); + widget->closeTabs(widget->currentSourceFileList().keys(ns)); + const QString docFile = m_helpEngine->documentationFileName(ns); + if (m_helpEngine->unregisterDocumentation(ns)) { + m_qchWatcher->removePath(docFile); + m_helpEngine->setupData(); + } + } +} + void RemoteControl::applyCache() { if (m_setSource.isValid()) { @@ -273,7 +340,8 @@ void RemoteControl::applyCache() if (m_syncContents) m_mainWindow->syncContents(); - if (m_expandTOC != -3) + Q_ASSERT(m_expandTOC >= -2); + if (m_expandTOC != -2) m_mainWindow->expandTOC(m_expandTOC); m_caching = false; diff --git a/tools/assistant/tools/assistant/remotecontrol.h b/tools/assistant/tools/assistant/remotecontrol.h index b888b40..adb6646 100644 --- a/tools/assistant/tools/assistant/remotecontrol.h +++ b/tools/assistant/tools/assistant/remotecontrol.h @@ -43,11 +43,13 @@ #define REMOTECONTROL_H #include <QtCore/QObject> +#include <QtCore/QString> #include <QtCore/QUrl> QT_BEGIN_NAMESPACE class MainWindow; +class QFileSystemWatcher; class QHelpEngine; class RemoteControl : public QObject @@ -55,7 +57,8 @@ class RemoteControl : public QObject Q_OBJECT public: - RemoteControl(MainWindow *mainWindow, QHelpEngine *helpEngine); + RemoteControl(MainWindow *mainWindow, QHelpEngine *helpEngine, + QFileSystemWatcher *qchWatcher); private slots: void receivedData(); @@ -64,6 +67,17 @@ private slots: private: void clearCache(); + void splitInputString(const QString &input, QString &cmd, QString &arg); + void handleDebugCommand(const QString &arg); + void handleShowOrHideCommand(const QString &arg, bool show); + void handleSetSourceCommand(const QString &arg); + void handleSyncContentsCommand(); + void handleActivateKeywordCommand(const QString &arg); + void handleActivateIdentifierCommand(const QString &arg); + void handleExpandTocCommand(const QString &arg); + void handleSetCurrentFilterCommand(const QString &arg); + void handleRegisterCommand(const QString &arg); + void handleUnregisterCommand(const QString &arg); private: MainWindow *m_mainWindow; @@ -77,6 +91,7 @@ private: QString m_activateIdentifier; int m_expandTOC; QString m_currentFilter; + QFileSystemWatcher * const m_qchWatcher; }; QT_END_NAMESPACE diff --git a/tools/assistant/compat/lib/qassistantclient_global.h b/tools/assistant/tools/assistant/tracer.h index 6b58736..1967606 100644 --- a/tools/assistant/compat/lib/qassistantclient_global.h +++ b/tools/assistant/tools/assistant/tracer.h @@ -39,25 +39,36 @@ ** ****************************************************************************/ -#ifndef QASSISTANTCLIENT_GLOBAL_H -#define QASSISTANTCLIENT_GLOBAL_H +#ifndef TRACER_H +#define TRACER_H -#include <QtCore/qglobal.h> - -QT_BEGIN_HEADER +#include <QtCore/QtGlobal> QT_BEGIN_NAMESPACE -#if defined(QT_ASSISTANT_CLIENT_STATIC) || (!defined(QT_SHARED) && !defined(QT_DLL)) -# define QT_ASSISTANT_CLIENT_EXPORT -#elif defined(QT_ASSISTANT_CLIENT_LIBRARY) -# define QT_ASSISTANT_CLIENT_EXPORT Q_DECL_EXPORT -#else -# define QT_ASSISTANT_CLIENT_EXPORT Q_DECL_IMPORT -#endif +class Tracer +{ +public: + Tracer(const char *func) : m_func(func) + { + qDebug("Entering function %s.", m_func); + } -QT_END_NAMESPACE + ~Tracer() + { + qDebug("Leaving function %s.", m_func); + } -QT_END_HEADER +private: + const char * const m_func; +}; +QT_END_NAMESPACE + +#ifdef TRACING_REQUESTED +#define TRACE_OBJ Tracer traceObj__(Q_FUNC_INFO); +#else +#define TRACE_OBJ #endif + +#endif // TRACER_H diff --git a/tools/assistant/tools/assistant/xbelsupport.cpp b/tools/assistant/tools/assistant/xbelsupport.cpp new file mode 100644 index 0000000..545be6c --- /dev/null +++ b/tools/assistant/tools/assistant/xbelsupport.cpp @@ -0,0 +1,234 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Assistant of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "xbelsupport.h" +#include "bookmarkmanager.h" + +#include <QtCore/QCoreApplication> + +struct Bookmark { + QString title; + QString url; + bool folded; +}; + +XbelWriter::XbelWriter(BookmarkModel *model) + : QXmlStreamWriter() + , treeModel(model) +{ + setAutoFormatting(true); +} + +void XbelWriter::writeToFile(QIODevice *device) +{ + setDevice(device); + + writeStartDocument(); + writeDTD(QLatin1String("<!DOCTYPE xbel>")); + writeStartElement(QLatin1String("xbel")); + writeAttribute(QLatin1String("version"), QLatin1String("1.0")); + + QStandardItem *root = treeModel->invisibleRootItem(); + for (int i = 0; i < root->rowCount(); ++i) + writeData(root->child(i)); + + writeEndDocument(); +} + +void XbelWriter::writeData(QStandardItem *child) +{ + Bookmark entry; + entry.title = child->data(Qt::DisplayRole).toString(); + entry.url = child->data(Qt::UserRole + 10).toString(); + + if (entry.url == QLatin1String("Folder")) { + writeStartElement(QLatin1String("folder")); + + entry.folded = !child->data(Qt::UserRole + 11).toBool(); + writeAttribute(QLatin1String("folded"), + entry.folded ? QLatin1String("yes") : QLatin1String("no")); + + writeTextElement(QLatin1String("title"), entry.title); + + for (int i = 0; i < child->rowCount(); ++i) + writeData(child->child(i)); + + writeEndElement(); + } else { + writeStartElement(QLatin1String("bookmark")); + writeAttribute(QLatin1String("href"), entry.url); + writeTextElement(QLatin1String("title"), entry.title); + writeEndElement(); + } +} + + +// XbelReader + + +XbelReader::XbelReader(BookmarkModel *tree, BookmarkModel *list) + : QXmlStreamReader() + , treeModel(tree) + , listModel(list) +{ + folderIcon = QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon); + bookmarkIcon = QIcon(QLatin1String(":/trolltech/assistant/images/bookmark.png")); +} + +bool XbelReader::readFromFile(QIODevice *device) +{ + setDevice(device); + + while (!atEnd()) { + readNext(); + + if (isStartElement()) { + if (name() == QLatin1String("xbel") + && attributes().value(QLatin1String("version")) + == QLatin1String("1.0")) { + readXBEL(); + } else { + raiseError(QLatin1String("The file is not an XBEL version 1.0 file.")); + } + } + } + + return !error(); +} + +void XbelReader::readXBEL() +{ + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + if (name() == QLatin1String("folder")) + readFolder(0); + else if (name() == QLatin1String("bookmark")) + readBookmark(0); + else + readUnknownElement(); + } + } +} + +void XbelReader::readUnknownElement() +{ + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) + readUnknownElement(); + } +} + +void XbelReader::readFolder(QStandardItem *item) +{ + QStandardItem *folder = createChildItem(item); + folder->setIcon(folderIcon); + folder->setData(QLatin1String("Folder"), Qt::UserRole + 10); + + bool expanded = + (attributes().value(QLatin1String("folded")) != QLatin1String("no")); + folder->setData(expanded, Qt::UserRole + 11); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + if (name() == QLatin1String("title")) + folder->setText(readElementText()); + else if (name() == QLatin1String("folder")) + readFolder(folder); + else if (name() == QLatin1String("bookmark")) + readBookmark(folder); + else + readUnknownElement(); + } + } +} + +void XbelReader::readBookmark(QStandardItem *item) +{ + QStandardItem *bookmark = createChildItem(item); + bookmark->setIcon(bookmarkIcon); + bookmark->setText(QCoreApplication::tr("Unknown title")); + bookmark->setData(attributes().value(QLatin1String("href")).toString(), + Qt::UserRole + 10); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + if (name() == QLatin1String("title")) + bookmark->setText(readElementText()); + else + readUnknownElement(); + } + } + + listModel->appendRow(bookmark->clone()); +} + +QStandardItem *XbelReader::createChildItem(QStandardItem *item) +{ + QStandardItem *childItem = new QStandardItem(); + childItem->setEditable(false); + + if (item) + item->appendRow(childItem); + else + treeModel->appendRow(childItem); + + return childItem; +} diff --git a/tools/assistant/tools/assistant/xbelsupport.h b/tools/assistant/tools/assistant/xbelsupport.h new file mode 100644 index 0000000..005cfbb --- /dev/null +++ b/tools/assistant/tools/assistant/xbelsupport.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Assistant of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef XBELSUPPORT_H +#define XBELSUPPORT_H + +#include <QtGui/QIcon> +#include <QtXml/QXmlStreamReader> + +QT_FORWARD_DECLARE_CLASS(QIODevice) +QT_FORWARD_DECLARE_CLASS(QStandardItem) + +class BookmarkModel; + +class XbelWriter : public QXmlStreamWriter +{ +public: + XbelWriter(BookmarkModel *model); + void writeToFile(QIODevice *device); + +private: + void writeData(QStandardItem *item); + +private: + BookmarkModel *treeModel; +}; + +class XbelReader : public QXmlStreamReader +{ +public: + XbelReader(BookmarkModel *tree, BookmarkModel *list); + bool readFromFile(QIODevice *device); + +private: + void readXBEL(); + void readUnknownElement(); + void readFolder(QStandardItem *item); + void readBookmark(QStandardItem *item); + QStandardItem* createChildItem(QStandardItem *item); + +private: + QIcon folderIcon; + QIcon bookmarkIcon; + + BookmarkModel *treeModel; + BookmarkModel *listModel; +}; + +#endif // XBELSUPPORT_H diff --git a/tools/assistant/tools/qcollectiongenerator/main.cpp b/tools/assistant/tools/qcollectiongenerator/main.cpp index 2339c50..d45279d 100644 --- a/tools/assistant/tools/qcollectiongenerator/main.cpp +++ b/tools/assistant/tools/qcollectiongenerator/main.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include "../shared/collectionconfiguration.h" #include "../shared/helpgenerator.h" #include <QtCore/QDir> @@ -87,6 +88,7 @@ public: QStringList filesToRegister() const { return m_filesToRegister; } QString cacheDirectory() const { return m_cacheDirectory; } + bool cacheDirRelativeToCollection() const { return m_cacheDirRelativeToCollection; } private: void raiseErrorWithLine(); @@ -115,6 +117,7 @@ private: QMap<QString, QString> m_filesToGenerate; QStringList m_filesToRegister; QString m_cacheDirectory; + bool m_cacheDirRelativeToCollection; }; void CollectionConfigReader::raiseErrorWithLine() @@ -198,6 +201,9 @@ void CollectionConfigReader::readAssistantSettings() } else if (name() == QLatin1String("aboutDialog")) { readAboutDialog(); } else if (name() == "cacheDirectory") { + m_cacheDirRelativeToCollection = + attributes().value(QLatin1String("base")) + == QLatin1String("collection"); m_cacheDirectory = readElementText(); } else { raiseErrorWithLine(); @@ -322,6 +328,14 @@ void CollectionConfigReader::readRegister() } } +namespace { + QString absoluteFileName(const QString &basePath, const QString &fileName) + { + return QFileInfo(fileName).isAbsolute() ? + fileName : basePath + QDir::separator() + fileName; + } +} + int main(int argc, char *argv[]) { QString error; @@ -403,13 +417,13 @@ int main(int argc, char *argv[]) while (it != config.filesToGenerate().constEnd()) { fprintf(stdout, "Generating help for %s...\n", qPrintable(it.key())); QHelpProjectData helpData; - if (!helpData.readData(basePath + QDir::separator() + it.key())) { + if (!helpData.readData(absoluteFileName(basePath, it.key()))) { fprintf(stderr, "%s\n", qPrintable(helpData.errorMessage())); return -1; } HelpGenerator helpGenerator; - if (!helpGenerator.generate(&helpData, basePath + QDir::separator() + it.value())) { + if (!helpGenerator.generate(&helpData, absoluteFileName(basePath, it.value()))) { fprintf(stderr, "%s\n", qPrintable(helpGenerator.error())); return -1; } @@ -433,49 +447,55 @@ int main(int argc, char *argv[]) } foreach (const QString &file, config.filesToRegister()) { - if (!helpEngine.registerDocumentation(basePath + QDir::separator() + file)) { + if (!helpEngine.registerDocumentation(absoluteFileName(basePath, file))) { fprintf(stderr, "%s\n", qPrintable(helpEngine.error())); return -1; } } if (!config.title().isEmpty()) - helpEngine.setCustomValue(QLatin1String("WindowTitle"), config.title()); + CollectionConfiguration::setWindowTitle(helpEngine, config.title()); if (!config.homePage().isEmpty()) { - helpEngine.setCustomValue(QLatin1String("defaultHomepage"), - config.homePage()); + CollectionConfiguration::setDefaultHomePage(helpEngine, + config.homePage()); } - if (!config.startPage().isEmpty()) - helpEngine.setCustomValue(QLatin1String("LastShownPages"), config.startPage()); + if (!config.startPage().isEmpty()) { + CollectionConfiguration::setLastShownPages(helpEngine, + QStringList(config.startPage())); + } - if (!config.currentFilter().isEmpty()) - helpEngine.setCustomValue(QLatin1String("CurrentFilter"), config.currentFilter()); + if (!config.currentFilter().isEmpty()) { + CollectionConfiguration::setCurrentFilter(helpEngine, + config.currentFilter()); + } - if (!config.cacheDirectory().isEmpty()) - helpEngine.setCustomValue(QLatin1String("CacheDirectory"), config.cacheDirectory()); + if (!config.cacheDirectory().isEmpty()) { + CollectionConfiguration::setCacheDir(helpEngine, config.cacheDirectory(), + config.cacheDirRelativeToCollection()); + } - helpEngine.setCustomValue(QLatin1String("EnableFilterFunctionality"), + CollectionConfiguration::setFilterFunctionalityEnabled(helpEngine, config.enableFilterFunctionality()); - helpEngine.setCustomValue(QLatin1String("HideFilterFunctionality"), - config.hideFilterFunctionality()); - helpEngine.setCustomValue(QLatin1String("EnableDocumentationManager"), + CollectionConfiguration::setFilterToolbarVisible(helpEngine, + !config.hideFilterFunctionality()); + CollectionConfiguration::setDocumentationManagerEnabled(helpEngine, config.enableDocumentationManager()); - helpEngine.setCustomValue(QLatin1String("EnableAddressBar"), + CollectionConfiguration::setAddressBarEnabled(helpEngine, config.enableAddressBar()); - helpEngine.setCustomValue(QLatin1String("HideAddressBar"), - config.hideAddressBar()); - helpEngine.setCustomValue(QLatin1String("CreationTime"), + CollectionConfiguration::setAddressBarVisible(helpEngine, + !config.hideAddressBar()); + CollectionConfiguration::setCreationTime(helpEngine, QDateTime::currentDateTime().toTime_t()); if (!config.applicationIcon().isEmpty()) { - QFile icon(basePath + QDir::separator() + config.applicationIcon()); + QFile icon(absoluteFileName(basePath, config.applicationIcon())); if (!icon.open(QIODevice::ReadOnly)) { fprintf(stderr, "Cannot open %s!\n", qPrintable(icon.fileName())); return -1; } - helpEngine.setCustomValue(QLatin1String("ApplicationIcon"), icon.readAll()); + CollectionConfiguration::setApplicationIcon(helpEngine, icon.readAll()); } if (config.aboutMenuTexts().count()) { @@ -487,16 +507,16 @@ int main(int argc, char *argv[]) s << it.value(); ++it; } - helpEngine.setCustomValue(QLatin1String("AboutMenuTexts"), ba); + CollectionConfiguration::setAboutMenuTexts(helpEngine, ba); } if (!config.aboutIcon().isEmpty()) { - QFile icon(basePath + QDir::separator() + config.aboutIcon()); + QFile icon(absoluteFileName(basePath, config.aboutIcon())); if (!icon.open(QIODevice::ReadOnly)) { fprintf(stderr, "Cannot open %s!\n", qPrintable(icon.fileName())); return -1; } - helpEngine.setCustomValue(QLatin1String("AboutIcon"), icon.readAll()); + CollectionConfiguration::setAboutIcon(helpEngine, icon.readAll()); } if (config.aboutTextFiles().count()) { @@ -512,7 +532,7 @@ int main(int argc, char *argv[]) while (it != config.aboutTextFiles().constEnd()) { s << it.key(); - QFileInfo fi(basePath + QDir::separator() + it.value()); + QFileInfo fi(absoluteFileName(basePath, it.value())); QFile f(fi.absoluteFilePath()); if (!f.open(QIODevice::ReadOnly)) { fprintf(stderr, "Cannot open %s!\n", qPrintable(f.fileName())); @@ -544,14 +564,14 @@ int main(int argc, char *argv[]) } ++it; } - helpEngine.setCustomValue(QLatin1String("AboutTexts"), ba); + CollectionConfiguration::setAboutTexts(helpEngine, ba); if (imgData.count()) { QByteArray imageData; QBuffer buffer(&imageData); buffer.open(QIODevice::WriteOnly); QDataStream out(&buffer); out << imgData; - helpEngine.setCustomValue(QLatin1String("AboutImages"), imageData); + CollectionConfiguration::setAboutImages(helpEngine, imageData); } } diff --git a/tools/assistant/tools/qcollectiongenerator/qcollectiongenerator.pro b/tools/assistant/tools/qcollectiongenerator/qcollectiongenerator.pro index cf70e48..98e6a31 100644 --- a/tools/assistant/tools/qcollectiongenerator/qcollectiongenerator.pro +++ b/tools/assistant/tools/qcollectiongenerator/qcollectiongenerator.pro @@ -1,14 +1,17 @@ -QT += xml network +QT += xml \ + network TEMPLATE = app DESTDIR = ../../../../bin TARGET = qcollectiongenerator -CONFIG += qt warn_on help console +CONFIG += qt \ + warn_on \ + help \ + console CONFIG -= app_bundle - -target.path=$$[QT_INSTALL_BINS] +target.path = $$[QT_INSTALL_BINS] INSTALLS += target - SOURCES += ../shared/helpgenerator.cpp \ - main.cpp - -HEADERS += ../shared/helpgenerator.h + main.cpp \ + ../shared/collectionconfiguration.cpp +HEADERS += ../shared/helpgenerator.h \ + ../shared/collectionconfiguration.h diff --git a/tools/assistant/tools/qhelpgenerator/main.cpp b/tools/assistant/tools/qhelpgenerator/main.cpp index 6245e33..00a0a3d 100644 --- a/tools/assistant/tools/qhelpgenerator/main.cpp +++ b/tools/assistant/tools/qhelpgenerator/main.cpp @@ -58,6 +58,7 @@ int main(int argc, char *argv[]) QString basePath; bool showHelp = false; bool showVersion = false; + bool checkLinks = false; for (int i = 1; i < argc; ++i) { arg = QString::fromLocal8Bit(argv[i]); @@ -72,6 +73,8 @@ int main(int argc, char *argv[]) showVersion = true; } else if (arg == QLatin1String("-h")) { showHelp = true; + } else if (arg == QLatin1String("-c")) { + checkLinks = true; } else { QFileInfo fi(arg); projectFile = fi.absoluteFilePath(); @@ -93,6 +96,8 @@ int main(int argc, char *argv[]) " file called <compressed-file>.\n" " If this option is not specified\n" " a default name will be used.\n" + " -c Checks whether all links in HTML files\n" + " point to files in this help project.\n" " -v Displays the version of \n" " qhelpgenerator.\n\n"); @@ -111,9 +116,11 @@ int main(int argc, char *argv[]) } if (compressedFile.isEmpty()) { - QFileInfo fi(projectFile); - compressedFile = basePath + QDir::separator() - + fi.baseName() + QLatin1String(".qch"); + if (!checkLinks) { + QFileInfo fi(projectFile); + compressedFile = basePath + QDir::separator() + + fi.baseName() + QLatin1String(".qch"); + } } else { // check if the output dir exists -- create if it doesn't QFileInfo fi(compressedFile); @@ -134,7 +141,11 @@ int main(int argc, char *argv[]) QCoreApplication app(argc, argv); HelpGenerator generator; - bool success = generator.generate(helpData, compressedFile); + bool success = true; + if (checkLinks) + success = generator.checkLinks(*helpData); + if (success && !compressedFile.isEmpty()) + success = generator.generate(helpData, compressedFile); delete helpData; if (!success) { fprintf(stderr, "%s\n", qPrintable(generator.error())); diff --git a/tools/assistant/tools/shared/collectionconfiguration.cpp b/tools/assistant/tools/shared/collectionconfiguration.cpp new file mode 100644 index 0000000..d0650e4 --- /dev/null +++ b/tools/assistant/tools/shared/collectionconfiguration.cpp @@ -0,0 +1,509 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Assistant of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "collectionconfiguration.h" + +#include <QtHelp/QHelpEngineCore> + +QT_BEGIN_NAMESPACE + +namespace { + const QString ListSeparator(QLatin1String("|")); + + const QString AboutIconKey(QLatin1String("AboutIcon")); + const QString AboutImagesKey(QLatin1String("AboutImages")); + const QString AboutMenuTextsKey(QLatin1String("AboutMenuTexts")); + const QString AboutTextsKey(QLatin1String("AboutTexts")); + const QString AppFontKey(QLatin1String("appFont")); + const QString ApplicationIconKey(QLatin1String("ApplicationIcon")); + const QString AppWritingSystemKey(QLatin1String("appWritingSystem")); + const QString BookmarksKey(QLatin1String("Bookmarks")); + const QString BrowserFontKey(QLatin1String("browserFont")); + const QString BrowserWritingSystemKey(QLatin1String("browserWritingSystem")); + const QString CacheDirKey(QLatin1String("CacheDirectory")); + const QString CacheDirRelativeToCollectionKey(QLatin1String("CacheDirRelativeToCollection")); + const QString CreationTimeKey(QLatin1String("CreationTime")); + const QString CurrentFilterKey(QLatin1String("CurrentFilter")); + const QString DefaultHomePageKey(QLatin1String("defaultHomepage")); + const QString DocUpdatePendingKey(QLatin1String("DocUpdate")); + const QString EnableAddressBarKey(QLatin1String("EnableAddressBar")); + const QString EnableDocManagerKey(QLatin1String("EnableDocumentationManager")); + const QString EnableFilterKey(QLatin1String("EnableFilterFunctionality")); + const QString FilterToolbarHiddenKey(QLatin1String("HideFilterFunctionality")); + const QString HideAddressBarKey(QLatin1String("HideAddressBar")); + const QString HomePageKey(QLatin1String("homepage")); + const QString LastPageKey(QLatin1String("LastTabPage")); + const QString LastShownPagesKey(QLatin1String("LastShownPages")); + const QString LastZoomFactorsKey(QLatin1String( +#if !defined(QT_NO_WEBKIT) + "LastPagesZoomWebView" +#else + "LastPagesZoomTextBrowser" +#endif + )); + const QString MainWindowKey(QLatin1String("MainWindow")); + const QString MainWindowGeometryKey(QLatin1String("MainWindowGeometry")); + const QString SearchWasAttachedKey(QLatin1String("SearchWasAttached")); + const QString StartOptionKey(QLatin1String("StartOption")); + const QString UnfilteredInsertedKey(QLatin1String("UnfilteredFilterInserted")); + const QString UseAppFontKey(QLatin1String("useAppFont")); + const QString UseBrowserFontKey(QLatin1String("useBrowserFont")); + const QString VersionKey(QString(QLatin1String("qtVersion%1$$$%2")). + arg(QLatin1String(QT_VERSION_STR))); + const QString WindowTitleKey(QLatin1String("WindowTitle")); +} // anonymous namespace + +const QString CollectionConfiguration::DefaultZoomFactor(QLatin1String("0.0")); + +uint CollectionConfiguration::creationTime(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(CreationTimeKey, 0).toUInt(); +} + +void CollectionConfiguration::setCreationTime(QHelpEngineCore &helpEngine, uint time) +{ + helpEngine.setCustomValue(CreationTimeKey, time); +} + +const QString CollectionConfiguration::windowTitle(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(WindowTitleKey).toString(); +} + +void CollectionConfiguration::setWindowTitle(QHelpEngineCore &helpEngine, + const QString &windowTitle) +{ + helpEngine.setCustomValue(WindowTitleKey, windowTitle); +} + + +int CollectionConfiguration::lastTabPage(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(LastPageKey, 1).toInt(); +} + +void CollectionConfiguration::setLastTabPage(QHelpEngineCore &helpEngine, int lastPage) +{ + helpEngine.setCustomValue(LastPageKey, lastPage); +} + + +const QStringList CollectionConfiguration::lastShownPages(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(LastShownPagesKey).toString(). + split(ListSeparator, QString::SkipEmptyParts); +} + +void CollectionConfiguration::setLastShownPages(QHelpEngineCore &helpEngine, + const QStringList &lastShownPages) +{ + helpEngine. + setCustomValue(LastShownPagesKey, lastShownPages.join(ListSeparator)); +} + +const QStringList CollectionConfiguration::lastZoomFactors(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(LastZoomFactorsKey).toString(). + split(ListSeparator, QString::SkipEmptyParts); +} + +void CollectionConfiguration::setLastZoomFactors(QHelpEngineCore &helpEngine, + const QStringList &lastZoomFactors) +{ + helpEngine.setCustomValue(LastZoomFactorsKey, lastZoomFactors.join(ListSeparator)); +} + +const QString CollectionConfiguration::currentFilter(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(CurrentFilterKey).toString(); +} + +void CollectionConfiguration::setCurrentFilter(QHelpEngineCore &helpEngine, + const QString ¤tFilter) +{ + helpEngine.setCustomValue(CurrentFilterKey, currentFilter); +} + +const QString CollectionConfiguration::cacheDir(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(CacheDirKey).toString(); +} + +bool CollectionConfiguration::cacheDirIsRelativeToCollection(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(CacheDirRelativeToCollectionKey).toBool(); +} + +void CollectionConfiguration::setCacheDir(QHelpEngineCore &helpEngine, + const QString &cacheDir, bool relativeToCollection) +{ + helpEngine.setCustomValue(CacheDirKey, cacheDir); + helpEngine.setCustomValue(CacheDirRelativeToCollectionKey, + relativeToCollection); +} + +bool CollectionConfiguration::filterFunctionalityEnabled(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(EnableFilterKey, true).toBool(); +} + +void CollectionConfiguration::setFilterFunctionalityEnabled(QHelpEngineCore &helpEngine, + bool enabled) +{ + helpEngine.setCustomValue(EnableFilterKey, enabled); +} + +bool CollectionConfiguration::filterToolbarVisible(const QHelpEngineCore &helpEngine) +{ + return !helpEngine.customValue(FilterToolbarHiddenKey, true).toBool(); +} + +void CollectionConfiguration::setFilterToolbarVisible(QHelpEngineCore &helpEngine, + bool visible) +{ + helpEngine.setCustomValue(FilterToolbarHiddenKey, !visible); +} + +bool CollectionConfiguration::addressBarEnabled(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(EnableAddressBarKey, true).toBool(); +} + +void CollectionConfiguration::setAddressBarEnabled(QHelpEngineCore &helpEngine, + bool enabled) +{ + helpEngine.setCustomValue(EnableAddressBarKey, enabled); +} + +bool CollectionConfiguration::addressBarVisible(const QHelpEngineCore &helpEngine) +{ + return !helpEngine.customValue(HideAddressBarKey, true).toBool(); +} + +void CollectionConfiguration::setAddressBarVisible(QHelpEngineCore &helpEngine, + bool visible) +{ + helpEngine.setCustomValue(HideAddressBarKey, !visible); +} + +bool CollectionConfiguration::documentationManagerEnabled(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(EnableDocManagerKey, true).toBool(); +} + +void CollectionConfiguration::setDocumentationManagerEnabled(QHelpEngineCore &helpEngine, + bool enabled) +{ + helpEngine.setCustomValue(EnableDocManagerKey, enabled); +} + +const QByteArray CollectionConfiguration::applicationIcon(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(ApplicationIconKey).toByteArray(); +} + +void CollectionConfiguration::setApplicationIcon(QHelpEngineCore &helpEngine, + const QByteArray &icon) +{ + helpEngine.setCustomValue(ApplicationIconKey, icon); +} + +const QByteArray CollectionConfiguration::aboutMenuTexts(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(AboutMenuTextsKey).toByteArray(); +} + +void CollectionConfiguration::setAboutMenuTexts(QHelpEngineCore &helpEngine, + const QByteArray &texts) +{ + helpEngine.setCustomValue(AboutMenuTextsKey, texts); +} + +const QByteArray CollectionConfiguration::aboutIcon(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(AboutIconKey).toByteArray(); +} + +void CollectionConfiguration::setAboutIcon(QHelpEngineCore &helpEngine, + const QByteArray &icon) +{ + helpEngine.setCustomValue(AboutIconKey, icon); +} + +const QByteArray CollectionConfiguration::aboutTexts(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(AboutTextsKey).toByteArray(); +} + +void CollectionConfiguration::setAboutTexts(QHelpEngineCore &helpEngine, + const QByteArray &texts) +{ + helpEngine.setCustomValue(AboutTextsKey, texts); +} + +const QByteArray CollectionConfiguration::aboutImages(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(AboutImagesKey).toByteArray(); +} + +void CollectionConfiguration::setAboutImages(QHelpEngineCore &helpEngine, + const QByteArray &images) +{ + helpEngine.setCustomValue(AboutImagesKey, images); +} + +const QString CollectionConfiguration::defaultHomePage(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(DefaultHomePageKey, QLatin1String("help")). + toString(); +} + +void CollectionConfiguration::setDefaultHomePage(QHelpEngineCore &helpEngine, + const QString &page) +{ + helpEngine.setCustomValue(DefaultHomePageKey, page); +} + +const QString CollectionConfiguration::homePage(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(HomePageKey).toString(); +} + +void CollectionConfiguration::setHomePage(QHelpEngineCore &helpEngine, + const QString &page) +{ + helpEngine.setCustomValue(HomePageKey, page); +} + +int CollectionConfiguration::startOption(const QHelpEngineCore &helpEngine) +{ + // TODO: After moving to helpengine wrapper, put LastPages in that header file + // and use it here as default value. + return helpEngine.customValue(StartOptionKey).toInt(); +} + +void CollectionConfiguration::setStartOption(QHelpEngineCore &helpEngine, + int option) +{ + helpEngine.setCustomValue(StartOptionKey, option); +} + +bool CollectionConfiguration::docUpdatePending(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(DocUpdatePendingKey, false).toBool(); +} + +void CollectionConfiguration::setDocUpdatePending(QHelpEngineCore &helpEngine, + bool pending) +{ + helpEngine.setCustomValue(DocUpdatePendingKey, pending); +} + +const QByteArray CollectionConfiguration::bookmarks(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(BookmarksKey).toByteArray(); +} + +void CollectionConfiguration::setBookmarks(QHelpEngineCore &helpEngine, + const QByteArray &bookmarks) +{ + helpEngine.setCustomValue(BookmarksKey, bookmarks); +} + +const QByteArray CollectionConfiguration::mainWindow(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(MainWindowKey).toByteArray(); +} + +void CollectionConfiguration::setMainWindow(QHelpEngineCore &helpEngine, + const QByteArray &mainWindow) +{ + helpEngine.setCustomValue(MainWindowKey, mainWindow); +} + +const QByteArray CollectionConfiguration::mainWindowGeometry(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(MainWindowGeometryKey).toByteArray(); +} + +void CollectionConfiguration::setMainWindowGeometry(QHelpEngineCore &helpEngine, + const QByteArray &geometry) +{ + helpEngine.setCustomValue(MainWindowGeometryKey, geometry); +} + +bool CollectionConfiguration::usesAppFont(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(UseAppFontKey).toBool(); +} + +void CollectionConfiguration::setUseAppFont(QHelpEngineCore &helpEngine, + bool useAppFont) +{ + helpEngine.setCustomValue(UseAppFontKey, useAppFont); +} + +bool CollectionConfiguration::usesBrowserFont(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(UseBrowserFontKey, false).toBool(); +} + +void CollectionConfiguration::setUseBrowserFont(QHelpEngineCore &helpEngine, + bool useBrowserFont) +{ + helpEngine.setCustomValue(UseBrowserFontKey, useBrowserFont); +} + +const QFont CollectionConfiguration::appFont(const QHelpEngineCore &helpEngine) +{ + return qVariantValue<QFont>(helpEngine.customValue(AppFontKey)); +} + +void CollectionConfiguration::setAppFont(QHelpEngineCore &helpEngine, + const QFont &font) +{ + helpEngine.setCustomValue(AppFontKey, font); +} + +QFontDatabase::WritingSystem CollectionConfiguration::appWritingSystem(const QHelpEngineCore &helpEngine) +{ + return static_cast<QFontDatabase::WritingSystem>( + helpEngine.customValue(AppWritingSystemKey).toInt()); +} + +void CollectionConfiguration::setAppWritingSystem(QHelpEngineCore &helpEngine, + QFontDatabase::WritingSystem system) +{ + helpEngine.setCustomValue(AppWritingSystemKey, system); +} + +const QFont CollectionConfiguration::browserFont(const QHelpEngineCore &helpEngine) +{ + return qVariantValue<QFont>(helpEngine.customValue(BrowserFontKey)); +} + +void CollectionConfiguration::setBrowserFont(QHelpEngineCore &helpEngine, + const QFont &font) +{ + helpEngine.setCustomValue(BrowserFontKey, font); +} + +QFontDatabase::WritingSystem CollectionConfiguration::browserWritingSystem(const QHelpEngineCore &helpEngine) +{ + return static_cast<QFontDatabase::WritingSystem>( + helpEngine.customValue(BrowserWritingSystemKey).toInt()); +} + +void CollectionConfiguration::setBrowserWritingSystem(QHelpEngineCore &helpEngine, + QFontDatabase::WritingSystem system) +{ + helpEngine.setCustomValue(BrowserWritingSystemKey, system); +} + +bool CollectionConfiguration::unfilteredInserted(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(UnfilteredInsertedKey).toInt() == 1; +} + +void CollectionConfiguration::setUnfilteredInserted(QHelpEngineCore &helpEngine) +{ + helpEngine.setCustomValue(UnfilteredInsertedKey, 1); +} + +const QStringList CollectionConfiguration::qtDocInfo(const QHelpEngineCore &helpEngine, + const QString &component) +{ + return helpEngine.customValue(VersionKey.arg(component)).toString(). + split(ListSeparator); +} + +void CollectionConfiguration::setQtDocInfo(QHelpEngineCore &helpEngine, + const QString &component, const QStringList &doc) +{ + helpEngine.setCustomValue(VersionKey.arg(component), + doc.join(ListSeparator)); +} + +bool CollectionConfiguration::searchWasAttached(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(SearchWasAttachedKey).toBool(); +} + +void CollectionConfiguration::setSearchWasAttached(QHelpEngineCore &helpEngine, + bool attached) +{ + helpEngine.setCustomValue(SearchWasAttachedKey, attached); +} + +bool CollectionConfiguration::hasFontSettings(const QHelpEngineCore &helpEngine) +{ + return helpEngine.customValue(UseAppFontKey).isValid(); +} + +bool CollectionConfiguration::isNewer(const QHelpEngineCore &newer, + const QHelpEngineCore &older) +{ + return creationTime(newer) > creationTime(older); +} + +void CollectionConfiguration::copyConfiguration(const QHelpEngineCore &source, + QHelpEngineCore &target) +{ + setCreationTime(target, creationTime(source)); + setWindowTitle(target, windowTitle(source)); + setLastShownPages(target, lastShownPages(source)); + setLastZoomFactors(target, lastZoomFactors(source)); + setCurrentFilter(target, currentFilter(source)); + setCacheDir(target, cacheDir(source), cacheDirIsRelativeToCollection(source)); + setFilterFunctionalityEnabled(target, filterFunctionalityEnabled(source)); + setFilterToolbarVisible(target, filterToolbarVisible(source)); + setAddressBarEnabled(target, addressBarEnabled(source)); + setAddressBarVisible(target, addressBarVisible(source)); + setDocumentationManagerEnabled(target, documentationManagerEnabled(source)); + setApplicationIcon(target, applicationIcon(source)); + setAboutMenuTexts(target, aboutMenuTexts(source)); + setAboutIcon(target, aboutIcon(source)); + setAboutTexts(target, aboutTexts(source)); + setAboutImages(target, aboutImages(source)); + setDefaultHomePage(target, defaultHomePage(source)); +} + +QT_END_NAMESPACE diff --git a/tools/assistant/tools/shared/collectionconfiguration.h b/tools/assistant/tools/shared/collectionconfiguration.h new file mode 100644 index 0000000..48d2803 --- /dev/null +++ b/tools/assistant/tools/shared/collectionconfiguration.h @@ -0,0 +1,198 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Assistant of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef COLLECTIONCONFIGURATION_H +#define COLLECTIONCONFIGURATION_H + +#include <QtCore/QByteArray> +#include <QtCore/QCoreApplication> +#include <QtCore/QString> +#include <QtCore/QStringList> +#include <QtGui/QFont> +#include <QtGui/QFontDatabase> + +QT_BEGIN_NAMESPACE + +class QHelpEngineCore; + +class CollectionConfiguration +{ +public: + static int lastTabPage(const QHelpEngineCore &helpEngine); + static void setLastTabPage(QHelpEngineCore &helpEngine, int lastPage); + + static const QStringList lastShownPages(const QHelpEngineCore &helpEngine); + static void setLastShownPages(QHelpEngineCore &helpEngine, + const QStringList &lastShownPages); + + + // TODO: Don't allow last pages and zoom factors to be set in isolation + // Perhaps also fill up missing elements automatically or assert. + static const QStringList lastZoomFactors(const QHelpEngineCore &helpEngine); + static void setLastZoomFactors(QHelpEngineCore &helpEngine, + const QStringList &lastZoomFactors); + + static const QString currentFilter(const QHelpEngineCore &helpEngine); + static void setCurrentFilter(QHelpEngineCore &helpEngine, + const QString ¤tFilter); + + static const QString cacheDir(const QHelpEngineCore &helpEngine); + static bool cacheDirIsRelativeToCollection(const QHelpEngineCore &helpEngine); + static void setCacheDir(QHelpEngineCore &helpEngine, + const QString &cacheDir, bool relativeToCollection); + + static bool filterFunctionalityEnabled(const QHelpEngineCore &helpEngine); + static void setFilterFunctionalityEnabled(QHelpEngineCore &helpEngine, + bool enabled); + + static bool filterToolbarVisible(const QHelpEngineCore &helpEngine); + static void setFilterToolbarVisible(QHelpEngineCore &helpEngine, + bool visible); + + static bool addressBarEnabled(const QHelpEngineCore &helpEngine); + static void setAddressBarEnabled(QHelpEngineCore &helpEngine, bool enabled); + + static bool addressBarVisible(const QHelpEngineCore &helpEngine); + static void setAddressBarVisible(QHelpEngineCore &helpEngine, bool visible); + + static uint creationTime(const QHelpEngineCore &helpEngine); + static void setCreationTime(QHelpEngineCore &helpEngine, uint time); + + static const QString windowTitle(const QHelpEngineCore &helpEngine); + static void setWindowTitle(QHelpEngineCore &helpEngine, + const QString &windowTitle); + + static bool documentationManagerEnabled(const QHelpEngineCore &helpEngine); + static void setDocumentationManagerEnabled(QHelpEngineCore &helpEngine, + bool enabled); + + static const QByteArray applicationIcon(const QHelpEngineCore &helpEngine); + static void setApplicationIcon(QHelpEngineCore &helpEngine, + const QByteArray &icon); + + static const QString homePage(const QHelpEngineCore &helpEngine); + static void setHomePage(QHelpEngineCore &helpEngine, const QString &page); + + static int startOption(const QHelpEngineCore &helpEngine); + static void setStartOption(QHelpEngineCore &helpEngine, int option); + + // TODO: Encapsulate encoding from/to QByteArray here + static const QByteArray aboutMenuTexts(const QHelpEngineCore &helpEngine); + static void setAboutMenuTexts(QHelpEngineCore &helpEngine, + const QByteArray &texts); + + static const QByteArray aboutIcon(const QHelpEngineCore &helpEngine); + static void setAboutIcon(QHelpEngineCore &helpEngine, + const QByteArray &icon); + + // TODO: Encapsulate encoding from/to QByteArray here + static const QByteArray aboutTexts(const QHelpEngineCore &helpEngine); + static void setAboutTexts(QHelpEngineCore &helpEngine, + const QByteArray &texts); + + static const QByteArray aboutImages(const QHelpEngineCore &helpEngine); + static void setAboutImages(QHelpEngineCore &helpEngine, + const QByteArray &images); + + static const QString defaultHomePage(const QHelpEngineCore &helpEngine); + static void setDefaultHomePage(QHelpEngineCore &helpEngine, + const QString &page); + + static bool docUpdatePending(const QHelpEngineCore &helpEngine); + static void setDocUpdatePending(QHelpEngineCore &helpEngine, bool pending); + + // TODO: Put these GUI-specific functions in the help engine wrapper + static const QByteArray bookmarks(const QHelpEngineCore &helpEngine); + static void setBookmarks(QHelpEngineCore &helpEngine, + const QByteArray &bookmarks); + + static const QByteArray mainWindow(const QHelpEngineCore &helpEngine); + static void setMainWindow(QHelpEngineCore &helpEngine, + const QByteArray &mainWindow); + + static const QByteArray mainWindowGeometry(const QHelpEngineCore &helpEngine); + static void setMainWindowGeometry(QHelpEngineCore &helpEngine, + const QByteArray &geometry); + + static bool usesAppFont(const QHelpEngineCore &helpEngine); + static void setUseAppFont(QHelpEngineCore &helpEngine, bool useAppFont); + + static bool usesBrowserFont(const QHelpEngineCore &helpEngine); + static void setUseBrowserFont(QHelpEngineCore &helpEngine, + bool useBrowserFont); + + static const QFont appFont(const QHelpEngineCore &helpEngine); + static void setAppFont(QHelpEngineCore &helpEngine, const QFont &font); + + static QFontDatabase::WritingSystem appWritingSystem(const QHelpEngineCore &helpEngine); + static void setAppWritingSystem(QHelpEngineCore &helpEngine, + QFontDatabase::WritingSystem system); + + static const QFont browserFont(const QHelpEngineCore &helpEngine); + static void setBrowserFont(QHelpEngineCore &helpEngine, const QFont &font); + + static QFontDatabase::WritingSystem browserWritingSystem(const QHelpEngineCore &helpEngine); + static void setBrowserWritingSystem(QHelpEngineCore &helpEngine, + QFontDatabase::WritingSystem system); + + static bool unfilteredInserted(const QHelpEngineCore &helpEngine); + static void setUnfilteredInserted(QHelpEngineCore &helpEngine); + + static const QStringList qtDocInfo(const QHelpEngineCore &helpEngine, + const QString &component); + static void setQtDocInfo(QHelpEngineCore &helpEngine, + const QString &component, const QStringList &doc); + + static bool searchWasAttached(const QHelpEngineCore &helpEngine); + static void setSearchWasAttached(QHelpEngineCore &helpEngine, bool attached); + + static bool hasFontSettings(const QHelpEngineCore &helpEngine); + static bool isNewer(const QHelpEngineCore &newer, + const QHelpEngineCore &older); + static void copyConfiguration(const QHelpEngineCore &source, + QHelpEngineCore &target); + + static const QString DefaultZoomFactor; +}; + +QT_END_NAMESPACE + +#endif // COLLECTIONCONFIGURATION_H diff --git a/tools/assistant/tools/shared/helpgenerator.cpp b/tools/assistant/tools/shared/helpgenerator.cpp index fa183cd..12008e6 100644 --- a/tools/assistant/tools/shared/helpgenerator.cpp +++ b/tools/assistant/tools/shared/helpgenerator.cpp @@ -61,6 +61,11 @@ bool HelpGenerator::generate(QHelpDataInterface *helpData, return generator->generate(helpData, outputFileName); } +bool HelpGenerator::checkLinks(const QHelpDataInterface &helpData) +{ + return generator->checkLinks(helpData); +} + QString HelpGenerator::error() const { return generator->error(); diff --git a/tools/assistant/tools/shared/helpgenerator.h b/tools/assistant/tools/shared/helpgenerator.h index 903d588..6da1c2b 100644 --- a/tools/assistant/tools/shared/helpgenerator.h +++ b/tools/assistant/tools/shared/helpgenerator.h @@ -57,6 +57,7 @@ public: HelpGenerator(); bool generate(QHelpDataInterface *helpData, const QString &outputFileName); + bool checkLinks(const QHelpDataInterface &helpData); QString error() const; private slots: diff --git a/tools/assistant/translations/translations_adp.pro b/tools/assistant/translations/translations_adp.pro deleted file mode 100644 index f8da2e3..0000000 --- a/tools/assistant/translations/translations_adp.pro +++ /dev/null @@ -1,41 +0,0 @@ -# Include those manually as they do not contain any directory specification - -FORMS += ../compat/helpdialog.ui \ - ../compat/mainwindow.ui \ - ../compat/tabbedbrowser.ui \ - ../compat/topicchooser.ui - -SOURCES += ../compat/main.cpp \ - ../compat/helpwindow.cpp \ - ../compat/topicchooser.cpp \ - ../compat/docuparser.cpp \ - ../compat/index.cpp \ - ../compat/profile.cpp \ - ../compat/config.cpp \ - ../compat/helpdialog.cpp \ - ../compat/mainwindow.cpp \ - ../compat/tabbedbrowser.cpp \ - ../compat/fontsettingsdialog.cpp - -SOURCES += ../../shared/fontpanel/fontpanel.cpp - -HEADERS += ../compat/helpwindow.h \ - ../compat/topicchooser.h \ - ../compat/docuparser.h \ - ../compat/index.h \ - ../compat/profile.h \ - ../compat/helpdialog.h \ - ../compat/mainwindow.h \ - ../compat/tabbedbrowser.h \ - ../compat/config.h \ - ../compat/fontsettingsdialog.h - - -TR_DIR = $$PWD/../../../translations -TRANSLATIONS = \ - $$TR_DIR/assistant_adp_de.ts \ - $$TR_DIR/assistant_adp_ja.ts \ - $$TR_DIR/assistant_adp_pl.ts \ - $$TR_DIR/assistant_adp_ru.ts \ - $$TR_DIR/assistant_adp_zh_CN.ts \ - $$TR_DIR/assistant_adp_zh_TW.ts diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 919e68f..3defeab 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1860,8 +1860,16 @@ bool Configure::findFile( const QString &fileName ) QString paths; if (file.endsWith(".h")) { - if (!mingwPath.isNull() && !findFileInPaths(file, mingwPath + QLatin1String("/../include")).isNull()) - return true; + if (!mingwPath.isNull()) { + if (!findFileInPaths(file, mingwPath + QLatin1String("/../include")).isNull()) + return true; + //now let's try the additional compiler path + QDir mingwLibDir = mingwPath + QLatin1String("/../lib/gcc/mingw32"); + foreach(const QFileInfo &version, mingwLibDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) { + if (!findFileInPaths(file, version.absoluteFilePath() + QLatin1String("/include")).isNull()) + return true; + } + } paths = QString::fromLocal8Bit(getenv("INCLUDE")); } else if ( file.endsWith( ".lib" ) || file.endsWith( ".a" ) ) { if (!mingwPath.isNull() && !findFileInPaths(file, mingwPath + QLatin1String("/../lib")).isNull()) @@ -1998,11 +2006,11 @@ bool Configure::checkAvailability(const QString &part) else if (part == "DIRECTSHOW") available = (dictionary[ "ARCHITECTURE" ] == "windowsce"); else if (part == "SSE2") - available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-g++"); + available = (dictionary.value("QMAKESPEC") != "win32-msvc"); else if (part == "3DNOW" ) - available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-icc") && findFile("mm3dnow.h") && (dictionary.value("QMAKESPEC") != "win32-g++"); + available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-icc") && findFile("mm3dnow.h"); else if (part == "MMX" || part == "SSE") - available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-g++"); + available = (dictionary.value("QMAKESPEC") != "win32-msvc"); else if (part == "OPENSSL") available = findFile("openssl\\ssl.h"); else if (part == "DBUS") diff --git a/tools/designer/src/components/widgetbox/widgetboxcategorylistview.cpp b/tools/designer/src/components/widgetbox/widgetboxcategorylistview.cpp index 674c3a8..1a8611c 100644 --- a/tools/designer/src/components/widgetbox/widgetboxcategorylistview.cpp +++ b/tools/designer/src/components/widgetbox/widgetboxcategorylistview.cpp @@ -88,11 +88,15 @@ namespace qdesigner_internal { struct WidgetBoxCategoryEntry { WidgetBoxCategoryEntry(); - explicit WidgetBoxCategoryEntry(const QDesignerWidgetBoxInterface::Widget &widget, const QIcon &icon, bool editable); + explicit WidgetBoxCategoryEntry(const QDesignerWidgetBoxInterface::Widget &widget, + const QString &filter, + const QIcon &icon, + bool editable); QDesignerWidgetBoxInterface::Widget widget; QString toolTip; QString whatsThis; + QString filter; QIcon icon; bool editable; }; @@ -103,8 +107,11 @@ WidgetBoxCategoryEntry::WidgetBoxCategoryEntry() : { } -WidgetBoxCategoryEntry::WidgetBoxCategoryEntry(const QDesignerWidgetBoxInterface::Widget &w, const QIcon &i, bool e) : +WidgetBoxCategoryEntry::WidgetBoxCategoryEntry(const QDesignerWidgetBoxInterface::Widget &w, + const QString &filterIn, + const QIcon &i, bool e) : widget(w), + filter(filterIn), icon(i), editable(e) { @@ -142,6 +149,7 @@ public: private: typedef QList<WidgetBoxCategoryEntry> WidgetBoxCategoryEntrys; + QRegExp m_classNameRegExp; QDesignerFormEditorInterface *m_core; WidgetBoxCategoryEntrys m_items; QListView::ViewMode m_viewMode; @@ -149,9 +157,11 @@ private: WidgetBoxCategoryModel::WidgetBoxCategoryModel(QDesignerFormEditorInterface *core, QObject *parent) : QAbstractListModel(parent), + m_classNameRegExp(QLatin1String("<widget +class *= *\"([^\"]+)\"")), m_core(core), m_viewMode(QListView::ListMode) { + Q_ASSERT(m_classNameRegExp.isValid()); } QListView::ViewMode WidgetBoxCategoryModel::viewMode() const @@ -205,8 +215,14 @@ bool WidgetBoxCategoryModel::removeCustomWidgets() void WidgetBoxCategoryModel::addWidget(const QDesignerWidgetBoxInterface::Widget &widget, const QIcon &icon,bool editable) { - // build item - WidgetBoxCategoryEntry item(widget, icon, editable); + // build item. Filter on name + class name if it is different and not a layout. + QString filter = widget.name(); + if (!filter.contains(QLatin1String("Layout")) && m_classNameRegExp.indexIn(widget.domXml()) != -1) { + const QString className = m_classNameRegExp.cap(1); + if (!filter.contains(className)) + filter += className; + } + WidgetBoxCategoryEntry item(widget, filter, icon, editable); const QDesignerWidgetDataBaseInterface *db = m_core->widgetDataBase(); const int dbIndex = db->indexOfClassName(widget.name()); if (dbIndex != -1) { @@ -255,7 +271,7 @@ QVariant WidgetBoxCategoryModel::data(const QModelIndex &index, int role) const case Qt::WhatsThisRole: return QVariant(item.whatsThis); case FilterRole: - return item.widget.name(); + return item.filter; } return QVariant(); } diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 2129265..5b4edf1 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -84,7 +84,7 @@ static void printUsage() printOut(QObject::tr( "Usage:\n" " lupdate [options] [project-file]...\n" - " lupdate [options] [source-file|path]... -ts ts-files\n\n" + " lupdate [options] [source-file|path|@lst-file]... -ts ts-files|@lst-file\n\n" "lupdate is part of Qt's Linguist tool chain. It extracts translatable\n" "messages from Qt UI files, C++, Java and JavaScript/QtScript source code.\n" "Extracted messages are stored in textual translation source files (typically\n" @@ -128,6 +128,8 @@ static void printUsage() " Guessed from the file name if not specified.\n" " -version\n" " Display the version of lupdate and exit.\n" + " @lst-file\n" + " Read additional file names (one per line) from lst-file.\n" ).arg(m_defaultExtensions)); } @@ -368,76 +370,94 @@ int main(int argc, char **argv) } numFiles++; + QStringList files; + if (arg.startsWith(QLatin1String("@"))) { + QFile lstFile(arg.mid(1)); + if (!lstFile.open(QIODevice::ReadOnly)) { + qWarning("lupdate error: List file '%s' is not readable", + qPrintable(lstFile.fileName())); + return 1; + } + while (!lstFile.atEnd()) + files << QString::fromLocal8Bit(lstFile.readLine().trimmed()); + } else { + files << arg; + } codecForTr.clear(); codecForSource.clear(); if (metTsFlag) { - bool found = false; - foreach (const Translator::FileFormat &fmt, Translator::registeredFileFormats()) { - if (arg.endsWith(QLatin1Char('.') + fmt.extension, Qt::CaseInsensitive)) { - QFileInfo fi(arg); - if (!fi.exists() || fi.isWritable()) { - tsFileNames.append(QFileInfo(arg).absoluteFilePath()); - } else { - qWarning("lupdate warning: For some reason, '%s' is not writable.\n", - qPrintable(arg)); + foreach (const QString &file, files) { + bool found = false; + foreach (const Translator::FileFormat &fmt, Translator::registeredFileFormats()) { + if (file.endsWith(QLatin1Char('.') + fmt.extension, Qt::CaseInsensitive)) { + QFileInfo fi(file); + if (!fi.exists() || fi.isWritable()) { + tsFileNames.append(QFileInfo(file).absoluteFilePath()); + } else { + qWarning("lupdate warning: For some reason, '%s' is not writable.\n", + qPrintable(file)); + } + found = true; + break; } - found = true; - break; + } + if (!found) { + qWarning("lupdate error: File '%s' has no recognized extension\n", + qPrintable(file)); + return 1; } } - if (!found) { - qWarning("lupdate error: File '%s' has no recognized extension\n", - qPrintable(arg)); - return 1; - } - } else if (arg.endsWith(QLatin1String(".pro"), Qt::CaseInsensitive) - || arg.endsWith(QLatin1String(".pri"), Qt::CaseInsensitive)) { - proFiles << arg; } else { - QFileInfo fi(arg); - if (!fi.exists()) { - qWarning("lupdate error: File '%s' does not exists\n", qPrintable(arg)); - return 1; - } else if (fi.isDir()) { - if (options & Verbose) - printOut(QObject::tr("Scanning directory '%1'...").arg(arg)); - QDir dir = QDir(fi.filePath()); - projectRoots.insert(dir.absolutePath() + QLatin1Char('/')); - if (extensionsNameFilters.isEmpty()) { - foreach (QString ext, extensions.split(QLatin1Char(','))) { - ext = ext.trimmed(); - if (ext.startsWith(QLatin1Char('.'))) - ext.remove(0, 1); - extensionsNameFilters.insert(ext); - } + foreach (const QString &file, files) { + QFileInfo fi(file); + if (!fi.exists()) { + qWarning("lupdate error: File '%s' does not exists\n", qPrintable(file)); + return 1; } - QDir::Filters filters = QDir::Files | QDir::NoSymLinks; - if (recursiveScan) - filters |= QDir::AllDirs | QDir::NoDotAndDotDot; - QFileInfoList fileinfolist; - recursiveFileInfoList(dir, extensionsNameFilters, filters, &fileinfolist); - int scanRootLen = dir.absolutePath().length(); - foreach (const QFileInfo &fi, fileinfolist) { - QString fn = QDir::cleanPath(fi.absoluteFilePath()); - sourceFiles << fn; - - if (!fn.endsWith(QLatin1String(".java")) - && !fn.endsWith(QLatin1String(".ui")) - && !fn.endsWith(QLatin1String(".js")) - && !fn.endsWith(QLatin1String(".qs"))) { - int offset = 0; - int depth = 0; - do { - offset = fn.lastIndexOf(QLatin1Char('/'), offset - 1); - QString ffn = fn.mid(offset + 1); - allCSources.insert(ffn, fn); - } while (++depth < 3 && offset > scanRootLen); + if (file.endsWith(QLatin1String(".pro"), Qt::CaseInsensitive) + || file.endsWith(QLatin1String(".pri"), Qt::CaseInsensitive)) { + proFiles << file; + } else if (fi.isDir()) { + if (options & Verbose) + printOut(QObject::tr("Scanning directory '%1'...").arg(file)); + QDir dir = QDir(fi.filePath()); + projectRoots.insert(dir.absolutePath() + QLatin1Char('/')); + if (extensionsNameFilters.isEmpty()) { + foreach (QString ext, extensions.split(QLatin1Char(','))) { + ext = ext.trimmed(); + if (ext.startsWith(QLatin1Char('.'))) + ext.remove(0, 1); + extensionsNameFilters.insert(ext); + } + } + QDir::Filters filters = QDir::Files | QDir::NoSymLinks; + if (recursiveScan) + filters |= QDir::AllDirs | QDir::NoDotAndDotDot; + QFileInfoList fileinfolist; + recursiveFileInfoList(dir, extensionsNameFilters, filters, &fileinfolist); + int scanRootLen = dir.absolutePath().length(); + foreach (const QFileInfo &fi, fileinfolist) { + QString fn = QDir::cleanPath(fi.absoluteFilePath()); + sourceFiles << fn; + + if (!fn.endsWith(QLatin1String(".java")) + && !fn.endsWith(QLatin1String(".ui")) + && !fn.endsWith(QLatin1String(".js")) + && !fn.endsWith(QLatin1String(".qs"))) { + int offset = 0; + int depth = 0; + do { + offset = fn.lastIndexOf(QLatin1Char('/'), offset - 1); + QString ffn = fn.mid(offset + 1); + allCSources.insert(ffn, fn); + } while (++depth < 3 && offset > scanRootLen); + } } + } else { + sourceFiles << QDir::cleanPath(fi.absoluteFilePath());; } - } else { - sourceFiles << QDir::cleanPath(fi.absoluteFilePath());; } } } // for args diff --git a/tools/porting/src/q3porting.xml b/tools/porting/src/q3porting.xml index 7a31d6e..39f341f 100644 --- a/tools/porting/src/q3porting.xml +++ b/tools/porting/src/q3porting.xml @@ -1626,10 +1626,6 @@ <Name>Q3Wizard</Name> </item> <item Type="Qt4Class" > - <Library>QtAssistant</Library> - <Name>QAssistantClient</Name> - </item> - <item Type="Qt4Class" > <Library>QtCore</Library> <Name>QAbstractEventDispatcher</Name> </item> diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 6c33054..2df7133 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -881,6 +881,7 @@ QString CppCodeMarker::addMarkUp(const QString& protectedCode, static QRegExp globalX("[\n{()=] *([a-zA-Z_][a-zA-Z_0-9]*)[ \n]*\\("); static QRegExp multiLineComment("/(?:( )?\\*(?:[^*]+|\\*(?! /))*\\*\\1/)"); multiLineComment.setMinimal(true); + static QRegExp singleLineCommentLine("(?:^|\n)(?:[^&]|&(?!quot;)|"(?:[^&\\\\]|&(?!quot;)|\\\\"|\\\\(?!"))*")*//(?!!)[^!\n]*"); static QRegExp singleLineComment("//(?!!)[^!\n]*"); static QRegExp preprocessor("(?:^|\n)(#[ \t]*(?:include|if|elif|endif|error|pragma|define" "|warning)(?:(?:\\\\\n|\\n#)[^\n]*)*)"); @@ -1056,7 +1057,8 @@ QString CppCodeMarker::addMarkUp(const QString& protectedCode, int mlpos; int slpos; int len; - slpos = singleLineComment.indexIn(result, pos); + int sllpos = singleLineCommentLine.indexIn(result, pos); + slpos = sllpos == -1 ? -1 : singleLineComment.indexIn(result, sllpos); mlpos = multiLineComment.indexIn(result, pos); if (slpos == -1 && mlpos == -1) diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index 38da552..63455f1 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -6,18 +6,18 @@ include(qt-defines.qdocconf) project = Qt Assistant description = Qt Assistant Manual -url = http://qt.nokia.com/doc/4.6 +url = http://qt.nokia.com/doc/4.7 indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Assistant qhp.Assistant.file = assistant.qhp -qhp.Assistant.namespace = com.trolltech.assistant.460 +qhp.Assistant.namespace = com.trolltech.assistant.470 qhp.Assistant.virtualFolder = qdoc qhp.Assistant.indexTitle = Qt Assistant Manual qhp.Assistant.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Assistant.filterAttributes = qt 4.6.2 tools assistant +qhp.Assistant.filterAttributes = qt 4.7.0 tools assistant qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual qhp.Assistant.customFilters.Assistant.filterAttributes = qt tools assistant qhp.Assistant.subprojects = manual examples diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf index 57d21a9..b0c88f1 100644 --- a/tools/qdoc3/test/designer.qdocconf +++ b/tools/qdoc3/test/designer.qdocconf @@ -6,18 +6,18 @@ include(qt-defines.qdocconf) project = Qt Designer description = Qt Designer Manual -url = http://qt.nokia.com/doc/4.6 +url = http://qt.nokia.com/doc/4.7 indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Designer qhp.Designer.file = designer.qhp -qhp.Designer.namespace = com.trolltech.designer.460 +qhp.Designer.namespace = com.trolltech.designer.470 qhp.Designer.virtualFolder = qdoc qhp.Designer.indexTitle = Qt Designer Manual qhp.Designer.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Designer.filterAttributes = qt 4.6.2 tools designer +qhp.Designer.filterAttributes = qt 4.7.0 tools designer qhp.Designer.customFilters.Designer.name = Qt Designer Manual qhp.Designer.customFilters.Designer.filterAttributes = qt tools designer qhp.Designer.subprojects = manual examples diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf index 5860b33..6acd2c6 100644 --- a/tools/qdoc3/test/linguist.qdocconf +++ b/tools/qdoc3/test/linguist.qdocconf @@ -6,18 +6,18 @@ include(qt-defines.qdocconf) project = Qt Linguist description = Qt Linguist Manual -url = http://qt.nokia.com/doc/4.6 +url = http://qt.nokia.com/doc/4.7 indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Linguist qhp.Linguist.file = linguist.qhp -qhp.Linguist.namespace = com.trolltech.linguist.460 +qhp.Linguist.namespace = com.trolltech.linguist.470 qhp.Linguist.virtualFolder = qdoc qhp.Linguist.indexTitle = Qt Linguist Manual qhp.Linguist.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Linguist.filterAttributes = qt 4.6.2 tools linguist +qhp.Linguist.filterAttributes = qt 4.7.0 tools linguist qhp.Linguist.customFilters.Linguist.name = Qt Linguist Manual qhp.Linguist.customFilters.Linguist.filterAttributes = qt tools linguist qhp.Linguist.subprojects = manual examples diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf index 0e7d960..76e7012 100644 --- a/tools/qdoc3/test/qmake.qdocconf +++ b/tools/qdoc3/test/qmake.qdocconf @@ -6,18 +6,18 @@ include(qt-defines.qdocconf) project = QMake description = QMake Manual -url = http://qt.nokia.com/doc/4.6 +url = http://qt.nokia.com/doc/4.7 indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = qmake qhp.qmake.file = qmake.qhp -qhp.qmake.namespace = com.trolltech.qmake.460 +qhp.qmake.namespace = com.trolltech.qmake.470 qhp.qmake.virtualFolder = qdoc qhp.qmake.indexTitle = QMake Manual qhp.qmake.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.qmake.filterAttributes = qt 4.6.2 tools qmake +qhp.qmake.filterAttributes = qt 4.7.0 tools qmake qhp.qmake.customFilters.qmake.name = qmake Manual qhp.qmake.customFilters.qmake.filterAttributes = qt tools qmake qhp.qmake.subprojects = manual diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index def4e67..ef4d04f 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -6,19 +6,19 @@ include(qt-defines.qdocconf) project = Qt description = Qt Reference Documentation -url = http://qt.nokia.com/doc/4.6 +url = http://qt.nokia.com/doc/4.7 -edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript QtScriptTools QtSql QtSvg \ - QtWebKit QtXml QtXmlPatterns Qt3Support QtHelp \ - QtDesigner QtAssistant QAxContainer Phonon \ - QAxServer QtUiTools QtTest QtDBus +edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript QtScriptTools QtSql \ + QtSvg QtWebKit QtXml QtXmlPatterns Qt3Support QtHelp \ + QtDesigner QAxContainer Phonon QAxServer QtUiTools \ + QtTest QtDBus edition.DesktopLight.modules = QtCore QtDBus QtGui Qt3SupportLight QtTest edition.DesktopLight.groups = -graphicsview-api qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.460 +qhp.Qt.namespace = com.trolltech.qt.470 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = @@ -32,9 +32,9 @@ qhp.Qt.extraFiles = classic.css \ images/dynamiclayouts-example.png \ images/stylesheet-coffee-plastique.png -qhp.Qt.filterAttributes = qt 4.6.2 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.6.2 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.2 +qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.0 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index 1aefa98..a066021 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -8,11 +8,11 @@ project = Qt versionsym = version = %VERSION% description = Qt Reference Documentation -url = http://qt.nokia.com/doc/4.6 +url = http://qt.nokia.com/doc/4.7 -edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript QtScriptTools QtSql QtSvg \ - QtWebKit QtXml QtXmlPatterns Qt3Support QtHelp \ - QtDesigner QtAssistant QAxContainer Phonon \ +edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript \ + QtScriptTools QtSql QtSvg QtWebKit QtXml QtXmlPatterns \ + Qt3Support QtHelp QtDesigner QAxContainer Phonon \ QAxServer QtUiTools QtTest QtDBus edition.DesktopLight.modules = QtCore QtDBus QtGui Qt3SupportLight QtTest edition.DesktopLight.groups = -graphicsview-api @@ -20,7 +20,7 @@ edition.DesktopLight.groups = -graphicsview-api qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.460 +qhp.Qt.namespace = com.trolltech.qt.470 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = @@ -34,9 +34,9 @@ qhp.Qt.extraFiles = classic.css \ images/dynamiclayouts-example.png \ images/stylesheet-coffee-plastique.png -qhp.Qt.filterAttributes = qt 4.6.2 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.6.2 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.2 +qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.0 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes diff --git a/tools/shared/fontpanel/fontpanel.cpp b/tools/shared/fontpanel/fontpanel.cpp index 0b6f394..063c98a 100644 --- a/tools/shared/fontpanel/fontpanel.cpp +++ b/tools/shared/fontpanel/fontpanel.cpp @@ -96,8 +96,12 @@ QFont FontPanel::selectedFont() const const QString family = rc.family(); rc.setPointSize(pointSize()); const QString styleDescription = styleString(); - rc.setItalic(m_fontDatabase.italic(family, styleDescription)); - + if (styleDescription.contains(QLatin1String("Italic"))) + rc.setStyle(QFont::StyleItalic); + else if (styleDescription.contains(QLatin1String("Oblique"))) + rc.setStyle(QFont::StyleOblique); + else + rc.setStyle(QFont::StyleNormal); rc.setBold(m_fontDatabase.bold(family, styleDescription)); // Weight < 0 asserts... diff --git a/translations/assistant_adp_de.ts b/translations/assistant_adp_de.ts deleted file mode 100644 index 79c9c76..0000000 --- a/translations/assistant_adp_de.ts +++ /dev/null @@ -1,973 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0" language="de"> -<context> - <name>AssistantServer</name> - <message> - <location filename="../tools/assistant/compat/main.cpp" line="+225"/> - <source>Qt Assistant</source> - <translation>Qt Assistant</translation> - </message> - <message> - <location line="+1"/> - <source>Failed to bind to port %1</source> - <translation>Kann Port %1 nicht binden</translation> - </message> -</context> -<context> - <name>FontPanel</name> - <message> - <location filename="../tools/shared/fontpanel/fontpanel.cpp" line="+63"/> - <source>Font</source> - <translation>Schrift</translation> - </message> - <message> - <location line="+11"/> - <source>&Writing system</source> - <translation>S&kript</translation> - </message> - <message> - <location line="+3"/> - <source>&Family</source> - <translation>&Schriftart</translation> - </message> - <message> - <location line="+4"/> - <source>&Style</source> - <translation>S&chriftschnitt</translation> - </message> - <message> - <location line="+4"/> - <source>&Point size</source> - <translation>Schriftg&rad</translation> - </message> -</context> -<context> - <name>FontSettingsDialog</name> - <message> - <location filename="../tools/assistant/compat/fontsettingsdialog.cpp" line="+63"/> - <source>Font Settings</source> - <translation>Schriftart</translation> - </message> - <message> - <location line="+7"/> - <source>Font settings for:</source> - <translation>Schriftart für:</translation> - </message> - <message> - <location line="+4"/> - <source>Browser</source> - <translation>Hilfeseiten</translation> - </message> - <message> - <location line="+1"/> - <source>Application</source> - <translation>Anwendung</translation> - </message> - <message> - <location line="+6"/> - <source>Use custom settings</source> - <translation>Erweitere Einstellungen nutzen</translation> - </message> -</context> -<context> - <name>HelpDialog</name> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui"/> - <source>Con&tents</source> - <translation>Inhal&t</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="+376"/> - <location line="+16"/> - <location line="+661"/> - <source>Qt Assistant</source> - <translation>Qt Assistant</translation> - </message> - <message> - <location line="-771"/> - <source>Open Link in New Window</source> - <translation>Öffne Link in neuem Fenster</translation> - </message> - <message> - <location line="+76"/> - <location line="+82"/> - <source>Prepare...</source> - <translation>Initialisiere...</translation> - </message> - <message> - <location line="-47"/> - <source>Cannot open the index file %1</source> - <translation>Kann Indexdatei %1 nicht öffnen</translation> - </message> - <message> - <location line="+58"/> - <location line="+124"/> - <location line="+8"/> - <source>Warning</source> - <translation>Warnung</translation> - </message> - <message> - <location line="-131"/> - <location line="+124"/> - <source>Documentation file %1 does not exist! -Skipping file.</source> - <translation>Dokumentation %1 existiert nicht! -Überspringe Datei.</translation> - </message> - <message> - <location line="-112"/> - <location line="+133"/> - <source>Parse Error</source> - <translation>Syntaxfehler</translation> - </message> - <message> - <location line="+35"/> - <location line="+469"/> - <source>Done</source> - <translation>Fertig</translation> - </message> - <message> - <location line="-18"/> - <source>Indexing files...</source> - <translation>Indiziere Dokumentation...</translation> - </message> - <message> - <location line="+15"/> - <source>Reading dictionary...</source> - <translation>Lese Suchindex...</translation> - </message> - <message> - <location line="+46"/> - <location line="+9"/> - <source>Full Text Search</source> - <translation>Volltextsuche</translation> - </message> - <message> - <location line="-8"/> - <source>Using a wildcard within phrases is not allowed.</source> - <translation>Wildcards innerhalb von Phrasen sind nicht zugelassen.</translation> - </message> - <message> - <location line="+9"/> - <source>The closing quotation mark is missing.</source> - <translation>Das schließende Anführungszeichen fehlt.</translation> - </message> - <message numerus="yes"> - <location line="+7"/> - <source>%n document(s) found.</source> - <translation> - <numerusform>%n Dokumente gefunden.</numerusform> - <numerusform></numerusform> - </translation> - </message> - <message> - <location line="-882"/> - <source>Open Link in Current Tab</source> - <translation>Link im Aktuellen Tab öffnen</translation> - </message> - <message> - <location line="+6"/> - <source>Open Link in New Tab</source> - <translation>Link in einem neuen Tab öffnen</translation> - </message> - <message> - <location line="+91"/> - <source>Failed to load keyword index file -Assistant will not work!</source> - <translation>Die Indexdatei konnte nicht geladen werden. -Der Assistent ist nicht einsatzbereit!</translation> - </message> - <message> - <location line="+208"/> - <source>Documentation file %1 is not compatible! -Skipping file.</source> - <translation>Dokumentation %1 ist nicht kompatibel! Datei wird übersprungen.</translation> - </message> - <message> - <location line="+470"/> - <source>Failed to save fulltext search index -Assistant will not work!</source> - <translation>Der Index für die Volltextsuche konnte nicht gespeichert werden. -Assistent ist nicht einsatzbereit!</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui"/> - <source>Help</source> - <translation>Hilfe</translation> - </message> - <message> - <location/> - <source><b>Help</b><p>Choose the topic you want help on from the contents list, or search the index for keywords.</p></source> - <translation><b>Hilfe</b><p>Wählen Sie ein Hilfethema aus dem Inhalt oder suchen Sie im Index nach Schlüsselwörtern.</p></translation> - </message> - <message> - <location/> - <source>Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.</source> - <translation>Zeigt Hilfethemen geordnet nach Kategorie, Index oder Lesezeichen an. Ein weiterer Abschnitt enthält die Volltextsuche.</translation> - </message> - <message> - <location/> - <source><b>Help topics organized by category.</b><p>Double-click an item to see the topics in that category. To view a topic, just double-click it.</p></source> - <translation><b>Hilfethemen geordnet nach Kategorie.</b><p>Doppelklicken Sie einen Eintrag, um die Themen dieser Kategorie zu sehen. Doppelklicken Sie ein Thema, um es angezeigt zu bekommen.</p></translation> - </message> - <message> - <location/> - <source>column 1</source> - <translation>Spalte 1</translation> - </message> - <message> - <location/> - <source>&Index</source> - <translation>&Index</translation> - </message> - <message> - <location/> - <source>&Look For:</source> - <translation>Suchen &nach:</translation> - </message> - <message> - <location/> - <source>Enter keyword</source> - <translation>Geben Sie ein Schlüsselwort ein</translation> - </message> - <message> - <location/> - <source><b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p></source> - <translation><b>Geben Sie ein Schlüsselwort ein.</b><p>Es wird dann der Eintrag aus der Liste ausgewählt, der am besten mit dem eingegebenen Begriff übereinstimmt.</p></translation> - </message> - <message> - <location/> - <source><b>List of available help topics.</b><p>Double-click on an item to open its help page. If more than one is found, you must specify which page you want.</p></source> - <translation><b>Liste aller verfügbaren Hilfethemen.</b><p>Doppelklicken Sie auf einen Eintrag, um die Hilfe zu öffnen. Wenn mehr als eine Seite gefunden wurde, wählen Sie die gewünschte Seite aus.</p></translation> - </message> - <message> - <location/> - <source>&Bookmarks</source> - <translation>L&esezeichen</translation> - </message> - <message> - <location/> - <source>Displays the list of bookmarks.</source> - <translation>Zeigt alle Lesezeichen an.</translation> - </message> - <message> - <location/> - <source>Add new bookmark</source> - <translation>Füge neues Lesezeichen hinzu</translation> - </message> - <message> - <location/> - <source>Add the currently displayed page as a new bookmark.</source> - <translation>Füge aktuelle Seite zu den Lesezeichen hinzu.</translation> - </message> - <message> - <location/> - <source>&New</source> - <translation>&Neu</translation> - </message> - <message> - <location/> - <source>Delete bookmark</source> - <translation>Lösche Lesezeichen</translation> - </message> - <message> - <location/> - <source>Delete the selected bookmark.</source> - <translation>Lösche markiertes Lesezeichen.</translation> - </message> - <message> - <location/> - <source>&Delete</source> - <translation>&Löschen</translation> - </message> - <message> - <location/> - <source>&Search</source> - <translation>&Suche</translation> - </message> - <message> - <location/> - <source>Searching f&or:</source> - <translation>Suche &nach:</translation> - </message> - <message> - <location/> - <source><b>Enter search word(s).</b><p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.</p></source> - <translation><b>Geben Sie Suchbegriffe ein.</b><p>Geben Sie hier die gesuchten Begriffe ein. Die Begriffe können Wildcards (*) enthalten. Eine Phrase muß in Anführungszeichen stehen.</p></translation> - </message> - <message> - <location/> - <source><b>Found documents</b><p>This list contains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p></source> - <translation><b>Gefundene Dokumente</b><p>Diese Liste beinhaltet alle gefundenen Dokumente der letzten Suche. Die Dokumente sind nach der Häufigkeit der Treffer geordnet.</p></translation> - </message> - <message> - <location/> - <source>Found &Documents:</source> - <translation>Gefundene &Dokumente:</translation> - </message> - <message> - <location/> - <source>Display the help page for the full text search.</source> - <translation>Zeigt die Hilfeseite für die Volltextsuche an.</translation> - </message> - <message> - <location/> - <source>He&lp</source> - <translation>Hi&lfe</translation> - </message> - <message> - <location/> - <source>Pressing this button starts the search.</source> - <translation>Startet die Suche.</translation> - </message> - <message> - <location/> - <source>Preparing...</source> - <translation>Initialisiere...</translation> - </message> - <message> - <location/> - <source>Enter searchword(s)</source> - <translation>Geben Sie Suchbegriffe ein</translation> - </message> - <message> - <location/> - <source>Display the help page</source> - <translation>Hilfeseite anzeigen</translation> - </message> - <message> - <location/> - <source>Start searching</source> - <translation>Suche beginnen</translation> - </message> -</context> -<context> - <name>HelpWindow</name> - <message> - <location filename="../tools/assistant/compat/helpwindow.cpp" line="+97"/> - <source>Help</source> - <translation>Hilfe</translation> - </message> - <message> - <location line="+93"/> - <source>Open Link in New Window Shift+LMB</source> - <translation>Öffne Link in neuem Fenster</translation> - </message> - <message> - <location line="-2"/> - <source>Open Link in New Tab</source> - <translation>Link in einem neuen Tab öffnen</translation> - </message> - <message> - <location line="-90"/> - <source>Unable to launch web browser. -</source> - <translation>Der Webbrowser konnte nicht gestartet werden. -</translation> - </message> - <message> - <location line="+1"/> - <source>OK</source> - <translation>OK</translation> - </message> - <message> - <location line="+27"/> - <source>Failed to open link: '%1'</source> - <translation>Der Link '%1' konnte nicht geöffnet werden</translation> - </message> - <message> - <location line="+1"/> - <source><div align="center"><h1>The page could not be found</h1><br><h3>'%1'</h3></div></source> - <translation><div align="center"><h1>Die Seite wurde nicht gefunden</h1><br><h3>'%1'</h3></div></translation> - </message> - <message> - <location line="+2"/> - <source>Error...</source> - <translation>Fehler ...</translation> - </message> - <message> - <location line="+56"/> - <source>Copy &Link Location</source> - <translation>Link-Adresse kopieren</translation> - </message> -</context> -<context> - <name>Index</name> - <message> - <location filename="../tools/assistant/compat/index.cpp" line="+385"/> - <source>Untitled</source> - <translation>Unbenannt</translation> - </message> -</context> -<context> - <name>MainWindow</name> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Toolbar</source> - <translation>Werkzeugleiste</translation> - </message> - <message> - <location/> - <source>&Print...</source> - <translation>&Drucken...</translation> - </message> - <message> - <location/> - <source>E&xit</source> - <translation>&Beenden</translation> - </message> - <message> - <location/> - <source>&Copy</source> - <translation>&Kopieren</translation> - </message> - <message> - <location/> - <source>&Find in Text...</source> - <translation>Text&suche...</translation> - </message> - <message> - <location/> - <source>&Home</source> - <translation>St&artseite</translation> - </message> - <message> - <location/> - <source>&Previous</source> - <translation>&Vorherige</translation> - </message> - <message> - <location/> - <source>&Next</source> - <translation>&Nächste</translation> - </message> - <message> - <location/> - <source>About Qt</source> - <translation>Über Qt</translation> - </message> - <message> - <location/> - <source>Zoom &in</source> - <translation>Vergrößern</translation> - </message> - <message> - <location/> - <source>Zoom &out</source> - <translation>Ver&kleinern</translation> - </message> - <message> - <location/> - <source>New Window</source> - <translation>Neues Fenster...</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+198"/> - <source>Ctrl+T</source> - <translation>Strg+T -</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+I</source> - <translation>Strg+I</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+B</source> - <translation>Strg+E</translation> - </message> - <message> - <location line="+129"/> - <location line="+1"/> - <source>Qt Assistant</source> - <translation>Qt Assistant</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>&Add Bookmark</source> - <translation>&Füge Lesezeichen hinzu</translation> - </message> - <message> - <location/> - <source>&File</source> - <translation>&Datei</translation> - </message> - <message> - <location/> - <source>&Edit</source> - <translation>&Bearbeiten</translation> - </message> - <message> - <location/> - <source>&View</source> - <translation>&Ansicht</translation> - </message> - <message> - <location/> - <source>&Go</source> - <translation>&Gehe zu</translation> - </message> - <message> - <location/> - <source>Boo&kmarks</source> - <translation>&Lesezeichen</translation> - </message> - <message> - <location/> - <source>Qt Assistant by Nokia</source> - <translation>Qt Assistant von Nokia</translation> - </message> - <message> - <location/> - <source>&Help</source> - <translation>&Hilfe</translation> - </message> - <message> - <location/> - <source>Print the currently displayed page.</source> - <translation>Drucke aktuelle Seite.</translation> - </message> - <message> - <location/> - <source>Ctrl+P</source> - <translation>Strg+P</translation> - </message> - <message> - <location/> - <source>Quit Qt Assistant.</source> - <translation>Qt Assistant beenden.</translation> - </message> - <message> - <location/> - <source>Ctrl+Q</source> - <translation>Strg+Q</translation> - </message> - <message> - <location/> - <source>Copy the selected text to the clipboard.</source> - <translation>Den markierten Text in die Zwischenablage kopieren.</translation> - </message> - <message> - <location/> - <source>Ctrl+C</source> - <translation>Strg+C</translation> - </message> - <message> - <location/> - <source>Open the Find dialog. Qt Assistant will search the currently displayed page for the text you enter.</source> - <translation>Den Suchdialog öffnen. Qt Assistant sucht in der aktuellen Seite nach dem eingegebenen Text.</translation> - </message> - <message> - <location/> - <source>Ctrl+F</source> - <translation>Strg+F</translation> - </message> - <message> - <location/> - <source>Go to the home page. Qt Assistant's home page is the Qt Reference Documentation.</source> - <translation>Zur Startseite gehen. Startseite im Qt Assistant ist die Qt-Referenzdokumentation.</translation> - </message> - <message> - <location/> - <source>Ctrl+Home</source> - <translation>Strg+Pos1</translation> - </message> - <message> - <location/> - <source>Go to the previous page.</source> - <translation>Gehe zur vorherigen Seite.</translation> - </message> - <message> - <location/> - <source>Alt+Left</source> - <translation>Alt+Links</translation> - </message> - <message> - <location/> - <source>Go to the next page.</source> - <translation>Gehe zur nächsten Seite.</translation> - </message> - <message> - <location/> - <source>Alt+Right</source> - <translation>Alt+Rechts</translation> - </message> - <message> - <location/> - <source>Display further information about Qt Assistant.</source> - <translation>Zeigt das Handbuch zum Qt Designer an.</translation> - </message> - <message> - <location/> - <source>Zoom in on the document, i.e. increase the font size.</source> - <translation>Vergrößert die Schrift.</translation> - </message> - <message> - <location/> - <source>Ctrl++</source> - <translation>Strg++</translation> - </message> - <message> - <location/> - <source>Zoom out on the document, i.e. decrease the font size.</source> - <translation>Verkleinert die Schrift.</translation> - </message> - <message> - <location/> - <source>Ctrl+-</source> - <translation>Strg+-</translation> - </message> - <message> - <location/> - <source>Open a new window.</source> - <translation>Öffnet ein neues Fenster.</translation> - </message> - <message> - <location/> - <source>Ctrl+N</source> - <translation>Strg+N</translation> - </message> - <message> - <location/> - <source>&Close</source> - <translation>&Schließen</translation> - </message> - <message> - <location/> - <source>Close the current window.</source> - <translation>Schließt das aktuelle Fenster.</translation> - </message> - <message> - <location/> - <source>Qt Assistant Manual</source> - <translation>Handbuch zu Qt Assistant</translation> - </message> - <message> - <location/> - <source>F1</source> - <translation>F1</translation> - </message> - <message> - <location/> - <source>Add the currently displayed page as a new bookmark.</source> - <translation>Aktuelle Seite zu den Lesezeichen hinzufügen.</translation> - </message> - <message> - <location/> - <source>What's This?</source> - <translation>Direkthilfe</translation> - </message> - <message> - <location/> - <source>"What's This?" context sensitive help.</source> - <translation>Kontextbezogene Direkthilfe.</translation> - </message> - <message> - <location/> - <source>Shift+F1</source> - <translation>Umschalt+F1</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="-129"/> - <source>Ctrl+S</source> - <translation>Strg+S</translation> - </message> - <message> - <location line="-33"/> - <source>Initializing Qt Assistant...</source> - <translation>Qt Assistant wird initialisiert...</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Go</source> - <translation>Gehe zu</translation> - </message> - <message> - <location/> - <source>Find &Next</source> - <translation>Weitersuchen</translation> - </message> - <message> - <location/> - <source>F3</source> - <translation>F3</translation> - </message> - <message> - <location/> - <source>Find &Previous</source> - <translation>Vorheriges suchen</translation> - </message> - <message> - <location/> - <source>Shift+F3</source> - <translation>Umschalt+F3</translation> - </message> - <message> - <location/> - <source>About Qt Assistant</source> - <translation>Über Qt Assistent</translation> - </message> - <message> - <location/> - <source>Add Tab</source> - <translation>Tab einfügen</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+N</source> - <translation></translation> - </message> - <message> - <location/> - <source>Next Tab</source> - <translation>Nächster Tab</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Right</source> - <translation></translation> - </message> - <message> - <location/> - <source>Previous Tab</source> - <translation>Voriger Tab</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Left</source> - <translation></translation> - </message> - <message> - <location/> - <source>Close Tab</source> - <translation>Tab schließen</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Q</source> - <translation></translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+181"/> - <source>Failed to open about application contents in file: '%1'</source> - <translation>Fehler beim Öffnen des Inhalts in Datei: '%1'</translation> - </message> - <message> - <location line="-246"/> - <source>Sidebar</source> - <translation>Sidebar</translation> - </message> - <message> - <location line="+18"/> - <source>&Window</source> - <translation>&Fenster</translation> - </message> - <message> - <location line="+2"/> - <source>Minimize</source> - <translation>Minimieren</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+M</source> - <translation>Strg+M</translation> - </message> - <message> - <location line="+70"/> - <source>SHIFT+CTRL+=</source> - <translation>Umschalt+Strg+=</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Ctrl+W</source> - <translation>Strg+W</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+8"/> - <source>Ctrl+]</source> - <translation>Strg+AltGr+]</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+[</source> - <translation>Strg+AltGr+[</translation> - </message> - <message> - <location line="+7"/> - <source>Views</source> - <translation>Menüleisten/Sidebar</translation> - </message> - <message> - <location line="+80"/> - <source>Displays the main page of a specific documentation set.</source> - <translation>Zeigt die Hauptseite eines Dokumentensets an.</translation> - </message> - <message> - <location line="+262"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location line="+238"/> - <location line="+6"/> - <source>Save Page</source> - <translation>Seite speichern</translation> - </message> - <message> - <location line="+0"/> - <source>Cannot open file for writing!</source> - <translation>Die Datei konnte nicht zum Schreiben geöffnet werden.</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Save Page As...</source> - <translation>Seite speichern als...</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+S</source> - <translation>Strg+Alt+S</translation> - </message> - <message> - <location/> - <source>Sync with Table of Contents</source> - <translation>Seite mit Inhalt-Tab syncronisieren</translation> - </message> - <message> - <location/> - <source>Select the page in contents tab.</source> - <translation>Wählt die Seite im Inhalt-Tab aus.</translation> - </message> - <message> - <location/> - <source>Font Settings...</source> - <translation>Schriftart...</translation> - </message> -</context> -<context> - <name>QObject</name> - <message> - <location filename="../tools/assistant/compat/config.cpp" line="+350"/> - <source>Qt Assistant by Nokia</source> - <translation>Qt Assistant von Nokia</translation> - </message> -</context> -<context> - <name>TabbedBrowser</name> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.ui"/> - <source>TabbedBrowser</source> - <translation></translation> - </message> - <message> - <location/> - <source>Untitled</source> - <translation>Unbenannt</translation> - </message> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.cpp" line="+235"/> - <source>Add page</source> - <translation>Seite einfügen</translation> - </message> - <message> - <location line="+9"/> - <source>Close page</source> - <translation>Seite schließen</translation> - </message> - <message> - <location line="-95"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location line="+338"/> - <source>New Tab</source> - <translation>Neuer Tab</translation> - </message> - <message> - <location line="+1"/> - <source>Close Tab</source> - <translation>Tab schließen</translation> - </message> - <message> - <location line="+1"/> - <source>Close Other Tabs</source> - <translation>Andere Tabs schließen</translation> - </message> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.ui"/> - <source>Previous</source> - <translation>Vorheriger</translation> - </message> - <message> - <location/> - <source>Next</source> - <translation>Nächster</translation> - </message> - <message> - <location/> - <source>Case Sensitive</source> - <translation>Groß-/Kleinschreibung beachten</translation> - </message> - <message> - <location/> - <source>Whole words</source> - <translation>Ganze Wörter</translation> - </message> - <message> - <location/> - <source><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped</source> - <translation><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Seitenende</translation> - </message> -</context> -<context> - <name>TopicChooser</name> - <message> - <location filename="../tools/assistant/compat/topicchooser.cpp" line="+56"/> - <source>Choose a topic for <b>%1</b></source> - <translation>Wählen Sie ein Thema für <b>%1</b></translation> - </message> - <message> - <location filename="../tools/assistant/compat/topicchooser.ui"/> - <source>Choose Topic</source> - <translation>Thema wählen</translation> - </message> - <message> - <location/> - <source>Select a topic from the list and click the <b>Display</b>-button to open the online help.</source> - <translation>Wählen Sie ein Thema aus der Liste aus und klicken Sie <b>Anzeigen</b> um die Hilfe zu öffnen.</translation> - </message> - <message> - <location/> - <source>&Topics</source> - <translation>&Themen</translation> - </message> - <message> - <location/> - <source>Displays a list of available help topics for the keyword.</source> - <translation>Zeigt eine Liste der verfügbaren Hilfethemen für diesen Begriff an.</translation> - </message> - <message> - <location/> - <source>&Display</source> - <translation>&Anzeigen</translation> - </message> - <message> - <location/> - <source>Open the topic selected in the list.</source> - <translation>Öffne das gewählte Thema aus der Liste.</translation> - </message> - <message> - <location/> - <source>&Close</source> - <translation>&Schließen</translation> - </message> - <message> - <location/> - <source>Close the Dialog.</source> - <translation>Schließt den Dialog.</translation> - </message> -</context> -</TS> diff --git a/translations/assistant_adp_ja.ts b/translations/assistant_adp_ja.ts deleted file mode 100644 index f87beab..0000000 --- a/translations/assistant_adp_ja.ts +++ /dev/null @@ -1,1047 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0" language="ja"> -<context> - <name>AssistantServer</name> - <message> - <location filename="../tools/assistant/compat/main.cpp" line="+225"/> - <source>Qt Assistant</source> - <translation>Qt Assistant</translation> - </message> - <message> - <location line="+1"/> - <source>Failed to bind to port %1</source> - <translation>ポート %1 のバインドに失敗しました</translation> - </message> -</context> -<context> - <name>FontPanel</name> - <message> - <location filename="../tools/shared/fontpanel/fontpanel.cpp" line="+63"/> - <source>Font</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+11"/> - <source>&Writing system</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+3"/> - <source>&Family</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+4"/> - <source>&Style</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+4"/> - <source>&Point size</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>FontSettingsDialog</name> - <message> - <location filename="../tools/assistant/compat/fontsettingsdialog.cpp" line="+63"/> - <source>Font Settings</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>Font settings for:</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+4"/> - <source>Browser</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+1"/> - <source>Application</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+6"/> - <source>Use custom settings</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>HelpDialog</name> - <message> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="+279"/> - <source>Open Link in Current Tab</source> - <translation>リンクを現在のタブに開く</translation> - </message> - <message> - <location line="+3"/> - <source>Open Link in New Window</source> - <translation>リンクを新しいウィンドウで開く</translation> - </message> - <message> - <location line="+3"/> - <source>Open Link in New Tab</source> - <translation>リンクを新しいタブで開く</translation> - </message> - <message> - <location line="+73"/> - <location line="+82"/> - <source>Prepare...</source> - <translation>準備中...</translation> - </message> - <message> - <location line="-64"/> - <location line="+16"/> - <location line="+661"/> - <source>Qt Assistant</source> - <translation>Qt Assistant</translation> - </message> - <message> - <location line="-677"/> - <source>Failed to load keyword index file -Assistant will not work!</source> - <translation>キーワードインデックスファイルのロードに失敗しました -Assistant は動きません!</translation> - </message> - <message> - <location line="+17"/> - <source>Cannot open the index file %1</source> - <translation>インデックスファイル %1 をオープンできません</translation> - </message> - <message> - <location line="+58"/> - <location line="+124"/> - <location line="+8"/> - <source>Warning</source> - <translation>警告</translation> - </message> - <message> - <location line="-131"/> - <location line="+124"/> - <source>Documentation file %1 does not exist! -Skipping file.</source> - <translation>ドキュメンテーションファイル %1 は存在しません! -スキップします。</translation> - </message> - <message> - <location line="-112"/> - <location line="+133"/> - <source>Parse Error</source> - <translation>パースエラー</translation> - </message> - <message> - <location line="-13"/> - <source>Documentation file %1 is not compatible! -Skipping file.</source> - <translation>ドキュメンテーションファイル %1 は互換性がありません! -スキップします。</translation> - </message> - <message numerus="yes"> - <location line="+577"/> - <source>%n document(s) found.</source> - <translation type="unfinished"> - <numerusform></numerusform> - </translation> - </message> - <message> - <source>Index</source> - <translation type="obsolete">インデックス</translation> - </message> - <message> - <source>Bookmarks</source> - <translation type="obsolete">ブックマーク</translation> - </message> - <message> - <source>Contents</source> - <translation type="obsolete">目次</translation> - </message> - <message> - <source>Search</source> - <translation type="obsolete">検索</translation> - </message> - <message> - <location line="-529"/> - <location line="+469"/> - <source>Done</source> - <translation>完了</translation> - </message> - <message> - <location line="-47"/> - <source>Failed to save fulltext search index -Assistant will not work!</source> - <translation>全文検索インデックスのセーブに失敗しました -Assistant は動きません!</translation> - </message> - <message> - <location line="+29"/> - <source>Indexing files...</source> - <translation>インデックス作成中...</translation> - </message> - <message> - <location line="+15"/> - <source>Reading dictionary...</source> - <translation>ディレクトリを読み込んでいます...</translation> - </message> - <message> - <location line="+46"/> - <location line="+9"/> - <source>Full Text Search</source> - <translation>全文検索</translation> - </message> - <message> - <location line="-8"/> - <source>Using a wildcard within phrases is not allowed.</source> - <translation>フレーズ中のワイルドカードの使用は認められていません。</translation> - </message> - <message> - <location line="+9"/> - <source>The closing quotation mark is missing.</source> - <translation>閉じ引用符がありません。</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui"/> - <source>Help</source> - <translation>ヘルプ</translation> - </message> - <message> - <location/> - <source><b>Help</b><p>Choose the topic you want help on from the contents list, or search the index for keywords.</p></source> - <translation><b>ヘルプ</b><p>目次のリストからヘルプを希望するトピックを選択します、あるいはキーワードをインデックスから検索します。</p></translation> - </message> - <message> - <location/> - <source>Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.</source> - <translation>カテゴリ、インデックス、ブックマークで編成したヘルプトピックを表示します。もう一つのタブは全文検索を引き継いでいます。</translation> - </message> - <message> - <location/> - <source>Con&tents</source> - <translation>目次(&T)</translation> - </message> - <message> - <location/> - <source><b>Help topics organized by category.</b><p>Double-click an item to see the topics in that category. To view a topic, just double-click it.</p></source> - <translation><b>カテゴリで編成したヘルプトピックです。</b><p>カテゴリ内のトピックを見るには、項目をダブルクリックしてください。</p></translation> - </message> - <message> - <location/> - <source>column 1</source> - <translation>コラム 1</translation> - </message> - <message> - <location/> - <source>&Index</source> - <translation>インデックス(&I)</translation> - </message> - <message> - <location/> - <source>&Look For:</source> - <translation>以下を検索(&L):</translation> - </message> - <message> - <location/> - <source>Enter keyword</source> - <translation>キーワードを入力してください</translation> - </message> - <message> - <location/> - <source><b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p></source> - <translation><b>キーワードを入力してください。</b><p>入力された文字列に一番近いものを選択します。</p></translation> - </message> - <message> - <location/> - <source><b>List of available help topics.</b><p>Double-click on an item to open its help page. If more than one is found, you must specify which page you want.</p></source> - <translation><b>ヘルプトピック一覧</b><p>ヘルプページをオープンするには、項目をダブルクリックしてください。複数見つかった場合は、その中から選んでください。</p></translation> - </message> - <message> - <location/> - <source>&Bookmarks</source> - <translation>ブックマーク(&B)</translation> - </message> - <message> - <location/> - <source>Displays the list of bookmarks.</source> - <translation>ブックマーク一覧を表示します。</translation> - </message> - <message> - <location/> - <source>Add new bookmark</source> - <translation>新しいブックマークを追加</translation> - </message> - <message> - <location/> - <source>Add the currently displayed page as a new bookmark.</source> - <translation>現在表示されているページを新しいブックマークとして追加します。</translation> - </message> - <message> - <location/> - <source>&New</source> - <translation>新規(&N)</translation> - </message> - <message> - <location/> - <source>Delete bookmark</source> - <translation>ブックマークを削除</translation> - </message> - <message> - <location/> - <source>Delete the selected bookmark.</source> - <translation>選択されたブックマークを削除します。</translation> - </message> - <message> - <location/> - <source>&Delete</source> - <translation>削除(&D)</translation> - </message> - <message> - <location/> - <source>&Search</source> - <translation>検索(&S)</translation> - </message> - <message> - <location/> - <source>Searching f&or:</source> - <translation>以下を検索(&O):</translation> - </message> - <message> - <location/> - <source>Enter searchword(s).</source> - <translation>検索する語(フレーズ)を入力してください。</translation> - </message> - <message> - <location/> - <source><b>Enter search word(s).</b><p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.</p></source> - <translation><b>検索する語(フレーズ)を入力してください。</b><p>検索する語(フレーズ)を入力してください。ワイルドカード(*)を含めることもできます。連続する語を入力する場合は引用符で囲んでください。</p></translation> - </message> - <message> - <location/> - <source><b>Found documents</b><p>This list contains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p></source> - <translation><b>見つかったドキュメント</b><p>この一覧は最新の検索で見つかったドキュメントを全て含んでいます。該当項目が多い順に並んでいます。</p></translation> - </message> - <message> - <location/> - <source>Found &Documents:</source> - <translation>見つかったドキュメント(&D):</translation> - </message> - <message> - <location/> - <source>Display the help page.</source> - <translation>ヘルプページを表示します。</translation> - </message> - <message> - <location/> - <source>Display the help page for the full text search.</source> - <translation>全文検索用にヘルプページを表示します。</translation> - </message> - <message> - <location/> - <source>He&lp</source> - <translation>ヘルプ(&L)</translation> - </message> - <message> - <location/> - <source>Start searching.</source> - <translation>検索を開始します。</translation> - </message> - <message> - <location/> - <source>Pressing this button starts the search.</source> - <translation>このボタンを押すと検索が始まります。</translation> - </message> - <message> - <location/> - <source>Preparing...</source> - <translation>準備中...</translation> - </message> -</context> -<context> - <name>HelpWindow</name> - <message> - <location filename="../tools/assistant/compat/helpwindow.cpp" line="+97"/> - <source>Help</source> - <translation>ヘルプ</translation> - </message> - <message> - <location line="+2"/> - <source>OK</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+27"/> - <source>Failed to open link: '%1'</source> - <translation>リンク開けませんでした: '%1'</translation> - </message> - <message> - <location line="+1"/> - <source><div align="center"><h1>The page could not be found</h1><br><h3>'%1'</h3></div></source> - <translation><div align="center"><h1>ページが見つかりませんでした</h1><br><h3>'%1'</h3></div></translation> - </message> - <message> - <location line="+2"/> - <source>Error...</source> - <translation>エラー...</translation> - </message> - <message> - <location line="+56"/> - <source>Copy &Link Location</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+5"/> - <source>Open Link in New Window Shift+LMB</source> - <translation>リンクを新しいウィンドウで開く Shift+LMB</translation> - </message> - <message> - <location line="-2"/> - <source>Open Link in New Tab</source> - <translation>リンクを新しいタブで開く</translation> - </message> - <message> - <location line="-90"/> - <source>Unable to launch web browser. -</source> - <translation>ブラウザを起動できません。 -</translation> - </message> - <message> - <source>Ok</source> - <translation type="obsolete">Ok</translation> - </message> -</context> -<context> - <name>Index</name> - <message> - <location filename="../tools/assistant/compat/index.cpp" line="+385"/> - <source>Untitled</source> - <translation>タイトルなし</translation> - </message> -</context> -<context> - <name>MainWindow</name> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+103"/> - <source>Sidebar</source> - <translation>サイドバー</translation> - </message> - <message> - <location line="+55"/> - <source>Initializing Qt Assistant...</source> - <translation>Qt Assistant を初期化中...</translation> - </message> - <message> - <location line="+26"/> - <source>SHIFT+CTRL+=</source> - <translation>SHIFT+CTRL+=</translation> - </message> - <message> - <location line="+4"/> - <source>Ctrl+T</source> - <translation>Ctrl+T</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+I</source> - <translation>Ctrl+I</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+B</source> - <translation>Ctrl+B</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+S</source> - <translation>Ctrl+S</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Ctrl+W</source> - <translation>Ctrl+W</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+1"/> - <source>Ctrl+]</source> - <translation>Ctrl+]</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+[</source> - <translation>Ctrl+[</translation> - </message> - <message> - <location line="+7"/> - <source>Views</source> - <translation>表示</translation> - </message> - <message> - <location line="+80"/> - <source>Displays the main page of a specific documentation set.</source> - <translation>指定されたドキュメントセットのメインページを表示します。</translation> - </message> - <message> - <location line="+49"/> - <location line="+1"/> - <source>Qt Assistant</source> - <translation>Qt Assistant</translation> - </message> - <message> - <location line="+19"/> - <source>Failed to open about application contents in file: '%1'</source> - <translation>'%1' というファイル内の、アプリケーションについての説明内容を開けませんでした</translation> - </message> - <message> - <location line="+201"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location line="+238"/> - <location line="+6"/> - <source>Save Page</source> - <translation>ページを保存</translation> - </message> - <message> - <location line="+0"/> - <source>Cannot open file for writing!</source> - <translation>書き込みのためにファイルが開けません!</translation> - </message> - <message> - <source>Qt Assistant by Trolltech</source> - <translation type="obsolete">Trolltech の Qt Assistant</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Toolbar</source> - <translation>ツールバー</translation> - </message> - <message> - <location/> - <source>Go</source> - <translation>移動</translation> - </message> - <message> - <location/> - <source>&File</source> - <translation>ファイル(&F)</translation> - </message> - <message> - <location/> - <source>&Edit</source> - <translation>編集(&E)</translation> - </message> - <message> - <location/> - <source>Font Settings...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location/> - <source>&View</source> - <translation>表示(&V)</translation> - </message> - <message> - <location/> - <source>&Go</source> - <translation>移動(&G)</translation> - </message> - <message> - <location/> - <source>Boo&kmarks</source> - <translation>ブックマーク(&K)</translation> - </message> - <message> - <location/> - <source>Qt Assistant by Nokia</source> - <translation type="unfinished"></translation> - </message> - <message> - <location/> - <source>&Help</source> - <translation>ヘルプ(&H)</translation> - </message> - <message> - <location/> - <source>Print the currently displayed page.</source> - <translation>現在表示されているページを印刷します。</translation> - </message> - <message> - <location/> - <source>Ctrl+P</source> - <translation>Ctrl+P</translation> - </message> - <message> - <location/> - <source>&Print...</source> - <translation>印刷(&P)...</translation> - </message> - <message> - <location/> - <source>Quit Qt Assistant.</source> - <translation>Qt Assistant を終了します。</translation> - </message> - <message> - <location/> - <source>Ctrl+Q</source> - <translation>Ctrl+Q</translation> - </message> - <message> - <location/> - <source>E&xit</source> - <translation>終了(&X)</translation> - </message> - <message> - <location/> - <source>Copy the selected text to the clipboard.</source> - <translation>選択されているテキストをクリップボードにコピーします。</translation> - </message> - <message> - <location/> - <source>Ctrl+C</source> - <translation>Ctrl+C</translation> - </message> - <message> - <location/> - <source>&Copy</source> - <translation>コピー(&C)</translation> - </message> - <message> - <location/> - <source>Open the Find dialog. Qt Assistant will search the currently displayed page for the text you enter.</source> - <translation>検索ダイアログを開きます。Qt Assistant は入力されたテキストを現在表示されているページから検索します。</translation> - </message> - <message> - <location/> - <source>Ctrl+F</source> - <translation>Ctrl+F</translation> - </message> - <message> - <location/> - <source>&Find in Text...</source> - <translation>テキスト内を検索(&F)...</translation> - </message> - <message> - <location/> - <source>F3</source> - <translation>F3</translation> - </message> - <message> - <location/> - <source>Find &Next</source> - <translation>次を検索(&N)</translation> - </message> - <message> - <location/> - <source>Shift+F3</source> - <translation>Shift+F3</translation> - </message> - <message> - <location/> - <source>Find &Previous</source> - <translation>前を検索(&P)</translation> - </message> - <message> - <location/> - <source>Go to the home page. Qt Assistant's home page is the Qt Reference Documentation.</source> - <translation>ホームページへ移動します。Qt Assistant のホームページは Qt Reference Documentation です。</translation> - </message> - <message> - <location/> - <source>Ctrl+Home</source> - <translation>Ctrl+Home</translation> - </message> - <message> - <location/> - <source>&Home</source> - <translation>ホーム(&H)</translation> - </message> - <message> - <location/> - <source>Go to the previous page.</source> - <translation>一つ前のページへ戻ります。</translation> - </message> - <message> - <location/> - <source>Alt+Left</source> - <translation>Alt+左矢印</translation> - </message> - <message> - <location/> - <source>&Previous</source> - <translation>戻る(&P)</translation> - </message> - <message> - <location/> - <source>Go to the next page.</source> - <translation>一つ先のページへ進みます。</translation> - </message> - <message> - <location/> - <source>Alt+Right</source> - <translation>Alt+右矢印</translation> - </message> - <message> - <location/> - <source>&Next</source> - <translation>進む(&N)</translation> - </message> - <message> - <location/> - <source>Display further information about Qt Assistant.</source> - <translation>Qt Assistant について、さらに詳しい情報を表示します。</translation> - </message> - <message> - <location/> - <source>About Qt Assistant</source> - <translation>Qt Assistant について</translation> - </message> - <message> - <location/> - <source>About Qt</source> - <translation>Qt について</translation> - </message> - <message> - <location/> - <source>Zoom in on the document, i.e. increase the font size.</source> - <translation>文書をズームイン(フォントサイズを拡大)します。</translation> - </message> - <message> - <location/> - <source>Ctrl++</source> - <translation>Ctrl++</translation> - </message> - <message> - <location/> - <source>Zoom &in</source> - <translation>拡大(&I)</translation> - </message> - <message> - <location/> - <source>Zoom out on the document, i.e. decrease the font size.</source> - <translation>文書をズームアウト(フォントサイズを縮小)します。</translation> - </message> - <message> - <location/> - <source>Ctrl+-</source> - <translation>Ctrl+-</translation> - </message> - <message> - <location/> - <source>Zoom &out</source> - <translation>縮小(&O)</translation> - </message> - <message> - <location/> - <source>Open a new window.</source> - <translation>新規ウィンドウを開きます。</translation> - </message> - <message> - <location/> - <source>Ctrl+N</source> - <translation>Ctrl+N</translation> - </message> - <message> - <location/> - <source>New Window</source> - <translation>新しいウィンドウ</translation> - </message> - <message> - <location/> - <source>Close the current window.</source> - <translation>現在のウィンドウを閉じます。</translation> - </message> - <message> - <location/> - <source>&Close</source> - <translation>閉じる(&C)</translation> - </message> - <message> - <location/> - <source>Add the currently displayed page as a new bookmark.</source> - <translation>現在表示されているページを新規ブックマークとして追加します。</translation> - </message> - <message> - <location/> - <source>&Add Bookmark</source> - <translation>ブックマークに追加(&A)</translation> - </message> - <message> - <location/> - <source>"What's This?" context sensitive help.</source> - <translation>文脈依存のヘルプ、ヒントです。</translation> - </message> - <message> - <location/> - <source>Shift+F1</source> - <translation>Shift+F1</translation> - </message> - <message> - <location/> - <source>What's This?</source> - <translation>ヒント</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+N</source> - <translation>Ctrl+Alt+N</translation> - </message> - <message> - <location/> - <source>Add Tab</source> - <translation>タブを追加</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Right</source> - <translation>Ctrl+Alt+右矢印</translation> - </message> - <message> - <location/> - <source>Next Tab</source> - <translation>次のタブ</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Left</source> - <translation>Ctrl+Alt+左矢印</translation> - </message> - <message> - <location/> - <source>Previous Tab</source> - <translation>前のタブ</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Q</source> - <translation>Ctrl+Alt+Q</translation> - </message> - <message> - <location/> - <source>Close Tab</source> - <translation>タブを閉じる</translation> - </message> - <message> - <location/> - <source>F1</source> - <translation>F1</translation> - </message> - <message> - <location/> - <source>Qt Assistant Manual</source> - <translation>Qt Assistant マニュアル</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+S</source> - <translation>Ctrl+Alt+S</translation> - </message> - <message> - <location/> - <source>Save Page As...</source> - <translation>名前をつけてページを保存...</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="-673"/> - <source>&Window</source> - <translation>ウィンドウ(&W)</translation> - </message> - <message> - <location line="+2"/> - <source>Minimize</source> - <translation>最小化</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+M</source> - <translation>Ctrl+M</translation> - </message> - <message> - <source>Open Source Edition</source> - <translation type="obsolete">オープンソース版</translation> - </message> - <message> - <source>This version of Qt Assistant is part of the Qt Open Source Edition, for use in the development of Open Source applications. Qt is a comprehensive C++ framework for cross-platform application development.</source> - <translation type="obsolete">この Qt Assistant は Qt オープンソース版の一部であり、オープンソースのアプリケーションの開発を目的としたものです。Qt は、複数のプラットフォームに対応するアプリケーションを開発するための C++ のわかりやすいフレームワークです。</translation> - </message> - <message> - <source>You need a commercial Qt license for development of proprietary (closed source) applications. Please see <a href="http://qt.nokia.com/company/model.html">qt.nokia.com/company/model.html</a> for an overview of Qt licensing.</source> - <translation type="obsolete">著作権のある(ソースを公開しない)アプリケーションを開発するには、Qt の商用ライセンスが必要です。Qt のライセンスの概要については <a href="http://qt.nokia.com/company/model.html">qt.nokia.com/company/model.html</a> をご覧ください。</translation> - </message> - <message> - <source>This program is licensed to you under the terms of the Qt Commercial License Agreement. For details, see the file LICENSE that came with this software distribution.</source> - <translation type="obsolete">このプログラムは Qt 商用版ライセンス規約の定める条件の下で、あなたにライセンスされています。詳細はこのソフトウェアとともに配布される LICENSE ファイルをご覧ください。</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Sync with Table of Contents</source> - <translation>目次の該当箇所を表示</translation> - </message> - <message> - <location/> - <source>Select the page in contents tab.</source> - <translation>「目次」タブからそのページを選択します。</translation> - </message> -</context> -<context> - <name>QAssistantClient</name> - <message> - <source>Failed to start Qt Assistant.</source> - <translation type="obsolete">Qt Assistant の起動に失敗しました。</translation> - </message> - <message> - <source>Qt Assistant crashed.</source> - <translation type="obsolete">Qt Assistant がクラッシュしました。</translation> - </message> - <message> - <source>Error while running Qt Assistant.</source> - <translation type="obsolete">Qt Assistant 実行中にエラーが発生しました。</translation> - </message> - <message> - <source>Cannot connect to Qt Assistant.</source> - <translation type="obsolete">Qt Assistant に接続できません。</translation> - </message> - <message> - <source>Could not connect to Assistant: Connection refused</source> - <translation type="obsolete">Assistant に接続できませんでした: 接続を拒否されました</translation> - </message> - <message> - <source>Could not connect to Assistant: Host not found</source> - <translation type="obsolete">Assistant に接続できませんでした: ホストが見つかりませんでした</translation> - </message> - <message> - <source>Communication error</source> - <translation type="obsolete">通信エラー</translation> - </message> -</context> -<context> - <name>QObject</name> - <message> - <source>Qt Assistant by Trolltech</source> - <translation type="obsolete">Trolltech の Qt Assistant</translation> - </message> - <message> - <location filename="../tools/assistant/compat/config.cpp" line="+350"/> - <source>Qt Assistant by Nokia</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>TabbedBrowser</name> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.cpp" line="+149"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location line="+86"/> - <source>Add page</source> - <translation>ページを追加</translation> - </message> - <message> - <location line="+9"/> - <source>Close page</source> - <translation>ページを閉じる</translation> - </message> - <message> - <location line="+243"/> - <source>New Tab</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+1"/> - <source>Close Tab</source> - <translation type="unfinished">タブを閉じる</translation> - </message> - <message> - <location line="+1"/> - <source>Close Other Tabs</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.ui"/> - <source>TabbedBrowser</source> - <translation>タブブラウザ</translation> - </message> - <message> - <location/> - <source>Untitled</source> - <translation>タイトルなし</translation> - </message> - <message> - <location/> - <source>Previous</source> - <translation>前</translation> - </message> - <message> - <location/> - <source>Next</source> - <translation>次</translation> - </message> - <message> - <location/> - <source>Case Sensitive</source> - <translation>大文字と小文字を区別する</translation> - </message> - <message> - <location/> - <source>Whole words</source> - <translation>完全に一致する単語だけを検索する</translation> - </message> - <message> - <location/> - <source><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped</source> - <translation><img src=":/trolltech/assistant/images/wrap.png">&nbsp;検索が一通り終わりました</translation> - </message> -</context> -<context> - <name>TopicChooser</name> - <message> - <location filename="../tools/assistant/compat/topicchooser.cpp" line="+56"/> - <source>Choose a topic for <b>%1</b></source> - <translation><b>%1</b> のトピックを選択</translation> - </message> - <message> - <location filename="../tools/assistant/compat/topicchooser.ui"/> - <source>Choose Topic</source> - <translation>トピックを選択</translation> - </message> - <message> - <location/> - <source>Select a topic from the list and click the <b>Display</b>-button to open the online help.</source> - <translation>一覧からトピックを選択し、<b>表示</b>ボタンをクリックしてオンラインヘルプを開いてください。</translation> - </message> - <message> - <location/> - <source>&Topics</source> - <translation>トピック(&T)</translation> - </message> - <message> - <location/> - <source>Displays a list of available help topics for the keyword.</source> - <translation>指定されたキーワードの使用できるヘルプトピックの一覧を表示します。</translation> - </message> - <message> - <location/> - <source>&Display</source> - <translation>表示(&D)</translation> - </message> - <message> - <location/> - <source>Open the topic selected in the list.</source> - <translation>一覧から選択されたトピックを開きます。</translation> - </message> - <message> - <location/> - <source>&Close</source> - <translation>閉じる(&C)</translation> - </message> - <message> - <location/> - <source>Close the Dialog.</source> - <translation>ダイアログを閉じます。</translation> - </message> -</context> -</TS> diff --git a/translations/assistant_adp_pl.ts b/translations/assistant_adp_pl.ts deleted file mode 100644 index 17c2c5c..0000000 --- a/translations/assistant_adp_pl.ts +++ /dev/null @@ -1,974 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0" language="pl"> -<context> - <name>AssistantServer</name> - <message> - <location filename="../tools/assistant/compat/main.cpp" line="+225"/> - <source>Qt Assistant</source> - <translation>Qt Assistant</translation> - </message> - <message> - <location line="+1"/> - <source>Failed to bind to port %1</source> - <translation>Błąd podłączenia do portu %1</translation> - </message> -</context> -<context> - <name>FontPanel</name> - <message> - <location filename="../tools/shared/fontpanel/fontpanel.cpp" line="+63"/> - <source>Font</source> - <translation>Czcionka</translation> - </message> - <message> - <location line="+11"/> - <source>&Writing system</source> - <translation>Sys&tem pisania</translation> - </message> - <message> - <location line="+3"/> - <source>&Family</source> - <translation>&Rodzina</translation> - </message> - <message> - <location line="+4"/> - <source>&Style</source> - <translation>&Styl</translation> - </message> - <message> - <location line="+4"/> - <source>&Point size</source> - <translation>&Wielkość punktu</translation> - </message> -</context> -<context> - <name>FontSettingsDialog</name> - <message> - <location filename="../tools/assistant/compat/fontsettingsdialog.cpp" line="+63"/> - <source>Font Settings</source> - <translation>Ustawienia czcionki</translation> - </message> - <message> - <location line="+7"/> - <source>Font settings for:</source> - <translation>Ustawienia czcionki</translation> - </message> - <message> - <location line="+4"/> - <source>Browser</source> - <translation>przeglądarki</translation> - </message> - <message> - <location line="+1"/> - <source>Application</source> - <translation>aplikacji</translation> - </message> - <message> - <location line="+6"/> - <source>Use custom settings</source> - <translation>Użyj własnych ustawień</translation> - </message> -</context> -<context> - <name>HelpDialog</name> - <message> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="+279"/> - <source>Open Link in Current Tab</source> - <translation>Otwórz odsyłacz w bieżącej karcie</translation> - </message> - <message> - <location line="+3"/> - <source>Open Link in New Window</source> - <translation>Otwórz odsyłacz w nowym oknie</translation> - </message> - <message> - <location line="+3"/> - <source>Open Link in New Tab</source> - <translation>Otwórz odsyłacz w nowej karcie</translation> - </message> - <message> - <location line="+73"/> - <location line="+82"/> - <source>Prepare...</source> - <translation>Przygotuj...</translation> - </message> - <message> - <location line="-64"/> - <location line="+16"/> - <location line="+661"/> - <source>Qt Assistant</source> - <translation>Qt Assistant</translation> - </message> - <message> - <location line="-677"/> - <source>Failed to load keyword index file -Assistant will not work!</source> - <translation>Nie można wczytać indeksu słów kluczowych -Assistant nie będzie działał!</translation> - </message> - <message> - <location line="+17"/> - <source>Cannot open the index file %1</source> - <translation>Nie można otworzyć indeksu %1</translation> - </message> - <message> - <location line="+58"/> - <location line="+124"/> - <location line="+8"/> - <source>Warning</source> - <translation>Ostrzeżenie</translation> - </message> - <message> - <location line="-131"/> - <location line="+124"/> - <source>Documentation file %1 does not exist! -Skipping file.</source> - <translation>Plik dokumentacji %1 nie istnieje! -Plik zostaje pominięty.</translation> - </message> - <message> - <location line="-112"/> - <location line="+133"/> - <source>Parse Error</source> - <translation>Błąd parsowania</translation> - </message> - <message> - <location line="-13"/> - <source>Documentation file %1 is not compatible! -Skipping file.</source> - <translation>Plik dokumentacji %1 jest nieodpowiedni! -Plik zostaje pominięty.</translation> - </message> - <message> - <location line="+48"/> - <location line="+469"/> - <source>Done</source> - <translation>Zrobione</translation> - </message> - <message> - <location line="-47"/> - <source>Failed to save fulltext search index -Assistant will not work!</source> - <translation>Nie można zapisać indeksu dla pełnego wyszukiwania -Assistant nie będzie działał!</translation> - </message> - <message> - <location line="+29"/> - <source>Indexing files...</source> - <translation>Indeksowanie plików...</translation> - </message> - <message> - <location line="+15"/> - <source>Reading dictionary...</source> - <translation>Czytanie katalogu...</translation> - </message> - <message> - <location line="+46"/> - <location line="+9"/> - <source>Full Text Search</source> - <translation>Pełne wyszukiwanie</translation> - </message> - <message> - <location line="-8"/> - <source>Using a wildcard within phrases is not allowed.</source> - <translation>Używanie znacznika w wyrażeniu nie jest dozwolone.</translation> - </message> - <message> - <location line="+9"/> - <source>The closing quotation mark is missing.</source> - <translation>Brakuje kończącego znaku cudzysłowu.</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui"/> - <source>Help</source> - <translation>Pomoc</translation> - </message> - <message> - <location/> - <source><b>Help</b><p>Choose the topic you want help on from the contents list, or search the index for keywords.</p></source> - <translation><b>Pomoc</b><p>Wybierz temat pomocy z listy dostępnych tematów bądź poszukaj słowa kluczowego w indeksie.</p></translation> - </message> - <message> - <location/> - <source>Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.</source> - <translation>Pokazuje listę tematów pomocy zorganizowaną w kategorie, indeks lub zakładki. Kolejna karta pozwala na pełne wyszukiwanie.</translation> - </message> - <message> - <location/> - <source>Con&tents</source> - <translation>&Spis treści</translation> - </message> - <message> - <location/> - <source><b>Help topics organized by category.</b><p>Double-click an item to see the topics in that category. To view a topic, just double-click it.</p></source> - <translation><b>Tematy pomocy zorganizowane w kategorie.</b><p>Kliknij dwukrotnie na wybraną kategorię aby otworzyć listę jej tematów. Aby obejrzeć temat dwukrotnie kliknij go.</p></translation> - </message> - <message> - <location/> - <source>column 1</source> - <translation>kolumna 1</translation> - </message> - <message> - <location/> - <source>&Index</source> - <translation>&Indeks</translation> - </message> - <message> - <location/> - <source>&Look For:</source> - <translation>&Szukaj wyrażenia:</translation> - </message> - <message> - <location/> - <source>Enter keyword</source> - <translation>Wprowadź słowo kluczowe</translation> - </message> - <message> - <location/> - <source><b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p></source> - <translation><b>Wprowadź słowo kluczowe.</b><p>Lista wybierze temat który najbardziej odpowiada szukanemu wyrażeniu.</p></translation> - </message> - <message> - <location/> - <source><b>List of available help topics.</b><p>Double-click on an item to open its help page. If more than one is found, you must specify which page you want.</p></source> - <translation><b>Lista dostępnych tematów pomocy</b><p>Kliknij dwukrotnie na wybranym temacie aby otworzyć jego treść. Jeśli temat występuje w kilku kontekstach, dodatkowo należy wybrać kontekst z listy.</p></translation> - </message> - <message> - <location/> - <source>&Bookmarks</source> - <translation>&Zakładki</translation> - </message> - <message> - <location/> - <source>Displays the list of bookmarks.</source> - <translation>Pokazuje listę zakładek.</translation> - </message> - <message> - <location/> - <source>Add new bookmark</source> - <translation>Dodaj nową zakładkę</translation> - </message> - <message> - <location/> - <source>Add the currently displayed page as a new bookmark.</source> - <translation>Dodaj bieżącą stronę jako nową zakładkę.</translation> - </message> - <message> - <location/> - <source>&New</source> - <translation>&Nowa</translation> - </message> - <message> - <location/> - <source>Delete bookmark</source> - <translation>Usuń zakładkę</translation> - </message> - <message> - <location/> - <source>Delete the selected bookmark.</source> - <translation>Usuń zaznaczoną zakładkę.</translation> - </message> - <message> - <location/> - <source>&Delete</source> - <translation>&Usuń</translation> - </message> - <message> - <location/> - <source>&Search</source> - <translation>&Szukaj</translation> - </message> - <message> - <location/> - <source>Searching f&or:</source> - <translation>&Szukanie:</translation> - </message> - <message> - <location/> - <source><b>Enter search word(s).</b><p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.</p></source> - <translation><b>Wprowadź wyrażenie(a) do szukania.<b><p>Wprowadź w tym okienku wyrażenia, których szukasz. Wyrażenia mogą zawierać znaczniki (*). Dla wyszukania ciągu wyrażeń umieść całość w cudzysłowie.</p></translation> - </message> - <message> - <location/> - <source><b>Found documents</b><p>This list contains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p></source> - <translation><b>Znalezione dokumenty</b><p>Lista zawiera wszystkie znalezione dokumenty związane z ostatnim wyszukiwaniem. Dokumenty są poukładane w kolejności pod względem ilości trafień szukanego wyrażenia.</p></translation> - </message> - <message> - <location/> - <source>Found &Documents:</source> - <translation>Znalezione &dokumenty:</translation> - </message> - <message> - <location/> - <source>Display the help page for the full text search.</source> - <translation>Pokaż stronę pomocy dla pełnego wyszukiwania.</translation> - </message> - <message> - <location/> - <source>He&lp</source> - <translation>&Pomoc</translation> - </message> - <message> - <location/> - <source>Pressing this button starts the search.</source> - <translation>Naciśnięcie tego przycisku powoduje rozpoczęcie wyszukiwania.</translation> - </message> - <message> - <location/> - <source>Preparing...</source> - <translation>Przygotowywanie...</translation> - </message> - <message numerus="yes"> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="+7"/> - <source>%n document(s) found.</source> - <translation> - <numerusform>Znaleziono %n dokument.</numerusform> - <numerusform>Znaleziono %n dokumenty.</numerusform> - <numerusform>Znaleziono %n dokumentów.</numerusform> - </translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui"/> - <source>Enter searchword(s)</source> - <translation>Wprowadź wyrażenie(a) do szukania</translation> - </message> - <message> - <location/> - <source>Display the help page</source> - <translation>Pokaż stronę pomocy</translation> - </message> - <message> - <location/> - <source>Start searching</source> - <translation>Rozpocznij wyszukiwanie</translation> - </message> -</context> -<context> - <name>HelpWindow</name> - <message> - <location filename="../tools/assistant/compat/helpwindow.cpp" line="+97"/> - <source>Help</source> - <translation>Pomoc</translation> - </message> - <message> - <location line="+1"/> - <source>Unable to launch web browser. -</source> - <translation>Nie można uruchomić przeglądarki internetowej. -</translation> - </message> - <message> - <location line="+28"/> - <source>Failed to open link: '%1'</source> - <translation>Nie można otworzyć odsyłacza: '%1'</translation> - </message> - <message> - <location line="+1"/> - <source><div align="center"><h1>The page could not be found</h1><br><h3>'%1'</h3></div></source> - <translation><div align="center"><h1>Strona nie została znaleziona</h1><br><h3>'%1'</h3></div></translation> - </message> - <message> - <location line="+2"/> - <source>Error...</source> - <translation>Błąd...</translation> - </message> - <message> - <location line="+61"/> - <source>Open Link in New Window Shift+LMB</source> - <translation>Otwórz odsyłacz w nowym oknie Shift+LMB</translation> - </message> - <message> - <location line="-2"/> - <source>Open Link in New Tab</source> - <translation>Otwórz odsyłacz w nowej karcie</translation> - </message> - <message> - <location line="-89"/> - <source>OK</source> - <translation>OK</translation> - </message> - <message> - <location line="+86"/> - <source>Copy &Link Location</source> - <translation>Skopiuj &odsyłacz</translation> - </message> -</context> -<context> - <name>Index</name> - <message> - <location filename="../tools/assistant/compat/index.cpp" line="+385"/> - <source>Untitled</source> - <translation>Nienazwany</translation> - </message> -</context> -<context> - <name>MainWindow</name> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+103"/> - <source>Sidebar</source> - <translation>Panel</translation> - </message> - <message> - <location line="+18"/> - <source>&Window</source> - <translation>&Okno</translation> - </message> - <message> - <location line="+2"/> - <source>Minimize</source> - <translation>Minimalizuj</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+M</source> - <translation>Ctrl+M</translation> - </message> - <message> - <location line="+44"/> - <source>Initializing Qt Assistant...</source> - <translation>Inicjalizowanie Qt Assistant...</translation> - </message> - <message> - <location line="+26"/> - <source>SHIFT+CTRL+=</source> - <translation>SHIFT+CTRL+=</translation> - </message> - <message> - <location line="+4"/> - <source>Ctrl+T</source> - <translation>Ctrl+T</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+I</source> - <translation>Ctrl+I</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+B</source> - <translation>Ctrl+B</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+S</source> - <translation>Ctrl+S</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Ctrl+W</source> - <translation>Ctrl+W</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+1"/> - <source>Ctrl+]</source> - <translation>Ctrl+]</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+[</source> - <translation>Ctrl+[</translation> - </message> - <message> - <location line="+7"/> - <source>Views</source> - <translation>Widoki</translation> - </message> - <message> - <location line="+80"/> - <source>Displays the main page of a specific documentation set.</source> - <translation>Pokazuje główną stronę wybranego zestawu dokumentacji.</translation> - </message> - <message> - <location line="+39"/> - <location line="+1"/> - <source>Qt Assistant</source> - <translation>Qt Assistant</translation> - </message> - <message> - <location line="+19"/> - <source>Failed to open about application contents in file: '%1'</source> - <translation>Nie można otworzyć pliku: '%1' z informacjami o aplikacji</translation> - </message> - <message> - <location line="+203"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location line="+238"/> - <location line="+6"/> - <source>Save Page</source> - <translation>Zapisz stronę</translation> - </message> - <message> - <location line="+0"/> - <source>Cannot open file for writing!</source> - <translation>Nie można otworzyć pliku do zapisu!</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Qt Assistant by Nokia</source> - <translation>Qt Assistant Nokii</translation> - </message> - <message> - <location/> - <source>Toolbar</source> - <translation>Pasek główny</translation> - </message> - <message> - <location/> - <source>Go</source> - <translation>Pasek z odsyłaczami</translation> - </message> - <message> - <location/> - <source>&Help</source> - <translation>&Pomoc</translation> - </message> - <message> - <location/> - <source>&File</source> - <translation>&Plik</translation> - </message> - <message> - <location/> - <source>Boo&kmarks</source> - <translation>&Zakładki</translation> - </message> - <message> - <location/> - <source>&Go</source> - <translation>&Nawigacja</translation> - </message> - <message> - <location/> - <source>&View</source> - <translation>&Widok</translation> - </message> - <message> - <location/> - <source>&Edit</source> - <translation>&Edycja</translation> - </message> - <message> - <location/> - <source>&Print...</source> - <translation>Wy&drukuj...</translation> - </message> - <message> - <location/> - <source>Print the currently displayed page.</source> - <translation>Wydrukuj bieżącą stronę.</translation> - </message> - <message> - <location/> - <source>Ctrl+P</source> - <translation>Ctrl+P</translation> - </message> - <message> - <location/> - <source>E&xit</source> - <translation>&Zakończ</translation> - </message> - <message> - <location/> - <source>Quit Qt Assistant.</source> - <translation>Zakończ Qt Assistant.</translation> - </message> - <message> - <location/> - <source>Ctrl+Q</source> - <translation>Ctrl+Q</translation> - </message> - <message> - <location/> - <source>&Copy</source> - <translation>S&kopiuj</translation> - </message> - <message> - <location/> - <source>Copy the selected text to the clipboard.</source> - <translation>Skopiuj wybrany tekst do schowka.</translation> - </message> - <message> - <location/> - <source>Ctrl+C</source> - <translation>Ctrl+C</translation> - </message> - <message> - <location/> - <source>&Find in Text...</source> - <translation>&Znajdź w tekście...</translation> - </message> - <message> - <location/> - <source>Open the Find dialog. Qt Assistant will search the currently displayed page for the text you enter.</source> - <translation>Otwórz okno szukania. Qt Assistant będzie przeszukiwał bieżącą stronę dla podanego tekstu.</translation> - </message> - <message> - <location/> - <source>Ctrl+F</source> - <translation>Ctrl+F</translation> - </message> - <message> - <location/> - <source>Find &Next</source> - <translation>Znajdź &następne</translation> - </message> - <message> - <location/> - <source>F3</source> - <translation>F3</translation> - </message> - <message> - <location/> - <source>Find &Previous</source> - <translation>Znajdź &poprzednie</translation> - </message> - <message> - <location/> - <source>Shift+F3</source> - <translation>Shift+F3</translation> - </message> - <message> - <location/> - <source>&Home</source> - <translation>Strona &startowa</translation> - </message> - <message> - <location/> - <source>Go to the home page. Qt Assistant's home page is the Qt Reference Documentation.</source> - <translation>Przejdź do strony startowej. Strona startowa Qt Assistant jest główną stroną dokumentacji Qt.</translation> - </message> - <message> - <location/> - <source>Ctrl+Home</source> - <translation>Ctrl+Home</translation> - </message> - <message> - <location/> - <source>&Previous</source> - <translation>&Poprzednia strona</translation> - </message> - <message> - <location/> - <source>Go to the previous page.</source> - <translation>Przejdź do poprzedniej strony.</translation> - </message> - <message> - <location/> - <source>Alt+Left</source> - <translation>Alt+Left</translation> - </message> - <message> - <location/> - <source>&Next</source> - <translation>&Następna strona</translation> - </message> - <message> - <location/> - <source>Go to the next page.</source> - <translation>Przejdź do następnej strony.</translation> - </message> - <message> - <location/> - <source>Alt+Right</source> - <translation>Alt+Right</translation> - </message> - <message> - <location/> - <source>About Qt Assistant</source> - <translation>Informacje o Qt Assistant</translation> - </message> - <message> - <location/> - <source>Display further information about Qt Assistant.</source> - <translation>Pokaż dalsze informacje o Qt Assistant.</translation> - </message> - <message> - <location/> - <source>About Qt</source> - <translation>Informacje o Qt</translation> - </message> - <message> - <location/> - <source>Zoom &in</source> - <translation>Po&większ</translation> - </message> - <message> - <location/> - <source>Zoom in on the document, i.e. increase the font size.</source> - <translation>Powiększ rozmiar czcionek w dokumencie.</translation> - </message> - <message> - <location/> - <source>Ctrl++</source> - <translation>Ctrl++</translation> - </message> - <message> - <location/> - <source>Zoom &out</source> - <translation>Po&mniejsz</translation> - </message> - <message> - <location/> - <source>Zoom out on the document, i.e. decrease the font size.</source> - <translation>Pomniejsz rozmiar czcionek w dokumencie.</translation> - </message> - <message> - <location/> - <source>Ctrl+-</source> - <translation>Ctrl+-</translation> - </message> - <message> - <location/> - <source>New Window</source> - <translation>Nowe okno</translation> - </message> - <message> - <location/> - <source>Open a new window.</source> - <translation>Otwórz nowe okno.</translation> - </message> - <message> - <location/> - <source>Ctrl+N</source> - <translation>Ctrl+N</translation> - </message> - <message> - <location/> - <source>&Close</source> - <translation>Za&mknij</translation> - </message> - <message> - <location/> - <source>Close the current window.</source> - <translation>Zamknij bieżące okno.</translation> - </message> - <message> - <location/> - <source>&Add Bookmark</source> - <translation>&Dodaj zakładkę</translation> - </message> - <message> - <location/> - <source>Add the currently displayed page as a new bookmark.</source> - <translation>Dodaj bieżącą stronę jako nową zakładkę.</translation> - </message> - <message> - <location/> - <source>What's This?</source> - <translation>Co to jest?</translation> - </message> - <message> - <location/> - <source>"What's This?" context sensitive help.</source> - <translation>"Co to jest?" jest pomocą kontekstową.</translation> - </message> - <message> - <location/> - <source>Shift+F1</source> - <translation>Shift+F1</translation> - </message> - <message> - <location/> - <source>Add Tab</source> - <translation>Dodaj kartę</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+N</source> - <translation>Ctrl+Alt+N</translation> - </message> - <message> - <location/> - <source>Next Tab</source> - <translation>Następna karta</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Right</source> - <translation>Ctrl+Alt+Right</translation> - </message> - <message> - <location/> - <source>Previous Tab</source> - <translation>Poprzednia karta</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Left</source> - <translation>Ctrl+Alt+Left</translation> - </message> - <message> - <location/> - <source>Close Tab</source> - <translation>Zamknij kartę</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Q</source> - <translation>Ctrl+Alt+Q</translation> - </message> - <message> - <location/> - <source>Qt Assistant Manual</source> - <translation>Podręcznik Qt Assistant</translation> - </message> - <message> - <location/> - <source>F1</source> - <translation>F1</translation> - </message> - <message> - <location/> - <source>Save Page As...</source> - <translation>Zapisz stronę jako...</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+S</source> - <translation>Ctrl+Alt+S</translation> - </message> - <message> - <location/> - <source>Sync with Table of Contents</source> - <translation>Znajdź bieżącą stronę w spisie treści</translation> - </message> - <message> - <location/> - <source>Select the page in contents tab.</source> - <translation>Wybierz stronę w karcie ze spisem treści.</translation> - </message> - <message> - <location/> - <source>Font Settings...</source> - <translation>Ustawienia czcionki...</translation> - </message> -</context> -<context> - <name>QObject</name> - <message> - <location filename="../tools/assistant/compat/config.cpp" line="+350"/> - <source>Qt Assistant by Nokia</source> - <translation>Qt Assistant Nokii</translation> - </message> -</context> -<context> - <name>TabbedBrowser</name> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.cpp" line="+149"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location line="+86"/> - <source>Add page</source> - <translation>Dodaj kartę</translation> - </message> - <message> - <location line="+9"/> - <source>Close page</source> - <translation>Zamknij kartę</translation> - </message> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.ui"/> - <source>TabbedBrowser</source> - <translation>Przeglądarka z kartami</translation> - </message> - <message> - <location/> - <source>Untitled</source> - <translation>Nienazwany</translation> - </message> - <message> - <location/> - <source>Previous</source> - <translation>Poprzedni</translation> - </message> - <message> - <location/> - <source>Next</source> - <translation>Następny</translation> - </message> - <message> - <location/> - <source>Case Sensitive</source> - <translation>Uwzględniaj wielkość liter</translation> - </message> - <message> - <location/> - <source>Whole words</source> - <translation>Wszystkie wyrazy</translation> - </message> - <message> - <location/> - <source><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped</source> - <translation><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Szukanie od początku</translation> - </message> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.cpp" line="+243"/> - <source>New Tab</source> - <translation>Nowa karta</translation> - </message> - <message> - <location line="+1"/> - <source>Close Tab</source> - <translation>Zamknij kartę</translation> - </message> - <message> - <location line="+1"/> - <source>Close Other Tabs</source> - <translation>Zamknij pozostałe karty</translation> - </message> -</context> -<context> - <name>TopicChooser</name> - <message> - <location filename="../tools/assistant/compat/topicchooser.cpp" line="+56"/> - <source>Choose a topic for <b>%1</b></source> - <translation>Wybierz temat dla <b>%1</b></translation> - </message> - <message> - <location filename="../tools/assistant/compat/topicchooser.ui"/> - <source>Choose Topic</source> - <translation>Wybierz temat</translation> - </message> - <message> - <location/> - <source>Select a topic from the list and click the <b>Display</b>-button to open the online help.</source> - <translation>Wybierz temat z listy i kliknij przycisk <b>Pokaż</b> aby otworzyć pomoc (online).</translation> - </message> - <message> - <location/> - <source>&Topics</source> - <translation>&Tematy</translation> - </message> - <message> - <location/> - <source>Displays a list of available help topics for the keyword.</source> - <translation>Pokazuje listę dostępnych tematów pomocy dla szukanego wyrażenia.</translation> - </message> - <message> - <location/> - <source>&Display</source> - <translation>Pok&aż</translation> - </message> - <message> - <location/> - <source>Open the topic selected in the list.</source> - <translation>Otwórz wybrany na liście temat.</translation> - </message> - <message> - <location/> - <source>&Close</source> - <translation>Za&mknij</translation> - </message> - <message> - <location/> - <source>Close the Dialog.</source> - <translation>Zamknij okno.</translation> - </message> -</context> -</TS> diff --git a/translations/assistant_adp_ru.ts b/translations/assistant_adp_ru.ts deleted file mode 100644 index db0c9df..0000000 --- a/translations/assistant_adp_ru.ts +++ /dev/null @@ -1,977 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0" language="ru"> -<context> - <name>AssistantServer</name> - <message> - <location filename="../tools/assistant/compat/main.cpp" line="+226"/> - <source>Failed to bind to port %1</source> - <translation>Не удалось открыть порт %1</translation> - </message> - <message> - <location line="-1"/> - <source>Qt Assistant</source> - <translation>Qt Assistant</translation> - </message> -</context> -<context> - <name>FontPanel</name> - <message> - <location filename="../tools/shared/fontpanel/fontpanel.cpp" line="+77"/> - <source>&Family</source> - <translation>&Шрифт</translation> - </message> - <message> - <location line="+4"/> - <source>&Style</source> - <translation>&Начертание</translation> - </message> - <message> - <location line="-18"/> - <source>Font</source> - <translation>Шрифт</translation> - </message> - <message> - <location line="+11"/> - <source>&Writing system</source> - <translation>Система &письма</translation> - </message> - <message> - <location line="+11"/> - <source>&Point size</source> - <translation>&Размер</translation> - </message> -</context> -<context> - <name>FontSettingsDialog</name> - <message> - <location filename="../tools/assistant/compat/fontsettingsdialog.cpp" line="+75"/> - <source>Application</source> - <translation>Приложение</translation> - </message> - <message> - <location line="-1"/> - <source>Browser</source> - <translation>Обозреватель</translation> - </message> - <message> - <location line="-4"/> - <source>Font settings for:</source> - <translation>Настройки шрифта для:</translation> - </message> - <message> - <location line="+11"/> - <source>Use custom settings</source> - <translation>Использование индивидуальных настроек</translation> - </message> - <message> - <location line="-18"/> - <source>Font Settings</source> - <translation>Настройки шрифта</translation> - </message> -</context> -<context> - <name>HelpDialog</name> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui" line="+108"/> - <source>&Index</source> - <translation>&Указатель</translation> - </message> - <message> - <location line="+12"/> - <source>&Look For:</source> - <translation>&Искать:</translation> - </message> - <message> - <location line="+91"/> - <source>&New</source> - <translation>&Новая</translation> - </message> - <message> - <location line="+23"/> - <location line="+111"/> - <source>&Search</source> - <translation>&Поиск</translation> - </message> - <message> - <location line="-212"/> - <source><b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p></source> - <translation type="unfinished"><b>Указание ключевого слова.</b><p>Список заполняется элементами, лучше соответствующими указанному ключевому слову.</p></translation> - </message> - <message> - <location line="+142"/> - <source><b>Enter search word(s).</b><p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.</p></source> - <translation type="unfinished"><b>Указание слов для поиска.</b><p>Введите одно или несколько слов, по которым требуется осуществить поиск. Слова могут содержкать символы-заменители (*). Если требуется найти сочетание слов, заключите искомую фразу в кавычки.</p></translation> - </message> - <message> - <location line="+10"/> - <source><b>Found documents</b><p>This list contains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p></source> - <translation type="unfinished"><b>Найденные документы</b><p>В данном списке представлены все найденные при последнем поиске документы. Документы упорядочены по релевантности, т.е. чем выше в списке, тем чаще в нём встречаются искомые слова.</p></translation> - </message> - <message> - <location line="-196"/> - <source><b>Help topics organized by category.</b><p>Double-click an item to see the topics in that category. To view a topic, just double-click it.</p></source> - <translation type="unfinished"><b>Разделы справки, распределённые по категориям.</b><p>Дважды щёлкните по одному из пунктов для отображения разделов в данной категории. Для открытия раздела дважды щёлкните по нему.</p></translation> - </message> - <message> - <location line="-31"/> - <source><b>Help</b><p>Choose the topic you want help on from the contents list, or search the index for keywords.</p></source> - <translation type="unfinished"><b>Справка</b><p>Выберите раздел справки из оглавления или воспользуйтесь поиском по предметному указателю.</p></translation> - </message> - <message> - <location line="+85"/> - <source><b>List of available help topics.</b><p>Double-click on an item to open its help page. If more than one is found, you must specify which page you want.</p></source> - <translation type="unfinished"><b>Список доступных разделов справки.</b><p>Дважды щёлкните по одному из пунктов для открытия страницы справки. Если найдено более одной страницы, выберите желаемую.</p></translation> - </message> - <message> - <location line="+62"/> - <source>Add new bookmark</source> - <translation>Добавить закладку</translation> - </message> - <message> - <location line="+3"/> - <source>Add the currently displayed page as a new bookmark.</source> - <translation>Добавить отображаемую страницу в закладки.</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="+393"/> - <source>Cannot open the index file %1</source> - <translation>Не удаётся открыть файл индекса %1</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui" line="-134"/> - <source>Con&tents</source> - <translation>&Оглавление</translation> - </message> - <message> - <location line="+144"/> - <source>Delete bookmark</source> - <translation>Удалить закладку</translation> - </message> - <message> - <location line="+3"/> - <source>Delete the selected bookmark.</source> - <translation>Удалить выбранную закладку.</translation> - </message> - <message> - <location line="+51"/> - <source>Enter searchword(s)</source> - <translation>Введите одно или несколько слов для поиска</translation> - </message> - <message> - <location line="+38"/> - <source>Display the help page</source> - <translation>Показать страницу справки</translation> - </message> - <message> - <location line="+3"/> - <source>Display the help page for the full text search.</source> - <translation>Показать справку по полнотекстовому поиску.</translation> - </message> - <message> - <location line="+26"/> - <source>Start searching</source> - <translation>Начать поиск</translation> - </message> - <message> - <location line="-269"/> - <source>Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.</source> - <translation>Отображает список разделов, распредёленных по категориям, указатель или закладки. Последняя вкладка содержит панель полнотекстового поиска.</translation> - </message> - <message> - <location line="+96"/> - <source>Displays the list of bookmarks.</source> - <translation>Отображает список закладок.</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="+59"/> - <location line="+124"/> - <source>Documentation file %1 does not exist! -Skipping file.</source> - <translation>Файл документации %1 не существует! -Пропущен.</translation> - </message> - <message> - <location line="+8"/> - <source>Documentation file %1 is not compatible! -Skipping file.</source> - <translation>Несовместимый файл документации %1! -Пропущен.</translation> - </message> - <message> - <location line="+48"/> - <location line="+469"/> - <source>Done</source> - <translation>Готово</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui" line="-36"/> - <source>Enter keyword</source> - <translation>Введите ключевое слово</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="-725"/> - <source>Failed to load keyword index file -Assistant will not work!</source> - <translation>Не удалось загрузить файл индекса ключевых слов -Qt Assistant не будет работать!</translation> - </message> - <message> - <location line="+678"/> - <source>Failed to save fulltext search index -Assistant will not work!</source> - <translation>Не удалось сохранить индекс полнотекстового поиска -Qt Assistant не будет работать!</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui" line="+162"/> - <source>Found &Documents:</source> - <translation>Найденные &документы:</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="+90"/> - <location line="+9"/> - <source>Full Text Search</source> - <translation>Полнотекстовый поиск</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui" line="+24"/> - <source>He&lp</source> - <translation>&Справка</translation> - </message> - <message> - <location line="-261"/> - <source>Help</source> - <translation>Справка</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="-70"/> - <source>Indexing files...</source> - <translation>Индексирование файлов...</translation> - </message> - <message> - <location line="-798"/> - <source>Open Link in New Tab</source> - <translation>Открыть ссылку в новой вкладке</translation> - </message> - <message> - <location line="-3"/> - <source>Open Link in New Window</source> - <translation>Открыть ссылку в новом окне</translation> - </message> - <message> - <location line="+182"/> - <location line="+133"/> - <source>Parse Error</source> - <translation>Ошибка обработки</translation> - </message> - <message> - <location line="-239"/> - <location line="+82"/> - <source>Prepare...</source> - <translation>Подготовка...</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui" line="+321"/> - <source>Preparing...</source> - <translation>Подготовка...</translation> - </message> - <message> - <location line="-34"/> - <source>Pressing this button starts the search.</source> - <translation>Нажатие на эту кнопку запустит процесс поиска.</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="-64"/> - <location line="+16"/> - <location line="+661"/> - <source>Qt Assistant</source> - <translation>Qt Assistant</translation> - </message> - <message> - <location line="+45"/> - <source>Reading dictionary...</source> - <translation>Чтение каталога...</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui" line="-80"/> - <source>Searching f&or:</source> - <translation>&Искать:</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="+56"/> - <source>The closing quotation mark is missing.</source> - <translation>Пропущена закрывающая кавычка.</translation> - </message> - <message> - <location line="-9"/> - <source>Using a wildcard within phrases is not allowed.</source> - <translation>Использование символов-заменителей внутри фраз недопустимо.</translation> - </message> - <message> - <location line="-694"/> - <location line="+124"/> - <location line="+8"/> - <source>Warning</source> - <translation>Предупреждение</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui" line="-163"/> - <location line="+74"/> - <source>column 1</source> - <translation>столбец 1</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="-304"/> - <source>Open Link in Current Tab</source> - <translation>Открыть ссылку в текущей вкладке</translation> - </message> - <message numerus="yes"> - <location line="+882"/> - <source>%n document(s) found.</source> - <translation> - <numerusform>Найден %n документ.</numerusform> - <numerusform>Найдено %n документа.</numerusform> - <numerusform>Найдено %n документов.</numerusform> - </translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui" line="-22"/> - <source>&Bookmarks</source> - <translation>&Закладки</translation> - </message> - <message> - <location line="+73"/> - <source>&Delete</source> - <translation>&Удалить</translation> - </message> -</context> -<context> - <name>HelpWindow</name> - <message> - <location filename="../tools/assistant/compat/helpwindow.cpp" line="+127"/> - <source><div align="center"><h1>The page could not be found</h1><br><h3>'%1'</h3></div></source> - <translation><div align="center"><h1>Страница не найдена</h1><br><h3>'%1'</h3></div></translation> - </message> - <message> - <location line="+58"/> - <source>Copy &Link Location</source> - <translation>Копировать &адрес ссылки</translation> - </message> - <message> - <location line="-56"/> - <source>Error...</source> - <translation>Ошибка...</translation> - </message> - <message> - <location line="-3"/> - <source>Failed to open link: '%1'</source> - <translation>Не удалось открыть ссылку: '%1'</translation> - </message> - <message> - <location line="-29"/> - <source>Help</source> - <translation>Справка</translation> - </message> - <message> - <location line="+2"/> - <source>OK</source> - <translation>Закрыть</translation> - </message> - <message> - <location line="+89"/> - <source>Open Link in New Tab</source> - <translation>Открыть ссылку в новой вкладке</translation> - </message> - <message> - <location line="+2"/> - <source>Open Link in New Window Shift+LMB</source> - <translation>Открыть ссылку в новом окне Shift+LMB</translation> - </message> - <message> - <location line="-92"/> - <source>Unable to launch web browser. -</source> - <translation>Невозможно запустить вэб-браузер. -</translation> - </message> -</context> -<context> - <name>Index</name> - <message> - <location filename="../tools/assistant/compat/index.cpp" line="+385"/> - <source>Untitled</source> - <translation>Неозаглавлено</translation> - </message> -</context> -<context> - <name>MainWindow</name> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui" line="+373"/> - <location line="+3"/> - <source>"What's This?" context sensitive help.</source> - <translation>Контекстная справка "Что это?".</translation> - </message> - <message> - <location line="-17"/> - <source>&Add Bookmark</source> - <translation>&Добавить закладку</translation> - </message> - <message> - <location line="-11"/> - <source>&Close</source> - <translation>&Закрыть</translation> - </message> - <message> - <location line="-141"/> - <source>&Copy</source> - <translation>&Копировать</translation> - </message> - <message> - <location line="-49"/> - <source>&Edit</source> - <translation>&Правка</translation> - </message> - <message> - <location line="-39"/> - <source>&File</source> - <translation>&Файл</translation> - </message> - <message> - <location line="+102"/> - <source>&Find in Text...</source> - <translation>П&оиск по тексту...</translation> - </message> - <message> - <location line="-82"/> - <source>&Go</source> - <translation>&Перейти</translation> - </message> - <message> - <location line="-31"/> - <source>&Help</source> - <translation>&Справка</translation> - </message> - <message> - <location line="+143"/> - <source>&Home</source> - <translation>&Домой</translation> - </message> - <message> - <location line="+28"/> - <source>&Next</source> - <translation>Сл&едующий</translation> - </message> - <message> - <location line="-14"/> - <source>&Previous</source> - <translation>&Предыдущий</translation> - </message> - <message> - <location line="-86"/> - <source>&Print...</source> - <translation>&Печать...</translation> - </message> - <message> - <location line="-28"/> - <source>&View</source> - <translation>&Вид</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+121"/> - <source>&Window</source> - <translation>&Окно</translation> - </message> - <message> - <location line="+431"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui" line="+150"/> - <source>About Qt</source> - <translation>О Qt</translation> - </message> - <message> - <location line="-11"/> - <source>About Qt Assistant</source> - <translation>О Qt Assistant</translation> - </message> - <message> - <location line="+94"/> - <source>Add Tab</source> - <translation>Добавить вкладку</translation> - </message> - <message> - <location line="-22"/> - <source>Add the currently displayed page as a new bookmark.</source> - <translation>Добавить отображаемую страницу в закладки.</translation> - </message> - <message> - <location line="-228"/> - <source>Boo&kmarks</source> - <translation>&Закладки</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+244"/> - <source>Cannot open file for writing!</source> - <translation>Не удалось открыть файл для записи!</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui" line="+274"/> - <source>Close Tab</source> - <translation>Закрыть вкладку</translation> - </message> - <message> - <location line="-57"/> - <source>Close the current window.</source> - <translation>Закрыть текущее окно.</translation> - </message> - <message> - <location line="-58"/> - <source>Display further information about Qt Assistant.</source> - <translation>Показать дополнительную информацию о Qt Assistant.</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="-506"/> - <source>Displays the main page of a specific documentation set.</source> - <translation>Открывает стартовую страницу выбранного набора документации.</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui" line="-103"/> - <source>E&xit</source> - <translation>В&ыход</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+59"/> - <source>Failed to open about application contents in file: '%1'</source> - <translation>Не удалось получить информацию о приложении из файла: '%1'</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui" line="+42"/> - <source>Find &Next</source> - <translation>Найти &следующее</translation> - </message> - <message> - <location line="+8"/> - <source>Find &Previous</source> - <translation>Найти &предыдущее</translation> - </message> - <message> - <location line="+206"/> - <source>Font Settings...</source> - <translation>Настройки шрифта...</translation> - </message> - <message> - <location line="-361"/> - <source>Go</source> - <translation>Перейти</translation> - </message> - <message> - <location line="+169"/> - <source>Go to the home page. Qt Assistant's home page is the Qt Reference Documentation.</source> - <translation>Перейти на домашнюю страницу. Домашная страница Qt Assistant - Справочная документация по Qt.</translation> - </message> - <message> - <location line="+28"/> - <source>Go to the next page.</source> - <translation>Переход на следующую страницу.</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="-181"/> - <source>Initializing Qt Assistant...</source> - <translation>Инициализация Qt Assistant...</translation> - </message> - <message> - <location line="-45"/> - <source>Minimize</source> - <translation>Свернуть</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui" line="+55"/> - <source>New Window</source> - <translation>Новое окно</translation> - </message> - <message> - <location line="+55"/> - <source>Next Tab</source> - <translation>Следующая вкладка</translation> - </message> - <message> - <location line="-52"/> - <source>Open a new window.</source> - <translation>Открыть новое окно.</translation> - </message> - <message> - <location line="-116"/> - <source>Open the Find dialog. Qt Assistant will search the currently displayed page for the text you enter.</source> - <translation>Открыть окно поиска. Qt Assistant произведёт поиск введённого текста на отображаемой странице.</translation> - </message> - <message> - <location line="+176"/> - <source>Previous Tab</source> - <translation>Предыдущая вкладка</translation> - </message> - <message> - <location line="-218"/> - <source>Print the currently displayed page.</source> - <translation>Печатать отображаемую страницу.</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+206"/> - <location line="+1"/> - <source>Qt Assistant</source> - <translation>Qt Assistant</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui" line="+237"/> - <source>Qt Assistant Manual</source> - <translation>Руководство по Qt Assistant</translation> - </message> - <message> - <location line="-366"/> - <source>Qt Assistant by Nokia</source> - <translation>Qt Assistant от Nokia</translation> - </message> - <message> - <location line="+140"/> - <source>Quit Qt Assistant.</source> - <translation>Выйти из Qt Assistant.</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+460"/> - <location line="+6"/> - <source>Save Page</source> - <translation>Сохранить страницу</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui" line="+234"/> - <source>Save Page As...</source> - <translation>Сохранить страницу как...</translation> - </message> - <message> - <location line="+14"/> - <source>Select the page in contents tab.</source> - <translation>Выбрать страницу во вкладке оглавления.</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="-693"/> - <source>Sidebar</source> - <translation>Боковая панель</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui" line="-3"/> - <source>Sync with Table of Contents</source> - <translation>Синхронизировать с оглавлением</translation> - </message> - <message> - <location line="-380"/> - <source>Toolbar</source> - <translation>Панель инструментов</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+107"/> - <source>Views</source> - <translation>Виды</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui" line="+312"/> - <source>What's This?</source> - <translation>Что это?</translation> - </message> - <message> - <location line="-58"/> - <source>Zoom &in</source> - <translation>У&величить</translation> - </message> - <message> - <location line="+14"/> - <source>Zoom &out</source> - <translation>У&меньшить</translation> - </message> - <message> - <location line="-11"/> - <source>Zoom in on the document, i.e. increase the font size.</source> - <translation>Увеличить размер шрифта.</translation> - </message> - <message> - <location line="+14"/> - <source>Zoom out on the document, i.e. decrease the font size.</source> - <translation>Уменьшить размер шрифта.</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="-86"/> - <source>Ctrl+M</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+70"/> - <source>SHIFT+CTRL+=</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+4"/> - <source>Ctrl+T</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+I</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+B</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+S</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+]</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+[</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui" line="-144"/> - <source>Ctrl+P</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+11"/> - <source>Ctrl+Q</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+14"/> - <source>Copy the selected text to the clipboard.</source> - <translation>Скопировать выделенный текст в буфер обмена.</translation> - </message> - <message> - <location line="+3"/> - <source>Ctrl+C</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+14"/> - <source>Ctrl+F</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+8"/> - <source>F3</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+8"/> - <source>Shift+F3</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+14"/> - <source>Ctrl+Home</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+11"/> - <source>Go to the previous page.</source> - <translation>Переход на предыдущую страницу.</translation> - </message> - <message> - <location line="+3"/> - <source>Alt+Left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+14"/> - <source>Alt+Right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+33"/> - <source>Ctrl++</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+14"/> - <source>Ctrl+-</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+11"/> - <source>Ctrl+N</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+11"/> - <source>Ctrl+W</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+25"/> - <source>Shift+F1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+8"/> - <source>Ctrl+Alt+N</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+8"/> - <source>Ctrl+Alt+Right</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+8"/> - <source>Ctrl+Alt+Left</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+8"/> - <source>Ctrl+Alt+Q</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+11"/> - <source>F1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+8"/> - <source>Ctrl+Alt+S</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QObject</name> - <message> - <location filename="../tools/assistant/compat/config.cpp" line="+350"/> - <source>Qt Assistant by Nokia</source> - <translation>Qt Assistant от Nokia</translation> - </message> -</context> -<context> - <name>TabbedBrowser</name> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.cpp" line="+149"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.ui" line="+197"/> - <source><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped</source> - <translation><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Поиск с начала</translation> - </message> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.cpp" line="+86"/> - <source>Add page</source> - <translation>Добавить вкладку</translation> - </message> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.ui" line="-26"/> - <source>Case Sensitive</source> - <translation>Учитывать регистр</translation> - </message> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.cpp" line="+254"/> - <source>Close Other Tabs</source> - <translation>Закрыть остальные вкладки</translation> - </message> - <message> - <location line="-1"/> - <source>Close Tab</source> - <translation>Закрыть вкладку</translation> - </message> - <message> - <location line="-244"/> - <source>Close page</source> - <translation>Закрыть вкладку</translation> - </message> - <message> - <location line="+243"/> - <source>New Tab</source> - <translation>Новая вкладка</translation> - </message> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.ui" line="-19"/> - <source>Next</source> - <translation>Следующее</translation> - </message> - <message> - <location line="-22"/> - <source>Previous</source> - <translation>Предыдущее</translation> - </message> - <message> - <location line="-62"/> - <source>Untitled</source> - <translation>Безымянный</translation> - </message> - <message> - <location line="+110"/> - <source>Whole words</source> - <translation>Слова целиком</translation> - </message> - <message> - <location line="-123"/> - <source>TabbedBrowser</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>TopicChooser</name> - <message> - <location filename="../tools/assistant/compat/topicchooser.ui" line="+149"/> - <source>&Close</source> - <translation>&Закрыть</translation> - </message> - <message> - <location line="-16"/> - <source>&Display</source> - <translation>&Показать</translation> - </message> - <message> - <location line="-53"/> - <source>&Topics</source> - <translation>&Разделы</translation> - </message> - <message> - <location line="-27"/> - <source>Choose Topic</source> - <translation>Выбор раздела</translation> - </message> - <message> - <location filename="../tools/assistant/compat/topicchooser.cpp" line="+56"/> - <source>Choose a topic for <b>%1</b></source> - <translation>Выберите раздел для <b>%1</b></translation> - </message> - <message> - <location filename="../tools/assistant/compat/topicchooser.ui" line="+93"/> - <source>Close the Dialog.</source> - <translation>Закрыть диалог.</translation> - </message> - <message> - <location line="-56"/> - <source>Displays a list of available help topics for the keyword.</source> - <translation>Показывает список доступных разделов справки, найденных по ключевому слову.</translation> - </message> - <message> - <location line="+40"/> - <source>Open the topic selected in the list.</source> - <translation>Открыть выбранный раздел.</translation> - </message> - <message> - <location line="-74"/> - <source>Select a topic from the list and click the <b>Display</b>-button to open the online help.</source> - <translation>Выберите раздел из списка и нажмите на кнопку <b>Показать</b> для открытия онлайн справки.</translation> - </message> -</context> -</TS> diff --git a/translations/assistant_adp_zh_CN.ts b/translations/assistant_adp_zh_CN.ts deleted file mode 100644 index 2d8d85c9..0000000 --- a/translations/assistant_adp_zh_CN.ts +++ /dev/null @@ -1,999 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0" language="zh_CN"> -<context> - <name>AssistantServer</name> - <message> - <location filename="../tools/assistant/compat/main.cpp" line="+225"/> - <source>Qt Assistant</source> - <translation>Qt 助手</translation> - </message> - <message> - <location line="+1"/> - <source>Failed to bind to port %1</source> - <translation>绑定到端口%1失败</translation> - </message> -</context> -<context> - <name>FontPanel</name> - <message> - <location filename="../tools/shared/fontpanel/fontpanel.cpp" line="+63"/> - <source>Font</source> - <translation>字体</translation> - </message> - <message> - <location line="+11"/> - <source>&Writing system</source> - <translation>书写系统(&W)</translation> - </message> - <message> - <location line="+3"/> - <source>&Family</source> - <translation>字体族(&F)</translation> - </message> - <message> - <location line="+4"/> - <source>&Style</source> - <translation>风格(&S)</translation> - </message> - <message> - <location line="+4"/> - <source>&Point size</source> - <translation>点大小(&P)</translation> - </message> -</context> -<context> - <name>FontSettingsDialog</name> - <message> - <location filename="../tools/assistant/compat/fontsettingsdialog.cpp" line="+63"/> - <source>Font Settings</source> - <translation>字体设置</translation> - </message> - <message> - <location line="+7"/> - <source>Font settings for:</source> - <translation>字体设置用于:</translation> - </message> - <message> - <location line="+4"/> - <source>Browser</source> - <translation>浏览器</translation> - </message> - <message> - <location line="+1"/> - <source>Application</source> - <translation>应用程序</translation> - </message> - <message> - <location line="+6"/> - <source>Use custom settings</source> - <translation>使用自定义设置</translation> - </message> -</context> -<context> - <name>HelpDialog</name> - <message> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="+279"/> - <source>Open Link in Current Tab</source> - <translation>在当前标签页打开链接</translation> - </message> - <message> - <location line="+3"/> - <source>Open Link in New Window</source> - <translation>在新窗口中打开链接</translation> - </message> - <message> - <location line="+3"/> - <source>Open Link in New Tab</source> - <translation>在新标签页中打开链接</translation> - </message> - <message> - <location line="+73"/> - <location line="+82"/> - <source>Prepare...</source> - <translation>准备...</translation> - </message> - <message> - <location line="-64"/> - <location line="+16"/> - <location line="+661"/> - <source>Qt Assistant</source> - <translation>Qt 助手</translation> - </message> - <message> - <location line="-677"/> - <source>Failed to load keyword index file -Assistant will not work!</source> - <translation>加载关键词索引文件失败 -Qt 助手将不能工作!</translation> - </message> - <message> - <location line="+17"/> - <source>Cannot open the index file %1</source> - <translation>无法打开索引文件 %1</translation> - </message> - <message> - <location line="+58"/> - <location line="+124"/> - <location line="+8"/> - <source>Warning</source> - <translation>警告</translation> - </message> - <message> - <location line="-131"/> - <location line="+124"/> - <source>Documentation file %1 does not exist! -Skipping file.</source> - <translation>文档文件 %1 不存在! -跳过文件。</translation> - </message> - <message> - <location line="-112"/> - <location line="+133"/> - <source>Parse Error</source> - <translation>解析错误</translation> - </message> - <message> - <location line="-13"/> - <source>Documentation file %1 is not compatible! -Skipping file.</source> - <translation>%1 文档文件不兼容! -跳过文件!</translation> - </message> - <message> - <location line="+48"/> - <location line="+469"/> - <source>Done</source> - <translation>完成</translation> - </message> - <message> - <location line="-47"/> - <source>Failed to save fulltext search index -Assistant will not work!</source> - <translation>保存全文搜索索引失败 Qt 助手将不能工作!</translation> - </message> - <message> - <location line="+29"/> - <source>Indexing files...</source> - <translation>正在索引文件...</translation> - </message> - <message> - <location line="+15"/> - <source>Reading dictionary...</source> - <translation>正在读取词典...</translation> - </message> - <message> - <location line="+46"/> - <location line="+9"/> - <source>Full Text Search</source> - <translation>全文搜索</translation> - </message> - <message> - <location line="-8"/> - <source>Using a wildcard within phrases is not allowed.</source> - <translation>不允许在短语中使用通配符。</translation> - </message> - <message> - <location line="+9"/> - <source>The closing quotation mark is missing.</source> - <translation>缺少关闭标点。</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui"/> - <source>Help</source> - <translation>帮助</translation> - </message> - <message> - <location/> - <source><b>Help</b><p>Choose the topic you want help on from the contents list, or search the index for keywords.</p></source> - <translation><b>帮助</b><p>在内容列表中选择您需要帮助的主题,或者在索引中搜索这个关键词。</p></translation> - </message> - <message> - <location/> - <source>Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.</source> - <translation>按种类、索引和标签显示帮助主题。另一个标签页中可以执行全文搜索。</translation> - </message> - <message> - <location/> - <source>Con&tents</source> - <translation>内容(&T)</translation> - </message> - <message> - <location/> - <source><b>Help topics organized by category.</b><p>Double-click an item to see the topics in that category. To view a topic, just double-click it.</p></source> - <translation><b>按种类组织帮助主题。</b><p>双击一项可以查看那个种类中的主题。要查看一个主题,只要双击它就可以了。</p></translation> - </message> - <message> - <location/> - <source>column 1</source> - <translation>列 1</translation> - </message> - <message> - <location/> - <source>&Index</source> - <translation>索引(&I)</translation> - </message> - <message> - <location/> - <source>&Look For:</source> - <translation>查找(&L):</translation> - </message> - <message> - <location/> - <source>Enter keyword</source> - <translation>输入关键词</translation> - </message> - <message> - <location/> - <source><b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p></source> - <translation><b>输入一个关键词。</b><p>这个列表将会选择一个和已输入字符串最匹配的一项。</p></translation> - </message> - <message> - <location/> - <source><b>List of available help topics.</b><p>Double-click on an item to open its help page. If more than one is found, you must specify which page you want.</p></source> - <translation><b>可用的帮助主题列表。</b><p>双击一项打开它的帮助页面。如果找到一个以上的结果,你必须指定你想要打开哪一个。</p></translation> - </message> - <message> - <location/> - <source>&Bookmarks</source> - <translation>书签(&B)</translation> - </message> - <message> - <location/> - <source>Displays the list of bookmarks.</source> - <translation>显示书签列表。</translation> - </message> - <message> - <location/> - <source>Add new bookmark</source> - <translation>添加新书签</translation> - </message> - <message> - <location/> - <source>Add the currently displayed page as a new bookmark.</source> - <translation>把当前显示的页面添加为一个新书签。</translation> - </message> - <message> - <location/> - <source>&New</source> - <translation>新建(&N)</translation> - </message> - <message> - <location/> - <source>Delete bookmark</source> - <translation>删除书签</translation> - </message> - <message> - <location/> - <source>Delete the selected bookmark.</source> - <translation>删除被选中的书签。</translation> - </message> - <message> - <location/> - <source>&Delete</source> - <translation>删除(&D)</translation> - </message> - <message> - <location/> - <source>&Search</source> - <translation>搜索(&S)</translation> - </message> - <message> - <location/> - <source>Searching f&or:</source> - <translation>正在搜索(&O):</translation> - </message> - <message> - <location/> - <source>Enter searchword(s).</source> - <translation>输入搜索词。</translation> - </message> - <message> - <location/> - <source><b>Enter search word(s).</b><p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.</p></source> - <translation><b>输入搜索词。<b><p>在这里输入您要查找的词。这个词可以包含通配符(*)。如果是一个词的序列,请把它们放在英文引号内。</p></translation> - </message> - <message> - <location/> - <source><b>Found documents</b><p>This list contains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p></source> - <translation><b>发现文档</b><p>这个列表包含上此搜索发现的所有文档。这些文档已经排序,例如,第一个文档最为匹配。</p></translation> - </message> - <message> - <location/> - <source>Found &Documents:</source> - <translation>找到的文档(&D):</translation> - </message> - <message> - <location/> - <source>Display the help page.</source> - <translation>显示帮助页面。</translation> - </message> - <message> - <location/> - <source>Display the help page for the full text search.</source> - <translation>显示全文文本搜索的帮助页面。</translation> - </message> - <message> - <location/> - <source>He&lp</source> - <translation>帮助(&L)</translation> - </message> - <message> - <location/> - <source>Start searching.</source> - <translation>开始搜索。</translation> - </message> - <message> - <location/> - <source>Pressing this button starts the search.</source> - <translation>点击这个按钮开始搜索。</translation> - </message> - <message> - <location/> - <source>Preparing...</source> - <translation>正在准备...</translation> - </message> - <message numerus="yes"> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="+7"/> - <source>%n document(s) found.</source> - <translation> - <numerusform>%n 个文档已经找到。</numerusform> - </translation> - </message> -</context> -<context> - <name>HelpWindow</name> - <message> - <location filename="../tools/assistant/compat/helpwindow.cpp" line="+97"/> - <source>Help</source> - <translation>帮助</translation> - </message> - <message> - <location line="+1"/> - <source>Unable to launch web browser. -</source> - <translation>不能启动网页浏览器。 -</translation> - </message> - <message> - <location line="+28"/> - <source>Failed to open link: '%1'</source> - <translation>打开链接失败:“%1”</translation> - </message> - <message> - <location line="+1"/> - <source><div align="center"><h1>The page could not be found</h1><br><h3>'%1'</h3></div></source> - <translation><div align="center"><h1>没有找到这个页面</h1><br><h3>“%1”</h3></div></translation> - </message> - <message> - <location line="+2"/> - <source>Error...</source> - <translation>错误...</translation> - </message> - <message> - <location line="+61"/> - <source>Open Link in New Window Shift+LMB</source> - <translation>在新窗口中打开链接 Shift+LMB</translation> - </message> - <message> - <location line="-2"/> - <source>Open Link in New Tab</source> - <translation>在新标签页中打开链接</translation> - </message> - <message> - <location line="-89"/> - <source>OK</source> - <translation>确定</translation> - </message> - <message> - <location line="+86"/> - <source>Copy &Link Location</source> - <translation>复制链接地址(&L)</translation> - </message> -</context> -<context> - <name>Index</name> - <message> - <location filename="../tools/assistant/compat/index.cpp" line="+385"/> - <source>Untitled</source> - <translation>未命名的</translation> - </message> -</context> -<context> - <name>MainWindow</name> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+103"/> - <source>Sidebar</source> - <translation>侧栏</translation> - </message> - <message> - <location line="+18"/> - <source>&Window</source> - <translation>窗口(&W)</translation> - </message> - <message> - <location line="+2"/> - <source>Minimize</source> - <translation>最小化</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+M</source> - <translation>Ctrl+M</translation> - </message> - <message> - <location line="+34"/> - <source>Initializing Qt Assistant...</source> - <translation>正在初始化 Qt 助手...</translation> - </message> - <message> - <location line="+26"/> - <source>SHIFT+CTRL+=</source> - <translation>SHIFT+CTRL+=</translation> - </message> - <message> - <location line="+4"/> - <source>Ctrl+T</source> - <translation>Ctrl+T</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+I</source> - <translation>Ctrl+I</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+B</source> - <translation>Ctrl+B</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+S</source> - <translation>Ctrl+S</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Ctrl+W</source> - <translation>Ctrl+W</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+1"/> - <source>Ctrl+]</source> - <translation>Ctrl+]</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+[</source> - <translation>Ctrl+[</translation> - </message> - <message> - <location line="+7"/> - <source>Views</source> - <translation>视图</translation> - </message> - <message> - <location line="+80"/> - <source>Displays the main page of a specific documentation set.</source> - <translation>显示一个指定文档集的主页面。</translation> - </message> - <message> - <source>Open Source Edition</source> - <translation type="obsolete">开源版本</translation> - </message> - <message> - <source>This version of Qt Assistant is part of the Qt Open Source Edition, for use in the development of Open Source applications. Qt is a comprehensive C++ framework for cross-platform application development.</source> - <translation type="obsolete">这个版本的 Qt 助手是 Qt 开源版本的一部分,用于开发开源应用程序。Qt 是一个用于跨平台应用程序开发的综合 C++ 框架。</translation> - </message> - <message> - <source>This program is licensed to you under the terms of the Qt Commercial License Agreement. For details, see the file LICENSE that came with this software distribution.</source> - <translation type="obsolete">我们已经允许您在 Qt 商业许可协议下使用本程序。有关细节,请阅读本软件发行中所带的 LICENSE 文件。</translation> - </message> - <message> - <location line="+49"/> - <location line="+1"/> - <source>Qt Assistant</source> - <translation>Qt 助手</translation> - </message> - <message> - <location line="+19"/> - <source>Failed to open about application contents in file: '%1'</source> - <translation>在“%1”文件中打开应用程序内容失败</translation> - </message> - <message> - <location line="+201"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location line="+238"/> - <location line="+6"/> - <source>Save Page</source> - <translation>保存页面</translation> - </message> - <message> - <location line="+0"/> - <source>Cannot open file for writing!</source> - <translation>不能写打开文件!</translation> - </message> - <message> - <source>Qt Assistant by Trolltech</source> - <translation type="obsolete">Trolltech 的 Qt 助手</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Qt Assistant by Nokia</source> - <translation>Qt助手 - Nokia</translation> - </message> - <message> - <location/> - <source>Toolbar</source> - <translation>工具栏</translation> - </message> - <message> - <location/> - <source>Go</source> - <translation>前往</translation> - </message> - <message> - <location/> - <source>&Help</source> - <translation>帮助(&H)</translation> - </message> - <message> - <location/> - <source>&File</source> - <translation>文件(&F)</translation> - </message> - <message> - <location/> - <source>Boo&kmarks</source> - <translation>书签(&K)</translation> - </message> - <message> - <location/> - <source>&Go</source> - <translation>前往(&G)</translation> - </message> - <message> - <location/> - <source>&View</source> - <translation>查看(&V)</translation> - </message> - <message> - <location/> - <source>&Edit</source> - <translation>编辑(&E)</translation> - </message> - <message> - <location/> - <source>&Print...</source> - <translation>打印(&P)...</translation> - </message> - <message> - <location/> - <source>Print the currently displayed page.</source> - <translation>打印当前显示页面。</translation> - </message> - <message> - <location/> - <source>Ctrl+P</source> - <translation>Ctrl+P</translation> - </message> - <message> - <location/> - <source>E&xit</source> - <translation>退出(&X)</translation> - </message> - <message> - <location/> - <source>Quit Qt Assistant.</source> - <translation>退出 Qt 助手。</translation> - </message> - <message> - <location/> - <source>Ctrl+Q</source> - <translation>Ctrl+Q</translation> - </message> - <message> - <location/> - <source>&Copy</source> - <translation>复制(&C)</translation> - </message> - <message> - <location/> - <source>Copy the selected text to the clipboard.</source> - <translation>复制选中的文本到剪贴板。</translation> - </message> - <message> - <location/> - <source>Ctrl+C</source> - <translation>Ctrl+C</translation> - </message> - <message> - <location/> - <source>&Find in Text...</source> - <translation>在文本中查找(&F)...</translation> - </message> - <message> - <location/> - <source>Open the Find dialog. Qt Assistant will search the currently displayed page for the text you enter.</source> - <translation>打开查找对话框。Qt 助手将会在当前显示页面中搜索您输入的文本。</translation> - </message> - <message> - <location/> - <source>Ctrl+F</source> - <translation>Ctrl+F</translation> - </message> - <message> - <location/> - <source>Find &Next</source> - <translation>查找下一个(&N)</translation> - </message> - <message> - <location/> - <source>F3</source> - <translation>F3</translation> - </message> - <message> - <location/> - <source>Find &Previous</source> - <translation>查找上一个(&P)</translation> - </message> - <message> - <location/> - <source>Shift+F3</source> - <translation>Shift+F3</translation> - </message> - <message> - <location/> - <source>&Home</source> - <translation>主页(&H)</translation> - </message> - <message> - <location/> - <source>Go to the home page. Qt Assistant's home page is the Qt Reference Documentation.</source> - <translation>前往主页。Qt 助手的主页就是 Qt 参考文档。</translation> - </message> - <message> - <location/> - <source>Ctrl+Home</source> - <translation>Ctrl+Home</translation> - </message> - <message> - <location/> - <source>&Previous</source> - <translation>上一页(&P)</translation> - </message> - <message> - <location/> - <source>Go to the previous page.</source> - <translation>前往上一页。</translation> - </message> - <message> - <location/> - <source>Alt+Left</source> - <translation>Alt+Left</translation> - </message> - <message> - <location/> - <source>&Next</source> - <translation>下一页(&N)</translation> - </message> - <message> - <location/> - <source>Go to the next page.</source> - <translation>前往下一页。</translation> - </message> - <message> - <location/> - <source>Alt+Right</source> - <translation>Alt+Right</translation> - </message> - <message> - <location/> - <source>About Qt Assistant</source> - <translation>关于 Qt 助手</translation> - </message> - <message> - <location/> - <source>Display further information about Qt Assistant.</source> - <translation>显示有关 Qt 助手的更多信息。</translation> - </message> - <message> - <location/> - <source>About Qt</source> - <translation>关于 Qt</translation> - </message> - <message> - <location/> - <source>Zoom &in</source> - <translation>放大(&I)</translation> - </message> - <message> - <location/> - <source>Zoom in on the document, i.e. increase the font size.</source> - <translation>放大文档,也就是增大字体大小。</translation> - </message> - <message> - <location/> - <source>Ctrl++</source> - <translation>Ctrl++</translation> - </message> - <message> - <location/> - <source>Zoom &out</source> - <translation>缩小(&O)</translation> - </message> - <message> - <location/> - <source>Zoom out on the document, i.e. decrease the font size.</source> - <translation>缩小文档,也就是减小字体大小。</translation> - </message> - <message> - <location/> - <source>Ctrl+-</source> - <translation>Ctrl+-</translation> - </message> - <message> - <location/> - <source>New Window</source> - <translation>新建窗口</translation> - </message> - <message> - <location/> - <source>Open a new window.</source> - <translation>打开一个新窗口。</translation> - </message> - <message> - <location/> - <source>Ctrl+N</source> - <translation>Ctrl+N</translation> - </message> - <message> - <location/> - <source>&Close</source> - <translation>关闭(&C)</translation> - </message> - <message> - <location/> - <source>Close the current window.</source> - <translation>关闭当前窗口。</translation> - </message> - <message> - <location/> - <source>&Add Bookmark</source> - <translation>添加书签(&A)</translation> - </message> - <message> - <location/> - <source>Add the currently displayed page as a new bookmark.</source> - <translation>把当前显示页面添加为一个新书签。</translation> - </message> - <message> - <location/> - <source>What's This?</source> - <translation>这是什么?</translation> - </message> - <message> - <location/> - <source>"What's This?" context sensitive help.</source> - <translation>“这是什么?”上下文敏感帮助。</translation> - </message> - <message> - <location/> - <source>Shift+F1</source> - <translation>Shift+F1</translation> - </message> - <message> - <location/> - <source>Add Tab</source> - <translation>添加标签页</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+N</source> - <translation>Ctrl+Alt+N</translation> - </message> - <message> - <location/> - <source>Next Tab</source> - <translation>下一个标签页</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Right</source> - <translation>Ctrl+Alt+Right</translation> - </message> - <message> - <location/> - <source>Previous Tab</source> - <translation>前一个标签页</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Left</source> - <translation>Ctrl+Alt+Left</translation> - </message> - <message> - <location/> - <source>Close Tab</source> - <translation>关闭标签页</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Q</source> - <translation>Ctrl+Alt+Q</translation> - </message> - <message> - <location/> - <source>Qt Assistant Manual</source> - <translation>Qt 助手手册</translation> - </message> - <message> - <location/> - <source>F1</source> - <translation>F1</translation> - </message> - <message> - <location/> - <source>Save Page As...</source> - <translation>页面另存为...</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+S</source> - <translation>Ctrl+Alt+S</translation> - </message> - <message> - <location/> - <source>Sync with Table of Contents</source> - <translation>同步目录</translation> - </message> - <message> - <location/> - <source>Select the page in contents tab.</source> - <translation>选择内容标签页中的页面。</translation> - </message> - <message> - <location/> - <source>Font Settings...</source> - <translation>字体设置...</translation> - </message> - <message> - <source>You need a commercial Qt license for development of proprietary (closed source) applications. Please see <a href="http://qt.nokia.com/company/model">qt.nokia.com/company/model</a> for an overview of Qt licensing.</source> - <translation type="obsolete">开发商业(闭源)应用程序,你需要商业 Qt 许可。对于 Qt 许可的概览,请参考<a href="http://qt.nokia.com/company/model">qt.nokia.com/company/model</a>。</translation> - </message> - <message> - <source>This program is licensed to you under the terms of the Qt %1 License Agreement. For details, see the license file that came with this software distribution.</source> - <translation type="obsolete">我们已经允许您在 Qt %1 许可协议下使用本程序。有关细节,请阅读本软件发行中所带的许可协议文件。</translation> - </message> -</context> -<context> - <name>QObject</name> - <message> - <source>Qt Assistant by Trolltech</source> - <translation type="obsolete">Trolltech 的 Qt 助手</translation> - </message> - <message> - <location filename="../tools/assistant/compat/config.cpp" line="+350"/> - <source>Qt Assistant by Nokia</source> - <translation>Qt助手 - Nokia</translation> - </message> -</context> -<context> - <name>TabbedBrowser</name> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.cpp" line="+149"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location line="+86"/> - <source>Add page</source> - <translation>添加页面</translation> - </message> - <message> - <location line="+9"/> - <source>Close page</source> - <translation>关闭页面</translation> - </message> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.ui"/> - <source>TabbedBrowser</source> - <translation>标签页浏览器</translation> - </message> - <message> - <location/> - <source>Untitled</source> - <translation>未命名的</translation> - </message> - <message> - <location/> - <source>Previous</source> - <translation>上一个</translation> - </message> - <message> - <location/> - <source>Next</source> - <translation>下一个</translation> - </message> - <message> - <location/> - <source>Case Sensitive</source> - <translation>区分大小写</translation> - </message> - <message> - <location/> - <source>Whole words</source> - <translation>整词</translation> - </message> - <message> - <location/> - <source><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped</source> - <translation><img src=":/trolltech/assistant/images/wrap.png">&nbsp;搜索已经回环</translation> - </message> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.cpp" line="+243"/> - <source>New Tab</source> - <translation>新标签页</translation> - </message> - <message> - <location line="+1"/> - <source>Close Tab</source> - <translation>关闭标签页</translation> - </message> - <message> - <location line="+1"/> - <source>Close Other Tabs</source> - <translation>关闭其它标签页</translation> - </message> -</context> -<context> - <name>TopicChooser</name> - <message> - <location filename="../tools/assistant/compat/topicchooser.cpp" line="+56"/> - <source>Choose a topic for <b>%1</b></source> - <translation>为<b>%1</b>选择一个主题</translation> - </message> - <message> - <location filename="../tools/assistant/compat/topicchooser.ui"/> - <source>Choose Topic</source> - <translation>选择主题</translation> - </message> - <message> - <location/> - <source>Select a topic from the list and click the <b>Display</b>-button to open the online help.</source> - <translation>从列表中选择一个主题并且点击<b>显示</b>按钮打开在线帮助。</translation> - </message> - <message> - <location/> - <source>&Topics</source> - <translation>主题(&T)</translation> - </message> - <message> - <location/> - <source>Displays a list of available help topics for the keyword.</source> - <translation>为这个关键词显示一个可用帮助主题的列表。</translation> - </message> - <message> - <location/> - <source>&Display</source> - <translation>显示(&D)</translation> - </message> - <message> - <location/> - <source>Open the topic selected in the list.</source> - <translation>打开列表中选中的主题。</translation> - </message> - <message> - <location/> - <source>&Close</source> - <translation>关闭(&C)</translation> - </message> - <message> - <location/> - <source>Close the Dialog.</source> - <translation>关闭对话框。</translation> - </message> -</context> -</TS> diff --git a/translations/assistant_adp_zh_TW.ts b/translations/assistant_adp_zh_TW.ts deleted file mode 100644 index d622d11..0000000 --- a/translations/assistant_adp_zh_TW.ts +++ /dev/null @@ -1,1000 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS> -<TS version="2.0" language="zh_TW"> -<context> - <name>AssistantServer</name> - <message> - <location filename="../tools/assistant/compat/main.cpp" line="+225"/> - <source>Qt Assistant</source> - <translation>Qt 小幫手</translation> - </message> - <message> - <location line="+1"/> - <source>Failed to bind to port %1</source> - <translation>無法結合連接埠 %1</translation> - </message> -</context> -<context> - <name>FontPanel</name> - <message> - <location filename="../tools/shared/fontpanel/fontpanel.cpp" line="+63"/> - <source>Font</source> - <translation>字型</translation> - </message> - <message> - <location line="+11"/> - <source>&Writing system</source> - <translation>寫入系統(&W)</translation> - </message> - <message> - <location line="+3"/> - <source>&Family</source> - <translation>家族(&F)</translation> - </message> - <message> - <location line="+4"/> - <source>&Style</source> - <translation>風格(&S)</translation> - </message> - <message> - <location line="+4"/> - <source>&Point size</source> - <translation>點大小(&P)</translation> - </message> -</context> -<context> - <name>FontSettingsDialog</name> - <message> - <location filename="../tools/assistant/compat/fontsettingsdialog.cpp" line="+63"/> - <source>Font Settings</source> - <translation>字型設定</translation> - </message> - <message> - <location line="+7"/> - <source>Font settings for:</source> - <translation>字型設定用於:</translation> - </message> - <message> - <location line="+4"/> - <source>Browser</source> - <translation>瀏覽器</translation> - </message> - <message> - <location line="+1"/> - <source>Application</source> - <translation>應用程式</translation> - </message> - <message> - <location line="+6"/> - <source>Use custom settings</source> - <translation>使用者自訂設定</translation> - </message> -</context> -<context> - <name>HelpDialog</name> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui"/> - <source>Con&tents</source> - <translation>內容(&T)</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="+376"/> - <location line="+16"/> - <location line="+661"/> - <source>Qt Assistant</source> - <translation>Qt 小幫手</translation> - </message> - <message> - <location line="-774"/> - <source>Open Link in Current Tab</source> - <translation>在目前的分頁開啟連結</translation> - </message> - <message> - <location line="+3"/> - <source>Open Link in New Window</source> - <translation>在新視窗開啟連結</translation> - </message> - <message> - <location line="+3"/> - <source>Open Link in New Tab</source> - <translation>在新分頁開啟連結</translation> - </message> - <message> - <location line="+73"/> - <location line="+82"/> - <source>Prepare...</source> - <translation>準備中...</translation> - </message> - <message> - <location line="-64"/> - <source>Failed to load keyword index file -Assistant will not work!</source> - <translation>無法載入關鍵字索引檔 -小幫手將無法運作!</translation> - </message> - <message> - <location line="+17"/> - <source>Cannot open the index file %1</source> - <translation>無法開啟索引檔 %1</translation> - </message> - <message> - <location line="+58"/> - <location line="+124"/> - <location line="+8"/> - <source>Warning</source> - <translation>警告</translation> - </message> - <message> - <location line="-131"/> - <location line="+124"/> - <source>Documentation file %1 does not exist! -Skipping file.</source> - <translation>文件檔 %1 不存在 -將跳過此檔案。</translation> - </message> - <message> - <location line="-112"/> - <location line="+133"/> - <source>Parse Error</source> - <translation>剖析錯誤</translation> - </message> - <message> - <location line="-13"/> - <source>Documentation file %1 is not compatible! -Skipping file.</source> - <translation>文件檔 %1 不相容 -將跳過此檔案。</translation> - </message> - <message> - <location line="+48"/> - <location line="+469"/> - <source>Done</source> - <translation>完成</translation> - </message> - <message> - <location line="-47"/> - <source>Failed to save fulltext search index -Assistant will not work!</source> - <translation>無法儲存全文檢索搜尋索引。 -小幫手將無法運作!</translation> - </message> - <message> - <location line="+29"/> - <source>Indexing files...</source> - <translation>建立檔案索引中...</translation> - </message> - <message> - <location line="+15"/> - <source>Reading dictionary...</source> - <translation>讀取字典中...</translation> - </message> - <message> - <location line="+46"/> - <location line="+9"/> - <source>Full Text Search</source> - <translation>全文檢索</translation> - </message> - <message> - <location line="-8"/> - <source>Using a wildcard within phrases is not allowed.</source> - <translation>在片語中不能使用萬用字元。</translation> - </message> - <message> - <location line="+9"/> - <source>The closing quotation mark is missing.</source> - <translation>沒有關閉引號。</translation> - </message> - <message> - <location filename="../tools/assistant/compat/helpdialog.ui"/> - <source>Help</source> - <translation>說明</translation> - </message> - <message> - <location/> - <source><b>Help</b><p>Choose the topic you want help on from the contents list, or search the index for keywords.</p></source> - <translation><b>說明</b><p>請從內容清單中選擇您需要說明的主題,或是在索引中搜尋關鍵字。</p></translation> - </message> - <message> - <location/> - <source>Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.</source> - <translation>依分類、索引或書籤來顯示說明主題。另一個分頁會繼承此全文檢索。</translation> - </message> - <message> - <location/> - <source><b>Help topics organized by category.</b><p>Double-click an item to see the topics in that category. To view a topic, just double-click it.</p></source> - <translation><b>依類別組織說明主題。</b><p>雙擊可以查看該類別中有哪些主題。雙擊該主題可以查看內容。</p></translation> - </message> - <message> - <location/> - <source>column 1</source> - <translation>欄 1</translation> - </message> - <message> - <location/> - <source>&Index</source> - <translation>索引(&I)</translation> - </message> - <message> - <location/> - <source>&Look For:</source> - <translation>搜尋(&L):</translation> - </message> - <message> - <location/> - <source>Enter keyword</source> - <translation>輸入關鍵字</translation> - </message> - <message> - <location/> - <source><b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p></source> - <translation><b>輸入關鍵字。</b><p>此清單可以選擇最能符合輸入字串的項目。</p></translation> - </message> - <message> - <location/> - <source><b>List of available help topics.</b><p>Double-click on an item to open its help page. If more than one is found, you must specify which page you want.</p></source> - <translation><b>可用說明主題清單。</b><p>雙擊可以開啟該說明頁面。如果找到一個以上,您必須指定您要看哪一個頁面。</p></translation> - </message> - <message> - <location/> - <source>&Bookmarks</source> - <translation>書籤(&B)</translation> - </message> - <message> - <location/> - <source>Displays the list of bookmarks.</source> - <translation>顯示書籤的清單。</translation> - </message> - <message> - <location/> - <source>Add new bookmark</source> - <translation>新增書籤</translation> - </message> - <message> - <location/> - <source>Add the currently displayed page as a new bookmark.</source> - <translation>將目前顯示的頁面新增到書籤中。</translation> - </message> - <message> - <location/> - <source>&New</source> - <translation>新增(&N)</translation> - </message> - <message> - <location/> - <source>Delete bookmark</source> - <translation>刪除書籤</translation> - </message> - <message> - <location/> - <source>Delete the selected bookmark.</source> - <translation>刪除選取的書籤。</translation> - </message> - <message> - <location/> - <source>&Delete</source> - <translation>刪除(&D)</translation> - </message> - <message> - <location/> - <source>&Search</source> - <translation>搜尋(&S)</translation> - </message> - <message> - <location/> - <source>Searching f&or:</source> - <translation>搜尋內容(&O):</translation> - </message> - <message> - <location/> - <source>Enter searchword(s).</source> - <translation>請輸入搜尋關鍵字詞。</translation> - </message> - <message> - <location/> - <source><b>Enter search word(s).</b><p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.</p></source> - <translation><b>輸入搜尋關鍵字詞。</b><p>在此輸入您要搜尋的關鍵字詞。可以使用萬用字元 (*)。如果是一個片語,請用引號括起來。</p></translation> - </message> - <message> - <location/> - <source><b>Found documents</b><p>This list contains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p></source> - <translation><b>找到的文件</b><p>這放清單包含了所有上次搜尋找到的文件。文件會依符合程度排序。</p></translation> - </message> - <message> - <location/> - <source>Found &Documents:</source> - <translation>找到的文件(&D):</translation> - </message> - <message> - <location/> - <source>Display the help page.</source> - <translation>顯示說明頁面。</translation> - </message> - <message> - <location/> - <source>Display the help page for the full text search.</source> - <translation>顯示全文檢索的說明頁面。</translation> - </message> - <message> - <location/> - <source>He&lp</source> - <translation>說明(&L)</translation> - </message> - <message> - <location/> - <source>Start searching.</source> - <translation>開始搜尋。</translation> - </message> - <message> - <location/> - <source>Pressing this button starts the search.</source> - <translation>按下此按鍵開始搜尋。</translation> - </message> - <message> - <location/> - <source>Preparing...</source> - <translation>準備中...</translation> - </message> - <message numerus="yes"> - <location filename="../tools/assistant/compat/helpdialog.cpp" line="+7"/> - <source>%n document(s) found.</source> - <translation> - <numerusform>找到 %n 個文件。</numerusform> - </translation> - </message> -</context> -<context> - <name>HelpWindow</name> - <message> - <location filename="../tools/assistant/compat/helpwindow.cpp" line="+97"/> - <source>Help</source> - <translation>說明</translation> - </message> - <message> - <location line="+93"/> - <source>Open Link in New Window Shift+LMB</source> - <translation>在新視窗開啟連結 Shift+滑鼠左鍵</translation> - </message> - <message> - <location line="-92"/> - <source>Unable to launch web browser. -</source> - <translation>無法啟動瀏覽器。 -</translation> - </message> - <message> - <location line="+1"/> - <source>OK</source> - <translation>確定</translation> - </message> - <message> - <location line="+27"/> - <source>Failed to open link: '%1'</source> - <translation>無法開啟連結:%1</translation> - </message> - <message> - <location line="+1"/> - <source><div align="center"><h1>The page could not be found</h1><br><h3>'%1'</h3></div></source> - <translation><div align="center"><h1>找不到該頁面</h1><br><h3>%1</h3></div></translation> - </message> - <message> - <location line="+2"/> - <source>Error...</source> - <translation>錯誤...</translation> - </message> - <message> - <location line="+59"/> - <source>Open Link in New Tab</source> - <translation>在新分頁開啟連結</translation> - </message> - <message> - <location line="-3"/> - <source>Copy &Link Location</source> - <translation>複製連結位置(&L)</translation> - </message> -</context> -<context> - <name>Index</name> - <message> - <location filename="../tools/assistant/compat/index.cpp" line="+385"/> - <source>Untitled</source> - <translation>未命名</translation> - </message> -</context> -<context> - <name>MainWindow</name> - <message> - <source>Qt Assistant by Trolltech</source> - <translation type="obsolete">Qt 小幫手,Trolltech 公司提供</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Toolbar</source> - <translation>工具列</translation> - </message> - <message> - <location/> - <source>&Print...</source> - <translation>列印(&P)...</translation> - </message> - <message> - <location/> - <source>E&xit</source> - <translation>離開(&X)</translation> - </message> - <message> - <location/> - <source>&Copy</source> - <translation>複製(&C)</translation> - </message> - <message> - <location/> - <source>&Find in Text...</source> - <translation>在文字中尋找(&F)...</translation> - </message> - <message> - <location/> - <source>&Home</source> - <translation>首頁(&H)</translation> - </message> - <message> - <location/> - <source>&Previous</source> - <translation>前一個(&P)</translation> - </message> - <message> - <location/> - <source>&Next</source> - <translation>下一個(&N)</translation> - </message> - <message> - <location/> - <source>About Qt</source> - <translation>關於 Qt</translation> - </message> - <message> - <location/> - <source>Zoom &in</source> - <translation>放大(&I)</translation> - </message> - <message> - <location/> - <source>Zoom &out</source> - <translation>縮小(&O)</translation> - </message> - <message> - <location/> - <source>New Window</source> - <translation>新視窗</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+188"/> - <source>Ctrl+T</source> - <translation>Ctrl+T</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+I</source> - <translation>Ctrl+I</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+B</source> - <translation>Ctrl+B</translation> - </message> - <message> - <location line="+139"/> - <location line="+1"/> - <source>Qt Assistant</source> - <translation>Qt 小幫手</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>&Add Bookmark</source> - <translation>新增書籤(&A)</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="-227"/> - <source>Sidebar</source> - <translation>邊列</translation> - </message> - <message> - <location line="+18"/> - <source>&Window</source> - <translation>視窗(&W)</translation> - </message> - <message> - <location line="+2"/> - <source>Minimize</source> - <translation>最小化</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+M</source> - <translation>Ctrl+M</translation> - </message> - <message> - <location line="+34"/> - <source>Initializing Qt Assistant...</source> - <translation>初始化 Qt 小幫手中...</translation> - </message> - <message> - <location line="+26"/> - <source>SHIFT+CTRL+=</source> - <translation>SHIFT+CTRL+=</translation> - </message> - <message> - <location line="+7"/> - <source>Ctrl+S</source> - <translation>Ctrl+S</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Ctrl+W</source> - <translation>Ctrl+W</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.cpp" line="+1"/> - <source>Ctrl+]</source> - <translation>Ctrl+]</translation> - </message> - <message> - <location line="+1"/> - <source>Ctrl+[</source> - <translation>Ctrl+[</translation> - </message> - <message> - <location line="+7"/> - <source>Views</source> - <translation>檢視</translation> - </message> - <message> - <location line="+80"/> - <source>Displays the main page of a specific documentation set.</source> - <translation>顯示指定文件集的主頁面。</translation> - </message> - <message> - <source>Open Source Edition</source> - <translation type="obsolete">開放源碼版本</translation> - </message> - <message> - <source>This version of Qt Assistant is part of the Qt Open Source Edition, for use in the development of Open Source applications. Qt is a comprehensive C++ framework for cross-platform application development.</source> - <translation type="obsolete">此版本的 Qt 小幫手是 Qt 開放源碼版本的一部份,只能用於開發開放源碼的應用程式。Qt 為一個跨平台的,強大的 C++ 應用程式開發框架。</translation> - </message> - <message> - <source>This program is licensed to you under the terms of the Qt Commercial License Agreement. For details, see the file LICENSE that came with this software distribution.</source> - <translation type="obsolete">此程式以 Qt 商業授權同意書(Qt Commerical License Agreement)授權給您。詳情請參照 LICENSE 檔。</translation> - </message> - <message> - <location line="+69"/> - <source>Failed to open about application contents in file: '%1'</source> - <translation>無法開啟檔案中應用程式的「關於」內容:%1</translation> - </message> - <message> - <location line="+201"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location line="+238"/> - <location line="+6"/> - <source>Save Page</source> - <translation>儲存頁面</translation> - </message> - <message> - <location line="+0"/> - <source>Cannot open file for writing!</source> - <translation>無法開啟檔案以寫入!</translation> - </message> - <message> - <location filename="../tools/assistant/compat/mainwindow.ui"/> - <source>Qt Assistant by Nokia</source> - <translation>Nokia 提供的 Qt 小幫手</translation> - </message> - <message> - <location/> - <source>Go</source> - <translation>走</translation> - </message> - <message> - <location/> - <source>&Help</source> - <translation>說明(&H)</translation> - </message> - <message> - <location/> - <source>&File</source> - <translation>檔案(&F)</translation> - </message> - <message> - <location/> - <source>Boo&kmarks</source> - <translation>書籤(&K)</translation> - </message> - <message> - <location/> - <source>&Go</source> - <translation>走(&G)</translation> - </message> - <message> - <location/> - <source>&View</source> - <translation>檢視(&V)</translation> - </message> - <message> - <location/> - <source>&Edit</source> - <translation>編輯(&E)</translation> - </message> - <message> - <location/> - <source>Print the currently displayed page.</source> - <translation>列印目前顯示的頁面。</translation> - </message> - <message> - <location/> - <source>Ctrl+P</source> - <translation>Ctrl+P</translation> - </message> - <message> - <location/> - <source>Quit Qt Assistant.</source> - <translation>離開 Qt 小幫手。</translation> - </message> - <message> - <location/> - <source>Ctrl+Q</source> - <translation>Ctrl+Q</translation> - </message> - <message> - <location/> - <source>Copy the selected text to the clipboard.</source> - <translation>複製選取的文字到剪貼簿中。</translation> - </message> - <message> - <location/> - <source>Ctrl+C</source> - <translation>Ctrl+C</translation> - </message> - <message> - <location/> - <source>Open the Find dialog. Qt Assistant will search the currently displayed page for the text you enter.</source> - <translation>開啟「尋找」對話框。Qt 小幫手會在目前顯示的頁面中搜尋您所輸入的文字。</translation> - </message> - <message> - <location/> - <source>Ctrl+F</source> - <translation>Ctrl+F</translation> - </message> - <message> - <location/> - <source>Find &Next</source> - <translation>尋找下一筆(&N)</translation> - </message> - <message> - <location/> - <source>F3</source> - <translation>F3</translation> - </message> - <message> - <location/> - <source>Find &Previous</source> - <translation>尋找上一筆(&P)</translation> - </message> - <message> - <location/> - <source>Shift+F3</source> - <translation>Shift+F3</translation> - </message> - <message> - <location/> - <source>Go to the home page. Qt Assistant's home page is the Qt Reference Documentation.</source> - <translation>回到首頁。Qt 小幫手的首頁為 Qt 參考文件。</translation> - </message> - <message> - <location/> - <source>Ctrl+Home</source> - <translation>Ctrl+Home</translation> - </message> - <message> - <location/> - <source>Go to the previous page.</source> - <translation>跳到上一頁。</translation> - </message> - <message> - <location/> - <source>Alt+Left</source> - <translation>Alt+Left</translation> - </message> - <message> - <location/> - <source>Go to the next page.</source> - <translation>跳到下一頁。</translation> - </message> - <message> - <location/> - <source>Alt+Right</source> - <translation>Alt+Right</translation> - </message> - <message> - <location/> - <source>About Qt Assistant</source> - <translation>關於 Qt 小幫手</translation> - </message> - <message> - <location/> - <source>Display further information about Qt Assistant.</source> - <translation>顯示關於 Qt 小幫手的詳情。</translation> - </message> - <message> - <location/> - <source>Zoom in on the document, i.e. increase the font size.</source> - <translation>放大文件,也就是加大字型。</translation> - </message> - <message> - <location/> - <source>Ctrl++</source> - <translation>Ctrl++</translation> - </message> - <message> - <location/> - <source>Zoom out on the document, i.e. decrease the font size.</source> - <translation>縮小文件,也就是縮小字型。</translation> - </message> - <message> - <location/> - <source>Ctrl+-</source> - <translation>Ctrl+-</translation> - </message> - <message> - <location/> - <source>Open a new window.</source> - <translation>開啟新視窗。</translation> - </message> - <message> - <location/> - <source>Ctrl+N</source> - <translation>Ctrl+N</translation> - </message> - <message> - <location/> - <source>&Close</source> - <translation>關閉(&C)</translation> - </message> - <message> - <location/> - <source>Close the current window.</source> - <translation>關閉目前的視窗。</translation> - </message> - <message> - <location/> - <source>Add the currently displayed page as a new bookmark.</source> - <translation>將目前顯示的頁面新增到書籤中。</translation> - </message> - <message> - <location/> - <source>What's This?</source> - <translation>這是什麼?</translation> - </message> - <message> - <location/> - <source>"What's This?" context sensitive help.</source> - <translation>「這是什麼?」內文說明。</translation> - </message> - <message> - <location/> - <source>Shift+F1</source> - <translation>Shift+F1</translation> - </message> - <message> - <location/> - <source>Add Tab</source> - <translation>新增分頁</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+N</source> - <translation>Ctrl+Alt+N</translation> - </message> - <message> - <location/> - <source>Next Tab</source> - <translation>下一個分頁</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Right</source> - <translation>Ctrl+Alt+Right</translation> - </message> - <message> - <location/> - <source>Previous Tab</source> - <translation>前一個分頁</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Left</source> - <translation>Ctrl+Alt+Left</translation> - </message> - <message> - <location/> - <source>Close Tab</source> - <translation>關閉分頁</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+Q</source> - <translation>Ctrl+Alt+Q</translation> - </message> - <message> - <location/> - <source>Qt Assistant Manual</source> - <translation>Qt 小幫手手冊</translation> - </message> - <message> - <location/> - <source>F1</source> - <translation>F1</translation> - </message> - <message> - <location/> - <source>Save Page As...</source> - <translation>另存頁面為...</translation> - </message> - <message> - <location/> - <source>Ctrl+Alt+S</source> - <translation>Ctrl+Alt+S</translation> - </message> - <message> - <location/> - <source>Sync with Table of Contents</source> - <translation>與目錄同步</translation> - </message> - <message> - <location/> - <source>Select the page in contents tab.</source> - <translation>選擇在內容分頁中的頁面。</translation> - </message> - <message> - <location/> - <source>Font Settings...</source> - <translation>字型設定...</translation> - </message> - <message> - <source>You need a commercial Qt license for development of proprietary (closed source) applications. Please see <a href="http://qt.nokia.com/company/model">qt.nokia.com/company/model</a> for an overview of Qt licensing.</source> - <translation type="obsolete">您需要商業版的 Qt 授權才能發展私有(封閉)應用程式軟體。關於 Qt 授權的概要,請參考 <a href="http://qt.nokia.com/company/model">qt.nokia.com/company/model</a>。</translation> - </message> - <message> - <source>This program is licensed to you under the terms of the Qt %1 License Agreement. For details, see the license file that came with this software distribution.</source> - <translation type="obsolete">此程式以 Qt %1 授權同意書授權給您。詳情請參照套件中的授權檔。</translation> - </message> -</context> -<context> - <name>QObject</name> - <message> - <source>Qt Assistant by Trolltech</source> - <translation type="obsolete">Qt 小幫手,Trolltech 公司提供</translation> - </message> - <message> - <location filename="../tools/assistant/compat/config.cpp" line="+350"/> - <source>Qt Assistant by Nokia</source> - <translation>Nokia 提供的 Qt 小幫手</translation> - </message> -</context> -<context> - <name>TabbedBrowser</name> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.cpp" line="+149"/> - <source>...</source> - <translation>...</translation> - </message> - <message> - <location line="+86"/> - <source>Add page</source> - <translation>新增頁面</translation> - </message> - <message> - <location line="+9"/> - <source>Close page</source> - <translation>關閉頁面</translation> - </message> - <message> - <location line="+243"/> - <source>New Tab</source> - <translation>新增分頁</translation> - </message> - <message> - <location line="+1"/> - <source>Close Tab</source> - <translation>關閉分頁</translation> - </message> - <message> - <location line="+1"/> - <source>Close Other Tabs</source> - <translation>關閉其他分頁</translation> - </message> - <message> - <location filename="../tools/assistant/compat/tabbedbrowser.ui"/> - <source>TabbedBrowser</source> - <translation>分頁式瀏覽器</translation> - </message> - <message> - <location/> - <source>Untitled</source> - <translation>未命名</translation> - </message> - <message> - <location/> - <source>Previous</source> - <translation>前一個</translation> - </message> - <message> - <location/> - <source>Next</source> - <translation>下一個</translation> - </message> - <message> - <location/> - <source>Case Sensitive</source> - <translation>區分大小寫</translation> - </message> - <message> - <location/> - <source>Whole words</source> - <translation>整個字詞</translation> - </message> - <message> - <location/> - <source><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped</source> - <translation><img src=":/trolltech/assistant/images/wrap.png">&nbsp;搜尋已折回</translation> - </message> -</context> -<context> - <name>TopicChooser</name> - <message> - <location filename="../tools/assistant/compat/topicchooser.cpp" line="+56"/> - <source>Choose a topic for <b>%1</b></source> - <translation>請為 <b>%1</b> 選擇一個主題</translation> - </message> - <message> - <location filename="../tools/assistant/compat/topicchooser.ui"/> - <source>Choose Topic</source> - <translation>選擇主題</translation> - </message> - <message> - <location/> - <source>Select a topic from the list and click the <b>Display</b>-button to open the online help.</source> - <translation>請從清單中選取一個主題,並按下「顯示」鍵開啟線上說明。</translation> - </message> - <message> - <location/> - <source>&Topics</source> - <translation>主題(&T)</translation> - </message> - <message> - <location/> - <source>Displays a list of available help topics for the keyword.</source> - <translation>顯示此關鍵字可用的說明主題。</translation> - </message> - <message> - <location/> - <source>&Display</source> - <translation>顯示(&D)</translation> - </message> - <message> - <location/> - <source>Open the topic selected in the list.</source> - <translation>開啟在清單中選取的主題。</translation> - </message> - <message> - <location/> - <source>&Close</source> - <translation>關閉(&C)</translation> - </message> - <message> - <location/> - <source>Close the Dialog.</source> - <translation>關閉對話框。</translation> - </message> -</context> -</TS> diff --git a/translations/translations.pri b/translations/translations.pri index 8896654..2b97a14 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -57,9 +57,7 @@ ts-linguist.depends = sub-tools ts-assistant.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ ../tools/assistant/translations/translations.pro \ && $$LUPDATE \ - ../tools/assistant/translations/qt_help.pro \ - && $$LUPDATE \ - ../tools/assistant/translations/translations_adp.pro) + ../tools/assistant/translations/qt_help.pro)) ts-assistant.depends = sub-tools ###### Qtconfig |