Modified google plugin dialog
authorMateusz Półrola <mateusz.polrola@comarch.pl>
Tue, 7 Sep 2010 08:14:19 +0000 (10:14 +0200)
committerMateusz Półrola <mateusz.polrola@comarch.pl>
Tue, 7 Sep 2010 08:14:19 +0000 (10:14 +0200)
34 files changed:
src/plugins/google/GoogleDialog.cpp [new file with mode: 0644]
src/plugins/google/GoogleDialog.h [new file with mode: 0644]
src/plugins/google/GoogleDictDialog.cpp
src/plugins/google/GoogleDictDialog.h
src/plugins/google/GooglePlugin.cpp
src/plugins/google/GooglePlugin.h
src/plugins/google/GoogleSettingsDialog.cpp [deleted file]
src/plugins/google/GoogleSettingsDialog.h [deleted file]
src/plugins/google/google.pro
src/plugins/google/google.qrc
src/plugins/google/translations/dict_google_en.qm [deleted file]
src/plugins/google/translations/dict_google_pl.qm [deleted file]
src/plugins/google/translations/en_EN.qm [new file with mode: 0644]
src/plugins/google/translations/pl_PL.qm [new file with mode: 0644]
src/plugins/xdxf/TranslationXdxf.cpp
src/plugins/xdxf/TranslationXdxf.h
src/plugins/xdxf/XdxfCachingDialog.cpp
src/plugins/xdxf/XdxfCachingDialog.h
src/plugins/xdxf/XdxfDialog.cpp
src/plugins/xdxf/XdxfDialog.h
src/plugins/xdxf/XdxfDictDialog.cpp
src/plugins/xdxf/XdxfDictDialog.h
src/plugins/xdxf/XdxfLoadDialog.cpp [deleted file]
src/plugins/xdxf/XdxfLoadDialog.h [deleted file]
src/plugins/xdxf/XdxfSettingsDialog.cpp [deleted file]
src/plugins/xdxf/XdxfSettingsDialog.h [deleted file]
src/plugins/xdxf/translations/dict_xdxf_en.qm [deleted file]
src/plugins/xdxf/translations/dict_xdxf_pl.qm [deleted file]
src/plugins/xdxf/translations/en_EN.qm [new file with mode: 0644]
src/plugins/xdxf/translations/pl_PL.qm [new file with mode: 0644]
src/plugins/xdxf/xdxf.pro
src/plugins/xdxf/xdxf.qrc
src/plugins/xdxf/xdxfplugin.cpp
src/plugins/xdxf/xdxfplugin.h

