diff --git a/src/catalog/gettext/catalogfileplugin.h b/src/catalog/gettext/catalogfileplugin.h index 09834af..1ab074a 100644 --- a/src/catalog/gettext/catalogfileplugin.h +++ b/src/catalog/gettext/catalogfileplugin.h @@ -1,149 +1,149 @@ /* **************************************************************************** This file is part of KAider This file contains parts of KBabel code Copyright (C) 2002-2003 by Stanislav Visnovsky This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. In addition, as a special exception, the copyright holders give permission to link the code of this program with any edition of the Qt library by Trolltech AS, Norway (or with modified versions of Qt that use the same license as Qt), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than Qt. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. **************************************************************************** */ #ifndef CATALOGFILEPLUGIN_H #define CATALOGFILEPLUGIN_H #include #include class QIODevice; class QString; class QStringList; namespace GettextCatalog { class GettextStorage; class CatalogItem; class CatalogImportPluginPrivate; class CatalogExportPluginPrivate; /** * Result of the conversion */ enum ConversionStatus { OK = 0, NOT_IMPLEMENTED, NO_FILE, NO_PERMISSIONS, PARSE_ERROR, RECOVERED_PARSE_ERROR, OS_ERROR, NO_PLUGIN, UNSUPPORTED_TYPE, RECOVERED_HEADER_ERROR, ///< Header error that could be recovered @since 1.11.2 (KDE 3.5.2) STOPPED, BUSY, NO_ENTRY_ERROR ///< The loaded catalog has not any entry! @since 1.11.2 (KDE 3.5.2) }; /** * HISTORY: this was a base class for Catalog import plugins in KBabel, * but this architecture isn't not suitable for XML-based files * (when whole DOM-tree is stored in memory to prevent file clashes) * * This class is the base for import plugins for catalogs. * It provides "transactional behavior", so the changes are stored in * catalog only if the import process finishes successfully. * * To use it, just subclass and redefine load() and id() methods. * When importing, you can use the protected methods for setting * the catalog. New catalog items can be added using appendCatalogItem. * * @short Base class for GettextCatalog import plugins * @author Stanislav Visnovsky */ class CatalogImportPlugin { public: CatalogImportPlugin(); virtual ~CatalogImportPlugin(); /** * Load the file and fill the corresponding catalog. The file * is considered to be of @p mimetype MIME type. * * @param device local file name to be opened - * @param mimetype the MIME type is should be handled as * @param catalog the catalog to be filled + * @param errorLine the number of erroneous line * @return result of the operation */ ConversionStatus open(QIODevice*, GettextStorage* catalog, int* errorLine); /** * Reimplement this method to load the local file passed as an argument. * Throughout the run, you can use the protected methods for setting * the contents of the resulting catalog. * This method must call \see setMimeTypes to setup correct MIME types * for the loaded file. Also, it should use \see isStopped to * abort loading and the signals for providing user feedback. * @param device file to be loaded */ virtual ConversionStatus load(QIODevice*) = 0; protected: /** Append a new catalog item, either as normal or as an obsolete one * @param item the new item * @param obsolete flag that the item is obsolete */ void appendCatalogItem(const CatalogItem& item, const bool obsolete = false); /** set flag that the file is generated from DocBook */ void setGeneratedFromDocbook(const bool fromDocbook); /** set the list of parse error indexes */ void setErrorIndex(const QList& errors); /** set extra data for the catalog, which can't be stored in * @ref CatalogItem. The format can be arbitrary */ void setCatalogExtraData(const QStringList& data); /** set the header catalog item */ void setHeader(const CatalogItem& header); /** Set the character encoding used in the catalog file. */ void setCodec(QTextCodec* codec); /** start a new transaction. You should never call this method. */ void startTransaction(); /** commit the data in the current transaction. You should never call this method. */ void commitTransaction(); short _maxLineLength; short _trailingNewLines; int _errorLine; private: CatalogImportPluginPrivate* d; }; } #endif diff --git a/src/common/flowlayout.h b/src/common/flowlayout.h index 45e101c..22a251c 100644 --- a/src/common/flowlayout.h +++ b/src/common/flowlayout.h @@ -1,92 +1,93 @@ /* **************************************************************************** This file is part of Lokalize Copyright (C) 2007 by Nick Shaforostoff Copyright (C) 2004-2007 Trolltech ASA. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. In addition, as a special exception, the copyright holders give permission to link the code of this program with any edition of the Qt library by Trolltech AS, Norway (or with modified versions of Qt that use the same license as Qt), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than Qt. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. **************************************************************************** */ #ifndef FLOWLAYOUT_H #define FLOWLAYOUT_H #include "glossary.h" #include #include class QAction; /** * used in glossary and kross views * * copied from 'pretty' docs */ class FlowLayout: public QLayout { public: enum User { glossary, webquery, standard }; /** * c'tor for glossary view */ explicit FlowLayout(User user = standard, QWidget *signalingWidget = nullptr, const QVector& actions = QVector(), int margin = 0, int spacing = -1); ~FlowLayout() override; void addItem(QLayoutItem *item) override; Qt::Orientations expandingDirections() const override; bool hasHeightForWidth() const override; int heightForWidth(int) const override; int count() const override; QLayoutItem *itemAt(int index) const override; QSize minimumSize() const override; void setGeometry(const QRect &rect) override; QSize sizeHint() const override; QLayoutItem *takeAt(int index) override; /** * @param term is the term matched * @param entryId is index of entry in the Glossary list + * @param capFirst whether the first letter should be capitalized */ void addTerm(const QString& term, const QByteArray& entryId, bool capFirst = false); void clearTerms(); private: int doLayout(const QRect &rect, bool testOnly) const; QList itemList; int m_index; //of the nearest free label ; or the next index of btn QWidget *m_receiver; }; #endif diff --git a/src/common/termlabel.h b/src/common/termlabel.h index bf6eced..f2863ba 100644 --- a/src/common/termlabel.h +++ b/src/common/termlabel.h @@ -1,68 +1,64 @@ /* **************************************************************************** This file is part of Lokalize Copyright (C) 2007 by Nick Shaforostoff This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . **************************************************************************** */ #ifndef TERMLABEL_H #define TERMLABEL_H #include #include "glossary.h" #include "project.h" namespace GlossaryNS { /** * flowlayout item */ class TermLabel: public QLabel//QPushButton { Q_OBJECT public: explicit TermLabel(QAction* a = nullptr): m_capFirst(false), m_action(a) {} ~TermLabel() override {} /** * @param term is the term matched * @param entryId is a whole entry + * @param capFirst whether the first letter should be capitalized */ void setText(const QString& term, const QByteArray& entryId, bool capFirst); void mousePressEvent(QMouseEvent* /* event*/) override; public slots: void insert(); // bool event(QEvent *event); signals: void insertTerm(const QString&); private: QByteArray m_entryId; bool m_capFirst; QAction* m_action; //used only for shortcut purposes }; - - - - - } #endif diff --git a/src/webquery/webquerycontroller.h b/src/webquery/webquerycontroller.h index e2183ef..9779165 100644 --- a/src/webquery/webquerycontroller.h +++ b/src/webquery/webquerycontroller.h @@ -1,131 +1,130 @@ /***************************************************************************** This file is part of KAider Copyright (C) 2007 by Nick Shaforostoff This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. In addition, as a special exception, the copyright holders give permission to link the code of this program with any edition of the Qt library by Trolltech AS, Norway (or with modified versions of Qt that use the same license as Qt), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than Qt. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. **************************************************************************** */ #ifndef WEBQUERYCONTROLLER_H #define WEBQUERYCONTROLLER_H #include #include #include class Catalog; class WebQueryView; class QTextCodec; class KJob; struct CatalogData { QString msg; //used when the script asks for the same file but with another target language // e.g. it easier for machine to translate from russian to ukrainian than from english to ukrainian QString msg2; WebQueryView* webQueryView;//object to call slots }; /** * uses async http reading. * * currently one instance per script is used... */ class WebQueryController: public /*QThread*/QObject { Q_OBJECT public: explicit WebQueryController(const QString& name, QObject* parent); public slots: void query(const CatalogData& data); void slotDownloadResult(KJob*); signals: void addWebQueryResult(const QString&, const QString&); //These are for scripts: signals: void doQuery(); void postProcess(QString); //these are for scripts: public slots: QString msg(); QString filePath(); void setTwinLangFilePath(QString); QString twinLangMsg(); /** * Also may be used to get name of another html file (e.g. of a frame) * * @param url Lokalize escapes url before downloading * @param codec e.g. UTF-8 * @param rx RegExp that gives result in the first cap. * e.g. "
([^<]+)
" - * @param repeat whether func should be called again (frames) */ void doDownloadAndFilter(QString url, QString codec, QString rx/*, int repeat*/); void setResult(QString); /* // If emitted calls the update() scripting function // if available. void update();*/ // protected: // void run(); private: QQueue m_queue; bool m_running; QString m_name;//of the script file //QString urlStr QTextCodec* codec; QRegExp filter; // int repeat; // QMutex m_mutex; }; #endif