Added settings widget in xdxf plugin, added dictionaries management(adding, removing...
[mdictionary] / trunk / src / plugins / xdxf / src / XdxfSettingsDialog.cpp
diff --git a/trunk/src/plugins/xdxf/src/XdxfSettingsDialog.cpp b/trunk/src/plugins/xdxf/src/XdxfSettingsDialog.cpp
new file mode 100644 (file)
index 0000000..9336920
--- /dev/null
@@ -0,0 +1,95 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#include "XdxfSettingsDialog.h"
+
+XdxfSettingsDialog::XdxfSettingsDialog(XdxfPlugin *plugin, QWidget *parent) :
+    QDialog(parent)
+{
+    this->plugin = plugin;
+    verticalLayout = new QVBoxLayout;
+    setLayout(verticalLayout);
+
+    setWindowTitle(tr("XDXF Settings"));
+
+
+    infoLabel = new QLabel;
+
+    infoLabel->setText(tr("Plugin type: ") + plugin->type() +"\n" +
+                   tr("From: ") + plugin->langFrom() + "\n" +
+                   tr("To: ") + plugin->langTo() + "\n" +
+                   tr("Description: ") + plugin->name());
+
+    verticalLayout->addWidget(infoLabel);
+
+    browseLayout = new QHBoxLayout;
+    verticalLayout->addLayout(browseLayout);
+
+    browseButton =  new QPushButton(tr("Browse"));
+    browseLabel = new QLabel(tr("Dictionary file: ") +
+                             plugin->settings()->value("path"));
+
+    browseLayout->addWidget(browseLabel);
+    browseLayout->addWidget(browseButton,0, Qt::AlignRight);
+
+
+    cacheLayout = new QHBoxLayout;
+    verticalLayout->addLayout(cacheLayout);
+
+    cacheButton = new QPushButton(tr("Cache"));
+    if(plugin->settings()->value("Cached") == "true") {
+        cacheButton->setEnabled(false);
+    }
+
+    cacheLayout->addWidget(cacheButton);
+
+    saveButton = new QPushButton(tr("Save settings"));
+
+    verticalLayout->addWidget(saveButton);
+
+    setModal(true);
+
+   /* connect(browseButton, SIGNAL(clicked()),
+            this, SLOT(selectFile()));
+
+    connect(addButton, SIGNAL(clicked()),
+            this, SLOT(addDictionary()));*/
+
+    _dicitonaryFilePath = QString();
+}
+
+Settings* XdxfSettingsDialog::getSettings(XdxfPlugin *plugin,
+                                          QWidget *parent) {
+    XdxfSettingsDialog settingsDialog(plugin, parent);
+    //Settings* settings = new Settings;
+
+    if(settingsDialog.exec()==QDialog::Accepted) {
+
+
+        return NULL;
+    }
+
+    return NULL;
+}
+
+