Fixed scroling on desktop in translation widget
authorMateusz Półrola <mateusz.polrola@comarch.pl>
Thu, 9 Sep 2010 09:50:35 +0000 (11:50 +0200)
committerMateusz Półrola <mateusz.polrola@comarch.pl>
Thu, 9 Sep 2010 09:50:35 +0000 (11:50 +0200)
data/gui.qrc
data/xsl/mask.png [new file with mode: 0644]
data/xsl/style.css
data/xsl/xsl.xsl
debian/mdictionary.install
src/mdictionary/backbone/ConfigGenerator.cpp
src/mdictionary/gui/TranslationTextEdit.cpp
src/mdictionary/gui/TranslationWidget.cpp
src/mdictionary/mdictionary.pro

index 03cab88..18cf9df 100644 (file)
@@ -12,5 +12,6 @@
         <file>xsl/xsl.xsl</file>
         <file>translations/en_US.qm</file>
         <file>translations/pl_PL.qm</file>
+        <file>xsl/mask.png</file>
     </qresource>
 </RCC>
diff --git a/data/xsl/mask.png b/data/xsl/mask.png
new file mode 100644 (file)
index 0000000..f3f986a
Binary files /dev/null and b/data/xsl/mask.png differ
index 74f0061..e4289dd 100644 (file)
@@ -1,60 +1,82 @@
 body {
-       background-color: #000000
+background-color: #000000 
+    
+ } 
+
+div.tab {
+       -webkit-box-shadow: rgba(0, 0, 0, 0.7) 0px 3px 10px;
+        background-color: #D6E4FF;
+       border-bottom-left-radius: 8px 8px;
+       border-bottom-right-radius: 8px 8px;
+       border-top-left-radius: 8px 8px;
+       border-top-right-radius: 8px 8px;
+       color: black;
+       font-family: 'Lucida Sans MS', 'Lucida Grande', Helvetica, sans-serif;
+       font-size: 10pt;
+       padding: 10px 10px;
+       padding-left: 5px;
+       padding-right: 5px;
+       -webkit-box-reflect:below 5px -webkit-gradient(linear, 0% 0%, 0% 190%, from(transparent), color-stop(0.3, transparent), to(white));
+}
+
+div.dict {
+       -webkit-box-shadow: rgba(0, 0, 0, 0.7) 0px 3px 10px;
+       background: -webkit-gradient(linear, 50% 0%, 50% 100%, from(#FFFFFA), color-stop(0.3, #FED), color-stop(0.8, #FED), to(#FFFFFA));
+       border-bottom-left-radius: 8px 8px;
+       border-bottom-right-radius: 8px 8px;
+       border-top-left-radius: 8px 8px;
+       border-top-right-radius: 8px 8px;
+       color: black;
+       font-family: 'Lucida Sans MS', 'Lucida Grande', Helvetica, sans-serif;
+       font-size: 10pt;
+       margin-bottom: 10px;
+       padding: 10px 18px;
+       padding-left: 5px;
+       padding-right: 5px;
 }
-div.tab { 
-    border-style            : solid;
-    border-width            : 1px;
-    -webkit-box-reflect:below 5px -webkit-gradient(linear, 0% 0%, 0% 180%, from(transparent), color-stop(0.3, transparent), to(white));
-} 
+
 
 div.info {
         font-weight            : bold;
         text-align             : center;
     
-background: -webkit-gradient(
+       background: -webkit-gradient(
     linear,
     left top,
     left bottom,
-    color-stop(0.05, rgb(88,190,245)),
-    color-stop(0.85, rgb(0,49,61))
-);
-       /*background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f7ffff), to(#dfffff));*/
-       
+    color-stop(0.05, rgb(255,190,245)),
+    color-stop(0.85, rgb(255,49,61)));
        
-       padding-bottom: 8px;
-       padding-left: 10px;
-       padding-right: 10px;
-       padding-top: 8px;
+       padding-bottom: 5px;
+       padding-left: 5px;
+       padding-right: 5px;
+       padding-top: 5px;
+       -webkit-mask-box-image: url(mask.png) 0 100 0 100 stretch stretch;
 }
 
 div.key {
        font-weight             : bold;
        text-align              : center;
-       padding-bottom: 8px;
-       padding-left: 10px;
-       padding-right: 10px;
-       padding-top: 8px;
-
        background: -webkit-gradient(
     linear,
-    left bottom,
     left top,
-    color-stop(0.03, rgb(175,247,237)),
-    color-stop(0.44, rgb(28,176,230)),
-    color-stop(1, rgb(0,48,61)));
-       
+    left bottom,
+    color-stop(0.01, rgb(88,190,245)),
+    color-stop(0.95, rgb(0,49,61)));
+       padding-bottom: 5px;
+       padding-left: 5px;
+       padding-right: 5px;
+       padding-top: 5px;
+       -webkit-mask-box-image: url(mask.png) 0 100 0 100 stretch stretch;
 }
 
 div.cell {
-
-       background: -webkit-gradient(
-    linear,
-    left top,
-    left bottom,
-    color-stop(0.03, rgb(175,247,237)),
-    color-stop(0.52, rgb(242,255,229)));
+       background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fffcca), to(#FFFFFA));
+       padding-top: 5px;
+       padding-left: 25px;
+       padding-right: 25px;
+       -webkit-mask-box-image: url(mask.png) 0 100 0 100 stretch stretch;
 }
-
 span.i {
         font-style             : italic;
 }
@@ -64,7 +86,7 @@ span.b {
 }
 
 span.u {
-       text-decoration    : underline;
+            text-decoration    : underline;
 }
 
 
index 01a19c4..ab99f61 100644 (file)
@@ -3,24 +3,33 @@
 
 <xsl:template match="/">
        <div class="tab">
-               <xsl:for-each select="ar/dict"> 
+               <xsl:for-each select="ar"> 
                        <xsl:apply-templates/>
                </xsl:for-each>
        </div>
 </xsl:template> 
 
+<xsl:template match="dict">
+       <div class="dict"><xsl:apply-templates/></div>
+</xsl:template>
+
+
 <xsl:template match="info">
-       <div class="info">              
+       <div class="info">
+               <xsl:variable name="path" select="@path"/>
+       
                <xsl:if test="@bookmark = 'true'">
                        <img src="$STAR$" width="16" height="16"/>   
                </xsl:if>
                <xsl:value-of select="."/> 
+               <br/>
+               <img src="{$path}" height="16"/>        
        </div>
 </xsl:template>
 
 <xsl:template match="key">
        <div class="key"><xsl:value-of select="."/></div>                       
-</xsl:template> 
+</xsl:template>
 
 <xsl:template match="t">
        <div class="cell"><xsl:apply-templates/></div>
index 9f01a7a..d211746 100644 (file)
@@ -1,6 +1,7 @@
 usr/share/dbus-1/
 usr/share/icons/
 usr/share/mdictionary/staron.png
+usr/share/mdictionary/mask.png
 usr/bin/mdictionary
 usr/lib/mdictionary/plugins/libxdxf.so
 usr/lib/mdictionary/plugins/eng-us.xdxf
index 4a5f611..704a6ba 100644 (file)
@@ -29,7 +29,7 @@
 #include <QDebug>
 
 bool ConfigGenerator::generateCss(QString file) {
-    return generateFile(":/xsl/style.css", file);
+    generateFile(":/xsl/style.css", file);
 }
 
 
index e7884d6..ed8c01a 100644 (file)
@@ -55,6 +55,10 @@ void TranslationTextEdit::wheelEvent(QWheelEvent *e) {
         else {
             zoomOut();
         }
+        e->ignore();
+    }
+    else {
+        QWebView::wheelEvent(e);
     }
 }
 
