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 \brief Implementation of xdxf plugin's dialogs.
26 \author Mateusz Półrola <mateusz.polrola@gmail.com>
33 #include "../../include/settings.h"
35 #include <QDeclarativeView>
37 #include "xdxfplugin.h"
41 This class can create dialogs for adding a new dictionary or changing settings
42 of an existing one, based on dialog type passed to contructor.
43 When adding a new dictionary dialog contains a button to browse file system and
44 select a dictionary file. When changing settings dialog displays basic
45 information about dictionary i. e. name, languages and license info.
46 In both types of dialogs there are comboboxes with "cache" and "remove accents"
47 options. On maemo right next to comboboxes are tool buttons which allow to
48 see more information about these options, on desktop the same information is
49 displayed as a tool tip.
50 All contents of a dialog are in a scroll area.
52 class XdxfDialog : public QDialog
57 Describes type of dialog. New means that dialog contains widgets to browse
58 file system and select dictionary file. Change means that dialog displays
59 information about dictionary.
60 In both types dialog provides widgets to create or delete cache and remove
63 enum XdxfDialogType {New, Change};
66 Creates new xdxf dialog
67 \param plugin if created dialog is of type Change it must be set to
68 point to plugin whose settings will be changed
69 \param type describes type of created dialog
70 \param parent parent widget of created dialog
72 explicit XdxfDialog(XdxfPlugin* plugin = 0,
73 XdxfDialogType type = New,
77 After acceptance of dialog this method returns plugin's settings based on
78 user's choices in dialog.
79 \returns settings of plugin
81 Settings* getSettings();
84 //! Requests to show notification
85 void notify(Notify::NotifyType, QString);
87 void setPlugin(QVariant name);
88 void setFrom(QVariant lang);
89 void setTo(QVariant lang);
90 void setDescription(QVariant descript);
91 void setInfo(QVariant info);
92 void setCheckedOptimalize(QVariant boolean);
93 void setCheckedStrip(QVariant boolean);
94 void setButtonText(QVariant text);
95 void setNew(QVariant text);
96 void setPath(QVariant path);
100 Reimplemented accept method, to check if all necessary fields in
101 dialog are correct e. g. dictionary file path
102 and saves new settings
108 //! displays dialog to browse and select file
111 //! download dictionaries list
114 //! set properti _generateCache
115 void setGenerateCache(bool);
117 //! set properti _accents
118 void setAccents(bool);
120 void fileDownloaded(QString);
123 //! on maemo shows information about checkboxes
124 void showCacheInfo();
126 //! on maemo shows information about checkboxes
127 void showAccentsInfo();
132 QVBoxLayout* mainLayout;
133 QDeclarativeView *view;
137 //! saves new settings after acceptance of dialog
141 QPushButton* browseButton;
142 QPushButton* downloadButton;
143 QHBoxLayout* browseLayout;
144 QHBoxLayout* infoLayout;
146 QCheckBox* cacheCheckBox;
147 QCheckBox* accentsCheckBox;
148 QHBoxLayout* cacheLayout;
149 QHBoxLayout* accentsLayout;
151 QString cacheToolTip;
152 QString accentsToolTip;
155 QToolButton* cacheInfoToolButton;
156 QToolButton* accentsInfoToolButton;
160 QPushButton* confirmButton;
162 QString _dictionaryFilePath;
164 QScrollArea* scrollArea;
169 QVBoxLayout* mainVerticalLayout;
180 #endif // XDXFDIALOG_H