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>
36 #include "xdxfplugin.h"
40 This class can create dialogs for adding a new dictionary or changing settings
41 of an existing one, based on dialog type passed to contructor.
42 When adding a new dictionary dialog contains a button to browse file system and
43 select a dictionary file. When changing settings dialog displays basic
44 information about dictionary i. e. name, languages and license info.
45 In both types of dialogs there are comboboxes with "cache" and "remove accents"
46 options. On maemo right next to comboboxes are tool buttons which allow to
47 see more information about these options, on desktop the same information is
48 displayed as a tool tip.
49 All contents of a dialog are in a scroll area.
51 class XdxfDialog : public QDialog
56 Describes type of dialog. New means that dialog contains widgets to browse
57 file system and select dictionary file. Change means that dialog displays
58 information about dictionary.
59 In both types dialog provides widgets to create or delete cache and remove
62 enum XdxfDialogType {New, Change};
65 Creates new xdxf dialog
66 \param plugin if created dialog is of type Change it must be set to
67 point to plugin whose settings will be changed
68 \param type describes type of created dialog
69 \param parent parent widget of created dialog
71 explicit XdxfDialog(XdxfPlugin* plugin = 0,
72 XdxfDialogType type = New,
76 After acceptance of dialog this method returns plugin's settings based on
77 user's choices in dialog.
78 \returns settings of plugin
80 Settings* getSettings();
83 //! Requests to show notification
84 void notify(Notify::NotifyType, QString);
86 void setPlugin(QVariant name);
87 void setFrom(QVariant lang);
88 void setTo(QVariant lang);
89 void setDescription(QVariant descript);
90 void setInfo(QVariant info);
91 void setCheckedOptimalize(QVariant boolean);
92 void setCheckedStrip(QVariant boolean);
93 void setButtonText(QVariant text);
94 void setNew(QVariant text);
95 void setPath(QVariant path);
99 Reimplemented accept method, to check if all necessary fields in
100 dialog are correct e. g. dictionary file path
101 and saves new settings
107 //! displays dialog to browse and select file
110 //! download dictionaries list
113 //! set properti _generateCache
114 void setGenerateCache(bool);
116 //! set properti _accents
117 void setAccents(bool);
119 void fileDownloaded(QString);
122 //! on maemo shows information about checkboxes
123 void showCacheInfo();
125 //! on maemo shows information about checkboxes
126 void showAccentsInfo();
131 QVBoxLayout* mainLayout;
132 QDeclarativeView *view;
136 //! saves new settings after acceptance of dialog
140 QPushButton* browseButton;
141 QPushButton* downloadButton;
142 QHBoxLayout* browseLayout;
143 QHBoxLayout* infoLayout;
145 QCheckBox* cacheCheckBox;
146 QCheckBox* accentsCheckBox;
147 QHBoxLayout* cacheLayout;
148 QHBoxLayout* accentsLayout;
150 QString cacheToolTip;
151 QString accentsToolTip;
154 QToolButton* cacheInfoToolButton;
155 QToolButton* accentsInfoToolButton;
159 QPushButton* confirmButton;
161 QString _dictionaryFilePath;
163 QScrollArea* scrollArea;
168 QVBoxLayout* mainVerticalLayout;
179 #endif // XDXFDIALOG_H