Merge branch 'master' of ssh://drop.maemo.org/git/mdictionary
authorPiotrek <ppilar11@gmail.com>
Wed, 1 Sep 2010 13:04:28 +0000 (15:04 +0200)
committerPiotrek <ppilar11@gmail.com>
Wed, 1 Sep 2010 13:04:28 +0000 (15:04 +0200)
Conflicts:
data/icons/gui.qrc
trunk/src/base/base.pro
trunk/src/base/gui/MainWindow.cpp

19 files changed:
data/gui.qrc [new file with mode: 0644]
data/icons/gui.qrc [deleted file]
data/translations/dict_en.qm [new file with mode: 0644]
data/translations/dict_pl.qm [new file with mode: 0644]
mdictionary.pro
trunk/src/base/base.pro
trunk/src/base/gui/AboutWidget.cpp
trunk/src/base/gui/DictManagerWidget.cpp
trunk/src/base/gui/MainWindow.cpp
trunk/src/base/gui/SettingsWidget.cpp
trunk/src/base/gui/main.cpp
trunk/src/plugins/google/src/GoogleDictDialog.h
trunk/src/plugins/google/src/GooglePlugin.h
trunk/src/plugins/google/src/GoogleSettingsDialog.cpp
trunk/src/plugins/google/src/GoogleSettingsDialog.h
trunk/src/plugins/google/src/TranslationGoogle.h
trunk/src/plugins/xdxf/src/XdxfCachingDialog.cpp
trunk/src/plugins/xdxf/src/XdxfSettingsDialog.cpp
trunk/src/plugins/xdxf/src/xdxfplugin.cpp