diff --git a/src/plugins/google/GoogleDialog.cpp b/src/plugins/google/GoogleDialog.cpp
new file mode 100644 (file)
index 0000000..9bfe817
--- /dev/null
@@ -0,0 +1,192 @@
+/*******************************************************************************
+
+    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.
+
+*******************************************************************************/
+
+/*! \file GoogleSettingsDialog.cpp
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+*/
+
+#include "GoogleDialog.h"
+#include <QDebug>
+
+GoogleDialog::GoogleDialog(GooglePlugin *plugin,
+                           GoogleDialogType type,
+                           QWidget *parent) : QDialog(parent) {
+    this->plugin = plugin;
+    this->type = type;
+    _settings = 0;
+
+    if(plugin) {
+        _langTo=GooglePlugin::languages.key(
+                plugin->settings()->value("lang_to"));
+
+        _langFrom=GooglePlugin::languages.key(
+                plugin->settings()->value("lang_from"));
+    }
+    else {
+        _langTo=GooglePlugin::languages.key("pl");
+        _langFrom=GooglePlugin::languages.key("en");
+    }
+
+
+
+    initializeUI();
+
+    connect(confirmButton, SIGNAL(clicked()),
+            this, SLOT(accept()));
+
+    connect(langFromComboBox, SIGNAL(currentIndexChanged(int)),
+            this, SLOT(langFromChanged(int)));
+
+    connect(langToComboBox, SIGNAL(currentIndexChanged(int)),
+            this, SLOT(langToChanged(int)));
+
+    connect(changeLangButton, SIGNAL(clicked()),
+            this, SLOT(changeLangButtonClicked()));
+}
+
+
+void GoogleDialog::initializeUI() {
+    setWindowTitle(tr("Google Plugin Settings"));
+
+    langFromLabel = new QLabel(tr("From:"));
+    langToLabel = new QLabel(tr("To: "));
+
+    verticalLayout = new QVBoxLayout;
+    setLayout(verticalLayout);
+
+
+    langLayout = new QVBoxLayout;
+    langFromLayout = new QHBoxLayout;
+    langToLayout = new QHBoxLayout;
+    changeLangLayout = new QHBoxLayout;
+
+
+    #ifdef Q_WS_MAEMO_5
+        setMinimumHeight(370);
+        changeLangButton=new QPushButton(
+                                 QIcon::fromTheme("general_refresh"), "");
+    #else
+        changeLangButton=new QPushButton(
+                QIcon::fromTheme("object-flip-vertical"),"");
+    #endif
+
+    infoLabel = new QLabel;
+    infoLabel->setText(tr("Plugin: GoogleTranslator \n")+
+                   tr("From: ") + _langFrom + "\n" +
+                   tr("To: ") + _langTo);
+    verticalLayout->addWidget(infoLabel);
+
+
+    #ifdef Q_WS_MAEMO_5
+        connectInfoLabel = new QLabel(tr("Google plugin makes use of Internet "                                         "connection, so it may cost You."));
+        connectInfoLabel->setWordWrap(true);
+
+        verticalLayout->addWidget(connectInfoLabel);
+    #endif
+
+    langFromComboBox = new QComboBox;
+    langToComboBox = new QComboBox;
+
+    int i=0;
+    int actualLangTo=0;
+    int actualLangFrom=0;
+
+    foreach(QString langs, GooglePlugin::languages.keys()){
+        if(langs==_langTo)
+            actualLangTo=i;
+        if(langs==_langFrom)
+            actualLangFrom=i;
+        langToComboBox->addItem(langs);
+        langFromComboBox->addItem(langs);
+        i++;
+    }
+
+    langToComboBox->setCurrentIndex(actualLangTo);
+    langFromComboBox->setCurrentIndex(actualLangFrom);
+
+    langFromLayout->addWidget(langFromLabel);
+    langFromLayout->addWidget(langFromComboBox);
+
+    langToLayout->addWidget(langToLabel);
+    langToLayout->addWidget(langToComboBox);
+
+    langLayout->addLayout(langFromLayout);
+    langLayout->addLayout(langToLayout);
+
+    changeLangLayout->addLayout(langLayout);
+    changeLangLayout->addWidget(changeLangButton);
+
+    verticalLayout->addLayout(changeLangLayout);
+
+    confirmButton = new QPushButton;
+    if(type == New) {
+        confirmButton->setText(tr("Add"));
+    }
+    else {
+        confirmButton->setText(tr("Save settings"));
+    }
+
+    verticalLayout->addWidget(confirmButton);
+
+    setModal(true);
+}
+
+void GoogleDialog::langFromChanged(int index) {
+    _langFrom=langFromComboBox->itemText(index);
+}
+
+void GoogleDialog::langToChanged(int index) {
+     _langTo=langToComboBox->itemText(index);
+}
+
+void GoogleDialog::changeLangButtonClicked() {
+    int tempIndexTo=langToComboBox->currentIndex();
+    QString tempLangTo=_langTo;
+
+    langToComboBox->setCurrentIndex(langFromComboBox->currentIndex());
+    langFromComboBox->setCurrentIndex(tempIndexTo);
+
+    _langTo=_langFrom;
+    _langFrom=tempLangTo;
+}
+
+void GoogleDialog::accept() {
+    saveSettings();
+
+    QDialog::accept();
+}
+
+void GoogleDialog::saveSettings() {
+    _settings = new Settings;
+    if(plugin) {
+        foreach(QString key, plugin->settings()->keys())
+            _settings->setValue(key, plugin->settings()->value(key));
+    }
+
+    _settings->setValue("lang_to",
+                        GooglePlugin::languages.value(_langTo));
+    _settings->setValue("lang_from",
+                        GooglePlugin::languages.value(_langFrom));
+}
+
+Settings* GoogleDialog::getSettings() {
+    return _settings;
+}
diff --git a/src/plugins/google/GoogleDialog.h b/src/plugins/google/GoogleDialog.h
new file mode 100644 (file)
index 0000000..e448589
--- /dev/null
@@ -0,0 +1,118 @@
+/*******************************************************************************
+
+    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.
+
+*******************************************************************************/
+
+/*!
+    \file GoogleDialog.cpp
+    \author Mateusz Półrola <mateusz.polrola@gmail.com>
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+*/
+
+#ifndef GOOGLEDIALOG_H
+#define GOOGLEDIALOG_H
+
+#include <QDialog>
+#include "../../include/settings.h"
+#include <QtGui>
+#include "GooglePlugin.h"
+
+//! Implementation of google plugin's dialogs.
+/*!
+    This class can create dialogs for adding new dictionary or changins settings
+     of existing one, based on dialog type passed to contructor.
+     These type are different only in confirm button label.
+     Both provides comboboxes with availaible languages to choose.
+*/
+class GoogleDialog : public QDialog
+{
+    Q_OBJECT
+public:
+    /*!
+      Describes type of dialog. New means that dialog confirm button has label
+        Add", Change means dialog confirm button has label "Save settings"
+    */
+    enum GoogleDialogType {New, Change};
+
+    //! Constructor
+    /*!
+        Creates new google dialog
+        \param plugin if creating dialog of type Change it must be set to
+            pointer of plugin whose settings will be changed
+        \param type describes type of creating dialog
+        \param parent parent widget of creating dialog
+    */
+    explicit GoogleDialog(GooglePlugin* plugin = 0,
+                          GoogleDialogType type = New,
+                          QWidget* parent = 0);
+
+
+    //! Returns settings of plugin
+    /*!
+        After acceptance of dialog this method return plugin's settings based on
+         user choises in dialog.
+    */
+    Settings* getSettings();
+
+Q_SIGNALS:
+    //! Request to show notification
+    void notify(Notify::NotifyType, QString);
+
+public Q_SLOTS:
+    //! Reimplemented accept method, to save new settings
+    void accept();
+
+private Q_SLOTS:
+    //! assigns the language chosen from a list(langFromComboBox) to _langFrom
+    void langFromChanged(int);
+
+    //! assigns the language chosen from a list(langToComboBox) to _langTo
+    void langToChanged(int);
+
+    //! handles the "swap languages" button
+    void changeLangButtonClicked();
+
+private:
+    void initializeUI();
+
+    //! saves new settings after acceptance of dialog
+    void saveSettings();
+
+    QLabel* infoLabel;
+    QLabel* langFromLabel;
+    QLabel* langToLabel;
+    QLabel* connectInfoLabel;
+    QPushButton* confirmButton;
+    QPushButton* changeLangButton;
+    QComboBox *langFromComboBox;
+    QComboBox *langToComboBox;
+    QVBoxLayout* verticalLayout;
+    QVBoxLayout* langLayout;
+    QHBoxLayout* langFromLayout;
+    QHBoxLayout* langToLayout;
+    QHBoxLayout* changeLangLayout;
+    QString _langFrom;
+    QString _langTo;
+
+    Settings* _settings;
+    GooglePlugin* plugin;
+    GoogleDialogType type;
+};
+
+#endif // GOOGLEDIALOG_H
index a4125c4..bd6bd37 100644 (file)
@@ -24,6 +24,7 @@
 */
 
 #include "GoogleDictDialog.h"
+#include "GoogleDialog.h"
 
 GoogleDictDialog::GoogleDictDialog(GooglePlugin *plugin, QObject *parent) :
     DictDialog(parent) {
@@ -31,10 +32,26 @@ GoogleDictDialog::GoogleDictDialog(GooglePlugin *plugin, QObject *parent) :
 }
 
 Settings* GoogleDictDialog::addNewDictionary(QWidget *parent) {
-   return GoogleSettingsDialog::getSettings(parent);
+    GoogleDialog d(0, GoogleDialog::New, parent);
+
+    connect(&d, SIGNAL(notify(Notify::NotifyType,QString)),
+            this, SIGNAL(notify(Notify::NotifyType,QString)));
+
+    if(d.exec() == QDialog::Accepted) {
+        return d.getSettings();
+    }
+
+    return 0;
 }
 
 void GoogleDictDialog::changeSettings(QWidget * parent) {
-    GoogleSettingsDialog::changeSettings(plugin,parent);
+    GoogleDialog d(plugin, GoogleDialog::Change, parent);
+
+    connect(&d, SIGNAL(notify(Notify::NotifyType,QString)),
+            this, SIGNAL(notify(Notify::NotifyType,QString)));
+
+    if(d.exec() == QDialog::Accepted) {
+        plugin->setSettings(d.getSettings());
+    }
 }
 
index 7823dab..243d35b 100644 (file)
@@ -31,7 +31,6 @@
 #include "../../include/DictDialog.h"
 #include "../../include/settings.h"
 #include "GooglePlugin.h"
