From 49bc49758291ccd86f20583c99a98692b7ab52a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mateusz=20P=C3=B3=C5=82rola?= Date: Tue, 7 Sep 2010 10:14:19 +0200 Subject: [PATCH] Modified google plugin dialog --- src/plugins/google/GoogleDialog.cpp | 192 +++++++++++++++++++++ src/plugins/google/GoogleDialog.h | 118 +++++++++++++ src/plugins/google/GoogleDictDialog.cpp | 21 ++- src/plugins/google/GoogleDictDialog.h | 1 - src/plugins/google/GooglePlugin.cpp | 22 +-- src/plugins/google/GooglePlugin.h | 7 +- src/plugins/google/GoogleSettingsDialog.cpp | 188 -------------------- src/plugins/google/GoogleSettingsDialog.h | 94 ---------- src/plugins/google/google.pro | 4 +- src/plugins/google/google.qrc | 4 +- src/plugins/google/translations/dict_google_en.qm | Bin 23 -> 0 bytes src/plugins/google/translations/dict_google_pl.qm | Bin 1020 -> 0 bytes src/plugins/google/translations/en_EN.qm | Bin 0 -> 23 bytes src/plugins/google/translations/pl_PL.qm | Bin 0 -> 1020 bytes src/plugins/xdxf/TranslationXdxf.cpp | 3 - src/plugins/xdxf/TranslationXdxf.h | 5 +- src/plugins/xdxf/XdxfCachingDialog.cpp | 14 +- src/plugins/xdxf/XdxfCachingDialog.h | 12 +- src/plugins/xdxf/XdxfDialog.cpp | 2 +- src/plugins/xdxf/XdxfDialog.h | 51 +++++- src/plugins/xdxf/XdxfDictDialog.cpp | 3 - src/plugins/xdxf/XdxfDictDialog.h | 1 - src/plugins/xdxf/XdxfLoadDialog.cpp | 151 ---------------- src/plugins/xdxf/XdxfLoadDialog.h | 71 -------- src/plugins/xdxf/XdxfSettingsDialog.cpp | 183 -------------------- src/plugins/xdxf/XdxfSettingsDialog.h | 76 -------- src/plugins/xdxf/translations/dict_xdxf_en.qm | Bin 134 -> 0 bytes src/plugins/xdxf/translations/dict_xdxf_pl.qm | Bin 4158 -> 0 bytes src/plugins/xdxf/translations/en_EN.qm | Bin 0 -> 134 bytes src/plugins/xdxf/translations/pl_PL.qm | Bin 0 -> 4158 bytes src/plugins/xdxf/xdxf.pro | 4 - src/plugins/xdxf/xdxf.qrc | 4 +- src/plugins/xdxf/xdxfplugin.cpp | 12 +- src/plugins/xdxf/xdxfplugin.h | 5 +- 34 files changed, 417 insertions(+), 831 deletions(-) create mode 100644 src/plugins/google/GoogleDialog.cpp create mode 100644 src/plugins/google/GoogleDialog.h delete mode 100644 src/plugins/google/GoogleSettingsDialog.cpp delete mode 100644 src/plugins/google/GoogleSettingsDialog.h delete mode 100644 src/plugins/google/translations/dict_google_en.qm delete mode 100644 src/plugins/google/translations/dict_google_pl.qm create mode 100644 src/plugins/google/translations/en_EN.qm create mode 100644 src/plugins/google/translations/pl_PL.qm delete mode 100644 src/plugins/xdxf/XdxfLoadDialog.cpp delete mode 100644 src/plugins/xdxf/XdxfLoadDialog.h delete mode 100644 src/plugins/xdxf/XdxfSettingsDialog.cpp delete mode 100644 src/plugins/xdxf/XdxfSettingsDialog.h delete mode 100644 src/plugins/xdxf/translations/dict_xdxf_en.qm delete mode 100644 src/plugins/xdxf/translations/dict_xdxf_pl.qm create mode 100644 src/plugins/xdxf/translations/en_EN.qm create mode 100644 src/plugins/xdxf/translations/pl_PL.qm diff --git a/src/plugins/google/GoogleDialog.cpp b/src/plugins/google/GoogleDialog.cpp new file mode 100644 index 0000000..9bfe817 --- /dev/null +++ b/src/plugins/google/GoogleDialog.cpp @@ -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 . + + Copyright 2010 Comarch S.A. + +*******************************************************************************/ + +/*! \file GoogleSettingsDialog.cpp + \author Jakub Jaszczynski +*/ + +#include "GoogleDialog.h" +#include + +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 index 0000000..e448589 --- /dev/null +++ b/src/plugins/google/GoogleDialog.h @@ -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 . + + Copyright 2010 Comarch S.A. + +*******************************************************************************/ + +/*! + \file GoogleDialog.cpp + \author Mateusz Półrola + \author Jakub Jaszczynski +*/ + +#ifndef GOOGLEDIALOG_H +#define GOOGLEDIALOG_H + +#include +#include "../../include/settings.h" +#include +#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 diff --git a/src/plugins/google/GoogleDictDialog.cpp b/src/plugins/google/GoogleDictDialog.cpp index a4125c4..bd6bd37 100644 --- a/src/plugins/google/GoogleDictDialog.cpp +++ b/src/plugins/google/GoogleDictDialog.cpp @@ -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()); + } } diff --git a/src/plugins/google/GoogleDictDialog.h b/src/plugins/google/GoogleDictDialog.h index 7823dab..243d35b 100644 --- a/src/plugins/google/GoogleDictDialog.h +++ b/src/plugins/google/GoogleDictDialog.h @@ -31,7 +31,6 @@ #include "../../include/DictDialog.h" #include "../../include/settings.h" #include "GooglePlugin.h" -#include "GoogleSettingsDialog.h" class GooglePlugin; diff --git a/src/plugins/google/GooglePlugin.cpp b/src/plugins/google/GooglePlugin.cpp index 7564064..20df8aa 100644 --- a/src/plugins/google/GooglePlugin.cpp +++ b/src/plugins/google/GooglePlugin.cpp @@ -27,6 +27,8 @@ #include #include "GoogleDictDialog.h" +QMap 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 GooglePlugin::initLanguages() { - QMap languages; +void GooglePlugin::initLanguages() { + if(languages.count() != 0) return; + languages["Afrikaans"] = "af"; languages["Albanian"] = "sq"; languages["Arabic"] = "ar"; @@ -408,7 +409,6 @@ QMap GooglePlugin::initLanguages() { // languages["TONGA"] = "to"; // languages["UZBEK"] = "uz"; // languages["UIGHUR"] = "ug"; - return languages; } diff --git a/src/plugins/google/GooglePlugin.h b/src/plugins/google/GooglePlugin.h index 2d9d7ff..a87e7e9 100644 --- a/src/plugins/google/GooglePlugin.h +++ b/src/plugins/google/GooglePlugin.h @@ -104,7 +104,9 @@ public: Translation* getTranslationFor(QString key); //! initializes the list of available languages in Google translator - static QMap initLanguages(); + static void initLanguages(); + + static QMap 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 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 index 0aaa9ad..0000000 --- a/src/plugins/google/GoogleSettingsDialog.cpp +++ /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 . - - Copyright 2010 Comarch S.A. - -*******************************************************************************/ - -/*! \file GoogleSettingsDialog.cpp - \author Jakub Jaszczynski -*/ - -#include "GoogleSettingsDialog.h" -#include - -GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent, - Settings *pluginSettings, - QString acceptButtonLabel) : - QDialog(parent) -{ - QMap 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 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 index 991f65c..0000000 --- a/src/plugins/google/GoogleSettingsDialog.h +++ /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 . - - Copyright 2010 Comarch S.A. - -*******************************************************************************/ - -/*! \file GoogleSettingsDialog.h - \brief Class creates dialog to get or change settings for Google Plugin - \author Jakub Jaszczynski -*/ - -#ifndef GOOGLESETTINGSDIALOG_H -#define GOOGLESETTINGSDIALOG_H - -#include -#include "../../include/settings.h" -#include -#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 diff --git a/src/plugins/google/google.pro b/src/plugins/google/google.pro index 08d7460..85aec3b 100644 --- a/src/plugins/google/google.pro +++ b/src/plugins/google/google.pro @@ -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 diff --git a/src/plugins/google/google.qrc b/src/plugins/google/google.qrc index cc5794c..47a4287 100644 --- a/src/plugins/google/google.qrc +++ b/src/plugins/google/google.qrc @@ -1,6 +1,6 @@ - translations/dict_google_en.qm - translations/dict_google_pl.qm + translations/en_EN.qm + translations/pl_PL.qm diff --git a/src/plugins/google/translations/dict_google_en.qm b/src/plugins/google/translations/dict_google_en.qm deleted file mode 100644 index 9dad8dffceb9623e88f8b96d9cd0caf25574c6fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 23 fcmcE7ks@*G{hX<16=n7(EZlpygMop8iIEWihQJ9+ diff --git a/src/plugins/google/translations/dict_google_pl.qm b/src/plugins/google/translations/dict_google_pl.qm deleted file mode 100644 index 24a516ffa59cc262cd283751a411e17a32a7cd0f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1020 zcmb7CO=}ZT6g|^?8sZ1E3lWiPA-D;FZiAb~(9nXV5Q`tHPG_Fu*yO!1^J1IQh2TOF zx4Lp8x^?5qjp$l%uM6=X*k2&^%(RXXWr~F1y?b)+x#zrlFTeHAe%ycl^wY)j?>An& z``Q7p2J~J5&MB1Md;kioXe1{-F5E<+SD)dGlE3+gQrm=3A-k#ioXq$v%B(QhvG2m-8fNW`Zp~N`zfZj=Br)$@EM* zNsrNQEy+L2RAz}qJXLxdqDg$niajDiKFv?CiHTF;IdVF5Wz+mt=Hbebhf%t5GIY08 zEMv~y+?Hi+Riu>_&uFbY8yek|*hpxZHz68ZxoO6&eBb9dI+spDI!l!AQe(1(8k0;# kz3<*r;@xp|pyGVGzqhWKzjTkdjy1An& z``Q7p2J~J5&MB1Md;kioXe1{-F5E<+SD)dGlE3+gQrm=3A-k#ioXq$v%B(QhvG2m-8fNW`Zp~N`zfZj=Br)$@EM* zNsrNQEy+L2RAz}qJXLxdqDg$niajDiKFv?CiHTF;IdVF5Wz+mt=Hbebhf%t5GIY08 zEMv~y+?Hi+Riu>_&uFbY8yek|*hpxZHz68ZxoO6&eBb9dI+spDI!l!AQe(1(8k0;# kz3<*r;@xp|pyGVGzqhWKzjTkdjy1 -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; } diff --git a/src/plugins/xdxf/XdxfCachingDialog.h b/src/plugins/xdxf/XdxfCachingDialog.h index 8d638f7..3bbb2ee 100644 --- a/src/plugins/xdxf/XdxfCachingDialog.h +++ b/src/plugins/xdxf/XdxfCachingDialog.h @@ -18,9 +18,11 @@ Copyright 2010 Comarch S.A. *******************************************************************************/ -/*! \file XdxfCachingDialog.h +/*! + \file XdxfCachingDialog.h + \author Mateusz Półrola */ -//Created by Mateusz Półrola + #ifndef XDXFCACHINGDIALOG_H #define XDXFCACHINGDIALOG_H @@ -31,7 +33,10 @@ 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: diff --git a/src/plugins/xdxf/XdxfDialog.cpp b/src/plugins/xdxf/XdxfDialog.cpp index 0927061..04bf67d 100644 --- a/src/plugins/xdxf/XdxfDialog.cpp +++ b/src/plugins/xdxf/XdxfDialog.cpp @@ -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); } diff --git a/src/plugins/xdxf/XdxfDialog.h b/src/plugins/xdxf/XdxfDialog.h index c5bea58..6108eff 100644 --- a/src/plugins/xdxf/XdxfDialog.h +++ b/src/plugins/xdxf/XdxfDialog.h @@ -19,7 +19,10 @@ *******************************************************************************/ -//Created by Mateusz Półrola +/*! + \file XdxfDialog.cpp + \author Mateusz Półrola +*/ #ifndef XDXFDIALOG_H #define XDXFDIALOG_H @@ -29,31 +32,70 @@ #include #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; diff --git a/src/plugins/xdxf/XdxfDictDialog.cpp b/src/plugins/xdxf/XdxfDictDialog.cpp index de4d9aa..9baf951 100644 --- a/src/plugins/xdxf/XdxfDictDialog.cpp +++ b/src/plugins/xdxf/XdxfDictDialog.cpp @@ -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 @@ -36,7 +34,6 @@ XdxfDictDialog::XdxfDictDialog(XdxfPlugin *plugin, QObject *parent) : } Settings* XdxfDictDialog::addNewDictionary(QWidget *parent) { - qDebug()<. - - 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 index f7c41cf..0000000 --- a/src/plugins/xdxf/XdxfLoadDialog.h +++ /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 . - - Copyright 2010 Comarch S.A. - -*******************************************************************************/ -/*! \file XdxfLoadDialog.h -*/ -//Created by Mateusz Półrola - -#ifndef XDXFLOADDIALOG_H -#define XDXFLOADDIALOG_H - -#include -#include -#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 index fa262a8..0000000 --- a/src/plugins/xdxf/XdxfSettingsDialog.cpp +++ /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 . - - Copyright 2010 Comarch S.A. - -*******************************************************************************/ - -/*! \file XdxfSettingsDialog.cpp -*/ - - -#include "XdxfSettingsDialog.h" -#include - -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 index b1cd533..0000000 --- a/src/plugins/xdxf/XdxfSettingsDialog.h +++ /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 . - - Copyright 2010 Comarch S.A. - -*******************************************************************************/ -/*! \file XdxfSettingsDialog.h -*/ -//Created by Mateusz Półrola - -#ifndef XDXFSETTINGSDIALOG_H -#define XDXFSETTINGSDIALOG_H - -#include -#include "../../include/settings.h" -#include -#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 index 900f71678adc36c355111d16b61fba965160a91d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 134 zcmcE7ks@*G{hX<16=n7(EZlq7iGhKEgJ+4@OCZgV3B<9?KthN?l_8HofuWcol_8lS zAIMGt35#F~GZb?GB^cO%m`62Fp*S@;KQBe2Sd$$nAQ+KSk>;G3oROKA?vk09lb_Dm K0TgCpWCQ?znH|Ic diff --git a/src/plugins/xdxf/translations/dict_xdxf_pl.qm b/src/plugins/xdxf/translations/dict_xdxf_pl.qm deleted file mode 100644 index 8ab7e05924a0741585fa4eeb8c78b926da15d3d1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4158 zcmeHJL1-LR82%^OY|?ZSZCY!^);^WgZ3(N9(nCyksZYo!QRJ zcC(?B3LX?sDwRqF6)Ijl^`xj&P*em_5QHLL#2$KS1y3GCzyHnd>?FIh%|Q=>hvdz^ znfLzhec$*0|9j*^Yuh(B-#Y*8z1y#xeD~9zCyD4cqQ@^085gMU@@GWDkI}9d?#K88 zo!a{{QSb3^+_>B``-LRxDffJJ@eon!VmJmA;473;t5{rt?UL<3)@ZvXxdq76q< z7Y==b`M%Vf&UvhRC>#f^)YX%Sv+-cxzSj{a^K^ROPuH;S!SpY)m>;~>f9%|gz;(L+ z#}CdDrSBg2_-qyNa^aYHf8ct4n5h4i4L6D(5%paO$6svilyL&bq}*!R8R!U)c};igS=+h{LdY@tzdNRUs8mZ*wni)7M^I=>icUon7bO5-mx z>Ih$%u485W-Tj!@G-EB#ACP9zb{6usEV&B??{S!>sX_tOsZ5eeWYY>plNRwGSd2+> zsRk@IFi9H2T!lQ$`Ltr(gVo%|ynwZJY zOvR{6in9er_B8toR5JS3AWTnsZp~Loi^s5-#a;qL7I3Z9Hs;FA8!R>+LEM~=1Qqjk zNll2+@uUcc*A;;Y;#iD=O%-Y5XA+Wg9V`xaA*KZm zw9OH{PIGK(U|9f?5CQ+Lf+HJv7>TXF&Vm`&IMYB4TNr&tKUM@fF-$5(iNW5h((VZV z!_yUb&R$Vs-u1+(s%X@&)toKrBEqFc zyRN}7vm19IE6{XC865iHUO=I`X1a#M+L&vuvY^-!B1kA2u4-{UT?jn8BBW_5C-B8! zHl!O>P*d%Tvg?IhkBPY|+*DDe62G-v=Yc>J(Ugjrso})Q+!EX&GXZb^3<}lArW@qcn zfl@{NtKoBS6ffsGyMaznA*MqZsfO96rK)&to`}DGvf+PLof{Ungx{eK?~O*FSGrK5 z8H&-q(*B2cLGl6(cTQ# z!$j+JyYsDc>9#DC=eb_gDg&=Bgm@Ns#Wj<)~b&rS6G!!s=wLRzZ$8ot+vEi`WK4tKUh$6LAzcW;0>dlG7bUJ9Tkf zdv1X%=E_bGCmIlu7f@;zs&SX$+?|K#JbfJt;`+3diIE$$uB-kaKbJ|8S; z|1_Ogg)BVRGqD_5Z0mOA@4e^u2M7=Q`A}AzjCs;G3oROKA?vk09lb_Dm K0TgCpWCQ?znH|Ic literal 0 HcmV?d00001 diff --git a/src/plugins/xdxf/translations/pl_PL.qm b/src/plugins/xdxf/translations/pl_PL.qm new file mode 100644 index 0000000000000000000000000000000000000000..8ab7e05924a0741585fa4eeb8c78b926da15d3d1 GIT binary patch literal 4158 zcmeHJL1-LR82%^OY|?ZSZCY!^);^WgZ3(N9(nCyksZYo!QRJ zcC(?B3LX?sDwRqF6)Ijl^`xj&P*em_5QHLL#2$KS1y3GCzyHnd>?FIh%|Q=>hvdz^ znfLzhec$*0|9j*^Yuh(B-#Y*8z1y#xeD~9zCyD4cqQ@^085gMU@@GWDkI}9d?#K88 zo!a{{QSb3^+_>B``-LRxDffJJ@eon!VmJmA;473;t5{rt?UL<3)@ZvXxdq76q< z7Y==b`M%Vf&UvhRC>#f^)YX%Sv+-cxzSj{a^K^ROPuH;S!SpY)m>;~>f9%|gz;(L+ z#}CdDrSBg2_-qyNa^aYHf8ct4n5h4i4L6D(5%paO$6svilyL&bq}*!R8R!U)c};igS=+h{LdY@tzdNRUs8mZ*wni)7M^I=>icUon7bO5-mx z>Ih$%u485W-Tj!@G-EB#ACP9zb{6usEV&B??{S!>sX_tOsZ5eeWYY>plNRwGSd2+> zsRk@IFi9H2T!lQ$`Ltr(gVo%|ynwZJY zOvR{6in9er_B8toR5JS3AWTnsZp~Loi^s5-#a;qL7I3Z9Hs;FA8!R>+LEM~=1Qqjk zNll2+@uUcc*A;;Y;#iD=O%-Y5XA+Wg9V`xaA*KZm zw9OH{PIGK(U|9f?5CQ+Lf+HJv7>TXF&Vm`&IMYB4TNr&tKUM@fF-$5(iNW5h((VZV z!_yUb&R$Vs-u1+(s%X@&)toKrBEqFc zyRN}7vm19IE6{XC865iHUO=I`X1a#M+L&vuvY^-!B1kA2u4-{UT?jn8BBW_5C-B8! zHl!O>P*d%Tvg?IhkBPY|+*DDe62G-v=Yc>J(Ugjrso})Q+!EX&GXZb^3<}lArW@qcn zfl@{NtKoBS6ffsGyMaznA*MqZsfO96rK)&to`}DGvf+PLof{Ungx{eK?~O*FSGrK5 z8H&-q(*B2cLGl6(cTQ# z!$j+JyYsDc>9#DC=eb_gDg&=Bgm@Ns#Wj<)~b&rS6G!!s=wLRzZ$8ot+vEi`WK4tKUh$6LAzcW;0>dlG7bUJ9Tkf zdv1X%=E_bGCmIlu7f@;zs&SX$+?|K#JbfJt;`+3diIE$$uB-kaKbJ|8S; z|1_Ogg)BVRGqD_5Z0mOA@4e^u2M7=Q`A}AzjCs - translations/dict_xdxf_en.qm - translations/dict_xdxf_pl.qm + translations/en_EN.qm + translations/pl_PL.qm diff --git a/src/plugins/xdxf/xdxfplugin.cpp b/src/plugins/xdxf/xdxfplugin.cpp index 04fa1c2..a3a7846 100644 --- a/src/plugins/xdxf/xdxfplugin.cpp +++ b/src/plugins/xdxf/xdxfplugin.cpp @@ -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; } diff --git a/src/plugins/xdxf/xdxfplugin.h b/src/plugins/xdxf/xdxfplugin.h index 76ac714..d47d43f 100644 --- a/src/plugins/xdxf/xdxfplugin.h +++ b/src/plugins/xdxf/xdxfplugin.h @@ -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 -- 1.7.9.5