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 \file GoogleDialog.cpp
24 \author Mateusz Półrola <mateusz.polrola@gmail.com>
25 \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
28 #ifndef GOOGLEDIALOG_H
29 #define GOOGLEDIALOG_H
32 #include "../../include/settings.h"
34 #include "GooglePlugin.h"
36 //! Implementation of google plugin's dialogs.
38 This class can create dialogs for adding new dictionary or changins settings
39 of existing one, based on dialog type passed to contructor.
40 These type are different only in confirm button label.
41 Both provides comboboxes with availaible languages to choose.
43 class GoogleDialog : public QDialog
48 Describes type of dialog. New means that dialog confirm button has label
49 Add", Change means dialog confirm button has label "Save settings"
51 enum GoogleDialogType {New, Change};
55 Creates new google dialog
56 \param plugin if creating dialog of type Change it must be set to
57 pointer of plugin whose settings will be changed
58 \param type describes type of creating dialog
59 \param parent parent widget of creating dialog
61 explicit GoogleDialog(GooglePlugin* plugin = 0,
62 GoogleDialogType type = New,
66 //! Returns settings of plugin
68 After acceptance of dialog this method return plugin's settings based on
69 user choises in dialog.
71 Settings* getSettings();
74 //! Request to show notification
75 void notify(Notify::NotifyType, QString);
78 //! Reimplemented accept method, to save new settings
82 //! assigns the language chosen from a list(langFromComboBox) to _langFrom
83 void langFromChanged(int);
85 //! assigns the language chosen from a list(langToComboBox) to _langTo
86 void langToChanged(int);
88 //! handles the "swap languages" button
89 void changeLangButtonClicked();
94 //! saves new settings after acceptance of dialog
98 QLabel* langFromLabel;
100 QLabel* connectInfoLabel;
101 QPushButton* confirmButton;
102 QPushButton* changeLangButton;
103 QComboBox *langFromComboBox;
104 QComboBox *langToComboBox;
105 QVBoxLayout* verticalLayout;
106 QVBoxLayout* langLayout;
107 QFormLayout* langsFormLayout;
108 QHBoxLayout* changeLangLayout;
113 GooglePlugin* plugin;
114 GoogleDialogType type;
117 #endif // GOOGLEDIALOG_H