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 *******************************************************************************/
22 \file GoogleDialog.cpp
23 \author Mateusz Półrola <mateusz.polrola@gmail.com>
24 \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
27 #ifndef GOOGLEDIALOG_H
28 #define GOOGLEDIALOG_H
31 #include "../../include/settings.h"
33 #include "GooglePlugin.h"
35 //! Implementation of google plugin's dialogs.
37 This class can create dialogs for adding a new dictionary or changing settings
38 of an existing one, based on dialog type passed to constructor.
39 These types differ only in confirm button label.
40 Both provide comboboxes with available languages to choose.
42 class GoogleDialog : public QDialog
47 Describes type of dialog. New means that dialog confirm button has
48 "Add" label, Change means that dialog confirm button has "Save settings" label.
50 enum GoogleDialogType {New, Change};
54 Creates new google dialog
55 \param plugin if created dialog is of type Change it must be set to
56 point to plugin whose settings will be changed
57 \param type describes type of created dialog
58 \param parent parent widget of created dialog
60 explicit GoogleDialog(GooglePlugin* plugin = 0,
61 GoogleDialogType type = New,
64 //! \returns settings of plugin
66 After acceptance of dialog this method returns plugin's settings based on
67 user's choices in dialog.
69 Settings* getSettings();
72 //! requests to show notification
73 void notify(Notify::NotifyType, QString);
76 //! reimplemented accept method, to save new settings
80 //! assigns the language chosen from a list(langFromComboBox) to _langFrom
81 void langFromChanged(int);
83 //! assigns the language chosen from a list(langToComboBox) to _langTo
84 void langToChanged(int);
86 //! handles the "swap languages" button
87 void changeLangButtonClicked();
92 //! saves new settings after acceptance of dialog
96 QLabel* langFromLabel;
98 QLabel* connectInfoLabel;
99 QPushButton* confirmButton;
100 QPushButton* changeLangButton;
101 QComboBox *langFromComboBox;
102 QComboBox *langToComboBox;
103 QVBoxLayout* verticalLayout;
104 QVBoxLayout* langLayout;
105 QFormLayout* langsFormLayout;
106 QHBoxLayout* changeLangLayout;
111 GooglePlugin* plugin;
112 GoogleDialogType type;
115 #endif // GOOGLEDIALOG_H