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 *******************************************************************************/
23 \brief Implementation of stardict plugin's dialogs.
25 \author Mateusz Półrola <mateusz.polrola@gmail.com>
32 #include "../../include/settings.h"
34 #include "StarDictPlugin.h"
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 All contents of a dialog are in a scroll area.
45 class StarDialog : public QDialog
50 Describes type of dialog. New means that dialog contains widgets to browse
51 file system and select dictionary file. Change means that dialog displays
52 information about dictionary.
53 In both types dialog provides widgets to create or delete cache and remove
56 enum StarDialogType {New, Change};
60 Creates new StarDict dialog
61 \param plugin if created dialog is of type Change it must be set to
62 point to plugin whose settings will be changed
63 \param type describes type of created dialog
64 \param parent parent widget of created dialog
66 explicit StarDialog(StarDictPlugin* plugin = 0,
67 StarDialogType type = New,
71 After acceptance of dialog this method returns plugin's settings based on
72 user's choices in dialog.
73 \returns settings of plugin
75 Settings* getSettings();
78 //! Requests to show notification
79 void notify(Notify::NotifyType, QString);
83 Reimplemented accept method, to check if all necessary fields in
84 dialog are correct e. g. dictionary file path
85 and saves new settings
90 //! displays dialog to browse and select file
94 //! create a user interface
97 //! saves new settings after acceptance of dialog
100 //! check that files is compressed
104 QPushButton* browseButton;
105 QHBoxLayout* browseLayout;
107 QPushButton* confirmButton;
108 QString _dictionaryFilePath;
109 QScrollArea* scrollArea;
112 QVBoxLayout* mainVerticalLayout;
118 StarDictPlugin* plugin;
122 #endif // STARDIALOG_H