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 *******************************************************************************/
24 \author Mateusz Półrola <mateusz.polrola@gmail.com>
31 #include "../../include/settings.h"
33 #include "xdxfplugin.h"
36 //! Implementation of xdxf plugin's dialogs.
38 This class can create dialogs for adding a new dictionary or changing settings
39 of an existing one, based on dialog type passed to contructor.
40 When adding a new dictionary dialog contains a button to browse file system and
41 select a dictionary file. When changing settings dialog displays basic
42 information about dictionary i. e. name, languages and license info.
43 In both types of dialogs there are comboboxes with "cache" and "remove accents"
44 options. On maemo right next to comboboxes are tool buttons which allow to
45 see more information about these options, on desktop the same information is
46 displayed as a tool tip.
47 All contents of a dialog are in a scroll area.
49 class XdxfDialog : public QDialog
54 Describes type of dialog. New means that dialog contains widgets to browse
55 file system and select dictionary file. Change means that dialog displays
56 information about dictionary.
57 In both types dialog provides widgets to create or delete cache and remove
60 enum XdxfDialogType {New, Change};
63 Creates new xdxf dialog
64 \param plugin if created dialog is of type Change it must be set to
65 point to plugin whose settings will be changed
66 \param type describes type of created dialog
67 \param parent parent widget of created dialog
69 explicit XdxfDialog(XdxfPlugin* plugin = 0,
70 XdxfDialogType type = New,
74 After acceptance of dialog this method returns plugin's settings based on
75 user's choices in dialog.
76 \returns settings of plugin
78 Settings* getSettings();
81 //! Requests to show notification
82 void notify(Notify::NotifyType, QString);
86 Reimplemented accept method, to check if all necessary fields in
87 dialog are correct e. g. dictionary file path
88 and saves new settings
93 //! displays dialog to browse and select file
96 //! download dictionaries list
99 //! set properti _generateCache
100 void setGenerateCache(bool);
102 //! set properti _accents
103 void setAccents(bool);
105 void fileDownloaded(QString);
108 //! on maemo shows information about checkboxes
109 void showCacheInfo();
111 //! on maemo shows information about checkboxes
112 void showAccentsInfo();
119 //! saves new settings after acceptance of dialog
123 QPushButton* browseButton;
124 QPushButton* downloadButton;
125 QHBoxLayout* browseLayout;
126 QHBoxLayout* infoLayout;
128 QCheckBox* cacheCheckBox;
129 QCheckBox* accentsCheckBox;
130 QHBoxLayout* cacheLayout;
131 QHBoxLayout* accentsLayout;
133 QString cacheToolTip;
134 QString accentsToolTip;
137 QToolButton* cacheInfoToolButton;
138 QToolButton* accentsInfoToolButton;
142 QPushButton* confirmButton;
144 QString _dictionaryFilePath;
146 QScrollArea* scrollArea;
151 QVBoxLayout* mainVerticalLayout;
162 #endif // XDXFDIALOG_H