1 /*******************************************************************************
3 This file is part of mDictionary.
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.
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.
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/>.
18 Copyright 2010 Comarch S.A.
20 *******************************************************************************/
22 /*! \file DictManagerWidget.h
23 \brief Implements dictionaries management widget
25 \author Mateusz Półrola <mateusz.polrola@comarch.pl>
28 #ifndef DICTMANAGERWIDGET_H
29 #define DICTMANAGERWIDGET_H
33 #include "../../include/GUIInterface.h"
34 #include "MenuWidget.h"
35 #include "DictManagerModel.h"
36 #include <QtDeclarative/QDeclarativeView>
37 #include <QtDeclarative/QDeclarativeContext>
41 Shows list of loaded dictionaries and their states (active/inactive).
42 It allows to change dicts states, add a new dict, remove selected one or
43 change settings of selected dict. All changes are saved automatically after
44 hiding of this widget.
46 class DictManagerWidget : public QDialog {
51 \param parent parent of this widget, which must be a subclass of
52 GUIInterface, because it will use it to get info about loaded plugins
55 explicit DictManagerWidget(GUIInterface *parent = 0);
58 void showEvent(QShowEvent *e);
59 void hideEvent(QHideEvent *e);
60 void keyPressEvent(QKeyEvent *e);
63 //! Emitted when hiding widget, it will save states of dictionaries
65 \param list of only active dictionaries
67 void selectedDictionaries(QList<CommonDictInterface*>);
69 //! Emitted when user wants to add a new dictionary
71 \param new dictionary returned by specific plugin dialog
73 void addDictionary(CommonDictInterface*);
75 //! Emitted when user wants to remove a dictionary
77 \param dictionary which will be removed
79 void removeDictionary(CommonDictInterface*);
89 /*! Shows "plugin select" dialog and then plugin specific "add a new dictionary"
90 dialog, which will return new CommonDictInterface* object, which is
91 later passed as a parameter of addDictionary signal*/
92 void addNewDictButtonClicked();
94 /*! Passes dictionary selected from a list as a parameter of removeDictionary
96 void removeButtonClicked();
98 //! user selects one of items
99 void itemSelected(QListWidgetItem*);
101 //! Shows plugin's settings dialog
102 void settingsButtonClicked();
104 //! Each change of state (that needs to be saved) should call this to
105 //! indicate state change
113 QPushButton* addNewDictButton;
114 QPushButton* removeDictButton;
115 QPushButton* settingsButton;
117 QVBoxLayout* verticalLayout;
118 QHBoxLayout* buttonGroup;
119 QListWidget* dictList;
121 //holds association between items on list and CommonDictInterface objects
122 QHash<QListWidgetItem*, CommonDictInterface*> dictsHash;
123 GUIInterface* guiInterface;
126 QDeclarativeView* qmlView;
127 QDeclarativeContext* ctxt;
128 DictManagerModel* model;
133 void refreshDictsList();
136 QPushButton* closeButton;
141 #endif // DICTMANAGERWIDGET_H