fix small bug(wildcard), and change some comments
[mdictionary] / src / plugins / xdxf / XdxfDictSelectDialog.h
1 /*******************************************************************************
2
3     This file is part of mDictionary.
4
5     mDictionary 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 3 of the License, or
8     (at your option) any later version.
9
10     mDictionary 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 mDictionary.  If not, see <http://www.gnu.org/licenses/>.
17
18     Copyright 2010 Comarch S.A.
19
20 *******************************************************************************/
21 /*!
22     \file XdxfDictSelectDialog.h
23     \author Mateusz Półrola <mateusz.polrola@comarch.com>
24  */
25
26 #ifndef XDXFDICTSELECTDIALOG_H
27 #define XDXFDICTSELECTDIALOG_H
28
29 #include <QDialog>
30 #include <QtGui>
31 #include "DownloadDict.h"
32 #include "DictsModel.h"
33 #include "DictsProxyModel.h"
34
35
36 /*!
37   Shows dialog with list of dictionaries and informations about them,
38   allowing user to filter data based on dictionaries languages,
39   and to select one of them.
40 */
41 class XdxfDictSelectDialog : public QDialog {
42     Q_OBJECT
43 public:
44     /*!
45         Constructor
46         \param dicts list of DownloadDict objects describing dictionaries.
47     */
48     XdxfDictSelectDialog(QList<DownloadDict> dicts,
49                                   QWidget *parent = 0);
50
51     /*!
52         Returns download link of dictionary selected by user. This string is set
53         only when user select any dictionary (dialog was accepted), otherwise it
54         is empty.
55     */
56     QString link() { return _link;}
57
58 private Q_SLOTS:
59     //! creates items for comboboxes and creates model with dicts info
60     void initializeDicts();
61
62     //! filters dicts after filtering settings change
63     void refreshDictList();
64
65     //! accept dialog and sets download link of clicked dictionary
66     void itemClicked(QModelIndex);
67
68 private:
69     QTreeView* treeView;
70     DictsModel* model;
71     DictsProxyModel *proxyModel; //used by treeView to allow filtering and sorti
72     QVBoxLayout* layout;
73     QHBoxLayout* checkBoxLayout;
74     QComboBox* langFrom;
75     QComboBox* langTo;
76     QLabel* langFromLabel;
77     QLabel* langToLabel;
78     QList<DownloadDict>* dictList;
79     QString _link;
80 };
81
82 #endif // XDXFDICTSELECTDIALOG_H