fix bug's (translation color in stardict and kept settings after leave)
authorjakub <jakub.jaszczynski@comarch.com>
Thu, 18 Nov 2010 09:37:53 +0000 (10:37 +0100)
committerjakub <jakub.jaszczynski@comarch.com>
Thu, 18 Nov 2010 09:37:53 +0000 (10:37 +0100)
18 files changed:
src/mdictionary/gui/TranslationWidget.cpp
src/plugins/google/pl_PL.ts
src/plugins/stardict/CompressedReader.cpp
src/plugins/stardict/CompressedReader.h
src/plugins/stardict/StarDialog.cpp
src/plugins/stardict/StarDialog.h
src/plugins/stardict/StarDictDialog.cpp
src/plugins/stardict/StarDictDialog.h
src/plugins/stardict/StarDictPlugin.cpp
src/plugins/stardict/StarDictPlugin.h
src/plugins/stardict/StarDictReader.h
src/plugins/stardict/StarDictReaderFactory.h
src/plugins/stardict/TranslationStarDict.cpp
src/plugins/stardict/TranslationStarDict.h
src/plugins/stardict/UncompressedReader.cpp
src/plugins/stardict/UncompressedReader.h
src/plugins/stardict/en_US.ts
src/plugins/stardict/pl_PL.ts

