Debian Codegraph @

src/view/UserphraseView.h

raw symbols SCIP
1 /*
2 * chewing-editor: Chewing userphrase editor
3 * Copyright (C) 2014 Chewing Development Team
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
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 along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #pragma once
21
22 #include <QListView>
23
24 #include "UserphraseDialog.h"
25 #include "UserphraseSortFilterProxyModel.h"
26 #include "UserphraseViewMenu.h"
27
28 class UserphraseView final : public QListView {
29 Q_OBJECT
30
31 public:
32 explicit UserphraseView(QWidget *parent = 0);
33 UserphraseView(const UserphraseView&) = delete;
34 UserphraseView& operator=(const UserphraseView&) = delete;
35 virtual ~UserphraseView() = default;
36 virtual void setModel(UserphraseSortFilterProxyModel *model) {
37 QListView::setModel(model);
38 }
39
40 public slots:
41 void showAddUserphraseDialog();
42 void showModifyUserphraseDialog();
43 void addPhrase(int result);
44 void remove();
45 void setFilterString(const QString& text);
46 void showContextMenu(const QPoint& point);
47
48
49 protected:
50 UserphraseSortFilterProxyModel* model() const {
51 return dynamic_cast<UserphraseSortFilterProxyModel*>(QListView::model());
52 }
53
54 private:
55 enum DialogType {
56 DIALOG_ADD,
57 DIALOG_MODIFY,
58 };
59
60 void setupContextMenu();
61 void setupAddUserphraseDialog();
62
63 UserphraseDialog *UserphraseDialog_;
64 UserphraseViewMenu *menu_;
65
66 bool dialogType_;
67
68 QString originalphrase_;
69 QString originalbopomofo_;
70 };