Merge branch 'gui'
[mdictionary] / src / plugins / google / GoogleSettingsDialog.h
1 /*******************************************************************************
2
3     This file is part of mDictionary.
4
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.
9
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.
14
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/>.
17
18     Copyright 2010 Comarch S.A.
19
20 *******************************************************************************/
21
22 /*! \file GoogleSettingsDialog.h
23     \brief Class creates dialog to get or change settings for Google Plugin
24     \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
25 */
26
27 #ifndef GOOGLESETTINGSDIALOG_H
28 #define GOOGLESETTINGSDIALOG_H
29
30 #include <QDialog>
31 #include "../../include/settings.h"
32 #include <QtGui>
33 #include "GooglePlugin.h"
34
35 class GooglePlugin;
36
37 class GoogleSettingsDialog : public QDialog
38 {
39     Q_OBJECT
40 public:
41     explicit GoogleSettingsDialog(QWidget *parent = 0,
42                                   Settings *pluginSettings=0,
43                                   QString acceptButtonLabel = tr("Add"));
44
45     /*!
46         \param parent parent widget on which dialog will be displayed
47         \param langTo language which is displayed in the comboBox as a startup item
48         \param langFrom language which is displayed in the comboBox as a startup item
49         \returns function returns settings to GooglePlugin
50     */
51     static Settings* getSettings(QWidget *parent,
52                                  Settings *pluginSettings=0,
53                                  QString acceptButtonLabel = tr("Add"));
54     /*!
55         function sets a new settings in plugin;
56         \param plugin plugin whose settings you will change
57         \param parent parent widget on which dialog will be displayed
58     */
59     static void changeSettings(GooglePlugin* plugin, QWidget *parent);
60
61     //! \return source language code iso 639-2
62     QString langFrom();
63
64     //! \return destination language code iso 639-2
65     QString langTo();
66
67 private slots:
68     //! assigns the language chosen from a list(langFromComboBox) to _langFrom
69     void activatedFrom(int);
70     //! assigns the language chosen from a list(langToComboBox) to _langTo
71     void activatedTo(int);
72     //! handles the "swap languages" button
73     void changeLangButtonClicked();
74
75
76 private:
77     QLabel* infoLabel;
78     QLabel* langFromLabel;
79     QLabel* langToLabel;
80     QLabel* connectInfoLabel;
81     QPushButton* saveButton;
82     QPushButton* changeLangButton;
83     QComboBox *langFromComboBox;
84     QComboBox *langToComboBox;
85     QVBoxLayout* verticalLayout;
86     QVBoxLayout* langLayout;
87     QHBoxLayout* langFromLayout;
88     QHBoxLayout* langToLayout;
89     QHBoxLayout* changelangLayout;
90     QString _langFrom;
91     QString _langTo;
92 };
93
94 #endif // GOOGLESETTINGSDIALOG_H