-#include "GoogleSettingsDialog.h"
 
 class GooglePlugin;
 
index 7564064..20df8aa 100644 (file)
@@ -27,6 +27,8 @@
 #include <QDebug>
 #include "GoogleDictDialog.h"
 
+QMap<QString, QString> GooglePlugin::languages;
+
 GooglePlugin::GooglePlugin(QObject *parent): CommonDictInterface(parent),
                     _name(""),_infoNote("") {
     _settings = new Settings();
@@ -38,7 +40,7 @@ GooglePlugin::GooglePlugin(QObject *parent): CommonDictInterface(parent),
     _icon = QIcon("/usr/share/mdictionary/google.png");
 
     stopped = false;
-    languages=initLanguages();
+    initLanguages();
 
     http = new QHttp(this);
     connect(http, SIGNAL(done(bool)), this, SLOT(done()));
@@ -47,14 +49,12 @@ GooglePlugin::GooglePlugin(QObject *parent): CommonDictInterface(parent),
 void GooglePlugin::retranslate() {
     QString locale = QLocale::system().name();
 
-    QTranslator *googleTranslator = new QTranslator(this);
-
-    if(locale == "pl_PL")
-        googleTranslator->load(":/translations/dict_google_pl");
-    else
-        googleTranslator->load(":/translations/dict_google_en");
+    QTranslator *translator = new QTranslator(this);
 
-    QCoreApplication::installTranslator(googleTranslator);
+    if(!translator->load(":/translations/" + locale)) {
+        translator->load(":/translations/en_EN");
+    }
+    QCoreApplication::installTranslator(translator);
 }
 
 
@@ -299,8 +299,9 @@ void GooglePlugin::stop() {
 }
 
 
-QMap<QString, QString> GooglePlugin::initLanguages() {
-    QMap<QString, QString> languages;
+void GooglePlugin::initLanguages() {
+    if(languages.count() != 0) return;
+
     languages["Afrikaans"] = "af";
     languages["Albanian"] = "sq";
     languages["Arabic"] = "ar";
@@ -408,7 +409,6 @@ QMap<QString, QString> GooglePlugin::initLanguages() {
 //    languages["TONGA"] = "to";
 //    languages["UZBEK"] = "uz";
 //    languages["UIGHUR"] = "ug";
-    return languages;  
 }
 
 
index 2d9d7ff..a87e7e9 100644 (file)
@@ -104,7 +104,9 @@ public:
     Translation* getTranslationFor(QString key);
 
     //! initializes the list of available languages in Google translator
-    static QMap<QString, QString> initLanguages();
+    static void initLanguages();
+
+    static QMap<QString, QString> languages;
 
 public slots:
     /*! performs search in dictionary
@@ -132,9 +134,6 @@ public slots:
     void retranslate();
 
 private:
-    //! maps languages full names to two-letter acronyms
-    QMap<QString, QString> languages;
-
     //! name of a dictionary
     QString _name;
     //! type of a dictionary
diff --git a/src/plugins/google/GoogleSettingsDialog.cpp b/src/plugins/google/GoogleSettingsDialog.cpp
deleted file mode 100644 (file)
index 0aaa9ad..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
-
-    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.
-
-*******************************************************************************/
-
-/*! \file GoogleSettingsDialog.cpp
-    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
-*/
-
-#include "GoogleSettingsDialog.h"
-#include <QDebug>
-
-GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent,
-                                           Settings *pluginSettings,
-                                           QString acceptButtonLabel) :
-                                           QDialog(parent)
-{
-    QMap<QString, QString> languages;
-    languages=GooglePlugin::initLanguages();
-
-    int actualLangTo=1;
-    int actualLangFrom=1;
-
-    if(pluginSettings==0) {
-        _langTo=languages.key("pl");
-        _langFrom=languages.key("en");
-    }
-    else {
-        _langTo=languages.key(pluginSettings->value("lang_to"));
-        _langFrom=languages.key(pluginSettings->value("lang_from"));
-    }
-
-
-    #ifdef Q_WS_MAEMO_5
-        setMinimumHeight(370);
-        changeLangButton=new QPushButton(
-                                 QIcon::fromTheme("general_refresh"), "");
-    #else
-        changeLangButton=new QPushButton(
-                QIcon::fromTheme("object-flip-vertical"),tr(""));
-    #endif
-
-    langFromLabel = new QLabel(tr("From:"));
-    langToLabel = new QLabel(tr(" To: "));
-
-    setWindowTitle(tr("Google Settings"));
-
-    verticalLayout = new QVBoxLayout;
-    langLayout = new QVBoxLayout;
-    langFromLayout = new QHBoxLayout;
-    langToLayout = new QHBoxLayout;
-    changelangLayout = new QHBoxLayout;
-
-    setLayout(verticalLayout);
-
-    infoLabel = new QLabel;
-    infoLabel->setText(tr("Plugin: GoogleTranslator \n")+
-                   tr("From: ") + _langFrom + "\n" +
-                   tr("To: ") + _langTo);
-    verticalLayout->addWidget(infoLabel);
-
-
-    #ifdef Q_WS_MAEMO_5
-        connectInfoLabel = new QLabel(tr("Google plugin makes use of Internet "
-                                         "connection, so it may cost You."));
-        connectInfoLabel->setWordWrap(true);
-
-        verticalLayout->addWidget(connectInfoLabel);
-    #endif
-
-    langFromComboBox = new QComboBox;
-    langToComboBox = new QComboBox;
-
-    int i=0;
-    foreach(QString langs,languages.keys()){
-        if(langs==_langTo)
-            actualLangTo=i;
-        if(langs==_langFrom)
-            actualLangFrom=i;
-        langToComboBox->addItem(langs);
-        langFromComboBox->addItem(langs);
-        i++;
-    }
-    langToComboBox->setCurrentIndex(actualLangTo);
-    langFromComboBox->setCurrentIndex(actualLangFrom);
-
-
-    langFromLayout->addWidget(langFromLabel);
-    langFromLayout->addWidget(langFromComboBox);
-    langToLayout->addWidget(langToLabel);
-    langToLayout->addWidget(langToComboBox);
-
-
-    langLayout->addLayout(langFromLayout);
-    langLayout->addLayout(langToLayout);
-    changelangLayout->addLayout(langLayout);
-    changelangLayout->addWidget(changeLangButton);
-    verticalLayout->addLayout(changelangLayout);
-
-    saveButton = new QPushButton(acceptButtonLabel);
-    verticalLayout->addWidget(saveButton);
-
-    setModal(true);
-
-    connect(saveButton, SIGNAL(clicked()),
-            this, SLOT(accept()));
-
-
-    connect(langFromComboBox, SIGNAL(activated(int)),
-            this, SLOT(activatedFrom(int)));
-    connect(langToComboBox, SIGNAL(activated(int)),
-            this, SLOT(activatedTo(int)));
-
-
-    connect(changeLangButton, SIGNAL(clicked()),
-            this, SLOT(changeLangButtonClicked()));
-}
-
-
-void GoogleSettingsDialog::activatedFrom(int index) {
-        _langFrom=langFromComboBox->itemText(index);
-}
-
-void GoogleSettingsDialog::activatedTo(int index) {
-     _langTo=langToComboBox->itemText(index);
-}
-
-
-void GoogleSettingsDialog::changeLangButtonClicked() {
-
-    int tempIndexTo=langToComboBox->currentIndex();
-    QString tempLangTo=_langTo;
-    langToComboBox->setCurrentIndex(langFromComboBox->currentIndex());
-    langFromComboBox->setCurrentIndex(tempIndexTo);
-    _langTo=_langFrom;
-    _langFrom=tempLangTo;
-
-}
-
-QString GoogleSettingsDialog::langFrom() {
-    return _langFrom;
-}
-
-QString GoogleSettingsDialog::langTo() {
-    return _langTo;
-}
-
-Settings* GoogleSettingsDialog::getSettings(QWidget *parent,
-                                            Settings *pluginSettings,
-                                             QString acceptButtonLabel) {
-    GoogleSettingsDialog settingsDialog(parent,pluginSettings,acceptButtonLabel);
-
-    QMap<QString, QString> languages;
-    languages=GooglePlugin::initLanguages();
-    if(settingsDialog.exec()==QDialog::Accepted) {
-        Settings *settings = new Settings();
-        settings->setValue("lang_to",languages.value(settingsDialog.langTo()));
-        settings->setValue("lang_from",languages.value(settingsDialog.langFrom()));
-        settings->setValue("connection_accepted","true");
-        settings->setValue("type","google");
-        return settings;
-    }
-    return 0;
-}
-
-void GoogleSettingsDialog::changeSettings(GooglePlugin* plugin,
-                                          QWidget *parent) {
-    Settings *settings = new Settings();
-    settings=getSettings(parent,plugin->settings(),tr("Save changes"));
-    plugin->setSettings(settings);
-    delete settings;
-}
diff --git a/src/plugins/google/GoogleSettingsDialog.h b/src/plugins/google/GoogleSettingsDialog.h
deleted file mode 100644 (file)
index 991f65c..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
-
-    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.
-
-*******************************************************************************/
-
-/*! \file GoogleSettingsDialog.h
-    \brief Class creates dialog to get or change settings for Google Plugin
-    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
-*/
-
-#ifndef GOOGLESETTINGSDIALOG_H
-#define GOOGLESETTINGSDIALOG_H
-
-#include <QDialog>
-#include "../../include/settings.h"
-#include <QtGui>
-#include "GooglePlugin.h"
-
-class GooglePlugin;
-
-class GoogleSettingsDialog : public QDialog
-{
-    Q_OBJECT
-public:
-    explicit GoogleSettingsDialog(QWidget *parent = 0,
-                                  Settings *pluginSettings=0,
-                                  QString acceptButtonLabel = tr("Add"));
-
-    /*!
-        \param parent parent widget on which dialog will be displayed
-        \param langTo language which is displayed in the comboBox as a startup item
-        \param langFrom language which is displayed in the comboBox as a startup item
-        \returns function returns settings to GooglePlugin
-    */
-    static Settings* getSettings(QWidget *parent,
-                                 Settings *pluginSettings=0,
-                                 QString acceptButtonLabel = tr("Add"));
-    /*!
-        function sets a new settings in plugin;
-        \param plugin plugin whose settings you will change
-        \param parent parent widget on which dialog will be displayed
-    */
-    static void changeSettings(GooglePlugin* plugin, QWidget *parent);
-
-    //! \return source language code iso 639-2
-    QString langFrom();
-
-    //! \return destination language code iso 639-2
-    QString langTo();
-
-private slots:
-    //! assigns the language chosen from a list(langFromComboBox) to _langFrom
-    void activatedFrom(int);
-    //! assigns the language chosen from a list(langToComboBox) to _langTo
-    void activatedTo(int);
-    //! handles the "swap languages" button
-    void changeLangButtonClicked();
-
-
-private:
-    QLabel* infoLabel;
-    QLabel* langFromLabel;
-    QLabel* langToLabel;
-    QLabel* connectInfoLabel;
-    QPushButton* saveButton;
-    QPushButton* changeLangButton;
-    QComboBox *langFromComboBox;
-    QComboBox *langToComboBox;
-    QVBoxLayout* verticalLayout;
-    QVBoxLayout* langLayout;
-    QHBoxLayout* langFromLayout;
-    QHBoxLayout* langToLayout;
-    QHBoxLayout* changelangLayout;
-    QString _langFrom;
-    QString _langTo;
-};
-
-#endif // GOOGLESETTINGSDIALOG_H
index 08d7460..85aec3b 100644 (file)
@@ -6,7 +6,7 @@ SOURCES +=  \
     GooglePlugin.cpp \
     TranslationGoogle.cpp \
     GoogleDictDialog.cpp \
-    GoogleSettingsDialog.cpp
+    GoogleDialog.cpp
 
 HEADERS += \
     GooglePlugin.h \
@@ -16,7 +16,7 @@ HEADERS += \
     ../../include/CommonDictInterface.h \
     TranslationGoogle.h \
     GoogleDictDialog.h \
-    GoogleSettingsDialog.h
+    GoogleDialog.h
 
 TRANSLATIONS += dict_google_pl.ts \
                 dict_google_en.ts
index cc5794c..47a4287 100644 (file)
@@ -1,6 +1,6 @@
 <RCC>
     <qresource prefix="/">
-        <file>translations/dict_google_en.qm</file>
-        <file>translations/dict_google_pl.qm</file>
+        <file>translations/en_EN.qm</file>
+        <file>translations/pl_PL.qm</file>
     </qresource>
 </RCC>
diff --git a/src/plugins/google/translations/dict_google_en.qm b/src/plugins/google/translations/dict_google_en.qm
deleted file mode 100644 (file)
index 9dad8df..0000000
Binary files a/src/plugins/google/translations/dict_google_en.qm and /dev/null differ
diff --git a/src/plugins/google/translations/dict_google_pl.qm b/src/plugins/google/translations/dict_google_pl.qm
deleted file mode 100644 (file)
index 24a516f..0000000
Binary files a/src/plugins/google/translations/dict_google_pl.qm and /dev/null differ
diff --git a/src/plugins/google/translations/en_EN.qm b/src/plugins/google/translations/en_EN.qm
new file mode 100644 (file)
index 0000000..9dad8df
Binary files /dev/null and b/src/plugins/google/translations/en_EN.qm differ
diff --git a/src/plugins/google/translations/pl_PL.qm b/src/plugins/google/translations/pl_PL.qm
new file mode 100644 (file)
index 0000000..24a516f
Binary files /dev/null and b/src/plugins/google/translations/pl_PL.qm differ
index 7a622d4..442e8fd 100644 (file)
@@ -38,9 +38,6 @@ TranslationXdxf::TranslationXdxf(QString _key, QString _dictionaryInfo,
     _bookmark=0;
 }
 
-TranslationXdxf::~TranslationXdxf() {
-    ;
-}
 
 QString TranslationXdxf::key() const {
     return _key;
index c28af27..3611642 100644 (file)
@@ -31,8 +31,9 @@ class TranslationXdxf : public Translation
 {
 public:
     TranslationXdxf();
-    TranslationXdxf(QString _key,QString _dictionaryInfo, XdxfPlugin *xdxfPlugin);
-    ~TranslationXdxf();
+    TranslationXdxf(QString _key,
+                    QString _dictionaryInfo,
+                    XdxfPlugin *xdxfPlugin);
 
     //! \return word to be translated
     QString key() const;
index 8083ae6..3e0a2d6 100644 (file)
@@ -28,9 +28,7 @@
 #include <QDebug>
 
 
-XdxfCachingDialog::XdxfCachingDialog(XdxfPlugin *parent) //:
-//    QDialog((QWidget*)parent)
-{
+XdxfCachingDialog::XdxfCachingDialog(XdxfPlugin *parent) {
     verticalLayout = new QVBoxLayout(this);
     setLayout(verticalLayout);
 
@@ -54,8 +52,8 @@ XdxfCachingDialog::XdxfCachingDialog(XdxfPlugin *parent) //:
     connect(cancelButton, SIGNAL(clicked()),
             this, SIGNAL(cancelCaching()));
 
-   connect(parent, SIGNAL(updateCachingProgress(int, int)),
-           this, SLOT(updateCachingProgress(int, int)));
+    connect(parent, SIGNAL(updateCachingProgress(int, int)),
+       this, SLOT(updateCachingProgress(int, int)));
     time.start();
 }
 
@@ -71,10 +69,4 @@ void XdxfCachingDialog::updateCachingProgress(int progress, int time) {
                           tr("%n second(s)", "", seconds));
     if(progress >= 100)
         this->hide();
-        
-
-}
-
-void XdxfCachingDialog::cancelButtonClicked(){
-    return;
 }
index 8d638f7..3bbb2ee 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-/*! \file XdxfCachingDialog.h
+/*!
+    \file XdxfCachingDialog.h
+    \author Mateusz Półrola <mateusz.polrola@gmail.com>
 */
-//Created by Mateusz Półrola
+
 
 #ifndef XDXFCACHINGDIALOG_H
 #define XDXFCACHINGDIALOG_H
 
 class XdxfPlugin;
 
-
+//! Shows dialog with progress of dictionary caching
+/*!
+    Displays progress bar and estimated time left of caching
+*/
 class XdxfCachingDialog : public QDialog
 {
     Q_OBJECT
@@ -43,7 +48,6 @@ Q_SIGNALS:
     void cancelCaching();
 
 private Q_SLOTS:
-    void cancelButtonClicked();
     void updateCachingProgress(int, int);
 
 private:
index 0927061..04bf67d 100644 (file)
@@ -89,7 +89,7 @@ void XdxfDialog::initializeUI() {
                        tr("From: ") + plugin->langFrom() + "\n" +
                        tr("To: ") + plugin->langTo() + "\n" +
                        tr("Description: ") + plugin->name() + "\n" +
-                       tr("License: ") + plugin->infoNote());
+                       plugin->infoNote());
         mainVerticalLayout->addWidget(infoLabel);
     }
 
index c5bea58..6108eff 100644 (file)
 
 *******************************************************************************/
 
-//Created by Mateusz Półrola
+/*!
+    \file XdxfDialog.cpp
+    \author Mateusz Półrola <mateusz.polrola@gmail.com>
+*/
 
 #ifndef XDXFDIALOG_H
 #define XDXFDIALOG_H
 #include <QtGui>
 #include "xdxfplugin.h"
 
+
+//! Implementation of xdxf plugin's dialogs.
+/*!
+    This class can create dialogs for adding new dictionary or changins settings
+     of existing one, based on dialog type passed to contructor.
+    When adding new dictionary dialog contains button to browse file system and
+    select dictionary file. When changing settings dialog displays basic
+    information about dictionary i. e. name, languages and license info.
+    In both types of dialogs there are comboboxes with cache and remove accents
+     options. On maemo right next to comboboxes are tool button which allow to
+     see more information about this options, on desktop the same information is
+     displayed as tool tip.
+    All content of dialog is in scroll area.
+*/
 class XdxfDialog : public QDialog
 {
     Q_OBJECT
 public:
+    /*!
+      Describes type of dialog. New means that dialog contains widgets to browse
+        file system and select dictionary file. Change means that dialog displays
+     information about dictionary.
+      In both types dialog provides widgets to create or delete cache and remove
+     or left accents.
+    */
     enum XdxfDialogType {New, Change};
 
+    //! Constructor
+    /*!
+        Creates new xdxf dialog
+        \param plugin if creating dialog of type Change it must be set to
+            pointer of plugin whose settings will be changed
+        \param type describes type of creating dialog
+        \param parent parent widget of creating dialog
+    */
     explicit XdxfDialog(XdxfPlugin* plugin = 0,
                         XdxfDialogType type = New,
-                        QWidget *parent = 0);
+                        QWidget* parent = 0);
 
+    //! Returns settings of plugin
+    /*!
+        After acceptance of dialog this method return plugin's settings based on
+         user choises in dialog.
+    */
     Settings* getSettings();
 
 Q_SIGNALS:
+    //! Request to show notification
     void notify(Notify::NotifyType, QString);
 
 public Q_SLOTS:
+    //! Reimplemented accept method, to check if all necessery fields in
+    //! dialog are correct e. g. dictionary file path
+    //! and saves new settings
     void accept();
 
 private Q_SLOTS:
+    //! displays dialog to browse and select file
     void selectFile();
-    void saveSettings();
     void setGenerateCache(bool);
     void setAccents(bool);
 
     #ifdef Q_WS_MAEMO_5
+        //! on maemo shows information about checkboxes
         void showCacheInfo();
         void showAccentsInfo();
     #endif
@@ -62,6 +104,9 @@ private Q_SLOTS:
 private:
     void initializeUI();
 
+    //! saves new settings after acceptance of dialog
+    void saveSettings();
+
     QLabel* infoLabel;
     QPushButton* browseButton;
     QHBoxLayout* browseLayout;
index de4d9aa..9baf951 100644 (file)
@@ -24,8 +24,6 @@
 //Created by Mateusz Półrola
 
 #include "XdxfDictDialog.h"
-#include "XdxfLoadDialog.h"
-#include "XdxfSettingsDialog.h"
 #include "xdxfplugin.h"
 #include "XdxfDialog.h"
 #include <QDebug>
@@ -36,7 +34,6 @@ XdxfDictDialog::XdxfDictDialog(XdxfPlugin *plugin, QObject *parent) :
 }
 
 Settings* XdxfDictDialog::addNewDictionary(QWidget *parent) {
-    qDebug()<<parent;
     XdxfDialog d(0, XdxfDialog::New, parent);
 
     connect(&d, SIGNAL(notify(Notify::NotifyType,QString)),
index f7b06f2..5edadbe 100644 (file)
@@ -26,7 +26,6 @@
 #define XDXFDICTDIALOG_H
 
 #include "../../include/DictDialog.h"
-#include "XdxfLoadDialog.h"
 
 class XdxfPlugin;
 
diff --git a/src/plugins/xdxf/XdxfLoadDialog.cpp b/src/plugins/xdxf/XdxfLoadDialog.cpp
deleted file mode 100644 (file)
index 5f02463..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
-
-    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.
-
-*******************************************************************************/
-
-/*! \file XdxfLoadDialog.cpp
-*/
-//Created by Mateusz Półrola
-
-#include "XdxfLoadDialog.h"
-
-XdxfLoadDialog::XdxfLoadDialog(QWidget *parent) :
-    QDialog(parent) {
-    verticalLayout = new QVBoxLayout;
-    setLayout(verticalLayout);
-
-    setWindowTitle(tr("Add new XDXF dictionary"));
-
-
-
-    browseLayout = new QHBoxLayout;
-
-    browseButton =  new QPushButton(tr("Browse"));
-    browseLabel = new QLabel(tr("Dictionary file: not selected"));
-    //browseLabel->setMargin(5);
-
-    browseLayout->addWidget(browseLabel, 0, Qt::AlignLeft);
-    browseLayout->addWidget(browseButton, 0, Qt::AlignRight);
-
-    verticalLayout->addLayout(browseLayout);
-
-    cacheLayout = new QHBoxLayout;
-    verticalLayout->addLayout(cacheLayout);
-    accentsCheckBox = new QCheckBox(tr("Strip accents (searching takes more "
-                 "time, but spelling don't have to be exact)"));
-    verticalLayout->addWidget(accentsCheckBox);
-
-    cacheCheckBox = new QCheckBox(tr("Optimize for quicker searches (may take some time)"),this);
-    cacheCheckBox->setChecked(true);
-    cacheLayout->addWidget(cacheCheckBox);
-
-    addButton = new QPushButton(tr("Add"));
-
-    verticalLayout->addWidget(addButton);
-
-    setModal(true);
-
-    connect(browseButton, SIGNAL(clicked()),
-            this, SLOT(selectFile()));
-
-    connect(addButton, SIGNAL(clicked()),
-            this, SLOT(addDictionary()));
-
-    connect(cacheCheckBox, SIGNAL(toggled(bool)),
-            SLOT(setGenerateCache(bool)));
-
-    connect(accentsCheckBox, SIGNAL(clicked(bool)), SLOT(setAccents(bool)));
-    lastAccents = accentsCheckBox->isChecked();
-    _dicitonaryFilePath = QString();
-}
-
-
-
-void XdxfLoadDialog::setAccents(bool state) {
-    lastAccents = state;
-}
-
-
-
-void XdxfLoadDialog::selectFile() {
-    QString fileName = QFileDialog::getOpenFileName(this,
-                                     tr("Select dictionary file"),
-                                     _dicitonaryFilePath,
-                                     tr("XDXF Files (*.xdxf)"),
-                                     NULL,
-                                     NULL);
-
-    if (!fileName.isEmpty()) {
-        browseLabel->setText(tr("Dictionary file: %1").arg(fileName));
-        _dicitonaryFilePath = fileName;
-    }repaint(rect());
-    resize(size());
-}
-
-void XdxfLoadDialog::addDictionary() {
-    _generateCache = cacheCheckBox->isChecked();
-    if(!_dicitonaryFilePath.isEmpty()) {
-        accept();
-    }
-}
-
-QString XdxfLoadDialog::dicitonaryFilePath() {
-    return _dicitonaryFilePath;
-}
-
-bool XdxfLoadDialog::generateCache() {
-    return _generateCache;
-}
-
-void XdxfLoadDialog::setGenerateCache(bool generate) {
-    _generateCache = generate;
-
-    if(generate)
-        accentsCheckBox->setChecked(true);
-    else
-        accentsCheckBox->setChecked(lastAccents);
-
-    accentsCheckBox->setEnabled(!generate);
-}
-
-Settings* XdxfLoadDialog::getSettings(QWidget *parent) {
-    XdxfLoadDialog loadDialog(parent);
-    Settings* settings = new Settings;
-
-    if(loadDialog.exec()==QDialog::Accepted) {
-        settings->setValue("path", loadDialog.dicitonaryFilePath());
-        if(loadDialog.generateCache()) {
-            settings->setValue("generateCache", "true");
-        }
-        else {
-            settings->setValue("generateCache", "false");
-        }
-        if(loadDialog.accentsCheckBox->isChecked())
-            settings->setValue("strip_accents", "true");
-        else
-            settings->setValue("strip_accents", "false");
-
-
-        return settings;
-    }
-
-    return NULL;
-}
-
-
diff --git a/src/plugins/xdxf/XdxfLoadDialog.h b/src/plugins/xdxf/XdxfLoadDialog.h
deleted file mode 100644 (file)
index f7c41cf..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
-
-    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.
-
-*******************************************************************************/
-/*! \file XdxfLoadDialog.h
-*/
-//Created by Mateusz Półrola
-
-#ifndef XDXFLOADDIALOG_H
-#define XDXFLOADDIALOG_H
-
-#include <QDialog>
-#include <QtGui>
-#include "../../include/settings.h"
-
-//! Displays dialog which allows user to add new xdxf dictionary
-class XdxfLoadDialog : public QDialog {
-    Q_OBJECT
-public:
-    explicit XdxfLoadDialog(QWidget *parent = 0);
-
-    /*! Displays dialog and returns settings of new dictionary
-        \return Settings object containing new dictionary settings or NULL in
-        case user cancels dialog
-    */
-    static Settings* getSettings(QWidget *parent);
-
-    //! Returns dictionary file path chosen by user
-    QString dicitonaryFilePath();
-
-    //! Returns if user wants to cache dictionary
-    bool generateCache();
-
-private Q_SLOTS:
-    void selectFile();
-    void addDictionary();
-    void setGenerateCache(bool);
-    void setAccents(bool);
-
-private:
-    QPushButton* addButton;
-    QPushButton* browseButton;
-    QLabel* browseLabel;
-    QCheckBox* cacheCheckBox;
-    QCheckBox* accentsCheckBox;
-    QVBoxLayout* verticalLayout;
-    QHBoxLayout* browseLayout;
-    QHBoxLayout* cacheLayout;
-    QString _dicitonaryFilePath;
-    bool _generateCache;
-    bool lastAccents;
-
-};
-
-#endif // XDXFLOADDIALOG_H
diff --git a/src/plugins/xdxf/XdxfSettingsDialog.cpp b/src/plugins/xdxf/XdxfSettingsDialog.cpp
deleted file mode 100644 (file)
index fa262a8..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
-
-    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.
-
-*******************************************************************************/
-
-/*! \file XdxfSettingsDialog.cpp
-*/
-
-
-#include "XdxfSettingsDialog.h"
-#include <QDebug>
-
-XdxfSettingsDialog::XdxfSettingsDialog(XdxfPlugin *plugin, QWidget *parent) :
-    QDialog(parent)
-{
-    this->plugin = plugin;
-
-    verticalLayout = new QVBoxLayout;
-
-    QWidget* w = new QWidget;
-    w->setLayout(verticalLayout);
-
-    setWindowTitle(tr("XDXF Settings"));
-
-
-    infoLabel = new QLabel(this);
-
-    infoLabel->setText(tr("Plugin: ") + plugin->type().toUpper() +"\n" +
-                   tr("From: ") + plugin->langFrom() + "\n" +
-                   tr("To: ") + plugin->langTo() + "\n" +
-                   tr("Description: ") + plugin->name() + "\n" +
-                   tr("License: ") + plugin->infoNote());
-    infoLabel->setWordWrap(true);
-
-
-    verticalLayout->addWidget(infoLabel);
-
-
-    accentsCheckBox = new QCheckBox(tr("Strip accents"));
-    /*(searching takes more time, "
-                     "but spelling don't have to be exact)*/
-    if(plugin->settings()->value("strip_accents") == "true")
-        accentsCheckBox->setChecked(true);
-    else
-        accentsCheckBox->setChecked(false);
-
-    cacheCheckBox = new QCheckBox(tr("Optimize for quicker searches"));
-/*(may take some time)*/
-    if(plugin->settings()->value("cached") == "true") {
-        cacheCheckBox->setChecked(true);
-        accentsCheckBox->setChecked(true);
-        accentsCheckBox->setEnabled(false);
-        _generateCache = true;
-    }
-    else {
-        cacheCheckBox->setChecked(false);
-        _generateCache = false;
-    }
-
-    accentsToolButton = new QToolButton;
-    cacheToolButton = new QToolButton;
-
-    accentsToolButton->setIcon(QIcon::fromTheme("general_information"));
-    cacheToolButton->setIcon(QIcon::fromTheme("general_information"));
-
-    cacheLayout = new QHBoxLayout;
-    accentsLayout = new QHBoxLayout;
-
-    accentsLayout->addWidget(accentsCheckBox);
-    accentsLayout->addWidget(accentsToolButton);
-
-    cacheLayout->addWidget(cacheCheckBox);
-    cacheLayout->addWidget(cacheToolButton);
-
-    verticalLayout->addLayout(cacheLayout);
-    verticalLayout->addLayout(accentsLayout);
-
-
-
-    saveButton = new QPushButton(tr("Save settings"));
-
-    verticalLayout->addWidget(saveButton);
-
-    scrollArea = new QScrollArea;
-    scrollArea->setWidget(w);
-
-
-    QHBoxLayout* layout = new QHBoxLayout();
-
-    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-    scrollArea->setWidgetResizable(true);
-    layout->addWidget(scrollArea);
-    setLayout(layout);
-
-
-
-    setModal(true);
-
-    connect(saveButton, SIGNAL(clicked()),
-            this, SLOT(accept()));
-
-    connect(cacheCheckBox, SIGNAL(toggled(bool)),
-            SLOT(setGenerateCache(bool)));
-
-    connect(accentsCheckBox, SIGNAL(clicked(bool)), SLOT(setAccents(bool)));
-
-
-    _dicitonaryFilePath = plugin->settings()->value("path");
-    lastAccents = accentsCheckBox->isChecked();
-}
-
-
-void XdxfSettingsDialog::setAccents(bool state) {
-    lastAccents = state;
-}
-
-void XdxfSettingsDialog::setGenerateCache(bool generate) {
-    _generateCache = generate;
-
-    if(generate)
-        accentsCheckBox->setChecked(true);
-    else
-        accentsCheckBox->setChecked(lastAccents);
-
-    accentsCheckBox->setEnabled(!generate);
-}
-
-bool XdxfSettingsDialog::generateCache() {
-    return _generateCache;
-}
-
-QString XdxfSettingsDialog::dicitonaryFilePath() {
-    return _dicitonaryFilePath;
-}
-
-Settings* XdxfSettingsDialog::getSettings(XdxfPlugin *plugin,
-                                          QWidget *parent) {
-    XdxfSettingsDialog settingsDialog(plugin, parent);
-
-
-    if(settingsDialog.exec()==QDialog::Accepted) {
-        Settings* settings = new Settings;
-        foreach(QString key, plugin->settings()->keys())
-            settings->setValue(key, plugin->settings()->value(key));
-        settings->setValue("path", settingsDialog.dicitonaryFilePath());
-
-        if(settingsDialog.generateCache()) {
-            settings->setValue("generateCache", "true");
-        }
-        else {
-            settings->setValue("generateCache", "false");
-        }
-
-        if(settingsDialog.accentsCheckBox->isChecked())
-            settings->setValue("strip_accents", "true");
-        else
-            settings->setValue("strip_accents", "false");
-
-        plugin->setSettings(settings);
-        delete settings;
-        return 0;
-    }
-
-    return 0;
-}
-
-
diff --git a/src/plugins/xdxf/XdxfSettingsDialog.h b/src/plugins/xdxf/XdxfSettingsDialog.h
deleted file mode 100644 (file)
index b1cd533..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
-
-    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.
-
-*******************************************************************************/
-/*! \file XdxfSettingsDialog.h
-*/
-//Created by Mateusz Półrola
-
-#ifndef XDXFSETTINGSDIALOG_H
-#define XDXFSETTINGSDIALOG_H
-
-#include <QDialog>
-#include "../../include/settings.h"
-#include <QtGui>
-#include "xdxfplugin.h"
-
-class XdxfSettingsDialog : public QDialog
-{
-    Q_OBJECT
-public:
-    explicit XdxfSettingsDialog(XdxfPlugin* plugin, QWidget *parent = 0);
-    //! \returns settings of a given plugin
-    static Settings* getSettings(XdxfPlugin* plugin, QWidget *parent);
-
-    //! \returns dictionary file path chosen by user
-    QString dicitonaryFilePath();
-
-    //! \returns if user wants to cache dictionary
-    bool generateCache();
-
-private Q_SLOTS:
-    void setGenerateCache(bool);
-    void setAccents(bool);
-
-private:
-    QLabel* infoLabel;
-    QPushButton* saveButton;
-
-
-    QCheckBox* cacheCheckBox;
-    QCheckBox* accentsCheckBox;
-
-    QHBoxLayout* cacheLayout;
-    QHBoxLayout* accentsLayout;
-
-    QToolButton* cacheToolButton;
-    QToolButton* accentsToolButton;
-
-    QVBoxLayout* verticalLayout;
-
-    QString _dicitonaryFilePath;
-    bool _generateCache;
-    XdxfPlugin* plugin;
-    bool lastAccents;
-
-    QScrollArea* scrollArea;
-
-};
-
-#endif // XDXFSETTINGSDIALOG_H
diff --git a/src/plugins/xdxf/translations/dict_xdxf_en.qm b/src/plugins/xdxf/translations/dict_xdxf_en.qm
deleted file mode 100644 (file)
index 900f716..0000000
Binary files a/src/plugins/xdxf/translations/dict_xdxf_en.qm and /dev/null differ
diff --git a/src/plugins/xdxf/translations/dict_xdxf_pl.qm b/src/plugins/xdxf/translations/dict_xdxf_pl.qm
deleted file mode 100644 (file)
index 8ab7e05..0000000
Binary files a/src/plugins/xdxf/translations/dict_xdxf_pl.qm and /dev/null differ
diff --git a/src/plugins/xdxf/translations/en_EN.qm b/src/plugins/xdxf/translations/en_EN.qm
new file mode 100644 (file)
index 0000000..900f716
Binary files /dev/null and b/src/plugins/xdxf/translations/en_EN.qm differ
diff --git a/src/plugins/xdxf/translations/pl_PL.qm b/src/plugins/xdxf/translations/pl_PL.qm
new file mode 100644 (file)
index 0000000..8ab7e05
Binary files /dev/null and b/src/plugins/xdxf/translations/pl_PL.qm differ
index 03e714e..f8dc5db 100644 (file)
@@ -5,9 +5,7 @@ include(../plugin.pri)
 SOURCES +=  \
     xdxfplugin.cpp \
     TranslationXdxf.cpp \
-    XdxfLoadDialog.cpp \
     XdxfDictDialog.cpp \
-    XdxfSettingsDialog.cpp \
     XdxfCachingDialog.cpp \
     XdxfDialog.cpp
 
@@ -15,13 +13,11 @@ SOURCES +=  \
 HEADERS += \
     xdxfplugin.h \
     TranslationXdxf.h \
-    XdxfLoadDialog.h \
     ../../include/DictDialog.h \
     XdxfDictDialog.h \
     ../../include/translation.h \
     ../../include/settings.h \
     ../../include/CommonDictInterface.h \
-    XdxfSettingsDialog.h \
     XdxfCachingDialog.h \
     XdxfDialog.h
 
index aa2fe0c..47a4287 100644 (file)
@@ -1,6 +1,6 @@
 <RCC>
     <qresource prefix="/">
-        <file>translations/dict_xdxf_en.qm</file>
-        <file>translations/dict_xdxf_pl.qm</file>
+        <file>translations/en_EN.qm</file>
+        <file>translations/pl_PL.qm</file>
     </qresource>
 </RCC>
index 04fa1c2..a3a7846 100644 (file)
@@ -38,7 +38,6 @@ XdxfPlugin::XdxfPlugin(QObject *parent) : CommonDictInterface(parent),
     cachingDialog = new XdxfCachingDialog(this);
 
 
-
     _settings->setValue("type","xdxf");
     _icon = QIcon("/usr/share/mdictionary/xdxf.png");
     _wordsCount = -1;
@@ -56,11 +55,9 @@ void XdxfPlugin::retranslate() {
 
     QTranslator *translator = new QTranslator(this);
 
-    if(locale == "pl_PL")
-        translator->load(":/translations/dict_xdxf_pl");
-    else
-        translator->load(":/translations/dict_xdxf_en");
-
+    if(!translator->load(":/translations/" + locale)) {
+        translator->load(":/translations/en_EN");
+    }
     QCoreApplication::installTranslator(translator);
 }
 
@@ -329,8 +326,7 @@ DictDialog* XdxfPlugin::dictDialog() {
 
 CommonDictInterface* XdxfPlugin::getNew(const Settings *settings) const {
     XdxfPlugin *plugin = new XdxfPlugin();
-    connect(plugin, SIGNAL(notify(Notify::NotifyType,QString)),
-            this, SIGNAL(notify(Notify::NotifyType,QString)));
+
     if(settings && plugin->setSettings(settings)) {
         return plugin;
     }
index 76ac714..d47d43f 100644 (file)
@@ -70,7 +70,7 @@ public:
     QString infoNote() const;
 
     /*! returns DictDialog object that creates dialogs
-        for adding new dictionary and changing plugin things
+        for adding new dictionary and changing plugin settings
       */
     DictDialog* dictDialog();
 
@@ -118,15 +118,12 @@ public Q_SLOTS:
     //! loads translations for each plugin only once
     void retranslate();
 
-
-
 Q_SIGNALS:
     //! emitted with percent count of caching progress, and time elapsed from
     //! last signal emit
     void updateCachingProgress(int, int);
 
 
-
 private:
 
     /*! returns true or false depending on whether the dictionary is cached