diff --git a/src/composer-ng/richtextcomposer.h b/src/composer-ng/richtextcomposer.h index e9167a4..793debf 100644 --- a/src/composer-ng/richtextcomposer.h +++ b/src/composer-ng/richtextcomposer.h @@ -1,154 +1,155 @@ /* Copyright (C) 2015-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPIMTEXTEDITRICHTEXTCOMPOSER_H #define KPIMTEXTEDITRICHTEXTCOMPOSER_H #include "kpimtextedit_export.h" #include class KActionCollection; namespace KPIMTextEdit { class RichTextComposerControler; class RichTextComposerActions; class RichTextExternalComposer; class RichTextComposerEmailQuoteHighlighter; /** * @brief The RichTextComposer class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT RichTextComposer : public KPIMTextEdit::RichTextEditor { Q_OBJECT public: explicit RichTextComposer(QWidget *parent = nullptr); ~RichTextComposer() override; enum Mode { Plain, ///< Plain text mode Rich ///< Rich text mode }; /** * @return The current text mode */ Q_REQUIRED_RESULT Mode textMode() const; /** * Enables word wrap. Words will be wrapped at the specified column. * * @param wrapColumn the column where words will be wrapped */ void enableWordWrap(int wrapColumn); /** * Disables word wrap. * Note that words are still wrapped at the end of the editor; no scrollbar * will appear. */ void disableWordWrap(); /** * @return the line number where the cursor is. This takes word-wrapping * into account. Line numbers start at 0. */ Q_REQUIRED_RESULT int linePosition() const; /** * @return the column number where the cursor is. */ Q_REQUIRED_RESULT int columnNumber() const; void forcePlainTextMarkup(bool force); void activateRichText(); void switchToPlainText(); void setTextOrHtml(const QString &text); Q_REQUIRED_RESULT QString textOrHtml() const; virtual void setHighlighterColors(KPIMTextEdit::RichTextComposerEmailQuoteHighlighter *highlighter); void setUseExternalEditor(bool use); void setExternalEditorPath(const QString &path); Q_REQUIRED_RESULT bool checkExternalEditorFinished(); void killExternalEditor(); //Redefine it for each apps virtual QString smartQuote(const QString &msg); //need by kmail void setQuotePrefixName(const QString "ePrefix); Q_REQUIRED_RESULT QString quotePrefixName() const; void setCursorPositionFromStart(unsigned int pos); Q_REQUIRED_RESULT int quoteLength(const QString &line, bool oneQuote = false) const; Q_REQUIRED_RESULT bool isLineQuoted(const QString &line) const; const QString defaultQuoteSign() const; void createActions(KActionCollection *ac); QVector richTextActionList() const; void setEnableActions(bool state); KPIMTextEdit::RichTextComposerControler *composerControler() const; KPIMTextEdit::RichTextExternalComposer *externalComposer() const; KPIMTextEdit::RichTextComposerActions *composerActions() const; void createHighlighter() override; virtual bool processAutoCorrection(QKeyEvent *event); public Q_SLOTS: void insertPlainTextImplementation(); void slotChangeInsertMode(); Q_SIGNALS: void insertModeChanged(); /** * Emitted whenever the text mode is changed. * * @param mode The new text mode */ void textModeChanged(KPIMTextEdit::RichTextComposer::Mode mode); /** * Emitted when the user uses the up arrow in the first line. The application * should then put the focus on the widget above the text edit. */ void focusUp(); void externalEditorStarted(); void externalEditorClosed(); void insertEmoticon(const QString &str); protected: void keyPressEvent(QKeyEvent *event) override; Sonnet::SpellCheckDecorator *createSpellCheckDecorator() override; void insertFromMimeData(const QMimeData *source) override; bool canInsertFromMimeData(const QMimeData *source) const override; void mouseReleaseEvent(QMouseEvent *event) override; void clearDecorator() override; void updateHighLighter() override; bool processKeyEvent(QKeyEvent *e); private: void slotTextModeChanged(KPIMTextEdit::RichTextComposer::Mode mode); void evaluateListSupport(QKeyEvent *event); void evaluateReturnKeySupport(QKeyEvent *event); class RichTextComposerPrivate; RichTextComposerPrivate *const d; }; } #endif // RICHTEXTCOMPOSER_H diff --git a/src/composer-ng/richtextcomposeractions.h b/src/composer-ng/richtextcomposeractions.h index 66bec55..9fe9488 100644 --- a/src/composer-ng/richtextcomposeractions.h +++ b/src/composer-ng/richtextcomposeractions.h @@ -1,63 +1,64 @@ /* Copyright (C) 2015-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPIMTEXTEDITRICHTEXTCOMPOSERACTIONS_H #define KPIMTEXTEDITRICHTEXTCOMPOSERACTIONS_H #include #include "kpimtextedit_export.h" #include "richtextcomposer.h" class KActionCollection; class QTextCharFormat; class QAction; namespace KPIMTextEdit { class RichTextComposerControler; /** * @brief The RichTextComposerActions class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT RichTextComposerActions : public QObject { Q_OBJECT public: explicit RichTextComposerActions(KPIMTextEdit::RichTextComposerControler *controler, QObject *parent = nullptr); ~RichTextComposerActions(); void createActions(KActionCollection *ac); Q_REQUIRED_RESULT int numberOfActions() const; Q_REQUIRED_RESULT QVector richTextActionList() const; void uncheckActionFormatPainter(); void updateActionStates(); void textModeChanged(KPIMTextEdit::RichTextComposer::Mode mode); public Q_SLOTS: void setActionsEnabled(bool enabled); private: void slotUpdateCharFormatActions(const QTextCharFormat &format); void slotUpdateMiscActions(); void setListStyle(int _styleindex); class RichTextComposerActionsPrivate; RichTextComposerActionsPrivate *const d; }; } #endif // RICHTEXTCOMPOSERACTIONS_H diff --git a/src/composer-ng/richtextcomposercontroler.h b/src/composer-ng/richtextcomposercontroler.h index a2065cd..e3d6ada 100644 --- a/src/composer-ng/richtextcomposercontroler.h +++ b/src/composer-ng/richtextcomposercontroler.h @@ -1,110 +1,111 @@ /* Copyright (C) 2015-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPIMTEXTEDITRICHTEXTCOMPOSERCONTROLER_H #define KPIMTEXTEDITRICHTEXTCOMPOSERCONTROLER_H #include #include "richtextcomposer.h" #include "kpimtextedit_export.h" namespace KPIMTextEdit { class RichTextComposer; class NestedListHelper; class RichTextComposerImages; /** * @brief The RichTextComposerControler class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT RichTextComposerControler : public QObject { Q_OBJECT public: explicit RichTextComposerControler(RichTextComposer *richtextComposer, QObject *parent = nullptr); ~RichTextComposerControler(); Q_REQUIRED_RESULT RichTextComposer *richTextComposer() const; Q_REQUIRED_RESULT QString currentLinkUrl() const; Q_REQUIRED_RESULT QString currentLinkText() const; void selectLinkText() const; Q_REQUIRED_RESULT QString toCleanHtml() const; Q_REQUIRED_RESULT bool canIndentList() const; Q_REQUIRED_RESULT bool canDedentList() const; Q_REQUIRED_RESULT NestedListHelper *nestedListHelper() const; void insertShareLink(const QString &url); void insertLink(const QString &url); void setCursorPositionFromStart(unsigned int pos); void ensureCursorVisible(); RichTextComposerImages *composerImages() const; Q_REQUIRED_RESULT bool painterActive() const; void disablePainter(); bool isFormattingUsed() const; void setFontForWholeText(const QFont &font); void textModeChanged(KPIMTextEdit::RichTextComposer::Mode mode); void updateLink(const QString &linkUrl, const QString &linkText); Q_REQUIRED_RESULT QString toWrappedPlainText(QTextDocument *doc) const; Q_REQUIRED_RESULT QString toWrappedPlainText() const; Q_REQUIRED_RESULT QString toCleanPlainText(const QString &plainText = QString()) const; void addQuotes(const QString &defaultQuote); public Q_SLOTS: void insertHorizontalRule(); void alignLeft(); void alignCenter(); void alignRight(); void alignJustify(); void makeRightToLeft(); void makeLeftToRight(); void setTextBold(bool bold); void setTextItalic(bool italic); void setTextUnderline(bool underline); void setTextStrikeOut(bool strikeOut); void setTextForegroundColor(const QColor &color); void setTextBackgroundColor(const QColor &color); void setFontFamily(const QString &fontFamily); void setFontSize(int size); void setFont(const QFont &font); void setTextSuperScript(bool superscript); void setTextSubScript(bool subscript); void setChangeTextForegroundColor(); void setChangeTextBackgroundColor(); void manageLink(); void indentListMore(); void indentListLess(); void setListStyle(int styleIndex); void slotAddEmoticon(const QString &text); void slotInsertHtml(); void slotFormatReset(); void slotDeleteLine(); void slotPasteWithoutFormatting(); void slotPasteAsQuotation(); void slotRemoveQuotes(); void slotAddQuotes(); void slotAddImage(); void slotFormatPainter(bool active); void ensureCursorVisibleDelayed(); private: class RichTextComposerControlerPrivate; RichTextComposerControlerPrivate *const d; }; } #endif // RICHTEXTCOMPOSERCONTROLER_H diff --git a/src/composer-ng/richtextcomposeremailquotedecorator.h b/src/composer-ng/richtextcomposeremailquotedecorator.h index f7e624f..8633819 100644 --- a/src/composer-ng/richtextcomposeremailquotedecorator.h +++ b/src/composer-ng/richtextcomposeremailquotedecorator.h @@ -1,45 +1,46 @@ /* Copyright (C) 2015-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPIMTEXTEDITRICHTEXTCOMPOSEREMAILQUOTEDECORATOR_H #define KPIMTEXTEDITRICHTEXTCOMPOSEREMAILQUOTEDECORATOR_H #include #include "kpimtextedit_export.h" namespace KPIMTextEdit { class RichTextComposer; /** * @brief The RichTextComposerEmailQuoteDecorator class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT RichTextComposerEmailQuoteDecorator : public Sonnet::SpellCheckDecorator { public: explicit RichTextComposerEmailQuoteDecorator(RichTextComposer *textEdit); ~RichTextComposerEmailQuoteDecorator() override; protected: bool isSpellCheckingEnabledForBlock(const QString &blockText) const override; private: class RichTextComposerEmailQuoteDecoratorPrivate; RichTextComposerEmailQuoteDecoratorPrivate *const d; }; } #endif // RICHTEXTCOMPOSEREMAILQUOTEDECORATOR_H diff --git a/src/composer-ng/richtextcomposerwidget.h b/src/composer-ng/richtextcomposerwidget.h index 9feaebd..1b9075d 100644 --- a/src/composer-ng/richtextcomposerwidget.h +++ b/src/composer-ng/richtextcomposerwidget.h @@ -1,45 +1,46 @@ /* Copyright (C) 2015-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef RICHTEXTCOMPOSERWIDGET_H #define RICHTEXTCOMPOSERWIDGET_H #include #include "kpimtextedit_export.h" namespace KPIMTextEdit { class RichTextComposerWidgetPrivate; class RichTextComposer; /** * @brief The RichTextComposerWidget class + * @author Laurent Montel * @since 5.2 */ class KPIMTEXTEDIT_EXPORT RichTextComposerWidget : public QWidget { Q_OBJECT public: explicit RichTextComposerWidget(QWidget *parent = nullptr); ~RichTextComposerWidget(); Q_REQUIRED_RESULT KPIMTextEdit::RichTextComposer *richTextComposer() const; private: RichTextComposerWidgetPrivate *const d; }; } #endif // RICHTEXTCOMPOSERWIDGET_H diff --git a/src/composer-ng/richtextexternalcomposer.h b/src/composer-ng/richtextexternalcomposer.h index aae7f00..0912d46 100644 --- a/src/composer-ng/richtextexternalcomposer.h +++ b/src/composer-ng/richtextexternalcomposer.h @@ -1,62 +1,63 @@ /* Copyright (C) 2015-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPIMTEXTEDITRICHTEXTEXTERNALCOMPOSER_H #define KPIMTEXTEDITRICHTEXTEXTERNALCOMPOSER_H #include "kpimtextedit_export.h" #include #include namespace KPIMTextEdit { class RichTextComposer; /** * @brief The RichTextExternalComposer class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT RichTextExternalComposer : public QObject { Q_OBJECT public: explicit RichTextExternalComposer(RichTextComposer *composer, QObject *parent = nullptr); ~RichTextExternalComposer(); Q_REQUIRED_RESULT bool useExternalEditor() const; void setUseExternalEditor(bool value); void startExternalEditor(); void setExternalEditorPath(const QString &path); Q_REQUIRED_RESULT QString externalEditorPath() const; Q_REQUIRED_RESULT bool checkExternalEditorFinished(); void killExternalEditor(); Q_REQUIRED_RESULT bool isInProgress() const; Q_SIGNALS: void externalEditorClosed(); void externalEditorStarted(); private: void slotEditorFinished(int codeError, QProcess::ExitStatus exitStatus); class RichTextExternalComposerPrivate; RichTextExternalComposerPrivate *const d; }; } #endif // RICHTEXTEXTERNALCOMPOSER_H diff --git a/src/emoticon/emoticonunicodetab.h b/src/emoticon/emoticonunicodetab.h index 45843d7..3bf1dcf 100644 --- a/src/emoticon/emoticonunicodetab.h +++ b/src/emoticon/emoticonunicodetab.h @@ -1,49 +1,50 @@ /* Copyright (c) 2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef EMOTICONUNICODETAB_H #define EMOTICONUNICODETAB_H #include #include "kpimtextedit_export.h" namespace KPIMTextEdit { /** * @brief The EmoticonUnicodeTab class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT EmoticonUnicodeTab : public QTabWidget { Q_OBJECT public: explicit EmoticonUnicodeTab(QWidget *parent = nullptr); ~EmoticonUnicodeTab(); void loadEmoticons(); Q_SIGNALS: void itemSelected(const QString &); private: void createPlainTextEmoticonTab(const QString &str, const QList &emoticons); void createPlainTextEmoticonTab(const QString &str, const QStringList &emoticons); }; } #endif // EMOTICONUNICODETAB_H diff --git a/src/selectspecialchardialog.h b/src/selectspecialchardialog.h index c56aeac..c35e94b 100644 --- a/src/selectspecialchardialog.h +++ b/src/selectspecialchardialog.h @@ -1,62 +1,63 @@ /* Copyright (c) 2012-2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPIMTEXTEDIT_SELECTSPECIAL_CHARDIALOG_H #define KPIMTEXTEDIT_SELECTSPECIAL_CHARDIALOG_H #include "kpimtextedit_export.h" #include namespace KPIMTextEdit { class SelectSpecialCharDialogPrivate; /** * @brief The SelectSpecialCharDialog class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT SelectSpecialCharDialog : public QDialog { Q_OBJECT public: explicit SelectSpecialCharDialog(QWidget *parent); ~SelectSpecialCharDialog(); void setCurrentChar(QChar c); Q_REQUIRED_RESULT QChar currentChar() const; void setOkButtonText(const QString &text); void showSelectButton(bool show); /* * When we double click we call accept */ void autoInsertChar(); Q_SIGNALS: void charSelected(QChar); private: SelectSpecialCharDialogPrivate *const d; friend class SelectSpecialCharDialogPrivate; void readConfig(); void writeConfig(); }; } #endif // KPIMTEXTEDIT_SELECTSPECIAL_CHAR_H diff --git a/src/texteditor/commonwidget/texteditfindbarbase.h b/src/texteditor/commonwidget/texteditfindbarbase.h index 5a17910..40916c7 100644 --- a/src/texteditor/commonwidget/texteditfindbarbase.h +++ b/src/texteditor/commonwidget/texteditfindbarbase.h @@ -1,102 +1,103 @@ /* Copyright (C) 2013-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef TEXTEDITFINDBARBASE_H #define TEXTEDITFINDBARBASE_H #include "kpimtextedit_export.h" #include #include #if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) #include #endif namespace KPIMTextEdit { class TextFindWidget; class TextReplaceWidget; /** * @brief The TextEditFindBarBase class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT TextEditFindBarBase : public QWidget { Q_OBJECT public: explicit TextEditFindBarBase(QWidget *parent = nullptr); ~TextEditFindBarBase() override; Q_REQUIRED_RESULT QString text() const; void setText(const QString &text); void focusAndSetCursor(); void showReplace(); void showFind(); void setHideWhenClose(bool hide); Q_SIGNALS: void displayMessageIndicator(const QString &message); void hideFindBar(); protected: virtual bool viewIsReadOnly() const = 0; virtual bool documentIsEmpty() const = 0; virtual bool searchInDocument(const QString &text, QTextDocument::FindFlags searchOptions) = 0; #if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) virtual bool searchInDocument(const QRegExp ®Exp, QTextDocument::FindFlags searchOptions) = 0; #else virtual bool searchInDocument(const QRegularExpression ®Exp, QTextDocument::FindFlags searchOptions) = 0; #endif virtual void autoSearchMoveCursor() = 0; bool event(QEvent *e) override; void clearSelections(); void updateHighLight(bool); bool searchText(bool backward, bool isAutoSearch); void updateSensitivity(bool); void setFoundMatch(bool match); void messageInfo(bool backward, bool isAutoSearch, bool found); public Q_SLOTS: void findNext(); void findPrev(); void autoSearch(const QString &str); virtual void slotSearchText(bool backward = false, bool isAutoSearch = true) = 0; void closeBar(); private Q_SLOTS: void slotClearSearch(); void slotUpdateSearchOptions(); virtual void slotReplaceText() = 0; virtual void slotReplaceAllText() = 0; protected: QString mLastSearchStr; #if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) QRegExp mLastSearchRegExp; #else QRegularExpression mLastSearchRegExp; #endif TextFindWidget *mFindWidget = nullptr; TextReplaceWidget *mReplaceWidget = nullptr; bool mHideWhenClose = true; }; } #endif // TEXTEDITFINDBARBASE_H diff --git a/src/texteditor/commonwidget/textgotolinewidget.h b/src/texteditor/commonwidget/textgotolinewidget.h index 7c36407..0b7fc00 100644 --- a/src/texteditor/commonwidget/textgotolinewidget.h +++ b/src/texteditor/commonwidget/textgotolinewidget.h @@ -1,60 +1,61 @@ /* Copyright (C) 2014-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef TEXTGOTOLINEWIDGET_H #define TEXTGOTOLINEWIDGET_H #include "kpimtextedit_export.h" #include namespace KPIMTextEdit { class TextGoToLineWidgetPrivate; /** * @brief The TextGoToLineWidget class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT TextGoToLineWidget : public QWidget { Q_OBJECT public: explicit TextGoToLineWidget(QWidget *parent = nullptr); ~TextGoToLineWidget() override; void goToLine(); void setMaximumLineCount(int max); Q_SIGNALS: void moveToLine(int); void hideGotoLine(); protected: bool event(QEvent *e) override; void showEvent(QShowEvent *e) override; public Q_SLOTS: void slotBlockCountChanged(int numberBlockCount); private Q_SLOTS: void slotCloseBar(); void slotGoToLine(); private: TextGoToLineWidgetPrivate *const d; }; } #endif // TEXTGOTOLINEWIDGET_H diff --git a/src/texteditor/commonwidget/textmessageindicator.h b/src/texteditor/commonwidget/textmessageindicator.h index cfbd0ab..84f1f03 100644 --- a/src/texteditor/commonwidget/textmessageindicator.h +++ b/src/texteditor/commonwidget/textmessageindicator.h @@ -1,64 +1,65 @@ /* Copyright (C) 2014-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef TEXTMESSAGEINDICATOR_H #define TEXTMESSAGEINDICATOR_H #include class QTimer; namespace KPIMTextEdit { /** * @short A widget that displays messages in the top-left corner. * * This is a widget with thin border and rounded corners that displays a given * text along as an icon. It's meant to be used for displaying messages to the * user by placing this above other widgets. + * @author Laurent Montel */ class TextMessageIndicator : public QWidget { Q_OBJECT public: explicit TextMessageIndicator(QWidget *parent = nullptr); enum Icon { None, Info, Warning, Error }; void display(const QString &message, const QString &details = QString(), Icon icon = None, int durationMs = 4000); protected: bool eventFilter(QObject *obj, QEvent *event) override; void paintEvent(QPaintEvent *e) override; void mousePressEvent(QMouseEvent *e) override; private: QRect computeTextRect(const QString &message, int extra_width) const; void computeSizeAndResize(); QString mMessage; QString mDetails; QPixmap mSymbol; QTimer *mTimer = nullptr; int mLineSpacing = 0; }; } #endif // TEXTMESSAGEINDICATOR_H diff --git a/src/texteditor/plaintexteditor/plaintexteditfindbar.h b/src/texteditor/plaintexteditor/plaintexteditfindbar.h index cdd4def..7fc6ad1 100644 --- a/src/texteditor/plaintexteditor/plaintexteditfindbar.h +++ b/src/texteditor/plaintexteditor/plaintexteditfindbar.h @@ -1,64 +1,65 @@ /* Copyright (C) 2012-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPIMTEXTEDIT_FINDBARBASE_H #define KPIMTEXTEDIT_FINDBARBASE_H #include "kpimtextedit_export.h" #include "kpimtextedit/texteditfindbarbase.h" #include class QPlainTextEdit; namespace KPIMTextEdit { class PlainTextEditFindBarPrivate; /** * @brief The PlainTextEditFindBar class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT PlainTextEditFindBar : public TextEditFindBarBase { Q_OBJECT public: explicit PlainTextEditFindBar(QPlainTextEdit *view, QWidget *parent = nullptr); ~PlainTextEditFindBar() override; protected: bool viewIsReadOnly() const override; bool documentIsEmpty() const override; bool searchInDocument(const QString &text, QTextDocument::FindFlags searchOptions) override; #if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) bool searchInDocument(const QRegExp ®Exp, QTextDocument::FindFlags searchOptions) override; #else bool searchInDocument(const QRegularExpression ®Exp, QTextDocument::FindFlags searchOptions) override; #endif void autoSearchMoveCursor() override; public Q_SLOTS: void slotSearchText(bool backward = false, bool isAutoSearch = true) override; private Q_SLOTS: void slotReplaceText() override; void slotReplaceAllText() override; private: PlainTextEditFindBarPrivate *const d; }; } #endif diff --git a/src/texteditor/plaintexteditor/plaintexteditor.h b/src/texteditor/plaintexteditor/plaintexteditor.h index aa1a2d1..f2e3b7a 100644 --- a/src/texteditor/plaintexteditor/plaintexteditor.h +++ b/src/texteditor/plaintexteditor/plaintexteditor.h @@ -1,133 +1,134 @@ /* Copyright (C) 2013-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef PLAINTEXTEDITOR_H #define PLAINTEXTEDITOR_H #include "kpimtextedit_export.h" #include namespace Sonnet { class Highlighter; class SpellCheckDecorator; } namespace KPIMTextEdit { /** * @brief The PlainTextEditor class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT PlainTextEditor : public QPlainTextEdit { Q_OBJECT Q_PROPERTY(bool searchSupport READ searchSupport WRITE setSearchSupport) Q_PROPERTY(bool spellCheckingSupport READ spellCheckingSupport WRITE setSpellCheckingSupport) Q_PROPERTY(bool textToSpeechSupport READ textToSpeechSupport WRITE setTextToSpeechSupport) Q_PROPERTY(bool webShortcutSupport READ webShortcutSupport WRITE setWebShortcutSupport) public: explicit PlainTextEditor(QWidget *parent = nullptr); ~PlainTextEditor() override; enum SupportFeature { None = 0, Search = 1, SpellChecking = 2, TextToSpeech = 4, AllowWebShortcut = 8 }; Q_DECLARE_FLAGS(SupportFeatures, SupportFeature) void setSearchSupport(bool b); Q_REQUIRED_RESULT bool searchSupport() const; Q_REQUIRED_RESULT bool spellCheckingSupport() const; void setSpellCheckingSupport(bool check); virtual void setReadOnly(bool readOnly); void setTextToSpeechSupport(bool b); Q_REQUIRED_RESULT bool textToSpeechSupport() const; void setWebShortcutSupport(bool b); Q_REQUIRED_RESULT bool webShortcutSupport() const; virtual void createHighlighter(); void addIgnoreWords(const QStringList &lst); Q_REQUIRED_RESULT bool activateLanguageMenu() const; void setActivateLanguageMenu(bool activate); Q_REQUIRED_RESULT Sonnet::Highlighter *highlighter() const; bool checkSpellingEnabled() const; void setCheckSpellingEnabled(bool check); void setSpellCheckingConfigFileName(const QString &_fileName); Q_REQUIRED_RESULT QString spellCheckingConfigFileName() const; const QString &spellCheckingLanguage() const; void setSpellCheckingLanguage(const QString &_language); public Q_SLOTS: void slotDisplayMessageIndicator(const QString &message); void slotCheckSpelling(); void slotSpeakText(); void slotZoomReset(); private Q_SLOTS: void slotUndoableClear(); void slotSpellCheckerMisspelling(const QString &text, int pos); void slotSpellCheckerCorrected(const QString &, int, const QString &); void slotSpellCheckerAutoCorrect(const QString &, const QString &); void slotSpellCheckerCanceled(); void slotSpellCheckerFinished(); void slotLanguageSelected(); void slotToggleAutoSpellCheck(); protected: virtual void addExtraMenuEntry(QMenu *menu, QPoint pos); protected: void contextMenuEvent(QContextMenuEvent *event) override; bool event(QEvent *ev) override; void keyPressEvent(QKeyEvent *event) override; bool overrideShortcut(QKeyEvent *event); bool handleShortcut(QKeyEvent *event); void wheelEvent(QWheelEvent *event) override; virtual Sonnet::SpellCheckDecorator *createSpellCheckDecorator(); void setHighlighter(Sonnet::Highlighter *_highLighter); void focusInEvent(QFocusEvent *event) override; virtual void updateHighLighter(); virtual void clearDecorator(); Q_SIGNALS: void findText(); void replaceText(); void spellCheckerAutoCorrect(const QString ¤tWord, const QString &autoCorrectWord); void checkSpellingChanged(bool); void languageChanged(const QString &); void spellCheckStatus(const QString &); void say(const QString &text); private: void addIgnoreWordsToHighLighter(); void deleteWordBack(); void deleteWordForward(); void highlightWord(int length, int pos); void deleteEndOfLine(); void moveLineUpDown(bool moveUp); class PlainTextEditorPrivate; PlainTextEditorPrivate *const d; }; } #endif // PLAINTEXTEDITOR_H diff --git a/src/texteditor/plaintexteditor/plaintexteditorwidget.h b/src/texteditor/plaintexteditor/plaintexteditorwidget.h index b9e0d38..5907e19 100644 --- a/src/texteditor/plaintexteditor/plaintexteditorwidget.h +++ b/src/texteditor/plaintexteditor/plaintexteditorwidget.h @@ -1,64 +1,65 @@ /* Copyright (C) 2013-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef PLAINTEXTEDITORWIDGET_H #define PLAINTEXTEDITORWIDGET_H #include "kpimtextedit_export.h" #include namespace KPIMTextEdit { class PlainTextEditor; class PlainTextEditorWidgetPrivate; /** * @brief The PlainTextEditorWidget class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT PlainTextEditorWidget : public QWidget { Q_OBJECT Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) public: explicit PlainTextEditorWidget(QWidget *parent = nullptr); explicit PlainTextEditorWidget(PlainTextEditor *customEditor, QWidget *parent = nullptr); ~PlainTextEditorWidget(); Q_REQUIRED_RESULT PlainTextEditor *editor() const; void setReadOnly(bool readOnly); Q_REQUIRED_RESULT bool isReadOnly() const; void setPlainText(const QString &text); Q_REQUIRED_RESULT QString toPlainText() const; void clear(); void setSpellCheckingConfigFileName(const QString &_fileName); Q_REQUIRED_RESULT bool isEmpty() const; private Q_SLOTS: void slotFind(); void slotReplace(); void slotHideFindBar(); private: void init(PlainTextEditor *customEditor = nullptr); PlainTextEditorWidgetPrivate *const d; }; } #endif // PLAINTEXTEDITORWIDGET_H diff --git a/src/texteditor/plaintexteditor/plaintextsyntaxspellcheckinghighlighter.h b/src/texteditor/plaintexteditor/plaintextsyntaxspellcheckinghighlighter.h index ef7aace..f983cbf 100644 --- a/src/texteditor/plaintexteditor/plaintextsyntaxspellcheckinghighlighter.h +++ b/src/texteditor/plaintexteditor/plaintextsyntaxspellcheckinghighlighter.h @@ -1,74 +1,75 @@ /* Copyright (C) 2015-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef PLAINTEXTSYNTAXSPELLCHECKINGHIGHLIGHTER_H #define PLAINTEXTSYNTAXSPELLCHECKINGHIGHLIGHTER_H #include "kpimtextedit_export.h" #include #include namespace KSyntaxHighlighting { class Format; } namespace KPIMTextEdit { class PlainTextEditor; class PlainTextSyntaxSpellCheckingHighlighterPrivate; /** * @brief The PlainTextSyntaxSpellCheckingHighlighter class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT PlainTextSyntaxSpellCheckingHighlighter : public Sonnet::Highlighter, public KSyntaxHighlighting::AbstractHighlighter { public: explicit PlainTextSyntaxSpellCheckingHighlighter(PlainTextEditor *plainText, const QColor &misspelledColor = Qt::red); ~PlainTextSyntaxSpellCheckingHighlighter() override; void toggleSpellHighlighting(bool on); void setDefinition(const KSyntaxHighlighting::Definition &def) override; /** * Reimplemented to highlight quote blocks. */ void highlightBlock(const QString &text) override; protected: /** * Reimplemented, the base version sets the text color to black, which * is not what we want. We do nothing, the format is already reset by * Qt. * @param start the beginning of text * @param count the amount of characters to set */ void unsetMisspelled(int start, int count) override; /** * Reimplemented to set the color of the misspelled word to a color * defined by setQuoteColor(). */ void setMisspelled(int start, int count) override; void applyFormat(int offset, int length, const KSyntaxHighlighting::Format &format) override; private: PlainTextSyntaxSpellCheckingHighlighterPrivate *const d; }; } #endif // PLAINTEXTSYNTAXSPELLCHECKINGHIGHLIGHTER_H diff --git a/src/texteditor/richtexteditor/richtexteditfindbar.h b/src/texteditor/richtexteditor/richtexteditfindbar.h index 1f35ace..e189164 100644 --- a/src/texteditor/richtexteditor/richtexteditfindbar.h +++ b/src/texteditor/richtexteditor/richtexteditfindbar.h @@ -1,63 +1,64 @@ /* Copyright (C) 2013-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef RICHTEXTEDITFINDBAR_H #define RICHTEXTEDITFINDBAR_H #include "kpimtextedit_export.h" #include "texteditor/commonwidget/texteditfindbarbase.h" #include class QTextEdit; namespace KPIMTextEdit { class RichTextEditFindBarPrivate; /** * @brief The RichTextEditFindBar class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT RichTextEditFindBar : public TextEditFindBarBase { Q_OBJECT public: explicit RichTextEditFindBar(QTextEdit *view, QWidget *parent = nullptr); ~RichTextEditFindBar() override; protected: bool viewIsReadOnly() const override; bool documentIsEmpty() const override; bool searchInDocument(const QString &text, QTextDocument::FindFlags searchOptions) override; #if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) bool searchInDocument(const QRegExp ®Exp, QTextDocument::FindFlags searchOptions) override; #else bool searchInDocument(const QRegularExpression ®Exp, QTextDocument::FindFlags searchOptions) override; #endif void autoSearchMoveCursor() override; public Q_SLOTS: void slotSearchText(bool backward = false, bool isAutoSearch = true) override; private Q_SLOTS: void slotReplaceText() override; void slotReplaceAllText() override; private: RichTextEditFindBarPrivate *const d; }; } #endif // RICHTEXTEDITFINDBAR_H diff --git a/src/texteditor/richtexteditor/richtexteditor.h b/src/texteditor/richtexteditor/richtexteditor.h index 00fb977..5bc433c 100644 --- a/src/texteditor/richtexteditor/richtexteditor.h +++ b/src/texteditor/richtexteditor/richtexteditor.h @@ -1,158 +1,159 @@ /* Copyright (C) 2013-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef RICHTEXTEDITOR_H #define RICHTEXTEDITOR_H #include "kpimtextedit_export.h" #include class QContextMenuEvent; class QMenu; namespace Sonnet { class Highlighter; class SpellCheckDecorator; } namespace KPIMTextEdit { /** * @brief The RichTextEditor class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT RichTextEditor : public QTextEdit { Q_OBJECT Q_PROPERTY(bool searchSupport READ searchSupport WRITE setSearchSupport) Q_PROPERTY(bool spellCheckingSupport READ spellCheckingSupport WRITE setSpellCheckingSupport) Q_PROPERTY(bool textToSpeechSupport READ textToSpeechSupport WRITE setTextToSpeechSupport) Q_PROPERTY(bool activateLanguageMenu READ activateLanguageMenu WRITE setActivateLanguageMenu) Q_PROPERTY(bool tabSupport READ allowTabSupport WRITE setAllowTabSupport) Q_PROPERTY(bool webShortcutSupport READ webShortcutSupport WRITE setWebShortcutSupport) public: explicit RichTextEditor(QWidget *parent = nullptr); ~RichTextEditor() override; enum SupportFeature { None = 0, Search = 1, SpellChecking = 2, TextToSpeech = 4, AllowTab = 8, AllowWebShortcut = 16 }; Q_DECLARE_FLAGS(SupportFeatures, SupportFeature) void setSearchSupport(bool b); Q_REQUIRED_RESULT bool searchSupport() const; Q_REQUIRED_RESULT bool spellCheckingSupport() const; void setSpellCheckingSupport(bool check); void setSpellCheckingConfigFileName(const QString &_fileName); bool checkSpellingEnabled() const; void setCheckSpellingEnabled(bool check); void setSpellCheckingLanguage(const QString &_language); const QString &spellCheckingLanguage() const; virtual void setReadOnly(bool readOnly); virtual void createHighlighter(); Q_REQUIRED_RESULT bool textToSpeechSupport() const; void setTextToSpeechSupport(bool b); Q_REQUIRED_RESULT Sonnet::Highlighter *highlighter() const; Q_REQUIRED_RESULT bool activateLanguageMenu() const; void setActivateLanguageMenu(bool activate); void setAllowTabSupport(bool b); Q_REQUIRED_RESULT bool allowTabSupport() const; void setShowAutoCorrectButton(bool b); Q_REQUIRED_RESULT bool showAutoCorrectButton() const; void forceSpellChecking(); Q_REQUIRED_RESULT QString spellCheckingConfigFileName() const; void setWebShortcutSupport(bool b); Q_REQUIRED_RESULT bool webShortcutSupport() const; void addIgnoreWords(const QStringList &lst); // Reimplement it in subclass virtual void forceAutoCorrection(bool selectedText = false); void setDefaultFontSize(int val); int zoomFactor() const; Q_SIGNALS: void say(const QString &text); public Q_SLOTS: void slotDisplayMessageIndicator(const QString &message); void slotSpeakText(); void slotCheckSpelling(); void slotZoomReset(); protected: virtual void addExtraMenuEntry(QMenu *menu, QPoint pos); void contextMenuEvent(QContextMenuEvent *event) override; void focusInEvent(QFocusEvent *event) override; bool event(QEvent *ev) override; void keyPressEvent(QKeyEvent *event) override; void wheelEvent(QWheelEvent *e) override; QMenu *mousePopupMenu(QPoint pos); virtual Sonnet::SpellCheckDecorator *createSpellCheckDecorator(); void setHighlighter(Sonnet::Highlighter *_highLighter); virtual void updateHighLighter(); virtual void clearDecorator(); Q_SIGNALS: void findText(); void replaceText(); void spellCheckerAutoCorrect(const QString ¤tWord, const QString &autoCorrectWord); void checkSpellingChanged(bool); void languageChanged(const QString &); void spellCheckStatus(const QString &); void spellCheckingFinished(); void spellCheckingCanceled(); private: void slotUndoableClear(); void slotSpellCheckerMisspelling(const QString &text, int pos); void slotSpellCheckerCorrected(const QString &, int, const QString &); void slotSpellCheckerAutoCorrect(const QString &, const QString &); void slotSpellCheckerCanceled(); void slotSpellCheckerFinished(); void slotToggleAutoSpellCheck(); void slotLanguageSelected(); void slotAllowTab(); void addIgnoreWordsToHighLighter(); bool handleShortcut(QKeyEvent *event); bool overrideShortcut(QKeyEvent *event); void deleteWordBack(); void deleteWordForward(); void highlightWord(int length, int pos); void checkSpelling(bool force); void moveLineUpDown(bool moveUp); class RichTextEditorPrivate; RichTextEditorPrivate *const d; }; } #endif // RICHTEXTEDITOR_H diff --git a/src/texteditor/richtexteditor/richtexteditorwidget.h b/src/texteditor/richtexteditor/richtexteditorwidget.h index ed2c0c7..537b162 100644 --- a/src/texteditor/richtexteditor/richtexteditorwidget.h +++ b/src/texteditor/richtexteditor/richtexteditorwidget.h @@ -1,74 +1,75 @@ /* Copyright (C) 2013-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef RICHTEXTEDITORWIDGET_H #define RICHTEXTEDITORWIDGET_H #include "kpimtextedit_export.h" #include namespace KPIMTextEdit { class RichTextEditor; class RichTextEditorWidgetPrivate; /** * @brief The RichTextEditorWidget class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT RichTextEditorWidget : public QWidget { Q_OBJECT Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) public: explicit RichTextEditorWidget(QWidget *parent = nullptr); explicit RichTextEditorWidget(RichTextEditor *customEditor, QWidget *parent = nullptr); ~RichTextEditorWidget(); void clear(); Q_REQUIRED_RESULT RichTextEditor *editor() const; void setReadOnly(bool readOnly); bool isReadOnly() const; void setHtml(const QString &html); Q_REQUIRED_RESULT QString toHtml() const; void setPlainText(const QString &text); Q_REQUIRED_RESULT QString toPlainText() const; void setAcceptRichText(bool b); bool acceptRichText() const; void setSpellCheckingConfigFileName(const QString &_fileName); Q_REQUIRED_RESULT bool isEmpty() const; public Q_SLOTS: void slotFindNext(); void slotFind(); void slotReplace(); private: void slotHideFindBar(); void init(RichTextEditor *customEditor = nullptr); RichTextEditorWidgetPrivate *const d; }; } #endif // RICHTEXTEDITORWIDGET_H diff --git a/src/texteditorcompleter.h b/src/texteditorcompleter.h index c193d7c..448c3ed 100644 --- a/src/texteditorcompleter.h +++ b/src/texteditorcompleter.h @@ -1,56 +1,57 @@ /* * Copyright (C) 2015-2019 Laurent Montel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef TEXTEDITORCOMPLETER_H #define TEXTEDITORCOMPLETER_H #include #include "kpimtextedit_export.h" class QCompleter; class QTextEdit; class QPlainTextEdit; namespace KPIMTextEdit { /** * @brief The TextEditorCompleter class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT TextEditorCompleter : public QObject { Q_OBJECT public: explicit TextEditorCompleter(QTextEdit *editor, QObject *parent); explicit TextEditorCompleter(QPlainTextEdit *editor, QObject *parent); ~TextEditorCompleter(); void setCompleterStringList(const QStringList &list); Q_REQUIRED_RESULT QCompleter *completer() const; void completeText(); void setExcludeOfCharacters(const QString &excludes); private: void slotCompletion(const QString &text); class TextEditorCompleterPrivate; TextEditorCompleterPrivate *const d; }; } #endif // TEXTEDITORCOMPLETER_H diff --git a/src/texttospeech/abstracttexttospeechconfiginterface.h b/src/texttospeech/abstracttexttospeechconfiginterface.h index e0c2add..a2cdf53 100644 --- a/src/texttospeech/abstracttexttospeechconfiginterface.h +++ b/src/texttospeech/abstracttexttospeechconfiginterface.h @@ -1,47 +1,48 @@ /* Copyright (C) 2014-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef ABSTRACTTEXTTOSPEECHCONFIGINTERFACE_H #define ABSTRACTTEXTTOSPEECHCONFIGINTERFACE_H #include #include #include #include "kpimtextedit_export.h" namespace KPIMTextEdit { /** * @brief The AbstractTextToSpeechConfigInterface class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT AbstractTextToSpeechConfigInterface : public QObject { Q_OBJECT public: explicit AbstractTextToSpeechConfigInterface(QObject *parent = nullptr); ~AbstractTextToSpeechConfigInterface(); virtual QVector availableLocales() const; virtual QLocale locale() const; virtual void setLocale(const QLocale &locale); virtual QStringList availableEngines() const; virtual QStringList availableVoices() const; virtual void setEngine(const QString &engineName); }; } #endif // ABSTRACTTEXTTOSPEECHCONFIGINTERFACE_H diff --git a/src/texttospeech/abstracttexttospeechinterface.h b/src/texttospeech/abstracttexttospeechinterface.h index b86f900..c5e2ac7 100644 --- a/src/texttospeech/abstracttexttospeechinterface.h +++ b/src/texttospeech/abstracttexttospeechinterface.h @@ -1,43 +1,44 @@ /* Copyright (C) 2014-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef ABSTRACTTEXTTOSPEECHINTERFACE_H #define ABSTRACTTEXTTOSPEECHINTERFACE_H #include "kpimtextedit_export.h" #include namespace KPIMTextEdit { /** * @brief The AbstractTextToSpeechInterface class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT AbstractTextToSpeechInterface : public QObject { Q_OBJECT public: explicit AbstractTextToSpeechInterface(QObject *parent = nullptr); ~AbstractTextToSpeechInterface(); virtual bool isReady() const; virtual void say(const QString &text); virtual int volume() const; virtual void setVolume(int value); virtual void reloadSettings(); }; } #endif // ABSTRACTTEXTTOSPEECHINTERFACE_H diff --git a/src/texttospeech/texttospeech.h b/src/texttospeech/texttospeech.h index 30ab183..72ca9a5 100644 --- a/src/texttospeech/texttospeech.h +++ b/src/texttospeech/texttospeech.h @@ -1,81 +1,82 @@ /* Copyright (C) 2014-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef TEXTTOSPEECH_H #define TEXTTOSPEECH_H #include "kpimtextedit_export.h" #include class QTextToSpeech; namespace KPIMTextEdit { /** * @brief The TextToSpeech class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT TextToSpeech : public QObject { Q_OBJECT public: static TextToSpeech *self(); ~TextToSpeech(); bool isReady() const; enum State { Ready = 0, Speaking, Paused, BackendError }; double volume() const; QVector availableLocales() const; QStringList availableEngines() const; QStringList availableVoices() const; QLocale locale() const; void reloadSettings(); public Q_SLOTS: void say(const QString &text); void stop(); void pause(); void resume(); void setRate(double rate); void setPitch(double pitch); void setVolume(double volume); void setLocale(const QLocale &locale) const; Q_SIGNALS: void stateChanged(TextToSpeech::State); private: void slotStateChanged(); explicit TextToSpeech(QObject *parent = nullptr); friend class TextToSpeechPrivate; QString mDefaultEngine; QTextToSpeech *mTextToSpeech = nullptr; }; } #endif // TEXTTOSPEECH_H diff --git a/src/texttospeech/texttospeechactions.h b/src/texttospeech/texttospeechactions.h index 5834cf3..4cae83e 100644 --- a/src/texttospeech/texttospeechactions.h +++ b/src/texttospeech/texttospeechactions.h @@ -1,58 +1,59 @@ /* Copyright (C) 2014-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef TEXTTOSPEECHACTIONS_H #define TEXTTOSPEECHACTIONS_H #include #include "kpimtextedit_export.h" #include "texttospeechwidget.h" class QAction; namespace KPIMTextEdit { class TextToSpeechActionsPrivate; /** * @brief The TextToSpeechActions class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT TextToSpeechActions : public QObject { Q_OBJECT public: explicit TextToSpeechActions(QObject *parent = nullptr); ~TextToSpeechActions(); QAction *stopAction() const; QAction *playPauseAction() const; TextToSpeechWidget::State state() const; public Q_SLOTS: void setState(TextToSpeechWidget::State); void slotStop(); Q_SIGNALS: void stateChanged(KPIMTextEdit::TextToSpeechWidget::State state); private: void slotPlayPause(); TextToSpeechActionsPrivate *const d; }; } #endif // TEXTTOSPEECHACTIONS_H diff --git a/src/texttospeech/texttospeechconfiginterface.h b/src/texttospeech/texttospeechconfiginterface.h index 7989d1d..87166df 100644 --- a/src/texttospeech/texttospeechconfiginterface.h +++ b/src/texttospeech/texttospeechconfiginterface.h @@ -1,47 +1,48 @@ /* Copyright (C) 2014-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef TEXTTOSPEECHCONFIGINTERFACE_H #define TEXTTOSPEECHCONFIGINTERFACE_H #include "abstracttexttospeechconfiginterface.h" #include "kpimtextedit_export.h" class QTextToSpeech; namespace KPIMTextEdit { /** * @brief The TextToSpeechConfigInterface class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT TextToSpeechConfigInterface : public AbstractTextToSpeechConfigInterface { Q_OBJECT public: explicit TextToSpeechConfigInterface(QObject *parent = nullptr); ~TextToSpeechConfigInterface() override; QVector availableLocales() const override; QLocale locale() const override; QStringList availableEngines() const override; QStringList availableVoices() const override; void setEngine(const QString &engineName) override; QTextToSpeech *mTextToSpeech = nullptr; }; } #endif // TEXTTOSPEECHCONFIGINTERFACE_H diff --git a/src/texttospeech/texttospeechinterface.h b/src/texttospeech/texttospeechinterface.h index fd65762..8ef7868 100644 --- a/src/texttospeech/texttospeechinterface.h +++ b/src/texttospeech/texttospeechinterface.h @@ -1,52 +1,53 @@ /* Copyright (C) 2014-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef TEXTTOSPEECHINTERFACE_H #define TEXTTOSPEECHINTERFACE_H #include #include "texttospeechwidget.h" #include "abstracttexttospeechinterface.h" #include "kpimtextedit_export.h" namespace KPIMTextEdit { class TextToSpeechWidget; class TextToSpeechInterfacePrivate; /** * @brief The TextToSpeechInterface class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT TextToSpeechInterface : public AbstractTextToSpeechInterface { Q_OBJECT public: explicit TextToSpeechInterface(TextToSpeechWidget *textToSpeechWidget, QObject *parent = nullptr); ~TextToSpeechInterface() override; bool isReady() const override; void say(const QString &text) override; Q_REQUIRED_RESULT int volume() const override; void setVolume(int value) override; void reloadSettings() override; private: void stateChanged(KPIMTextEdit::TextToSpeechWidget::State state); TextToSpeechInterfacePrivate *const d; }; } #endif // TEXTTOSPEECHINTERFACE_H diff --git a/src/texttospeech/texttospeechwidget.h b/src/texttospeech/texttospeechwidget.h index c51c280..7eae6ec 100644 --- a/src/texttospeech/texttospeechwidget.h +++ b/src/texttospeech/texttospeechwidget.h @@ -1,68 +1,69 @@ /* Copyright (C) 2014-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef TEXTTOSPEECHWIDGET_H #define TEXTTOSPEECHWIDGET_H #include #include "kpimtextedit_export.h" #include "texttospeech.h" namespace KPIMTextEdit { class AbstractTextToSpeechInterface; class TextToSpeechWidgetPrivate; /** * @brief The TextToSpeechWidget class + * @author Laurent Montel */ class KPIMTEXTEDIT_EXPORT TextToSpeechWidget : public QWidget { Q_OBJECT public: explicit TextToSpeechWidget(QWidget *parent = nullptr); ~TextToSpeechWidget(); enum State { Stop = 0, Play, Pause }; Q_ENUMS(State) Q_REQUIRED_RESULT State state() const; void setState(KPIMTextEdit::TextToSpeechWidget::State state); void setTextToSpeechInterface(AbstractTextToSpeechInterface *interface); Q_REQUIRED_RESULT bool isReady() const; public Q_SLOTS: void say(const QString &text); void slotStateChanged(KPIMTextEdit::TextToSpeech::State state); Q_SIGNALS: void stateChanged(KPIMTextEdit::TextToSpeechWidget::State state); private: void slotVolumeChanged(int value); void slotCloseTextToSpeechWidget(); void slotConfigure(); TextToSpeechWidgetPrivate *const d; }; } #endif // TEXTTOSPEECHWIDGET_H