-
Notifications
You must be signed in to change notification settings - Fork 10
/
grouppickerform.h
71 lines (57 loc) · 2.23 KB
/
grouppickerform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
** Copyright 2007-2013, 2017-2018 Sólyom Zoltán
** This file is part of zkanji, a free software released under the terms of the
** GNU General Public License version 3. See the file LICENSE for details.
**/
#ifndef GROUPPICKER_H
#define GROUPPICKER_H
#include <QMainWindow>
#include <functional>
#include "groupwidget.h"
#include "dialogwindow.h"
namespace Ui {
class GroupPickerForm;
}
struct WordEntry;
class Dictionary;
class TreeItem;
class GroupBase;
class QPushButton;
// Window shown when a category or group should be selected. Use the static select() or create
// the window and set everything with the setters. The groupSelected() signal is triggered
// when the user clicks the select group button.
class GroupPickerForm : public DialogWindow
{
Q_OBJECT
signals:
void groupSelected(Dictionary *dict, GroupBase *selection);
public:
// Creates a modal group picker form and shows it on screen. Returns the selected group.
// Pass true in showdicts to show the dictionary combo box. Otherwise the dictionary for
// the listed groups can't be changed from dict. To create a non-modal form construct the
// window manually and connect to the groupSelected event.
static GroupBase* select(GroupWidget::Modes mode, const QString &instructions, Dictionary *dict, bool onlycategories = false, bool showdicts = false, QWidget *parent = nullptr);
/* Constructor is private */
~GroupPickerForm();
void hideDictionarySelect();
void setDictionary(Dictionary *dict);
void setMode(GroupWidget::Modes mode);
void setInstructions(const QString &instructions);
protected:
virtual bool event(QEvent *e) override;
private:
GroupPickerForm() = delete;
GroupPickerForm(const GroupPickerForm&) = delete;
GroupPickerForm(GroupPickerForm&&) = delete;
GroupPickerForm(bool categories, QWidget *parent = nullptr);
GroupPickerForm(GroupWidget::Modes mode, bool categories, QWidget *parent = nullptr);
void translateTexts();
Ui::GroupPickerForm *ui;
QPushButton *selectButton;
typedef DialogWindow base;
private slots:
void selectClicked();
void on_groupWidget_currentItemChanged(GroupBase *current);
void on_dictCBox_currentIndexChanged(int index);
};
#endif // GROUPPICKER_H