index 15859a3..7312d32 100644 (file)
@@ -85,9 +85,8 @@ void TranslationWidget::show(QStringList translations) {
            + trans + QString("\n </ar>");
 
     trans=checkTranslation(trans);
            + trans + QString("\n </ar>");
 
     trans=checkTranslation(trans);
-    trans=XslConversion(trans);
-
     qDebug()<<"\n\n trans"<<trans;
     qDebug()<<"\n\n trans"<<trans;
+    trans=XslConversion(trans);
 
     QString head = "<html><head>";
     head += "<link rel=\"stylesheet\" type=\"text/css\" " ;
 
     QString head = "<html><head>";
     head += "<link rel=\"stylesheet\" type=\"text/css\" " ;
@@ -98,6 +97,7 @@ void TranslationWidget::show(QStringList translations) {
     trans+= "</body></html>";
     trans.replace("$STAR$", "/usr/share/mdictionary/staron.png");
 
     trans+= "</body></html>";
     trans.replace("$STAR$", "/usr/share/mdictionary/staron.png");
 
+ //   qDebug()<<"\n\n trans"<<trans;
     webkit->setHtml(trans, QUrl().fromLocalFile("/"));
     //webkit->repaint(this->rect());
     //update(this->rect());
     webkit->setHtml(trans, QUrl().fromLocalFile("/"));
     //webkit->repaint(this->rect());
     //update(this->rect());
index 3107137..84f0cee 100644 (file)
@@ -23,7 +23,8 @@
         <location filename="GoogleDialog.cpp" line="91"/>
         <source>Plugin: GoogleTranslator 
 </source>
         <location filename="GoogleDialog.cpp" line="91"/>
         <source>Plugin: GoogleTranslator 
 </source>
-        <translation type="unfinished"></translation>
+        <translation>Plugin: GoogleTranslator 
+</translation>
     </message>
     <message>
         <location filename="GoogleDialog.cpp" line="92"/>
     </message>
     <message>
         <location filename="GoogleDialog.cpp" line="92"/>
index 33a9744..dae4b2e 100644 (file)
@@ -29,16 +29,19 @@ CompressedReader::CompressedReader(QObject *parent) :
     StarDictReader(parent) {
 }
 
     StarDictReader(parent) {
 }
 
+
 CompressedReader::CompressedReader(QString filename, QObject *parent) :
     StarDictReader(parent) {
     open(filename);
 }
 
 CompressedReader::CompressedReader(QString filename, QObject *parent) :
     StarDictReader(parent) {
     open(filename);
 }
 
+
 CompressedReader::~CompressedReader() {
     if(_file != NULL)
         gzclose(_file);
 }
 
 CompressedReader::~CompressedReader() {
     if(_file != NULL)
         gzclose(_file);
 }
 
+
 bool CompressedReader::open(QString file) {
     _file = gzopen(file.toStdString().c_str(), "rb");
     if(_file == NULL)
 bool CompressedReader::open(QString file) {
     _file = gzopen(file.toStdString().c_str(), "rb");
     if(_file == NULL)
@@ -46,6 +49,7 @@ bool CompressedReader::open(QString file) {
     return true;
 }
 
     return true;
 }
 
+
 void CompressedReader::close() {
     gzclose(_file);
     _file = NULL;
 void CompressedReader::close() {
     gzclose(_file);
     _file = NULL;
@@ -57,6 +61,19 @@ QChar CompressedReader::readChar() {
     QString cha;
 
     gzread(_file, c, 1);
     QString cha;
 
     gzread(_file, c, 1);
+    if(((unsigned char)c[0])>240)
+        gzread(_file, c+1, 3);
+    else if(((unsigned char)c[0])>224)
+        gzread(_file, c+1, 2);
+    else if(((unsigned char)c[0])>192)
+        gzread(_file, c+1, 1);
+    else if(((unsigned char)c[0])>127){
+        qDebug()<<"error - starDict - read wordList from UTF-8";
+        c[0]=0;
+    }
+
+
+ /*   gzread(_file, c, 1);
     if(((unsigned char)c[0])>127){
         gzread(_file, c+1, 1);
         if(((unsigned char)c[1])>127 && ((unsigned char)c[1])<192){
     if(((unsigned char)c[0])>127){
         gzread(_file, c+1, 1);
         if(((unsigned char)c[1])>127 && ((unsigned char)c[1])<192){
@@ -65,23 +82,27 @@ QChar CompressedReader::readChar() {
                 gzread(_file, c+3, 1);
         }
     }
                 gzread(_file, c+3, 1);
         }
     }
+*/
 
     cha=QString::fromUtf8(c);
     return cha.at(0);
 }
 
 
     cha=QString::fromUtf8(c);
     return cha.at(0);
 }
 
+
 qint32 CompressedReader::readInt32BigEndian() {
     qint32 value;
     gzread(_file, (void*)(&value), 4);
     return qFromBigEndian(value);
 }
 
 qint32 CompressedReader::readInt32BigEndian() {
     qint32 value;
     gzread(_file, (void*)(&value), 4);
     return qFromBigEndian(value);
 }
 
+
 qint64 CompressedReader::readInt64BigEndian() {
     qint64 value;
     gzread(_file, (void*)(&value), 8);
     return value;
 }
 
 qint64 CompressedReader::readInt64BigEndian() {
     qint64 value;
     gzread(_file, (void*)(&value), 8);
     return value;
 }
 
+
 QString CompressedReader::readKeyword() {
     QString result;
     QChar c;
 QString CompressedReader::readKeyword() {
     QString result;
     QChar c;
@@ -94,6 +115,7 @@ QString CompressedReader::readKeyword() {
     return result;
 }
 
     return result;
 }
 
+
 QByteArray CompressedReader::readString(qint64 offset, qint32 len) {
     char* buf;
     buf = new char[len];
 QByteArray CompressedReader::readString(qint64 offset, qint32 len) {
     char* buf;
     buf = new char[len];
index 1e7c14a..56aaf0b 100644 (file)
 #include "StarDictReader.h"
 
 /*!
 #include "StarDictReader.h"
 
 /*!
-  Class implementing StarDictReader interface and handling rading from compressed
+    Class implementing StarDictReader interface and handling rading from compressed
     files like .gz or .dz, using zlib
     files like .gz or .dz, using zlib
-  */
+*/
 class CompressedReader : public StarDictReader
 {
     Q_OBJECT
 public:
     CompressedReader(QObject *parent = 0);
     /*!
 class CompressedReader : public StarDictReader
 {
     Q_OBJECT
 public:
     CompressedReader(QObject *parent = 0);
     /*!
-      Creates new compressed reader and open file with passed filename
-      */
+        Creates new compressed reader and open file with passed filename
+    */
     CompressedReader(QString filename, QObject *parent = 0);
     /*!
     CompressedReader(QString filename, QObject *parent = 0);
     /*!
-      Destructs object and closing file
+        Destructs object and closing file
     */
     ~CompressedReader();
 
     /*!
     */
     ~CompressedReader();
 
     /*!
-      Reads translations text from compressed dict file.
-      \param offset 64-bit offset of translation in uncompressed file, readed
+        Reads translations text from compressed dict file.
+        \param offset 64-bit offset of translation in uncompressed file, readed
              from idx file
              from idx file
-      \param len length of uncompressed translation, readed from idx file too
-      */
+        \param len length of uncompressed translation, readed from idx file too
+    */
     QByteArray readString(qint64 offset, qint32 len);
 
     /*!
     QByteArray readString(qint64 offset, qint32 len);
 
     /*!
-      Reads 32-bits integer value from compressed file and convert it from
-      BigEndian to Little Endian
-      */
+        Reads 32-bits integer value from compressed file and convert it from
+        BigEndian to Little Endian
+    */
     qint32 readInt32BigEndian();
 
     /*!
     qint32 readInt32BigEndian();
 
     /*!
-      Reads 64-bits integer value from compressed file and convert it from
-      BigEndian to Little Endian
-      */
+        Reads 64-bits integer value from compressed file and convert it from
+        BigEndian to Little Endian
+    */
     qint64 readInt64BigEndian();
 
     /*!
     qint64 readInt64BigEndian();
 
     /*!
-      Reads single string from compressed file, end of string is marked as '\0'
-     in file.
-     */
+        Reads single string from compressed file, end of string is marked as '\0'
+        in file.
+    */
     QString readKeyword();
 
 
     /*!
     QString readKeyword();
 
 
     /*!
-      Closing file;
-      */
+        Closing file;
+    */
     void close();
 
 protected:
     /*!
     void close();
 
 protected:
     /*!
-      Opens file
-      \returns true if file is opened or false otherwise
-      */
+        Opens file
+        \returns true if file is opened or false otherwise
+    */
     bool open(QString file);
 
     /*!
     bool open(QString file);
 
     /*!
-      Reads single char from compressed.
-     */
+        Reads single char from compressed.
+    */
     QChar readChar();
 
 private:
     QChar readChar();
 
 private:
index 139c8bd..8f608f2 100644 (file)
 #include <QDebug>
 #include <QFile>
 
 #include <QDebug>
 #include <QFile>
 
-StarDialog::StarDialog(StarDictPlugin *plugin,
-                       StarDialogType type,
-                       QWidget *parent) :
-    QDialog(parent) {
-    this->plugin = plugin;
-    this->type = type;
-
-    accentsToolTip = tr("Strip accents (searching takes more time, but spelling doesn't have to be exact)");
-
-    initializeUI();
-
-
-    connect(accentsCheckBox, SIGNAL(toggled(bool)),
-            this, SLOT(setAccents(bool)));
-
-    #ifdef Q_WS_MAEMO_5
-        connect(accentsInfoToolButton, SIGNAL(clicked()),
-
-    #endif
-
-    if(type == New) {
-        connect(browseButton, SIGNAL(clicked()),
-                this, SLOT(selectFile()));
-    }
-
-    connect(confirmButton, SIGNAL(clicked()),
-            this, SLOT(accept()));
-
+StarDialog::StarDialog(StarDictPlugin *plugin, StarDialogType type,
+                       QWidget *parent) : QDialog(parent) {
+   this->plugin = plugin;
+   this->type = type;
+   initializeUI();
+   if(type == New)
+       connect(browseButton, SIGNAL(clicked()),this, SLOT(selectFile()));
+   connect(confirmButton, SIGNAL(clicked()),this, SLOT(accept()));
 }
 
 
 }
 
 
@@ -60,25 +40,21 @@ void StarDialog::initializeUI() {
     mainVerticalLayout = new QVBoxLayout;
     widget = new QWidget;
     widget->setLayout(mainVerticalLayout);
     mainVerticalLayout = new QVBoxLayout;
     widget = new QWidget;
     widget->setLayout(mainVerticalLayout);
-
     infoLabel = new QLabel;
     infoLabel->setWordWrap(true);
 
     if(type == New) {
     infoLabel = new QLabel;
     infoLabel->setWordWrap(true);
 
     if(type == New) {
-        setWindowTitle(tr("Add new StarDict dictionary"));
-
         browseLayout = new QHBoxLayout;
         browseButton = new QPushButton(tr("Browse"));
         browseLayout = new QHBoxLayout;
         browseButton = new QPushButton(tr("Browse"));
-        infoLabel->setText(tr("Dictionary file: not selected"));
 
 
+        setWindowTitle(tr("Add new StarDict dictionary"));
+        infoLabel->setText(tr("Dictionary file: not selected"));
         browseLayout->addWidget(infoLabel, 0, Qt::AlignLeft);
         browseLayout->addWidget(browseButton, 0, Qt::AlignRight);
         browseLayout->addWidget(infoLabel, 0, Qt::AlignLeft);
         browseLayout->addWidget(browseButton, 0, Qt::AlignRight);
-
         mainVerticalLayout->addLayout(browseLayout);
     }
     else {
         setWindowTitle(tr("StarDict Settings"));
         mainVerticalLayout->addLayout(browseLayout);
     }
     else {
         setWindowTitle(tr("StarDict Settings"));
-
         infoLabel->setText(tr("Plugin: ") + plugin->type().toUpper() +"\n" +
                 tr("Book name: ") + plugin->settings()->value("bookname") 
                         + "\n" +
         infoLabel->setText(tr("Plugin: ") + plugin->type().toUpper() +"\n" +
                 tr("Book name: ") + plugin->settings()->value("bookname") 
                         + "\n" +
@@ -94,51 +70,15 @@ void StarDialog::initializeUI() {
         mainVerticalLayout->addWidget(infoLabel);
     }
 
         mainVerticalLayout->addWidget(infoLabel);
     }
 
-    accentsLayout = new QHBoxLayout;
-    accentsCheckBox = new QCheckBox(tr("Strip accents"));
-    accentsCheckBox->setToolTip(accentsToolTip);
-    accentsLayout->addWidget(accentsCheckBox); 
-    #ifdef Q_WS_MAEMO_5
-        accentsInfoToolButton = new QToolButton;
-        accentsInfoToolButton->setIcon(QIcon::fromTheme("general_information"));
-        accentsLayout->addWidget(accentsInfoToolButton);
-    #endif
-
-
-    mainVerticalLayout->addLayout(accentsLayout);
-
-
-    //load old setting if exists
-    if(!plugin) {
-        accentsCheckBox->setChecked(true);
-        accentsCheckBox->setEnabled(false);
-        _accents = true;
+    if(!plugin)
         _dictionaryFilePath = "";
         _dictionaryFilePath = "";
-    }
-    else if(plugin && plugin->settings()->value("cached") == "true") {
-        accentsCheckBox->setChecked(true);
-        accentsCheckBox->setEnabled(false);
-        _accents = true;
-    }
-    else {
-        if(plugin->settings()->value("strip_accents") == "true") {
-            accentsCheckBox->setChecked(true);
-            _accents = true;
-        }
-        else {
-            accentsCheckBox->setChecked(false);
-            _accents = false;
-        }
-    }
 
     confirmButton = new QPushButton;
     mainVerticalLayout->addWidget(confirmButton);
 
     confirmButton = new QPushButton;
     mainVerticalLayout->addWidget(confirmButton);
-    if(type == New) {
+    if(type == New)
         confirmButton->setText(tr("Add"));
         confirmButton->setText(tr("Add"));
-    }
-    else {
+    else
         confirmButton->setText(tr("Save settings"));
         confirmButton->setText(tr("Save settings"));
-    }
 
     scrollArea = new QScrollArea;
     scrollArea->setWidget(widget);
 
     scrollArea = new QScrollArea;
     scrollArea->setWidget(widget);
@@ -167,68 +107,60 @@ void StarDialog::initializeUI() {
     scrollArea->setLineWidth(0);
     scrollArea->setMidLineWidth(0);
     scrollArea->setFrameStyle(QFrame::NoFrame);
     scrollArea->setLineWidth(0);
     scrollArea->setMidLineWidth(0);
     scrollArea->setFrameStyle(QFrame::NoFrame);
-
-
-}
-
-
-void StarDialog::setAccents(bool accents) {
-    _accents = accents;
 }
 
 
 void StarDialog::selectFile() {
     QString fileName = QFileDialog::getOpenFileName(this,
 }
 
 
 void StarDialog::selectFile() {
     QString fileName = QFileDialog::getOpenFileName(this,
-                                     tr("Select dictionary file"),
-                                     _dictionaryFilePath,
-                                     tr("StarDict Files (*.dict *dict.dz *.idx *idx.gz *.ifo)"),
-                                     NULL,
-                                     NULL);
-
+                     tr("Select dictionary file"),
+                     _dictionaryFilePath,
+                     tr("StarDict Files (*.dict *dict.dz *.idx *idx.gz *.ifo)"),
+                     NULL,
+                     NULL);
     if (!fileName.isEmpty()) {
         infoLabel->setText(tr("Dictionary file: %1").arg(fileName));
         _dictionaryFilePath = fileName;
     if (!fileName.isEmpty()) {
         infoLabel->setText(tr("Dictionary file: %1").arg(fileName));
         _dictionaryFilePath = fileName;
-        if (_dictionaryFilePath.endsWith(".tar.bz2")){
-                _isCompressed = true;
-        }
-        else {
-                _isCompressed = false;
-        }
+        if (_dictionaryFilePath.endsWith(".tar.bz2"))
+            _isCompressed = true;
+        else
+            _isCompressed = false;
         updateGeometry();
     }
 }
 
         updateGeometry();
     }
 }
 
+
 void StarDialog::saveSettings() {
     _settings = new Settings;
 void StarDialog::saveSettings() {
     _settings = new Settings;
-    if(plugin) {
+
+    if(plugin)
         foreach(QString key, plugin->settings()->keys())
             _settings->setValue(key, plugin->settings()->value(key));
         foreach(QString key, plugin->settings()->keys())
             _settings->setValue(key, plugin->settings()->value(key));
-    }
 
 
-    _settings->setValue("path", _dictionaryFilePath);
-    _settings->setValue("ifoFileName", _dictName + ".ifo");
-    _settings->setValue("idxFileName", _dictName + ".idx");
-    if (QFile::exists(_dictName + ".dict.dz") == true) {
+    if(_settings->value("path")=="")
+        _settings->setValue("path", _dictionaryFilePath);
+
+    if(_settings->value("ifoFileName")=="")
+        _settings->setValue("ifoFileName", _dictName + ".ifo");
+
+    if(_settings->value("idxFileName")=="")
+        _settings->setValue("idxFileName", _dictName + ".idx");
+
+    if(_settings->value("dictFileName")==""){
+        if (QFile::exists(_dictName + ".dict.dz") == true)
             _settings->setValue("dictFileName", _dictName + ".dict.dz");
             _settings->setValue("dictFileName", _dictName + ".dict.dz");
-    }
-    else {
+        else
             _settings->setValue("dictFileName", _dictName + ".dict");
     }
 
             _settings->setValue("dictFileName", _dictName + ".dict");
     }
 
-    if (QFile::exists(_dictName + ".syn") == true) {
+    if(_settings->value("synFileName")=="")
+        if (QFile::exists(_dictName + ".syn") == true)
             _settings->setValue("synFileName", _dictName + ".syn");
             _settings->setValue("synFileName", _dictName + ".syn");
-    }
-
-    if(_accents)
-        _settings->setValue("strip_accents", "true");
-    else
-        _settings->setValue("strip_accents", "false");
 }
 
 }
 
+
 void StarDialog::accept() {
     if(type == New && _dictionaryFilePath.isEmpty()) {
         Q_EMIT notify(Notify::Warning, tr("File path is not set"));
 void StarDialog::accept() {
     if(type == New && _dictionaryFilePath.isEmpty()) {
         Q_EMIT notify(Notify::Warning, tr("File path is not set"));
-
         return;
     }
 
         return;
     }
 
@@ -241,38 +173,34 @@ void StarDialog::accept() {
     QDialog::accept();
 }
 
     QDialog::accept();
 }
 
+
 bool StarDialog::checkFiles() {
 bool StarDialog::checkFiles() {
-        if (!_isCompressed) {
-
-            if (_dictionaryFilePath.right(2) == "dz") {
-                _dictName = _dictionaryFilePath.left(_dictionaryFilePath.lastIndexOf("."));
-                _dictName = _dictName.left(_dictName.lastIndexOf("."));
-            }
-            else {
-                _dictName = _dictionaryFilePath.left(_dictionaryFilePath.lastIndexOf("."));
-            }
-
-            if (QFile::exists(_dictName + ".idx") == false && QFile::exists(_dictName + ".idx.gz") == false) {
-                return false;
-            }
-            if (QFile::exists(_dictName + ".dict") == false && QFile::exists(_dictName + ".dict.dz") == false) {
-                return false;
-            }
-            return true;
+    if (!_isCompressed) {
+        if (_dictionaryFilePath.right(2) == "dz") {
+            _dictName = _dictionaryFilePath.left(_dictionaryFilePath.lastIndexOf("."));
+            _dictName = _dictName.left(_dictName.lastIndexOf("."));
         }
         }
-        else {
-            //TODO: untar files (?)
+        else{
+            _dictName = _dictionaryFilePath.left(_dictionaryFilePath.lastIndexOf("."));
+        }
+
+
+        if (QFile::exists(_dictName + ".idx") == false
+                && QFile::exists(_dictName + ".idx.gz") == false) {
+            return false;
+        }
+        if (QFile::exists(_dictName + ".dict") == false
+                && QFile::exists(_dictName + ".dict.dz") == false) {
             return false;
         }
             return false;
         }
+        return true;
+    }
+    else
+        return false;
 }
 
 }
 
+
 Settings* StarDialog::getSettings() {
     return _settings;
 }
 
 Settings* StarDialog::getSettings() {
     return _settings;
 }
 
-#ifdef Q_WS_MAEMO_5
-    void StarDialog::showAccentsInfo() {
-        Q_EMIT notify(Notify::Warning, accentsToolTip);
-    }
-#endif
-
index b87cf0f..de3ed04 100644 (file)
 //! Implementation of stardict plugin's dialogs.
 /*!
     This class can create dialogs for adding a new dictionary or changing settings
 //! Implementation of stardict plugin's dialogs.
 /*!
     This class can create dialogs for adding a new dictionary or changing settings
-     of an existing one, based on dialog type passed to contructor.
+    of an existing one, based on dialog type passed to contructor.
     When adding a new dictionary dialog contains a button to browse file system and
     select a 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"
     When adding a new dictionary dialog contains a button to browse file system and
     select a 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 buttons which allow to
-     see more information about these options, on desktop the same information is
-     displayed as a tool tip.
+    options. On maemo right next to comboboxes are tool buttons which allow to
+    see more information about these options, on desktop the same information is
+    displayed as a tool tip.
     All contents of a dialog are in a scroll area.
 */
 class StarDialog : public QDialog
     All contents of a dialog are in a scroll area.
 */
 class StarDialog : public QDialog
@@ -51,11 +51,11 @@ class StarDialog : public QDialog
     Q_OBJECT
 public:
     /*!
     Q_OBJECT
 public:
     /*!
-      Describes type of dialog. New means that dialog contains widgets to browse
+        Describes type of dialog. New means that dialog contains widgets to browse
         file system and select dictionary file. Change means that dialog displays
         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 keep accents.
+        information about dictionary.
+        In both types dialog provides widgets to create or delete cache and remove
+        or keep accents.
     */
     enum StarDialogType {New, Change};
 
     */
     enum StarDialogType {New, Change};
 
@@ -71,10 +71,10 @@ public:
                         StarDialogType type = New,
                         QWidget* parent = 0);
 
                         StarDialogType type = New,
                         QWidget* parent = 0);
 
-    //! \returns settings of plugin
     /*!
         After acceptance of dialog this method returns plugin's settings based on
     /*!
         After acceptance of dialog this method returns plugin's settings based on
-         user's choices in dialog.
+        user's choices in dialog.
+        \returns settings of plugin
     */
     Settings* getSettings();
 
     */
     Settings* getSettings();
 
@@ -91,13 +91,6 @@ public Q_SLOTS:
 private Q_SLOTS:
     //! displays dialog to browse and select file
     void selectFile();
 private Q_SLOTS:
     //! displays dialog to browse and select file
     void selectFile();
-    void setAccents(bool);
-
-    #ifdef Q_WS_MAEMO_5
-        //! on maemo shows information about checkboxes
-        void showAccentsInfo();
-    #endif
-
 
 private:
     void initializeUI();
 
 private:
     void initializeUI();
@@ -110,30 +103,12 @@ private:
     QPushButton* browseButton;
     QHBoxLayout* browseLayout;
 
     QPushButton* browseButton;
     QHBoxLayout* browseLayout;
 
-
-    QCheckBox* accentsCheckBox;
-    QHBoxLayout* accentsLayout;
-
-    QString accentsToolTip;
-
-    #ifdef Q_WS_MAEMO_5
-        QToolButton* accentsInfoToolButton;
-    #endif
-
-
     QPushButton* confirmButton;
     QPushButton* confirmButton;
-
     QString _dictionaryFilePath;
     QString _dictionaryFilePath;
-
     QScrollArea* scrollArea;
     QScrollArea* scrollArea;
-
     QWidget* widget;
     QHBoxLayout* layout;
     QWidget* widget;
     QHBoxLayout* layout;
-
     QVBoxLayout* mainVerticalLayout;
     QVBoxLayout* mainVerticalLayout;
-    bool _accents;
-    bool _lastAccents;
-
     bool _isCompressed;
     QString _dictName;
 
     bool _isCompressed;
     QString _dictName;
 
index f2c0f94..a032c8e 100644 (file)
 #include "StarDialog.h"
 #include <QDebug>
 
 #include "StarDialog.h"
 #include <QDebug>
 
+
 StarDictDialog::StarDictDialog(StarDictPlugin *plugin, QObject *parent) :
     DictDialog(parent) {
     this->plugin = plugin;
     _lastDialogParent=0;
 }
 
 StarDictDialog::StarDictDialog(StarDictPlugin *plugin, QObject *parent) :
     DictDialog(parent) {
     this->plugin = plugin;
     _lastDialogParent=0;
 }
 
+
 QWidget* StarDictDialog::lastDialogParent() {
     return _lastDialogParent;
 }
 
 QWidget* StarDictDialog::lastDialogParent() {
     return _lastDialogParent;
 }
 
+
 void StarDictDialog::setLastDialogParent(QWidget *w) {
     _lastDialogParent = w;
 }
 
 void StarDictDialog::setLastDialogParent(QWidget *w) {
     _lastDialogParent = w;
 }
 
+
 Settings* StarDictDialog::addNewDictionary(QWidget *parent) {
     StarDialog d(0, StarDialog::New, parent);
     setLastDialogParent(parent);
 Settings* StarDictDialog::addNewDictionary(QWidget *parent) {
     StarDialog d(0, StarDialog::New, parent);
     setLastDialogParent(parent);
@@ -55,6 +59,7 @@ Settings* StarDictDialog::addNewDictionary(QWidget *parent) {
     return 0;
 }
 
     return 0;
 }
 
+
 void StarDictDialog::changeSettings(QWidget * parent) {
     StarDialog d(plugin, StarDialog::Change, parent);
     setLastDialogParent(parent);
 void StarDictDialog::changeSettings(QWidget * parent) {
     StarDialog d(plugin, StarDialog::Change, parent);
     setLastDialogParent(parent);
index f4a33e1..99f581b 100644 (file)
@@ -36,15 +36,15 @@ class StarDictDialog : public DictDialog {
 public:
     explicit StarDictDialog(StarDictPlugin* plugin, QObject *parent = 0);
     /*!
 public:
     explicit StarDictDialog(StarDictPlugin* plugin, QObject *parent = 0);
     /*!
-      Shows "add new xdxf dictionary" dialog and returns settings of a new dict
-      \param parent parent widget on which dialog will be displayed
-      */
+        Shows "add new xdxf dictionary" dialog and returns settings of a new dict
+        \param parent parent widget on which dialog will be displayed
+    */
     Settings* addNewDictionary(QWidget *parent);
 
     /*!
     Settings* addNewDictionary(QWidget *parent);
 
     /*!
-      Shows settings dialog and saves new settings in plugin
-      \param parent parent widget on which dialog will be displayed
-      */
+        Shows settings dialog and saves new settings in plugin
+        \param parent parent widget on which dialog will be displayed
+    */
     void changeSettings(QWidget *parent);
 
     QWidget* lastDialogParent();
     void changeSettings(QWidget *parent);
 
     QWidget* lastDialogParent();
index b12f843..f30dbc8 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "StarDictPlugin.h"
 
 
 #include "StarDictPlugin.h"
 
-
+/**/
 uint qHash(const TranslationStarDict &key) {
    return qHash(key.key());
 }
 uint qHash(const TranslationStarDict &key) {
    return qHash(key.key());
 }
@@ -40,7 +40,6 @@ StarDictPlugin::StarDictPlugin(QObject *parent) : CommonDictInterface(parent),
 
     _settings->setValue("type","stardict");
     _icon = QIcon("/usr/share/mdictionary/stardict.png");
 
     _settings->setValue("type","stardict");
     _icon = QIcon("/usr/share/mdictionary/stardict.png");
-    _wordsCount = -1;
     stopped = false;
 
     initAccents();
     stopped = false;
 
     initAccents();
@@ -106,10 +105,10 @@ QList<Translation*> StarDictPlugin::searchWordList(QString word, int limit) {
         word.indexOf("_")==-1 && word.indexOf("%")==-1)
         word+="*";
 
         word.indexOf("_")==-1 && word.indexOf("%")==-1)
         word+="*";
 
-
     if((settings()->value("idxoffsetbits") == "32") ||
                          (settings()->value("idxoffsetbits") == ""))
         is32b = true;
     if((settings()->value("idxoffsetbits") == "32") ||
                          (settings()->value("idxoffsetbits") == ""))
         is32b = true;
+
     if(!err)
         return QList<Translation*>();
 
     if(!err)
         return QList<Translation*>();
 
@@ -150,10 +149,6 @@ QByteArray StarDictPlugin::read(QByteArray::iterator it,
     if(bytes == 0 && it != end){
         while(*it != '\0' && it != end)
             ret.append(*it++);
     if(bytes == 0 && it != end){
         while(*it != '\0' && it != end)
             ret.append(*it++);
-        if(it == end)
-            qDebug()<<"end";
-        else
-            qDebug()<<"000";
     }
     else
         for(int i = 0; i < bytes && it != end; i++)
     }
     else
         for(int i = 0; i < bytes && it != end; i++)
@@ -166,19 +161,22 @@ QString StarDictPlugin::interpret(QByteArray::iterator it,
         QByteArray::iterator end, QChar mode,QString key, bool last) {
     QString result;
     qDebug()<<"****** mode:     "<<mode;
         QByteArray::iterator end, QChar mode,QString key, bool last) {
     QString result;
     qDebug()<<"****** mode:     "<<mode;
-    if(mode == 'm'){
-        result += "<key>" + key + "</key>";
-        result += QString::fromUtf8(read(it++, end));
-    }
-    else if(mode == 'l'){
+
+    if(mode == 'm' ||
+            mode == 'l' ||
+            mode == 'g' ||
+            mode == 't' ||
+            mode == 'y' ||
+            mode == 'k' ||
+            mode == 'w' ||
+            mode == 'h' ||
+            mode == 'r' ){
         result += "<key>" + key + "</key>";
         result += "<key>" + key + "</key>";
-        result += QString::fromUtf8(read(it++, end));
+        result += "<t>" + QString::fromUtf8(read(it++, end)) + "</t>";
     }
     }
-    else if(mode ==  'g'){
-        result += "<key>" + key + "</key>";
-        result += QString::fromUtf8(read(it++, end));
 
 
-        /* delete "small" tag  from translation*/
+    if(mode ==  'g'){
+        /* delete "small" tag  from g translation*/
         int indexOfSmall=result.indexOf("<small>");
         while(indexOfSmall!=-1){
             int indexOfEndSmall= result.indexOf("</small>");
         int indexOfSmall=result.indexOf("<small>");
         while(indexOfSmall!=-1){
             int indexOfEndSmall= result.indexOf("</small>");
@@ -187,11 +185,7 @@ QString StarDictPlugin::interpret(QByteArray::iterator it,
             indexOfSmall=result.indexOf("<small>");
         }
     }
             indexOfSmall=result.indexOf("<small>");
         }
     }
-    else if(mode == 't'){
-        result += "<key>" + key + "</key>";
-        result += QString::fromUtf8(read(it++, end));
-    }
-    else if(mode == 'x'){
+    if(mode == 'x'){
         result += QString::fromUtf8(read(it++, end));
         result.replace("</k>","</key><t>");
         result.replace("<k>","</t><key>");
         result += QString::fromUtf8(read(it++, end));
         result.replace("</k>","</key><t>");
         result.replace("<k>","</t><key>");
@@ -201,27 +195,6 @@ QString StarDictPlugin::interpret(QByteArray::iterator it,
         if(result.contains("<t>"))
             result+="</t>";
     }
         if(result.contains("<t>"))
             result+="</t>";
     }
-    else if(mode == 'y') {
-        result += "<key>" + key + "</key>";
-        result += QString::fromUtf8(read(it++, end));
-    }
-    else if(mode == 'k'){
-        result += "<key>" + key + "</key>";
-        result += QString::fromUtf8(read(it++, end));
-    }
-    else if(mode == 'w'){
-        result += "<key>" + key + "</key>";
-        result += QString::fromUtf8(read(it++, end));
-    }
-    else if(mode == 'h'){
-        result += "<key>" + key + "</key>";
-        result += QString::fromUtf8(read(it++, end));
-    }
-    else if(mode == 'r'){
-        result += "<key>" + key + "</key>";
-        result += QString::fromUtf8(read(it++, end));
-    }
-
 
 // Dont know whether mDictionary would ever handle binary stardict format
 // to be honest dont see any kind of adventages (can't find any binary dict)
 
 // Dont know whether mDictionary would ever handle binary stardict format
 // to be honest dont see any kind of adventages (can't find any binary dict)
@@ -273,7 +246,6 @@ QString StarDictPlugin::format(QByteArray raw, QString mode,QString key) {
 }
 
 
 }
 
 
-
 QString StarDictPlugin::search(QString key, qint64 offset, qint32 len) {
     QString dictPath = settings()->value("dictFileName");
     StarDictReader *reader = StarDictReaderFactory::createReader(dictPath);
 QString StarDictPlugin::search(QString key, qint64 offset, qint32 len) {
     QString dictPath = settings()->value("dictFileName");
     StarDictReader *reader = StarDictReaderFactory::createReader(dictPath);
@@ -329,11 +301,6 @@ Settings* StarDictPlugin::settings() {
 }
 
 
 }
 
 
-bool StarDictPlugin::isCached() {
-    return false;
-}
-
-
 bool StarDictPlugin::setSettings(const Settings *sett) {
     if(sett) {
         foreach(QString key, sett->keys())
 bool StarDictPlugin::setSettings(const Settings *sett) {
     if(sett) {
         foreach(QString key, sett->keys())
@@ -378,7 +345,6 @@ int StarDictPlugin::countWords() {
 }
 
 
 }
 
 
-
 void StarDictPlugin::clean() {
 
 }
 void StarDictPlugin::clean() {
 
 }
index 084f8ee..460874e 100644 (file)
@@ -70,7 +70,7 @@ public:
 
     /*! \returns DictDialog object that creates dialogs
         for adding a new dictionary and changing plugin settings
 
     /*! \returns DictDialog object that creates dialogs
         for adding a new dictionary and changing plugin settings
-      */
+    */
     DictDialog* dictDialog();
 
     //! \returns new, clean copy of plugin with settings set as in Settings*
     DictDialog* dictDialog();
 
     //! \returns new, clean copy of plugin with settings set as in Settings*
@@ -87,7 +87,7 @@ public:
     /*! \return a description of a word given by a QString
         \param offset offset of translation to be cut out
         \param len lenght of translation to be cut out
     /*! \return a description of a word given by a QString
         \param offset offset of translation to be cut out
         \param len lenght of translation to be cut out
-        */
+    */
     QString search(QString key, qint64 offset, qint32 len);
 
     //! \returns current plugin settings
     QString search(QString key, qint64 offset, qint32 len);
 
     //! \returns current plugin settings
@@ -104,18 +104,19 @@ public:
 
     /*! plugin should delete any files (eg. cache) that have been created and are ready
         to be deleted
 
     /*! plugin should delete any files (eg. cache) that have been created and are ready
         to be deleted
-        */
+    */
     void clean();
 
 
 
 public Q_SLOTS:
     void clean();
 
 
 
 public Q_SLOTS:
-    /*! performs search in a dictionary
-      \param  word word to search for in a dictionary
-      \param limit limit on number of results
+    /*!
+        performs search in a dictionary
+        \param  word word to search for in a dictionary
+        \param limit limit on number of results
 
 
-      After finishing search it has to emit
-      \see CommonDictInterface:finalTranslation  finalTranslation
+        After finishing search it has to emit
+        \see CommonDictInterface:finalTranslation  finalTranslation
     */
     QList<Translation*> searchWordList(QString word, int limit=0);
 
     */
     QList<Translation*> searchWordList(QString word, int limit=0);
 
@@ -128,28 +129,28 @@ public Q_SLOTS:
 
 private:
 
 
 private:
 
-    /*! \returns true or false depending on whether the dictionary is cached
-        or not
-     */
-    bool isCached();
-    /*! searches for a list of words similar to a word in a database file
-    \param word key compared with keys in a database
-    \param limit limits the number of translations in returned list,
-           0 means unlimited
-    \returns list of translations
+    /*!
+        searches for a list of words similar to a word in a database file
+        \param word key compared with keys in a database
+        \param limit limits the number of translations in returned list,
+        0 means unlimited
+        \returns list of translations
     */
     QList<Translation*> searchWordListCache(QString word, int limit=0);
 
     */
     QList<Translation*> searchWordListCache(QString word, int limit=0);
 
-    /*! searches for a list of words similar to a word in a xdxf file
-    \param word key compared with keys in a xdxf file
-    \param limit limits the number of translations in returned list,
-           0 means unlimited
-    \returns list of translations
+    /*!
+        searches for a list of words similar to a word in a xdxf file
+        \param word key compared with keys in a xdxf file
+        \param limit limits the number of translations in returned list,
+        0 means unlimited
+        \returns list of translations
     */
     QList<Translation*> searchWordListFile(QString word, int limit=0);
 
     */
     QList<Translation*> searchWordListFile(QString word, int limit=0);
 
-    /*! searches for a translation of a word which is exactly like a key
-        in a xdxf file */
+    /*!
+        searches for a translation of a word which is exactly like a key
+        in a xdxf file
+    */
     QString searchFile(QString key);
 
     //! scans dictionary file to get information about it
     QString searchFile(QString key);
 
     //! scans dictionary file to get information about it
@@ -168,41 +169,43 @@ private:
     //! information about dictionary
     QString _infoNote;
 
     //! information about dictionary
     QString _infoNote;
 
-    QString _dictionaryInfo;
-
     //! icon displayed during translations and when a dictionary is chosen
     QIcon _icon;
 
     //! icon displayed during translations and when a dictionary is chosen
     QIcon _icon;
 
-    //! number of words in a dictionary
-    long _wordsCount;
     //! indicates if search is stopped
     volatile bool stopped;
     Settings *_settings;
     StarDictDialog* _dictDialog;
     Settings* _ifoFileSettings;
 
     //! indicates if search is stopped
     volatile bool stopped;
     Settings *_settings;
     StarDictDialog* _dictDialog;
     Settings* _ifoFileSettings;
 
-    /*! Reads and process (converting to qstring) data from StarDict dictionary
+    /*!
+        Reads and process (converting to qstring) data from StarDict dictionary
         file (*.dict[.dz])
         \return converted translation
         \param QByteArray raw data to process
         file (*.dict[.dz])
         \return converted translation
         \param QByteArray raw data to process
-        \param mode StarDict parametr "sametypesequence" */
+        \param mode StarDict parametr "sametypesequence"
+    */
     QString format(QByteArray, QString mode,QString key);
 
     QString format(QByteArray, QString mode,QString key);
 
-    /*! Reads bytes bytes of data or reads until \0
+    /*!
+        Reads bytes bytes of data or reads until \0
         \param it iterator to given data
         \param end end of data
         \param bytes to read
         \param it iterator to given data
         \param end end of data
         \param bytes to read
-        \return readed data chunk*/
+        \return readed data chunk
+    */
     QByteArray read(QByteArray::iterator it, QByteArray::iterator end,
            int bytes = 0);
 
     QByteArray read(QByteArray::iterator it, QByteArray::iterator end,
            int bytes = 0);
 
-    /*! Interpret data basis on mode (StarDict dict data type)
+    /*!
+        Interpret data basis on mode (StarDict dict data type)
         \param it iterator on given data set
         \param end iterator pointing to the data end
         \param mode stardict dict data type
         \param last used to interpret sametypesequence field last letter (see
         \param it iterator on given data set
         \param end iterator pointing to the data end
         \param mode stardict dict data type
         \param last used to interpret sametypesequence field last letter (see
-                StarDict format description)
-        \return QSting containing interpreted data chunk */
+        StarDict format description)
+        \return QSting containing interpreted data chunk
+    */
     QString interpret(QByteArray::iterator it, QByteArray::iterator end,
             QChar mode,QString key, bool last = false);
 
     QString interpret(QByteArray::iterator it, QByteArray::iterator end,
             QChar mode,QString key, bool last = false);
 
index b1bbbdc..c2c67b2 100644 (file)
@@ -29,9 +29,9 @@
 #include <QObject>
 
 /*!
 #include <QObject>
 
 /*!
-  Abstract class used for reading stardict dict and idx files.
-  It allows to read all necessary data types used in parsing stardict files.
-  */
+    Abstract class used for reading stardict dict and idx files.
+    It allows to read all necessary data types used in parsing stardict files.
+*/
 class StarDictReader : public QObject {
     Q_OBJECT
 public:
 class StarDictReader : public QObject {
     Q_OBJECT
 public:
@@ -39,45 +39,45 @@ public:
     virtual ~StarDictReader() {}
 
     /*!
     virtual ~StarDictReader() {}
 
     /*!
-      Reads translations text from dict file.
-      \param offset 64-bit offset of translation in file, readed from idx file
-      \param len length of translation, readed from idx file too
-      */
+        Reads translations text from dict file.
+        \param offset 64-bit offset of translation in file, readed from idx file
+        \param len length of translation, readed from idx file too
+    */
     virtual QByteArray readString(qint64 offset, qint32 len)=0;
 
     /*!
     virtual QByteArray readString(qint64 offset, qint32 len)=0;
 
     /*!
-      Reads 32-bits integer value from file and convert it from BigEndian
+        Reads 32-bits integer value from file and convert it from BigEndian
         to Little Endian
         to Little Endian
-      */
+    */
     virtual qint32 readInt32BigEndian()=0;
 
     /*!
     virtual qint32 readInt32BigEndian()=0;
 
     /*!
-      Reads 64-bits integer value from file and convert it from BigEndian
+        Reads 64-bits integer value from file and convert it from BigEndian
         to Little Endian
         to Little Endian
-      */
+    */
     virtual qint64 readInt64BigEndian()=0;
 
     /*!
     virtual qint64 readInt64BigEndian()=0;
 
     /*!
-      Reads single string from file, end of string is marked as '\0' in file.
-     */
+        Reads single string from file, end of string is marked as '\0' in file.
+    */
     virtual QString readKeyword()=0;
 
 
     /*!
     virtual QString readKeyword()=0;
 
 
     /*!
-      Closing file;
-      */
+        Closing file;
+    */
     virtual void close()=0;
 
 protected:
     /*!
     virtual void close()=0;
 
 protected:
     /*!
-      Opens file
-      \returns true if file is opened or false otherwise
-      */
+        Opens file
+        \returns true if file is opened or false otherwise
+    */
     virtual bool open(QString file)=0;
 
     /*!
     virtual bool open(QString file)=0;
 
     /*!
-      Reads single char from file.
-     */
+        Reads single char from file.
+    */
     virtual QChar readChar()=0;
 
 };
     virtual QChar readChar()=0;
 
 };
index a6e12e3..31013c6 100644 (file)
@@ -26,9 +26,9 @@
 #include "StarDictReader.h"
 
 /*!
 #include "StarDictReader.h"
 
 /*!
-  Class used to creating StarDictReader objects, based on filename it creates
-  compressed or uncompressed reader.
-  */
+    Class used to creating StarDictReader objects, based on filename it creates
+    compressed or uncompressed reader.
+*/
 class StarDictReaderFactory
 {
 public:
 class StarDictReaderFactory
 {
 public:
index 18c6744..d5fcf87 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-/*! \file TranslationXdxf.cpp
+/*! \file TranslationStarDict.cpp
     \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
 
     \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
 
-
 #include "TranslationStarDict.h"
 #include <QDebug>
 
 #include "TranslationStarDict.h"
 #include <QDebug>
 
+
 TranslationStarDict::TranslationStarDict():_key(""),_dictionaryInfo("") {
     starDictPlugin=0;
 }
 
 TranslationStarDict::TranslationStarDict():_key(""),_dictionaryInfo("") {
     starDictPlugin=0;
 }
 
+
 TranslationStarDict::TranslationStarDict(QString _key, QString _dictionaryInfo,
          StarDictPlugin *starDictPlugin): _key(_key),_dictionaryInfo(_dictionaryInfo) {
     this->starDictPlugin=starDictPlugin;
 TranslationStarDict::TranslationStarDict(QString _key, QString _dictionaryInfo,
          StarDictPlugin *starDictPlugin): _key(_key),_dictionaryInfo(_dictionaryInfo) {
     this->starDictPlugin=starDictPlugin;
@@ -59,8 +60,8 @@ QString TranslationStarDict::key() const {
     return _key;
 }
 
     return _key;
 }
 
-QString TranslationStarDict::toXml() const {
 
 
+QString TranslationStarDict::toXml() const {
     QString result("");
     if(!starDictPlugin)
         return result;
     QString result("");
     if(!starDictPlugin)
         return result;
@@ -83,10 +84,12 @@ QString TranslationStarDict::toXml() const {
    return result;
 }
 
    return result;
 }
 
+
 void TranslationStarDict::setKey(QString _key) {
     this->_key=_key;
 }
 
 void TranslationStarDict::setKey(QString _key) {
     this->_key=_key;
 }
 
+
 void TranslationStarDict::setDictionaryInfo(QString _dictionaryInfo) {
     this->_dictionaryInfo=_dictionaryInfo;
 }
 void TranslationStarDict::setDictionaryInfo(QString _dictionaryInfo) {
     this->_dictionaryInfo=_dictionaryInfo;
 }
index 6582324..5c68df9 100644 (file)
@@ -52,8 +52,10 @@ public:
     //! \return parsed raw format into xml
     QString toXml() const;
 
     //! \return parsed raw format into xml
     QString toXml() const;
 
-    /*! sets the word for which we want to find a translation
-        \param word for which we want to find a translation */
+    /*!
+        sets the word for which we want to find a translation
+        \param word for which we want to find a translation
+    */
     void setKey(QString);
 
     //! sets information about dictionary
     void setKey(QString);
 
     //! sets information about dictionary
@@ -67,7 +69,8 @@ public:
     //! returns corresponding dict object
     uint dict() const {return _dictHash;}
 
     //! returns corresponding dict object
     uint dict() const {return _dictHash;}
 
-    /*! Add another hit in *.id(x) file
+    /*!
+        Add another hit in *.id(x) file
         \param offset offset from begining of file to searched keyword
         \param len lenght of searched keyword
     */
         \param offset offset from begining of file to searched keyword
         \param len lenght of searched keyword
     */
index 8bf95b7..5cc4b0e 100644 (file)
@@ -1,37 +1,53 @@
 #include "UncompressedReader.h"
 #include "QDebug"
 
 #include "UncompressedReader.h"
 #include "QDebug"
 
+
 UncompressedReader::UncompressedReader(QObject *parent) :
         StarDictReader(parent) {
 
 }
 
 UncompressedReader::UncompressedReader(QObject *parent) :
         StarDictReader(parent) {
 
 }
 
+
 UncompressedReader::UncompressedReader(QString filename, QObject *parent) :
 StarDictReader(parent) {
     open(filename);
 }
 
 UncompressedReader::UncompressedReader(QString filename, QObject *parent) :
 StarDictReader(parent) {
     open(filename);
 }
 
+
 UncompressedReader::~UncompressedReader() {
     if(_file.isOpen())
         _file.close();
 }
 
 UncompressedReader::~UncompressedReader() {
     if(_file.isOpen())
         _file.close();
 }
 
+
 bool UncompressedReader::open(QString file) {
     _file.setFileName(file);
     _stream.setDevice(&_file);
     return _file.open(QFile::ReadOnly);
 }
 
 bool UncompressedReader::open(QString file) {
     _file.setFileName(file);
     _stream.setDevice(&_file);
     return _file.open(QFile::ReadOnly);
 }
 
+
 void UncompressedReader::close() {
     _file.close();
 }
 
 void UncompressedReader::close() {
     _file.close();
 }
 
+
 QChar UncompressedReader::readChar() {
     char c[4]={0};
     QString cha;
 
     _stream.readRawData(c,1);
 QChar UncompressedReader::readChar() {
     char c[4]={0};
     QString cha;
 
     _stream.readRawData(c,1);
-    if(((unsigned char)c[0])>127){
+    if(((unsigned char)c[0])>240)
+        _stream.readRawData(c+1,3);
+    else if(((unsigned char)c[0])>224)
+        _stream.readRawData(c+1,2);
+    else if(((unsigned char)c[0])>192)
+        _stream.readRawData(c+1,1);
+    else if(((unsigned char)c[0])>127)
+        qDebug()<<"error - starDict - read wordList from UTF-8";
+
+
+ /*   if(((unsigned char)c[0])>127){
         _stream.readRawData(c+1,1);
         if(((unsigned char)c[1])>127 && ((unsigned char)c[1])<192){
             _stream.readRawData(c+2,1);
         _stream.readRawData(c+1,1);
         if(((unsigned char)c[1])>127 && ((unsigned char)c[1])<192){
             _stream.readRawData(c+2,1);
@@ -39,11 +55,13 @@ QChar UncompressedReader::readChar() {
                 _stream.readRawData(c+3,1);
         }
     }
                 _stream.readRawData(c+3,1);
         }
     }
-
+ */
     cha=QString::fromUtf8(c);
     cha=QString::fromUtf8(c);
+
     return cha.at(0);
 }
 
     return cha.at(0);
 }
 
+
 QString UncompressedReader::readKeyword() {
     QString result;
     QChar c;
 QString UncompressedReader::readKeyword() {
     QString result;
     QChar c;
@@ -53,7 +71,6 @@ QString UncompressedReader::readKeyword() {
         result += c;
         c = readChar();
     }
         result += c;
         c = readChar();
     }
-
     return result;
 }
 
     return result;
 }
 
@@ -70,6 +87,7 @@ QByteArray UncompressedReader::readString(qint64 offset, qint32 len) {
     return result;
 }
 
     return result;
 }
 
+
 qint32 UncompressedReader::readInt32BigEndian() {
     _stream.setByteOrder(QDataStream::BigEndian);
     qint32 value;
 qint32 UncompressedReader::readInt32BigEndian() {
     _stream.setByteOrder(QDataStream::BigEndian);
     qint32 value;
@@ -78,11 +96,11 @@ qint32 UncompressedReader::readInt32BigEndian() {
     return value;
 }
 
     return value;
 }
 
+
 qint64 UncompressedReader::readInt64BigEndian() {
     _stream.setByteOrder(QDataStream::BigEndian);
     qint64 value;
     _stream>>value;
     _stream.setByteOrder(QDataStream::LittleEndian);
 qint64 UncompressedReader::readInt64BigEndian() {
     _stream.setByteOrder(QDataStream::BigEndian);
     qint64 value;
     _stream>>value;
     _stream.setByteOrder(QDataStream::LittleEndian);
-
     return value;
 }
     return value;
 }
index 30e4809..af9014f 100644 (file)
@@ -33,7 +33,7 @@
 
 /*!
   Class implementing StarDictReader interface and handling rading from uncompressed files
 
 /*!
   Class implementing StarDictReader interface and handling rading from uncompressed files
-  */
+*/
 class UncompressedReader : public StarDictReader
 {
     Q_OBJECT
 class UncompressedReader : public StarDictReader
 {
     Q_OBJECT
@@ -41,57 +41,57 @@ public:
     UncompressedReader(QObject *parent = 0);
 
     /*!
     UncompressedReader(QObject *parent = 0);
 
     /*!
-      Creates new reader and open file with passed filename
-      */
+        Creates new reader and open file with passed filename
+    */
     UncompressedReader(QString filename, QObject *parent = 0);
 
     /*!
     UncompressedReader(QString filename, QObject *parent = 0);
 
     /*!
-      Destructs object and closing file
+        Destructs object and closing file
     */
     ~UncompressedReader();
 
     /*!
     */
     ~UncompressedReader();
 
     /*!
-      Reads translations text from file
-      \param offset 64-bit offset of translation in file, readed
-             from idx file
-      \param len length of translation, readed from idx file too
-      */
+        Reads translations text from file
+        \param offset 64-bit offset of translation in file, readed
+        from idx file
+        \param len length of translation, readed from idx file too
+    */
     QByteArray readString(qint64 offset, qint32 len);
 
     /*!
     QByteArray readString(qint64 offset, qint32 len);
 
     /*!
-      Reads 32-bits integer value from file and convert it from
-      BigEndian to Little Endian
-      */
+        Reads 32-bits integer value from file and convert it from
+        BigEndian to Little Endian
+    */
     qint32 readInt32BigEndian();
 
     /*!
     qint32 readInt32BigEndian();
 
     /*!
-      Reads 64-bits integer value from file and convert it from
-      BigEndian to Little Endian
-      */
+        Reads 64-bits integer value from file and convert it from
+        BigEndian to Little Endian
+    */
     qint64 readInt64BigEndian();
 
     /*!
     qint64 readInt64BigEndian();
 
     /*!
-      Reads single string from file, end of string is marked as '\0'
-     in file.
-     */
+        Reads single string from file, end of string is marked as '\0'
+        in file.
+    */
     QString readKeyword();
 
 
     /*!
     QString readKeyword();
 
 
     /*!
-      Closing file;
-      */
+        Closing file;
+    */
     void close();
 
 protected:
     /*!
     void close();
 
 protected:
     /*!
-      Opens file
-      \returns true if file is opened or false otherwise
-      */
+        Opens file
+        \returns true if file is opened or false otherwise
+    */
     bool open(QString file);
 
     /*!
     bool open(QString file);
 
     /*!
-      Reads single char from compressed.
-     */
+        Reads single char from compressed.
+    */
     QChar readChar();
 
 private:
     QChar readChar();
 
 private:
index 64c07a0..f7b5541 100644 (file)
 <!DOCTYPE TS>
 <TS version="2.0" language="en_US">
 <context>
 <!DOCTYPE TS>
 <TS version="2.0" language="en_US">
 <context>
-    <name>XdxfCachingDialog</name>
-    <message>
-        <location filename="XdxfCachingDialog.cpp" line="35"/>
-        <location filename="XdxfCachingDialog.cpp" line="49"/>
-        <source>Caching dictionary, please wait</source>
-        <translation type="unfinished"></translation>
-    </message>
+    <name>StarDialog</name>
     <message>
     <message>
-        <location filename="XdxfCachingDialog.cpp" line="41"/>
-        <source>Cancel</source>
+        <location filename="StarDialog.cpp" line="33"/>
+        <source>Strip accents (searching takes more time, but spelling doesn&apos;t have to be exact)</source>
         <translation type="unfinished"></translation>
     </message>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>StarDictPlugin</name>
     <message>
     <message>
-        <location filename="XdxfCachingDialog.cpp" line="79"/>
-        <source>Estimated time left: </source>
+        <location filename="StarDictPlugin.cpp" line="353"/>
+        <source>StarDict dictionary cannot be read from file</source>
         <translation type="unfinished"></translation>
     </message>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>XdxfCachingDialog</name>
     <message numerus="yes">
     <message numerus="yes">
-        <location filename="XdxfCachingDialog.cpp" line="80"/>
         <source>%n second(s)</source>
         <source>%n second(s)</source>
-        <translation>
+        <translation type="obsolete">
             <numerusform>%n second</numerusform>
             <numerusform>%n seconds</numerusform>
         </translation>
     </message>
 </context>
             <numerusform>%n second</numerusform>
             <numerusform>%n seconds</numerusform>
         </translation>
     </message>
 </context>
-<context>
-    <name>XdxfDialog</name>
-    <message>
-        <location filename="XdxfDialog.cpp" line="35"/>
-        <source>Optimize for quicker searches (may take some time)</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="36"/>
-        <source>Strip accents (searching takes more time, but spelling doesn&apos;t have to be exact)</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="74"/>
-        <source>Add new XDXF dictionary</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="77"/>
-        <source>Browse</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="78"/>
-        <source>Dictionary file: not selected</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="86"/>
-        <source>XDXF Settings</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="88"/>
-        <source>Plugin: </source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="89"/>
-        <source>From: </source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="90"/>
-        <source>To: </source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="91"/>
-        <source>Description: </source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="97"/>
-        <source>Strip accents</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="107"/>
-        <source>Optimize</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="153"/>
-        <source>Add</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="156"/>
-        <source>Save settings</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="210"/>
-        <source>Select dictionary file</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="212"/>
-        <source>XDXF Files (*.xdxf)</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="217"/>
-        <source>Dictionary file: %1</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="246"/>
-        <source>File path is not set</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
-    <name>XdxfPlugin</name>
-    <message>
-        <location filename="xdxfplugin.cpp" line="108"/>
-        <location filename="xdxfplugin.cpp" line="206"/>
-        <location filename="xdxfplugin.cpp" line="523"/>
-        <source>Cache database cannot be opened for %1 dictionary. Searching in XDXF file. You may want to recache.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="xdxfplugin.cpp" line="157"/>
-        <location filename="xdxfplugin.cpp" line="237"/>
-        <source>XDXF file cannot be read for %1</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="xdxfplugin.cpp" line="365"/>
-        <source>XDXF file is in wrong format</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="xdxfplugin.cpp" line="407"/>
-        <source>XDXF dictionary cannot be read from file</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="xdxfplugin.cpp" line="455"/>
-        <location filename="xdxfplugin.cpp" line="514"/>
-        <source>XDXF file cannot be read for %1 dictionary</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="xdxfplugin.cpp" line="605"/>
-        <source>Database caching error, please try again.</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
 </TS>
 </TS>
index 9800a1c..40a705b 100644 (file)
@@ -2,27 +2,38 @@
 <!DOCTYPE TS>
 <TS version="2.0" language="pl_PL">
 <context>
 <!DOCTYPE TS>
 <TS version="2.0" language="pl_PL">
 <context>
+    <name>StarDialog</name>
+    <message>
+        <location filename="StarDialog.cpp" line="33"/>
+        <source>Strip accents (searching takes more time, but spelling doesn&apos;t have to be exact)</source>
+        <translation type="unfinished">Usuń akcenty (wyszukiwanie trwa dłużej, ale szukane słowo nie musi być wpisane dokładnie)</translation>
+    </message>
+</context>
+<context>
+    <name>StarDictPlugin</name>
+    <message>
+        <location filename="StarDictPlugin.cpp" line="353"/>
+        <source>StarDict dictionary cannot be read from file</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>XdxfCachingDialog</name>
     <message>
     <name>XdxfCachingDialog</name>
     <message>
-        <location filename="XdxfCachingDialog.cpp" line="35"/>
-        <location filename="XdxfCachingDialog.cpp" line="49"/>
         <source>Caching dictionary, please wait</source>
         <source>Caching dictionary, please wait</source>
-        <translation>Optymalizacja słownika, proszę czekać</translation>
+        <translation type="obsolete">Optymalizacja słownika, proszę czekać</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfCachingDialog.cpp" line="41"/>
         <source>Cancel</source>
         <source>Cancel</source>
-        <translation>Anuluj</translation>
+        <translation type="obsolete">Anuluj</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfCachingDialog.cpp" line="79"/>
         <source>Estimated time left: </source>
         <source>Estimated time left: </source>
-        <translation>Pozostały czas: </translation>
+        <translation type="obsolete">Pozostały czas: </translation>
     </message>
     <message numerus="yes">
     </message>
     <message numerus="yes">
-        <location filename="XdxfCachingDialog.cpp" line="80"/>
         <source>%n second(s)</source>
         <source>%n second(s)</source>
-        <translation>
+        <translation type="obsolete">
             <numerusform>%n sekunda</numerusform>
             <numerusform>%n sekundy</numerusform>
             <numerusform>%n sekund</numerusform>
             <numerusform>%n sekunda</numerusform>
             <numerusform>%n sekundy</numerusform>
             <numerusform>%n sekund</numerusform>
 <context>
     <name>XdxfDialog</name>
     <message>
 <context>
     <name>XdxfDialog</name>
     <message>
-        <location filename="XdxfDialog.cpp" line="35"/>
         <source>Optimize for quicker searches (may take some time)</source>
         <source>Optimize for quicker searches (may take some time)</source>
-        <translation>Optymalizuj dla szybszego wyszukiwania (może zająć trochę czasu)</translation>
+        <translation type="obsolete">Optymalizuj dla szybszego wyszukiwania (może zająć trochę czasu)</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="36"/>
         <source>Strip accents (searching takes more time, but spelling doesn&apos;t have to be exact)</source>
         <source>Strip accents (searching takes more time, but spelling doesn&apos;t have to be exact)</source>
-        <translation>Usuń akcenty (wyszukiwanie trwa dłużej, ale szukane słowo nie musi być wpisane dokładnie)</translation>
+        <translation type="obsolete">Usuń akcenty (wyszukiwanie trwa dłużej, ale szukane słowo nie musi być wpisane dokładnie)</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="74"/>
         <source>Add new XDXF dictionary</source>
         <source>Add new XDXF dictionary</source>
-        <translation>Dodaj nowy słownik XDXF</translation>
+        <translation type="obsolete">Dodaj nowy słownik XDXF</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="77"/>
         <source>Browse</source>
         <source>Browse</source>
-        <translation>Przeglądaj</translation>
+        <translation type="obsolete">Przeglądaj</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="78"/>
         <source>Dictionary file: not selected</source>
         <source>Dictionary file: not selected</source>
-        <translation>Plik ze słownikiem nie został wybrany</translation>
+        <translation type="obsolete">Plik ze słownikiem nie został wybrany</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="86"/>
         <source>XDXF Settings</source>
         <source>XDXF Settings</source>
-        <translation>Ustawienia XDXF</translation>
-    </message>
-    <message>
-        <location filename="XdxfDialog.cpp" line="88"/>
-        <source>Plugin: </source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">Ustawienia XDXF</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="89"/>
         <source>From: </source>
         <source>From: </source>
-        <translation>Z: </translation>
+        <translation type="obsolete">Z: </translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="90"/>
         <source>To: </source>
         <source>To: </source>
-        <translation>Na: </translation>
+        <translation type="obsolete">Na: </translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="91"/>
         <source>Description: </source>
         <source>Description: </source>
-        <translation>Opis: </translation>
+        <translation type="obsolete">Opis: </translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="97"/>
         <source>Strip accents</source>
         <source>Strip accents</source>
-        <translation>Usuń akcenty</translation>
+        <translation type="obsolete">Usuń akcenty</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="107"/>
         <source>Optimize</source>
         <source>Optimize</source>
-        <translation>Optymalizuj</translation>
+        <translation type="obsolete">Optymalizuj</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="153"/>
         <source>Add</source>
         <source>Add</source>
-        <translation>Dodaj</translation>
+        <translation type="obsolete">Dodaj</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="156"/>
         <source>Save settings</source>
         <source>Save settings</source>
-        <translation>Zapisz ustawienia</translation>
+        <translation type="obsolete">Zapisz ustawienia</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="210"/>
         <source>Select dictionary file</source>
         <source>Select dictionary file</source>
-        <translation>Wybierz plik ze słownikiem</translation>
+        <translation type="obsolete">Wybierz plik ze słownikiem</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="212"/>
         <source>XDXF Files (*.xdxf)</source>
         <source>XDXF Files (*.xdxf)</source>
-        <translation>Pliki XDXF (*.xdxf)</translation>
+        <translation type="obsolete">Pliki XDXF (*.xdxf)</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="217"/>
         <source>Dictionary file: %1</source>
         <source>Dictionary file: %1</source>
-        <translation>Plik ze słownikiem: %1</translation>
+        <translation type="obsolete">Plik ze słownikiem: %1</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="XdxfDialog.cpp" line="246"/>
         <source>File path is not set</source>
         <source>File path is not set</source>
-        <translation>Ścieżka do pliku nie jest ustawiona</translation>
+        <translation type="obsolete">Ścieżka do pliku nie jest ustawiona</translation>
     </message>
 </context>
 <context>
     <name>XdxfPlugin</name>
     <message>
     </message>
 </context>
 <context>
     <name>XdxfPlugin</name>
     <message>
-        <location filename="xdxfplugin.cpp" line="108"/>
-        <location filename="xdxfplugin.cpp" line="206"/>
-        <location filename="xdxfplugin.cpp" line="523"/>
         <source>Cache database cannot be opened for %1 dictionary. Searching in XDXF file. You may want to recache.</source>
         <source>Cache database cannot be opened for %1 dictionary. Searching in XDXF file. You may want to recache.</source>
-        <translation>Nie można otworzyć bazy danych dla słownika %1. Szukanie w pliku XDXF. Możesz spróbować ponownie włączyć optymalizację.</translation>
+        <translation type="obsolete">Nie można otworzyć bazy danych dla słownika %1. Szukanie w pliku XDXF. Możesz spróbować ponownie włączyć optymalizację.</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="xdxfplugin.cpp" line="157"/>
-        <location filename="xdxfplugin.cpp" line="237"/>
         <source>XDXF file cannot be read for %1</source>
         <source>XDXF file cannot be read for %1</source>
-        <translation>Nie można odczytać pliku XDXF dla %1</translation>
+        <translation type="obsolete">Nie można odczytać pliku XDXF dla %1</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="xdxfplugin.cpp" line="365"/>
         <source>XDXF file is in wrong format</source>
         <source>XDXF file is in wrong format</source>
-        <translation>Niewłaściwy format pliku XDXF</translation>
+        <translation type="obsolete">Niewłaściwy format pliku XDXF</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="xdxfplugin.cpp" line="407"/>
         <source>XDXF dictionary cannot be read from file</source>
         <source>XDXF dictionary cannot be read from file</source>
-        <translation>Nie można odczytać słownika XDXF z pliku</translation>
+        <translation type="obsolete">Nie można odczytać słownika XDXF z pliku</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="xdxfplugin.cpp" line="455"/>
-        <location filename="xdxfplugin.cpp" line="514"/>
         <source>XDXF file cannot be read for %1 dictionary</source>
         <source>XDXF file cannot be read for %1 dictionary</source>
-        <translation>Nie mozna odczytać pliku XDXF dla słownika %1</translation>
+        <translation type="obsolete">Nie mozna odczytać pliku XDXF dla słownika %1</translation>
     </message>
     <message>
     </message>
     <message>
-        <location filename="xdxfplugin.cpp" line="605"/>
         <source>Database caching error, please try again.</source>
         <source>Database caching error, please try again.</source>
-        <translation>Błąd optymalizacji, proszę spróbować ponownie.</translation>
+        <translation type="obsolete">Błąd optymalizacji, proszę spróbować ponownie.</translation>
     </message>
 </context>
 </TS>
     </message>
 </context>
 </TS>