diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 15:17:53 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 15:17:53 -0500 |
commit | dda8474928bd7276e1fad8fb7a601e7c83ff2bc2 (patch) | |
tree | 7f83910598b33b12730035f086df20b5a53ab99c /tqtinterface/qt4/tools/assistant | |
parent | 6260b6178868c03aab1644bf93b0ef043654bdb0 (diff) | |
download | experimental-dda8474928bd7276e1fad8fb7a601e7c83ff2bc2.tar.gz experimental-dda8474928bd7276e1fad8fb7a601e7c83ff2bc2.zip |
Added TQt4 HEAD
Diffstat (limited to 'tqtinterface/qt4/tools/assistant')
66 files changed, 10710 insertions, 0 deletions
diff --git a/tqtinterface/qt4/tools/assistant/LICENSE.GPL b/tqtinterface/qt4/tools/assistant/LICENSE.GPL new file mode 100644 index 0000000..149f4ac --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/LICENSE.GPL @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which tqcontains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part tqcontains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it tqcontains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/tqtinterface/qt4/tools/assistant/assistant.icns b/tqtinterface/qt4/tools/assistant/assistant.icns Binary files differnew file mode 100644 index 0000000..a6dbcdd --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/assistant.icns diff --git a/tqtinterface/qt4/tools/assistant/assistant.ico b/tqtinterface/qt4/tools/assistant/assistant.ico Binary files differnew file mode 100644 index 0000000..eb43249 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/assistant.ico diff --git a/tqtinterface/qt4/tools/assistant/assistant.pro b/tqtinterface/qt4/tools/assistant/assistant.pro new file mode 100644 index 0000000..1d8ba5c --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/assistant.pro @@ -0,0 +1,72 @@ +TEMPLATE = app +LANGUAGE = C++ +TARGET = assistant + +CONFIG += qt warn_off + +PROJECTNAME = Assistant +DESTDIR = ../../bin + +SOURCES += main.cpp \ + helpwindow.cpp \ + topicchooserimpl.cpp \ + docuparser.cpp \ + helpdialogimpl.cpp \ + settingsdialogimpl.cpp \ + index.cpp \ + profile.cpp \ + config.cpp + +HEADERS += helpwindow.h \ + topicchooserimpl.h \ + docuparser.h \ + helpdialogimpl.h \ + settingsdialogimpl.h \ + index.h \ + profile.h \ + config.h + +#DEFINES += QT_PALMTOPCENTER_DOCS +DEFINES += QT_INTERNAL_NETWORK QT_INTERNAL_XML +include( ../../src/qt_professional.pri ) + +win32:RC_FILE = assistant.rc +mac:RC_FILE = assistant.icns + +target.path = $$bins.path +INSTALLS += target + +assistanttranslations.files = *.qm +assistanttranslations.path = $$translations.path +INSTALLS += assistanttranslations + +TRANSLATIONS = assistant_de.ts \ + assistant_fr.ts + +unix:!zlib:LIBS += -lz + +FORMS = mainwindow.ui \ + topicchooser.ui \ + finddialog.ui \ + helpdialog.ui \ + settingsdialog.ui \ + tabbedbrowser.ui +IMAGES = images/editcopy.png \ + images/find.png \ + images/home.png \ + images/next.png \ + images/previous.png \ + images/print.png \ + images/whatsthis.xpm \ + images/book.png \ + images/designer.png \ + images/assistant.png \ + images/linguist.png \ + images/qt.png \ + images/zoomin.png \ + images/zoomout.png \ + images/splash.png \ + images/appicon.png \ + images/addtab.png \ + images/closetab.png \ + images/d_closetab.png diff --git a/tqtinterface/qt4/tools/assistant/assistant.rc b/tqtinterface/qt4/tools/assistant/assistant.rc new file mode 100644 index 0000000..b4786ce --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/assistant.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "assistant.ico" diff --git a/tqtinterface/qt4/tools/assistant/assistant_de.qm b/tqtinterface/qt4/tools/assistant/assistant_de.qm Binary files differnew file mode 100644 index 0000000..c50e90f --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/assistant_de.qm diff --git a/tqtinterface/qt4/tools/assistant/assistant_de.ts b/tqtinterface/qt4/tools/assistant/assistant_de.ts new file mode 100644 index 0000000..ed4c994 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/assistant_de.ts @@ -0,0 +1,1084 @@ +<!DOCTYPE TS><TS> +<context> + <name>Assistant</name> + <message> + <source>Welcome to the <b>Qt Assistant</b>. Qt Assistant will give you quicker access to help and tips while using applications like Qt Designer.</source> + <translation type="obsolete">Wilkommen bei <b>Qt Assistant</b>. Qt Assistant ermöglicht einen schnellen Zugriff der Onlinehilfe während dem Arbeiten mit Programmen wie dem Qt Designer.</translation> + </message> + <message> + <source>Qt Assistant</source> + <translation type="obsolete">Qt Assistant</translation> + </message> +</context> +<context> + <name>AssistantServer</name> + <message> + <source>Qt Assistant</source> + <translation>Qt Assistant</translation> + </message> + <message> + <source>Failed to bind to port %1</source> + <translation>Kann Port %1 nicht binden</translation> + </message> +</context> +<context> + <name>FindDialog</name> + <message> + <source>Find Text</source> + <translation type="obsolete">Textsuche</translation> + </message> + <message> + <source>&Find:</source> + <translation type="obsolete">&Suchen:</translation> + </message> + <message> + <source>&Find</source> + <translation>&Suchen</translation> + </message> + <message> + <source>Close</source> + <translation type="obsolete">Schließen</translation> + </message> + <message> + <source>&Direction</source> + <translation>Rich&tung</translation> + </message> + <message> + <source>Forwar&d</source> + <translation type="obsolete">&Vorwärts</translation> + </message> + <message> + <source>&Backward</source> + <translation>&Rückwärts</translation> + </message> + <message> + <source>&Options</source> + <translation>&Optionen</translation> + </message> + <message> + <source>&Whole words only</source> + <translation>&Ganze Wörter</translation> + </message> + <message> + <source>&Case sensitive</source> + <translation>Groß- und &Kleinschreibung beachten</translation> + </message> + <message> + <source>Qt Assistant - Find Text</source> + <translation>Qt Assistant - Textsuche</translation> + </message> + <message> + <source>Enter the text you are looking for.</source> + <translation>Geben Sie den Suchtext ein.</translation> + </message> + <message> + <source>Search reached end of the document</source> + <translation>Die Suche hat das Ende des Dokuments erreicht</translation> + </message> + <message> + <source>Search reached start of the document</source> + <translation>Die Suche hat den Anfang des Dokuments erreicht</translation> + </message> + <message> + <source>Text not found</source> + <translation>Text nicht gefunden</translation> + </message> + <message> + <source>Fo&rward</source> + <translation>Vo&rwärts</translation> + </message> + <message> + <source>F&ind:</source> + <translation>Su&chen:</translation> + </message> + <message> + <source>C&lose</source> + <translation>Sch&ließen</translation> + </message> + <message> + <source>Alt+L</source> + <translation></translation> + </message> + <message> + <source>Alt+F</source> + <translation></translation> + </message> +</context> +<context> + <name>HelpDialog</name> + <message> + <source>Index</source> + <translation>Index</translation> + </message> + <message> + <source>Bookmarks</source> + <translation>Lesezeichen</translation> + </message> + <message> + <source>Con&tents</source> + <translation type="obsolete">Inhal&t</translation> + </message> + <message> + <source>Qt Reference Documentation</source> + <translation type="obsolete">Qt Referenzdokumentation</translation> + </message> + <message> + <source>Qt Designer Manual</source> + <translation type="obsolete">Qt Designer Handbuch</translation> + </message> + <message> + <source>Qt Linguist Manual</source> + <translation type="obsolete">Qt Linguist Handbuch</translation> + </message> + <message> + <source>Qt Assistant Manual</source> + <translation type="obsolete">Qt Assistant Handbuch</translation> + </message> + <message> + <source>Qt Assistant</source> + <translation>Qt Assistant</translation> + </message> + <message> + <source>Open Link in Current Window</source> + <translation type="obsolete">Öffne Link im aktuellen Fenster</translation> + </message> + <message> + <source>Open Link in New Window</source> + <translation>Öffne Link in neuem Fenster</translation> + </message> + <message> + <source>Contents</source> + <translation>Inhalt</translation> + </message> + <message> + <source>Search</source> + <translation>Suche</translation> + </message> + <message> + <source>Prepare...</source> + <translation>Initialisiere...</translation> + </message> + <message> + <source>Cannot open the index file %1</source> + <translation>Kann Indexdatei %1 nicht öffnen</translation> + </message> + <message> + <source>Warning</source> + <translation>Warnung</translation> + </message> + <message> + <source>Documentation file %1 does not exist! +Skipping file.</source> + <translation>Dokumentation %1 existiert nicht! +Überspringe Datei.</translation> + </message> + <message> + <source>Parse Error</source> + <translation>Syntaxfehler</translation> + </message> + <message> + <source>Done</source> + <translation>Fertig</translation> + </message> + <message> + <source>Indexing files...</source> + <translation>Indiziere Dokumentation...</translation> + </message> + <message> + <source>Reading dictionary...</source> + <translation>Lese Suchindex...</translation> + </message> + <message> + <source>Full Text Search</source> + <translation>Volltextsuche</translation> + </message> + <message> + <source>Using a wildcard within phrases is not allowed.</source> + <translation>Wildcards innerhalb von Phrasen sind nicht zugelassen.</translation> + </message> + <message> + <source>The closing quotation mark is missing.</source> + <translation>Das schließende Anführungszeichen fehlt.</translation> + </message> + <message> + <source>Open Link in Current Tab</source> + <translation>Link im Aktuellen Tab öffnen</translation> + </message> + <message> + <source>Open Link in New Tab</source> + <translation>Link in einem neuen Tab öffnen</translation> + </message> + <message> + <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> + <source>Documentation file %1 is not compatible! +Skipping file.</source> + <translation>Dokumentation %1 ist nicht kompatibel! Datei wird übersprungen.</translation> + </message> + <message> + <source>Failed to save fulltext search index +Assistant will not work!</source> + <translation>Der Index für die Volltextsuche konnte nicht gespeichert werden. +Der Assistent ist nicht einsatzbereit!</translation> + </message> +</context> +<context> + <name>HelpDialogBase</name> + <message> + <source>Help</source> + <translation>Hilfe</translation> + </message> + <message> + <source><b>Help</b><p>Choose the topic you need help for from the contents list, or search the index for keywords.</p></source> + <translation type="obsolete"><b>Hilfe</b><p>Wählen Sie ein Thema vom Inhaltsverzeichnis oder suchen Sie im Index nach Schlüsselwörtern.</p></translation> + </message> + <message> + <source>Displays help topics organized by category, index or bookmarks</source> + <translation type="obsolete">Zeigt die Hilfethemen unterteilt in Kategorien, Indizes oder Lesezeichen an</translation> + </message> + <message> + <source>Con&tents</source> + <translation>Inhal&t</translation> + </message> + <message> + <source>Column 1</source> + <translation>Spalte 1</translation> + </message> + <message> + <source><b>Help topics organized by category.</b><p>Double-click an item to see which topics are in that category. To view a topic, select it, and then click <b>Display</b>.</p></source> + <translation type="obsolete"><b>Die Hilfethemen sind nach Kategorien organisiert.</b><p>Ein Doppelklick auf einen Eintrag zeigt die Themen dieser Kategorie an. Um ein Thema anzuzeigen, wählen Sie es aus und drücken Sie <b>Anzeigen</b>.</p></translation> + </message> + <message> + <source>&Index</source> + <translation>&Index</translation> + </message> + <message> + <source>&Look For:</source> + <translation>Suchen &nach:</translation> + </message> + <message> + <source>Enter keyword</source> + <translation>Geben Sie ein Schlüsselwort ein</translation> + </message> + <message> + <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> + <source><b>List of available help topics.</b><p>Double-click on an item to open up the help page for this topic. You will have to choose the right page if more than one are found.</p></source> + <translation type="obsolete"><b>Liste aller verfügbaren Hilfethemen.</b><p>Ein Doppelklick auf einen Eintrag öffnet die dazugehörige Hilfeseite. Wenn es mehrere Seiten zu einem Eintrag gibt, wählen Sie die gewünschte aus.</p></translation> + </message> + <message> + <source>&Bookmarks</source> + <translation>L&esezeichen</translation> + </message> + <message> + <source>Displays the list of bookmarks.</source> + <translation>Zeigt alle Lesezeichen an.</translation> + </message> + <message> + <source>&New Bookmark</source> + <translation type="obsolete">&Neues Lesezeichen</translation> + </message> + <message> + <source>Add new bookmark</source> + <translation>Füge neues Lesezeichen hinzu</translation> + </message> + <message> + <source>Add the current displayed page as new bookmark to the list.</source> + <translation type="obsolete">Füge die aktuelle Seite als Lesezeichen hinzu.</translation> + </message> + <message> + <source>D&elete Bookmark</source> + <translation type="obsolete">&Lösche Lesezeichen</translation> + </message> + <message> + <source>Delete bookmark</source> + <translation>Lösche Lesezeichen</translation> + </message> + <message> + <source>Delete the selected bookmark from the list.</source> + <translation type="obsolete">Lösche markiertes Lesezeichen.</translation> + </message> + <message> + <source>Preparing...</source> + <translation>Initialisiere...</translation> + </message> + <message> + <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> + <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> + <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> + <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> + <source>&New</source> + <translation>&Neu</translation> + </message> + <message> + <source>Add the currently displayed page as a new bookmark.</source> + <translation>Füge aktuelle Seite zu den Lesezeichen hinzu.</translation> + </message> + <message> + <source>&Delete</source> + <translation>&Löschen</translation> + </message> + <message> + <source>Delete the selected bookmark.</source> + <translation>Lösche markiertes Lesezeichen.</translation> + </message> + <message> + <source>&Search</source> + <translation>&Suche</translation> + </message> + <message> + <source>Searching f&or:</source> + <translation>Suche &nach:</translation> + </message> + <message> + <source>Enter searchword(s).</source> + <translation>Suchebegriff(e).</translation> + </message> + <message> + <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> + <source><b>Found documents</b><p>This list tqcontains 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> + <source>Found &Documents:</source> + <translation>Gefundene &Dokumente:</translation> + </message> + <message> + <source>He&lp</source> + <translation>Hi&lfe</translation> + </message> + <message> + <source>Display the help page.</source> + <translation>Zeigt die Hilfe an.</translation> + </message> + <message> + <source>Display the help page for the full text search.</source> + <translation>Zeigt die Hilfeseite für die Volltextsuche an.</translation> + </message> + <message> + <source>Start searching.</source> + <translation>Starte Suche.</translation> + </message> + <message> + <source>Pressing this button starts the search.</source> + <translation>Startet die Suche.</translation> + </message> +</context> +<context> + <name>HelpWindow</name> + <message> + <source>Qt Assistant by Trolltech - %1</source> + <translation type="obsolete">Qt Assistant von Trolltech - %1</translation> + </message> + <message> + <source>Help</source> + <translation>Hilfe</translation> + </message> + <message> + <source>Can't load and display non-local file +%1</source> + <translation>Kann gewünschte Datei nicht laden: +%1</translation> + </message> + <message> + <source>Open Link in New Window<byte value="x9"/>Shift+LMB</source> + <translation>Öffne Link in neuem Fenster</translation> + </message> + <message> + <source>Currently no Web browser is selected. +Please use the settings dialog to specify one! +</source> + <translation>Es ist kein Webbrowser ausgewählt. +Öffnen Sie bitten den "Einstellungen" Dialog um einen Webbrowser auszuwählen. +</translation> + </message> + <message> + <source>Qt Assistant by Trolltech - %1%2</source> + <translation type="obsolete">Qt Assistant von Trolltech - %1%2</translation> + </message> + <message> + <source>No PDF Viewer has been specified +Please use the settings dialog to specify one! +</source> + <translation>Es wurde kein PDF Betrachter angegeben. +Bitte diesen im Menue Einstellungen festlegen! +</translation> + </message> + <message> + <source>Qt Assistant is unable to start the PDF Viewer + +%1 + +Please make sure that the executable exists and is located at +the specified location.</source> + <translation>Der Qt Assistent konnte den PDF betrachter +%1 nicht laden. +Bitte überprüfen Sie, das dieser an der angegeben Stelle existiert.</translation> + </message> + <message> + <source>Open Link in New Tab</source> + <translation>Link in einenm neuen Tab öffnen</translation> + </message> +</context> +<context> + <name>Index</name> + <message> + <source>Untitled</source> + <translation>Unbenannt</translation> + </message> +</context> +<context> + <name>MainWindow</name> + <message> + <source>Qt Assistant by Trolltech</source> + <translation>Qt Assistant von Trolltech</translation> + </message> + <message> + <source>Toolbar</source> + <translation>Werkzeugleiste</translation> + </message> + <message> + <source>Print</source> + <translation>Drucken</translation> + </message> + <message> + <source>&Print...</source> + <translation>&Drucken...</translation> + </message> + <message> + <source>Exit</source> + <translation>Beenden</translation> + </message> + <message> + <source>E&xit</source> + <translation>&Beenden</translation> + </message> + <message> + <source>Copy</source> + <translation>Kopieren</translation> + </message> + <message> + <source>&Copy</source> + <translation>&Kopieren</translation> + </message> + <message> + <source>Find in Text</source> + <translation>Textsuche</translation> + </message> + <message> + <source>&Find in Text...</source> + <translation>Text&suche...</translation> + </message> + <message> + <source>Home</source> + <translation>Startseite</translation> + </message> + <message> + <source>&Home</source> + <translation>St&artseite</translation> + </message> + <message> + <source>Previous</source> + <translation>Vorherige</translation> + </message> + <message> + <source>&Previous</source> + <translation>&Vorherige</translation> + </message> + <message> + <source>Next</source> + <translation>Nächste</translation> + </message> + <message> + <source>&Next</source> + <translation>&Nächste</translation> + </message> + <message> + <source>About</source> + <translation type="obsolete">Über</translation> + </message> + <message> + <source>About Qt</source> + <translation type="obsolete">Über Qt</translation> + </message> + <message> + <source>Qt Class Reference</source> + <translation type="obsolete">Qt Klassenreferenz</translation> + </message> + <message> + <source>Qt Designer Manual</source> + <translation type="obsolete">Qt Designer Handbuch</translation> + </message> + <message> + <source>Zoom in</source> + <translation>Vergrößern</translation> + </message> + <message> + <source>Zoom &in</source> + <translation>Ver&größern</translation> + </message> + <message> + <source>Zoom out</source> + <translation>Verkleinern</translation> + </message> + <message> + <source>Zoom &out</source> + <translation>Ver&kleinern</translation> + </message> + <message> + <source>Qt Linguist Manual</source> + <translation type="obsolete">Qt Linguist Handbuch</translation> + </message> + <message> + <source>&Settings</source> + <translation type="obsolete">&Einstellungen</translation> + </message> + <message> + <source>&Settings...</source> + <translation>&Einstellungen...</translation> + </message> + <message> + <source>New Window</source> + <translation>Neues Fenster</translation> + </message> + <message> + <source>New Window...</source> + <translation type="obsolete">Neues Fenster...</translation> + </message> + <message> + <source>Close</source> + <translation>Schließen</translation> + </message> + <message> + <source>Vie&ws</source> + <translation>A&nsicht</translation> + </message> + <message> + <source>Ctrl+T</source> + <translation>Strg+T +</translation> + </message> + <message> + <source>Ctrl+I</source> + <translation>Strg+I</translation> + </message> + <message> + <source>Ctrl+B</source> + <translation>Strg+E</translation> + </message> + <message> + <source>Qt Assistant</source> + <translation>Qt Assistant</translation> + </message> + <message> + <source>&Add Bookmark</source> + <translation>&Füge Lesezeichen hinzu</translation> + </message> + <message> + <source>Qt Reference Documentation</source> + <translation type="obsolete">Qt Referenzdokumention</translation> + </message> + <message> + <source>&File</source> + <translation>&Datei</translation> + </message> + <message> + <source>&Edit</source> + <translation>&Bearbeiten</translation> + </message> + <message> + <source>&View</source> + <translation>&Ansicht</translation> + </message> + <message> + <source>&Go</source> + <translation>&Gehe zu</translation> + </message> + <message> + <source>Boo&kmarks</source> + <translation>&Lesezeichen</translation> + </message> + <message> + <source>&Help</source> + <translation>&Hilfe</translation> + </message> + <message> + <source>Print the currently displayed page.</source> + <translation>Drucke aktuelle Seite.</translation> + </message> + <message> + <source>Ctrl+P</source> + <translation>Strg+P</translation> + </message> + <message> + <source>Quit Qt Assistant.</source> + <translation>Beende Qt Assistant.</translation> + </message> + <message> + <source>Ctrl+Q</source> + <translation>Strg+Q</translation> + </message> + <message> + <source>Copy the selected text to the clipboard.</source> + <translation>Kopiere den markierten Text in die Zwischenablage.</translation> + </message> + <message> + <source>Ctrl+C</source> + <translation>Strg+C</translation> + </message> + <message> + <source>Open the Find dialog. Qt Assistant will search the currently displayed page for the text you enter.</source> + <translation>Öffne den Suchdialog. Qt Assistant sucht in der aktuellen Seite nach dem eingegebenen Text.</translation> + </message> + <message> + <source>Ctrl+F</source> + <translation>Strg+F</translation> + </message> + <message> + <source>Go to the home page. Qt Assistant's home page is the Qt Reference Documentation.</source> + <translation>Gehe zur Startseite. Qt Assistants Startseite ist die Qt Referenzdokumentation.</translation> + </message> + <message> + <source>Ctrl+Home</source> + <translation>Strg+Pos1</translation> + </message> + <message> + <source>Go to the previous page.</source> + <translation>Gehe zur vorherigen Seite.</translation> + </message> + <message> + <source>Alt+Left</source> + <translation>Alt+Links</translation> + </message> + <message> + <source>Go to the next page.</source> + <translation>Gehe zur nächsten Seite.</translation> + </message> + <message> + <source>Alt+Right</source> + <translation>Alt+Rechts</translation> + </message> + <message> + <source>Display further information about Qt Assistant.</source> + <translation>Zeigt weitere Informationen zu Qt Assistant an.</translation> + </message> + <message> + <source>Display further information about Qt.</source> + <translation type="obsolete">Zeigt weitere Informationen zu Qt an.</translation> + </message> + <message> + <source>Display the Qt Reference Documentation.</source> + <translation type="obsolete">Zeigt die Qt Referenzdokumentation an.</translation> + </message> + <message> + <source>Display the Qt Designer manual.</source> + <translation type="obsolete">Zeigt das Qt Designer Handbuch an.</translation> + </message> + <message> + <source>Zoom in on the document, i.e. increase the font size.</source> + <translation>Vergrößert die Schrift.</translation> + </message> + <message> + <source>Ctrl++</source> + <translation>Strg++</translation> + </message> + <message> + <source>Zoom out on the document, i.e. decrease the font size.</source> + <translation>Verkleinert die Schrift.</translation> + </message> + <message> + <source>Ctrl+-</source> + <translation>Strg+-</translation> + </message> + <message> + <source>Display the Guide to the Qt Translation Tools.</source> + <translation type="obsolete">Zeigt die Anleitung zu den Qt Übersetzungswerkzeugen an.</translation> + </message> + <message> + <source>Open the settings dialog.</source> + <translation>Öffnet den "Einstellungen" Dialog.</translation> + </message> + <message> + <source>Open a new window.</source> + <translation>Öffnet ein neues Fenster.</translation> + </message> + <message> + <source>Ctrl+N</source> + <translation>Strg+N</translation> + </message> + <message> + <source>&Close</source> + <translation>&Schließen</translation> + </message> + <message> + <source>Close the current window.</source> + <translation>Schließt das aktuelle Fenster.</translation> + </message> + <message> + <source>Qt Assistant Manual</source> + <translation>Qt Assistant Handbuch</translation> + </message> + <message> + <source>Display the Qt Assistant manual.</source> + <translation type="obsolete">Zeigt das Qt Assistant Handbuch an.</translation> + </message> + <message> + <source>F1</source> + <translation>F1</translation> + </message> + <message> + <source>Add the currently displayed page as a new bookmark.</source> + <translation>Füge aktuelle Seite zu den Lesezeichen hinzu.</translation> + </message> + <message> + <source>What's This?</source> + <translation>Direkthilfe</translation> + </message> + <message> + <source>"What's This?" context sensitive help.</source> + <translation>Kontextbezogene Direkthilfe.</translation> + </message> + <message> + <source>Shift+F1</source> + <translation>Umschalt+F1</translation> + </message> + <message> + <source>Ctrl+S</source> + <translation>Strg+S</translation> + </message> + <message> + <source>Initializing Qt Assistant...</source> + <translation>Initialisiere Qt Assistant...</translation> + </message> + <message> + <source>Go</source> + <translation>Gehe zu</translation> + </message> + <message> + <source>Find &Next</source> + <translation>&Nächste tqfinden</translation> + </message> + <message> + <source>Find Next</source> + <translation>Nächste tqfinden</translation> + </message> + <message> + <source>F3</source> + <translation>F3</translation> + </message> + <message> + <source>Find &Previous</source> + <translation>&Vorigen tqfinden</translation> + </message> + <message> + <source>Find Previous</source> + <translation>Vorigen tqfinden</translation> + </message> + <message> + <source>Shift+F3</source> + <translation>Umschalt+F3</translation> + </message> + <message> + <source>About Qt Assistant</source> + <translation>Über den Qt Assistent</translation> + </message> + <message> + <source>Settings</source> + <translation>Einstellungen</translation> + </message> + <message> + <source>Add Bookmark</source> + <translation>Lesezeichen einfügen</translation> + </message> + <message> + <source>Add Tab</source> + <translation>Tab einfügen</translation> + </message> + <message> + <source>Ctrl+Alt+N</source> + <translation></translation> + </message> + <message> + <source>Next Tab</source> + <translation>Nächster Tab</translation> + </message> + <message> + <source>Ctrl+Alt+Right</source> + <translation></translation> + </message> + <message> + <source>Previous Tab</source> + <translation>Voriger Tab</translation> + </message> + <message> + <source>Ctrl+Alt+Left</source> + <translation></translation> + </message> + <message> + <source>Close Tab</source> + <translation>Tab schließen</translation> + </message> + <message> + <source>Ctrl+Alt+Q</source> + <translation></translation> + </message> + <message> + <source>Failed to open about application contents in file: '%1'</source> + <translation></translation> + </message> + <message> + <source>Failed to open link: '%1'</source> + <translation>Der Link '%1' konnte nicht geöffnet werden</translation> + </message> + <message> + <source><div align="center"><h1>The page could not be found!</h1><br><h3>'%1'</h3></div></source> + <translation><div align="Hauptseite nicht gefunden!</h1></translation> + </message> + <message> + <source>Error...</source> + <translation>Fehler ...</translation> + </message> +</context> +<context> + <name>SettingsDialog</name> + <message> + <source>all</source> + <translation type="obsolete">Alle</translation> + </message> + <message> + <source>Qt Assistant - Add Documentation</source> + <translation type="obsolete">Qt Assistant - Hinzufügen von Dokumentation</translation> + </message> + <message> + <source>Qt Assistant</source> + <translation type="obsolete">Qt Assistant</translation> + </message> + <message> + <source>Parse Error</source> + <translation type="obsolete">Syntaxfehler</translation> + </message> + <message> + <source>This item can not be deleted!</source> + <translation type="obsolete">Dieser Eintrag kann nicht gelöscht werden!</translation> + </message> + <message> + <source>This branch is not empty! +Firstly, all contents have to be removed.</source> + <translation type="obsolete">Dieser Zweig ist nicht leer! +Es müssen zuerst alle Inhalte gelöscht werden.</translation> + </message> + <message> + <source>Qt Assistant - Set Web Browser</source> + <translation>Qt Assistant - Setze Webbrowser</translation> + </message> + <message> + <source>Qt Assistant - Set PDF Browser</source> + <translation>Qt Assistent - Setze PDF Betrachter</translation> + </message> + <message> + <source>Qt Assistant - Set Homepage</source> + <translation>Qt Assistent - Setzte Startseite</translation> + </message> +</context> +<context> + <name>SettingsDialogBase</name> + <message> + <source>Settings</source> + <translation type="obsolete">Einstellungen</translation> + </message> + <message> + <source>Font:</source> + <translation type="obsolete">Schriften:</translation> + </message> + <message> + <source>Link color:</source> + <translation>Linkfarbe:</translation> + </message> + <message> + <source>Underline links</source> + <translation type="obsolete">Unterstreiche Links</translation> + </message> + <message> + <source>OK</source> + <translation type="obsolete">OK</translation> + </message> + <message> + <source>Cancel</source> + <translation type="obsolete">Abbrechen</translation> + </message> + <message> + <source>Fixed font:</source> + <translation type="obsolete">Nicht-proportionale Schrift:</translation> + </message> + <message> + <source>Qt Assistant - Settings</source> + <translation>Qt Assistant - Einstellungen</translation> + </message> + <message> + <source>General</source> + <translation type="obsolete">Allgemein</translation> + </message> + <message> + <source>Fix&ed font:</source> + <translation>&Nicht-proportionale Schrift:</translation> + </message> + <message> + <source>&Font:</source> + <translation>&Schrift:</translation> + </message> + <message> + <source>&Underline links</source> + <translation>&Unterstreiche Links</translation> + </message> + <message> + <source>Web</source> + <translation type="obsolete">Web</translation> + </message> + <message> + <source>&Web Browser Application:</source> + <translation type="obsolete">&Webbrowser Anwendung:</translation> + </message> + <message> + <source>...</source> + <translation>...</translation> + </message> + <message> + <source>Documentation</source> + <translation type="obsolete">Dokumentation</translation> + </message> + <message> + <source>&Delete</source> + <translation type="obsolete">&Lösche</translation> + </message> + <message> + <source>&Add...</source> + <translation type="obsolete">&Hinzufügen...</translation> + </message> + <message> + <source>Categories</source> + <translation type="obsolete">Kategorien</translation> + </message> + <message> + <source>Category &Name:</source> + <translation type="obsolete">Kategorie&name:</translation> + </message> + <message> + <source>&Add</source> + <translation type="obsolete">&Hinzufügen</translation> + </message> + <message> + <source>&OK</source> + <translation>&OK</translation> + </message> + <message> + <source>&Cancel</source> + <translation>&Abbrechen</translation> + </message> + <message> + <source>&General</source> + <translation>&Haupt</translation> + </message> + <message> + <source>&Web</source> + <translation>&Web</translation> + </message> + <message> + <source>Web &Browser Application:</source> + <translation>Web&browser:</translation> + </message> + <message> + <source>&Home page</source> + <translation>&Startseite</translation> + </message> + <message> + <source>&PDF</source> + <translation>&PDF</translation> + </message> + <message> + <source>PDF &Application</source> + <translation>PDF &Betrachter</translation> + </message> +</context> +<context> + <name>TabbedBrowser</name> + <message> + <source>TabbedBrowser</source> + <translation></translation> + </message> + <message> + <source>Untitled</source> + <translation>Unbenannt</translation> + </message> + <message> + <source>Add page</source> + <translation>Seite einfügen</translation> + </message> + <message> + <source>Close page</source> + <translation>Seite schließen</translation> + </message> +</context> +<context> + <name>TopicChooser</name> + <message> + <source>Choose a topic for <b>%1</b></source> + <translation>Wählen Sie ein Thema für <b>%1</b></translation> + </message> +</context> +<context> + <name>TopicChooserBase</name> + <message> + <source>Choose Topic</source> + <translation>Thema wählen</translation> + </message> + <message> + <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> + <source>&Topics</source> + <translation>&Themen</translation> + </message> + <message> + <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> + <source>&Display</source> + <translation>&Anzeigen</translation> + </message> + <message> + <source>Open the topic selected in the list.</source> + <translation>Öffne das gewählte Thema aus der Liste.</translation> + </message> + <message> + <source>&Close</source> + <translation>&Schließen</translation> + </message> + <message> + <source>Close the Dialog.</source> + <translation>Schließt den Dialog.</translation> + </message> +</context> +</TS> diff --git a/tqtinterface/qt4/tools/assistant/assistant_fr.ts b/tqtinterface/qt4/tools/assistant/assistant_fr.ts new file mode 100644 index 0000000..0dfa69f --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/assistant_fr.ts @@ -0,0 +1,426 @@ +<!DOCTYPE TS><TS> +<context> + <name>Assistant</name> + <message> + <source>Welcome to the <b>Qt Assistant</b>. Qt Assistant will give you quicker access to help and tips while using applications like Qt Designer.</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Qt Assistant</source> + <translation type="unfinished"></translation> + </message> +</context> +<context encoding="UTF-8"> + <name>FindDialog</name> + <message encoding="UTF-8"> + <source>Find Text</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Find:</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Find</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Close</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Direction</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Forwar&d</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Backward</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Options</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Whole words only</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Case sensitive</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>HelpDialog</name> + <message> + <source>Index</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Bookmarks</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Con&tents</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Qt Reference Documentation</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Qt Designer Manual</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Qt Linguist Manual</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Qt Assistant Manual</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Qt Assistant</source> + <translation type="unfinished"></translation> + </message> +</context> +<context encoding="UTF-8"> + <name>HelpDialogBase</name> + <message encoding="UTF-8"> + <source>Help</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source><b>Help</b><p>Choose the topic you need help for from the contents list, or search the index for keywords.</p></source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Displays help topics organized by category, index or bookmarks</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Con&tents</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Column 1</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source><b>Help topics organized by category.</b><p>Double-click an item to see which topics are in that category. To view a topic, select it, and then click <b>Display</b>.</p></source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Index</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Look For:</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Enter keyword</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source><b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p></source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source><b>List of available help topics.</b><p>Double-click on an item to open up the help page for this topic. You will have to choose the right page if more than one are found.</p></source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Bookmarks</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Displays the list of bookmarks.</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&New Bookmark</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Add new bookmark</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Add the current displayed page as new bookmark to the list.</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>D&elete Bookmark</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Delete bookmark</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Delete the selected bookmark from the list.</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Preparing...</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>HelpWindow</name> + <message> + <source>Qt Assistant by Trolltech - %1</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Help</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Can't load and display non-local file +%1</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Open Link in New Window<byte value="x9"/>Shift+LMB</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>MainWindow</name> + <message encoding="UTF-8"> + <source>Qt Assistant by Trolltech</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Toolbar</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Print</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Print...</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Exit</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>E&xit</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Copy</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Copy</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Find in Text</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Find in Text...</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Home</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Home</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Previous</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Previous</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Next</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Next</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>About</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>About</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>About Qt</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>About Qt</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Qt Class Reference</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Qt Designer Manual</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Zoom in</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Zoom &in</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Zoom out</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Zoom &out</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Qt Linguist Manual</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Settings</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Settings...</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>New Window</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>New Window...</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Close</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Vie&ws</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Ctrl+T</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Ctrl+I</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Ctrl+B</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Qt Assistant</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>&Add Bookmark</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Qt Reference Documentation</source> + <translation type="unfinished"></translation> + </message> +</context> +<context encoding="UTF-8"> + <name>SettingsDialogBase</name> + <message encoding="UTF-8"> + <source>Settings</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Font:</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Link color:</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Underline links</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>OK</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Cancel</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Fixed font:</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>TopicChooser</name> + <message> + <source>Choose a topic for <b>%1</b></source> + <translation type="unfinished"></translation> + </message> +</context> +<context encoding="UTF-8"> + <name>TopicChooserBase</name> + <message encoding="UTF-8"> + <source>Choose Topic</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Select a topic from the list and click the <b>Display</b>-button to open the online help.</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Topics</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Displays a list of available help topics for the keyword.</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Display</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Open the topic selected in the list.</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>&Close</source> + <translation type="unfinished"></translation> + </message> + <message encoding="UTF-8"> + <source>Close the Dialog.</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tqtinterface/qt4/tools/assistant/book/assistant.book b/tqtinterface/qt4/tools/assistant/book/assistant.book new file mode 100644 index 0000000..feb6588 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/book/assistant.book @@ -0,0 +1,6 @@ +\title Qt Assistant Manual + +\granularity chapter + +\input assistant.leaf + diff --git a/tqtinterface/qt4/tools/assistant/book/assistant.leaf b/tqtinterface/qt4/tools/assistant/book/assistant.leaf new file mode 100644 index 0000000..e978b03 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/book/assistant.leaf @@ -0,0 +1,563 @@ +\chapter Introduction + +This document introduces \QA, a tool for presenting on-line +documentation. It also introduces the Qt Reference Documentation which +is accessible using \QA, or with a web browser. The document is +divided into the following sections: + +\list +\i Introduction to the Qt Reference Documentation +\i The 1 Minute Guide to using Qt Assistant +\i Qt Assistant in More Detail +\i Full Text Searching +\i Customizing Qt Assistant +\endlist + +\chapter Introduction to the Qt Reference Documentation + +The documentation for the Qt library is written in-line in the \File +.cpp files by the developers themselves. The documentation team +revises the documentation to ensure that it is accurate and usable, +and to provide quality control. The documentation team also writes the +larger texts, such as the class descriptions that introduce a class +along with the concepts the class uses, as well as introducing the +functions and properties that the class provides. + +The documentation focuses on the API rather than the internals, since +we make great efforts to keep our API consistent and compatible with +each new version, but we may change the internals considerably to improve +performance and enhance functionality. + +The Qt Reference Documentation consists of almost 1,500 HTML pages +(over 2,500 printed pages). The overwhelming majority of pages +document Qt classes. Since developers differ in the way they +think and work we provide a variety of approaches to navigating the +documentation set: + +\list + +\i The \link classes.html All Classes\endlink page lists every class +in Qt's public API, and consists of several hundred classes. + +\i The \link mainclasses.html Main Classes\endlink page lists the +classes you're most likely to use most often, and provides a much +shorter and more managable list than the All Classes list. + +\i The \link groups.html Grouped Classes\endlink page presents a list +of groups, each of which leads to a list of related classes, for +example, the \link advanced.html Advanced Widgets\endlink list. + +\i The \link hierarchy.html Inheritance Hierarchy\endlink page +presents a list of classes in terms of the hierarchy of Qt classes. + +\i The \link functions.html All Functions\endlink page lists all the +functions provided by Qt classes, each one with links to the class(es) +in which it appears. + +\endlist + +No matter where you tqfind yourself in the Qt documentation, you will +tqfind extensive cross-referencing. Even snippets of example code +contain clickable links, so that for example, if you come across a +class declaration in a code example, the class name will be a +clickable link to the class's documentation. + +In addition to the class documentation some of Qt's modules have +extensive descriptions, and there are many overview documents which +describe various aspects of the Qt library; all these are linked from +the reference documentation home page. There are also two tutorials +and numerous example programs in the examples subdirectory of the Qt +distribution. + +\chapter The 1 Minute Guide to Using Qt Assistant + +Under Windows, \QA is available as a menu option on the Qt menu. On +Unix, run \c{assistant} from an xterm. + +When you start up \QA, you will be presented with a standard +main-window style application, with a menu bar and toolbar. Below +these, on the left hand side is a navigation window called the \e +Sidebar, and on the right, taking up most of the space, is the +documentation window. By default, the Qt Reference Documentation's home +page is shown in the documentation window. + +\QA works in a similar way to a web browser. If you click underlined +text (which signifies a cross-reference), the documentation window will +present the relevant page. You can bookmark pages of particular +interest and you can click the \Toolbutton Previous and \Toolbutton +Next toolbar buttons to navigate within the pages you've visited. + +Although \QA can be used just like a web browser to navigate through +the Qt documentation set, \QA offers a powerful means of navigation +that web browsers don't provide. \QA uses an intelligent algorithm to +index all the pages in the documentation sets that it presents so that +you can search for particular words and phrases. + +To perform an index search, click the \Toolbutton Index tab on the Sidebar +(or click \Key Ctrl+I). In the 'Look For' line edit enter a word, e.g. +'homedirpath'. As you type, words are found and highlighted in a list +beneath the line edit. If the highlighted text matches what you're +looking for, double click it, (or press \Key Enter) and the +documentation window will display the relevant page. You rarely have +to type in the whole word before \QA tqfinds a match. Note that for some +words there may be more than one possible page that is relevant. + +\QA also provides full text searching for tqfinding specific words in +the documentation. Documents with the highest occurrences of the word +that you are looking for appear first, and every occurrence of the +word within the documentation is highlighted. + +\omit +For example, enter 'setenabled' in the 'Look For' line edit. +As you type, words are found and highlighted in the list beneath the +line edit, as before. Once the highlighted text matches what you're +looking for, double click it, (or press \Key Enter). In the case of +setEnabled, it is a function name which occurs in several classes, so +a dialog pops up listing the possible choices. Click the choice you're +interested in (or move to it using the \Key Up and \Key Down arrow +keys and press \Key Enter). The relevant page will display in the +documentation window. +\endomit + +\QA can be customized by creating profiles, a collection of +documentation. Profiles can be created for your own use, or for an +application you will distribute. With profiles, you can select which +documentation you want the end user of your application to be able to +view. + +\chapter Qt Assistant in More Detail + +\img assistant.png +\caption Qt Assistant + +\section1 The Sidebar + +\img sidebar.png + +The sidebar provides four ways of navigating documentation: +\list 1 +\i The \Toolbutton Contents tab presents a tree view of the +documentation sets that are available. If you click an item, its +documentation will appear in the documentation window. If you double +click an item or click a '+' sign to the left of an item, the item's +sub-items will appear. Click a sub-item to make its page appear in the +documentation window. Click a '-' sign to the left of an item to hide +its sub-items. +\i The \Toolbutton Index tab is used to look up key words or phrases. +See \l{The 1 Minute Guide to using Qt Assistant} for how to use this +tab. +\i The \Toolbutton Bookmarks tab lists any bookmarks you've made. +Double click a bookmark to make its page appear in the documentation +window. The \Toolbutton Bookmarks tab has a \Button{New Bookmark} +button and a \Button{Delete Bookmark} button at the bottom. Click +\Button{New Bookmark} to bookmark the page that is showing in the +documentation window. Click a bookmark in the list, then click +\Button{Delete Bookmark} to delete the highlighted bookmark. +\i The \Toolbutton Search tab provides full text search of \e all +the documents. See \l{Full Text Searching} for more information about +this feature. +\endlist + +If you want the documentation window to use as much space as possible, +you can easily hide or show the Sidebar. If the Sidebar is showing, +press \Key Ctrl+T, \Key Ctrl+I, \Key Ctrl+B or \Key Ctrl+S to hide it. +If the Sidebar is hidden, press \Key Ctrl+T to show it on the Contents +tab, or press \Key Ctrl+I to show it on the Index tab (with the focus +in the 'Look For' line edit box), or press \Key Ctrl+B to show it on +the Bookmarks tab, or press \Key Ctrl+S to show it on the (full text) +Search tab. + +The Sidebar is a dock window, so you can drag it to the top, left, +right or bottom of \QA's window, or you can drag it outside \QA to +float it. + +\section1 The Documentation Window + +\img docwindow.png + +The documentation window offers a feature for viewing documentation by +enabling you to create tabs for each documentation page that you view. +Click the \Button {Add Tab} button and a new tab will appear with the +page name as the tab's caption. This makes it convenient to switch +between pages when you are working with different documentation. You +can delete a tab by clicking the \Button {Close Tab} button located +on the right side of the documentation window. + +\section1 The Toolbar + +\img toolbar1.png + +The toolbar provides fast access to the most common actions. +\list +\i \Toolbutton Previous takes you to the previous page. The menu +option is \Menu Go|Previous and the keyboard shortcut is \Key{Alt+Left +Arrow}. +\i \Toolbutton Next takes you to the next page. The menu +option is \Menu Go|Next and the keyboard shortcut is \Key{Alt+Right +Arrow}. +\i \Toolbutton Home takes you to the home page (normally the home page +of the Qt Reference Documentation). The menu +option is \Menu Go|Home and the keyboard shortcut is \Key{Ctrl+Home}. +\i \Toolbutton Copy copies any selected text to the clipboard. The menu +option is \Menu Edit|Copy and the keyboard shortcut is \Key{Ctrl+C}. +\i \Toolbutton{Find in Text} invokes the \Dialog{Find Text} dialog. The menu +option is \Menu{Edit|Find in Text} and the keyboard shortcut is \Key{Ctrl+F}. +\i \Toolbutton{Print} invokes the \Dialog{Print} dialog. The menu +option is \Menu{File|Print} and the keyboard shortcut is \Key{Ctrl+P}. +\i \Toolbutton{Zoom in} increases the font size. The menu +option is \Menu{View|Zoom in} and the keyboard shortcut is \Key{Ctrl++}. +\i \Toolbutton{Zoom out} decreases the font size. The menu +option is \Menu{View|Zoom out} and the keyboard shortcut is \Key{Ctrl+-}. +\i \Toolbutton{What's This?} provides a description of a \QA feature. +The menu option is \Menu{Help|What's This?} and the keyboard shortcut +is \Key{Shift+F1}. +\endlist + +The remaining toolbar buttons are bookmarks and will vary depending on +your configuration. + +\section1 The Menus + +\section2 The File Menu + +\list +\i \Menu{File|Print} invokes the \Dialog{Print} dialog. +\i \Menu{File|Exit} terminates \QA. +\endlist + +\section2 The Edit Menu + +\list +\i \Menu{Edit|Copy} copies any selected text to the clipboard. +\i \Menu{Edit|Find in Text} invokes the \Dialog{Find Text} dialog. +\i \Menu{Edit|Settings} invokes the \Dialog{Settings} dialog. +\endlist + +\section2 The View Menu + +\list +\i \Menu{View|Zoom in} increases the font size. +\i \Menu{View|Zoom out} decreases the font size. +\i \Menu{View|Views|Sidebar} toggles the display of the Sidebar. +\i \Menu{View|Views|Toolbar} toggles the display of the Toolbar. +\i \Menu{View|Views|Line up} lines up the toolbar buttons in the +Toolbar. +\endlist + +\section2 The Go Menu + +\list +\i \Menu{Go|Previous} displays the previous page. +\i \Menu{Go|Next} displays the next page. +\i \Menu{Go|home} goes to the home page. +\endlist +This menu also has additional items; these are pre-defined bookmarks +that vary depending on your configuration. + +\section2 The Bookmarks Menu + +\list +\i \Menu{Bookmarks|Add} adds the current page to the list of bookmarks. +\endlist +This menu may have additional items, i.e. any bookmarks that you have +already made. If you want to delete a bookmark go to the Bookmarks tab +on the Sidebar. + +\section1 The Dialogs + +\section2 The Print Dialog + +This dialog is platform-specific. It gives access to various printer +options and can be used to print the current page. + +\section2 The Find Text Dialog + +This dialog is used to tqfind text in the current page. Enter the text +you want to tqfind in the Find line edit. If you check the 'Whole words +only' checkbox, the search will only consider whole words, i.e. if you +search for 'spin' with this checkbox checked it will not match +'spinbox', but will match 'spin'. If you check the 'Case sensitive' +check box then, for example, 'spin' will match 'spin' but not 'Spin'. +You can search Forward or Backward from your current position in the +page by clicking one of the Direction radio buttons. Click the \Button +Find button to search (or search again), and click the \Button Close +button to finish. + +\section2 The Settings Dialog + +The Settings dialog is used to set your preferences for \QA. The +dialog has four tabs: General Settings, Web Settings, PDF Settings, +and Profiles. \QA will remember your settings between sessions, +including window sizes and positions, and which pages you have open. +Each of the tabs is discussed as follows: + +\list +\i General Settings + +\img general.png + +To change the base font used throughout \QA, select a +font type from the Font combobox. To choose a new fixed-width +font, for example, to show code snippets, choose a font type from +the 'Fixed font' combobox. To change the color of hypertext +links, click the 'Link color' color button. Uncheck the +'Underline links' checkbox if you don't want underlined links. + +\i Web Settings + +\img web.png + +Some pages contain links to external web pages. In order to display +these links, you must specify a web browser. Type the name of your +browser's executable in the Web Browser Application line edit. +Alternatively, click the \Button {(ellipsis)} button to invoke the +\Widget {Set Web Browser} dialog and navigate until you tqfind the web +browser you want to use. Click \Button {Save} to accept the selection. + +To change \QA's default home page, enter the file name in the Home +Page line edit. Alternatively, click the \Button {(ellipsis)} button +to invoke the \Widget {Set Homepage} dialog. Navigate until you tqfind +the home page file you want to use and then click \Button {Save} to +accept the selection. + +\i PDF Settings + +\img pdf1.png + +Some pages contain links to PDF documents. In order to display these +links, you must specify a PDF viewer. Type in the name of your PDF viewer's +executable in the line edit. Alternatively, click the \Button {(ellipsis)} +button to invoke the \Widget {Set PDF Browser} dialog and navigate +until you tqfind the PDF viewer you want to use. Click \Button Save to +accept the selection. + +\chapter Full Text Searching + +\img search.png + +\QA provides a powerful full text search engine. To search +for certain words or text, click the 'Search' tab in the sidebar. Then +enter the text you want to look for and press \Key Enter or click +\Button Search. The search is not case sensitive, so Foo, fOo and +FOO are all treated as the same. The following are examples of common search +patterns: + +\list +\i \c deep -- lists all the documents that contain the word 'deep' + +\i \c{deep*} -- lists all the documents that contain a word beginning +with 'deep' + +\i \c{deep copy} -- lists all documents that contain both 'deep' \e +and 'copy' + +\i \c{"deep copy"} -- list all documents that contain the phrase 'deep copy' +\endlist + +The wildcard (*) character cannot be used within quotes. + +The list of documents found is ordered according to the number of +occurrences of the search text they contain, therefore those with the +highest number of occurrences appearing first. Simply click any +document in the list to display it in the document window. + +If the documentation has changed, i.e. if documents have been added or +removed, \QA will reindex. + +\chapter Customizing Qt Assistant + +\QA can be customized by adding and removing documentation from its +documentation set. In addition, \QA introduces the profiles option, +which enables its properties to change, for example, the default +startup page, and application icon. + +\section1 Modifying the Default Documentation Set + +When it is started without any options, \QA displays a default set of +documentation. When Qt is installed, the default documentation set in +\QA tqcontains the Qt reference documentation as well as the tools that +come with Qt, such as \QD and qmake. + +Documentation can be added or removed from \QA by +adding and removing the content files. The format of the content files are +specified below. To add a content file, type the following command line +option: \c{-addContentFile docfile}. To remove a content file from the +default set, type the following command line option: +\c{-removeContentFile docfile}. For example: + +\code +1: > assistant -addContentFile file.dcf +2: > assistant +3: > assistant -removeContentFile file.dcf +\endcode + +In line one, we add the content file \c file.dcf. In line two, we start +\QA. The default set will now be extended with the doc file +\c file.dcf. In line three we remove the file \c file.dcf from the default +documentation set so that subsequent use of \QA will not contain this +file. + +\section2 Documentation Content File Format + +The Documentation Content File must contain the documentation's table +of contents and all important keywords for the index. In addition, it +may inherit an icon for the documentation which is displayed in the +\QA toolbar. You can also specify an extra directory path for +additional images used in the documentation. + +An example of a content file that uses all the available tags and +attributes is shown below: +\code +<assistantconfig version="3.2.0"> + <DCF ref="demo.html" icon="handbook.png" imagedir="../img/" + title="Development Demo Handbook"> + <section ref="./chap1/chap1.html" title="Chapter1"> + <section ref="./chap1/section1.html" title="Section1"> + <keyword ref="./chap1/section1.html#foo">foo</keyword> + <keyword ref="./chap1/section1.html#bla">bla</keyword> + <section ref="./chap1/section1.html#subsection1" title="Subsection 1"/> + <section ref="./chap1/section1.html#subsection2" title="Subsection 2"/> + <section ref="./chap1/section1.html#subsection3" title="Subsection 3"/> + </section> + <section ref="./chap1/section2" title="Section2"> + <section ref="./chap1/section2.html#subsection1" title="Subsection 1"/> + <section ref="./chap1/section2.html#subsection2" title="Subsection 2"/> + <section ref="./chap1/section2.html#subsection3" title="Subsection 3"/> + </section> + </section> + <section ref="./chap2/chap2.html" title="Chapter2"> + <keyword ref="./chap2/chap2.html#foo">foo</keyword> + <section ref="./chap2/section1.html" title="Section1"/> + </section> + </DCF> +</assistantconfig> +\endcode + +Sections may be nested as deeply as necessary. All references should +be related. + +Note that any \c keyword tags for a given section must appear \e +before any sections nested within the given section. + +The paths in the \c refs attribute are always written Unix-style +(forward slashes) and are relative to the location of the +documentation content file itself. + +Since the introduction of the new root tag \c assistantconfig in the +fileformat from Qt version 3.2.0, it is possible to specify multiple DCF tags in +one file. Note that the old document contents file format, used up to +Qt 3.2 is still valid. + +\section1 Profiles + +Profiles enable \QA to act as a specialized help tool for displaying +documentation for applications. With profiles, the documentation +writer can change properties such as \QA's title, application icons, and +'about' dialogs. In addition, profiles can be used to run specialized +documentation sets that are separate from the Qt docs. \QA can be +customized by changing the following properties: + +\list + +\i Name- This property is used to name the profile. If multiple +profiles are used for the same installation of \QA, this +parameter is crucial to keep their profile specific settings +apart. The property name is \c name + +\i Title- This property is used to specify a caption for \QA. The +property name is \c title + +\i Application Icon- This property describes an icon that will be used +as \QA application icon. The location of the icon is relative to the +location of the profile. The property name is \c applicationicon + +\i Start Page- This property specifies which page \QA should initially +display when the profile is used. Usually, this is the HTML file which +tqcontains the documentation's table of contents. This property also +describes the default location to go to when pressing the home button +in \QA's main user interface. The start page is specified relative to +the location of the profile. The property name is \c startpage + +\i About Menu Text- This property describes the text that appears in +the \Menu Help menu, e.g. About Application. The property name is \c +aboutmenutext + +\i About URL- This property can be used to point to an HTML file that +describes the contents in the About dialog that is opened for the +\Menu Help menu, e.g. About Application. The url is specified relative +to the location of the profile. The property name is \c abouturl + +\i \QA Documentation- This property describes the location of +the \QA documentation. This is required since \QA provides +self help, such as the full text search help and the \QA +Manual option in the \Menu Help menu. The location is a directory +relative to the location of the profile. The property name is \c +assistantdocs. + +\endlist + +To define a profile, one needs to specify a \QA Document +Profile, usually abbreviated \c{.adp}. The profile is an extension of +the Documentation Content File described above. We add a \c profile +tag containing \c property tags to the format. + +An example of a document profile file is shown below: + +\c helpdemo.adp + +\code +<assistantconfig version="3.2.0"> + + <profile> + <property name="name">HelpExample</property> + <property name="title">Help Example</property> + <property name="applicationicon">logo.png</property> + <property name="startpage">index.html</property> + <property name="aboutmenutext">About Help</property> + <property name="abouturl">../about.txt</property> + <property name="assistantdocs">../../../doc/html</property> + </profile> + + <DCF ref="index.html" icon="handbook.png" title="Help example"> + <section ref="./manual.html" title="How to use this Example"> + <keyword ref="./manual.html#installdocs">Install Docs</keyword> + <keyword ref="./manual.html#onlydoc">Example Profile</keyword> + <keyword ref="./manual.html#hide">Hide Sidebar</keyword> + <keyword ref="./manual.html#openqabutton">Open</keyword> + <keyword ref="./manual.html#closeqabutton">Close</keyword> + <keyword ref="./manual.html#display">Display</keyword> + </section> + </DCF> + +</assistantconfig> +\endcode + +These files are XML files. Characters such as \c{<}, \c{>}, and \c{&} +must be written as entities (e.g., \c{<}, \c{>}, \c{&}). + +\section2 Using Profiles + +To use a profile, run \QA with the option \c {-profile filename}. +This will load the profile specified in the file and will customize +\QA accordingly. For example, to run \QA with the example +file above, \c helpdemo.adp, we would run the command as follows: + +\code +> assistant -profile helpdemo.adp +\endcode + +See the HelpDemo example in the Qt distribution for a demonstration +on how to use \QA with profiles for your own applications. + +When distributing \QA with your application, you will also need to +copy the icon files from the \c QTDIR/tools/assistant/images +directory so that \QA tqfinds its icons. + +\omit +For small documentation sets, the sidebar may not be necessary. You +can hide the sidebar on startup with the following: +\code +assistant -hideSidebar +\endcode +\endomit + diff --git a/tqtinterface/qt4/tools/assistant/book/images/assistant.png b/tqtinterface/qt4/tools/assistant/book/images/assistant.png Binary files differnew file mode 100644 index 0000000..9401940 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/book/images/assistant.png diff --git a/tqtinterface/qt4/tools/assistant/book/images/docwindow.png b/tqtinterface/qt4/tools/assistant/book/images/docwindow.png Binary files differnew file mode 100644 index 0000000..18fa098 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/book/images/docwindow.png diff --git a/tqtinterface/qt4/tools/assistant/book/images/general.png b/tqtinterface/qt4/tools/assistant/book/images/general.png Binary files differnew file mode 100644 index 0000000..2fad053 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/book/images/general.png diff --git a/tqtinterface/qt4/tools/assistant/book/images/pdf1.png b/tqtinterface/qt4/tools/assistant/book/images/pdf1.png Binary files differnew file mode 100644 index 0000000..104ac16 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/book/images/pdf1.png diff --git a/tqtinterface/qt4/tools/assistant/book/images/search.png b/tqtinterface/qt4/tools/assistant/book/images/search.png Binary files differnew file mode 100644 index 0000000..667a4a6 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/book/images/search.png diff --git a/tqtinterface/qt4/tools/assistant/book/images/sidebar.png b/tqtinterface/qt4/tools/assistant/book/images/sidebar.png Binary files differnew file mode 100644 index 0000000..7e005cd --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/book/images/sidebar.png diff --git a/tqtinterface/qt4/tools/assistant/book/images/toolbar1.png b/tqtinterface/qt4/tools/assistant/book/images/toolbar1.png Binary files differnew file mode 100644 index 0000000..0f3358a --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/book/images/toolbar1.png diff --git a/tqtinterface/qt4/tools/assistant/book/images/web.png b/tqtinterface/qt4/tools/assistant/book/images/web.png Binary files differnew file mode 100644 index 0000000..5888f79 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/book/images/web.png diff --git a/tqtinterface/qt4/tools/assistant/config.cpp b/tqtinterface/qt4/tools/assistant/config.cpp new file mode 100644 index 0000000..56ac848 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/config.cpp @@ -0,0 +1,379 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "config.h" +#include "profile.h" +#include "docuparser.h" + +#include <tqapplication.h> +#include <tqdir.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqsettings.h> +#include <tqxml.h> + +static Config *static_configuration = 0; + +inline TQString getVersionString() +{ + return TQString::number( (TQT_VERSION >> 16) & 0xff ) + + "." + TQString::number( (TQT_VERSION >> 8) & 0xff ); +} + +Config::Config() + : hideSidebar( FALSE ), profil( 0 ), maximized(FALSE) +{ + fontSiz = tqApp->font().pointSize(); + if( !static_configuration ) { + static_configuration = this; + } else { + qWarning( "Multiple configurations not allowed!" ); + } +} + +Config *Config::loadConfig(const TQString &profileFileName) +{ + Config *config = new Config(); + + if (profileFileName.isEmpty()) { // no profile + config->profil = Profile::createDefaultProfile(); + config->load(); + config->loadDefaultProfile(); + return config; + } + + TQFile file(profileFileName); + if (!file.exists()) { + qWarning( "File does not exist: " + profileFileName ); + return 0; + } + DocuParser *parser = DocuParser::createParser( profileFileName ); + if (!parser) { + qWarning( "Failed to create parser for file: " + profileFileName ); + return 0; + } + if (parser->parserVersion() < DocuParser::TQt320) { + 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: " + profileFileName ); + return 0; + } + config->profil->setProfileType(Profile::UserProfile); + config->profil->setDocuParser(profileParser); + config->load(); + return config; +} + +Config *Config::configuration() +{ + TQ_ASSERT( static_configuration ); + return static_configuration; +} + +void Config::load() +{ + const TQString key = "/TQt Assistant/" + getVersionString() + "/"; + const TQString profkey = key + "Profile/" + profil->props["name"] + "/"; + + TQSettings settings; + settings.insertSearchPath( TQSettings::Windows, "/Trolltech" ); + + webBrows = settings.readEntry( key + "Webbrowser" ); + home = settings.readEntry( profkey + "Homepage" ); + pdfApp = settings.readEntry( key + "PDFApplication" ); + linkUnder = settings.readBoolEntry( key + "LinkUnderline", TRUE ); + linkCol = settings.readEntry( key + "LinkColor", "#0000FF" ); + src = settings.readListEntry( profkey + "Source" ); + sideBar = settings.readNumEntry( key + "SideBarPage" ); + if (tqApp->type() != TQApplication::Tty) { + fontFam = settings.readEntry( key + "Family", tqApp->font().family() ); + + fontFix = settings.readEntry( key + "FixedFamily", "courier" ); + fontSiz = settings.readNumEntry( key + "Size", -1 ); + if ( fontSiz < 4 ) { + fontSiz = tqApp->font().pointSize(); + } + + geom.setRect( settings.readNumEntry( key + "GeometryX", TQApplication::desktop()->availableGeometry().x() ), + settings.readNumEntry( key + "GeometryY", TQApplication::desktop()->availableGeometry().y() ), + settings.readNumEntry( key + "GeometryWidth", 800 ), + settings.readNumEntry( key + "GeometryHeight", 600 ) ); + maximized = settings.readBoolEntry( key + "GeometryMaximized", FALSE ); + } + mainWinLayout = settings.readEntry( key + "MainwindowLayout" ); + rebuildDocs = settings.readBoolEntry( key + "RebuildDocDB", TRUE ); + + profileNames = settings.entryList( key + "Profile" ); +} + +void Config::save() +{ + saveSettings(); + saveProfile( profil ); +} + +void Config::saveSettings() +{ + const TQString key = "/TQt Assistant/" + getVersionString() + "/"; + const TQString profkey = key + "Profile/" + profil->props["name"] + "/"; + + TQSettings settings; + settings.insertSearchPath( TQSettings::Windows, "/Trolltech" ); + + settings.writeEntry( key + "Webbrowser", webBrows ); + settings.writeEntry( profkey + "Homepage", home ); + settings.writeEntry( key + "PDFApplication", pdfApp ); + settings.writeEntry( key + "LinkUnderline", linkUnder ); + settings.writeEntry( key + "LinkColor", linkCol ); + settings.writeEntry( profkey + "Source", src ); + settings.writeEntry( key + "SideBarPage", sideBarPage() ); + if (tqApp->type() != TQApplication::Tty) { + settings.writeEntry( key + "GeometryX", geom.x() ); + settings.writeEntry( key + "GeometryY", geom.y() ); + settings.writeEntry( key + "GeometryWidth", geom.width() ); + settings.writeEntry( key + "GeometryHeight", geom.height() ); + settings.writeEntry( key + "GeometryMaximized", maximized ); + settings.writeEntry( key + "Family", fontFam ); + settings.writeEntry( key + "Size", fontSiz < 4 ? tqApp->font().pointSize() : fontSiz ); + settings.writeEntry( key + "FixedFamily", fontFix ); + } + if ( !hideSidebar ) + settings.writeEntry( key + "MainwindowLayout", mainWinLayout ); + settings.writeEntry( key + "RebuildDocDB", rebuildDocs ); +} + +#ifdef ASSISTANT_DEBUG +static void dumpmap( const TQMap<TQString,TQString> &m, const TQString &header ) +{ + qDebug( header ); + TQMap<TQString,TQString>::ConstIterator it = m.begin(); + while (it != m.end()) { + qDebug( " " + it.key() + ":\t\t" + *it ); + ++it; + } +} +#endif + +void Config::loadDefaultProfile() +{ + TQSettings settings; + settings.insertSearchPath( TQSettings::Windows, "/Trolltech" ); + const TQString key = "/TQt Assistant/" + TQString(TQT_VERSION_STR) + "/Profile"; + const TQString profKey = key + "/default/"; + + if( settings.entryList( key + "/default" ).count() == 0 ) { + return; + } + + // Override the defaults with settings in registry. + profil->icons.clear(); + profil->indexPages.clear(); + profil->imageDirs.clear(); + profil->docs.clear(); + profil->dcfTitles.clear(); + + TQStringList titles = settings.readListEntry( profKey + "Titles" ); + TQStringList iconLst = settings.readListEntry( profKey + "DocIcons" ); + TQStringList indexLst = settings.readListEntry( profKey + "IndexPages" ); + TQStringList imgDirLst = settings.readListEntry( profKey + "ImageDirs" ); + TQStringList dcfs = settings.readListEntry( profKey + "DocFiles" ); + + TQStringList::ConstIterator it = titles.begin(); + TQValueListConstIterator<TQString> iconIt = iconLst.begin(); + TQValueListConstIterator<TQString> indexIt = indexLst.begin(); + TQValueListConstIterator<TQString> imageIt = imgDirLst.begin(); + TQValueListConstIterator<TQString> dcfIt = dcfs.begin(); + for( ; it != titles.end(); + ++it, ++iconIt, ++indexIt, ++imageIt, ++dcfIt ) + { + profil->addDCFIcon( *it, *iconIt ); + profil->addDCFIndexPage( *it, *indexIt ); + profil->addDCFImageDir( *it, *imageIt ); + profil->addDCFTitle( *dcfIt, *it ); + } +#if ASSISTANT_DEBUG + dumpmap( profil->icons, "Icons" ); + dumpmap( profil->indexPages, "IndexPages" ); + dumpmap( profil->imageDirs, "ImageDirs" ); + dumpmap( profil->dcfTitles, "dcfTitles" ); + qDebug( "Docfiles: \n " + profil->docs.join( "\n " ) ); +#endif +} + +void Config::saveProfile( Profile *profile ) +{ + if (profil && profil->profileType() == Profile::UserProfile) + return; + TQSettings settings; + settings.insertSearchPath( TQSettings::Windows, "/Trolltech" ); + TQString versionString = (profile->props["name"] == "default") + ? TQString(TQT_VERSION_STR) + : getVersionString(); + const TQString key = "/TQt Assistant/" + versionString + "/"; + const TQString profKey = key + "Profile/" + profile->props["name"] + "/"; + + TQStringList indexes, icons, imgDirs, dcfs; + TQValueList<TQString> titles = profile->dcfTitles.keys(); + TQValueListConstIterator<TQString> it = titles.begin(); + for ( ; it != titles.end(); ++it ) { + indexes << profile->indexPages[*it]; + icons << profile->icons[*it]; + imgDirs << profile->imageDirs[*it]; + dcfs << profile->dcfTitles[*it]; + } + + settings.writeEntry( profKey + "Titles", titles ); + settings.writeEntry( profKey + "DocFiles", dcfs ); + settings.writeEntry( profKey + "IndexPages", indexes ); + settings.writeEntry( profKey + "DocIcons", icons ); + settings.writeEntry( profKey + "ImageDirs", imgDirs ); + +#if ASSISTANT_DEBUG + qDebug( "Titles:\n - " + ( (TQStringList*) &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 +} + +TQStringList Config::mimePaths() +{ + static TQStringList lst; + + if( lst.count() > 0 ) + return lst; + + for (TQMap<TQString,TQString>::ConstIterator it = profil->dcfTitles.begin(); + it != profil->dcfTitles.end(); ++it ) { + + // Mime source for .dcf file path + TQFileInfo info( *it ); + TQString dcfPath = info.dirPath(TRUE); + if (lst.tqcontains(dcfPath) == 0) + lst << dcfPath; + + // Image dir for .dcf + TQString imgDir = TQDir::convertSeparators( dcfPath + TQDir::separator() + + profil->imageDirs[it.key()] ); + if (lst.tqcontains(imgDir) == 0) + lst << imgDir; + } + return lst; +} + +TQStringList Config::profiles() const +{ + return profileNames; +} + +TQString Config::title() const +{ + return profil->props[ "title" ]; +} + +TQString Config::aboutApplicationMenuText() const +{ + return profil->props[ "aboutmenutext" ]; +} + +TQString Config::aboutURL() const +{ + return profil->props[ "abouturl" ]; +} + +TQString Config::homePage() const +{ + return home.isEmpty() ? profil->props["startpage"] : home; +} + +TQStringList Config::source() const +{ + return src.size() == 0 ? TQStringList(profil->props["startpage"]) : src; +} + +TQStringList Config::docFiles() const +{ + return profil->docs; +} + +TQPixmap Config::docIcon( const TQString &title ) const +{ + // ### To allow qdoc generated dcf files to reference the doc icons from qmake_image_col + if (!TQFile::exists(profil->icons[title])) + return TQPixmap::fromMimeSource( TQFileInfo(profil->icons[title]).fileName() ); + return TQPixmap::fromMimeSource( profil->icons[title] ); +} + +TQPixmap Config::applicationIcon() const +{ + return TQPixmap::fromMimeSource( profil->props["applicationicon"] ); +} + +TQStringList Config::docTitles() const +{ + return TQStringList(profil->indexPages.keys()); +} + +TQString Config::docImageDir( const TQString &docfile ) const +{ + return profil->imageDirs[docfile]; +} + +TQString Config::indexPage( const TQString &title ) const +{ + return profil->indexPages + [title]; +} + +void Config::hideSideBar( bool b ) +{ + hideSidebar = b; +} + +bool Config::sideBarHidden() const +{ + return hideSidebar; +} + +TQString Config::assistantDocPath() const +{ + return profil->props["assistantdocs"].isEmpty() + ? TQString( qInstallPathDocs() ) + "/html" + : profil->props["assistantdocs"]; +} diff --git a/tqtinterface/qt4/tools/assistant/config.h b/tqtinterface/qt4/tools/assistant/config.h new file mode 100644 index 0000000..56e9f70 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/config.h @@ -0,0 +1,152 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "profile.h" + +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqpixmap.h> +#include <tqmap.h> + +class Profile; + +class Config +{ +public: + + Config(); + + void load(); + void save(); + Profile *profile() const { return profil; } + TQString profileName() const { return profil->props["name"]; } + bool validProfileName() const; + void hideSideBar( bool b ); + bool sideBarHidden() const; + TQStringList mimePaths(); + + // From profile, read only + TQStringList docFiles() const; + TQStringList docTitles() const; + TQString indexPage( const TQString &title ) const; + TQString docImageDir( const TQString &title ) const; + TQPixmap docIcon( const TQString &title ) const; + + TQStringList profiles() const; + TQString title() const; + TQString aboutApplicationMenuText() const; + TQString aboutURL() const; + TQPixmap applicationIcon() const; + + // From TQSettings, read / write + TQString webBrowser() const { return webBrows; } + void setWebBrowser( const TQString &cmd ) { webBrows = cmd; } + + TQString homePage() const; + void setHomePage( const TQString &hom ) { home = hom; } + + TQString pdfReader() const { return pdfApp; } + void setPdfReader( const TQString &cmd ) { pdfApp = cmd; } + + int fontSize() const { return fontSiz; } + void setFontSize( int size ) { fontSiz = size; } + + TQString fontFamily() const { return fontFam; } + void setFontFamily( const TQString &fam ) { fontFam = fam; } + + TQString fontFixedFamily() const { return fontFix; } + void setFontFixedFamily( const TQString &fn ) { fontFix = fn; } + + TQString linkColor() const { return linkCol; } + void setLinkColor( const TQString &col ) { linkCol = col; } + + TQStringList source() const; + void setSource( const TQStringList &s ) { src = s; } + + int sideBarPage() const { return sideBar; } + void setSideBarPage( int sbp ) { sideBar = sbp; } + + TQRect tqgeometry() const { return geom; } + void setGeometry( const TQRect &geo ) { geom = geo; } + + bool isMaximized() const { return maximized; } + void setMaximized( bool max ) { maximized = max; } + + bool isLinkUnderline() const { return linkUnder; } + void setLinkUnderline( bool ul ) { linkUnder = ul; } + + TQString mainWindowLayout() const { return mainWinLayout; } + void setMainWindowLayout( const TQString &tqlayout ) { mainWinLayout = tqlayout; } + + TQString assistantDocPath() const; + + bool docRebuild() const { return rebuildDocs; } + void setDocRebuild( bool rb ) { rebuildDocs = rb; } + + void saveProfile( Profile *profile ); + void loadDefaultProfile(); + + static Config *configuration(); + static Config *loadConfig(const TQString &profileFileName); + +private: + Config( const Config &c ); + Config& operator=( const Config &c ); + + void saveSettings(); + +private: + Profile *profil; + + TQStringList profileNames; + TQString webBrows; + TQString home; + TQString pdfApp; + TQString fontFam; + TQString fontFix; + TQString linkCol; + TQStringList src; + TQString mainWinLayout; + TQRect geom; + int sideBar; + int fontSiz; + bool maximized; + bool linkUnder; + bool hideSidebar; + bool rebuildDocs; +}; + +#endif diff --git a/tqtinterface/qt4/tools/assistant/docuparser.cpp b/tqtinterface/qt4/tools/assistant/docuparser.cpp new file mode 100644 index 0000000..f1c2f01 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/docuparser.cpp @@ -0,0 +1,397 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "docuparser.h" +#include "profile.h" + +#include <tqdir.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqregexp.h> +#include <tqstring.h> +#include <tqxml.h> + +TQDataStream &operator>>( TQDataStream &s, ContentItem &ci ) +{ + s >> ci.title; + s >> ci.reference; + s >> ci.depth; + return s; +} + +TQDataStream &operator<<( TQDataStream &s, const ContentItem &ci ) +{ + s << ci.title; + s << ci.reference; + s << ci.depth; + return s; +} + +const TQString DocuParser::DocumentKey = "/TQt Assistant/" + TQString(TQT_VERSION_STR) + "/"; + +DocuParser *DocuParser::createParser( const TQString &fileName ) +{ + TQFile file( fileName ); + if( !file.open( IO_ReadOnly ) ) { + return 0; + } + + TQString str; + int read = 0; + int maxlen = 1024; + int majVer = 0, minVer = 0, serVer = 0; + static TQRegExp re( "assistantconfig +version=\"(\\d)\\.(\\d)\\.(\\d)\"", FALSE ); + TQ_ASSERT( re.isValid() ); + while( read != -1 ) { + read = file.readLine( str, maxlen ); + if( re.search( str ) >= 0 ) { + majVer = re.cap( 1 ).toInt(); + minVer = re.cap( 2 ).toInt(); + serVer = re.cap( 3 ).toInt(); + } + } + + if( majVer == 3 && minVer >= 2 ) + return new DocuParser320; + + return new DocuParser310; +} + + +bool DocuParser::parse( TQFile *file ) +{ + TQXmlInputSource source( TQT_TQIODEVICE(file) ); + TQXmlSimpleReader reader; + reader.setContentHandler( this ); + reader.setErrorHandler( this ); + setFileName( TQFileInfo( *file ).absFilePath() ); + return reader.parse( source ); +} + + +TQString DocuParser::errorProtocol() const +{ + return errorProt; +} + + +TQValueList<ContentItem> DocuParser::getContentItems() +{ + return contentList; +} + + +TQPtrList<IndexItem> DocuParser::getIndexItems() +{ + return indexList; +} + +TQString DocuParser::absolutify( const TQString &name ) const +{ + TQFileInfo orgPath( name ); + if( orgPath.isRelative() ) + return TQFileInfo( fname ).dirPath() + TQDir::separator() + name; + 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 = ""; + + contentRef = ""; + indexRef = ""; + depth = 0; + contentList.clear(); + indexList.clear(); + + return TRUE; +} + + +bool DocuParser310::startElement( const TQString &, const TQString &, + const TQString &qname, + const TQXmlAttributes &attr ) +{ + if (qname == "DCF" && state == StateInit) { + state = StateContent; + contentRef = absolutify( attr.value( "ref" ) ); + conURL = contentRef; + docTitle = attr.value( "title" ); + iconName = absolutify( attr.value( "icon" ) ); + contentList.append( ContentItem( docTitle, contentRef, depth ) ); + } else if (qname == "section" && (state == StateContent || state == StateSect)) { + state = StateSect; + contentRef = absolutify( attr.value( "ref" ) ); + title = attr.value( "title" ); + depth++; + contentList.append( ContentItem( title, contentRef, depth ) ); + } else if (qname == "keyword" && state == StateSect) { + state = StateKeyword; + indexRef = absolutify( attr.value( "ref" ) ); + } else + return FALSE; + return TRUE; +} + +bool DocuParser310::endElement( const TQString &nameSpace, const TQString &localName, + const TQString &qName ) +{ + switch( state ) { + case StateInit: + break; + case StateContent: + state = StateInit; + break; + case StateSect: + state = --depth ? StateSect : StateContent; + break; + case StateKeyword: + state = StateSect; + break; + } + return TRUE; +} + + +bool DocuParser310::characters( const TQString& ch ) +{ + TQString str = ch.simplifyWhiteSpace(); + 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 TQXmlParseException& exception ) +{ + errorProt += TQString( "fatal parsing error: %1 in line %2, column %3\n" ) + .arg( exception.message() ) + .arg( exception.lineNumber() ) + .arg( exception.columnNumber() ); + + return TQXmlDefaultHandler::fatalError( exception ); +} + + +DocuParser320::DocuParser320() + : prof( new Profile ) +{ +} + + +void DocuParser320::addTo( Profile *p ) +{ + TQMap<TQString,TQString>::ConstIterator it; + + for (it = prof->dcfTitles.begin(); it != prof->dcfTitles.end(); ++it) + p->dcfTitles[it.key()] = *it; + + for (it = prof->icons.begin(); it != prof->icons.end(); ++it) + p->icons[it.key()] = *it; + + for (it = prof->indexPages.begin(); it != prof->indexPages.end(); ++it) + p->indexPages[it.key()] = *it; +} + + +bool DocuParser320::startDocument() +{ + state = StateInit; + errorProt = ""; + + contentRef = ""; + indexRef = ""; + depth = 0; + contentList.clear(); + indexList.clear(); + + prof->addDCF( fname ); + + return TRUE; +} + +bool DocuParser320::startElement( const TQString &, const TQString &, + const TQString &qname, + const TQXmlAttributes &attr ) +{ + TQString lower = qname.lower(); + + switch( state ) { + + case StateInit: + if( lower == "assistantconfig" ) + state = StateDocRoot; + break; + + case StateDocRoot: + if( lower == "dcf" ) { + state = StateContent; + contentRef = absolutify( attr.value( "ref" ) ); + conURL = contentRef; + docTitle = attr.value( "title" ); + iconName = absolutify( attr.value( "icon" ) ); + contentList.append( ContentItem( docTitle, contentRef, depth ) ); + } else if( lower == "profile" ) { + state = StateProfile; + } + break; + + case StateSect: + if ( lower == "keyword" && state == StateSect ) { + state = StateKeyword; + indexRef = absolutify( attr.value( "ref" ) ); + break; + } // else if (lower == "section") + case StateContent: + if( lower == "section" ) { + state = StateSect; + contentRef = absolutify( attr.value( "ref" ) ); + title = attr.value( "title" ); + depth++; + contentList.append( ContentItem( title, contentRef, depth ) ); + } + break; + + case StateProfile: + if( lower == "property" ) { + state = StateProperty; + propertyName = attr.value( "name" ); + } + break; + + case StateProperty: + break; + } + + return TRUE; +} + +bool DocuParser320::endElement( const TQString &nameSpace, + const TQString &localName, + const TQString &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 TQStringList lst = TQStringList() << "startpage" << "abouturl" + << "applicationicon" << "assistantdocs"; + if (lst.tqcontains(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 TQString& ch ) +{ + TQString str = ch.simplifyWhiteSpace(); + 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 TQXmlParseException& exception ) +{ + errorProt += TQString( "fatal parsing error: %1 in line %2, column %3\n" ) + .arg( exception.message() ) + .arg( exception.lineNumber() ) + .arg( exception.columnNumber() ); + + return TQXmlDefaultHandler::fatalError( exception ); +} diff --git a/tqtinterface/qt4/tools/assistant/docuparser.h b/tqtinterface/qt4/tools/assistant/docuparser.h new file mode 100644 index 0000000..0ca4d61 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/docuparser.h @@ -0,0 +1,151 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef DOCUPARSER_H +#define DOCUPARSER_H + +#include <tqxml.h> +#include <tqptrlist.h> +#include <tqmap.h> + +class Profile; + +struct ContentItem { + ContentItem() + : title( TQString() ), reference( TQString() ), depth( 0 ) {} + ContentItem( const TQString &t, const TQString &r, int d ) + : title( t ), reference( r ), depth( d ) {} + TQString title; + TQString reference; + int depth; + TQ_DUMMY_COMPARISON_OPERATOR(ContentItem) +}; + +TQDataStream &operator>>( TQDataStream &s, ContentItem &ci ); +TQDataStream &operator<<( TQDataStream &s, const ContentItem &ci ); + +struct IndexItem { + IndexItem( const TQString &k, const TQString &r ) + : keyword( k ), reference( r ) {} + TQString keyword; + TQString reference; +}; + + + +class DocuParser : public TQXmlDefaultHandler +{ +public: + enum ParserVersion { TQt310, TQt320 }; + // Since We don't want problems with documentation + // from version to version, this string stores the correct + // version string to save documents. + static const TQString DocumentKey; + + static DocuParser *createParser( const TQString &fileName ); + + virtual bool parse( TQFile *file ); + + TQValueList<ContentItem> getContentItems(); + TQPtrList<IndexItem> getIndexItems(); + + TQString errorProtocol() const; + TQString contentsURL() const { return conURL; } + + virtual ParserVersion parserVersion() const = 0; + virtual void addTo( Profile *p ) = 0; + + TQString fileName() const { return fname; } + void setFileName( const TQString &file ) { fname = file; } + +protected: + TQString absolutify( const TQString &input ) const; + + TQString contentRef, indexRef, errorProt, conURL; + TQString docTitle, title, iconName; + TQValueList<ContentItem> contentList; + TQPtrList<IndexItem> indexList; + TQString fname; +}; + + +class DocuParser310 : public DocuParser +{ +public: + enum States{ StateInit, StateContent, StateSect, StateKeyword }; + + bool startDocument(); + bool startElement( const TQString&, const TQString&, const TQString& , + const TQXmlAttributes& ); + bool endElement( const TQString&, const TQString&, const TQString& ); + bool characters( const TQString & ); + bool fatalError( const TQXmlParseException& exception ); + + virtual ParserVersion parserVersion() const { return TQt310; } + 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 TQString&, const TQString&, const TQString& , + const TQXmlAttributes& ); + bool endElement( const TQString&, const TQString&, const TQString& ); + bool characters( const TQString & ); + bool fatalError( const TQXmlParseException& exception ); + + virtual ParserVersion parserVersion() const { return TQt320; } + virtual void addTo( Profile *p ); + Profile *profile() const { return prof; } + +private: + + States state; + int depth; + int docfileCounter; + TQString propertyValue; + TQString propertyName; + Profile *prof; +}; +#endif //DOCUPARSER_H diff --git a/tqtinterface/qt4/tools/assistant/finddialog.ui b/tqtinterface/qt4/tools/assistant/finddialog.ui new file mode 100644 index 0000000..56fd582 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/finddialog.ui @@ -0,0 +1,292 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>FindDialog</class> +<comment>********************************************************************* + +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. + +** + +** This file is part of Qt Assistant. + +** + +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** + +*********************************************************************</comment> +<widget class="TQDialog"> + <property name="name"> + <cstring>FindDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>362</width> + <height>156</height> + </rect> + </property> + <property name="caption"> + <string>Qt Assistant - Find Text</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout5</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <widget class="TQButtonGroup" row="1" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>ButtonGroup2</cstring> + </property> + <property name="title"> + <string>&Direction</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>radioForward</cstring> + </property> + <property name="text"> + <string>Fo&rward</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>radioBackward</cstring> + </property> + <property name="text"> + <string>&Backward</string> + </property> + </widget> + </vbox> + </widget> + <widget class="TQLayoutWidget" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>F&ind:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>comboFind</cstring> + </property> + </widget> + <widget class="TQComboBox"> + <property name="name"> + <cstring>comboFind</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </hbox> + </widget> + <spacer row="2" column="2"> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="tqsizeHint"> + <size> + <width>31</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQPushButton" row="1" column="2"> + <property name="name"> + <cstring>PushButton2</cstring> + </property> + <property name="text"> + <string>C&lose</string> + </property> + <property name="accel"> + <string>Alt+L</string> + </property> + </widget> + <widget class="TQButtonGroup" row="1" column="0" rowspan="2" colspan="1"> + <property name="name"> + <cstring>ButtonGroup1</cstring> + </property> + <property name="title"> + <string>&Options</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>checkWords</cstring> + </property> + <property name="text"> + <string>&Whole words only</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>checkCase</cstring> + </property> + <property name="text"> + <string>&Case sensitive</string> + </property> + </widget> + </vbox> + </widget> + <widget class="TQPushButton" row="0" column="2"> + <property name="name"> + <cstring>PushButton1</cstring> + </property> + <property name="text"> + <string>&Find</string> + </property> + <property name="accel"> + <string>Alt+F</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </grid> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>PushButton1</sender> + <signal>clicked()</signal> + <receiver>FindDialog</receiver> + <slot>doFind()</slot> + </connection> + <connection> + <sender>PushButton2</sender> + <signal>clicked()</signal> + <receiver>FindDialog</receiver> + <slot>reject()</slot> + </connection> +</connections> +<tabstops> + <tabstop>comboFind</tabstop> + <tabstop>checkWords</tabstop> + <tabstop>checkCase</tabstop> + <tabstop>radioForward</tabstop> + <tabstop>radioBackward</tabstop> + <tabstop>PushButton1</tabstop> + <tabstop>PushButton2</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in implementation">tqstatusbar.h</include> + <include location="global" impldecl="in implementation">tqtextbrowser.h</include> + <include location="local" impldecl="in implementation">mainwindow.h</include> + <include location="local" impldecl="in implementation">tabbedbrowser.h</include> + <include location="local" impldecl="in implementation">finddialog.ui.h</include> +</includes> +<forwards> + <forward>class TQTextBrowser;</forward> + <forward>class TQStatusBar;</forward> + <forward>class MainWindow;</forward> +</forwards> +<variables> + <variable>TQStatusBar *sb;</variable> + <variable>bool onceFound;</variable> + <variable>TQString tqfindExpr;</variable> + <variable>TQTextBrowser *lastBrowser;</variable> +</variables> +<Q_SLOTS> + <slot access="protected">init()</slot> + <slot access="protected">destroy()</slot> + <slot>doFind()</slot> + <slot>doFind(bool)</slot> + <slot>statusMessage(const TQString &message)</slot> +</Q_SLOTS> +<functions> + <function specifier="non virtual" returnType="MainWindow *">mainWindow()</function> + <function specifier="non virtual" returnType="bool">hasFindExpression()</function> +</functions> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/assistant/finddialog.ui.h b/tqtinterface/qt4/tools/assistant/finddialog.ui.h new file mode 100644 index 0000000..dc10393 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/finddialog.ui.h @@ -0,0 +1,108 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include <tqapplication.h> + +void FindDialog::init() +{ + lastBrowser = 0; + onceFound = FALSE; + tqfindExpr = ""; + sb = new TQStatusBar( this ); + FindDialogLayout->addWidget( sb ); + sb->message( tr( "Enter the text you are looking for." ) ); +} + +void FindDialog::destroy() +{ +} + +void FindDialog::doFind() +{ + doFind(radioForward->isChecked()); +} + +void FindDialog::doFind(bool forward) +{ + TQTextBrowser *browser = (TQTextBrowser*) mainWindow()->browsers()->currentBrowser(); + sb->clear(); + + if (comboFind->currentText() != tqfindExpr || lastBrowser != browser) + onceFound = false; + tqfindExpr = comboFind->currentText(); + + bool found; + if (browser->hasSelectedText()) { // Search either forward or backward from cursor. + found = browser->tqfind(tqfindExpr, checkCase->isChecked(), checkWords->isChecked(), + forward); + } else { + int para = forward ? 0 : INT_MAX; + int index = forward ? 0 : INT_MAX; + found = browser->tqfind(tqfindExpr, checkCase->isChecked(), checkWords->isChecked(), + forward, ¶, &index); + } + + if (!found) { + if (onceFound) { + if (forward) + statusMessage(tr("Search reached end of the document")); + else + statusMessage(tr("Search reached start of the document")); + } else { + statusMessage(tr( "Text not found" )); + } + } + onceFound |= found; + lastBrowser = browser; +} + + + +MainWindow* FindDialog::mainWindow() +{ + return (MainWindow*) tqparent(); +} + +bool FindDialog::hasFindExpression() +{ + return !tqfindExpr.isEmpty(); +} + +void FindDialog::statusMessage(const TQString &message) +{ + if (isVisible()) + sb->message(message); + else + ((MainWindow*) tqparent())->statusBar()->message(message, 2000); + +} diff --git a/tqtinterface/qt4/tools/assistant/helpdialog.ui b/tqtinterface/qt4/tools/assistant/helpdialog.ui new file mode 100644 index 0000000..3f61572 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/helpdialog.ui @@ -0,0 +1,506 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>HelpDialogBase</class> +<comment>********************************************************************* +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +*********************************************************************</comment> +<widget class="TQWidget"> + <property name="name"> + <cstring>HelpDialogBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>268</width> + <height>448</height> + </rect> + </property> + <property name="caption"> + <string>Help</string> + </property> + <property name="whatsThis" stdset="0"> + <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> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQTabWidget"> + <property name="name"> + <cstring>tabWidget</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.</string> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>contentPage</cstring> + </property> + <attribute name="title"> + <string>Con&tents</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>5</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQListView"> + <column> + <property name="text"> + <string>Column 1</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>listContents</cstring> + </property> + <property name="rootIsDecorated"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <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> + </widget> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>Widget8</cstring> + </property> + <attribute name="title"> + <string>&Index</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>5</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>&Look For:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>editIndex</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>editIndex</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Enter keyword</string> + </property> + <property name="whatsThis" stdset="0"> + <string><b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p></string> + </property> + </widget> + <widget class="TQListBox"> + <property name="name"> + <cstring>listIndex</cstring> + </property> + <property name="whatsThis" stdset="0"> + <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> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>Widget9</cstring> + </property> + <attribute name="title"> + <string>&Bookmarks</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>5</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQListView"> + <column> + <property name="text"> + <string>Column 1</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>listBookmarks</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Displays the list of bookmarks.</string> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="tqsizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>buttonAdd</cstring> + </property> + <property name="text"> + <string>&New</string> + </property> + <property name="toolTip" stdset="0"> + <string>Add new bookmark</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Add the currently displayed page as a new bookmark.</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>buttonRemove</cstring> + </property> + <property name="text"> + <string>&Delete</string> + </property> + <property name="toolTip" stdset="0"> + <string>Delete bookmark</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Delete the selected bookmark.</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>searchTab</cstring> + </property> + <attribute name="title"> + <string>&Search</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>5</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer row="3" column="0"> + <property name="name"> + <cstring>Spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="tqsizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1_2</cstring> + </property> + <property name="text"> + <string>Searching f&or:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>termsEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="1" column="0"> + <property name="name"> + <cstring>termsEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Enter searchword(s).</string> + </property> + <property name="whatsThis" stdset="0"> + <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> + <widget class="TQListBox" row="5" column="0"> + <property name="name"> + <cstring>resultBox</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string><b>Found documents</b><p>This list tqcontains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p></string> + </property> + </widget> + <widget class="TQLabel" row="4" column="0"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>Found &Documents:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>resultBox</cstring> + </property> + </widget> + <widget class="TQLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>Layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQPushButton"> + <property name="name"> + <cstring>helpButton</cstring> + </property> + <property name="text"> + <string>He&lp</string> + </property> + <property name="toolTip" stdset="0"> + <string>Display the help page.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Display the help page for the full text search.</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="tqsizeHint"> + <size> + <width>61</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>searchButton</cstring> + </property> + <property name="text"> + <string>&Search</string> + </property> + <property name="toolTip" stdset="0"> + <string>Start searching.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Pressing this button starts the search.</string> + </property> + </widget> + </hbox> + </widget> + </grid> + </widget> + </widget> + <widget class="TQFrame"> + <property name="name"> + <cstring>framePrepare</cstring> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>3</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>labelPrepare</cstring> + </property> + <property name="text"> + <string>Preparing...</string> + </property> + </widget> + <widget class="TQProgressBar"> + <property name="name"> + <cstring>progressPrepare</cstring> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>buttonAdd</sender> + <signal>clicked()</signal> + <receiver>HelpDialogBase</receiver> + <slot>addBookmark()</slot> + </connection> + <connection> + <sender>buttonRemove</sender> + <signal>clicked()</signal> + <receiver>HelpDialogBase</receiver> + <slot>removeBookmark()</slot> + </connection> + <connection> + <sender>termsEdit</sender> + <signal>returnPressed()</signal> + <receiver>searchButton</receiver> + <slot>animateClick()</slot> + </connection> + <connection> + <sender>helpButton</sender> + <signal>clicked()</signal> + <receiver>HelpDialogBase</receiver> + <slot>showSearchHelp()</slot> + </connection> + <connection> + <sender>searchButton</sender> + <signal>clicked()</signal> + <receiver>HelpDialogBase</receiver> + <slot>startSearch()</slot> + </connection> + <connection> + <sender>resultBox</sender> + <signal>returnPressed(TQListBoxItem*)</signal> + <receiver>HelpDialogBase</receiver> + <slot>showResultPage(TQListBoxItem*)</slot> + </connection> + <connection> + <sender>resultBox</sender> + <signal>mouseButtonClicked(int, TQListBoxItem*, const TQPoint &)</signal> + <receiver>HelpDialogBase</receiver> + <slot>showResultPage(int, TQListBoxItem*, const TQPoint & )</slot> + </connection> +</connections> +<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> +<Q_SLOTS> + <slot access="protected">init()</slot> + <slot access="protected">destroy()</slot> + <slot access="protected">addBookmark()</slot> + <slot access="protected">currentBookmarkChanged( TQListViewItem * )</slot> + <slot access="protected">currentIndexChanged( TQListBoxItem * )</slot> + <slot access="protected">currentTabChanged( const TQString & )</slot> + <slot access="protected">loadIndexFile()</slot> + <slot access="protected">currentContentsChanged( TQListViewItem * )</slot> + <slot access="protected">removeBookmark()</slot> + <slot access="protected">searchInIndex( const TQString & )</slot> + <slot access="protected">showTopic()</slot> + <slot access="protected">showTopic( int, TQListBoxItem *, const TQPoint & )</slot> + <slot access="protected">showSearchHelp()</slot> + <slot access="protected">startSearch()</slot> + <slot access="protected">showResultPage( TQListBoxItem * )</slot> + <slot access="protected">showResultPage( int, TQListBoxItem *, const TQPoint & )</slot> + <slot access="protected">showResultPage( int, TQListViewItem *, const TQPoint & )</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/assistant/helpdialogimpl.cpp b/tqtinterface/qt4/tools/assistant/helpdialogimpl.cpp new file mode 100644 index 0000000..b608d51 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/helpdialogimpl.cpp @@ -0,0 +1,1161 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "helpdialogimpl.h" +#include "helpwindow.h" +#include "topicchooserimpl.h" +#include "docuparser.h" +#include "mainwindow.h" +#include "config.h" +#include "tabbedbrowser.h" + +#include <tqaccel.h> +#include <tqapplication.h> +#include <tqcursor.h> +#include <tqdir.h> +#include <tqeventloop.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqheader.h> +#include <tqlabel.h> +#include <tqlineedit.h> +#include <tqmessagebox.h> +#include <tqpixmap.h> +#include <tqprogressbar.h> +#include <tqptrlist.h> +#include <tqptrstack.h> +#include <tqpushbutton.h> +#include <tqregexp.h> +#include <tqsettings.h> +#include <tqstatusbar.h> +#include <tqtabwidget.h> +#include <tqtextbrowser.h> +#include <tqtextstream.h> +#include <tqtimer.h> +#include <tqurl.h> +#include <tqvalidator.h> + +#include <stdlib.h> +#include <limits.h> + +static TQString stripAmpersand( const TQString &str ) +{ + TQString s( str ); + s = s.tqreplace( '&', "" ); + return s; +} + +static bool verifyDirectory(const TQString &str) +{ + TQFileInfo dirInfo(str); + if (!dirInfo.exists()) + return TQDir().mkdir(str); + if (!dirInfo.isDir()) { + qWarning("'%s' exists but is not a directory", str.latin1()); + return FALSE; + } + return TRUE; +} + +struct IndexKeyword { + IndexKeyword( const TQString &kw, const TQString &l ) + : keyword( kw ), link( l ) {} + IndexKeyword() : keyword( TQString() ), link( TQString() ) {} + bool operator<( const IndexKeyword &ik ) const { + return keyword.lower() < ik.keyword.lower(); + } + bool operator<=( const IndexKeyword &ik ) const { + return keyword.lower() <= ik.keyword.lower(); + } + bool operator>( const IndexKeyword &ik ) const { + return keyword.lower() > ik.keyword.lower(); + } + TQ_DUMMY_COMPARISON_OPERATOR( IndexKeyword ) + TQString keyword; + TQString link; +}; + +TQDataStream &operator>>( TQDataStream &s, IndexKeyword &ik ) +{ + s >> ik.keyword; + s >> ik.link; + return s; +} + +TQDataStream &operator<<( TQDataStream &s, const IndexKeyword &ik ) +{ + s << ik.keyword; + s << ik.link; + return s; +} + +TQValidator::State SearchValidator::validate( TQString &str, int & ) const +{ + for ( int i = 0; i < (int) str.length(); ++i ) { + TQChar c = str[i]; + if ( !c.isLetterOrNumber() && c != '\'' && c != '`' + && c != '\"' && c != ' ' && c != '-' && c != '_' + && c!= '*' ) + return TQValidator::Invalid; + } + return TQValidator::Acceptable; +} + +HelpNavigationListItem::HelpNavigationListItem( TQListBox *ls, const TQString &txt ) + : TQListBoxText( ls, txt ) +{ +} + +void HelpNavigationListItem::addLink( const TQString &link ) +{ + int hash = link.tqfind( '#' ); + if ( hash == -1 ) { + linkList << link; + return; + } + + TQString preHash = link.left( hash ); + if ( linkList.grep( preHash, FALSE ).count() > 0 ) + return; + linkList << link; +} + +HelpNavigationContentsItem::HelpNavigationContentsItem( TQListView *v, TQListViewItem *after ) + : TQListViewItem( v, after ) +{ +} + +HelpNavigationContentsItem::HelpNavigationContentsItem( TQListViewItem *v, TQListViewItem *after ) + : TQListViewItem( v, after ) +{ +} + +void HelpNavigationContentsItem::setLink( const TQString &lnk ) +{ + theLink = lnk; +} + +TQString HelpNavigationContentsItem::link() const +{ + return theLink; +} + + + +HelpDialog::HelpDialog( TQWidget *tqparent, MainWindow *h ) + : HelpDialogBase( tqparent, 0, FALSE ), lwClosed( FALSE ), help( h ) +{ +} + +void HelpDialog::initialize() +{ + connect( tabWidget, TQT_SIGNAL( selected(const TQString&) ), + this, TQT_SLOT( currentTabChanged(const TQString&) ) ); + connect( listContents, TQT_SIGNAL( mouseButtonClicked(int, TQListViewItem*, const TQPoint &, int ) ), + this, TQT_SLOT( showTopic(int,TQListViewItem*, const TQPoint &) ) ); + connect( listContents, TQT_SIGNAL( currentChanged(TQListViewItem*) ), + this, TQT_SLOT( currentContentsChanged(TQListViewItem*) ) ); + connect( listContents, TQT_SIGNAL( selectionChanged(TQListViewItem*) ), + this, TQT_SLOT( currentContentsChanged(TQListViewItem*) ) ); + connect( listContents, TQT_SIGNAL( doubleClicked(TQListViewItem*) ), + this, TQT_SLOT( showTopic(TQListViewItem*) ) ); + connect( listContents, TQT_SIGNAL( returnPressed(TQListViewItem*) ), + this, TQT_SLOT( showTopic(TQListViewItem*) ) ); + connect( listContents, TQT_SIGNAL( contextMenuRequested( TQListViewItem*, const TQPoint&, int ) ), + this, TQT_SLOT( showItemMenu( TQListViewItem*, const TQPoint& ) ) ); + connect( editIndex, TQT_SIGNAL( returnPressed() ), + this, TQT_SLOT( showTopic() ) ); + connect( editIndex, TQT_SIGNAL( textChanged(const TQString&) ), + this, TQT_SLOT( searchInIndex(const TQString&) ) ); + + connect( listIndex, TQT_SIGNAL( selectionChanged(TQListBoxItem*) ), + this, TQT_SLOT( currentIndexChanged(TQListBoxItem*) ) ); + connect( listIndex, TQT_SIGNAL( returnPressed(TQListBoxItem*) ), + this, TQT_SLOT( showTopic() ) ); + connect( listIndex, TQT_SIGNAL( mouseButtonClicked(int, TQListBoxItem*, const TQPoint &) ), + this, TQT_SLOT( showTopic( int, TQListBoxItem *, const TQPoint & ) ) ); + connect( listIndex, TQT_SIGNAL( currentChanged(TQListBoxItem*) ), + this, TQT_SLOT( currentIndexChanged(TQListBoxItem*) ) ); + connect( listIndex, TQT_SIGNAL( contextMenuRequested( TQListBoxItem*, const TQPoint& ) ), + this, TQT_SLOT( showItemMenu( TQListBoxItem*, const TQPoint& ) ) ); + + connect( listBookmarks, TQT_SIGNAL( mouseButtonClicked(int, TQListViewItem*, const TQPoint&, int ) ), + this, TQT_SLOT( showTopic(int, TQListViewItem*, const TQPoint &) ) ); + connect( listBookmarks, TQT_SIGNAL( returnPressed(TQListViewItem*) ), + this, TQT_SLOT( showTopic(TQListViewItem*) ) ); + connect( listBookmarks, TQT_SIGNAL( selectionChanged(TQListViewItem*) ), + this, TQT_SLOT( currentBookmarkChanged(TQListViewItem*) ) ); + connect( listBookmarks, TQT_SIGNAL( currentChanged(TQListViewItem*) ), + this, TQT_SLOT( currentBookmarkChanged(TQListViewItem*) ) ); + connect( listBookmarks, TQT_SIGNAL( contextMenuRequested( TQListViewItem*, const TQPoint&, int ) ), + this, TQT_SLOT( showItemMenu( TQListViewItem*, const TQPoint& ) ) ); + connect( resultBox, TQT_SIGNAL( contextMenuRequested( TQListBoxItem*, const TQPoint& ) ), + this, TQT_SLOT( showItemMenu( TQListBoxItem*, const TQPoint& ) ) ); + + cacheFilesPath = TQDir::homeDirPath() + "/.assistant/"; //### Find a better location for the dbs + + editIndex->installEventFilter( this ); + listBookmarks->header()->hide(); + listBookmarks->header()->setStretchEnabled( TRUE ); + listContents->header()->hide(); + listContents->header()->setStretchEnabled( TRUE ); + framePrepare->hide(); + connect( tqApp, TQT_SIGNAL(lastWindowClosed()), TQT_SLOT(lastWinClosed()) ); + + termsEdit->setValidator( new SearchValidator( TQT_TQOBJECT(termsEdit) ) ); + + itemPopup = new TQPopupMenu( this ); + itemPopup->insertItem( tr( "Open Link in Current Tab" ), 0 ); + itemPopup->insertItem( tr( "Open Link in New Window" ), 1 ); + itemPopup->insertItem( tr( "Open Link in New Tab" ), 2 ); + + contentList.setAutoDelete( TRUE ); + contentList.clear(); + + initDoneMsgShown = FALSE; + fullTextIndex = 0; + indexDone = FALSE; + titleMapDone = FALSE; + contentsInserted = FALSE; + bookmarksInserted = FALSE; + setupTitleMap(); +} + + +void HelpDialog::processEvents() +{ + tqApp->eventLoop()->processEvents( TQEventLoop::ExcludeUserInput ); +} + + +void HelpDialog::lastWinClosed() +{ + lwClosed = TRUE; +} + + +void HelpDialog::removeOldCacheFiles() +{ + TQString dir = cacheFilesPath; // ### remove the last '/' ? + if (!verifyDirectory(cacheFilesPath)) { + qWarning( "Failed to created assistant directory" ); + return; + } + TQString pname = "." + Config::configuration()->profileName(); + + TQStringList fileList; + fileList << "indexdb" << "indexdb.dict" << "indexdb.doc" << "contentdb"; + TQStringList::iterator it = fileList.begin(); + for ( ; it != fileList.end(); ++it ) { + if ( TQFile::exists( cacheFilesPath + *it + pname ) ) { + TQFile f( cacheFilesPath + *it + pname ); + f.remove(); + } + } +} + +void HelpDialog::timerEvent(TQTimerEvent *e) +{ + static int opacity = 255; + // To allow patching of 3.2.3 assistant for qsa. +#if TQT_VERSION >= 0x030300 + help->setWindowOpacity((opacity-=4)/255.0); + if (opacity<=0) +#endif + tqApp->quit(); +} + + +void HelpDialog::loadIndexFile() +{ + if ( indexDone ) + return; + + setCursor( Qt::WaitCursor ); + indexDone = TRUE; + labelPrepare->setText( tr( "Prepare..." ) ); + framePrepare->show(); + processEvents(); + + TQProgressBar *bar = progressPrepare; + bar->setTotalSteps( 100 ); + bar->setProgress( 0 ); + + keywordDocuments.clear(); + TQValueList<IndexKeyword> lst; + TQFile indexFile( cacheFilesPath + "indexdb." + + Config::configuration()->profileName() ); + if ( !indexFile.open( IO_ReadOnly ) ) { + buildKeywordDB(); + processEvents(); + if( lwClosed ) + return; + if (!indexFile.open(IO_ReadOnly)) { + TQMessageBox::warning(help, tr("TQt Assistant"), tr("Failed to load keyword index file\n" + "Assistant will not work!")); +#if defined TQ_WS_WIN || defined TQ_WS_MACX + startTimer(50); +#endif + return; + } + } + + editIndex->setEnabled(FALSE); + + TQDataStream ds( &indexFile ); + TQ_UINT32 fileAges; + ds >> fileAges; + if ( fileAges != getFileAges() ) { + indexFile.close(); + buildKeywordDB(); + if ( !indexFile.open( IO_ReadOnly ) ) { + TQMessageBox::warning( help, tr( "TQt Assistant" ), + tr( "Cannot open the index file %1" ).arg( TQFileInfo( indexFile ).absFilePath() ) ); + editIndex->setEnabled(TRUE); + return; + } + ds.setDevice( &indexFile ); + ds >> fileAges; + } + ds >> lst; + indexFile.close(); + + bar->setProgress( bar->totalSteps() ); + processEvents(); + + listIndex->clear(); + HelpNavigationListItem *lastItem = 0; + TQString lastKeyword = TQString(); + TQValueList<IndexKeyword>::ConstIterator it = lst.begin(); + for ( ; it != lst.end(); ++it ) { + if ( lastKeyword.lower() != (*it).keyword.lower() ) + lastItem = new HelpNavigationListItem( listIndex, (*it).keyword ); + lastItem->addLink( (*it).link ); + lastKeyword = (*it).keyword; + + TQString lnk = (*it).link; + int i = lnk.tqfindRev('#'); + if ( i > -1 ) + lnk = lnk.left( i ); + if (!keywordDocuments.tqcontains(lnk)) + keywordDocuments.append(lnk); + } + framePrepare->hide(); + showInitDoneMessage(); + setCursor( Qt::ArrowCursor ); + editIndex->setEnabled(TRUE); +} + +TQ_UINT32 HelpDialog::getFileAges() +{ + TQStringList addDocuFiles = Config::configuration()->docFiles(); + TQStringList::const_iterator i = addDocuFiles.begin(); + + TQ_UINT32 fileAges = 0; + for( ; i != addDocuFiles.end(); ++i ) { + TQFileInfo fi( *i ); + if ( fi.exists() ) + fileAges += fi.lastModified().toTime_t(); + } + + return fileAges; +} + +void HelpDialog::buildKeywordDB() +{ + TQStringList addDocuFiles = Config::configuration()->docFiles(); + TQStringList::iterator i = addDocuFiles.begin(); + + int steps = 0; + for( ; i != addDocuFiles.end(); i++ ) + steps += TQFileInfo( *i ).size(); + + labelPrepare->setText( tr( "Prepare..." ) ); + progressPrepare->setTotalSteps( steps ); + progressPrepare->setProgress( 0 ); + processEvents(); + + TQValueList<IndexKeyword> lst; + TQ_UINT32 fileAges = 0; + for( i = addDocuFiles.begin(); i != addDocuFiles.end(); i++ ){ + TQFile file( *i ); + if ( !file.exists() ) { + TQMessageBox::warning( this, tr( "Warning" ), + tr( "Documentation file %1 does not exist!\n" + "Skipping file." ).arg( TQFileInfo( file ).absFilePath() ) ); + continue; + } + fileAges += TQFileInfo( file ).lastModified().toTime_t(); + DocuParser *handler = DocuParser::createParser( *i ); + bool ok = handler->parse( &file ); + file.close(); + if( !ok ){ + TQString msg = TQString( "In file %1:\n%2" ) + .arg( TQFileInfo( file ).absFilePath() ) + .arg( handler->errorProtocol() ); + TQMessageBox::critical( this, tr( "Parse Error" ), tr( msg ) ); + delete handler; + continue; + } + + TQPtrList<IndexItem> indLst = handler->getIndexItems(); + TQPtrListIterator<IndexItem> it( indLst ); + IndexItem *indItem; + int counter = 0; + while ( ( indItem = it.current() ) != 0 ) { + TQFileInfo fi( indItem->reference ); + lst.append( IndexKeyword( indItem->keyword, fi.absFilePath() ) ); + if ( progressPrepare ) + progressPrepare->setProgress( progressPrepare->progress() + + int(fi.absFilePath().length() * 1.6) ); + + if( ++counter%100 == 0 ) { + processEvents(); + if( lwClosed ) { + return; + } + } + ++it; + } + delete handler; + } + if ( !lst.isEmpty() ) + qHeapSort( lst ); + + TQFile indexout( cacheFilesPath + "indexdb." + Config::configuration()->profileName() ); + if ( verifyDirectory(cacheFilesPath) && indexout.open( IO_WriteOnly ) ) { + TQDataStream s( &indexout ); + s << fileAges; + s << lst; + indexout.close(); + } +} + +void HelpDialog::setupTitleMap() +{ + if ( titleMapDone ) + return; + if ( Config::configuration()->docRebuild() ) { + removeOldCacheFiles(); + Config::configuration()->setDocRebuild( FALSE ); + Config::configuration()->saveProfile( Config::configuration()->profile() ); + } + if ( contentList.isEmpty() ) + getAllContents(); + + titleMapDone = TRUE; + titleMap.clear(); + TQDictIterator<ContentList> lstIt( contentList ); + for ( ; lstIt.current(); ++lstIt ) { + TQValueList<ContentItem> &lst = *(lstIt.current()); + TQValueListConstIterator<ContentItem> it; + for ( it = lst.begin(); it != lst.end(); ++it ) { + TQFileInfo link( (*it).reference.simplifyWhiteSpace() ); + titleMap[ link.absFilePath() ] = (*it).title.stripWhiteSpace(); + } + } + processEvents(); +} + +void HelpDialog::getAllContents() +{ + TQFile contentFile( cacheFilesPath + "contentdb." + Config::configuration()->profileName() ); + contentList.clear(); + if ( !contentFile.open( IO_ReadOnly ) ) { + buildContentDict(); + return; + } + + TQDataStream ds( &contentFile ); + TQ_UINT32 fileAges; + ds >> fileAges; + if ( fileAges != getFileAges() ) { + contentFile.close(); + buildContentDict(); + return; + } + TQString key; + TQValueList<ContentItem> lst; + while ( !ds.atEnd() ) { + ds >> key; + ds >> lst; + contentList.insert( key, new TQValueList<ContentItem>( lst ) ); + } + contentFile.close(); + processEvents(); + +} + +void HelpDialog::buildContentDict() +{ + TQStringList docuFiles = Config::configuration()->docFiles(); + + TQ_UINT32 fileAges = 0; + for( TQStringList::iterator it = docuFiles.begin(); it != docuFiles.end(); it++ ) { + TQFile file( *it ); + if ( !file.exists() ) { + TQMessageBox::warning( this, tr( "Warning" ), + tr( "Documentation file %1 does not exist!\n" + "Skipping file." ).arg( TQFileInfo( file ).absFilePath() ) ); + continue; + } + fileAges += TQFileInfo( file ).lastModified().toTime_t(); + DocuParser *handler = DocuParser::createParser( *it ); + if( !handler ) { + TQMessageBox::warning( this, tr( "Warning" ), + tr( "Documentation file %1 is not compatible!\n" + "Skipping file." ).arg( TQFileInfo( file ).absFilePath() ) ); + continue; + } + bool ok = handler->parse( &file ); + file.close(); + if( ok ) { + contentList.insert( *it, new TQValueList<ContentItem>( handler->getContentItems() ) ); + delete handler; + } else { + TQString msg = TQString( "In file %1:\n%2" ) + .arg( TQFileInfo( file ).absFilePath() ) + .arg( handler->errorProtocol() ); + TQMessageBox::critical( this, tr( "Parse Error" ), tr( msg ) ); + continue; + } + } + + TQString pname = Config::configuration()->profileName(); + TQFile contentOut( cacheFilesPath + "contentdb." + pname ); + TQFile::remove( cacheFilesPath + "indexdb.dict." + pname ); + TQFile::remove( cacheFilesPath + "indexdb.doc." + pname ); + if ( contentOut.open( IO_WriteOnly ) ) { + TQDataStream s( &contentOut ); + s << fileAges; + TQDictIterator<ContentList> it( contentList ); + for ( ; it.current(); ++it ) { + s << it.currentKey(); + s << *(it.current()); + } + contentOut.close(); + } +} + +void HelpDialog::currentTabChanged( const TQString &s ) +{ + if ( stripAmpersand( s ).tqcontains( tr( "Index" ) ) ) + TQTimer::singleShot( 0, this, TQT_SLOT( loadIndexFile() ) ); + else if ( stripAmpersand( s ).tqcontains( tr( "Bookmarks" ) ) ) + insertBookmarks(); + else if ( stripAmpersand( s ).tqcontains( tr( "Contents" ) ) ) + TQTimer::singleShot( 0, this, TQT_SLOT( insertContents() ) ); + else if ( stripAmpersand( s ).tqcontains( tr( "Search" ) ) ) + TQTimer::singleShot( 0, this, TQT_SLOT( setupFullTextIndex() ) ); +} + +void HelpDialog::showInitDoneMessage() +{ + if ( initDoneMsgShown ) + return; + initDoneMsgShown = TRUE; + help->statusBar()->message( tr( "Done" ), 3000 ); +} + +void HelpDialog::currentIndexChanged( TQListBoxItem * ) +{ +} + + +void HelpDialog::showTopic( int button, TQListBoxItem *item, + const TQPoint & ) +{ + if( button == Qt::LeftButton && item ) + showTopic(); +} + +void HelpDialog::showTopic( int button, TQListViewItem *item, + const TQPoint & ) +{ + if( button == Qt::LeftButton && item ) + showTopic(); +} + +void HelpDialog::showTopic( TQListViewItem *item ) +{ + if( item ) + showTopic(); +} + +void HelpDialog::showTopic() +{ + if ( stripAmpersand( tabWidget->tabLabel( tabWidget->currentPage() ) ).tqcontains( tr( "Index" ) ) ) + showIndexTopic(); + else if ( stripAmpersand( tabWidget->tabLabel( tabWidget->currentPage() ) ).tqcontains( tr( "Bookmarks" ) ) ) + showBookmarkTopic(); + else if ( stripAmpersand( tabWidget->tabLabel( tabWidget->currentPage() ) ).tqcontains( tr( "Contents" ) ) ) + showContentsTopic(); +} + +void HelpDialog::showIndexTopic() +{ + TQListBoxItem *i = listIndex->item( listIndex->currentItem() ); + if ( !i ) + return; + + editIndex->blockSignals( TRUE ); + editIndex->setText( i->text() ); + editIndex->blockSignals( FALSE ); + + HelpNavigationListItem *item = (HelpNavigationListItem*)i; + + TQStringList links = item->links(); + if ( links.count() == 1 ) { + emit showLink( links.first() ); + } else { + qHeapSort( links ); + TQStringList::Iterator it = links.begin(); + TQStringList linkList; + TQStringList linkNames; + for ( ; it != links.end(); ++it ) { + linkList << *it; + linkNames << titleOfLink( *it ); + } + TQString link = TopicChooser::getLink( this, linkNames, linkList, i->text() ); + if ( !link.isEmpty() ) + emit showLink( link ); + } +} + +void HelpDialog::searchInIndex( const TQString &s ) +{ + TQListBoxItem *i = listIndex->firstItem(); + TQString sl = s.lower(); + while ( i ) { + TQString t = i->text(); + if ( t.length() >= sl.length() && + i->text().left(s.length()).lower() == sl ) { + listIndex->setCurrentItem( i ); + listIndex->setTopItem(listIndex->index(i)); + break; + } + i = i->next(); + } +} + +TQString HelpDialog::titleOfLink( const TQString &link ) +{ + TQString s( link ); + s.remove( s.tqfind( '#' ), s.length() ); + s = titleMap[ s ]; + if ( s.isEmpty() ) + return link; + return s; +} + +bool HelpDialog::eventFilter( TQObject * o, TQEvent * e ) +{ + if ( !o || !e ) + return TRUE; + + if ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(editIndex) && e->type() == TQEvent::KeyPress ) { + TQKeyEvent *ke = (TQKeyEvent*)e; + if ( ke->key() == Qt::Key_Up ) { + int i = listIndex->currentItem(); + if ( --i >= 0 ) { + listIndex->setCurrentItem( i ); + editIndex->blockSignals( TRUE ); + editIndex->setText( listIndex->currentText() ); + editIndex->blockSignals( FALSE ); + } + return TRUE; + } else if ( ke->key() == Qt::Key_Down ) { + int i = listIndex->currentItem(); + if ( ++i < int(listIndex->count()) ) { + listIndex->setCurrentItem( i ); + editIndex->blockSignals( TRUE ); + editIndex->setText( listIndex->currentText() ); + editIndex->blockSignals( FALSE ); + } + return TRUE; + } else if ( ke->key() == TQt::Key_Next || ke->key() == TQt::Key_Prior ) { + TQApplication::sendEvent( listIndex, e); + editIndex->blockSignals( TRUE ); + editIndex->setText( listIndex->currentText() ); + editIndex->blockSignals( FALSE ); + } + } + + return TQWidget::eventFilter( o, e ); +} + +void HelpDialog::addBookmark() +{ + if ( !bookmarksInserted ) + insertBookmarks(); + TQString link = TQUrl( help->browsers()->currentBrowser()->context(), + help->browsers()->currentBrowser()->source() ).path(); + TQString title = help->browsers()->currentBrowser()->documentTitle(); + if ( title.isEmpty() ) + title = titleOfLink( link ); + HelpNavigationContentsItem *i = new HelpNavigationContentsItem( listBookmarks, 0 ); + i->setText( 0, title ); + i->setLink( link ); + saveBookmarks(); + help->updateBookmarkMenu(); +} + +void HelpDialog::removeBookmark() +{ + if ( !listBookmarks->currentItem() ) + return; + + delete listBookmarks->currentItem(); + saveBookmarks(); + if ( listBookmarks->firstChild() ) { + listBookmarks->setSelected( listBookmarks->firstChild(), TRUE ); + } + help->updateBookmarkMenu(); +} + +void HelpDialog::insertBookmarks() +{ + if ( bookmarksInserted ) + return; + bookmarksInserted = TRUE; + listBookmarks->clear(); + TQFile f( cacheFilesPath + "bookmarks." + Config::configuration()->profileName() ); + if ( !f.open( IO_ReadOnly ) ) + return; + TQTextStream ts( &f ); + while ( !ts.atEnd() ) { + HelpNavigationContentsItem *i = new HelpNavigationContentsItem( listBookmarks, 0 ); + i->setText( 0, ts.readLine() ); + i->setLink( ts.readLine() ); + } + help->updateBookmarkMenu(); + showInitDoneMessage(); +} + +void HelpDialog::currentBookmarkChanged( TQListViewItem * ) +{ +} + +void HelpDialog::showBookmarkTopic() +{ + if ( !listBookmarks->currentItem() ) + return; + + HelpNavigationContentsItem *i = (HelpNavigationContentsItem*)listBookmarks->currentItem(); + TQString absPath = ""; + if ( TQFileInfo( i->link() ).isRelative() ) + absPath = documentationPath + "/"; + emit showLink( absPath + i->link() ); +} + +void HelpDialog::saveBookmarks() +{ + TQFile f( cacheFilesPath + "bookmarks." + Config::configuration()->profileName() ); + if ( !f.open( IO_WriteOnly ) ) + return; + TQTextStream ts( &f ); + TQListViewItemIterator it( listBookmarks ); + for ( ; it.current(); ++it ) { + HelpNavigationContentsItem *i = (HelpNavigationContentsItem*)it.current(); + ts << i->text( 0 ) << endl; + ts << i->link() << endl; + } + f.close(); +} + +void HelpDialog::insertContents() +{ + if ( contentsInserted ) + return; + + if ( contentList.isEmpty() ) + getAllContents(); + + contentsInserted = TRUE; + listContents->clear(); + setCursor( Qt::WaitCursor ); + if ( !titleMapDone ) + setupTitleMap(); + + listContents->setSorting( -1 ); + + TQDictIterator<ContentList> lstIt( contentList ); + for ( ; lstIt.current(); ++lstIt ) { + HelpNavigationContentsItem *newEntry; + + HelpNavigationContentsItem *contentEntry = 0; + TQPtrStack<HelpNavigationContentsItem> stack; + stack.clear(); + int depth = 0; + bool root = FALSE; + + HelpNavigationContentsItem *lastItem[64]; + for( int j = 0; j < 64; ++j ) + lastItem[j] = 0; + + + TQValueList<ContentItem> &lst = *(lstIt.current()); + TQValueListConstIterator<ContentItem> it; + for( it = lst.begin(); it != lst.end(); ++it ){ + ContentItem item = *it; + if( item.depth == 0 ){ + newEntry = new HelpNavigationContentsItem( listContents, 0 ); + newEntry->setPixmap( 0, TQPixmap::fromMimeSource( "book.png" ) ); + newEntry->setText( 0, item.title ); + newEntry->setLink( 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 ) { + contentEntry = new HelpNavigationContentsItem( stack.top(), lastItem[ depth ] ); + lastItem[ depth ] = contentEntry; + contentEntry->setText( 0, item.title ); + contentEntry->setLink( item.reference ); + } + else if( item.depth < depth ) { + stack.pop(); + depth--; + item = *(--it); + } + } + } + processEvents(); + } + setCursor( Qt::ArrowCursor ); + showInitDoneMessage(); +} + +void HelpDialog::currentContentsChanged( TQListViewItem * ) +{ +} + +void HelpDialog::showContentsTopic() +{ + HelpNavigationContentsItem *i = (HelpNavigationContentsItem*)listContents->currentItem(); + if ( !i ) + return; + emit showLink( i->link() ); +} + +void HelpDialog::toggleContents() +{ + if ( !isVisible() || tabWidget->currentPageIndex() != 0 ) { + tabWidget->setCurrentPage( 0 ); + parentWidget()->show(); + } + else + parentWidget()->hide(); +} + +void HelpDialog::toggleIndex() +{ + if ( !isVisible() || tabWidget->currentPageIndex() != 1 || !editIndex->hasFocus() ) { + tabWidget->setCurrentPage( 1 ); + parentWidget()->show(); + editIndex->setFocus(); + } + else + parentWidget()->hide(); +} + +void HelpDialog::toggleBookmarks() +{ + if ( !isVisible() || tabWidget->currentPageIndex() != 2 ) { + tabWidget->setCurrentPage( 2 ); + parentWidget()->show(); + } + else + parentWidget()->hide(); +} + +void HelpDialog::toggleSearch() +{ + if ( !isVisible() || tabWidget->currentPageIndex() != 3 ) { + tabWidget->setCurrentPage( 3 ); + parentWidget()->show(); + } + else + parentWidget()->hide(); +} + +void HelpDialog::setupFullTextIndex() +{ + if ( fullTextIndex ) + return; + + TQStringList documentList; + TQString pname = Config::configuration()->profileName(); + fullTextIndex = new Index( documentList, TQDir::homeDirPath() ); // ### Is this correct ? + if (!verifyDirectory(cacheFilesPath)) { + TQMessageBox::warning(help, tr("TQt Assistant"), + tr("Failed to save fulltext search index\n" + "Assistant will not work!")); + return; + } + searchButton->setEnabled(FALSE); + helpButton->setEnabled(FALSE); + termsEdit->setEnabled(FALSE); + + fullTextIndex->setDictionaryFile( cacheFilesPath + "indexdb.dict." + pname ); + fullTextIndex->setDocListFile( cacheFilesPath + "indexdb.doc." + pname ); + processEvents(); + + connect( fullTextIndex, TQT_SIGNAL( indexingProgress( int ) ), + this, TQT_SLOT( setIndexingProgress( int ) ) ); + TQFile f( cacheFilesPath + "indexdb.dict." + pname ); + if ( !f.exists() ) { + TQMap<TQString, TQString>::ConstIterator it = titleMap.begin(); + TQString documentName; + for ( ; it != titleMap.end(); ++it ) { + documentName = it.key(); + int i = documentName.tqfindRev('#'); + if ( i > -1 ) + documentName = documentName.left( i ); + + if (!documentList.tqcontains(documentName)) + documentList << documentName; + } + loadIndexFile(); + for (TQStringList::Iterator it2 = keywordDocuments.begin(); it2 != keywordDocuments.end(); ++it2) { + if (!documentList.tqcontains(*it2)) + documentList << *it2; + } + fullTextIndex->setDocList( documentList ); + + help->statusBar()->clear(); + setCursor( Qt::WaitCursor ); + labelPrepare->setText( tr( "Indexing files..." ) ); + progressPrepare->setTotalSteps( 100 ); + progressPrepare->reset(); + progressPrepare->show(); + framePrepare->show(); + processEvents(); + if ( fullTextIndex->makeIndex() != -1 ) { + fullTextIndex->writeDict(); + progressPrepare->setProgress( 100 ); + framePrepare->hide(); + setCursor( Qt::ArrowCursor ); + showInitDoneMessage(); + keywordDocuments.clear(); + } + } else { + setCursor( Qt::WaitCursor ); + help->statusBar()->message( tr( "Reading dictionary..." ) ); + processEvents(); + fullTextIndex->readDict(); + help->statusBar()->message( tr( "Done" ), 3000 ); + setCursor( Qt::ArrowCursor ); + } + searchButton->setEnabled(TRUE); + termsEdit->setEnabled(TRUE); + helpButton->setEnabled(TRUE); +} + +void HelpDialog::setIndexingProgress( int prog ) +{ + progressPrepare->setProgress( prog ); + processEvents(); +} + +void HelpDialog::startSearch() +{ + TQString str = termsEdit->text(); + str = str.tqreplace( "\'", "\"" ); + str = str.tqreplace( "`", "\"" ); + TQString buf = str; + str = str.tqreplace( "-", " " ); + str = str.tqreplace( TQRegExp( "\\s[\\S]?\\s" ), " " ); + terms = TQStringList::split( " ", str ); + TQStringList termSeq; + TQStringList seqWords; + TQStringList::iterator it = terms.begin(); + for ( ; it != terms.end(); ++it ) { + (*it) = (*it).simplifyWhiteSpace(); + (*it) = (*it).lower(); + (*it) = (*it).tqreplace( "\"", "" ); + } + if ( str.tqcontains( '\"' ) ) { + if ( (str.tqcontains( '\"' ))%2 == 0 ) { + int beg = 0; + int end = 0; + TQString s; + beg = str.tqfind( '\"', beg ); + while ( beg != -1 ) { + beg++; + end = str.tqfind( '\"', beg ); + s = str.mid( beg, end - beg ); + s = s.lower(); + s = s.simplifyWhiteSpace(); + if ( s.tqcontains( '*' ) ) { + TQMessageBox::warning( this, tr( "Full Text Search" ), + tr( "Using a wildcard within phrases is not allowed." ) ); + return; + } + seqWords += TQStringList::split( ' ', s ); + termSeq << s; + beg = str.tqfind( '\"', end + 1); + } + } else { + TQMessageBox::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 ); + TQString msg( TQString( "%1 documents found." ).arg( foundDocs.count() ) ); + help->statusBar()->message( tr( msg ), 3000 ); + resultBox->clear(); + for ( it = foundDocs.begin(); it != foundDocs.end(); ++it ) + resultBox->insertItem( fullTextIndex->getDocumentTitle( *it ) ); + + terms.clear(); + bool isPhrase = FALSE; + TQString s = ""; + for ( int i = 0; i < (int)buf.length(); ++i ) { + if ( buf[i] == '\"' ) { + isPhrase = !isPhrase; + s = s.simplifyWhiteSpace(); + if ( !s.isEmpty() ) + terms << s; + s = ""; + } else if ( buf[i] == ' ' && !isPhrase ) { + s = s.simplifyWhiteSpace(); + if ( !s.isEmpty() ) + terms << s; + s = ""; + } else + s += buf[i]; + } + if ( !s.isEmpty() ) + terms << s; + + setCursor( Qt::ArrowCursor ); +} + +void HelpDialog::showSearchHelp() +{ + emit showLink( Config::configuration()->assistantDocPath() + "/assistant-5.html" ); +} + +void HelpDialog::showResultPage( int button, TQListBoxItem *i, const TQPoint & ) +{ + if( button == Qt::LeftButton ) { + showResultPage( i ); + } +} + +void HelpDialog::showResultPage( TQListBoxItem *i ) +{ + if( !i ) + return; + emit showSearchLink( foundDocs[resultBox->index( i )], terms ); +} + +void HelpDialog::showItemMenu( TQListBoxItem *item, const TQPoint &pos ) +{ + if ( !item ) + return; + int id = itemPopup->exec( pos ); + if ( id == 0 ) { + if ( stripAmpersand( tabWidget->tabLabel( tabWidget->currentPage() ) ).tqcontains( tr( "Index" ) ) ) + showTopic(); + else { + showResultPage( item ); + } + } else if ( id > 0 ) { + HelpWindow *hw = help->browsers()->currentBrowser(); + if ( stripAmpersand( tabWidget->tabLabel( tabWidget->currentPage() ) ).tqcontains( tr( "Index" ) ) ) { + editIndex->blockSignals( TRUE ); + editIndex->setText( item->text() ); + editIndex->blockSignals( FALSE ); + + HelpNavigationListItem *hi = (HelpNavigationListItem*)item; + + TQStringList links = hi->links(); + if ( links.count() == 1 ) { + if ( id == 1 ) + hw->openLinkInNewWindow( links.first() ); + else + hw->openLinkInNewPage( links.first() ); + } else { + TQStringList::Iterator it = links.begin(); + TQStringList linkList; + TQStringList linkNames; + for ( ; it != links.end(); ++it ) { + linkList << *it; + linkNames << titleOfLink( *it ); + } + TQString link = TopicChooser::getLink( this, linkNames, linkList, item->text() ); + if ( !link.isEmpty() ) { + if ( id == 1 ) + hw->openLinkInNewWindow( link ); + else + hw->openLinkInNewPage( link ); + } + } + } else { + TQString link = foundDocs[ resultBox->index( item ) ]; + if ( id == 1 ) + hw->openLinkInNewWindow( link ); + else + hw->openLinkInNewPage( link ); + } + } +} + +void HelpDialog::showItemMenu( TQListViewItem *item, const TQPoint &pos ) +{ + if ( !item ) + return; + int id = itemPopup->exec( pos ); + if ( id == 0 ) { + if ( stripAmpersand( tabWidget->tabLabel( tabWidget->currentPage() ) ).tqcontains( tr( "Contents" ) ) ) + showContentsTopic(); + else + showBookmarkTopic(); + } else if ( id > 0 ) { + HelpNavigationContentsItem *i = (HelpNavigationContentsItem*)item; + if ( id == 1 ) + help->browsers()->currentBrowser()->openLinkInNewWindow( i->link() ); + else + help->browsers()->currentBrowser()->openLinkInNewPage( i->link() ); + } +} diff --git a/tqtinterface/qt4/tools/assistant/helpdialogimpl.h b/tqtinterface/qt4/tools/assistant/helpdialogimpl.h new file mode 100644 index 0000000..13b4c51 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/helpdialogimpl.h @@ -0,0 +1,173 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef HELPDIALOGIMPL_H +#define HELPDIALOGIMPL_H + +#include "helpdialog.h" +#include "index.h" +#include "helpwindow.h" +#include "docuparser.h" + +#include <tqlistbox.h> +#include <tqlistview.h> +#include <tqmap.h> +#include <tqstringlist.h> +#include <tqvalidator.h> +#include <tqpopupmenu.h> +#include <tqdict.h> +#include <tqpopupmenu.h> + +class TQProgressBar; +class MainWindow; +class TQTextBrowser; + +class HelpNavigationListItem : public TQListBoxText +{ +public: + HelpNavigationListItem( TQListBox *ls, const TQString &txt ); + + void addLink( const TQString &link ); + TQStringList links() const { return linkList; } +private: + TQStringList linkList; + +}; + +class SearchValidator : public TQValidator +{ + Q_OBJECT + TQ_OBJECT +public: + SearchValidator( TQObject *tqparent, const char *name = 0 ) + : TQValidator( tqparent, name ) {} + ~SearchValidator() {} + TQValidator::State validate( TQString &str, int & ) const; +}; + +class HelpNavigationContentsItem : public TQListViewItem +{ +public: + HelpNavigationContentsItem( TQListView *v, TQListViewItem *after ); + HelpNavigationContentsItem( TQListViewItem *v, TQListViewItem *after ); + + void setLink( const TQString &lnk ); + TQString link() const; + +private: + TQString theLink; +}; + +class HelpDialog : public HelpDialogBase +{ + Q_OBJECT + TQ_OBJECT + +public: + HelpDialog( TQWidget *tqparent, MainWindow *h ); + + TQString titleOfLink( const TQString &link ); + bool eventFilter( TQObject *, TQEvent * ); + bool lastWindowClosed() { return lwClosed; } + + void timerEvent(TQTimerEvent *e); + +protected Q_SLOTS: + void showTopic( int, TQListBoxItem *, const TQPoint & ); + void showTopic( int, TQListViewItem *, const TQPoint & ); + void showTopic( TQListViewItem * ); + void loadIndexFile(); + void insertContents(); + void setupFullTextIndex(); + void currentTabChanged( const TQString &s ); + void currentIndexChanged( TQListBoxItem *i ); + void showTopic(); + void searchInIndex( const TQString &s ); + void addBookmark(); + void removeBookmark(); + void currentBookmarkChanged( TQListViewItem *i ); + void currentContentsChanged( TQListViewItem *i ); + void startSearch(); + void showSearchHelp(); + +public Q_SLOTS: + void initialize(); + void toggleContents(); + void toggleIndex(); + void toggleBookmarks(); + void toggleSearch(); + + +Q_SIGNALS: + void showLink( const TQString &s ); + void showSearchLink( const TQString &s, const TQStringList &terms ); + +private Q_SLOTS: + void lastWinClosed(); + void showResultPage( int button, TQListBoxItem *i, const TQPoint &p ); + void showResultPage( TQListBoxItem *i ); + void setIndexingProgress( int prog ); + void showItemMenu( TQListBoxItem *item, const TQPoint &pos ); + void showItemMenu( TQListViewItem *item, const TQPoint &pos ); + void insertBookmarks(); + void processEvents(); + +private: + typedef TQValueList<ContentItem> ContentList; + void removeOldCacheFiles(); + void buildKeywordDB(); + TQ_UINT32 getFileAges(); + void showIndexTopic(); + void showBookmarkTopic(); + void setupTitleMap(); + void saveBookmarks(); + void showContentsTopic(); + void showInitDoneMessage(); + void buildContentDict(); + + TQMap<TQString, TQString> titleMap; + bool indexDone, bookmarksInserted, titleMapDone, contentsInserted; + bool lwClosed; + MainWindow *help; + TQString documentationPath; + Index *fullTextIndex; + TQStringList terms, foundDocs; + bool initDoneMsgShown; + void getAllContents(); + TQDict<ContentList> contentList; + TQPopupMenu *itemPopup; + TQString cacheFilesPath; + TQStringList keywordDocuments; +}; + +#endif diff --git a/tqtinterface/qt4/tools/assistant/helpwindow.cpp b/tqtinterface/qt4/tools/assistant/helpwindow.cpp new file mode 100644 index 0000000..7a57028 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/helpwindow.cpp @@ -0,0 +1,282 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "helpwindow.h" +#include "mainwindow.h" +#include "tabbedbrowser.h" +#include "helpdialogimpl.h" +#include "config.h" + +#include <tqapplication.h> +#include <tqclipboard.h> +#include <tqurl.h> +#include <tqmessagebox.h> +#include <tqdir.h> +#include <tqfile.h> +#include <tqprocess.h> +#include <tqpopupmenu.h> +#include <tqaction.h> +#include <tqfileinfo.h> +#include <tqevent.h> +#include <tqtextstream.h> +#include <tqtextcodec.h> + +#if defined(TQ_OS_WIN32) +#include <windows.h> +#endif + +HelpWindow::HelpWindow( MainWindow *w, TQWidget *tqparent, const char *name ) + : TQTextBrowser( tqparent, name ), mw( w ), blockScroll( FALSE ), + shiftPressed( FALSE ), newWindow( FALSE ) +{ + connect(this, TQT_SIGNAL(forwardAvailable(bool)), this, TQT_SLOT(updateForward(bool))); + connect(this, TQT_SIGNAL(backwardAvailable(bool)), this, TQT_SLOT(updateBackward(bool))); +} + +void HelpWindow::setSource( const TQString &name ) +{ + if ( name.isEmpty() ) + return; + + if (newWindow || shiftPressed) { + removeSelection(); + mw->saveSettings(); + mw->saveToolbarSettings(); + MainWindow *nmw = new MainWindow; + + TQFileInfo currentInfo( source() ); + TQFileInfo linkInfo( name ); + TQString target = name; + if( linkInfo.isRelative() ) + target = currentInfo.dirPath( TRUE ) + "/" + name; + + nmw->setup(); + nmw->move( mw->tqgeometry().topLeft() ); + if ( mw->isMaximized() ) + nmw->showMaximized(); + else + nmw->show(); + nmw->showLink( target ); + return; + } + + if ( name.left( 7 ) == "http://" || name.left( 6 ) == "ftp://" ) { + TQString webbrowser = Config::configuration()->webBrowser(); + if ( webbrowser.isEmpty() ) { +#if defined(TQ_OS_WIN32) + TQT_WA( { + ShellExecute( winId(), 0, (TCHAR*)name.ucs2(), 0, 0, SW_SHOWNORMAL ); + } , { + ShellExecuteA( winId(), 0, name.local8Bit(), 0, 0, SW_SHOWNORMAL ); + } ); +#elif defined(TQ_OS_MACX) + webbrowser = "/usr/bin/open"; +#else + int result = TQMessageBox::information( mw, tr( "Help" ), + tr( "Currently no Web browser is selected.\nPlease use the settings dialog to specify one!\n" ), + "Open", "Cancel" ); + if ( result == 0 ) { + emit chooseWebBrowser(); + webbrowser = Config::configuration()->webBrowser(); + } +#endif + if ( webbrowser.isEmpty() ) + return; + } + TQProcess *proc = new TQProcess(TQT_TQOBJECT(this)); + + proc->addArgument( webbrowser ); + TQObject::connect(proc, TQT_SIGNAL(processExited()), proc, TQT_SLOT(deleteLater())); + proc->addArgument( name ); + proc->start(); + return; + } + + if ( name.right( 3 ) == "pdf" ) { + TQString pdfbrowser = Config::configuration()->pdfReader(); + if ( pdfbrowser.isEmpty() ) { +#if defined(TQ_OS_MACX) + pdfbrowser = "/usr/bin/open"; +#else + TQMessageBox::information( mw, + tr( "Help" ), + tr( "No PDF Viewer has been specified\n" + "Please use the settings dialog to specify one!\n" ) ); + return; +#endif + } + TQFileInfo info( pdfbrowser ); + if( !info.exists() ) { + TQMessageBox::information( mw, + tr( "Help" ), + tr( "TQt Assistant is unable to start the PDF Viewer\n\n" + "%1\n\n" + "Please make sure that the executable exists and is located at\n" + "the specified location." ).arg( pdfbrowser ) ); + return; + } + TQProcess *proc = new TQProcess(TQT_TQOBJECT(this)); + TQObject::connect(proc, TQT_SIGNAL(processExited()), proc, TQT_SLOT(deleteLater())); + proc->addArgument( pdfbrowser ); + proc->addArgument( name ); + proc->start(); + + return; + } + + TQUrl u( context(), name ); + if ( !u.isLocalFile() ) { + TQMessageBox::information( mw, tr( "Help" ), tr( "Can't load and display non-local file\n" + "%1" ).arg( name ) ); + return; + } + + setText("<body bgcolor=\"" + paletteBackgroundColor().name() + "\">"); + TQTextBrowser::setSource( name ); +} + + +void HelpWindow::openLinkInNewWindow() +{ + if ( lastAnchor.isEmpty() ) + return; + newWindow = TRUE; + setSource(lastAnchor); + newWindow = FALSE; +} + +void HelpWindow::openLinkInNewWindow( const TQString &link ) +{ + lastAnchor = link; + openLinkInNewWindow(); +} + +void HelpWindow::openLinkInNewPage() +{ + if( lastAnchor.isEmpty() ) + return; + mw->browsers()->newTab( lastAnchor ); + lastAnchor = TQString(); +} + +void HelpWindow::openLinkInNewPage( const TQString &link ) +{ + lastAnchor = link; + openLinkInNewPage(); +} + +TQPopupMenu *HelpWindow::createPopupMenu( const TQPoint& pos ) +{ + TQPopupMenu *m = new TQPopupMenu(0); + lastAnchor = anchorAt( pos ); + if ( !lastAnchor.isEmpty() ) { + if ( lastAnchor.at( 0 ) == '#' ) { + TQString src = source(); + int hsh = src.tqfind( '#' ); + lastAnchor = ( hsh>=0 ? src.left( hsh ) : src ) + lastAnchor; + } + m->insertItem( tr("Open Link in New Window\tShift+LMB"), + this, TQT_SLOT( openLinkInNewWindow() ) ); + m->insertItem( tr("Open Link in New Tab"), + this, TQT_SLOT( openLinkInNewPage() ) ); + } + mw->actionNewWindow->addTo( m ); + mw->actionOpenPage->addTo( m ); + mw->actionClosePage->addTo( m ); + m->insertSeparator(); + mw->actionGoPrevious->addTo( m ); + mw->actionGoNext->addTo( m ); + mw->actionGoHome->addTo( m ); + m->insertSeparator(); + mw->actionZoomIn->addTo( m ); + mw->actionZoomOut->addTo( m ); + m->insertSeparator(); + mw->actionEditCopy->addTo( m ); + mw->actionEditFind->addTo( m ); + return m; +} + +void HelpWindow::blockScrolling( bool b ) +{ + blockScroll = b; +} + +void HelpWindow::ensureCursorVisible() +{ + if ( !blockScroll ) + TQTextBrowser::ensureCursorVisible(); +} + +void HelpWindow::contentsMousePressEvent(TQMouseEvent *e) +{ + shiftPressed = ( e->state() & ShiftButton ); + TQTextBrowser::contentsMousePressEvent(e); +} + +void HelpWindow::keyPressEvent(TQKeyEvent *e) +{ + shiftPressed = ( e->state() & ShiftButton ); + TQTextBrowser::keyPressEvent(e); +} + +void HelpWindow::copy() +{ + if (textFormat() == TQt::PlainText) { + TQTextEdit::copy(); + } else { + TQt::TextFormat oldTf = textFormat(); + setTextFormat(TQt::PlainText); + TQString selectText = selectedText(); + selectText.tqreplace("<br>", "\n"); + selectText.tqreplace("\xa0", " "); + selectText.tqreplace(">", ">"); + selectText.tqreplace("<", "<"); + selectText.tqreplace("&", "&"); + + TQClipboard *cb = TQApplication::tqclipboard(); + if (cb->supportsSelection()) + cb->setText(selectText, TQClipboard::Selection); + cb->setText(selectText, TQClipboard::Clipboard); + setTextFormat(oldTf); + } +} + +void HelpWindow::updateForward(bool fwd) +{ + fwdAvail = fwd; +} + +void HelpWindow::updateBackward(bool back) +{ + backAvail = back; +} diff --git a/tqtinterface/qt4/tools/assistant/helpwindow.h b/tqtinterface/qt4/tools/assistant/helpwindow.h new file mode 100644 index 0000000..a00774f --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/helpwindow.h @@ -0,0 +1,88 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef HELPWINDOW_H +#define HELPWINDOW_H + +#include <tqtextbrowser.h> + +class MainWindow; +class TQKeyEvent; +class TQMime; +class TQMouseEvent; + +class HelpWindow : public TQTextBrowser +{ + Q_OBJECT + TQ_OBJECT +public: + HelpWindow( MainWindow *m, TQWidget *tqparent = 0, const char *name = 0 ); + void setSource( const TQString &name ); + TQPopupMenu *createPopupMenu( const TQPoint& pos ); + void blockScrolling( bool b ); + void openLinkInNewWindow( const TQString &link ); + void openLinkInNewPage( const TQString &link ); + void addMimePath( const TQString &path ); + + void contentsMousePressEvent(TQMouseEvent *e); + void keyPressEvent(TQKeyEvent *); + + bool isBackwardAvailable() const { return backAvail; } + bool isForwardAvailable() const { return fwdAvail; } + +Q_SIGNALS: + void chooseWebBrowser(); + +public Q_SLOTS: + void copy(); +protected Q_SLOTS: + void ensureCursorVisible(); + +private Q_SLOTS: + void openLinkInNewWindow(); + void openLinkInNewPage(); + void updateForward(bool); + void updateBackward(bool); + +private: + MainWindow *mw; + TQString lastAnchor; + bool blockScroll; + bool shiftPressed; + bool newWindow; + TQMimeSourceFactory *mimeSourceFactory; + bool fwdAvail; + bool backAvail; +}; + +#endif diff --git a/tqtinterface/qt4/tools/assistant/images/addtab.png b/tqtinterface/qt4/tools/assistant/images/addtab.png Binary files differnew file mode 100644 index 0000000..a88697f --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/addtab.png diff --git a/tqtinterface/qt4/tools/assistant/images/appicon.png b/tqtinterface/qt4/tools/assistant/images/appicon.png Binary files differnew file mode 100644 index 0000000..a50dc9c --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/appicon.png diff --git a/tqtinterface/qt4/tools/assistant/images/assistant.png b/tqtinterface/qt4/tools/assistant/images/assistant.png Binary files differnew file mode 100644 index 0000000..461b883 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/assistant.png diff --git a/tqtinterface/qt4/tools/assistant/images/book.png b/tqtinterface/qt4/tools/assistant/images/book.png Binary files differnew file mode 100644 index 0000000..ede2b97 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/book.png diff --git a/tqtinterface/qt4/tools/assistant/images/closetab.png b/tqtinterface/qt4/tools/assistant/images/closetab.png Binary files differnew file mode 100644 index 0000000..61ac034 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/closetab.png diff --git a/tqtinterface/qt4/tools/assistant/images/d_closetab.png b/tqtinterface/qt4/tools/assistant/images/d_closetab.png Binary files differnew file mode 100644 index 0000000..f2ac158 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/d_closetab.png diff --git a/tqtinterface/qt4/tools/assistant/images/designer.png b/tqtinterface/qt4/tools/assistant/images/designer.png Binary files differnew file mode 100644 index 0000000..d808332 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/designer.png diff --git a/tqtinterface/qt4/tools/assistant/images/editcopy.png b/tqtinterface/qt4/tools/assistant/images/editcopy.png Binary files differnew file mode 100644 index 0000000..804c98c --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/editcopy.png diff --git a/tqtinterface/qt4/tools/assistant/images/find.png b/tqtinterface/qt4/tools/assistant/images/find.png Binary files differnew file mode 100644 index 0000000..8d73ab0 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/find.png diff --git a/tqtinterface/qt4/tools/assistant/images/home.png b/tqtinterface/qt4/tools/assistant/images/home.png Binary files differnew file mode 100644 index 0000000..aa150a3 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/home.png diff --git a/tqtinterface/qt4/tools/assistant/images/linguist.png b/tqtinterface/qt4/tools/assistant/images/linguist.png Binary files differnew file mode 100644 index 0000000..1021804 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/linguist.png diff --git a/tqtinterface/qt4/tools/assistant/images/next.png b/tqtinterface/qt4/tools/assistant/images/next.png Binary files differnew file mode 100644 index 0000000..4b29ff4 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/next.png diff --git a/tqtinterface/qt4/tools/assistant/images/previous.png b/tqtinterface/qt4/tools/assistant/images/previous.png Binary files differnew file mode 100644 index 0000000..4e3556c --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/previous.png diff --git a/tqtinterface/qt4/tools/assistant/images/print.png b/tqtinterface/qt4/tools/assistant/images/print.png Binary files differnew file mode 100644 index 0000000..cc083ed --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/print.png diff --git a/tqtinterface/qt4/tools/assistant/images/qt.png b/tqtinterface/qt4/tools/assistant/images/qt.png Binary files differnew file mode 100644 index 0000000..29a1fa8 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/qt.png diff --git a/tqtinterface/qt4/tools/assistant/images/splash.png b/tqtinterface/qt4/tools/assistant/images/splash.png Binary files differnew file mode 100644 index 0000000..e121aa1 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/splash.png diff --git a/tqtinterface/qt4/tools/assistant/images/whatsthis.xpm b/tqtinterface/qt4/tools/assistant/images/whatsthis.xpm new file mode 100644 index 0000000..799b599 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/whatsthis.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *whatsthis[] = { +/* width height ncolors chars_per_pixel */ +"16 16 3 1", +/* colors */ +"# c None", +". c #000000", +"a c #000083", +/* pixels */ +".########aaaaa##", +"..######aaa#aaa#", +"...####aaa###aaa", +"....###aa#####aa", +".....##aa#####aa", +"......##a####aaa", +".......#####aaa#", +"........###aaa##", +".........#aaa###", +".....#####aaa###", +"..#...##########", +".##...####aaa###", +"####...###aaa###", +"####...#########", +"#####...########", +"#####...########" +}; diff --git a/tqtinterface/qt4/tools/assistant/images/zoomin.png b/tqtinterface/qt4/tools/assistant/images/zoomin.png Binary files differnew file mode 100644 index 0000000..667f2d6 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/zoomin.png diff --git a/tqtinterface/qt4/tools/assistant/images/zoomout.png b/tqtinterface/qt4/tools/assistant/images/zoomout.png Binary files differnew file mode 100644 index 0000000..8755f4c --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/images/zoomout.png diff --git a/tqtinterface/qt4/tools/assistant/index.cpp b/tqtinterface/qt4/tools/assistant/index.cpp new file mode 100644 index 0000000..41e582f --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/index.cpp @@ -0,0 +1,526 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "index.h" + +#include <tqfile.h> +#include <tqdir.h> +#include <tqstringlist.h> +#include <tqdict.h> +#include <tqapplication.h> + +#include <ctype.h> + +int TermList::compareItems( TQPtrCollection::Item i1, TQPtrCollection::Item i2 ) +{ + if( ( (Term*)i1 )->frequency == ( (Term*)i2 )->frequency ) + return 0; + if( ( (Term*)i1 )->frequency < ( (Term*)i2 )->frequency ) + return -1; + return 1; +} + +TQDataStream &operator>>( TQDataStream &s, Document &l ) +{ + s >> l.docNumber; + s >> l.frequency; + return s; +} + +TQDataStream &operator<<( TQDataStream &s, const Document &l ) +{ + s << (TQ_INT16)l.docNumber; + s << (TQ_INT16)l.frequency; + return s; +} + +Index::Index( const TQString &dp, const TQString &hp ) + : TQObject( 0, 0 ), dict( 8999 ), docPath( dp ) +{ + alreadyHaveDocList = FALSE; + lastWindowClosed = FALSE; + connect( tqApp, TQT_SIGNAL( lastWindowClosed() ), + this, TQT_SLOT( setLastWinClosed() ) ); +} + +Index::Index( const TQStringList &dl, const TQString &hp ) + : TQObject( 0, 0 ), dict( 8999 ) +{ + docList = dl; + alreadyHaveDocList = TRUE; + lastWindowClosed = FALSE; + connect( tqApp, TQT_SIGNAL( lastWindowClosed() ), + this, TQT_SLOT( setLastWinClosed() ) ); +} + +void Index::setLastWinClosed() +{ + lastWindowClosed = TRUE; +} + +void Index::setDictionaryFile( const TQString &f ) +{ + dictFile = f; +} + +void Index::setDocListFile( const TQString &f ) +{ + docListFile = f; +} + +void Index::setDocList( const TQStringList &lst ) +{ + docList = lst; +} + +int Index::makeIndex() +{ + if ( !alreadyHaveDocList ) + setupDocumentList(); + if ( docList.isEmpty() ) + return 1; + TQStringList::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; + } + parseDocument( *it, i ); + if ( i%steps == 0 ) { + prog++; + emit indexingProgress( prog ); + } + } + return 0; +} + +void Index::setupDocumentList() +{ + TQDir d( docPath ); + TQStringList lst = d.entryList( "*.html" ); + TQStringList::ConstIterator it = lst.begin(); + for ( ; it != lst.end(); ++it ) + docList.append( docPath + "/" + *it ); +} + +void Index::insertInDict( const TQString &str, int docNum ) +{ + if ( strcmp( str, "amp" ) == 0 || strcmp( str, "nbsp" ) == 0 ) + return; + Entry *e = 0; + if ( dict.count() ) + e = dict[ str ]; + + if ( e ) { + if ( e->documents.first().docNumber != docNum ) + e->documents.prepend( Document( docNum, 1 ) ); + else + e->documents.first().frequency++; + } else { + dict.insert( str, new Entry( docNum ) ); + } +} + +void Index::parseDocument( const TQString &filename, int docNum ) +{ + TQFile file( filename ); + if ( !file.open( IO_ReadOnly ) ) { + qWarning( "can not open file " + filename ); + return; + } + + TQTextStream s( &file ); + TQString text = s.read(); + if (text.isNull()) + return; + + bool valid = TRUE; + const TQChar *buf = text.tqunicode(); + TQChar str[64]; + TQChar c = buf[0]; + int j = 0; + int i = 0; + while ( (uint)j < text.length() ) { + if ( c == '<' || c == '&' ) { + valid = FALSE; + if ( i > 1 ) + insertInDict( TQString(str,i), docNum ); + i = 0; + c = buf[++j]; + continue; + } + if ( ( c == '>' || c == ';' ) && !valid ) { + valid = TRUE; + c = buf[++j]; + continue; + } + if ( !valid ) { + c = buf[++j]; + continue; + } + if ( ( c.isLetterOrNumber() || c == '_' ) && i < 63 ) { + str[i] = c.lower(); + ++i; + } else { + if ( i > 1 ) + insertInDict( TQString(str,i), docNum ); + i = 0; + } + c = buf[++j]; + } + if ( i > 1 ) + insertInDict( TQString(str,i), docNum ); + file.close(); +} + +void Index::writeDict() +{ + TQDictIterator<Entry> it( dict ); + TQFile f( dictFile ); + if ( !f.open( IO_WriteOnly ) ) + return; + TQDataStream s( &f ); + for( ; it.current(); ++it ) { + Entry *e = it.current(); + s << it.currentKey(); + s << e->documents; + } + f.close(); + writeDocumentList(); +} + +void Index::writeDocumentList() +{ + TQFile f( docListFile ); + if ( !f.open( IO_WriteOnly ) ) + return; + TQDataStream s( &f ); + s << docList; +} + +void Index::readDict() +{ + TQFile f( dictFile ); + if ( !f.open( IO_ReadOnly ) ) + return; + + dict.clear(); + TQDataStream s( &f ); + TQString key; + TQValueList<Document> docs; + while ( !s.atEnd() ) { + s >> key; + s >> docs; + dict.insert( key, new Entry( docs ) ); + } + f.close(); + readDocumentList(); +} + +void Index::readDocumentList() +{ + TQFile f( docListFile ); + if ( !f.open( IO_ReadOnly ) ) + return; + TQDataStream s( &f ); + s >> docList; +} + +TQStringList Index::query( const TQStringList &terms, const TQStringList &termSeq, const TQStringList &seqWords ) +{ + TermList termList; + + TQStringList::ConstIterator it = terms.begin(); + for ( it = terms.begin(); it != terms.end(); ++it ) { + Entry *e = 0; + if ( (*it).tqcontains( '*' ) ) { + TQValueList<Document> wcts = setupDummyTerm( getWildcardTerms( *it ) ); + termList.append( new Term( "dummy", wcts.count(), wcts ) ); + } else if ( dict[ *it ] ) { + e = dict[ *it ]; + termList.append( new Term( *it, e->documents.count(), e->documents ) ); + } else { + return TQStringList(); + } + } + termList.sort(); + + Term *minTerm = termList.first(); + if ( !termList.count() ) + return TQStringList(); + termList.removeFirst(); + + TQValueList<Document> minDocs = minTerm->documents; + TQValueList<Document>::iterator C; + TQValueList<Document>::ConstIterator It; + Term *t = termList.first(); + for ( ; t; t = termList.next() ) { + TQValueList<Document> docs = t->documents; + C = minDocs.begin(); + while ( C != minDocs.end() ) { + bool found = FALSE; + for ( It = docs.begin(); It != docs.end(); ++It ) { + if ( (*C).docNumber == (*It).docNumber ) { + (*C).frequency += (*It).frequency; + found = TRUE; + break; + } + } + if ( !found ) + C = minDocs.remove( C ); + else + ++C; + } + } + + TQStringList results; + qHeapSort( minDocs ); + if ( termSeq.isEmpty() ) { + for ( C = minDocs.begin(); C != minDocs.end(); ++C ) + results << docList[ (int)(*C).docNumber ]; + return results; + } + + TQString fileName; + for ( C = minDocs.begin(); C != minDocs.end(); ++C ) { + fileName = docList[ (int)(*C).docNumber ]; + if ( searchForPattern( termSeq, seqWords, fileName ) ) + results << fileName; + } + return results; +} + +TQString Index::getDocumentTitle( const TQString &fileName ) +{ + TQFile file( fileName ); + if ( !file.open( IO_ReadOnly ) ) { + qWarning( "cannot open file " + fileName ); + return fileName; + } + TQTextStream s( &file ); + TQString text = s.read(); + + int start = text.tqfind( "<title>", 0, FALSE ) + 7; + int end = text.tqfind( "</title>", 0, FALSE ); + + TQString title = ( end - start <= 0 ? tr("Untitled") : text.mid( start, end - start ) ); + return title; +} + +TQStringList Index::getWildcardTerms( const TQString &term ) +{ + TQStringList lst; + TQStringList terms = split( term ); + TQValueList<TQString>::iterator iter; + + TQDictIterator<Entry> it( dict ); + for( ; it.current(); ++it ) { + int index = 0; + bool found = FALSE; + TQString text( it.currentKey() ); + for ( iter = terms.begin(); iter != terms.end(); ++iter ) { + if ( *iter == "*" ) { + found = TRUE; + continue; + } + if ( iter == terms.begin() && (*iter)[0] != text[0] ) { + found = FALSE; + break; + } + index = text.tqfind( *iter, index ); + if ( *iter == terms.last() && index != (int)text.length()-1 ) { + index = text.tqfindRev( *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; +} + +TQStringList Index::split( const TQString &str ) +{ + TQStringList lst; + int j = 0; + int i = str.tqfind( '*', j ); + + while ( i != -1 ) { + if ( i > j && i <= (int)str.length() ) { + lst << str.mid( j, i - j ); + lst << "*"; + } + j = i + 1; + i = str.tqfind( '*', j ); + } + + int l = str.length() - 1; + if ( str.mid( j, l - j + 1 ).length() > 0 ) + lst << str.mid( j, l - j + 1 ); + + return lst; +} + +TQValueList<Document> Index::setupDummyTerm( const TQStringList &terms ) +{ + TermList termList; + TQStringList::ConstIterator it = terms.begin(); + for ( ; it != terms.end(); ++it ) { + Entry *e = 0; + if ( dict[ *it ] ) { + e = dict[ *it ]; + termList.append( new Term( *it, e->documents.count(), e->documents ) ); + } + } + termList.sort(); + + TQValueList<Document> maxList; + + if ( !termList.count() ) + return maxList; + maxList = termList.last()->documents; + termList.removeLast(); + + TQValueList<Document>::iterator docIt; + Term *t = termList.first(); + while ( t ) { + TQValueList<Document> docs = t->documents; + for ( docIt = docs.begin(); docIt != docs.end(); ++docIt ) { + if ( maxList.tqfindIndex( *docIt ) == -1 ) + maxList.append( *docIt ); + } + t = termList.next(); + } + return maxList; +} + +void Index::buildMiniDict( const TQString &str ) +{ + if ( miniDict[ str ] ) + miniDict[ str ]->positions.append( wordNum ); + ++wordNum; +} + +bool Index::searchForPattern( const TQStringList &patterns, const TQStringList &words, const TQString &fileName ) +{ + TQFile file( fileName ); + if ( !file.open( IO_ReadOnly ) ) { + qWarning( "cannot open file " + fileName ); + return FALSE; + } + + wordNum = 3; + miniDict.clear(); + TQStringList::ConstIterator cIt = words.begin(); + for ( ; cIt != words.end(); ++cIt ) + miniDict.insert( *cIt, new PosEntry( 0 ) ); + + TQTextStream s( &file ); + TQString text = s.read(); + bool valid = TRUE; + const TQChar *buf = text.tqunicode(); + TQChar str[64]; + TQChar c = buf[0]; + int j = 0; + int i = 0; + while ( (uint)j < text.length() ) { + if ( c == '<' || c == '&' ) { + valid = FALSE; + if ( i > 1 ) + buildMiniDict( TQString(str,i) ); + i = 0; + c = buf[++j]; + continue; + } + if ( ( c == '>' || c == ';' ) && !valid ) { + valid = TRUE; + c = buf[++j]; + continue; + } + if ( !valid ) { + c = buf[++j]; + continue; + } + if ( ( c.isLetterOrNumber() || c == '_' ) && i < 63 ) { + str[i] = c.lower(); + ++i; + } else { + if ( i > 1 ) + buildMiniDict( TQString(str,i) ); + i = 0; + } + c = buf[++j]; + } + if ( i > 1 ) + buildMiniDict( TQString(str,i) ); + file.close(); + + TQStringList::ConstIterator patIt = patterns.begin(); + TQStringList wordLst; + TQValueList<uint> a, b; + TQValueList<uint>::iterator aIt; + for ( ; patIt != patterns.end(); ++patIt ) { + wordLst = TQStringList::split( ' ', *patIt ); + 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.tqfind( *aIt + 1 ) != b.end() ) { + (*aIt)++; + ++aIt; + } else { + aIt = a.remove( aIt ); + } + } + } + } + if ( a.count() ) + return TRUE; + return FALSE; +} diff --git a/tqtinterface/qt4/tools/assistant/index.h b/tqtinterface/qt4/tools/assistant/index.h new file mode 100644 index 0000000..8526ba0 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/index.h @@ -0,0 +1,132 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef INDEX_H +#define INDEX_H + +#include <tqstringlist.h> +#include <tqdict.h> +#include <tqdatastream.h> +#include <tqobject.h> + +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; + } + TQ_INT16 docNumber; + TQ_INT16 frequency; +}; + +TQDataStream &operator>>( TQDataStream &s, Document &l ); +TQDataStream &operator<<( TQDataStream &s, const Document &l ); + +class Index : public TQObject +{ + Q_OBJECT + TQ_OBJECT +public: + struct Entry { + Entry( int d ) { documents.append( Document( d, 1 ) ); } + Entry( TQValueList<Document> l ) : documents( l ) {} + TQValueList<Document> documents; + }; + struct PosEntry { + PosEntry( int p ) { positions.append( p ); } + TQValueList<uint> positions; + }; + + Index( const TQString &dp, const TQString &hp ); + Index( const TQStringList &dl, const TQString &hp ); + void writeDict(); + void readDict(); + int makeIndex(); + TQStringList query( const TQStringList&, const TQStringList&, const TQStringList& ); + TQString getDocumentTitle( const TQString& ); + void setDictionaryFile( const TQString& ); + void setDocListFile( const TQString& ); + void setDocList( const TQStringList & ); + +Q_SIGNALS: + void indexingProgress( int ); + +private Q_SLOTS: + void setLastWinClosed(); + +private: + void setupDocumentList(); + void parseDocument( const TQString&, int ); + void insertInDict( const TQString&, int ); + void writeDocumentList(); + void readDocumentList(); + TQStringList getWildcardTerms( const TQString& ); + TQStringList split( const TQString& ); + TQValueList<Document> setupDummyTerm( const TQStringList& ); + bool searchForPattern( const TQStringList&, const TQStringList&, const TQString& ); + void buildMiniDict( const TQString& ); + TQStringList docList; + TQDict<Entry> dict; + TQDict<PosEntry> miniDict; + uint wordNum; + TQString docPath; + TQString dictFile, docListFile; + bool alreadyHaveDocList; + bool lastWindowClosed; +}; + +struct Term { + Term( const TQString &t, int f, TQValueList<Document> l ) + : term( t ), frequency( f ), documents( l ) {} + TQString term; + int frequency; + TQValueList<Document>documents; +}; + +class TermList : public TQPtrList<Term> +{ +public: + TermList() : TQPtrList<Term>() {} + int compareItems( TQPtrCollection::Item i1, TQPtrCollection::Item i2 ); +}; + +#endif diff --git a/tqtinterface/qt4/tools/assistant/lib/lib.pro b/tqtinterface/qt4/tools/assistant/lib/lib.pro new file mode 100644 index 0000000..d0a5d18 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/lib/lib.pro @@ -0,0 +1,23 @@ +TEMPLATE = lib +TARGET = tqassistantclient +VERSION = 1.0 + +CONFIG += qt warn_on release +CONFIG += staticlib +CONFIG -= dll + +SOURCES = tqassistantclient.cpp +HEADERS += $$QT_SOURCE_TREE/include/tqassistantclient.h + + +DEFINES += QT_INTERNAL_NETWORK +include( ../../../src/qt_professional.pri ) + +DESTDIR = ../../../lib + +unix { + target.path=$$libs.path + QMAKE_CFLAGS += $$QMAKE_CFLAGS_SHLIB + QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_SHLIB + INSTALLS += target +} diff --git a/tqtinterface/qt4/tools/assistant/lib/tqassistantclient.cpp b/tqtinterface/qt4/tools/assistant/lib/tqassistantclient.cpp new file mode 100644 index 0000000..4478642 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/lib/tqassistantclient.cpp @@ -0,0 +1,334 @@ +/********************************************************************** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQAssistantClient library. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqassistantclient.h" + +#include <tqsocket.h> +#include <tqtextstream.h> +#include <tqprocess.h> +#include <tqtimer.h> +#include <tqfileinfo.h> + +class TQAssistantClientPrivate +{ + friend class TQAssistantClient; + TQStringList arguments; +}; + +static TQMap<const TQAssistantClient*,TQAssistantClientPrivate*> *dpointers = 0; + +static TQAssistantClientPrivate *data( const TQAssistantClient *client, bool create=FALSE ) +{ + if( !dpointers ) + dpointers = new TQMap<const TQAssistantClient*,TQAssistantClientPrivate*>; + TQAssistantClientPrivate *d = (*dpointers)[client]; + if( !d && create ) { + d = new TQAssistantClientPrivate; + dpointers->insert( client, d ); + } + return d; +} + +/*! + \class TQAssistantClient + \brief The TQAssistantClient class provides a means of using TQt + Assistant as an application's help tool. + + Using TQt Assistant is simple: Create a TQAssistantClient instance, + then call showPage() as often as necessary to show your help + pages. When you call showPage(), TQt Assistant will be launched if + it isn't already running. + + The TQAssistantClient instance can open (openAssistant()) or close + (closeAssistant()) TQt Assistant whenever required. If TQt Assistant + is open, isOpen() returns TRUE. + + One TQAssistantClient instance interacts with one TQt Assistant + instance, so every time you call openAssistant(), showPage() or + closeAssistant() they are applied to the particular TQt Assistant + instance associated with the TQAssistantClient. + + When you call openAssistant() the assistantOpened() signal is + emitted. Similarly when closeAssistant() is called, + assistantClosed() is emitted. In either case, if an error occurs, + error() is emitted. + + This class is not included in the TQt library itself. To use it you + must link against \c libqassistantclient.a (Unix) or \c + qassistantclient.lib (Windows), which is built into \c INSTALL/lib + if you built the TQt tools (\c INSTALL is the directory where TQt is + installed). If you use qmake, then you can simply add the following + line to your pro file: + + \code + LIBS += -lqassistantclient + \endcode + + See also "Adding Documentation to TQt Assistant" in the \link + assistant.book TQt Assistant manual\endlink. +*/ + +/*! + \fn void TQAssistantClient::assistantOpened() + + This signal is emitted when TQt Assistant is open and the + client-server communication is set up. +*/ + +/*! + \fn void TQAssistantClient::assistantClosed() + + This signal is emitted when the connection to TQt Assistant is + closed. This happens when the user exits TQt Assistant, or when an + error in the server or client occurs, or if closeAssistant() is + called. +*/ + +/*! + \fn void TQAssistantClient::error( const TQString &msg ) + + This signal is emitted if TQt Assistant cannot be started or if an + error occurs during the initialization of the connection between + TQt Assistant and the calling application. The \a msg provides an + explanation of the error. +*/ + +/*! + Constructs an assistant client object. The \a path specifies the + path to the TQt Assistant executable. If \a path is an empty + string the system path (\c{%PATH%} or \c $PATH) is used. + + The assistant client object is a child of \a tqparent and is called + \a name. +*/ +TQAssistantClient::TQAssistantClient( const TQString &path, TQObject *tqparent, const char *name ) + : TQObject( tqparent, name ), host ( "localhost" ) +{ + if ( path.isEmpty() ) + assistantCommand = "assistant"; + else { + TQFileInfo fi( path ); + if ( fi.isDir() ) + assistantCommand = path + "/assistant"; + else + assistantCommand = path; + } + +#if defined(TQ_OS_MACX) + assistantCommand += ".app/Contents/MacOS/assistant"; +#elif defined(TQ_WS_WIN) + if (!assistantCommand.endsWith(".exe")) + assistantCommand += ".exe"; +#endif + socket = new TQSocket( this ); + connect( socket, TQT_SIGNAL( connected() ), + TQT_SLOT( socketConnected() ) ); + connect( socket, TQT_SIGNAL( connectionClosed() ), + TQT_SLOT( socketConnectionClosed() ) ); + connect( socket, TQT_SIGNAL( error( int ) ), + TQT_SLOT( socketError( int ) ) ); + opened = FALSE; + proc = new TQProcess( this ); + port = 0; + pageBuffer = ""; + connect( proc, TQT_SIGNAL( readyReadStderr() ), + this, TQT_SLOT( readStdError() ) ); +} + +/*! + Destroys the assistant client object and frees up all allocated + resources. +*/ +TQAssistantClient::~TQAssistantClient() +{ + if ( proc && proc->isRunning() ) { + proc->tryTerminate(); + proc->kill(); + } + + if( dpointers ) { + TQAssistantClientPrivate *d = (*dpointers)[ this ]; + if( d ) { + dpointers->remove( this ); + delete d; + if( dpointers->isEmpty() ) { + delete dpointers; + dpointers = 0; + } + } + } +} + +/*! + This function opens TQt Assistant and sets up the client-server + communiction between the application and TQt Assistant. If it is + already open, this function does nothing. If an error occurs, + error() is emitted. + + \sa assistantOpened() +*/ +void TQAssistantClient::openAssistant() +{ + if ( proc->isRunning() ) + return; + proc->clearArguments(); + proc->addArgument( assistantCommand ); + proc->addArgument( "-server" ); + if( !pageBuffer.isEmpty() ) { + proc->addArgument( "-file" ); + proc->addArgument( pageBuffer ); + } + + TQAssistantClientPrivate *d = data( this ); + if( d ) { + TQStringList::ConstIterator it = d->arguments.begin(); + while( it!=d->arguments.end() ) { + proc->addArgument( *it ); + ++it; + } + } + + if ( !proc->launch( TQString() ) ) { + emit error( tr( "Cannot start TQt Assistant '%1'" ) + .arg( proc->arguments().join( " " ) ) ); + return; + } + connect( proc, TQT_SIGNAL( readyReadStdout() ), + this, TQT_SLOT( readPort() ) ); +} + +void TQAssistantClient::readPort() +{ + TQString p = proc->readLineStdout(); + TQ_UINT16 port = p.toUShort(); + if ( port == 0 ) { + emit error( tr( "Cannot connect to TQt Assistant." ) ); + return; + } + socket->connectToHost( host, port ); + disconnect( proc, TQT_SIGNAL( readyReadStdout() ), + this, TQT_SLOT( readPort() ) ); +} + +/*! + Use this function to close TQt Assistant. + + \sa assistantClosed() +*/ +void TQAssistantClient::closeAssistant() +{ + if ( !opened ) + return; + proc->tryTerminate(); + proc->kill(); +} + +/*! + Call this function to make TQt Assistant show a particular \a page. + The \a page is a filename (e.g. \c myhelpfile.html). See "Adding + Documentation to TQt Assistant" in the \link assistant.book TQt + Assistant manual\endlink for further information. + + If TQt Assistant hasn't been \link openAssistant() opened\endlink + yet, this function will do nothing. You can use isOpen() to + determine whether TQt Assistant is up and running, or you can + connect to the asssistantOpened() signal. + + \sa isOpen(), assistantOpened() +*/ +void TQAssistantClient::showPage( const TQString &page ) +{ + if ( !opened ) { + pageBuffer = page; + openAssistant(); + pageBuffer = TQString(); + return; + } + TQTextStream os( socket ); + os << page << "\n"; +} + +/*! + \property TQAssistantClient::open + \brief Whether TQt Assistant is open. + +*/ +bool TQAssistantClient::isOpen() const +{ + return opened; +} + +void TQAssistantClient::socketConnected() +{ + opened = TRUE; + if ( !pageBuffer.isEmpty() ) + showPage( pageBuffer ); + emit assistantOpened(); +} + +void TQAssistantClient::socketConnectionClosed() +{ + opened = FALSE; + emit assistantClosed(); +} + +void TQAssistantClient::socketError( int i ) +{ + if ( i == TQSocket::ErrConnectionRefused ) + emit error( tr( "Could not connect to Assistant: Connection refused" ) ); + else if ( i == TQSocket::ErrHostNotFound ) + emit error( tr( "Could not connect to Assistant: Host not found" ) ); + else + emit error( tr( "Communication error" ) ); +} + +void TQAssistantClient::readStdError() +{ + TQString errmsg; + while ( proc->canReadLineStderr() ) { + errmsg += proc->readLineStderr(); + errmsg += "\n"; + } + if (!errmsg.isEmpty()) + emit error( tr( errmsg.simplifyWhiteSpace() ) ); +} + +/*! + Sets the command line arguments used when TQt Assistant is + started to \a args. +*/ +void TQAssistantClient::setArguments( const TQStringList &args ) +{ + TQAssistantClientPrivate *d = data( this, TRUE ); + d->arguments = args; +} diff --git a/tqtinterface/qt4/tools/assistant/lib/tqassistantclient.h b/tqtinterface/qt4/tools/assistant/lib/tqassistantclient.h new file mode 100644 index 0000000..64b95d9 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/lib/tqassistantclient.h @@ -0,0 +1,81 @@ +/********************************************************************** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQAssistantClient library. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQASSISTANTCLIENT_H +#define TQASSISTANTCLIENT_H + +#include <tqobject.h> + +class TQSocket; +class TQProcess; + +class TQAssistantClient : public TQObject +{ + Q_OBJECT + TQ_OBJECT + Q_PROPERTY( bool open READ isOpen ) + +public: + TQAssistantClient( const TQString &path, TQObject *tqparent = 0, const char *name = 0 ); + ~TQAssistantClient(); + + bool isOpen() const; + + void setArguments( const TQStringList &args ); + +public Q_SLOTS: + virtual void openAssistant(); + virtual void closeAssistant(); + virtual void showPage( const TQString &page ); + +Q_SIGNALS: + void assistantOpened(); + void assistantClosed(); + void error( const TQString &msg ); + +private Q_SLOTS: + void socketConnected(); + void socketConnectionClosed(); + void readPort(); + void socketError( int ); + void readStdError(); + +private: + TQSocket *socket; + TQProcess *proc; + TQ_UINT16 port; + TQString host, assistantCommand, pageBuffer; + bool opened; +}; + +#endif diff --git a/tqtinterface/qt4/tools/assistant/main.cpp b/tqtinterface/qt4/tools/assistant/main.cpp new file mode 100644 index 0000000..42b5819 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/main.cpp @@ -0,0 +1,344 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "mainwindow.h" +#include "helpdialogimpl.h" +#include "config.h" + +#include <tqapplication.h> +#include <tqserversocket.h> +#include <tqsocket.h> +#include <tqpixmap.h> +#include <tqptrlist.h> +#include <tqstringlist.h> +#include <tqdir.h> +#include <tqmessagebox.h> +#include <tqguardedptr.h> +#include <stdlib.h> +#include <stdio.h> +#include <tqtextcodec.h> + +#ifdef TQ_WS_WIN +#define INDEX_CHECK( text ) if( i+1 >= argc ) { TQMessageBox::information( 0, "TQt Assistant", text ); return 1; } +#else +#define INDEX_CHECK( text ) if( i+1 >= argc ) { fprintf( stderr, text "\n" ); return 1; } +#endif + +static bool allowFirstRun = TRUE; + +class AssistantSocket : public TQSocket +{ + Q_OBJECT + TQ_OBJECT +public: + AssistantSocket( int sock, TQObject *tqparent = 0 ); + ~AssistantSocket() {} + +Q_SIGNALS: + void showLinkRequest( const TQString& ); + +private Q_SLOTS: + void readClient(); + void connectionClosed(); +}; + + +class AssistantServer : public TQServerSocket +{ + Q_OBJECT + TQ_OBJECT +public: + AssistantServer( TQObject* tqparent = 0 ); + void newConnection( int socket ); + TQ_UINT16 getPort() const; + +Q_SIGNALS: + void showLinkRequest( const TQString& ); + void newConnect(); + +private: + TQ_UINT16 p; +}; + + +AssistantSocket::AssistantSocket( int sock, TQObject *tqparent ) + : TQSocket( tqparent, 0 ) +{ + connect( this, TQT_SIGNAL( readyRead() ), + TQT_SLOT( readClient() ) ); + connect( this, TQT_SIGNAL( connectionClosed() ), + TQT_SLOT( connectionClosed() ) ); + setSocket( sock ); +} + +void AssistantSocket::readClient() +{ + TQString link = TQString(); + while ( canReadLine() ) + link = readLine(); + if ( !link.isNull() ) { + link = link.tqreplace( "\n", "" ); + link = link.tqreplace( "\r", "" ); + emit showLinkRequest( link ); + } +} + +void AssistantSocket::connectionClosed() +{ + delete this; +} + +AssistantServer::AssistantServer( TQObject *tqparent ) + : TQServerSocket( 0x7f000001, 0, 1, tqparent ) +{ + if ( !ok() ) { + TQMessageBox::critical( 0, tr( "TQt Assistant" ), + tr( "Failed to bind to port %1" ).arg( port() ) ); + exit( 1 ); + } + p = port(); +} + +TQ_UINT16 AssistantServer::getPort() const +{ + return p; +} + +void AssistantServer::newConnection( int socket ) +{ + AssistantSocket *as = new AssistantSocket( socket, this ); + connect( as, TQT_SIGNAL( showLinkRequest( const TQString& ) ), + this, TQT_SIGNAL( showLinkRequest( const TQString& ) ) ); + emit newConnect(); +} + +int main( int argc, char ** argv ) +{ + bool withGUI = TRUE; + if ( argc > 1 ) { + TQString arg( argv[1] ); + arg = arg.lower(); + if ( arg == "-addcontentfile" + || arg == "-removecontentfile" +#ifndef TQ_WS_WIN + || arg == "-help" +#endif + ) + withGUI = FALSE; + } + TQApplication a(argc, argv, withGUI); + + TQString resourceDir; + AssistantServer *as = 0; + TQStringList catlist; + TQString file, profileName, aDocPath; + bool server = FALSE; + bool hideSidebar = FALSE; + bool startClean = FALSE; + bool configLoaded = FALSE; + if ( argc == 2 ) { + if ( (argv[1])[0] != '-' ) + file = argv[1]; + } + if ( file.isEmpty() ) { + for ( int i = 1; i < argc; i++ ) { + if ( TQString( argv[i] ).lower() == "-file" ) { + INDEX_CHECK( "Missing file argument!" ); + i++; + file = argv[i]; + } else if ( TQString( argv[i] ).lower() == "-server" ) { + server = TRUE; + } else if ( TQString( argv[i] ).lower() == "-profile" ) { + INDEX_CHECK( "Missing profile argument!" ); + profileName = argv[++i]; + } else if ( TQString( argv[i] ).lower() == "-addcontentfile" ) { + INDEX_CHECK( "Missing content file!" ); + Config *c = Config::loadConfig( TQString() ); + TQFileInfo file( argv[i+1] ); + if( !file.exists() ) { + fprintf( stderr, "Could not locate content file: '%s'\n", + file.absFilePath().latin1() ); + fflush( stderr ); + return 1; + } + DocuParser *parser = DocuParser::createParser( file.absFilePath() ); + if( parser ) { + TQFile f( argv[i+1] ); + if( !parser->parse( &f ) ) { + fprintf( stderr, "Failed to parse file: '%s'\n, ", + file.absFilePath().latin1() ); + fflush( stderr ); + return 1; + } + parser->addTo( c->profile() ); + c->setDocRebuild( TRUE ); + c->save(); + } + return 0; + } else if ( TQString( argv[i] ).lower() == "-removecontentfile" ) { + INDEX_CHECK( "Missing content file!" ); + Config *c = Config::loadConfig( TQString() ); + Profile *profile = c->profile(); + TQStringList entries = profile->docs.grep(argv[i+1]); + if (entries.count() == 0) { + fprintf(stderr, "Could not locate content file: '%s'\n", + argv[i+1]); + fflush(stderr); + return 1; + } else if (entries.count() > 1) { + fprintf(stderr, "More than one entry matching file name found, " + "please specify full path to file"); + fflush(stderr); + return 1; + } else { + TQFileInfo file(entries[0]); + if( !file.exists() ) { + fprintf( stderr, "Could not locate content file: '%s'\n", + file.absFilePath().latin1() ); + fflush( stderr ); + return 1; + } + profile->removeDocFileEntry( file.absFilePath() ); + c->setDocRebuild( TRUE ); + c->save(); + } + return 0; + } else if ( TQString( argv[i] ).lower() == "-docpath" ) { + INDEX_CHECK( "Missing path!" ); + TQDir dir( argv[i+1] ); + if ( dir.exists() ) { + Config *c = Config::loadConfig( TQString() ); + c->saveProfile(Profile::createDefaultProfile(dir.absPath())); + c->loadDefaultProfile(); + c->setDocRebuild( TRUE ); + c->save(); + configLoaded = TRUE; + ++i; + } else { + fprintf( stderr, "The specified path does not exist!\n"); + fflush( stderr ); + return 1; + } + } else if ( TQString( argv[i] ).lower() == "-hidesidebar" ) { + hideSidebar = TRUE; + } else if ( TQString( argv[i] ).lower() == "-help" ) { + TQString helpText( "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 TQt 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 TQ_WS_WIN + TQMessageBox::information( 0, "TQt Assistant", "<pre>" + helpText + "</pre>" ); +#else + printf( "%s\n", helpText.latin1() ); +#endif + exit( 0 ); + } else if ( TQString( argv[i] ).lower() == "-resourcedir" ) { + INDEX_CHECK( "Missing resource directory argument!" ); + resourceDir = TQString( argv[++i] ); + } else { + fprintf( stderr, "Unrecognized option '%s'. Try -help to get help.\n", + argv[i] ); + fflush( stderr ); + return 1; + } + } + } + + if( resourceDir.isNull() ) + resourceDir = qInstallPathTranslations(); + + TQTranslator translator( 0 ); + translator.load( TQString("assistant_") + TQTextCodec::locale(), resourceDir ); + a.installTranslator( &translator ); + + TQTranslator qtTranslator( 0 ); + qtTranslator.load( TQString("qt_") + TQTextCodec::locale(), 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.latin1() ); + fflush( stderr ); + return -1; + } + + bool max = conf->isMaximized(); + TQStringList links = conf->source(); + conf->hideSideBar( hideSidebar ); + + TQGuardedPtr<MainWindow> mw = new MainWindow( 0, "Assistant" ); + + if ( server ) { + as = new AssistantServer(); + printf("%d\n", as->port() ); + fflush( stdout ); + as->connect( as, TQT_SIGNAL( showLinkRequest( const TQString& ) ), + mw, TQT_SLOT( showLinkFromClient( const TQString& ) ) ); + } + + if ( max ) + mw->showMaximized(); + else + mw->show(); + + if ( !file.isEmpty() ) + mw->showLink( file ); + else if ( file.isEmpty() ) + mw->showLinks( links ); + + a.connect( &a, TQT_SIGNAL( lastWindowClosed() ), &a, TQT_SLOT( quit() ) ); + + int appExec = a.exec(); + delete (MainWindow*)mw; + return appExec; +} + +#include "main.tqmoc" diff --git a/tqtinterface/qt4/tools/assistant/mainwindow.ui b/tqtinterface/qt4/tools/assistant/mainwindow.ui new file mode 100644 index 0000000..d3dbdab --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/mainwindow.ui @@ -0,0 +1,670 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>MainWindow</class> +<comment>********************************************************************* +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +*********************************************************************</comment> +<widget class="TQMainWindow"> + <property name="name"> + <cstring>MainWindow</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>949</width> + <height>670</height> + </rect> + </property> + <property name="caption"> + <string>Qt Assistant by Trolltech</string> + </property> +</widget> +<menubar> + <property name="name"> + <cstring>menubar</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>949</width> + <height>29</height> + </rect> + </property> + <item text="&File" name="fileMenu"> + <action name="actionNewWindow"/> + <action name="actionOpenPage"/> + <action name="actionClosePage"/> + <separator/> + <action name="actionFilePrint"/> + <separator/> + <action name="actionClose"/> + <action name="actionFileExit"/> + </item> + <item text="&Edit" name="editMenu"> + <action name="actionEditCopy"/> + <action name="actionEditFind"/> + <action name="actionEditFindAgain"/> + <action name="actionEditFindAgainPrev"/> + <separator/> + <action name="actionSettings"/> + </item> + <item text="&View" name="PopupMenu"> + <action name="actionZoomIn"/> + <action name="actionZoomOut"/> + <separator/> + </item> + <item text="&Go" name="goMenu"> + <action name="actionGoPrevious"/> + <action name="actionGoNext"/> + <action name="actionGoHome"/> + <separator/> + <action name="actionNextPage"/> + <action name="actionPrevPage"/> + </item> + <item text="Boo&kmarks" name="bookmarkMenu"> + </item> + <item text="&Help" name="helpMenu"> + <action name="actionHelpAssistant"/> + <separator/> + <action name="helpAbout_Qt_AssistantAction"/> + <action name="actionAboutApplication"/> + <separator/> + <action name="actionHelpWhatsThis"/> + </item> +</menubar> +<toolbars> + <toolbar dock="2"> + <property name="name"> + <cstring>Toolbar</cstring> + </property> + <property name="label"> + <string>Toolbar</string> + </property> + <action name="actionGoPrevious"/> + <action name="actionGoNext"/> + <action name="actionGoHome"/> + <separator/> + <action name="actionEditCopy"/> + <action name="actionEditFind"/> + <action name="actionFilePrint"/> + <separator/> + <action name="actionZoomIn"/> + <action name="actionZoomOut"/> + <separator/> + <action name="actionHelpWhatsThis"/> + </toolbar> + <toolbar dock="2"> + <property name="name"> + <cstring>goActionToolbar</cstring> + </property> + <property name="label"> + <string>Go</string> + </property> + </toolbar> +</toolbars> +<actions> + <action> + <property name="name"> + <cstring>actionFilePrint</cstring> + </property> + <property name="iconSet"> + <iconset>print.png</iconset> + </property> + <property name="text"> + <string>Print</string> + </property> + <property name="menuText"> + <string>&Print...</string> + </property> + <property name="whatsThis"> + <string>Print the currently displayed page.</string> + </property> + <property name="accel"> + <string>Ctrl+P</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionFileExit</cstring> + </property> + <property name="text"> + <string>Exit</string> + </property> + <property name="menuText"> + <string>E&xit</string> + </property> + <property name="whatsThis"> + <string>Quit Qt Assistant.</string> + </property> + <property name="accel"> + <string>Ctrl+Q</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionEditCopy</cstring> + </property> + <property name="iconSet"> + <iconset>editcopy.png</iconset> + </property> + <property name="text"> + <string>Copy</string> + </property> + <property name="menuText"> + <string>&Copy</string> + </property> + <property name="whatsThis"> + <string>Copy the selected text to the clipboard.</string> + </property> + <property name="accel"> + <string>Ctrl+C</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionEditFind</cstring> + </property> + <property name="iconSet"> + <iconset>find.png</iconset> + </property> + <property name="text"> + <string>Find in Text</string> + </property> + <property name="menuText"> + <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="accel"> + <string>Ctrl+F</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionEditFindAgain</cstring> + </property> + <property name="menuText"> + <string>Find &Next</string> + </property> + <property name="text"> + <string>Find Next</string> + </property> + <property name="accel"> + <string>F3</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionEditFindAgainPrev</cstring> + </property> + <property name="menuText"> + <string>Find &Previous</string> + </property> + <property name="text"> + <string>Find Previous</string> + </property> + <property name="accel"> + <string>Shift+F3</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionGoHome</cstring> + </property> + <property name="iconSet"> + <iconset>home.png</iconset> + </property> + <property name="text"> + <string>Home</string> + </property> + <property name="menuText"> + <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="accel"> + <string>Ctrl+Home</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionGoPrevious</cstring> + </property> + <property name="iconSet"> + <iconset>previous.png</iconset> + </property> + <property name="text"> + <string>Previous</string> + </property> + <property name="menuText"> + <string>&Previous</string> + </property> + <property name="whatsThis"> + <string>Go to the previous page.</string> + </property> + <property name="accel"> + <string>Alt+Left</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionGoNext</cstring> + </property> + <property name="iconSet"> + <iconset>next.png</iconset> + </property> + <property name="text"> + <string>Next</string> + </property> + <property name="menuText"> + <string>&Next</string> + </property> + <property name="whatsThis"> + <string>Go to the next page.</string> + </property> + <property name="accel"> + <string>Alt+Right</string> + </property> + </action> + <action> + <property name="name"> + <cstring>helpAbout_Qt_AssistantAction</cstring> + </property> + <property name="text"> + <string>About Qt Assistant</string> + </property> + <property name="menuText"> + <string>About Qt Assistant</string> + </property> + <property name="whatsThis"> + <string>Display further information about Qt Assistant.</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionAboutApplication</cstring> + </property> + </action> + <action> + <property name="name"> + <cstring>actionZoomIn</cstring> + </property> + <property name="iconSet"> + <iconset>zoomin.png</iconset> + </property> + <property name="text"> + <string>Zoom in</string> + </property> + <property name="menuText"> + <string>Zoom &in</string> + </property> + <property name="whatsThis"> + <string>Zoom in on the document, i.e. increase the font size.</string> + </property> + <property name="accel"> + <string>Ctrl++</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionZoomOut</cstring> + </property> + <property name="iconSet"> + <iconset>zoomout.png</iconset> + </property> + <property name="text"> + <string>Zoom out</string> + </property> + <property name="menuText"> + <string>Zoom &out</string> + </property> + <property name="whatsThis"> + <string>Zoom out on the document, i.e. decrease the font size.</string> + </property> + <property name="accel"> + <string>Ctrl+-</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionSettings</cstring> + </property> + <property name="text"> + <string>Settings</string> + </property> + <property name="menuText"> + <string>&Settings...</string> + </property> + <property name="whatsThis"> + <string>Open the settings dialog.</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionNewWindow</cstring> + </property> + <property name="text"> + <string>New Window</string> + </property> + <property name="menuText"> + <string>New Window</string> + </property> + <property name="whatsThis"> + <string>Open a new window.</string> + </property> + <property name="accel"> + <string>Ctrl+N</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionClose</cstring> + </property> + <property name="text"> + <string>Close</string> + </property> + <property name="menuText"> + <string>&Close</string> + </property> + <property name="whatsThis"> + <string>Close the current window.</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionAddBookmark</cstring> + </property> + <property name="text"> + <string>Add Bookmark</string> + </property> + <property name="menuText"> + <string>&Add Bookmark</string> + </property> + <property name="whatsThis"> + <string>Add the currently displayed page as a new bookmark.</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionHelpWhatsThis</cstring> + </property> + <property name="iconSet"> + <iconset>whatsthis.xpm</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="accel"> + <string>Shift+F1</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionOpenPage</cstring> + </property> + <property name="text"> + <string>Add Tab</string> + </property> + <property name="accel"> + <string>Ctrl+Alt+N</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionNextPage</cstring> + </property> + <property name="text"> + <string>Next Tab</string> + </property> + <property name="accel"> + <string>Ctrl+Alt+Right</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionPrevPage</cstring> + </property> + <property name="text"> + <string>Previous Tab</string> + </property> + <property name="accel"> + <string>Ctrl+Alt+Left</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionClosePage</cstring> + </property> + <property name="text"> + <string>Close Tab</string> + </property> + <property name="accel"> + <string>Ctrl+Alt+Q</string> + </property> + </action> + <action> + <property name="name"> + <cstring>actionHelpAssistant</cstring> + </property> + <property name="iconSet"> + <iconset>assistant.png</iconset> + </property> + <property name="text"> + <string>Qt Assistant Manual</string> + </property> + <property name="accel"> + <string>F1</string> + </property> + </action> +</actions> +<connections> + <connection> + <sender>actionGoHome</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>goHome()</slot> + </connection> + <connection> + <sender>helpAbout_Qt_AssistantAction</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>about()</slot> + </connection> + <connection> + <sender>actionEditFind</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>tqfind()</slot> + </connection> + <connection> + <sender>actionEditFindAgain</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>tqfindAgain()</slot> + </connection> + <connection> + <sender>actionEditFindAgainPrev</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>tqfindAgainPrev()</slot> + </connection> + <connection> + <sender>actionFilePrint</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>print()</slot> + </connection> + <connection> + <sender>actionSettings</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>showSettingsDialog()</slot> + </connection> + <connection> + <sender>actionNewWindow</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>newWindow()</slot> + </connection> + <connection> + <sender>actionClose</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>close()</slot> + </connection> + <connection> + <sender>actionHelpWhatsThis</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>whatsThis()</slot> + </connection> + <connection> + <sender>actionHelpAssistant</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>showAssistantHelp()</slot> + </connection> + <connection> + <sender>actionAboutApplication</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>aboutApplication()</slot> + </connection> +</connections> +<includes> + <include location="global" impldecl="in implementation">tqtoolbutton.h</include> + <include location="local" impldecl="in implementation">settingsdialogimpl.h</include> + <include location="global" impldecl="in implementation">tqmessagebox.h</include> + <include location="global" impldecl="in implementation">tqfontdatabase.h</include> + <include location="global" impldecl="in implementation">tqaccel.h</include> + <include location="global" impldecl="in implementation">tqcombobox.h</include> + <include location="global" impldecl="in implementation">tqpaintdevicemetrics.h</include> + <include location="global" impldecl="in implementation">tqsimplerichtext.h</include> + <include location="global" impldecl="in implementation">tqfileinfo.h</include> + <include location="global" impldecl="in implementation">tqtextstream.h</include> + <include location="global" impldecl="in implementation">tqdockwindow.h</include> + <include location="global" impldecl="in implementation">stdlib.h</include> + <include location="global" impldecl="in implementation">tqmime.h</include> + <include location="local" impldecl="in implementation">helpwindow.h</include> + <include location="global" impldecl="in implementation">tqstylesheet.h</include> + <include location="global" impldecl="in implementation">tqapplication.h</include> + <include location="local" impldecl="in implementation">helpdialogimpl.h</include> + <include location="global" impldecl="in implementation">tqdir.h</include> + <include location="global" impldecl="in implementation">tqprinter.h</include> + <include location="global" impldecl="in implementation">tqpainter.h</include> + <include location="global" impldecl="in implementation">tqurl.h</include> + <include location="global" impldecl="in implementation">tqstatusbar.h</include> + <include location="global" impldecl="in implementation">tqlineedit.h</include> + <include location="global" impldecl="in implementation">tqsettings.h</include> + <include location="global" impldecl="in implementation">tqcheckbox.h</include> + <include location="local" impldecl="in implementation">tabbedbrowser.h</include> + <include location="global" impldecl="in declaration">tqptrlist.h</include> + <include location="global" impldecl="in declaration">tqguardedptr.h</include> + <include location="global" impldecl="in declaration">tqmap.h</include> + <include location="local" impldecl="in declaration">finddialog.h</include> + <include location="global" impldecl="in declaration">tqstringlist.h</include> + <include location="local" impldecl="in declaration">helpwindow.h</include> + <include location="local" impldecl="in implementation">mainwindow.ui.h</include> +</includes> +<forwards> + <forward>class SettingsDialog;</forward> + <forward>class HelpDialog;</forward> + <forward>class TabbedBrowser;</forward> + <forward>class TQTimerEvent;</forward> +</forwards> +<variables> + <variable>TQPtrList<TQAction> *goActions;</variable> + <variable>int setupCompleted:1;</variable> + <variable>TabbedBrowser *tabs;</variable> + <variable>SettingsDialog * settingsDia;</variable> + <variable>TQMap<int, TQString> bookmarks;</variable> + <variable>HelpDialog *helpDock;</variable> + <variable>TQDockWindow *dw;</variable> + <variable>TQGuardedPtr<FindDialog> tqfindDialog;</variable> + <variable>static TQPtrList<MainWindow> *windows;</variable> + <variable>TQMap<TQAction*,TQString> *goActionDocFiles;</variable> + <variable>TQStringList pendingLinks;</variable> + <variable>TQPtrList<HelpWindow> pendingBrowsers</variable> +</variables> +<Q_SLOTS> + <slot>init()</slot> + <slot>setup()</slot> + <slot>destroy()</slot> + <slot>about()</slot> + <slot>aboutApplication()</slot> + <slot>tqfind()</slot> + <slot>tqfindAgain()</slot> + <slot>tqfindAgainPrev()</slot> + <slot>goHome()</slot> + <slot>print()</slot> + <slot>updateBookmarkMenu()</slot> + <slot>setupBookmarkMenu()</slot> + <slot>showBookmark( int id )</slot> + <slot>showLinkFromClient( const TQString & link )</slot> + <slot>showLink( const TQString & link )</slot> + <slot>showLinks( const TQStringList & links )</slot> + <slot>showQtHelp()</slot> + <slot>showSettingsDialog()</slot> + <slot>showWebBrowserSettings()</slot> + <slot>showSettingsDialog( int page )</slot> + <slot>hide()</slot> + <slot returnType="MainWindow *">newWindow()</slot> + <slot>saveSettings()</slot> + <slot>saveToolbarSettings()</slot> + <slot>showSearchLink( const TQString & link, const TQStringList & terms )</slot> + <slot>showGoActionLink()</slot> + <slot>showAssistantHelp()</slot> + <slot>updateProfileSettings()</slot> + <slot>backwardAvailable(bool)</slot> + <slot>forwardAvailable(bool)</slot> + <slot>browserTabChanged()</slot> +</Q_SLOTS> +<functions> + <function access="private">setupGoActions()</function> + <function access="private" returnType="bool">insertActionSeparator()</function> + <function returnType="bool">close( bool alsoDelete )</function> + <function specifier="non virtual" returnType="TabbedBrowser *">browsers()</function> + <function returnType="HelpDialog*">helpDialog()</function> + <function>timerEvent(TQTimerEvent *)</function> +</functions> +<pixmapinproject/> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/assistant/mainwindow.ui.h b/tqtinterface/qt4/tools/assistant/mainwindow.ui.h new file mode 100644 index 0000000..cb079aa --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/mainwindow.ui.h @@ -0,0 +1,697 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "config.h" + +#include <tqtabwidget.h> +#include <tqfileinfo.h> +#include <tqaccel.h> +#include <tqobjectlist.h> +#include <tqtimer.h> +#include <tqdragobject.h> +#include <tqfontinfo.h> +#include <tqaccel.h> +#include <tqmetaobject.h> +#include <tqeventloop.h> + +TQPtrList<MainWindow> *MainWindow::windows = 0; + +#if defined(TQ_WS_WIN) +extern TQ_EXPORT int qt_ntfs_permission_lookup; +#endif + +void MainWindow::init() +{ +#if defined(TQ_WS_WIN) + // Workaround for TQMimeSourceFactory failing in TQFileInfo::isReadable() for + // certain user configs. See task: 34372 + qt_ntfs_permission_lookup = 0; +#endif + setupCompleted = FALSE; + + goActions = new TQPtrList<TQAction>; + goActionDocFiles = new TQMap<TQAction*,TQString>; + goActions->setAutoDelete( TRUE ); + + if ( !windows ) + windows = new TQPtrList<MainWindow>; + windows->append( this ); + tabs = new TabbedBrowser( this, "qt_assistant_tabbedbrowser" ); + setCentralWidget( tabs ); + settingsDia = 0; + + Config *config = Config::configuration(); + + updateProfileSettings(); + + dw = new TQDockWindow( TQDockWindow::InDock, this ); + helpDock = new HelpDialog( dw, this ); + dw->setResizeEnabled( TRUE ); + dw->setCloseMode( TQDockWindow::Always ); + addDockWindow( dw, TQt::DockLeft ); + dw->setWidget( helpDock ); + dw->setCaption( "Sidebar" ); + dw->setFixedExtentWidth( 320 ); + + // read tqgeometry configuration + setupGoActions(); + + if ( !config->isMaximized() ) { + TQRect geom = config->tqgeometry(); + if( geom.isValid() ) { + resize(geom.size()); + move(geom.topLeft()); + } + } + + TQString mainWindowLayout = config->mainWindowLayout(); + + TQTextStream ts( &mainWindowLayout, IO_ReadOnly ); + ts >> *this; + + if ( config->sideBarHidden() ) + dw->hide(); + + tabs->setup(); + TQTimer::singleShot( 0, this, TQT_SLOT( setup() ) ); +#if defined(TQ_OS_MACX) + // 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. + actionGoPrevious->setAccel(TQKeySequence(TQt::CTRL|TQt::Key_Left)); + actionGoNext->setAccel(TQKeySequence(TQt::CTRL|TQt::Key_Right)); +#endif +} + +void MainWindow::setup() +{ + if( setupCompleted ) + return; + + tqApp->setOverrideCursor( TQCursor( TQt::WaitCursor ) ); + statusBar()->message( tr( "Initializing TQt Assistant..." ) ); + setupCompleted = TRUE; + helpDock->initialize(); + connect( actionGoPrevious, TQT_SIGNAL( activated() ), tabs, TQT_SLOT( backward() ) ); + connect( actionGoNext, TQT_SIGNAL( activated() ), tabs, TQT_SLOT( forward() ) ); + connect( actionEditCopy, TQT_SIGNAL( activated() ), tabs, TQT_SLOT( copy() ) ); + connect( actionFileExit, TQT_SIGNAL( activated() ), tqApp, TQT_SLOT( closeAllWindows() ) ); + connect( actionAddBookmark, TQT_SIGNAL( activated() ), + helpDock, TQT_SLOT( addBookmark() ) ); + connect( helpDock, TQT_SIGNAL( showLink( const TQString& ) ), + this, TQT_SLOT( showLink( const TQString& ) ) ); + connect( helpDock, TQT_SIGNAL( showSearchLink( const TQString&, const TQStringList& ) ), + this, TQT_SLOT( showSearchLink( const TQString&, const TQStringList&) ) ); + + connect( bookmarkMenu, TQT_SIGNAL( activated( int ) ), + this, TQT_SLOT( showBookmark( int ) ) ); + connect( actionZoomIn, TQT_SIGNAL( activated() ), tabs, TQT_SLOT( zoomIn() ) ); + connect( actionZoomOut, TQT_SIGNAL( activated() ), tabs, TQT_SLOT( zoomOut() ) ); + + connect( actionOpenPage, TQT_SIGNAL( activated() ), tabs, TQT_SLOT( newTab() ) ); + connect( actionClosePage, TQT_SIGNAL( activated() ), tabs, TQT_SLOT( closeTab() ) ); + connect( actionNextPage, TQT_SIGNAL( activated() ), tabs, TQT_SLOT( nextTab() ) ); + connect( actionPrevPage, TQT_SIGNAL( activated() ), tabs, TQT_SLOT( previousTab() ) ); + + + +#if defined(TQ_OS_WIN32) || defined(TQ_OS_WIN64) + TQAccel *acc = new TQAccel( this ); +// acc->connectItem( acc->insertItem( Key_F5 ), browser, TQT_SLOT( reload() ) ); + acc->connectItem( acc->insertItem( TQKeySequence("SHIFT+CTRL+=") ), actionZoomIn, TQT_SIGNAL(activated()) ); +#endif + + TQAccel *a = new TQAccel( this, dw ); + a->connectItem( a->insertItem( TQAccel::stringToKey( tr("Ctrl+T") ) ), + helpDock, TQT_SLOT( toggleContents() ) ); + a->connectItem( a->insertItem( TQAccel::stringToKey( tr("Ctrl+I") ) ), + helpDock, TQT_SLOT( toggleIndex() ) ); + a->connectItem( a->insertItem( TQAccel::stringToKey( tr("Ctrl+B") ) ), + helpDock, TQT_SLOT( toggleBookmarks() ) ); + a->connectItem( a->insertItem( TQAccel::stringToKey( tr("Ctrl+S") ) ), + helpDock, TQT_SLOT( toggleSearch() ) ); + + Config *config = Config::configuration(); + + setupBookmarkMenu(); + PopupMenu->insertItem( tqtr( "Vie&ws" ), createDockWindowMenu() ); + helpDock->tabWidget->setCurrentPage( config->sideBarPage() ); + + tqApp->restoreOverrideCursor(); + actionGoPrevious->setEnabled( FALSE ); + actionGoNext->setEnabled( FALSE ); +} + +void MainWindow::setupGoActions() +{ + Config *config = Config::configuration(); + TQStringList titles = config->docTitles(); + TQAction *action = 0; + + static bool separatorInserted = FALSE; + + TQAction *cur = goActions->first(); + while( cur ) { + cur->removeFrom( goMenu ); + cur->removeFrom( goActionToolbar ); + cur = goActions->next(); + } + goActions->clear(); + goActionDocFiles->clear(); + + int addCount = 0; + + TQStringList::ConstIterator it = titles.begin(); + for ( ; it != titles.end(); ++it ) { + TQString title = *it; + TQPixmap pix = config->docIcon( title ); + if( !pix.isNull() ) { + if( !separatorInserted ) { + goMenu->insertSeparator(); + separatorInserted = TRUE; + } + action = new TQAction( title, TQIconSet( pix ), title, 0, 0 ); + action->addTo( goMenu ); + action->addTo( goActionToolbar ); + goActions->append( action ); + goActionDocFiles->insert( action, config->indexPage( title ) ); + connect( action, TQT_SIGNAL( activated() ), + this, TQT_SLOT( showGoActionLink() ) ); + ++addCount; + } + } + if( !addCount ) + goActionToolbar->hide(); + else + goActionToolbar->show(); + +} + +void MainWindow::browserTabChanged() +{ + if (tabs->currentBrowser()) { + actionGoPrevious->setEnabled(tabs->currentBrowser()->isBackwardAvailable()); + actionGoNext->setEnabled(tabs->currentBrowser()->isForwardAvailable()); + } +} + +bool MainWindow::insertActionSeparator() +{ + goMenu->insertSeparator(); + Toolbar->addSeparator(); + return TRUE; +} + +bool MainWindow::close( bool alsoDelete ) +{ + saveSettings(); + return TQMainWindow::close( alsoDelete ); +} + +void MainWindow::destroy() +{ + windows->removeRef( this ); + if ( windows->isEmpty() ) { + delete windows; + windows = 0; + } + delete goActions; + delete goActionDocFiles; +} + +void MainWindow::about() +{ + TQMessageBox box( this ); + box.setText( "<center><img src=\"splash.png\">" + "<p>Version " + TQString(TQT_VERSION_STR) + "</p>" + "<p>Copyright (C) 2000-2008 Trolltech ASA. All rights reserved." + "</p></center><p></p>" + "<p>TQt Commercial Edition license holders: This program is" + " licensed to you under the terms of the TQt Commercial License" + " Agreement. For details, see the file LICENSE that came with" + " this software distribution.</p><p></p>" + "<p>TQt Open Source Edition users: This program is licensed to you" + " under the terms of the GNU General Public License Version 2." + " For details, see the file LICENSE.GPL that came with this" + " software distribution.</p><p>The program is provided AS IS" + " with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF" + " DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE." + "</p>" ); + box.setCaption( tr( "TQt Assistant" ) ); + box.setIcon( TQMessageBox::NoIcon ); + box.exec(); +} + +void MainWindow::aboutApplication() +{ + TQString url = Config::configuration()->aboutURL(); + if ( url == "about_qt" ) { + TQMessageBox::aboutTQt( this, "TQt Assistant" ); + return; + } + TQString text; + TQFile file( url ); + if( file.exists() && file.open( IO_ReadOnly ) ) + text = TQString( file.readAll() ); + if( text.isNull() ) + text = tr( "Failed to open about application contents in file: '%1'" ).arg( url ); + + TQMessageBox box( this ); + box.setText( text ); + box.setCaption( Config::configuration()->aboutApplicationMenuText() ); + box.setIcon( TQMessageBox::NoIcon ); + box.exec(); +} + +void MainWindow::tqfind() +{ + if ( !tqfindDialog ) + tqfindDialog = new FindDialog( this ); + tqfindDialog->comboFind->setFocus(); + tqfindDialog->comboFind->lineEdit()->setSelection( + 0, tqfindDialog->comboFind->lineEdit()->text().length() ); + tqfindDialog->show(); +} + +void MainWindow::tqfindAgain() +{ + if (!tqfindDialog || !tqfindDialog->hasFindExpression()) { + tqfind(); + return; + } + tqfindDialog->doFind(TRUE); +} + +void MainWindow::tqfindAgainPrev() +{ + if (!tqfindDialog || !tqfindDialog->hasFindExpression()) { + tqfind(); + return; + } + tqfindDialog->doFind(FALSE); +} + +void MainWindow::goHome() +{ + showLink( Config::configuration()->homePage() ); +} + +void MainWindow::print() +{ + TQPrinter printer( TQPrinter::HighResolution ); + printer.setFullPage( TRUE ); + if ( printer.setup( this ) ) { + TQPainter p; + if ( !p.begin( &printer ) ) + return; + + tqApp->setOverrideCursor( TQCursor( TQt::WaitCursor ) ); + tqApp->eventLoop()->processEvents( TQEventLoop::ExcludeUserInput ); + + TQPaintDeviceMetrics metrics(p.tqdevice()); + TQTextBrowser *browser = tabs->currentBrowser(); + int dpiy = metrics.logicalDpiY(); + int margin = (int) ( (2/2.54)*dpiy ); + TQRect view( margin, + margin, + metrics.width() - 2 * margin, + metrics.height() - 2 * margin ); + TQSimpleRichText richText( browser->text(), browser->TQWidget::font(), browser->context(), + browser->styleSheet(), browser->mimeSourceFactory(), + view.height(), TQt::black, FALSE ); + richText.setWidth( &p, view.width() ); + int page = 1; + do { + tqApp->eventLoop()->processEvents( TQEventLoop::ExcludeUserInput ); + + richText.draw( &p, margin, margin, view, tqpalette().active() ); + view.moveBy( 0, view.height() ); + p.translate( 0 , -view.height() ); + p.drawText( view.right() - p.fontMetrics().width( TQString::number(page) ), + view.bottom() + p.fontMetrics().ascent() + 5, TQString::number(page) ); + if ( view.top() - margin >= richText.height() ) + break; + printer.newPage(); + page++; + } while (TRUE); + + tqApp->eventLoop()->processEvents( TQEventLoop::ExcludeUserInput ); + tqApp->restoreOverrideCursor(); + } +} + +void MainWindow::updateBookmarkMenu() +{ + for ( MainWindow *mw = windows->first(); mw; mw = windows->next() ) + mw->setupBookmarkMenu(); +} + +void MainWindow::setupBookmarkMenu() +{ + bookmarkMenu->clear(); + bookmarks.clear(); + actionAddBookmark->addTo( bookmarkMenu ); + + TQFile f( TQDir::homeDirPath() + "/.assistant/bookmarks." + + Config::configuration()->profileName() ); + if ( !f.open( IO_ReadOnly ) ) + return; + TQTextStream ts( &f ); + bookmarkMenu->insertSeparator(); + while ( !ts.atEnd() ) { + TQString title = ts.readLine(); + TQString link = ts.readLine(); + bookmarks.insert( bookmarkMenu->insertItem( title ), link ); + } +} + +void MainWindow::showBookmark( int id ) +{ + if ( bookmarks.tqfind( id ) != bookmarks.end() ) + showLink( *bookmarks.tqfind( id ) ); +} + +void MainWindow::showLinkFromClient( const TQString &link ) +{ + setWindowState(windowState() & ~TQt::WindowMinimized); + raise(); + setActiveWindow(); + showLink( link ); +} + +void MainWindow::showLink( const TQString &link ) +{ + if( link.isEmpty() ) { + qWarning( "The link is empty!" ); + } + + int tqfind = link.tqfind( '#' ); + TQString name = tqfind >= 0 ? link.left( tqfind ) : link; + + TQString absLink = link; + TQFileInfo fi( name ); + if ( fi.isRelative() ) { + if ( tqfind >= 0 ) + absLink = fi.absFilePath() + link.right( link.length() - tqfind ); + else + absLink = fi.absFilePath(); + } + if( fi.exists() ) { + tabs->setSource( absLink ); + tabs->currentBrowser()->setFocus(); + } else { + // ### Default 404 site! + statusBar()->message( tr( "Failed to open link: '%1'" ).arg( link ), 5000 ); + tabs->currentBrowser()->setText( tr( "<div align=\"center\"><h1>The page could not be found!</h1><br>" + "<h3>'%1'</h3></div>").arg( link ) ); + tabs->updateTitle( tr( "Error..." ) ); + } +} + +void MainWindow::showLinks( const TQStringList &links ) +{ + if ( links.size() == 0 ) { + qWarning( "MainWindow::showLinks() - Empty link" ); + return; + } + + if ( links.size() == 1 ) { + showLink( links.first() ); + return; + } + + pendingLinks = links; + + TQStringList::ConstIterator it = pendingLinks.begin(); + // Initial showing, The tab is empty so update that without creating it first + if ( tabs->currentBrowser()->source().isEmpty() ) { + pendingBrowsers.append(tabs->currentBrowser()); + tabs->setTitle(tabs->currentBrowser(), pendingLinks.first()); + } + ++it; + + while( it != pendingLinks.end() ) { + pendingBrowsers.append( tabs->newBackgroundTab(*it) ); + ++it; + } + + startTimer(50); + return; +} + +void MainWindow::timerEvent(TQTimerEvent *e) +{ + TQString link = pendingLinks.first(); + HelpWindow *win = pendingBrowsers.first(); + pendingLinks.pop_front(); + pendingBrowsers.removeFirst(); + if (pendingLinks.size() == 0) + killTimer(e->timerId()); + win->setSource(link); +} + +void MainWindow::showQtHelp() +{ + showLink( TQString( qInstallPathDocs() ) + "/html/index.html" ); +} + +void MainWindow::showSettingsDialog() +{ + showSettingsDialog( -1 ); +} + +void MainWindow::showWebBrowserSettings() +{ + showSettingsDialog( 1 ); +} + +void MainWindow::showSettingsDialog( int page ) +{ + if ( !settingsDia ){ + settingsDia = new SettingsDialog( this ); + } + TQFontDatabase fonts; + settingsDia->fontCombo->clear(); + settingsDia->fontCombo->insertStringList( TQT_TQSTRINGLIST_OBJECT(fonts.families()) ); + settingsDia->fontCombo->lineEdit()->setText( tabs->browserFont().family() ); + settingsDia->fixedfontCombo->clear(); + settingsDia->fixedfontCombo->insertStringList( TQT_TQSTRINGLIST_OBJECT(fonts.families()) ); + settingsDia->fixedfontCombo->lineEdit()->setText( tabs->styleSheet()->item( "pre" )->fontFamily() ); + settingsDia->linkUnderlineCB->setChecked( tabs->linkUnderline() ); + settingsDia->colorButton->setPaletteBackgroundColor( tabs->palette().color( TQPalette::Active, TQColorGroup::Link ) ); + if ( page != -1 ) + settingsDia->settingsTab->setCurrentPage( page ); + + int ret = settingsDia->exec(); + + if ( ret != TQDialog::Accepted ) + return; + + TQObject *obj; + for ( obj = Toolbar->childrenListObject().last(); obj; obj = Toolbar->childrenListObject().prev() ) { + if ( obj->isA( "TQToolBarSeparator" ) ) { + delete obj; + obj = 0; + break; + } + } + + setupGoActions(); + + TQFont fnt( tabs->browserFont() ); + fnt.setFamily( settingsDia->fontCombo->currentText() ); + tabs->setBrowserFont( fnt ); + tabs->setLinkUnderline( settingsDia->linkUnderlineCB->isChecked() ); + + TQPalette pal = tabs->palette(); + TQColor lc = settingsDia->colorButton->paletteBackgroundColor(); + pal.setColor( TQPalette::Active, TQColorGroup::Link, lc ); + pal.setColor( TQPalette::Inactive, TQColorGroup::Link, lc ); + pal.setColor( TQPalette::Disabled, TQColorGroup::Link, lc ); + tabs->setPalette( pal ); + + TQString family = settingsDia->fixedfontCombo->currentText(); + + TQStyleSheet *sh = tabs->styleSheet(); + sh->item( "pre" )->setFontFamily( family ); + sh->item( "code" )->setFontFamily( family ); + sh->item( "tt" )->setFontFamily( family ); + tabs->currentBrowser()->setText( tabs->currentBrowser()->text() ); + showLink( tabs->currentBrowser()->source() ); +} + +void MainWindow::hide() +{ + saveToolbarSettings(); + TQMainWindow::hide(); +} + +MainWindow* MainWindow::newWindow() +{ + saveSettings(); + saveToolbarSettings(); + MainWindow *mw = new MainWindow; + mw->move( tqgeometry().topLeft() ); + if ( isMaximized() ) + mw->showMaximized(); + else + mw->show(); + mw->goHome(); + return mw; +} + +void MainWindow::saveSettings() +{ + Config *config = Config::configuration(); + config->setFontFamily( tabs->browserFont().family() ); + config->setFontSize( tabs->currentBrowser()->font().pointSize() ); + config->setFontFixedFamily( tabs->styleSheet()->item( "pre" )->fontFamily() ); + config->setLinkUnderline( tabs->linkUnderline() ); + config->setLinkColor( tabs->palette().color( TQPalette::Active, TQColorGroup::Link ).name() ); + config->setSideBarPage( helpDock->tabWidget->currentPageIndex() ); + config->setGeometry( TQRect( x(), y(), width(), height() ) ); + config->setMaximized( isMaximized() ); + + // Create list of the tab urls + TQStringList lst; + TQPtrList<HelpWindow> browsers = tabs->browsers(); + HelpWindow *browser = browsers.first(); + while (browser) { + lst << browser->source(); + browser = browsers.next(); + } + config->setSource(lst); + config->save(); +} + +void MainWindow::saveToolbarSettings() +{ + TQString mainWindowLayout; + TQTextStream ts( &mainWindowLayout, IO_WriteOnly ); + ts << *this; + Config::configuration()->setMainWindowLayout( mainWindowLayout ); +} + +TabbedBrowser* MainWindow::browsers() +{ + return tabs; +} + +void MainWindow::showSearchLink( const TQString &link, const TQStringList &terms ) +{ + HelpWindow * hw = tabs->currentBrowser(); + hw->blockScrolling( TRUE ); + hw->setCursor( tqwaitCursor ); + if ( hw->source() == link ) + hw->reload(); + else + showLink( link ); + hw->sync(); + hw->setCursor( tqarrowCursor ); + + hw->viewport()->setUpdatesEnabled( FALSE ); + int minPar = INT_MAX; + int minIndex = INT_MAX; + TQStringList::ConstIterator it = terms.begin(); + for ( ; it != terms.end(); ++it ) { + int para = 0; + int index = 0; + bool found = hw->tqfind( *it, FALSE, TRUE, TRUE, ¶, &index ); + while ( found ) { + if ( para < minPar ) { + minPar = para; + minIndex = index; + } + hw->setColor( Qt::red ); + found = hw->tqfind( *it, FALSE, TRUE, TRUE ); + } + } + hw->blockScrolling( FALSE ); + hw->viewport()->setUpdatesEnabled( TRUE ); + hw->setCursorPosition( minPar, minIndex ); + hw->updateContents(); +} + + +void MainWindow::showGoActionLink() +{ + const TQObject *origin = TQT_TQOBJECT(sender()); + if( !origin || + origin->tqmetaObject()->className() != TQString( "TQAction" ) ) + return; + + TQAction *action = (TQAction*) origin; + TQString docfile = *( goActionDocFiles->tqfind( action ) ); + showLink( docfile ); +} + +void MainWindow::showAssistantHelp() +{ + showLink( Config::configuration()->assistantDocPath() + "/assistant.html" ); +} + +HelpDialog* MainWindow::helpDialog() +{ + return helpDock; +} + +void MainWindow::backwardAvailable( bool enable ) +{ + actionGoPrevious->setEnabled( enable ); +} + +void MainWindow::forwardAvailable( bool enable ) +{ + actionGoNext->setEnabled( enable ); +} + +void MainWindow::updateProfileSettings() +{ + Config *config = Config::configuration(); +#ifndef TQ_WS_MACX + setIcon( config->applicationIcon() ); +#endif + helpMenu->clear(); + actionHelpAssistant->addTo( helpMenu ); + helpMenu->insertSeparator(); + helpAbout_Qt_AssistantAction->addTo( helpMenu ); + if ( !config->aboutApplicationMenuText().isEmpty() ) + actionAboutApplication->addTo( helpMenu ); + helpMenu->insertSeparator(); + actionHelpWhatsThis->addTo( helpMenu ); + + actionAboutApplication->setMenuText( config->aboutApplicationMenuText() ); + + if( !config->title().isNull() ) + setCaption( config->title() ); +} diff --git a/tqtinterface/qt4/tools/assistant/profile.cpp b/tqtinterface/qt4/tools/assistant/profile.cpp new file mode 100644 index 0000000..6215d39 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/profile.cpp @@ -0,0 +1,124 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ +#include "profile.h" +#include <tqxml.h> +#include <tqtextcodec.h> +#include <tqfileinfo.h> +#include <tqregexp.h> +#include <tqdir.h> + +#define TQT_TITLE "TQt Reference Documentation" +#define DESIGNER_TITLE "TQt Designer Manual" +#define ASSISTANT_TITLE "TQt Assistant Manual" +#define LINGUIST_TITLE "Guide to the TQt Translation Tools" +#define TQMAKE_TITLE "qmake User Guide" + +Profile *Profile::createDefaultProfile( const TQString &docPath ) +{ + TQString path = qInstallPathDocs(); + if ( !docPath.isEmpty() ) + path = docPath; + path = path + "/html/"; + Profile *profile = new Profile; + profile->valid = TRUE; + profile->type = DefaultProfile; + profile->props["name"] = "default"; + profile->props["applicationicon"] = "appicon.png"; + profile->props["aboutmenutext"] = "About TQt"; + profile->props["abouturl"] = "about_qt"; + profile->props["title"] = "TQt Assistant"; + profile->props["basepath"] = path; + profile->props["startpage"] = path + "index.html"; + + profile->addDCFTitle( path + "qt.dcf", TQT_TITLE ); + profile->addDCFTitle( path + "designer.dcf", DESIGNER_TITLE ); + profile->addDCFTitle( path + "assistant.dcf", ASSISTANT_TITLE ); + profile->addDCFTitle( path + "linguist.dcf", LINGUIST_TITLE ); + profile->addDCFTitle( path + "qmake.dcf", TQMAKE_TITLE ); + + profile->addDCFIcon( TQT_TITLE, "qt.png" ); + profile->addDCFIcon( DESIGNER_TITLE, "designer.png" ); + profile->addDCFIcon( ASSISTANT_TITLE, "assistant.png" ); + profile->addDCFIcon( LINGUIST_TITLE, "linguist.png" ); + + profile->addDCFIndexPage( TQT_TITLE, path + "index.html" ); + profile->addDCFIndexPage( DESIGNER_TITLE, path + "designer-manual.html" ); + profile->addDCFIndexPage( ASSISTANT_TITLE, path + "assistant.html" ); + profile->addDCFIndexPage( LINGUIST_TITLE, path + "linguist-manual.html" ); + profile->addDCFIndexPage( TQMAKE_TITLE, path + "qmake-manual.html" ); + + profile->addDCFImageDir( TQT_TITLE, "../../gif/" ); + profile->addDCFImageDir( DESIGNER_TITLE, "../../gif/" ); + profile->addDCFImageDir( ASSISTANT_TITLE, "../../gif/" ); + profile->addDCFImageDir( LINGUIST_TITLE, "../../gif/" ); + profile->addDCFImageDir( TQMAKE_TITLE, "../../gif/" ); + + return profile; +} + + +Profile::Profile() + : valid( TRUE ), dparser( 0 ) +{ +} + + +void Profile::removeDocFileEntry( const TQString &docfile ) +{ + docs.remove( docfile ); + + TQStringList titles; + + for( TQMap<TQString,TQString>::Iterator it = dcfTitles.begin(); + it != dcfTitles.end(); ++it ) { + if( (*it) == docfile ) { + indexPages.remove( *it ); + icons.remove( *it ); + imageDirs.remove( *it ); + titles << it.key(); + } + } + + for( TQStringList::ConstIterator title = titles.begin(); + title != titles.end(); ++title ) { + + dcfTitles.remove( *title ); + } + +#ifdef ASSISTANT_DEBUG + qDebug( "docs:\n - " + docs.join( "\n - " ) ); + qDebug( "titles:\n - " + titles.join( "\n - " ) ); + qDebug( "keys:\n - " + ( (TQStringList*) &(dcfTitles.keys()) )->join( "\n - " ) ); + qDebug( "values:\n - " + ( (TQStringList*) &(dcfTitles.values()) )->join( "\n - " ) ); +#endif +} diff --git a/tqtinterface/qt4/tools/assistant/profile.h b/tqtinterface/qt4/tools/assistant/profile.h new file mode 100644 index 0000000..f8482c7 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/profile.h @@ -0,0 +1,130 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef PROFILE_H +#define PROFILE_H + +#include <tqfileinfo.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqmap.h> + +class DocuParser; + +class Profile +{ +public: + enum ProfileType { DefaultProfile, UserProfile }; + Profile(); + + inline bool isValid() const; + + inline void addDCF( const TQString &docfile ); + inline void addDCFIcon( const TQString title, const TQString &icon ); + inline void addDCFIndexPage( const TQString title, const TQString &indexPage ); + inline void addDCFImageDir( const TQString title, const TQString &imgDir ); + inline void addDCFTitle( const TQString &dcf, const TQString &title ); + inline void addProperty( const TQString &name, const TQString &value ); + inline bool hasDocFile( const TQString &docFile ); + void removeDocFileEntry( const TQString &title ); + + inline ProfileType profileType() const { return type; } + inline void setProfileType( ProfileType t ) { type = t; } + + inline DocuParser *docuParser() const { return dparser; } + inline void setDocuParser( DocuParser *dp ) { dparser = dp; } + + static Profile* createDefaultProfile( const TQString &docPath = TQString() ); + static TQString makeRelativePath( const TQString &base, const TQString &path ); + + int valid:1; + ProfileType type; + DocuParser *dparser; + TQMap<TQString,TQString> props; + TQMap<TQString,TQString> icons; + TQMap<TQString,TQString> indexPages; + TQMap<TQString,TQString> imageDirs; + TQMap<TQString,TQString> dcfTitles; + TQStringList docs; +}; + + +inline bool Profile::isValid() const +{ + return valid; +} + +inline void Profile::addDCFTitle(const TQString &dcf, const TQString &title) +{ + TQString absdcf = TQFileInfo(dcf).absFilePath(); + dcfTitles[title] = absdcf; + if (docs.tqcontains(absdcf) == 0) + docs << absdcf; +} + +inline void Profile::addDCF( const TQString &docfile ) +{ + if( !docs.tqcontains( docfile ) == 0 ) + docs << docfile; +} + +inline void Profile::addDCFIcon( const TQString docfile, + const TQString &icon ) +{ + icons[docfile] = icon; +} + +inline void Profile::addDCFIndexPage( const TQString title, + const TQString &indexPage ) +{ + indexPages[title] = indexPage; +} + +inline void Profile::addDCFImageDir( const TQString docfile, + const TQString &imgDir ) +{ + imageDirs[docfile] = imgDir; +} + +inline void Profile::addProperty( const TQString &name, + const TQString &value ) +{ + props[name] = value; +} + +inline bool Profile::hasDocFile( const TQString &name ) +{ + return docs.tqcontains( name ) > 0; +} + +#endif diff --git a/tqtinterface/qt4/tools/assistant/settingsdialog.ui b/tqtinterface/qt4/tools/assistant/settingsdialog.ui new file mode 100644 index 0000000..f2ae9b2 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/settingsdialog.ui @@ -0,0 +1,516 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>SettingsDialogBase</class> +<comment>********************************************************************* +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +*********************************************************************</comment> +<widget class="TQDialog"> + <property name="name"> + <cstring>SettingsDialogBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>389</width> + <height>253</height> + </rect> + </property> + <property name="caption"> + <string>Qt Assistant - Settings</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQTabWidget"> + <property name="name"> + <cstring>settingsTab</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&General</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout2</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQComboBox" row="1" column="1"> + <property name="name"> + <cstring>fixedfontCombo</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Fix&ed font:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>fixedfontCombo</cstring> + </property> + </widget> + <widget class="TQLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>Link color:</string> + </property> + </widget> + <widget class="TQComboBox" row="0" column="1"> + <property name="name"> + <cstring>fontCombo</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>fontLabel</cstring> + </property> + <property name="text"> + <string>&Font:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>fontCombo</cstring> + </property> + </widget> + <widget class="TQCheckBox" row="3" column="0"> + <property name="name"> + <cstring>linkUnderlineCB</cstring> + </property> + <property name="text"> + <string>&Underline links</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQToolButton" row="2" column="1"> + <property name="name"> + <cstring>colorButton</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="tqminimumSize"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + <property name="paletteBackgroundColor"> + <color> + <red>255</red> + <green>0</green> + <blue>0</blue> + </color> + </property> + <property name="focusPolicy"> + <enum>TabFocus</enum> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </grid> + </widget> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Web</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="4" column="0"> + <property name="name"> + <cstring>Spacer11</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="tqsizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1_3</cstring> + </property> + <property name="text"> + <string>Web &Browser Application:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>browserApp</cstring> + </property> + </widget> + <widget class="TQLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>Layout9</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>browserApp</cstring> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>buttonBrowse</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="tqmaximumSize"> + <size> + <width>30</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel1_3_3</cstring> + </property> + <property name="text"> + <string>&Home page</string> + </property> + <property name="buddy" stdset="0"> + <cstring>homePage</cstring> + </property> + </widget> + <widget class="TQLayoutWidget" row="3" column="0"> + <property name="name"> + <cstring>tqlayout8</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>homePage</cstring> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>buttonHome</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="tqmaximumSize"> + <size> + <width>30</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </hbox> + </widget> + </grid> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>pdfTab</cstring> + </property> + <attribute name="title"> + <string>&PDF</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1_3_2</cstring> + </property> + <property name="text"> + <string>PDF &Application</string> + </property> + <property name="buddy" stdset="0"> + <cstring>pdfApp</cstring> + </property> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer10</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="tqsizeHint"> + <size> + <width>20</width> + <height>81</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>tqlayout9</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>pdfApp</cstring> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>buttonPDF</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="tqmaximumSize"> + <size> + <width>30</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </hbox> + </widget> + </grid> + </widget> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="tqsizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>SettingsDialogBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>SettingsDialogBase</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>colorButton</sender> + <signal>clicked()</signal> + <receiver>SettingsDialogBase</receiver> + <slot>selectColor()</slot> + </connection> + <connection> + <sender>buttonBrowse</sender> + <signal>clicked()</signal> + <receiver>SettingsDialogBase</receiver> + <slot>browseWebApp()</slot> + </connection> + <connection> + <sender>buttonHome</sender> + <signal>clicked()</signal> + <receiver>SettingsDialogBase</receiver> + <slot>browseHomepage()</slot> + </connection> + <connection> + <sender>buttonPDF</sender> + <signal>clicked()</signal> + <receiver>SettingsDialogBase</receiver> + <slot>browsePDFApplication()</slot> + </connection> +</connections> +<tabstops> + <tabstop>settingsTab</tabstop> + <tabstop>fontCombo</tabstop> + <tabstop>fixedfontCombo</tabstop> + <tabstop>colorButton</tabstop> + <tabstop>linkUnderlineCB</tabstop> + <tabstop>browserApp</tabstop> + <tabstop>buttonBrowse</tabstop> + <tabstop>homePage</tabstop> + <tabstop>buttonHome</tabstop> + <tabstop>pdfApp</tabstop> + <tabstop>buttonPDF</tabstop> + <tabstop>buttonOk</tabstop> + <tabstop>buttonCancel</tabstop> +</tabstops> +<Q_SLOTS> + <slot>selectColor()</slot> + <slot>browseWebApp()</slot> + <slot>browsePDFApplication()</slot> + <slot>browseHomepage()</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/assistant/settingsdialogimpl.cpp b/tqtinterface/qt4/tools/assistant/settingsdialogimpl.cpp new file mode 100644 index 0000000..39abaa7 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/settingsdialogimpl.cpp @@ -0,0 +1,122 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "settingsdialogimpl.h" +#include "docuparser.h" +#include "config.h" + +#include <tqapplication.h> +#include <tqpushbutton.h> +#include <tqcheckbox.h> +#include <tqcolordialog.h> +#include <tqdir.h> +#include <tqfiledialog.h> +#include <tqfileinfo.h> +#include <tqlineedit.h> +#include <tqlistbox.h> +#include <tqlistview.h> +#include <tqmessagebox.h> +#include <tqptrstack.h> +#include <tqsettings.h> +#include <tqtimer.h> +#include <tqtoolbutton.h> +#include <tqtabwidget.h> +#include <tqmap.h> + + +SettingsDialog::SettingsDialog( TQWidget *tqparent, const char* name ) + : SettingsDialogBase( tqparent, name ) +{ + init(); +} + +void SettingsDialog::init() +{ + Config *config = Config::configuration(); + + browserApp->setText( config->webBrowser() ); + homePage->setText( config->homePage() ); + pdfApp->setText( config->pdfReader() ); +} + +void SettingsDialog::selectColor() +{ + TQColor c = TQColorDialog::getColor( colorButton->paletteBackgroundColor(), this ); + colorButton->setPaletteBackgroundColor( c ); +} + +void SettingsDialog::browseWebApp() +{ + setFile( browserApp, tr( "TQt Assistant - Set Web Browser" ) ); +} + +void SettingsDialog::browsePDFApplication() +{ + setFile( pdfApp, tr( "TQt Assistant - Set PDF Browser" ) ); +} + +void SettingsDialog::browseHomepage() +{ + setFile( homePage, tr( "TQt Assistant - Set Homepage" ) ); +} + +void SettingsDialog::setFile( TQLineEdit *le, const TQString &caption ) +{ + TQFileDialog *fd = new TQFileDialog( this ); + fd->setCaption( caption ); + fd->setMode( TQFileDialog::AnyFile ); + fd->setDir( TQDir::homeDirPath() ); + + if ( fd->exec() == TQDialog::Accepted ) { + if ( !fd->selectedFile().isEmpty() ) + le->setText( fd->selectedFile() ); + } +} + +void SettingsDialog::accept() +{ + Config *config = Config::configuration(); + + config->setWebBrowser( browserApp->text() ); + config->setHomePage( homePage->text() ); + config->setPdfReader( pdfApp->text() ); + + hide(); + done( Accepted ); +} + +void SettingsDialog::reject() +{ + init(); + done( Rejected ); +} diff --git a/tqtinterface/qt4/tools/assistant/settingsdialogimpl.h b/tqtinterface/qt4/tools/assistant/settingsdialogimpl.h new file mode 100644 index 0000000..3865630 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/settingsdialogimpl.h @@ -0,0 +1,64 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef SETTINGSDIALOGIMPL_H +#define SETTINGSDIALOGIMPL_H + +#include "settingsdialog.h" + +#include <tqstringlist.h> +#include <tqptrlist.h> +#include <tqlistview.h> + +class SettingsDialog : public SettingsDialogBase +{ + Q_OBJECT + TQ_OBJECT + +public: + SettingsDialog( TQWidget *tqparent, const char* name = 0 ); + +protected Q_SLOTS: + void selectColor(); + void browseWebApp(); + void browsePDFApplication(); + void browseHomepage(); + void accept(); + void reject(); + +private: + void init(); + void setFile( TQLineEdit *le, const TQString &caption ); +}; + +#endif diff --git a/tqtinterface/qt4/tools/assistant/tabbedbrowser.ui b/tqtinterface/qt4/tools/assistant/tabbedbrowser.ui new file mode 100644 index 0000000..79fec26 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/tabbedbrowser.ui @@ -0,0 +1,141 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>TabbedBrowser</class> +<comment>********************************************************************* +** Copyright (C) 2003-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +*********************************************************************</comment> +<widget class="TQWidget"> + <property name="name"> + <cstring>TabbedBrowser</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>710</width> + <height>681</height> + </rect> + </property> + <property name="caption"> + <string>TabbedBrowser</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>0</number> + </property> + <widget class="TQTabWidget" row="0" column="0"> + <property name="name"> + <cstring>tab</cstring> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>frontpage</cstring> + </property> + <attribute name="title"> + <string>Untitled</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + </grid> + </widget> + </widget> + </grid> +</widget> +<includes> + <include location="global" impldecl="in declaration">tqsettings.h</include> + <include location="local" impldecl="in implementation">helpwindow.h</include> + <include location="local" impldecl="in implementation">mainwindow.h</include> + <include location="global" impldecl="in implementation">tqstylesheet.h</include> + <include location="global" impldecl="in implementation">tqmime.h</include> + <include location="local" impldecl="in implementation">tabbedbrowser.ui.h</include> +</includes> +<forwards> + <forward>class HelpWindow;</forward> + <forward>class MainWindow;</forward> + <forward>class TQStyleSheet;</forward> + <forward>class TQMimeSourceFactory;</forward> +</forwards> +<variables> + <variable access="private">TQStyleSheet *tabStyleSheet;</variable> + <variable access="private">bool tabLinkUnderline;</variable> + <variable access="private">TQMimeSourceFactory *mimeSourceFactory;</variable> + <variable access="private">TQWidget *lastCurrentTab;</variable> + <variable access="private">TQFont tabFont;</variable> +</variables> +<Q_SLOTS> + <slot>forward()</slot> + <slot>backward()</slot> + <slot>setSource( const TQString & ref )</slot> + <slot>reload()</slot> + <slot>home()</slot> + <slot>nextTab()</slot> + <slot>previousTab()</slot> + <slot>newTab( const TQString & lnk )</slot> + <slot>zoomIn()</slot> + <slot>zoomOut()</slot> + <slot>updateTitle( const TQString & title )</slot> + <slot>newTab()</slot> + <slot>transferFocus()</slot> + <slot>initHelpWindow( HelpWindow * win )</slot> + <slot>setup()</slot> + <slot>setLinkUnderline( bool uline )</slot> + <slot>setPalette( const TQPalette & pal )</slot> + <slot>copy()</slot> + <slot>closeTab()</slot> + <slot>sourceChanged()</slot> +</Q_SLOTS> +<functions> + <function returnType="HelpWindow *">currentBrowser()</function> + <function access="private">init()</function> + <function returnType="MainWindow *">mainWindow()</function> + <function specifier="non virtual" returnType="TQStyleSheet *">styleSheet()</function> + <function specifier="non virtual" returnType="bool">linkUnderline()</function> + <function specifier="non virtual" returnType="TQStringList">sources()</function> + <function specifier="non virtual">setMimePath( TQStringList lst )</function> + <function specifier="non virtual">setMimeExtension( const TQString & ext )</function> + <function specifier="non virtual">setBrowserFont( const TQFont & fnt )</function> + <function specifier="non virtual" returnType="TQFont">browserFont()</function> + <function specifier="non virtual" returnType="TQPtrList<HelpWindow>">browsers() const</function> + <function returnType="HelpWindow*">newBackgroundTab( const TQString & url )</function> + <function returnType="HelpWindow*" access="private">createHelpWindow(const TQString &)</function> + <function>setTitle(HelpWindow*, const TQString &)</function> +</functions> +<pixmapinproject/> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/assistant/tabbedbrowser.ui.h b/tqtinterface/qt4/tools/assistant/tabbedbrowser.ui.h new file mode 100644 index 0000000..b059b54 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/tabbedbrowser.ui.h @@ -0,0 +1,347 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename functions or Q_SLOTS use +** TQt Designer which will update this file, preserving your code. Create an +** init() function in place of a constructor, and a destroy() function in +** place of a destructor. +*****************************************************************************/ + +#include <tqfileinfo.h> +#include <tqtoolbutton.h> +#include <tqpixmap.h> +#include <tqiconset.h> +#include <tqstyle.h> +#include <tqtimer.h> + +#include "config.h" + +static TQString reduceLabelLength( const TQString &s ) +{ + uint maxLength = 16; + TQString str = s; + if ( str.length() < maxLength ) + return str; + str = str.left( maxLength - 3 ); + str += "..."; + return str; +} + +void TabbedBrowser::forward() +{ + currentBrowser()->forward(); +} + +void TabbedBrowser::backward() +{ + currentBrowser()->backward(); +} + +void TabbedBrowser::setSource( const TQString &ref ) +{ + HelpWindow * win = currentBrowser(); + win->setSource(ref); +} + +void TabbedBrowser::reload() +{ + currentBrowser()->reload(); +} + +void TabbedBrowser::home() +{ + currentBrowser()->home(); +} + +HelpWindow * TabbedBrowser::currentBrowser() +{ + return (HelpWindow*) tab->currentPage(); +} + +void TabbedBrowser::nextTab() +{ + if( tab->currentPageIndex()<=tab->count()-1 ) + tab->setCurrentPage( tab->currentPageIndex()+1 ); +} + +void TabbedBrowser::previousTab() +{ + int idx = tab->currentPageIndex()-1; + if( idx>=0 ) + tab->setCurrentPage( idx ); +} + +HelpWindow *TabbedBrowser::createHelpWindow(const TQString &title) +{ + MainWindow *mainWin = mainWindow(); + HelpWindow *win = new HelpWindow( mainWin, this, "qt_assistant_helpwin" ); + win->setFont( browserFont() ); + win->setPalette( palette() ); + win->setLinkUnderline( tabLinkUnderline ); + win->setStyleSheet( tabStyleSheet ); + win->setMimeSourceFactory( mimeSourceFactory ); + tab->addTab(win, reduceLabelLength(title)); + connect( win, TQT_SIGNAL( highlighted( const TQString & ) ), + (const TQObject*) (mainWin->statusBar()), TQT_SLOT( message( const TQString & ) ) ); + connect( win, TQT_SIGNAL( chooseWebBrowser() ), mainWin, TQT_SLOT( showWebBrowserSettings() ) ); + connect( win, TQT_SIGNAL( backwardAvailable(bool) ), + mainWin, TQT_SLOT( backwardAvailable(bool) ) ); + connect( win, TQT_SIGNAL( forwardAvailable(bool) ), + mainWin, TQT_SLOT( forwardAvailable(bool) ) ); + connect( win, TQT_SIGNAL( sourceChanged(const TQString &) ), this, TQT_SLOT( sourceChanged() )); + + tab->cornerWidget( TQt::TopRight )->setEnabled( tab->count() > 1 ); + return win; +} + +HelpWindow *TabbedBrowser::newBackgroundTab( const TQString &url ) +{ + HelpWindow *win = createHelpWindow(url); + return win; +} + +void TabbedBrowser::newTab( const TQString &lnk ) +{ + TQString link( lnk ); + if( link.isNull() ) { + HelpWindow *w = currentBrowser(); + if( w ) + link = w->source(); + } + HelpWindow *win = createHelpWindow(link); + tab->showPage( win ); + if( !link.isNull() ) { + win->setSource( link ); + } +} + +void TabbedBrowser::zoomIn() +{ + currentBrowser()->zoomIn(); +} + +void TabbedBrowser::zoomOut() +{ + currentBrowser()->zoomOut(); +} + +void TabbedBrowser::init() +{ + tabLinkUnderline = FALSE; + tabStyleSheet = new TQStyleSheet( TQStyleSheet::defaultSheet() ); + lastCurrentTab = 0; + while( tab->count() ) + tab->removePage( tab->page(0) ); + + mimeSourceFactory = new TQMimeSourceFactory(); + mimeSourceFactory->setExtensionType("html","text/html;charset=UTF-8"); + mimeSourceFactory->setExtensionType("htm","text/html;charset=UTF-8"); + mimeSourceFactory->setExtensionType("png", "image/png" ); + mimeSourceFactory->setExtensionType("jpg", "image/jpeg" ); + mimeSourceFactory->setExtensionType("jpeg", "image/jpeg" ); + setMimePath( Config::configuration()->mimePaths() ); + + connect( tab, TQT_SIGNAL( currentChanged( TQWidget* ) ), + this, TQT_SLOT( transferFocus() ) ); + connect( tab, TQT_SIGNAL( currentChanged( TQWidget* ) ), + mainWindow(), TQT_SLOT( browserTabChanged() ) ); + + TQTabBar *tabBar = (TQTabBar*)tab->child( 0, "TQTabBar", FALSE ); + int m = ( tabBar ? tqstyle().tqpixelMetric( TQStyle::PM_TabBarTabVSpace, (TQWidget*)tabBar ) + + tqstyle().tqpixelMetric( TQStyle::PM_TabBarBaseHeight, (TQWidget*)tabBar ) : 0 ); + int s = tab->height() - m; + + // workaround for sgi style + TQPalette pal = palette(); + pal.setColor(TQPalette::Active, TQColorGroup::Button, pal.active().background()); + pal.setColor(TQPalette::Disabled, TQColorGroup::Button, pal.disabled().background()); + pal.setColor(TQPalette::Inactive, TQColorGroup::Button, pal.inactive().background()); + + TQToolButton *newTabButton = new TQToolButton( this ); + newTabButton->setPalette(pal); + tab->setCornerWidget( newTabButton, TQt::TopLeft ); + newTabButton->setCursor( tqarrowCursor ); + newTabButton->setAutoRaise( TRUE ); + newTabButton->setPixmap( TQPixmap::fromMimeSource( "addtab.png" ) ); + newTabButton->setFixedSize( s, s ); + TQObject::connect( newTabButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( newTab() ) ); + TQToolTip::add( newTabButton, tr( "Add page" ) ); + + TQToolButton *closeTabButton = new TQToolButton( this ); + closeTabButton->setPalette(pal); + tab->setCornerWidget( closeTabButton, TQt::TopRight ); + closeTabButton->setCursor( tqarrowCursor ); + closeTabButton->setAutoRaise( TRUE ); + TQIconSet is( TQPixmap::fromMimeSource( "closetab.png") ); + TQPixmap disabledPix = TQPixmap::fromMimeSource( "d_closetab.png" ); + is.setPixmap( disabledPix, TQIconSet::Small, TQIconSet::Disabled ); + closeTabButton->setIconSet( is ); + closeTabButton->setFixedSize( s, s ); + TQObject::connect( closeTabButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( closeTab() ) ); + TQToolTip::add( closeTabButton, tr( "Close page" ) ); + closeTabButton->setEnabled( FALSE ); +} + +void TabbedBrowser::setMimePath( TQStringList lst ) +{ + mimeSourceFactory->setFilePath( lst ); +} + +void TabbedBrowser::setMimeExtension( const TQString &ext ) +{ + mimeSourceFactory->setExtensionType( "html", ext ); + mimeSourceFactory->setExtensionType( "htm", ext ); +} + +void TabbedBrowser::updateTitle( const TQString &title ) +{ + tab->changeTab( currentBrowser(), title ); +} + +MainWindow* TabbedBrowser::mainWindow() +{ + return (MainWindow*) tqparent(); +} + +void TabbedBrowser::newTab() +{ + newTab( TQString() ); +} + +void TabbedBrowser::transferFocus() +{ + if( currentBrowser() ) { + currentBrowser()->setFocus(); + } + mainWindow()->setCaption(Config::configuration()->title() + + " - " + currentBrowser()->documentTitle()); +} + +void TabbedBrowser::initHelpWindow( HelpWindow * /*win*/ ) +{ +} + +void TabbedBrowser::setup() +{ + Config *config = Config::configuration(); + + TQFont fnt( font() ); + TQFontInfo fntInfo( fnt ); + fnt.setFamily( config->fontFamily() ); + fnt.setPointSize( config->fontSize() ); + setBrowserFont( fnt ); + + TQPalette pal = palette(); + TQColor lc( config->linkColor() ); + pal.setColor( TQPalette::Active, TQColorGroup::Link, lc ); + pal.setColor( TQPalette::Inactive, TQColorGroup::Link, lc ); + pal.setColor( TQPalette::Disabled, TQColorGroup::Link, lc ); + setPalette( pal ); + + tabLinkUnderline = config->isLinkUnderline(); + + TQString family = config->fontFixedFamily(); + tabStyleSheet->item( "pre" )->setFontFamily( family ); + tabStyleSheet->item( "code" )->setFontFamily( family ); + tabStyleSheet->item( "tt" )->setFontFamily( family ); + + newTab( TQString() ); +} + +void TabbedBrowser::setLinkUnderline( bool uline ) +{ + if( uline==tabLinkUnderline ) + return; + tabLinkUnderline = uline; + int cnt = tab->count(); + for( int i=0; i<cnt; i++ ) + ( (TQTextBrowser*) tab->page( i ) )->setLinkUnderline( tabLinkUnderline ); +} + +TQFont TabbedBrowser::browserFont() +{ + return tabFont; +} + +void TabbedBrowser::setBrowserFont( const TQFont &fnt ) +{ + if( tabFont == fnt ) + return; + tabFont = fnt; + int cnt = tab->count(); + for( int i=0; i<cnt; i++ ) + ( (TQTextBrowser*) tab->page( i ) )->setFont( fnt ); +} + +void TabbedBrowser::setPalette( const TQPalette &pal ) +{ + if( palette()==pal ) + return; + TQWidget::setPalette( pal ); + int cnt = tab->count(); + for( int i=0; i<cnt; i++ ) + ( (TQTextBrowser*) tab->page( i ) )->setPalette( pal ); +} + +TQStyleSheet* TabbedBrowser::styleSheet() +{ + return tabStyleSheet; +} + +bool TabbedBrowser::linkUnderline() +{ + return tabLinkUnderline; +} + +void TabbedBrowser::copy() +{ + currentBrowser()->copy(); +} + +void TabbedBrowser::closeTab() +{ + if( tab->count()==1 ) + return; + HelpWindow *win = currentBrowser(); + tab->removePage( win ); + TQTimer::singleShot(0, win, TQT_SLOT(deleteLater())); + tab->cornerWidget( TQt::TopRight )->setEnabled( tab->count() > 1 ); +} + +TQStringList TabbedBrowser::sources() +{ + TQStringList lst; + int cnt = tab->count(); + for( int i=0; i<cnt; i++ ) { + lst.append( ( (TQTextBrowser*) tab->page(i) )->source() ); + } + return lst; +} + +TQPtrList<HelpWindow> TabbedBrowser::browsers() const +{ + TQPtrList<HelpWindow> list; + for (int i=0; i<tab->count(); ++i) { + TQ_ASSERT(::tqqt_cast<HelpWindow*>(tab->page(i))); + list.append(::tqqt_cast<HelpWindow*>(tab->page(i))); + } + return list; +} + +void TabbedBrowser::sourceChanged() +{ + HelpWindow *win = ::tqqt_cast<HelpWindow *>( sender() ); + TQ_ASSERT( win ); + TQString docTitle(win->documentTitle()); + if (docTitle.isEmpty()) + docTitle = "..."; + setTitle(win, docTitle); +} + +void TabbedBrowser::setTitle(HelpWindow *win, const TQString &title) +{ + tab->setTabLabel(win, reduceLabelLength(title)); + if (win == currentBrowser()) + mainWindow()->setCaption(Config::configuration()->title() + " - " + title); +} + diff --git a/tqtinterface/qt4/tools/assistant/topicchooser.ui b/tqtinterface/qt4/tools/assistant/topicchooser.ui new file mode 100644 index 0000000..364e23f --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/topicchooser.ui @@ -0,0 +1,182 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>TopicChooserBase</class> +<comment>********************************************************************* +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +*********************************************************************</comment> +<widget class="TQDialog"> + <property name="name"> + <cstring>TopicChooserBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>391</width> + <height>223</height> + </rect> + </property> + <property name="caption"> + <string>Choose Topic</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>Select a topic from the list and click the <b>Display</b>-button to open the online help.</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>label</cstring> + </property> + <property name="text"> + <string>&Topics</string> + </property> + <property name="buddy" stdset="0"> + <cstring>listbox</cstring> + </property> + </widget> + <widget class="TQListBox"> + <property name="name"> + <cstring>listbox</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Displays a list of available help topics for the keyword.</string> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout16</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="tqsizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>buttonDisplay</cstring> + </property> + <property name="text"> + <string>&Display</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>Open the topic selected in the list.</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Close</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>Close the Dialog.</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>buttonDisplay</sender> + <signal>clicked()</signal> + <receiver>TopicChooserBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>TopicChooserBase</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>listbox</sender> + <signal>doubleClicked(QListBoxItem*)</signal> + <receiver>TopicChooserBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>listbox</sender> + <signal>returnPressed(QListBoxItem*)</signal> + <receiver>TopicChooserBase</receiver> + <slot>accept()</slot> + </connection> +</connections> +<Q_SLOTS> + <slot access="protected">init()</slot> + <slot access="protected">destroy()</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/assistant/topicchooserimpl.cpp b/tqtinterface/qt4/tools/assistant/topicchooserimpl.cpp new file mode 100644 index 0000000..4cad976 --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/topicchooserimpl.cpp @@ -0,0 +1,70 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "topicchooserimpl.h" + +#include <tqlabel.h> +#include <tqlistbox.h> +#include <tqpushbutton.h> + +TopicChooser::TopicChooser( TQWidget *tqparent, const TQStringList &lnkNames, + const TQStringList &lnks, const TQString &title ) + : TopicChooserBase( tqparent, 0, TRUE ), links( lnks ), linkNames( lnkNames ) +{ + label->setText( tr( "Choose a topic for <b>%1</b>" ).arg( title ) ); + listbox->insertStringList( linkNames ); + listbox->setCurrentItem( listbox->firstItem() ); + listbox->setFocus(); +} + +TQString TopicChooser::link() const +{ + if ( listbox->currentItem() == -1 ) + return TQString(); + TQString s = listbox->currentText(); + if ( s.isEmpty() ) + return s; + int i = linkNames.tqfindIndex( s ); + return links[ i ]; +} + +TQString TopicChooser::getLink( TQWidget *tqparent, const TQStringList &lnkNames, + const TQStringList &lnks, const TQString &title ) +{ + TopicChooser *dlg = new TopicChooser( tqparent, lnkNames, lnks, title ); + TQString lnk; + if ( dlg->exec() == TQDialog::Accepted ) + lnk = dlg->link(); + delete dlg; + return lnk; +} diff --git a/tqtinterface/qt4/tools/assistant/topicchooserimpl.h b/tqtinterface/qt4/tools/assistant/topicchooserimpl.h new file mode 100644 index 0000000..1bfd10b --- /dev/null +++ b/tqtinterface/qt4/tools/assistant/topicchooserimpl.h @@ -0,0 +1,60 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of TQt Assistant. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TOPICCHOOSERIMPL_H +#define TOPICCHOOSERIMPL_H + +#include "topicchooser.h" + +#include <tqstringlist.h> + +class TopicChooser : public TopicChooserBase +{ + TQ_OBJECT + +public: + TopicChooser( TQWidget *tqparent, const TQStringList &lnkNames, + const TQStringList &lnks, const TQString &title ); + + TQString link() const; + + static TQString getLink( TQWidget *tqparent, const TQStringList &lnkNames, + const TQStringList &lnks, const TQString &title ); + +private: + TQString theLink; + TQStringList links, linkNames; + +}; + +#endif |