~neon/kmouth/master

1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
1
/***************************************************************************
486.1.3 by Jeremy Whiting
Updated copyright headers and add missing ones.
2
 *   Copyright (C) 2002 by Gunnar Schmi Dt <kmouth@schmi-dt.de             *
3
 *             (C) 2015 by Jeremy Whiting <jpwhiting@kde.org>              *
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 *   (at your option) any later version.                                   *
9
 *                                                                         *
486.1.3 by Jeremy Whiting
Updated copyright headers and add missing ones.
10
 *   This program is distributed in the hope that it will be useful,       *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13
 *   GNU General Public License for more details.                          *
14
 *                                                                         *
15
 *   You should have received a copy of the GNU General Public License     *
16
 *   along with this program; if not, write to the                         *
17
 *   Free Software Foundation, Inc.,                                       *
18
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
19
 ***************************************************************************/
20
21
#ifndef PHRASELIST_H
22
#define PHRASELIST_H
23
24
// include files for KDE
492 by Jeremy Whiting
Port from KUrl to QUrl and KFileDialog to QFileDialog.
25
#include <QUrl>
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
26
27
// include files for Qt
487 by Jeremy Whiting
Initial port to kf5/qt5/QtSpeech.
28
#include <QWidget>
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
29
489 by Jeremy Whiting
Cleanup headers and bump version to 1.2.0
30
class KComboBox;
31
class KLineEdit;
32
class QKeyEvent;
484.1.13 by Jeremy Whiting
Remove Q3List from PhraseList.
33
class QListView;
489 by Jeremy Whiting
Cleanup headers and bump version to 1.2.0
34
class QPrinter;
35
class QPushButton;
484.1.13 by Jeremy Whiting
Remove Q3List from PhraseList.
36
class QStandardItemModel;
35 by Gunnar Schmidt
Word completion added to KMouth
37
class WordCompletion;
38
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
39
/**
40
 * This class represents a phrase list. It contains methods for manipulating
41
 * the phraselist and also methods for viewing the list.
42
 * The phrase list consists of an edit field for entering phrases and a list
43
 * box for the spoken phrases.
484.1.13 by Jeremy Whiting
Remove Q3List from PhraseList.
44
 *
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
45
 * @author Gunnar Schmi Dt
46
 */
47
484.1.19 by Jeremy Whiting
Restyle with astyle as per kdelibs coding style.
48
class PhraseList : public QWidget
49
{
50
    Q_OBJECT
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
51
public:
561 by Laurent Montel
Use explicit and co
52
    explicit PhraseList(QWidget *parent = nullptr, const QString &name = QString());
654 by Laurent Montel
GIT_SILENT: add missing override keyword
53
    ~PhraseList() override;
484.1.19 by Jeremy Whiting
Restyle with astyle as per kdelibs coding style.
54
55
    /** contains the implementation for printing functionality */
56
    void print(QPrinter *pPrinter);
57
58
    QStringList getListSelection();
59
60
    bool existListSelection();
61
    bool existEditSelection();
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
62
560 by Laurent Montel
Fix compile with KDEFrameworkCompilerSettings
63
public Q_SLOTS:
484.1.19 by Jeremy Whiting
Restyle with astyle as per kdelibs coding style.
64
    /** Called whenever the user wants the contents of the edit line to be spoken. */
65
    void speak();
66
67
    void cut();
68
    void copy();
69
    void paste();
70
71
    /** Insert s into the edit field. */
72
    void insert(const QString &s);
73
74
    /** Called whenever the user wants the selected list entries to be spoken. */
75
    void speakListSelection();
76
77
    void removeListSelection();
78
    void cutListSelection();
79
    void copyListSelection();
80
81
    void save();
82
    void open();
494 by Jeremy Whiting
Port from KIcon to QIcon::fromTheme.
83
    void open(const QUrl &url);
484.1.19 by Jeremy Whiting
Restyle with astyle as per kdelibs coding style.
84
85
    void selectAllEntries();
86
    void deselectAllEntries();
87
88
    void configureCompletion();
89
    void saveWordCompletion();
495 by Jeremy Whiting
Port from KConfig to KSharedConfig.
90
    void saveCompletionOptions();
91
    void readCompletionOptions();
55 by Gunnar Schmidt
Made the word completion configurable
92
560 by Laurent Montel
Fix compile with KDEFrameworkCompilerSettings
93
protected Q_SLOTS:
484.1.19 by Jeremy Whiting
Restyle with astyle as per kdelibs coding style.
94
    void lineEntered(const QString &phrase);
95
    void contextMenuRequested(const QPoint &pos);
96
    void textChanged(const QString &s);
97
    void selectionChanged();
519 by Andrius Štikonas
Q_DECL_OVERRIDE->override.
98
    void keyPressEvent(QKeyEvent *e) override;
484.1.19 by Jeremy Whiting
Restyle with astyle as per kdelibs coding style.
99
    void configureCompletionCombo(const QStringList &list);
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
100
101
private:
484.1.19 by Jeremy Whiting
Restyle with astyle as per kdelibs coding style.
102
    QListView *m_listView;
103
    QStandardItemModel *m_model;
104
    KComboBox *dictionaryCombo;
105
    KLineEdit *lineEdit;
106
    QPushButton *speakButton;
107
    QString line;
108
    WordCompletion *completion;
109
110
    bool isInSlot;
111
112
    void speakPhrase(const QString &phrase);
113
    void setEditLineText(const QString &s);
114
    void insertIntoPhraseList(const QString &phrase, bool clearEditLine);
115
116
    void enableMenuEntries();
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
117
};
118
119
#endif