New xdxf dialog, one which provides methods to add new or change setting of existing...
[mdictionary] / src / plugins / xdxf / XdxfDialog.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 //Created by Mateusz Półrola
23
24 #ifndef XDXFDIALOG_H
25 #define XDXFDIALOG_H
26
27 #include <QDialog>
28 #include "../../include/settings.h"
29 #include <QtGui>
30 #include "xdxfplugin.h"
31
32 class XdxfDialog : public QDialog
33 {
34     Q_OBJECT
35 public:
36     enum XdxfDialogType {New, Change};
37
38     explicit XdxfDialog(XdxfPlugin* plugin = 0, XdxfDialogType type = New,
39                         QWidget *parent = 0);
40
41     Settings* getSettings();
42
43 Q_SIGNALS:
44     void notify(Notify::NotifyType, QString, QWidget*);
45
46 public Q_SLOTS:
47     void accept();
48
49 private Q_SLOTS:
50     void selectFile();
51     void saveSettings();
52     void setGenerateCache(bool);
53     void setAccents(bool);
54
55     void showCacheInfo();
56     void showAccentsInfo();
57
58
59 private:
60     void initializeUI();
61
62     QLabel* browseLabel;
63     QPushButton* browseButton;
64     QHBoxLayout* browseLayout;
65
66     QLabel* infoLabel;
67
68     QCheckBox* cacheCheckBox;
69     QCheckBox* accentsCheckBox;
70     QHBoxLayout* cacheLayout;
71     QHBoxLayout* accentsLayout;
72     QToolButton* cacheInfoToolButton;
73     QToolButton* accentsInfoToolButton;
74
75     QPushButton* saveButton;
76     QPushButton* addButton;
77
78     QString _dictionaryFilePath;
79
80     QScrollArea* scrollArea;
81
82     QWidget* widget;
83     QHBoxLayout* layout;
84
85     QVBoxLayout* mainVerticalLayout;
86     bool _generateCache;
87     bool _accents;
88     bool _lastAccents;
89
90     Settings* _settings;
91
92     XdxfPlugin* plugin;
93     XdxfDialogType type;
94 };
95
96 #endif // XDXFDIALOG_H