TranslationXdxf.cpp \
XdxfLoadDialog.cpp \
XdxfDictDialog.cpp \
- XdxfSettingsDialog.cpp
+ XdxfSettingsDialog.cpp \
+ XdxfCachingDialog.cpp
HEADERS += \
../../../includes/translation.h \
../../../includes/settings.h \
../../../includes/CommonDictInterface.h \
- XdxfSettingsDialog.h
+ XdxfSettingsDialog.h \
+ XdxfCachingDialog.h
_wordsCount = -1;
_settings = new Settings();
_dictDialog = new XdxfDictDialog(this, this);
+ cachingDialog = new XdxfCachingDialog(this);
+
_settings->setValue("type","xdxf");
if(isCached())
_settings->setValue("cached","true");
bool XdxfPlugin::makeCache(QString dir) {
+ cachingDialog->setVisible(true);
QFileInfo dictFileN(_settings->value("path"));
QString cachePathN;
cachePathN = dictFileN.dir().absolutePath() + "/"
counter=0;
while (!reader.atEnd()) {
+ QCoreApplication::processEvents();
+ //usleep(50);
reader.readNext();
if(reader.tokenType() == QXmlStreamReader::StartElement) {
counter++;
int prog = counter*100/_wordsCount;
if(prog % 5 == 0)
- Q_EMIT update(prog);
+ Q_EMIT updateCachingProgress(prog);
}
}
}
+ cachingDialog->setVisible(false);
+
qDebug()<<counter;
cur.exec("END;");
cur.exec("select count(*) from dict");
#include <QSqlQuery>
#include <QSqlDatabase>
#include "XdxfDictDialog.h"
+#include "XdxfCachingDialog.h"
class TranslationXdxf;
Q_SIGNALS:
//! emited with percent count of caching progress
- void update(float);
+ void updateCachingProgress(int);
protected:
volatile bool stopped;
Settings *_settings;
XdxfDictDialog* _dictDialog;
+ XdxfCachingDialog* cachingDialog;
};
#endif // XDXFPLUGIN_H