Added settings widget in xdxf plugin, added dictionaries management(adding, removing...
[mdictionary] / trunk / src / plugins / xdxf / src / XdxfSettingsDialog.cpp
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 #include "XdxfSettingsDialog.h"
25
26 XdxfSettingsDialog::XdxfSettingsDialog(XdxfPlugin *plugin, QWidget *parent) :
27     QDialog(parent)
28 {
29     this->plugin = plugin;
30     verticalLayout = new QVBoxLayout;
31     setLayout(verticalLayout);
32
33     setWindowTitle(tr("XDXF Settings"));
34
35
36     infoLabel = new QLabel;
37
38     infoLabel->setText(tr("Plugin type: ") + plugin->type() +"\n" +
39                    tr("From: ") + plugin->langFrom() + "\n" +
40                    tr("To: ") + plugin->langTo() + "\n" +
41                    tr("Description: ") + plugin->name());
42
43     verticalLayout->addWidget(infoLabel);
44
45     browseLayout = new QHBoxLayout;
46     verticalLayout->addLayout(browseLayout);
47
48     browseButton =  new QPushButton(tr("Browse"));
49     browseLabel = new QLabel(tr("Dictionary file: ") +
50                              plugin->settings()->value("path"));
51
52     browseLayout->addWidget(browseLabel);
53     browseLayout->addWidget(browseButton,0, Qt::AlignRight);
54
55
56     cacheLayout = new QHBoxLayout;
57     verticalLayout->addLayout(cacheLayout);
58
59     cacheButton = new QPushButton(tr("Cache"));
60     if(plugin->settings()->value("Cached") == "true") {
61         cacheButton->setEnabled(false);
62     }
63
64     cacheLayout->addWidget(cacheButton);
65
66     saveButton = new QPushButton(tr("Save settings"));
67
68     verticalLayout->addWidget(saveButton);
69
70     setModal(true);
71
72    /* connect(browseButton, SIGNAL(clicked()),
73             this, SLOT(selectFile()));
74
75     connect(addButton, SIGNAL(clicked()),
76             this, SLOT(addDictionary()));*/
77
78     _dicitonaryFilePath = QString();
79 }
80
81 Settings* XdxfSettingsDialog::getSettings(XdxfPlugin *plugin,
82                                           QWidget *parent) {
83     XdxfSettingsDialog settingsDialog(plugin, parent);
84     //Settings* settings = new Settings;
85
86     if(settingsDialog.exec()==QDialog::Accepted) {
87
88
89         return NULL;
90     }
91
92     return NULL;
93 }
94
95