Some changes in xdxf dialogs
authorMateusz Półrola <mateusz.polrola@comarch.pl>
Mon, 6 Sep 2010 09:33:19 +0000 (11:33 +0200)
committerMateusz Półrola <mateusz.polrola@comarch.pl>
Mon, 6 Sep 2010 09:33:19 +0000 (11:33 +0200)
20 files changed:
data/xsl/xsl.xsl
debian/mdictionary-google-plugin.install
doc/doc.pri
src/mdictionary/gui/TranslationTextEdit.cpp
src/mdictionary/gui/TranslationTextEdit.h
src/plugins/google/GooglePlugin.cpp
src/plugins/google/GoogleSettingsDialog.cpp
src/plugins/google/TranslationGoogle.cpp
src/plugins/google/drawing.png [deleted file]
src/plugins/google/google.png [new file with mode: 0644]
src/plugins/google/google.pro
src/plugins/google/google.qrc [new file with mode: 0644]
src/plugins/google/icons.qrc [deleted file]
src/plugins/xdxf/XdxfLoadDialog.cpp
src/plugins/xdxf/XdxfLoadDialog.h
src/plugins/xdxf/XdxfSettingsDialog.cpp
src/plugins/xdxf/XdxfSettingsDialog.h
src/plugins/xdxf/xdxf.png
src/plugins/xdxf/xdxf.qrc
src/plugins/xdxf/xdxfplugin.cpp

index bdd79ce..7c2b850 100644 (file)
@@ -16,7 +16,7 @@
                <xsl:if test="@bookmark = 'true'">
                        <img src="$STAR$" width="16" height="16"/>   
                </xsl:if>
-               <xsl:value-of select="."/>  <img src="{$path}" height="16"/>
+               <xsl:value-of select="."/> <br/>  <img src="{$path}" height="16"/>
                </th>
        </tr>
 </xsl:template>
index 64a26a7..e654516 100644 (file)
@@ -1,2 +1,2 @@
 usr/lib/mdictionary/plugins/libgoogle.so
-usr/share/mdictionary/drawing.png
+usr/share/mdictionary/google.png
index 926d1e0..5d26af4 100644 (file)
@@ -12,7 +12,7 @@ htmldocs_install.path = $$INSTALL_PREFIX/share/doc/$${PROJECTNAME}/doc
        
        
 doc.depends = doxygen_doc
-       
+htmldocs_install.depends = doc
        
 QMAKE_EXTRA_TARGETS += doxygen_doc
 
index 2f8fbc1..e7884d6 100644 (file)
@@ -47,9 +47,18 @@ TranslationTextEdit::TranslationTextEdit(QWidget *parent) :
     connect(page(), SIGNAL(selectionChanged()), this, SLOT(selection()));
 }
 
+void TranslationTextEdit::wheelEvent(QWheelEvent *e) {
+    if(e->modifiers() & Qt::ControlModifier) {
+        if(e->delta()>0) {
+            zoomIn();
+        }
+        else {
+            zoomOut();
+        }
+    }
+}
 
