usr/lib/mdictionary/plugins/eng-thai.xdxf
usr/share/mdictionary/xdxf.png
usr/share/mdictionary/css/
-usr/share/applications/hildon/mdictionary.desktop
+usr/share/applications/mdictionary.desktop
public Q_SLOTS:
void reject();
+ void updateCachingProgress(int, int);
Q_SIGNALS:
//! signal emitted when user cancels caching of a dictionary
void cancelCaching();
-private Q_SLOTS:
- void updateCachingProgress(int, int);
private:
QLabel* cachingLabel;
if(type == New) {
connect(browseButton, SIGNAL(clicked()),
this, SLOT(selectFile()));
+
+ connect(downloadButton, SIGNAL(clicked()),
+ this, SLOT(downloadFile()));
}
connect(confirmButton, SIGNAL(clicked()),
setWindowTitle(tr("Add new XDXF dictionary"));
browseLayout = new QHBoxLayout;
+
+ QHBoxLayout* buttonLayout = new QHBoxLayout;
browseButton = new QPushButton(tr("Browse"));
+ browseButton->setMaximumWidth(150);
+
+ downloadButton = new QPushButton(tr("Download"));
+ downloadButton->setMaximumWidth(150);
+
infoLabel->setText(tr("Dictionary file: not selected"));
browseLayout->addWidget(infoLabel, 0, Qt::AlignLeft);
- browseLayout->addWidget(browseButton, 0, Qt::AlignRight);
+
+ browseLayout->addLayout(buttonLayout);
+ buttonLayout->addWidget(browseButton);
+ buttonLayout->addWidget(downloadButton);
mainVerticalLayout->addLayout(browseLayout);
}
}
}
+void XdxfDialog::downloadFile() {
+ XdxfPlugin::dictDownloader.download(this);
+}
+
void XdxfDialog::saveSettings() {
_settings = new Settings;
if(plugin) {
private Q_SLOTS:
//! displays dialog to browse and select file
void selectFile();
+ void downloadFile();
void setGenerateCache(bool);
void setAccents(bool);
QLabel* infoLabel;
QPushButton* browseButton;
+ QPushButton* downloadButton;
QHBoxLayout* browseLayout;
--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#include "XdxfDictDownloadProgressDialog.h"
+
+XdxfDictDownloadProgressDialog::XdxfDictDownloadProgressDialog(QWidget*parent):
+ QDialog(parent) {
+ verticalLayout = new QVBoxLayout(this);
+ setLayout(verticalLayout);
+
+ setWindowTitle(tr("Downloading dictionary, please wait"));
+ downloadProgressBar = new QProgressBar(this);
+ downloadProgressBar->setMinimum(0);
+ downloadProgressBar->setMaximum(100);
+ downloadProgressBar->setTextVisible(true);
+
+ cancelButton = new QPushButton(tr("Cancel"),this);
+
+
+ downloadTimeLabel = new QLabel(this);
+ downloadTimeLabel->hide();
+
+ #ifndef Q_WS_MAEMO_5
+ downloadLabel = new QLabel(this);
+ downloadLabel->setText(tr("Downloading dictionary, please wait"));
+ verticalLayout->addWidget(downloadLabel, 0, Qt::AlignCenter);
+ #endif
+
+
+ verticalLayout->addWidget(downloadTimeLabel);
+ verticalLayout->addWidget(downloadProgressBar);
+ verticalLayout->addWidget(cancelButton);
+
+ connect(cancelButton, SIGNAL(clicked()),
+ this, SIGNAL(cancelDownloading()));
+
+ time.start();
+
+ setModal(true);
+}
+
+
+void XdxfDictDownloadProgressDialog::reject() {
+ return;
+}
+
+void XdxfDictDownloadProgressDialog::updateDownloadProgress(int progress,
+ int time) {
+ if(!downloadTimeLabel->isVisible())
+ downloadTimeLabel->show();
+
+ int seconds = float((100 - progress)*time) / (5*1000);
+
+ downloadTimeLabel->setText(tr("Estimated time left: ") +
+ tr("%n second(s)", "", seconds));
+ if(progress >= 100)
+ this->accept();
+}
--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#ifndef XDXFDICTDOWNLOADPROGRESSDIALOG_H
+#define XDXFDICTDOWNLOADPROGRESSDIALOG_H
+
+#include <QDialog>
+#include <QtGui>
+
+class XdxfDictDownloadProgressDialog : public QDialog {
+ Q_OBJECT
+public:
+ XdxfDictDownloadProgressDialog(QWidget *parent = 0);
+
+public Q_SLOTS:
+ void reject();
+ void updateDownloadProgress(int, int);
+
+Q_SIGNALS:
+ //! signal emitted when user cancels downloading of a dictionary
+ void cancelDownloading();
+
+private:
+ QLabel* downloadLabel;
+ QLabel* downloadTimeLabel;
+ QProgressBar* downloadProgressBar;
+ QPushButton* cancelButton;
+ QVBoxLayout* verticalLayout;
+ //! used to check the progress of dictionary downloading
+ QTime time;
+};
+
+#endif // XDXFDICTDOWNLOADPROGRESSDIALOG_H
--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#include "XdxfDictDownloader.h"
+#include "XdxfDictDownloadProgressDialog.h"
+
+XdxfDictDownloader::XdxfDictDownloader(QObject *parent) :
+ QObject(parent)
+{
+}
+
+
+void XdxfDictDownloader::download(QWidget *parent) {
+ XdxfDictDownloadProgressDialog progress(parent);
+ //XdxfDictSelectDialog selectDialog(parent);
+}
--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#ifndef XDXFDICTDOWNLOADER_H
+#define XDXFDICTDOWNLOADER_H
+
+#include <QObject>
+#include "XdxfDictSelectDialog.h"
+#include <QTimer>
+
+class XdxfDictDownloader : public QObject
+{
+ Q_OBJECT
+public:
+ XdxfDictDownloader(QObject *parent = 0);
+
+public Q_SLOTS:
+ void download(QWidget* parent);
+
+
+};
+
+#endif // XDXFDICTDOWNLOADER_H
--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#include "XdxfDictSelectDialog.h"
+
+XdxfDictSelectDialog::XdxfDictSelectDialog(QWidget *parent) :
+ QDialog(parent) {
+ layout = new QVBoxLayout;
+ setLayout(layout);
+
+ checkBoxLayout = new QHBoxLayout;
+ layout->addLayout(checkBoxLayout);
+
+ langFrom = new QComboBox;
+ langTo = new QComboBox;
+
+ checkBoxLayout->addWidget(langFrom);
+ checkBoxLayout->addWidget(langTo);
+
+
+ treeWidget = new QTreeWidget;
+ treeWidget->setRootIsDecorated(false);
+ treeWidget->setColumnCount(4);
+ QStringList headers;
+ headers << tr("From") << tr("To") << tr("Name") << tr("Size");
+ treeWidget->setHeaderLabels(headers);
+ treeWidget->setColumnWidth(0, 100);
+ treeWidget->setColumnWidth(1, 100);
+ treeWidget->setColumnWidth(2, 100);
+ treeWidget->setColumnWidth(3, 100);
+ layout->addWidget(treeWidget);
+
+
+ connect(langFrom, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(refreshDictList()));
+
+ connect(langTo, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(refreshDictList()));
+
+ #ifndef Q_WS_MAEMO_5
+ setMinimumSize(400,200);
+ #else
+ setMinimumHeight(350);
+ #endif
+
+ refreshDictList();
+}
+
+
+void XdxfDictSelectDialog::refreshDictList() {
+ QStringList l;
+ l << "pies" << "kot";
+ treeWidget->insertTopLevelItem(0, new QTreeWidgetItem(l));
+}
--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#ifndef XDXFDICTSELECTDIALOG_H
+#define XDXFDICTSELECTDIALOG_H
+
+#include <QDialog>
+#include <QtGui>
+
+class XdxfDictSelectDialog : public QDialog {
+ Q_OBJECT
+public:
+ explicit XdxfDictSelectDialog(QWidget *parent = 0);
+
+private:
+ QTreeWidget* treeWidget;
+ QVBoxLayout* layout;
+ QHBoxLayout* checkBoxLayout;
+ QComboBox* langFrom;
+ QComboBox* langTo;
+
+private Q_SLOTS:
+ void refreshDictList();
+};
+
+#endif // XDXFDICTSELECTDIALOG_H
QT = core \
gui \
xml \
- sql
+ sql \
+ network
maemo5:QT += maemo5
TranslationXdxf.cpp \
XdxfDictDialog.cpp \
XdxfCachingDialog.cpp \
- XdxfDialog.cpp
+ XdxfDialog.cpp \
+ XdxfDictDownloader.cpp \
+ XdxfDictSelectDialog.cpp \
+ XdxfDictDownloadProgressDialog.cpp
HEADERS += \
../../include/settings.h \
../../include/CommonDictInterface.h \
XdxfCachingDialog.h \
- XdxfDialog.h
+ XdxfDialog.h \
+ XdxfDictDownloader.h \
+ XdxfDictSelectDialog.h \
+ XdxfDictDownloadProgressDialog.h
RESOURCES += \
xdxf.qrc
#include <QDebug>
#include "../../include/Notify.h"
+
+XdxfDictDownloader XdxfPlugin::dictDownloader;
+
XdxfPlugin::XdxfPlugin(QObject *parent) : CommonDictInterface(parent),
_langFrom(""), _langTo(""),_name(""), _infoNote("") {
_settings = new Settings();
#include "XdxfDictDialog.h"
#include "XdxfCachingDialog.h"
#include "TranslationXdxf.h"
+#include "XdxfDictDownloader.h"
class TranslationXdxf;
*/
void clean();
-
+ static XdxfDictDownloader dictDownloader;
public Q_SLOTS:
/*! performs search in a dictionary