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 //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
25 #ifndef DICTMANAGERWIDGET_H
26 #define DICTMANAGERWIDGET_H
30 #include "../../include/GUIInterface.h"
31 #include "MenuWidget.h"
34 //! Implements dictionaries management widget
36 Shows list of loaded dictionaries and their states (active/inactive).
37 It allows to change dicts states, add new dict, remove selected one or
38 change settings of selected dict. All changes are saved automatically after
39 hiding of this widget.
41 class DictManagerWidget : public QDialog {
46 \param parent parent of this widget, which must be subclass of
47 GUIInterface, because it will use it to get info about loaded plugins
50 explicit DictManagerWidget(GUIInterface *parent = 0);
53 void showEvent(QShowEvent *e);
54 void hideEvent(QHideEvent *e);
57 //! Emitted when hiding widget, it will save states of dictionaries
59 \param list of only active dictionaries
61 void selectedDictionaries(QList<CommonDictInterface*>);
63 //! Emitted when user wants to add new dictionary
65 \param new dictionary returned by specific plugin dialog
67 void addDictionary(CommonDictInterface*);
69 //! Emitted when user wants to remove dictionary
71 \param dictionary which will be removed
73 void removeDictionary(CommonDictInterface*);
83 /*! Shows "plugin select" dialog and then plugin specific "add new dictionary
84 dialog", which will return new CommonDictInterface* object, which is
85 later passed as parameter of addDictionary signal*/
86 void addNewDictButtonClicked();
88 /*! Passes dictionary selected from list as parameter of removeDictionary
90 void removeButtonClicked();
92 //! user select one of items
93 void itemSelected(QListWidgetItem*);
95 //! Shows plugin's settings dialog
96 void settingsButtonClicked();
98 //! Each change of state (that needs to be saved) should call this to
99 //! indicate state change
107 QPushButton* addNewDictButton;
108 QPushButton* removeDictButton;
109 QPushButton* settingsButton;
111 QVBoxLayout* verticalLayout;
112 QHBoxLayout* buttonGroup;
113 QListWidget* dictList;
115 //holds association between items on list and CommonDictInterface objects
116 QHash<QListWidgetItem*, CommonDictInterface*> dictsHash;
117 GUIInterface* guiInterface;
121 void refreshDictsList();
124 QPushButton* closeButton;
129 #endif // DICTMANAGERWIDGET_H