-bool TranslationTextEdit::eventFilter(QObject *, QEvent *e)
-{
+bool TranslationTextEdit::eventFilter(QObject *, QEvent *e) {
     switch (e->type()) {
     case QEvent::MouseButtonPress:
         if (static_cast<QMouseEvent *>(e)->button() == Qt::LeftButton)
@@ -62,7 +71,6 @@ bool TranslationTextEdit::eventFilter(QObject *, QEvent *e)
     case QEvent::MouseMove:
         if (mousePressed)
             return true;
-        break;
     default:
         break;
     }
index 0150a81..917105a 100644 (file)
@@ -51,6 +51,7 @@ Q_SIGNALS:
 
 protected:
     void contextMenuEvent(QContextMenuEvent *);
+    void wheelEvent(QWheelEvent *);
 
 private:
     QAction* searchSelectedAction;
index 5a9c13f..29ca10f 100644 (file)
@@ -35,7 +35,7 @@ GooglePlugin::GooglePlugin(QObject *parent): CommonDictInterface(parent),
     _settings->setValue("type","google");
     _settings->setValue("connection_accepted","true");
     _dictDialog = new GoogleDictDialog(this,this);
-    _icon = QIcon(":/icons/drawing.png");
+    _icon = QIcon("/usr/share/mdictionary/google.png");
 
     stopped = false;
     languages=initLanguages();
index 91782ba..0aaa9ad 100644 (file)
@@ -46,9 +46,9 @@ GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent,
         _langFrom=languages.key(pluginSettings->value("lang_from"));
     }
 
-    setMinimumHeight(370);
-    #ifdef Q_WS_MAEMO_5
 
+    #ifdef Q_WS_MAEMO_5
+        setMinimumHeight(370);
         changeLangButton=new QPushButton(
                                  QIcon::fromTheme("general_refresh"), "");
     #else
@@ -58,10 +58,7 @@ GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent,
 
     langFromLabel = new QLabel(tr("From:"));
     langToLabel = new QLabel(tr(" To: "));
-    connectInfoLabel = new QLabel(tr("Google plugin makes use of Internet "
-                                     "connection, so it may cost You."));
 
-    connectInfoLabel->setWordWrap(true);
     setWindowTitle(tr("Google Settings"));
 
     verticalLayout = new QVBoxLayout;
@@ -79,6 +76,14 @@ GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent,
     verticalLayout->addWidget(infoLabel);
 
 
+    #ifdef Q_WS_MAEMO_5
+        connectInfoLabel = new QLabel(tr("Google plugin makes use of Internet "
+                                         "connection, so it may cost You."));
+        connectInfoLabel->setWordWrap(true);
+
+        verticalLayout->addWidget(connectInfoLabel);
+    #endif
+
     langFromComboBox = new QComboBox;
     langToComboBox = new QComboBox;
 
@@ -96,10 +101,6 @@ GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent,
     langFromComboBox->setCurrentIndex(actualLangFrom);
 
 
-
-    setWindowTitle(tr("Google Settings"));
-    verticalLayout->addWidget(connectInfoLabel);
-
     langFromLayout->addWidget(langFromLabel);
     langFromLayout->addWidget(langFromComboBox);
     langToLayout->addWidget(langToLabel);
index 5d1d5c8..f6819c2 100644 (file)
@@ -56,7 +56,7 @@ QString TranslationGoogle::toHtml() const {
     QString result("");
     if(!googlePlugin)
         return result;   
-    result="<dict> <info path=\"/usr/share/mdictionary/drawing.png\" ";
+    result="<dict> <info path=\"/usr/share/mdictionary/google.png\" ";
     if(isBookmark())
         result+="bookmark=\"true\" >";
     else
diff --git a/src/plugins/google/drawing.png b/src/plugins/google/drawing.png
deleted file mode 100644 (file)
index 3eef78f..0000000
Binary files a/src/plugins/google/drawing.png and /dev/null differ
diff --git a/src/plugins/google/google.png b/src/plugins/google/google.png
new file mode 100644 (file)
index 0000000..b6167c3
Binary files /dev/null and b/src/plugins/google/google.png differ
index f867bc1..08d7460 100644 (file)
@@ -22,14 +22,14 @@ TRANSLATIONS += dict_google_pl.ts \
                 dict_google_en.ts
 
 RESOURCES += \
-    icons.qrc
+    google.qrc
 
 
 unix {
   INSTALLS += plugin-icon
 
   plugin-icon.path = $$DATA_DIR
-  plugin-icon.files += drawing.png
+  plugin-icon.files += google.png
 }
 check.commands = echo 'No check here'
 QMAKE_EXTRA_TARGETS += check
diff --git a/src/plugins/google/google.qrc b/src/plugins/google/google.qrc
new file mode 100644 (file)
index 0000000..cc5794c
--- /dev/null
@@ -0,0 +1,6 @@
+<RCC>
+    <qresource prefix="/">
+        <file>translations/dict_google_en.qm</file>
+        <file>translations/dict_google_pl.qm</file>
+    </qresource>
+</RCC>
diff --git a/src/plugins/google/icons.qrc b/src/plugins/google/icons.qrc
deleted file mode 100644 (file)
index dbab6e4..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<RCC>
-    <qresource prefix="/icons">
-        <file>drawing.png</file>
-    </qresource>
-    <qresource prefix="/">
-        <file>translations/dict_google_en.qm</file>
-        <file>translations/dict_google_pl.qm</file>
-    </qresource>
-</RCC>
index 269bb87..3adaf1e 100644 (file)
@@ -32,21 +32,22 @@ XdxfLoadDialog::XdxfLoadDialog(QWidget *parent) :
 
     setWindowTitle(tr("Add new XDXF dictionary"));
 
-    browseLayout = new QVBoxLayout;
+
+
+    browseLayout = new QHBoxLayout;
 
     browseButton =  new QPushButton(tr("Browse"));
     browseLabel = new QLabel(tr("Dictionary file: not selected"));
-    //browseLabel->setWordWrap(true);
-    browseLabel->setMargin(5);
+    //browseLabel->setMargin(5);
 
     browseLayout->addWidget(browseLabel, 0, Qt::AlignLeft);
-    browseLayout->addWidget(browseButton);
+    browseLayout->addWidget(browseButton, 0, Qt::AlignRight);
 
     verticalLayout->addLayout(browseLayout);
 
     cacheLayout = new QHBoxLayout;
     verticalLayout->addLayout(cacheLayout);
-    accentsCheckBox = new QCheckBox(tr("Strip accents \n(searching takes more "
+    accentsCheckBox = new QCheckBox(tr("Strip accents (searching takes more "
                  "time, but spelling don't have to be exact)"));
     verticalLayout->addWidget(accentsCheckBox);
 
@@ -85,7 +86,7 @@ void XdxfLoadDialog::setAccents(bool state) {
 void XdxfLoadDialog::selectFile() {
     QString fileName = QFileDialog::getOpenFileName(this,
                                      tr("Select dictionary file"),
-                                     "",
+                                     _dicitonaryFilePath,
                                      tr("XDXF Files (*.xdxf)"),
                                      NULL,
                                      NULL);
index 97e79e5..655e051 100644 (file)
@@ -64,7 +64,7 @@ private:
     QCheckBox* cacheCheckBox;
     QCheckBox* accentsCheckBox;
     QVBoxLayout* verticalLayout;
-    QVBoxLayout* browseLayout;
+    QHBoxLayout* browseLayout;
     QHBoxLayout* cacheLayout;
     QString _dicitonaryFilePath;
     bool _generateCache;
index 7143737..fa262a8 100644 (file)
@@ -21,7 +21,7 @@
 
 /*! \file XdxfSettingsDialog.cpp
 */
-//Created by Mateusz Półrola
+
 
 #include "XdxfSettingsDialog.h"
 #include <QDebug>
@@ -30,8 +30,11 @@ XdxfSettingsDialog::XdxfSettingsDialog(XdxfPlugin *plugin, QWidget *parent) :
     QDialog(parent)
 {
     this->plugin = plugin;
-    verticalLayout = new QVBoxLayout();
-       setLayout(verticalLayout);
+
+    verticalLayout = new QVBoxLayout;
+
+    QWidget* w = new QWidget;
+    w->setLayout(verticalLayout);
 
     setWindowTitle(tr("XDXF Settings"));
 
@@ -41,33 +44,24 @@ XdxfSettingsDialog::XdxfSettingsDialog(XdxfPlugin *plugin, QWidget *parent) :
     infoLabel->setText(tr("Plugin: ") + plugin->type().toUpper() +"\n" +
                    tr("From: ") + plugin->langFrom() + "\n" +
                    tr("To: ") + plugin->langTo() + "\n" +
-                   tr("Description: ") + plugin->name());
-
-    verticalLayout->addWidget(infoLabel);
-
-    browseLayout = new QHBoxLayout();
-    verticalLayout->addLayout(browseLayout);
-
-    browseButton =  new QPushButton(tr("Browse"));
-    browseLabel = new QLabel(tr("Dictionary file: ") +
-                             plugin->settings()->value("path"));
+                   tr("Description: ") + plugin->name() + "\n" +
+                   tr("License: ") + plugin->infoNote());
+    infoLabel->setWordWrap(true);
 
-    browseLayout->addWidget(browseLabel);
-    browseLayout->addWidget(browseButton,0, Qt::AlignRight);
 
+    verticalLayout->addWidget(infoLabel);
 
-    cacheLayout = new QHBoxLayout();
-    verticalLayout->insertLayout(-1,cacheLayout,0);
-    accentsCheckBox = new QCheckBox(tr("Strip accents \n(searching takes more time, "
-                 "but spelling don't have to be exact)"));
-    verticalLayout->addWidget(accentsCheckBox);
 
+    accentsCheckBox = new QCheckBox(tr("Strip accents"));
+    /*(searching takes more time, "
+                     "but spelling don't have to be exact)*/
     if(plugin->settings()->value("strip_accents") == "true")
         accentsCheckBox->setChecked(true);
     else
         accentsCheckBox->setChecked(false);
 
-    cacheCheckBox = new QCheckBox(tr("Optimize for quicker searches (may take some time)"),this);
+    cacheCheckBox = new QCheckBox(tr("Optimize for quicker searches"));
+/*(may take some time)*/
     if(plugin->settings()->value("cached") == "true") {
         cacheCheckBox->setChecked(true);
         accentsCheckBox->setChecked(true);
@@ -79,16 +73,44 @@ XdxfSettingsDialog::XdxfSettingsDialog(XdxfPlugin *plugin, QWidget *parent) :
         _generateCache = false;
     }
 
+    accentsToolButton = new QToolButton;
+    cacheToolButton = new QToolButton;
+
+    accentsToolButton->setIcon(QIcon::fromTheme("general_information"));
+    cacheToolButton->setIcon(QIcon::fromTheme("general_information"));
+
+    cacheLayout = new QHBoxLayout;
+    accentsLayout = new QHBoxLayout;
+
+    accentsLayout->addWidget(accentsCheckBox);
+    accentsLayout->addWidget(accentsToolButton);
+
     cacheLayout->addWidget(cacheCheckBox);
+    cacheLayout->addWidget(cacheToolButton);
+
+    verticalLayout->addLayout(cacheLayout);
+    verticalLayout->addLayout(accentsLayout);
+
+
 
     saveButton = new QPushButton(tr("Save settings"));
 
     verticalLayout->addWidget(saveButton);
 
-    setModal(true);
+    scrollArea = new QScrollArea;
+    scrollArea->setWidget(w);
+
+
+    QHBoxLayout* layout = new QHBoxLayout();
+
+    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    scrollArea->setWidgetResizable(true);
+    layout->addWidget(scrollArea);
+    setLayout(layout);
 
-    connect(browseButton, SIGNAL(clicked()),
-            this, SLOT(selectFile()));
+
+
+    setModal(true);
 
     connect(saveButton, SIGNAL(clicked()),
             this, SLOT(accept()));
@@ -108,7 +130,6 @@ void XdxfSettingsDialog::setAccents(bool state) {
     lastAccents = state;
 }
 
-
 void XdxfSettingsDialog::setGenerateCache(bool generate) {
     _generateCache = generate;
 
@@ -124,19 +145,6 @@ bool XdxfSettingsDialog::generateCache() {
     return _generateCache;
 }
 
-void XdxfSettingsDialog::selectFile() {
-    QString fileName = QFileDialog::getOpenFileName(this,
-                                     tr("Select dictionary file"),
-                                     "",
-                                     tr("XDXF Files (*.xdxf)"),
-                                     NULL,
-                                     NULL);
-    if (!fileName.isEmpty()) {
-        browseLabel->setText(tr("Dictionary file: ") + fileName);
-        _dicitonaryFilePath = fileName;
-    }    
-}
-
 QString XdxfSettingsDialog::dicitonaryFilePath() {
     return _dicitonaryFilePath;
 }
index b7543f8..c11d44c 100644 (file)
@@ -45,25 +45,32 @@ public:
     bool generateCache();
 
 private Q_SLOTS:
-    void selectFile();
     void setGenerateCache(bool);
     void setAccents(bool);
 
 private:
     QLabel* infoLabel;
     QPushButton* saveButton;
-    QPushButton* browseButton;
-    QLabel* browseLabel;
+
+
     QCheckBox* cacheCheckBox;
     QCheckBox* accentsCheckBox;
-    QVBoxLayout* verticalLayout;
-    QHBoxLayout* browseLayout;
+
     QHBoxLayout* cacheLayout;
+    QHBoxLayout* accentsLayout;
+
+    QToolButton* cacheToolButton;
+    QToolButton* accentsToolButton;
+
+    QVBoxLayout* verticalLayout;
+
     QString _dicitonaryFilePath;
     bool _generateCache;
     XdxfPlugin* plugin;
     bool lastAccents;
 
+    QScrollArea* scrollArea;
+
 };
 
 #endif // XDXFSETTINGSDIALOG_H
index 66048d0..47611d6 100644 (file)
Binary files a/src/plugins/xdxf/xdxf.png and b/src/plugins/xdxf/xdxf.png differ
index 71670af..aa2fe0c 100644 (file)
@@ -1,7 +1,4 @@
 <RCC>
-    <qresource prefix="/icons">
-        <file>xdxf.png</file>
-    </qresource>
     <qresource prefix="/">
         <file>translations/dict_xdxf_en.qm</file>
         <file>translations/dict_xdxf_pl.qm</file>
index 626e300..33a15d4 100644 (file)
@@ -34,7 +34,7 @@ XdxfPlugin::XdxfPlugin(QObject *parent) : CommonDictInterface(parent),
     cachingDialog = new XdxfCachingDialog(this);
 
     _settings->setValue("type","xdxf");
-    _icon = QIcon(":/icons/xdxf.png");
+    _icon = QIcon("/usr/share/mdictionary/xdxf.png");
     _wordsCount = -1;
     stopped = false;