MainWidget.h
RESOURCES += \
- ../../data/gui.qrc
+ ../../data/gui.qrc \
+ desktopWidget.qrc
+TRANSLATIONS += pl_PL.ts \
+ en_US.ts
unix {
target.path = $$INSTALL_PREFIX/lib/hildon-desktop
--- /dev/null
+<RCC>
+ <qresource prefix="/desktopWidget">
+ <file>translations/en_US.qm</file>
+ <file>translations/pl_PL.qm</file>
+ </qresource>
+</RCC>
}
QApplication a(dpy, argc, argv);
+
+ QString locale = QLocale::system().name();
+
+ QTranslator translator;
+
+ if(!translator.load("://desktopWidget/translations/" + locale)) {
+ translator.load("://desktopWidget/translations/en_US");
+ }
+
+ QCoreApplication::installTranslator(&translator);
+
QApplication::setOrganizationName("Comarch S.A.");
QApplication::setOrganizationDomain("comarch.com");
QApplication::setApplicationName("mDictionaryWidget");
--- /dev/null
+<¸d\18Êï\9c\95Í!\1c¿`¡½Ý
\ No newline at end of file
#include <QDebug>
-XdxfCachingDialog::XdxfCachingDialog(XdxfPlugin *parent) {
+XdxfCachingDialog::XdxfCachingDialog(QWidget *parent): QDialog(parent) {
verticalLayout = new QVBoxLayout(this);
setLayout(verticalLayout);
connect(cancelButton, SIGNAL(clicked()),
this, SIGNAL(cancelCaching()));
- connect(parent, SIGNAL(updateCachingProgress(int, int)),
- this, SLOT(updateCachingProgress(int, int)));
time.start();
- #ifndef Q_WS_MAEMO_5
- setModal(true);
- #endif
+ //#ifndef Q_WS_MAEMO_5
+ setModal(true);
+ //#endif
}
{
Q_OBJECT
public:
- explicit XdxfCachingDialog(XdxfPlugin *parent = 0);
+ explicit XdxfCachingDialog(QWidget *parent = 0);
public Q_SLOTS:
void reject();
XdxfDictDialog::XdxfDictDialog(XdxfPlugin *plugin, QObject *parent) :
DictDialog(parent) {
this->plugin = plugin;
+ _lastDialogParent=0;
+}
+
+QWidget* XdxfDictDialog::lastDialogParent() {
+ return _lastDialogParent;
}
Settings* XdxfDictDialog::addNewDictionary(QWidget *parent) {
XdxfDialog d(0, XdxfDialog::New, parent);
+ _lastDialogParent = parent;
+
connect(&d, SIGNAL(notify(Notify::NotifyType,QString)),
this, SIGNAL(notify(Notify::NotifyType,QString)));
void XdxfDictDialog::changeSettings(QWidget * parent) {
XdxfDialog d(plugin, XdxfDialog::Change, parent);
+ _lastDialogParent = parent;
+
connect(&d, SIGNAL(notify(Notify::NotifyType,QString)),
this, SIGNAL(notify(Notify::NotifyType,QString)));
*/
void changeSettings(QWidget *parent);
+ QWidget* lastDialogParent();
+
private:
XdxfPlugin* plugin;
+ QWidget* _lastDialogParent;
};
#endif // XDXFDICTDIALOG_H
connect(_dictDialog, SIGNAL(notify(Notify::NotifyType,QString)),
this, SIGNAL(notify(Notify::NotifyType,QString)));
- cachingDialog = new XdxfCachingDialog(this);
-
_settings->setValue("type","xdxf");
_icon = QIcon("/usr/share/mdictionary/xdxf.png");
_wordsCount = -1;
stopped = false;
- connect(cachingDialog, SIGNAL(cancelCaching()),
- this, SLOT(stop()));
- connect(this, SIGNAL(updateCachingProgress(int,int)),
- cachingDialog, SLOT(updateCachingProgress(int,int)));
initAccents();
}
XdxfPlugin::~XdxfPlugin() {
delete _settings;
- delete cachingDialog;
delete _dictDialog;
}
bool XdxfPlugin::makeCache(QString) {
- #ifdef Q_WS_MAEMO_5
- cachingDialog->setVisible(true);
- #else
- cachingDialog->show();
- #endif
+
+ XdxfCachingDialog d(_dictDialog->lastDialogParent());
+
+ connect(&d, SIGNAL(cancelCaching()),
+ this, SLOT(stop()));
+
+ connect(this, SIGNAL(updateCachingProgress(int,int)),
+ &d, SLOT(updateCachingProgress(int,int)));
+
+ d.show();
+
+
+ // cachingDialog->setParent(_dictDialog->lastDialogParent());
+ // #ifdef Q_WS_MAEMO_5
+ // cachingDialog->setVisible(true);
+ // #else
+ // cachingDialog->exec();
+ // #endif
QCoreApplication::processEvents();
QFileInfo dictFileN(_settings->value("path"));
QString cachePathN;
/*add all words to db*/
while (!reader.atEnd() && !stopped) {
+
QCoreApplication::processEvents();
reader.readNext();
if(reader.tokenType() == QXmlStreamReader::StartElement) {
cur.exec();
counter++;
int prog = counter*100/_wordsCount;
- if(prog % 5 == 0 && lastProg != prog) {
+ if(prog % 2 == 0 && lastProg != prog) {
Q_EMIT updateCachingProgress(prog,timer.restart());
lastProg = prog;
+ sleep(1);
}
}
}
_settings->setValue("cache_path", cachePathN);
_settings->setValue("cached", "true");
+
+ disconnect(&d, SIGNAL(cancelCaching()),
+ this, SLOT(stop()));
+
+ disconnect(this, SIGNAL(updateCachingProgress(int,int)),
+ &d, SLOT(updateCachingProgress(int,int)));
+
db.close();
return true;
}