index 935323e..10358ee 100644 (file)
@@ -29,6 +29,7 @@
     #include <X11/Xlib.h>
     #include <X11/Xatom.h>
 #endif
+#include <QWebFrame>
 
 TranslationWidget::TranslationWidget(QWidget *parent):
         QScrollArea(parent){
@@ -81,6 +82,10 @@ void TranslationWidget::show(QStringList translations) {
 
     trans=tr("<?xml version=\"1.0\" encoding=\"UTF-8\"?>") + tr("\n <ar>")
             + trans + tr("\n </ar>");
+
+
+    qDebug()<<trans<<endl;
+
     trans=XslConversion(trans);
 
     QString head = "<html><head>";
@@ -95,6 +100,9 @@ void TranslationWidget::show(QStringList translations) {
     webkit->setHtml(trans, QUrl().fromLocalFile("/"));
 
 
+    qDebug()<<webkit->page()->currentFrame()->toHtml();
+
+
     //webkit->repaint(this->rect());
     //update(this->rect());
 
index 9dd0c8e..91bb85b 100644 (file)
@@ -89,13 +89,14 @@ unix {
        desktop.files += ../../data/other/$${TARGET}.desktop
        icon64.files += ../../data/icons/64x64/$${TARGET}.png
 
-       bookmarks.path = $$DATA_DIR
-       bookmarks.files += ../../data/icons/16x16/staron.png
+    shared.path = $$DATA_DIR
+    shared.files += ../../data/icons/16x16/staron.png
+    shared.files += ../../data/xsl/mask.png
 
        service.path = $$SHARE_DIR/dbus-1/services
        service.files += ../../data/other/com.comarch.mdictionary.service
        
-       INSTALLS += desktop icon64 bookmarks service
+    INSTALLS += desktop icon64 shared service
 }