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 "../../includes/GUIInterface.h"
33 //! Implements dictionaries management widget
35 Shows list of loaded dictionaries and their states (active/inactive).
36 It allows to change dicts states, add new dict, remove selected one or
37 change settings of selected dict. All changes are saved automatically after
38 hiding of this widget.
40 class DictManagerWidget : public QDialog {
45 \param parent parent of this widget, which must be subclass of
46 GUIInterface, because it will use it to get info about loaded plugins
49 explicit DictManagerWidget(GUIInterface *parent = 0);
52 void showEvent(QShowEvent *e);
53 void hideEvent(QHideEvent *e);
56 //! Emitted when hiding widget, it will save states of dictionaries
58 \param list of only active dictionaries
60 void selectedDictionaries(QList<CommonDictInterface*>);
62 //! Emitted when user wants to add new dictionary
64 \param new dictionary returned by specific plugin dialog
66 void addDictionary(CommonDictInterface*);
68 //! Emitted when user wants to remove dictionary
70 \param dictionary which will be removed
72 void removeDictionary(CommonDictInterface*);
82 Shows plugin select dialog and then specific plugin add new dictionary
83 dialog, which will return new CommonDictInterface* object, which is
84 later passed as parameter of addDictionary signal
86 void addNewDictButtonClicked();
89 Passes selected dictionary from list as parameter of removeDictionary
92 void removeButtonClicked();
94 //! user select one of items
95 void itemSelected(QListWidgetItem*);
97 //! Shows plugin's settings dialog
98 void settingsButtonClicked();
100 //! Each change of state (that needs to be saved) should call this to
101 //! indicate state change
109 QPushButton* addNewDictButton;
110 QPushButton* removeDictButton;
111 QPushButton* settingsButton;
113 QVBoxLayout* verticalLayout;
114 QHBoxLayout* buttonGroup;
115 QListWidget* dictListWidget;
117 //holds association between items on list and CommonDictInterface objects
118 QHash<QListWidgetItem*, CommonDictInterface*> dictsHash;
119 GUIInterface* guiInterface;
123 void refreshDictsList();
126 QPushButton* closeButton;
131 #endif // DICTMANAGERWIDGET_H