diff --git a/data/gui.qrc b/data/gui.qrc
new file mode 100644 (file)
index 0000000..9f227c5
--- /dev/null
@@ -0,0 +1,13 @@
+<RCC>
+    <qresource prefix="/">
+        <file>icons/logo/mdictionary.png</file>
+        <file>icons/96x96/staron.png</file>
+        <file>icons/96x96/staroff.png</file>
+        <file>icons/64x64/mdictionary.png</file>
+        <file>icons/48x48/edit-select-all.png</file>
+        <file>icons/16x16/staron.png</file>
+        <file>icons/16x16/staroff.png</file>
+        <file>translations/dict_pl.qm</file>
+        <file>translations/dict_en.qm</file>
+    </qresource>
+</RCC>
diff --git a/data/icons/gui.qrc b/data/icons/gui.qrc
deleted file mode 100644 (file)
index 6fe251e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<RCC>
-    <qresource prefix="/icons">
-        <file>48x48/edit-select-all.png</file>
-        <file>logo/mdictionary.png</file>
-        <file>96x96/staroff.png</file>
-        <file>96x96/staron.png</file>
-        <file>16x16/staroff.png</file>
-        <file>16x16/staron.png</file>
-        <file>64x64/mdictionary.png</file>
-    </qresource>
-</RCC>
diff --git a/data/translations/dict_en.qm b/data/translations/dict_en.qm
new file mode 100644 (file)
index 0000000..900f716
Binary files /dev/null and b/data/translations/dict_en.qm differ
diff --git a/data/translations/dict_pl.qm b/data/translations/dict_pl.qm
new file mode 100644 (file)
index 0000000..fb43470
Binary files /dev/null and b/data/translations/dict_pl.qm differ
index 912067e..0b91f14 100644 (file)
@@ -7,6 +7,7 @@ error("Use the qmake include with Qt4.4 or greater, on Debian that is qmake-qt4"
 QT += sql
 TEMPLATE = subdirs
 SUBDIRS  = trunk
+TRANSLATIONS += dict_pl.ts dict_en.ts
 
 BINDIR = $$PREFIX/bin
 LIBDIR = $$PREFIX/lib/$${MDICT_APPNAME}
index d923732..79f0288 100644 (file)
@@ -62,10 +62,12 @@ HEADERS += gui/MainWindow.h \
     ../includes/Notify.h \
     gui/TranslationTextEdit.h \
     ../includes/AccentsNormalizer.h \
+    ../includes/DictDialog.h
     ../includes/DictDialog.h \
     gui/DBusAdapter.h \
     gui/NotifyManager.h
-RESOURCES += ../../../data/icons/gui.qrc
+
+RESOURCES += ../../../data/gui.qrc
 unix { 
     # VARIABLES
     isEmpty(PREFIX):PREFIX = /usr
index 1e3be9d..7eea400 100644 (file)
@@ -31,7 +31,7 @@ AboutWidget::AboutWidget(GUIInterface *parent): QDialog(parent)
 {
     QString infoNote, licenseNote, comarchNote;
     infoNote = "<center><h2><u>mDictionary</u></h2></center>";
-    comarchNote = "<center>Meamo/Meego Mulitlingual Dictionary</center>";
+    comarchNote = "<center>Meamo/Meego Multilingual Dictionary</center>";
     comarchNote += "<center>Copyright 2006-2010, Comarch S.A. <br>";
     comarchNote += "<a href=\"http://mdictionary.garage.maemo.org\">http://mdictionary.garage.maemo.org</a></center>";
     licenseNote = QString("<br><p><font size=\"small\">This program is free software: you can redistribute it and/or modify\n")+
index c718908..76cd907 100644 (file)
@@ -139,7 +139,7 @@ void DictManagerWidget::saveChanges() {
     if(_save) {
     #else
     if(_changed &&
-            QMessageBox::question(this, "Save", "Do you want to save changes?",
+            QMessageBox::question(this, tr("Save"), tr("Do you want to save changes?"),
             QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
     #endif
         QList<CommonDictInterface*> checkedDicts;
@@ -184,8 +184,8 @@ void DictManagerWidget::itemSelected(QListWidgetItem *) {
 }
 
 void DictManagerWidget::removeButtonClicked() {
-    if(QMessageBox::question(this, "Remove dictionary",
-            "Do you want to remove selected dictionary?",
+    if(QMessageBox::question(this, tr("Remove dictionary"),
+            tr("Do you want to remove selected dictionary?"),
             QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) {
         QList<QListWidgetItem*> selected = dictListWidget->selectedItems();
         if(selected.count() > 0) {
index d34d81a..b706572 100644 (file)
@@ -561,8 +561,8 @@ void MainWindow::removeBookmarks() {
     #else
         par = this;
     #endif
-    if(QMessageBox::question(par, "Delete all bookmarks",
-             "Do you want to delete all bookmarks? (This action cannot be revoked)",
+    if(QMessageBox::question(par, tr("Delete all bookmarks"),
+             tr("Do you want to delete all bookmarks? (This action cannot be revoked)"),
              QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) {
         backbone->removeAllBookmarks();
         if(searchString.size())
index 15e3e40..ce21f4f 100644 (file)
@@ -126,7 +126,7 @@ void SettingsWidget::hideEvent(QHideEvent *e) {
     if(settings && _save) {
     #else
     if(settings && _changed &&
-            QMessageBox::question(this, "Save", "Do you want to save changes?",
+            QMessageBox::question(this, tr("Save"), tr("Do you want to save changes?"),
              QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
 
     #endif
index 8d154c2..71cd63a 100644 (file)
@@ -59,13 +59,27 @@ int main(int argc, char *argv[]) {
     QApplication::setOrganizationDomain("comarch.com");
     QApplication::setApplicationName("mDictionary");
 
-
     QStringList search = parseParameters(argc, argv);
 
     qRegisterMetaType<Translation*>("Translation*");
     qRegisterMetaType<QList<Translation*> >("QList<Translation*>");
     qRegisterMetaType<Notify>("Notify");
     qRegisterMetaType<Notify::NotifyType>("Notify::NotifyType");
+
+    QString locale = QLocale::system().name();
+
+    QTranslator qtTranslator;
+    qtTranslator.load("qt_" + QLocale::system().name(),
+    QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+    a.installTranslator(&qtTranslator);
+
+    QTranslator myTranslator;
+    if(locale == "pl_PL")
+        myTranslator.load(":/translations/dict_pl");
+    else
+        myTranslator.load(":/translations/dict_en");
+    a.installTranslator(&myTranslator);
+
     Backbone backbone;
     MainWindow w(&backbone);
 
index d62e1f1..38964cd 100644 (file)
@@ -48,7 +48,7 @@ public:
 
     /*!
       Shows settings dialog and save new settings in plugin
-      \param parent parent widget on which will be displayed dialog
+      \param parent parent widget on which dialog will be displayed
       */
     void changeSettings(QWidget *parent);
 
index 280ad57..c9b103c 100644 (file)
@@ -56,7 +56,7 @@ public:
     //! returns destination language code iso 639-2
     QString langTo() const;
 
-    //! returns dictionary name (like "old english" or so)
+    //! returns dictionary name (like "old English" or so)
     QString name() const;
 
     //! returns dictionary type (xdxf, google translate, etc)
@@ -70,7 +70,7 @@ public:
     void setLangFrom(QString langFrom);
 
     /*! returns DictDialog object that creates dialogs
-        for adding new dictionary and change plugin tings
+        for adding new dictionaries and changing plugin things
       */
     DictDialog* dictDialog();
 
@@ -90,7 +90,7 @@ public:
     //! returns a unique hash for a dictionary
     uint hash() const;
 
-    //! set unique value (unique for every dictionary not plugin)
+    //! sets unique value (unique for every dictionary not plugin)
     void setHash(uint);
 
     //! returns current plugin settings
index 041f4a0..cdadfe2 100644 (file)
@@ -58,8 +58,8 @@ GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent,
 
     langFromLabel = new QLabel(tr("From:"));
     langToLabel = new QLabel(tr(" To: "));
-    connectInfoLabel = new QLabel(tr("Google plugin make use of internet "
-                                     "conection, so it may cost You."));
+    connectInfoLabel = new QLabel(tr("Google plugin makes use of Internet "
+                                     "connection, so it may cost You."));
 
     connectInfoLabel->setWordWrap(true);
     setWindowTitle(tr("Google Settings"));
@@ -73,7 +73,7 @@ GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent,
     setLayout(verticalLayout);
 
     infoLabel = new QLabel;
-    infoLabel->setText(tr("Plugin:GoogleTranslator \n")+
+    infoLabel->setText(tr("Plugin: GoogleTranslator \n")+
                    tr("From: ") + _langFrom + "\n" +
                    tr("To: ") + _langTo);
     verticalLayout->addWidget(infoLabel);
index 4c90131..aa2cea7 100644 (file)
@@ -20,7 +20,7 @@
 *******************************************************************************/
 
 /*! \file GoogleSettingsDialog.h
-    \brief Class create dialog to get or change settings for Google Plagin
+    \brief Class creates dialog to get or change settings for Google Plugin
     \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
 
@@ -43,18 +43,18 @@ public:
                                   QString acceptButtonLabel = tr("Add"));
 
     /*!
-        \param parent parent widget on which will be displayed dialog
-        \param langTo language witch is display in the comboBox as a startup item
-        \param langFrom language witch is display in the comboBox as a startup item
+        \param parent parent widget on which dialog will be displayed
+        \param langTo language which is displayed in the comboBox as a startup item
+        \param langFrom language which is displayed in the comboBox as a startup item
         \returns function return settings to GooglePlugin
     */
     static Settings* getSettings(QWidget *parent,
                                  Settings *pluginSettings=0,
                                  QString acceptButtonLabel = tr("Add"));
     /*!
-        function set a new settings in plugin;
+        function sets a new settings in plugin;
         \param plugin plugin whose settings you will change
-        \param parent parent widget on which will be displayed dialog
+        \param parent parent widget on which dialog will be displayed
     */
     static void changeSettings(GooglePlugin* plugin, QWidget *parent);
 
index 08b5530..ad42ee0 100644 (file)
@@ -55,7 +55,7 @@ public:
     //! sets information about dictionary
     void setDictionaryInfo(QString);
 
-    //! \retrun whether given translation is taken from bookmarks
+    //! \return whether given translation is taken from bookmarks
     bool isBookmark() const {
         return _bookmark;
    }
index f06f69c..3cf5bf3 100644 (file)
@@ -68,7 +68,7 @@ void XdxfCachingDialog::updateCachingProgress(int progress, int time) {
     int seconds = float((100 - progress)*time) / (5*1000);
 
     cachingLabel->setText(tr("Estimated time left: ") +
-                      QString::number(seconds) + tr(" seconds"));
+                     /*QString::number(seconds)*/  tr("%n second(s)", "", seconds));
     if(progress >= 100)
         this->hide();
         
index c45f180..40104a1 100644 (file)
@@ -38,7 +38,7 @@ XdxfSettingsDialog::XdxfSettingsDialog(XdxfPlugin *plugin, QWidget *parent) :
 
     infoLabel = new QLabel(this);
 
-    infoLabel->setText(tr("Plugin type: ") + plugin->type() +"\n" +
+    infoLabel->setText(tr("Plugin: ") + plugin->type().toUpper() +"\n" +
                    tr("From: ") + plugin->langFrom() + "\n" +
                    tr("To: ") + plugin->langTo() + "\n" +
                    tr("Description: ") + plugin->name());
index 5573a56..f9a758d 100644 (file)
@@ -94,7 +94,7 @@ QList<Translation*> XdxfPlugin::searchWordListCache(QString word, int limit) {
     if(!db.open()) {
         qDebug() << "Database error" << db.lastError().text() << endl;
         Q_EMIT notify(Notify::Warning, QString(tr("Cache database cannot be "
-                "opened for %1 dictionary. Searching in xdxf file. "
+                "opened for %1 dictionary. Searching in XDXF file. "
                 "You may want to recache.").arg(name())));
         return searchWordListFile(word, limit);
     }
@@ -149,7 +149,7 @@ QList<Translation*> XdxfPlugin::searchWordListFile(QString word, int limit) {
     if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
         qDebug()<<"Error: could not open file";
         Q_EMIT notify(Notify::Warning,
-                QString(tr("Xdxf file cannot be read for %1").arg(name())));
+                QString(tr("XDXF file cannot be read for %1").arg(name())));
         return translations.toList();
     }
 
@@ -204,7 +204,7 @@ QString XdxfPlugin::searchCache(QString key) {
     if(!db.open()) {
         qDebug() << "Database error" << db.lastError().text() << endl;
         Q_EMIT notify(Notify::Warning, QString(tr("Cache database cannot be "
-                "opened for %1 dictionary. Searching in xdxf file. "
+                "opened for %1 dictionary. Searching in XDXF file. "
                 "You may want to recache.").arg(name())));
         return searchFile(key);
     }
@@ -229,7 +229,7 @@ QString XdxfPlugin::searchFile(QString key) {
     QString resultString("");
     if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
         Q_EMIT notify(Notify::Warning,
-                QString(tr("Xdxf file cannot be read for %1").arg(name())));
+                QString(tr("XDXF file cannot be read for %1").arg(name())));
         qDebug()<<"Error: could not open file";
         return "";
     }
@@ -384,7 +384,7 @@ void XdxfPlugin::getDictionaryInfo() {
     QFile dictionaryFile(path);
     if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
        Q_EMIT notify(Notify::Warning,
-               QString(tr("Xdxf file cannot be read dictionary")));
+               QString(tr("XDXF dictionary cannot be read from file")));
         qDebug()<<"Error: could not open file";
         return;
     }
@@ -424,7 +424,7 @@ int XdxfPlugin::countWords() {
     QFile dictionaryFile(path);
     if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
         Q_EMIT notify(Notify::Warning,
-                QString(tr("Xdxf file cannot be read for %1 dictionary")
+                QString(tr("XDXF file cannot be read for %1 dictionary")
                 .arg(name())));
         qDebug()<<"Error: could not open file";
         return -1;
@@ -460,7 +460,7 @@ bool XdxfPlugin::makeCache(QString) {
     if (!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
         Q_EMIT updateCachingProgress(100, 0);
         Q_EMIT notify(Notify::Warning,
-                QString(tr("Xdxf file cannot be read for %1 dictionary")
+                QString(tr("XDXF file cannot be read for %1 dictionary")
                 .arg(name())));
         return 0;
     }
@@ -472,7 +472,7 @@ bool XdxfPlugin::makeCache(QString) {
         qDebug() << "Database error" << db.lastError().text() << endl;
         Q_EMIT updateCachingProgress(100, 0);
         Q_EMIT notify(Notify::Warning, QString(tr("Cache database cannot be "
-                "opened for %1 dictionary. Searching in xdxf file. "
+                "opened for %1 dictionary. Searching in XDXF file. "
                 "You may want to recache.").arg(name())));
         return false;
     }