From: <si...@us...> - 2010-07-02 12:35:08
|
Revision: 1202 http://qterm.svn.sourceforge.net/qterm/?rev=1202&view=rev Author: sidos Date: 2010-07-02 12:35:00 +0000 (Fri, 02 Jul 2010) Log Message: ----------- integrate assistant help Modified Paths: -------------- trunk/qterm-qt4/src/CMakeLists.txt trunk/qterm-qt4/src/qtermframe.cpp trunk/qterm-qt4/src/qtermframe.h trunk/qterm-qt4/src/qtermglobal.h trunk/qterm-qt4/src/qtermwindow.h trunk/qterm-qt4/src/qtermwindowbase.h Added Paths: ----------- trunk/qterm-qt4/src/assistantclient.cpp trunk/qterm-qt4/src/assistantclient.h trunk/qterm-qt4/src/doc/ trunk/qterm-qt4/src/doc/CMakeLists.txt trunk/qterm-qt4/src/doc/Script.html trunk/qterm-qt4/src/doc/about.txt trunk/qterm-qt4/src/doc/doc.css trunk/qterm-qt4/src/doc/index.html.in trunk/qterm-qt4/src/doc/qterm.qhcp trunk/qterm-qt4/src/doc/qterm.qhp.in Modified: trunk/qterm-qt4/src/CMakeLists.txt =================================================================== --- trunk/qterm-qt4/src/CMakeLists.txt 2010-07-02 11:34:10 UTC (rev 1201) +++ trunk/qterm-qt4/src/CMakeLists.txt 2010-07-02 12:35:00 UTC (rev 1202) @@ -119,6 +119,7 @@ aboutdialog.cpp addrdialog.cpp articledialog.cpp + assistantclient.cpp imageviewer.cpp imagelistviewer.cpp keydialog.cpp @@ -236,6 +237,7 @@ add_subdirectory(scripts) add_subdirectory(po) add_subdirectory(keyboard_profiles) +add_subdirectory(doc) add_dependencies(qterm translations_target) if(QTERM_ENABLE_TEST) add_subdirectory(test) Added: trunk/qterm-qt4/src/assistantclient.cpp =================================================================== --- trunk/qterm-qt4/src/assistantclient.cpp (rev 0) +++ trunk/qterm-qt4/src/assistantclient.cpp 2010-07-02 12:35:00 UTC (rev 1202) @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt...@no...) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt...@no.... +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "assistantclient.h" +#include "qtermglobal.h" + +#include <QtCore/QString> +#include <QtCore/QProcess> +#include <QtCore/QDir> +#include <QtCore/QLibraryInfo> +#include <QtCore/QDebug> +#include <QtCore/QFileInfo> +#include <QtCore/QObject> +#include <QtCore/QTextStream> +#include <QtCore/QCoreApplication> + +namespace QTerm +{ + +enum { debugAssistantClient = 0 }; + +AssistantClient::AssistantClient() : + m_process(0) +{ +} + +AssistantClient::~AssistantClient() +{ + if (isRunning()) { + m_process->terminate(); + m_process->waitForFinished(); + } + delete m_process; +} + +bool AssistantClient::showPage(const QString &path, QString *errorMessage) +{ + QString cmd = QLatin1String("SetSource "); + cmd += path; + return sendCommand(cmd, errorMessage); +} + +bool AssistantClient::activateIdentifier(const QString &identifier, QString *errorMessage) +{ + QString cmd = QLatin1String("ActivateIdentifier "); + cmd += identifier; + return sendCommand(cmd, errorMessage); +} + +bool AssistantClient::activateKeyword(const QString &keyword, QString *errorMessage) +{ + QString cmd = QLatin1String("ActivateKeyword "); + cmd += keyword; + return sendCommand(cmd, errorMessage); +} + +bool AssistantClient::sendCommand(const QString &cmd, QString *errorMessage) +{ + if (debugAssistantClient) + qDebug() << "sendCommand " << cmd; + if (!ensureRunning(errorMessage)) + return false; + if (!m_process->isWritable() || m_process->bytesToWrite() > 0) { + *errorMessage = QCoreApplication::translate("AssistantClient", "Unable to send request: Assistant is not responding."); + return false; + } + QTextStream str(m_process); + str << cmd << QLatin1Char('\0') << endl; + return true; +} + +bool AssistantClient::isRunning() const +{ + return m_process && m_process->state() != QProcess::NotRunning; +} + +QString AssistantClient::binary() +{ + QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator(); +#if !defined(Q_OS_MAC) + app += QLatin1String("assistant"); +#else + app += QLatin1String("Assistant.app/Contents/MacOS/Assistant"); +#endif + +#if defined(Q_OS_WIN) + app += QLatin1String(".exe"); +#endif + + return app; +} + +bool AssistantClient::ensureRunning(QString *errorMessage) +{ + if (isRunning()) + return true; + + if (!m_process) + m_process = new QProcess; + + const QString app = binary(); + if (!QFileInfo(app).isFile()) { + *errorMessage = QCoreApplication::translate("AssistantClient", "The binary '%1' does not exist.").arg(app); + return false; + } + if (debugAssistantClient) + qDebug() << "Running " << app; + // run + QStringList args; + args << QLatin1String("-enableRemoteControl") + << QLatin1String("-collectionFile") + << Global::instance()->pathLib() + QDir::separator() + "doc/qterm.qhc"; + m_process->start(app, args); + if (!m_process->waitForStarted()) { + *errorMessage = QCoreApplication::translate("AssistantClient", "Unable to launch assistant (%1).").arg(app); + return false; + } + return true; +} + +} Added: trunk/qterm-qt4/src/assistantclient.h =================================================================== --- trunk/qterm-qt4/src/assistantclient.h (rev 0) +++ trunk/qterm-qt4/src/assistantclient.h 2010-07-02 12:35:00 UTC (rev 1202) @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt...@no...) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt...@no.... +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ASSISTANTCLIENT_H +#define ASSISTANTCLIENT_H + +#include <QtCore/qglobal.h> + +class QProcess; +class QString; + +namespace QTerm +{ +class AssistantClient +{ + AssistantClient(const AssistantClient &); + AssistantClient &operator=(const AssistantClient &); + +public: + AssistantClient(); + ~AssistantClient(); + + bool showPage(const QString &path, QString *errorMessage); + bool activateIdentifier(const QString &identifier, QString *errorMessage); + bool activateKeyword(const QString &keyword, QString *errorMessage); + + bool isRunning() const; + +private: + static QString binary(); + bool sendCommand(const QString &cmd, QString *errorMessage); + bool ensureRunning(QString *errorMessage); + + QProcess *m_process; +}; +} // namespace QTerm +#endif // ASSISTANTCLIENT_H Added: trunk/qterm-qt4/src/doc/CMakeLists.txt =================================================================== --- trunk/qterm-qt4/src/doc/CMakeLists.txt (rev 0) +++ trunk/qterm-qt4/src/doc/CMakeLists.txt 2010-07-02 12:35:00 UTC (rev 1202) @@ -0,0 +1,28 @@ +CONFIGURE_FILE(../pic/qterm.png qterm.png COPYONLY) +CONFIGURE_FILE(qterm.qhp.in qterm.qhp) +CONFIGURE_FILE(index.html.in index.html) + +FIND_PROGRAM(QT_HELP_COLLECTION_GENERATOR + qcollectiongenerator + PATHS "${QT_BINARY_DIR}" + DOC "qcollectiongenerator used to compile Qt help collection project files") + + +ADD_CUSTOM_COMMAND( + OUTPUT qterm.qhc + DEPENDS qterm.qhcp + DEPENDS qterm.qhp + COMMAND ${QT_HELP_COLLECTION_GENERATOR} + ARGS qterm.qhcp + -o qterm.qhc + COMMENT "Compiling Qt help collection project qterm.qhcp" +) + +ADD_CUSTOM_TARGET(help_target + DEPENDS qterm.qhc) + +INSTALL( + FILES qterm.qhc + DESTINATION share/qterm/doc +) + Added: trunk/qterm-qt4/src/doc/Script.html =================================================================== --- trunk/qterm-qt4/src/doc/Script.html (rev 0) +++ trunk/qterm-qt4/src/doc/Script.html 2010-07-02 12:35:00 UTC (rev 1202) @@ -0,0 +1,268 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> + +<html> +<head> + <title>Script - QTerm Documents</title> + <link rel="stylesheet" type="text/css" href="doc.css"/> +</head> +<body> + +<div class="Documentation"> + <div class="Heading"> + Script + </div> +</div> + +<div class="toc"> + <p><strong>Contents</strong></p> + <ul> + <li><a href="#Introduction">Introduction</a></li> + <li><a href="#How_to_Use">How to Use</a></li> + <li><a href="#How_to_Debug">How to Debug</a></li> + <li><a href="#How_to_Write_a_Script">How to Write a + Script</a></li> + <li><a href="#How_to_Write_a_System_Script">How to Write + a System Script</a></li> + </ul> +</div> +<a name="Introduction" id="Introduction"></a><h3> Introduction</span></h3> +<p>Starting from the version 0.5.6, QTerm supports scripts with QtScript. With +the greatest and latest script support in QTerm, you can:</p> +<ul> + <li> Do boring and repeating operation automatically.</li> + <li> Change the default behavior of QTerm with system scripts.</li> + <li> Try new functions with script (In order to do this you might want to have Qt bindings for QtScript installed, they can be downloaded from <a href="http://labs.trolltech.com/page/Projects/QtScript/Generator" class="external free" title="http://labs.trolltech.com/page/Projects/QtScript/Generator" rel="nofollow">http://labs.trolltech.com/page/Projects/QtScript/Generator</a>)</li> +</ul> + +<a name="How_to_Use" id="How_to_Use"></a><h3> How to Use</h3> +<p>You can run simple scripts using Script->Run, for example, save the following +code</p> +<pre>for (var i = 0; i < 10; i++) + QTerm.sendString("q"); +</pre> +<p>to a script file, run it in QTerm will send 10 q's to the server.</p> +<p>To use the system control script. Open the address book, in the very end of +the General tab. First enable the Load Control Script checkbox, then choose +your system script.</p> + +<a name="How_to_Debug" id="How_to_Debug"></a><h3> How to Debug</h3> +<p>If you want to develop serious/complicate scripts for QTerm, it is very +helpful to have QScriptEngineDebugger enable. This feature is introduced in Qt +4.5, make sure your qt is new enough. Then you can run cmake with +-DQTERM_ENABLE_SCRIPT_DEBUGGER=ON, for example:</p> +<pre>cmake .. -DQTERM_ENABLE_SCRIPT_DEBUGGER=ON</pre> +<p>Then do the usual make, make install to install QTerm +</p><p>After you enable the debugger. It will pop up every time the script engine +catches a exception. You can also call the debugger any time by Script->Debug.</p> + +<a name="How_to_Write_a_Script" id="How_to_Write_a_Script"></a><h3> How to Write a Script</h3> +<p>Here is a list of functions you can call in the scripts, they are all in the +"QTerm" object, so for example if you want to call "version()" you should call +"QTerm.version()" instead.</p> +<p>QString version()</p> +<pre> Return the version of QTerm.</pre> +<p>int caretX()</p> +<p>int caretY()</p> +<pre> Return the x or y coordinate of the current position of caret.</pre> +<p>int columns()</p> +<p>int rows()</p> +<pre> Return the number of columns or rows of the current window.</pre> +<p>int charX(int x, int y)</p> +<p>int charY(int x, int y)</p> +<pre> Given the graphical coordinate in the current window, convert it to the + text coordinate. +</pre> +<p>int posX()</p> +<p>int posY()</p> +<pre> Return the x or y coordinate of the mouse.</pre> +<p>QString getUrl()</p> +<p>QString getIP()</p> +<pre> Return the URL or IP address under the mouse pointer, if no url is + detected an empty string will be returned. +</pre> +<p>bool isConnected()</p> +<pre> Check if the current window is conneced to a BBS server.</pre> +<p>void reconnect()</p> +<pre> Reconnect to the BBS server, do nothing if the current window is already + connected. +</pre> +<p>void disconnect()</p> +<pre> Disconnect from the current BBS server.</pre> +<p>void buzz()</p> +<pre> Shake QTerm.</pre> +<p>void sendString(const QString & string)</p> +<pre> Send string to the BBS server.</pre> +<p>void sendParsedString(const QString & string)</p> +<pre> Send parsed string to the BBS server. you can use '^M' to represent the + return key for example. +</pre> +<p>void osdMessage(const QString & message, int icon = 1, int duration = 0) +</p> +<pre> Show message in the osd, icon = 0, 1, 2, 3 means No/Info/Warning/Error + icon. Duration is in the unit of ms, 0 means forever. +</pre> +<p>void showMessage(const QString & message, int duration = -1) +</p> +<pre> Show message in the notification area or system tray. duration is not + really useful for now. +</pre> +<p>void cancelZmodem() +</p> +<pre> Cancel the current zmodem transfer. +</pre> +<p>void setZmodemFileList(const QStringList & fileList) +</p> +<pre> Set the list of files you want to upload with zmodem. call it before your + start zmodem to avoid the file selection dialog. +</pre> +<p>QScriptValue getLine(int line) +</p> +<pre> Get the object represent the 'line' line text. +</pre> +<p>QScriptValue window() +</p> +<pre> Return the current window object. +</pre> +<p>bool addPopupMenu(QString id, QString menuTitle, QString icon = "QTerm") +</p> +<pre> Add a menu item to the popup menu, you can access to the new action with + QTerm.id property if the method succeed. menuTitle is the text displayed + in the menu. currently icon parameter has no effect. Return true if + succeed, otherwise it will return false. +</pre> +<p>bool addUrlMenu(QString id, QString menuTitle, QString icon = "QTerm") +</p> +<pre> Add a menu item to the url popup menu, you can access to the new action + with QTerm.id property if the method succeed. menuTitle is the text + displayed in the menu. currently icon parameter has no effect. Return true + if succeed, otherwise it will return false. +</pre> +<p>void addPopupSeparator() +</p><p>void addUrlSeparator() +</p> +<pre> Add separators to the popup/url menu so they will look nicer. +</pre> +<p>void loadScript(const QString & filename) +</p> +<pre> Load external javascript files, QTerm will search the file under the + "scripts" directory under the local path (e.g.SHOME/.qterm) first and then + search the global path (e.g. /usr/share) +</pre> +<p>void globalPath() +</p> +<pre> Return the global data path, for example, if you installed QTerm to /usr, + then it will return /usr/share. +</pre> +<p>void localPath() +</p> +<pre> Return the local data path, $HOME/.qterm under Linux. +</pre> +<p>QString getSelectedText(bool rect = false, bool color = false, const QString & escape = "") +</p> +<pre> Return the current selected region. rect should always be false currently. + color indicate if you want the copy the attribute of the text, escape is + only useful when color is true, indicate how you want to represent the + escape sequence. +</pre> +<p>void openUrl(const QString & url) +</p> +<pre> Open the url using the http browser specified in QTerm. +</pre> +<p>void loadExtension(const QString & extension) +</p> +<pre> Load extension, if you want to use the classes in Qt bindings, you + need to load them first. +</pre> +<a name="How_to_Write_a_System_Script" id="How_to_Write_a_System_Script"></a><h3> <span class="mw-headline">How to Write a System Script</span></h3> +<p>In order to change the behavior of QTerm. You can reimplement the following +functions in the system script, again all the functions are members of 'QTerm' +object, for example init() should be understand as QTerm.init(): +</p><p>There is a property which is important for this usage: QTerm.accepted. It +should be set to true if you do not want the native QTerm code to handle the +event any further, otherwise it should set to false. +</p><p>init() +</p> +<pre> This function is called every time the system script is loaded. You can + show messages or initiate some variables here. +</pre> +<p>setCursorType(x,y) +</p> +<pre> Determine what kind of mouse cursor should be shown in the current + context, if mouse release events is not handle by the script this function + also determine how the mouse release will be handled. +</pre> +<p>setPageState() +</p> +<pre> Determine the current state of the BBS page, useful for further determine + the mouse behavior +</pre> +<p>isLineClickable(x,y) +</p> +<pre> Determine if the current line under mouse cursor is clickable, x and y is + the mouse text coordinate. +</pre> +<p>getClickableString(x,y) +</p> +<pre> Determine if the string under mouse cursor is clickable, x and y is the + mouse text coordinate, the string should be returned and will be + highlighted by QTerm. +</pre> +<p>onMouseEvent(type, button, buttons, modifiers, pt_x, pt_y) +</p> +<pre> Handle the mouse event, type, button, buttons, modifiers follow the + definition in QMouseEvent, pt_x and pt_y is the graphical coordinate of the + mouse pointer. +</pre> +<p>onKeyPressEvent(key, modifiers, text) +</p> +<pre> Handle the key press event, the definition of the arguments again follows + QKeyEvent. +</pre> +<p>onWheelEvent(delta, buttons, modifiers, orientation, pt_x, pt_y) +</p> +<pre> Handle the mouse wheel event, the definition of delta, button, modifiers, + and orientation follow QWheelEvent. pt_x and pt_y is the graphical + coordinate of the mouse pointer. +</pre> +<p>onNewData() +</p> +<pre> The function will be called every time QTerm gets new data, you can + manipulate the received data a little bit. +</pre> +<p>antiIdle() +</p> +<pre> Determine how the anti idle event should be handled. +</pre> +<p>autoReply() +</p> +<pre> Determine how to reply the incoming message. Useful for those who want to + write BBS robots. +</pre> +<p>checkUrl() +</p> +<pre> Determine if there is a URL under the mouse pointer, return the URL if + found, otherwise return a empty string. +</pre> +<p>checkIP() +</p> +<pre> Determine if there is a IP address under the mouse pointer, return the URL + if found, otherwise return a empty string. +</pre> +<p>onTelnetState(int state) +</p> +<pre> Handle telnet events +</pre> +<p>onZmodemState(int type, int value, const QString& msg) +</p> +<pre> Handle zmodem events +</pre> +<p>endOfArticle() +</p> +<pre> Implement this to check the end of articles for downloading articles +</pre> +<p>There is also a signal: scriptEvent(const QString& type) which can be used by +the script to emit and handle signals +</p> + +</body> +</html> Added: trunk/qterm-qt4/src/doc/about.txt =================================================================== --- trunk/qterm-qt4/src/doc/about.txt (rev 0) +++ trunk/qterm-qt4/src/doc/about.txt 2010-07-02 12:35:00 UTC (rev 1202) @@ -0,0 +1 @@ +QTerm is a BBS client written in Qt. Added: trunk/qterm-qt4/src/doc/doc.css =================================================================== --- trunk/qterm-qt4/src/doc/doc.css (rev 0) +++ trunk/qterm-qt4/src/doc/doc.css 2010-07-02 12:35:00 UTC (rev 1202) @@ -0,0 +1,39 @@ +body { + border: 1px solid #000000; + background: #EEF3F5; + margin: 0px; + padding: 0px; +} +div.Heading { + padding-top: 5px; + padding-bottom: 5px; + padding-left: 5px; + background: #adc4d2; + font-weight: bold; + font-size: 24pt; + border-bottom: 1px solid #000000; +} +span.HeadingSmallText { + font-weight: bold; + font-size: 12pt; +} +div.LongHelp { + margin: 20px; + font-style: italic; +} +div.Description { + border-top: 1px solid; +} +table.PropertiesTable { +} +tr.PropertiesTableHeading { + background: #85a8bc; +} + +div.toc { + background: #DDDDDD; + border: 1px solid #000000; + margin: 2em 2em; + padding: 1em; + width: 30em; +} Added: trunk/qterm-qt4/src/doc/index.html.in =================================================================== --- trunk/qterm-qt4/src/doc/index.html.in (rev 0) +++ trunk/qterm-qt4/src/doc/index.html.in 2010-07-02 12:35:00 UTC (rev 1202) @@ -0,0 +1,42 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> + +<html> +<head> + <title>Main - QTerm Documents</title> + <link rel="stylesheet" type="text/css" href="doc.css"/> +</head> +<body> + +<div class="Documentation"> + <div class="Heading"> + QTerm @QTERM_VERSION_MAJOR@.@QTERM_VERSION_MINOR@.@QTERM_VERSION_RELEASE@ + </div> +</div> + +<p align="center"><a href="http://www.qterm.org"><img src="qterm.png"/></a></p> + +<p> +QTerm is a BBS client written in Qt, thus running on multiple platforms, +e.g. Linux, Windows, Mac OS X. + + +<div class="toc"> + <p><strong>Table of Contents</strong></p> + <ul> + <li> + <a href="Script.html">Script</a> + <ul> + <li><a href="Script.html#Introduction">Introduction</a></li> + <li><a href="Script.html#How_to_Use">How to Use</a></li> + <li><a href="Script.html#How_to_Debug">How to Debug</a></li> + <li><a href="Script.html#How_to_Write_a_Script">How to Write a + Script</a></li> + <li><a href="Script.html#How_to_Write_a_System_Script">How to Write + a System Script</a></li> + </ul> + </li> + </ul> +</div> + +</body> +</html> Added: trunk/qterm-qt4/src/doc/qterm.qhcp =================================================================== --- trunk/qterm-qt4/src/doc/qterm.qhcp (rev 0) +++ trunk/qterm-qt4/src/doc/qterm.qhcp 2010-07-02 12:35:00 UTC (rev 1202) @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8" ?> +<QHelpCollectionProject version="1.0"> + <assistant> + <title>QTerm Help</title> + <startPage>qthelp://org.qterm/doc/index.html</startPage> + <applicationIcon>../pic/qterm.png</applicationIcon> + <aboutMenuText> + <text>About QTerm</text> + </aboutMenuText> + <aboutDialog> + <file>about.txt</file> + <icon>../pic/qterm.png</icon> + </aboutDialog> + </assistant> + <docFiles> + <generate> + <file> + <input>qterm.qhp</input> + <output>qterm.qch</output> + </file> + </generate> + <register> + <file>qterm.qch</file> + </register> + </docFiles> +</QHelpCollectionProject> Added: trunk/qterm-qt4/src/doc/qterm.qhp.in =================================================================== --- trunk/qterm-qt4/src/doc/qterm.qhp.in (rev 0) +++ trunk/qterm-qt4/src/doc/qterm.qhp.in 2010-07-02 12:35:00 UTC (rev 1202) @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<QtHelpProject version="1.0"> + <namespace>org.qterm</namespace> + <virtualFolder>doc</virtualFolder> + <filterSection> + <toc> + <section title="QTerm" ref="index.html"> + <section title="Script" ref="Script.html"/> + </section> + </toc> + <filterAttribute>QTerm</filterAttribute> + <filterAttribute>@QTERM_VERSION_MAJOR@.@QTERM_VERSION_MINOR@.@QTERM_VERSION_RELEASE@</filterAttribute> + <keywords> + <keyword name="Script" ref="Script.html" id="Script::Script"/> + </keywords> + <files> + <file>doc.css</file> + <file>*.html</file> + <file>*.png</file> + </files> + </filterSection> +</QtHelpProject> Modified: trunk/qterm-qt4/src/qtermframe.cpp =================================================================== --- trunk/qterm-qt4/src/qtermframe.cpp 2010-07-02 11:34:10 UTC (rev 1201) +++ trunk/qterm-qt4/src/qtermframe.cpp 2010-07-02 12:35:00 UTC (rev 1202) @@ -336,6 +336,14 @@ Global::instance()->openUrl(strUrl); } +//slot Help->Contents +void Frame::on_actionContents_triggered() +{ + QString errorMessage; + if (!m_assistant.showPage("qthelp://org.qterm/doc/index.html", &errorMessage)) + QMessageBox::warning(this, tr("Assistant"), errorMessage); +} + //slot Windows menu aboutToShow void Frame::windowsMenuAboutToShow() { Modified: trunk/qterm-qt4/src/qtermframe.h =================================================================== --- trunk/qterm-qt4/src/qtermframe.h 2010-07-02 11:34:10 UTC (rev 1201) +++ trunk/qterm-qt4/src/qtermframe.h 2010-07-02 12:35:00 UTC (rev 1202) @@ -1,7 +1,9 @@ #ifndef QTERMFRAME_H #define QTERMFRAME_H +#include "ui_mainframe.h" +#include "assistantclient.h" #include "statusBar.h" #include <QPixmap> #include <QByteArray> @@ -21,13 +23,12 @@ namespace QTerm { -class WndMgr; class Window; class QTermTimeLabel; class Param; class Config; -class Frame : public QMainWindow +class Frame : public QMainWindow, public Ui::Frame { Q_OBJECT public: @@ -36,9 +37,7 @@ static Frame * instance() { return s_instance; } - - void updateMenuToolBar(); - void enableMenuToolBar(bool); + QMenu * createPopupMenu(); void popupFocusIn(Window * window = 0); void buzz(); QMenu * genPopupMenu(QWidget * owner); @@ -49,165 +48,76 @@ void saveAndDisconnect(); signals: - void bossColor(); void scrollChanged(); void statusBarChanged(bool); protected slots: + // custum key + void on_actionKey_Setup_triggered(); void keyClicked(int); - // Menu - void addressBook(); - void quickLogin(); + // theme submenu + void initThemeMenu(); + void themesMenuActivated(QAction *); + // toolbar submenu + void initToolbarMenu(); + // File + void on_actionAddressBook_triggered(); + void on_actionQuick_Login_triggered(); + void on_actionPrint_triggered(); + // View + void on_actionFont_triggered(); + void on_actionMenubar_toggled(bool); + void on_actionStatusbar_toggled(bool); + void on_actionFullscreen_triggered(bool); + // BBS + void on_actionImage_Viewer_triggered(); + // Options + void on_actionDefault_Session_Setting_triggered(); + void on_actionPreference_triggered(); + void on_actionConfigure_Shortcuts_triggered(); + void on_actionConfigure_Toolbars_triggered(); + // Help + void on_actionAbout_QTerm_triggered(); + void on_actionQTerm_Online_triggered(); + void on_actionAbout_Qt_triggered(); + void on_actionContents_triggered(); - void aboutQTerm(); - void homepage(); - void updateLang(QAction*); - void defaultSetting(); - void preference(); - void reloadScript(); - void runScript(); - void stopScript(); - void debugConsole(); - - // Toolbar +protected slots: + // Action groups void connectIt(); - void disconnect(); - void copy(); - void paste(); - void copyRect(bool); - void copyColor(bool); - void copyArticle(); - void autoCopy(bool); - void wordWrap(bool); void updateESC(QAction*); void updateCodec(QAction*); void updateScroll(QAction*); - void updateSwitchBar(bool); - void updateStatusBar(bool); - void refresh(); - void triggerFullScreen(bool isFullScreen); - void hideMenuBar(bool hide); - void bosscolor(); - void uiFont(); - void antiIdle(bool); - void autoReply(bool); - void setting(); - void viewMessages(); - void updateMouse(bool); - void updateBeep(bool); - void reconnect(bool); - void keySetup(); - void printScreen(); + void updateLang(QAction*); - void viewImages(); - - void initThemesMenu(); - void themesMenuActivated(QAction *); void windowsMenuAboutToShow(); void windowsMenuActivated(); + void connectMenuAboutToShow(); void connectMenuActivated(int); - void popupConnectMenu(); + void windowActivated(QMdiSubWindow*); + void windowClosed(QObject*); + void actionsDispatcher(QAction*); + void trayActivated(QSystemTrayIcon::ActivationReason reason); void trayHide(); void trayShow(); void buildTrayMenu(); void switchWin(int); - void paintEvent(QPaintEvent *); - void configShortcuts(); - void configToolbars(); void slotShowQTerm(); -public: - QMdiArea * m_MdiArea; + protected: //variables - //QTermTimeLabel *labelTime; - QMenu *windowsMenu; - QMenu *themesMenu; - - QString theme; - - QToolBar * key; - - QMenu * escapeMenu; - QMenu * langMenu; QMenu * connectMenu; - -// File - QAction * m_connectAction; - QAction * m_disconnectAction; - QAction * m_addressAction; - QAction * m_quickConnectAction; - QAction * m_printAction; - QAction * m_exitAction; - -// Edit - QAction * m_copyAction; - QAction * m_pasteAction; - QAction * m_colorCopyAction; - QAction * m_rectAction; - QAction * m_autoCopyAction; - QAction * m_wwrapAction; - QAction * m_noescAction; - QAction * m_escescAction; - QAction * m_uescAction; - QAction * m_customescAction; - QAction * m_NoConvAction; - QAction * m_S2TAction; - QAction * m_T2SAction; - - QAction * m_refreshAction; - QAction * m_engAction; - QAction * m_chsAction; - QAction * m_chtAction; - QAction * m_uiFontAction; - QAction * m_fullAction; - QAction * m_bossAction; - QAction * m_scrollHideAction; - QAction * m_scrollLeftAction; - QAction * m_scrollRightAction; - QAction * m_switchAction; - -// View - QAction * m_currentSessionAction; - QAction * m_defaultAction; - QAction * m_prefAction; - QAction * m_copyArticleAction; - QAction * m_antiIdleAction; - QAction * m_autoReplyAction; - QAction * m_viewMessageAction; - QAction * m_beepAction; - QAction * m_mouseAction; - QAction * m_viewImageAction; - QAction * m_menuBarAction; - - QAction * m_scriptReloadAction; - QAction * m_scriptRunAction; - QAction * m_scriptStopAction; - QAction * m_scriptDebugAction; - - QAction * m_aboutAction; - QAction * m_homepageAction; - - QAction * m_reconnectAction; - QAction * m_shortcutsAction; - QAction * m_toolbarsAction; - - StatusBar * m_pStatusBar; - QToolButton *connectButton; - QMenuBar * mainMenu; - QToolBar *mdiconnectTools, *mdiTools; - -// bool m_bFullScreen; -// bool m_bSwitchBar; - + QMenu *trayMenu; QSystemTrayIcon *tray; - QMenu *trayMenu; + StatusBar *m_pStatusBar; + //function void newWindow(const Param& param, int index = -1); void closeEvent(QCloseEvent *); @@ -215,9 +125,11 @@ void mouseReleaseEvent(QMouseEvent *); void selectStyleMenu(int , int); void iniSetting(); - void initActions(); + void initShortcuts(); - //void loadPref(Config *); + + void groupActions(); + void saveSetting(); void saveShortcuts(); void loadShortcuts(); @@ -225,18 +137,18 @@ void loadToolbars(); void loadSession(); - void addMainMenu(); - void addMainTool(); - void updateKeyToolBar(); QAction * insertThemeItem(const QString &); void setUseTray(bool); private: - static Frame * s_instance; + static Frame * s_instance; + AssistantClient m_assistant; + + QStringList listBasicActions; + QActionGroup* actionsExtra; }; } // namespace QTerm -#endif //QTERMFRAME_H - +#endif //QTERMFRAME_H \ No newline at end of file Modified: trunk/qterm-qt4/src/qtermglobal.h =================================================================== --- trunk/qterm-qt4/src/qtermglobal.h 2010-07-02 11:34:10 UTC (rev 1201) +++ trunk/qterm-qt4/src/qtermglobal.h 2010-07-02 12:35:00 UTC (rev 1202) @@ -14,6 +14,7 @@ #include "qtermparam.h" +#include <QtCore/QTranslator> #include <QtCore/QMutex> #include <QtCore/QString> #include <QtCore/QMap> @@ -31,7 +32,7 @@ Q_OBJECT public: enum Language { - SimpilifiedChinese, + SimplifiedChinese, TraditionalChinese, English }; @@ -48,6 +49,13 @@ Simplified_To_Traditional, Traditional_To_Simplified }; + + enum Position { + Hide = 0, + Left, + Right + }; + struct Pref { Conversion XIM; int nWordWrap; @@ -83,7 +91,6 @@ bool isOK(); Pref m_pref; void loadPrefence(); - enum Position {Hide, Left, Right}; bool isBossColor() const; const QString & escapeString() const; Conversion clipConversion() const; @@ -91,20 +98,21 @@ Position scrollPosition() const; bool isFullScreen() const; bool showSwitchBar() const; - bool showToolBar(const QString & toolbar); - const QString & style() const; + bool showStatusBar() const; + bool showMenuBar() const; + const QString & style() const; + void setClipConversion(Conversion conversionId); void setEscapeString(const QString & escapeString); void setScrollPosition(Position position); void setStatusBar(bool isShow); //Better name? + void setMenuBar(bool isShow); void setBossColor(bool isBossColor); void setFullScreen(bool isFullscreen); void setSwitchBar(bool isShow); void setLanguage(const Language language); void setStyle(const QString & style); - void setShowToolBar(const QString & toolbar, bool isShown); - void saveShowToolBar(); void loadConfig(); //TODO: Merge with iniSettings void saveConfig(); QByteArray loadGeometry(); @@ -143,8 +151,10 @@ Position m_scrollPos; bool m_fullScreen; bool m_switchBar; + bool m_menuBar; Language m_language; - QMap<QString, bool> m_showToolBar; + QTranslator *m_translatorQT; + QTranslator *m_translatorQTerm; #ifdef KWALLET_ENABLED Wallet * m_wallet; #endif // KWALLET_ENABLED Modified: trunk/qterm-qt4/src/qtermwindow.h =================================================================== --- trunk/qterm-qt4/src/qtermwindow.h 2010-07-02 11:34:10 UTC (rev 1201) +++ trunk/qterm-qt4/src/qtermwindow.h 2010-07-02 12:35:00 UTC (rev 1202) @@ -88,27 +88,46 @@ return m_nAddrIndex; } + + public slots: + // File + void on_actionDisconnect_triggered(); + // Edit + void on_actionCopy_triggered(); + void on_actionPaste_triggered(); + void on_actionRectangle_Selection_toggled(bool rect) { m_bRectCopy = rect; } + void on_actionCopy_w_Color_toggled(bool color) { m_bColorCopy = color; } + void on_actionAuto_Copy_toggled(bool automatic) { m_bAutoCopy = automatic; } + void on_actionPaste_w_Wrodwrap(bool wordwrap) { m_bWordWrap = wordwrap; } + // View + void on_actionRefresh_triggered(); + void on_actionBoss_Color_toggled(bool); + // BBS + void on_actionAuto_Reply_toggled(bool); + void on_actionAnti_Idle_toggled(bool); + void on_actionCopy_Article_triggered(); + void on_actionView_Message_triggered(); + void on_actionBeep_on_message_toggled(bool beep) { m_bBeep = beep; } + void on_actionSupport_Mouse_toggled(bool mouse) { m_bMouse = mouse; } + + // Option + void on_actionCurrent_Session_Setting_triggered(); + // Script + void on_actionRun_triggered(); + void on_actionStop_triggered(); + void on_actionDebug_Console_triggered(); + void on_actionReload_Script_triggered(); + +public slots: // ui - void copy(); - void paste(); - void copyArticle(); - void setting(); - void runScript(const QString & filename=""); - void stopScript(); - void debugConsole(); void reconnect(); void sendParsedString(const QString &); void showIP(); void inputHandle(const QString & text); public: - void disconnect(); - void refresh(); - void viewMessages(); - void autoReply(bool); - void antiIdle(bool); - void initScript(); + void runScript(const QString & filename=""); void externInput(const QString &); void getHttpHelper(const QString&, bool); void osdMessage(const QString &, int type, int duration); @@ -148,11 +167,12 @@ void httpDone(QObject*); // decode - void setMouseMode(bool); + void setMouseMode(bool on ) { m_bMouseX11 = on; } void jobDone(int); void showArticle(const QString text); protected: + // Mouse Events void mouseDoubleClickEvent(QMouseEvent *); void mouseMoveEvent(QMouseEvent *); void mousePressEvent(QMouseEvent *); @@ -161,12 +181,6 @@ void enterEvent(QEvent *); void leaveEvent(QEvent *); -// void customEvent( QCustomEvent * ); - /* - void imStartEvent (QIMEvent *); - void imComposeEvent (QIMEvent *); - void imEndEvent (QIMEvent *); - */ void reconnectProcess(); void connectionClosed(); void doAutoLogin(); @@ -181,6 +195,8 @@ void keyPressEvent(QKeyEvent *); void loadKeyboardTranslator(const QString & profile); + + void groupActions(); Screen * m_pScreen; Decode * m_pDecode; @@ -261,8 +277,8 @@ BBS * m_pBBS; HostInfo * m_hostInfo; // menu and toolbar state - bool m_bCopyColor; - bool m_bCopyRect; + bool m_bColorCopy; + bool m_bRectCopy; bool m_bAutoCopy; bool m_bWordWrap; bool m_bAntiIdle; Modified: trunk/qterm-qt4/src/qtermwindowbase.h =================================================================== --- trunk/qterm-qt4/src/qtermwindowbase.h 2010-07-02 11:34:10 UTC (rev 1201) +++ trunk/qterm-qt4/src/qtermwindowbase.h 2010-07-02 12:35:00 UTC (rev 1202) @@ -2,6 +2,7 @@ #define QTERMWINDOWBASE_H #include <QMdiSubWindow> +#include <QMap> namespace QTerm { @@ -16,9 +17,15 @@ virtual ~WindowBase() {} bool hasAction(const QString& act){return listActions.contains(act);} - + bool isActionChecked(const QString& act) { + if (mapToggleStates.contains(act)) + return *mapToggleStates[act]; + else + return false; + } protected: QStringList listActions; + QMap<QString, bool*> mapToggleStates; }; } // namespace QTerm This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |