system(echo "ENABLED_PLUGINS = $$ENABLED_PLUGINS" >src/plugins/plugins.pri)
OTHER_FILES +=
+
+HEADERS +=
height: parent.height
anchors.left: parent.left
source: "qrc:/button/buttonLeft.png"
+ smooth: true
fillMode:Image.Stretch
}
Image {
id: image3
smooth: true
- width: parent.width - ((70*parent.height)/107) +1;
height: parent.height
- anchors.horizontalCenter: parent.horizontalCenter
+ anchors.right: image2.left
+ anchors.rightMargin: -1
+ anchors.left: image1.right
+ anchors.leftMargin: -1
source: "qrc:/button/buttonCenter.png"
fillMode:Image.Stretch
}
Image {
id: image
z:4;
+ smooth: true
anchors.centerIn: parent
width: iconWidth;
height: iconHeight;
id: image3
z: 1
smooth: true
- width: parent.width - (70*parent.height)/107 +1
height: parent.height
- anchors.horizontalCenter: parent.horizontalCenter
+ anchors.right: image2.left
+ anchors.rightMargin: -1
+ anchors.left: image1.right
+ anchors.leftMargin: -1
source: "qrc:/button/buttonCenter.png"
}
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial Usage
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
import Qt 4.7
Item {
ny = scrollArea.visibleArea.yPosition * container.height;
else
ny = scrollArea.visibleArea.xPosition * container.width;
- if (ny > 2) return ny; else return 2;
+ if (ny > 2)
+ return ny;
+ else
+ return 2;
}
function size()
else
t = Math.ceil(container.width - 3 - ny);
if (nh > t) return t; else return nh;
- } else return nh + ny;
+ } else
+ return nh + ny;
}
//Rectangle { anchors.fill: parent; color: "Black"; opacity: 0.5 }
--- /dev/null
+import Qt 4.7
+
+Item {
+ id: scrollBar
+
+ // The properties that define the scrollbar's state.
+ // position and pageSize are in the range 0.0 - 1.0. They are relative to the
+ // height of the page, i.e. a pageSize of 0.5 means that you can see 50%
+ // of the height of the view.
+ // orientation can be either Qt.Vertical or Qt.Horizontal
+ property variant orientation : Qt.Vertical
+ property int windowHeight :100
+ property alias position: slider.x
+
+ signal changeCursor
+
+ // Size the bar to the required size, depending upon the orientation.
+ Rectangle {
+ id: slider;
+ width: 1;
+ height: windowHeight;
+ radius: height/2 - 1
+ color: "black"
+ opacity: 0.7
+ }
+
+ MouseArea {
+ property variant lastPresX;
+ anchors.rightMargin: 5
+ anchors.leftMargin: 5
+ id: mouse_area1
+ anchors.fill: slider
+ onEntered: {
+
+ }
+
+ onMousePositionChanged:{
+ var num=0;
+ if(Qt.LeftButton) {
+ num= slider.x+(mouseX-lastPresX);
+
+ if(num>(scrollBar.width-slider.width))
+ slider.x=scrollBar.width-slider.width
+ else if(num<0)
+ slider.x=0;
+ else
+ slider.x=num ;
+ }
+ }
+ onPressed: lastPresX=mouseX;
+ }
+}
--- /dev/null
+import Qt 4.7
+
+Rectangle {
+ SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
+ color : myPalette.window;
+
+ id: rectangle1
+ width: 400;
+ height: 400;
+ anchors.fill: parent
+
+ signal dictLink(string link);
+
+ ScrollBar2 {
+ id: horizontalScrollBar1
+ z:2;
+ width: parent.width-12;
+ windowHeight: parent.height
+ anchors.left: parent.left
+ orientation: Qt.Horizontal
+ position: 100
+ }
+ ScrollBar2 {
+ id: horizontalScrollBar2
+ z:2;
+ width: parent.width-12;
+ windowHeight: parent.height
+ anchors.left: horizontalScrollBar1.left
+ anchors.leftMargin: horizontalScrollBar1.position
+ orientation: Qt.Horizontal
+ position: 100
+ }
+ ScrollBar2 {
+ id: horizontalScrollBar3
+ z:2;
+ width: parent.width-12;
+ windowHeight: parent.height
+ anchors.left: horizontalScrollBar2.left
+ anchors.leftMargin: horizontalScrollBar2.position
+ orientation: Qt.Horizontal
+ position: 100
+ }
+
+ ElementsListView{
+ id: dictList
+ width: rectangle1.width
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ highlightResizeSpeed: 1000
+
+ header: Component{
+ id: dictListHeader
+ Item {
+ width: rectangle1.width
+ height: 20
+ Row {
+ anchors.fill: parent
+ Rectangle {
+ id: fromRecHeader
+ width: horizontalScrollBar1.position
+ height: parent.height
+ radius: 1
+ gradient: Gradient { GradientStop { position: 0.3; color: "#a0cbec" } GradientStop { position: 0.99; color: "#35a0f1" } }
+
+ Text {
+ id: fromTextHeader
+ text: qsTr("From");
+ elide: Text.ElideRight
+ font.pixelSize: 12
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle {
+ id: toRecHeader
+ width: horizontalScrollBar2.position
+ height: parent.height
+ radius: 1
+ gradient: Gradient { GradientStop { position: 0.3; color: "#a0cbec" } GradientStop { position: 0.99; color: "#35a0f1" } }
+
+ Text {
+ id: toTextHeader
+ text: qsTr("To");
+ elide: Text.ElideRight
+ font.pixelSize: 12
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle {
+ id: nameRecHeader
+ width: horizontalScrollBar3.position
+ height: parent.height
+ radius: 1
+ gradient: Gradient { GradientStop { position: 0.3; color: "#a0cbec" } GradientStop { position: 0.99; color: "#35a0f1" } }
+
+ Text {
+ id: nameTextHeader
+ text: qsTr("Title");
+ elide: Text.ElideRight
+ font.pixelSize: 12
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle {
+ id: sizeRecHeader
+ width: 100;
+ height: parent.height
+ radius: 1
+ gradient: Gradient { GradientStop { position: 0.3; color: "#a0cbec" } GradientStop { position: 0.99; color: "#35a0f1" } }
+
+ Text {
+ id: sizeTextHeader
+ text: qsTr("Size");
+ elide: Text.ElideRight
+ font.pixelSize: 12
+ anchors.centerIn: parent
+ }
+ }
+ }
+ }
+ }
+
+ delegate: Component{
+ id: dictListDelegate
+ Item {
+ width: rectangle1.width
+ height:nameText.height
+ MouseArea{
+ anchors.fill: parent
+ onClicked: {
+ dictList.currentIndex = index
+ }
+ onDoubleClicked: {
+ rectangle1.dictLink(link)
+ }
+ }
+ Row {
+ anchors.fill: parent
+ Text {
+ id: fromText
+ text: " "+from+" ";
+ width: horizontalScrollBar1.position
+ elide: Text.ElideRight
+ }
+
+ Text {
+ id: toText
+ text: " "+to+" ";
+ width: horizontalScrollBar2.position
+ elide: Text.ElideRight
+ }
+
+ Text {
+ id: nameText
+ text: " "+name+" ";
+ width: horizontalScrollBar3.position
+ elide: Text.ElideRight
+ }
+ Text {
+ id: sizeText
+ text: " "+size+" ";
+ width: 100
+ elide: Text.ElideRight
+ }
+ }
+ }
+ }
+ model: dictModel
+ }
+}
Item { id: headerSpace; width: parent.width; height: 1}
ScrollBar {
- scrollArea: webView; width: 8
+ scrollArea: webView;
+ width: 8
anchors { right: parent.right; top: parent.bottom; bottom: parent.bottom }
}
ScrollBar {
- scrollArea: webView; height: 8; orientation: Qt.Horizontal
+ scrollArea: webView;
+ height: 8; orientation: Qt.Horizontal
anchors { right: parent.right; rightMargin: 8; left: parent.left; bottom: parent.bottom }
}
color : myPalette.window;
function setValue(intiger){
- console.log("ala value " +intiger);
progressbar1.setValue(intiger);
}
function setText(string){
- console.log("ala text " +string);
text.text=string;
}
function setMaximumValue(intiger){
- console.log("ala max " +intiger);
if(intiger==0){
timerUp.running=true;
setValue(-1);
anchors.right: parent.right
anchors.left: parent.left
onClicked: {
- console.log("click");
rectangle1.cancelDownloading();
}
}
_link = lreg.capturedTexts().at(1);
}
+ DownloadDict(const DownloadDict &dict) {
+ _from = dict.fromLang();
+ _to = dict.toLang();
+ _title = dict.title();
+ _size = dict.size();
+ _link = dict.link();
+ }
+
//! \return dictionary source language
QString fromLang() const {return _from;}
\return 1 if this is before other
*/
bool operator <(DownloadDict other) const {
- if(_from < other.fromLang()) return true;
- if(_from > other.fromLang()) return false;
- if(_to < other.toLang()) return true;
- return false;
+ if(_from < other.fromLang())
+ return true;
+ else if(_from > other.fromLang())
+ return false;
+ else if(_to < other.toLang())
+ return true;
+ else
+ return false;
}
private:
#define XDXFDIALOG_H
#include <QDialog>
-#include "../../include/settings.h"
#include <QtGui>
#include <QDeclarativeView>
#include "xdxfplugin.h"
-
+#include "../../include/settings.h"
/*!
This class can create dialogs for adding a new dictionary or changing settings
XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
QWidget *parent) :
QDialog(parent) {
+
+
setWindowTitle(tr("Select dictionary"));
+ //here removing already added dictionary
+ for (int i = 0; i < dicts.size(); i++){
+ if(QFile::exists(QDir::homePath() + "/.mdictionary/" + dicts[i].title() + ".xdxf")){
+ dicts.removeAt(i);
+ i--;
+ }
+ }
+
+#ifndef Q_WS_MAEMO_5
+ model2 = new DictsListModel(dicts, this);
+ proxyModel2 = new DictsProxyListModel;
+ proxyModel2->setSourceModel(model2);
+ proxyModel2->setTo("Polish");
+ view= new QDeclarativeView();
+ QDeclarativeContext* ctxt=view->rootContext();
+ ctxt->setContextProperty("dictModel", proxyModel2);
+ view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/TableWidget.qml"));
+ view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ view->setAlignment(Qt::AlignCenter);
+
+ mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(view);
+ this->setLayout(mainLayout);
+ proxyModel2->setTo("English");
+
+ QGraphicsObject *rootObject = view->rootObject();
+
+ connect(rootObject,SIGNAL(dictLink(QString)),
+ this,SLOT(itemClicked(QString)));
+#else
+
layout = new QVBoxLayout;
setLayout(layout);
checkBoxLayout->addWidget(langToLabel);
checkBoxLayout->addWidget(langTo, 10);
- //here removing already added dictionary
-
- for (int i = 0; i < dicts.size(); i++){
- if(QFile::exists(QDir::homePath() + "/.mdictionary/" + dicts[i].title() + ".xdxf")){
- dicts.removeAt(i);
- i--;
- }
- }
-
model = new DictsModel(dicts, this);
proxyModel = new DictsProxyModel;
#endif
initializeDicts();
+ #endif
}
void XdxfDictSelectDialog::refreshDictList() {
+#ifndef Q_WS_MAEMO_5
+
+
+#else
+
//if selected language is "Any"(index 0), from filter string is set to empty string, proxy model uses empty string as special case and don't filter by this field.
if(langTo->currentIndex() == 0)
proxyModel->setTo(QString());
proxyModel->setFrom(QString());
else
proxyModel->setFrom(langFrom->currentText());
+
+#endif
}
+void XdxfDictSelectDialog::itemClicked(QString link) {
+#ifndef Q_WS_MAEMO_5
+ _link = link;
+ accept();
+#endif
+}
+
void XdxfDictSelectDialog::itemClicked(QModelIndex index) {
+#ifdef Q_WS_MAEMO_5
_link = index.model()->data(index, Qt::UserRole).toString();
accept();
+#endif
}
#include <QtGui>
#include <QFile>
#include <QDir>
+#include <QDeclarativeView>
+#include <QDeclarativeContext>
+
#include "DownloadDict.h"
+#include "DictsListModel.h"
#include "DictsModel.h"
#include "DictsProxyModel.h"
+#include "DictsProxyListModel.h"
/*!
//! accept dialog and sets download link of clicked dictionary
void itemClicked(QModelIndex);
+ void itemClicked(QString link);
+
private:
+ QVBoxLayout* mainLayout;
+ QDeclarativeView *view;
+ DictsListModel* model2;
+ DictsProxyListModel *proxyModel2;
+
QTreeView* treeView;
DictsModel* model;
DictsProxyModel *proxyModel; //used by treeView to allow filtering and sorti
XdxfDictSelectDialog.cpp \
XdxfDictDownloadProgressDialog.cpp \
DictsModel.cpp \
- HttpDownloader.cpp
+ HttpDownloader.cpp \
+ DictsListModel.cpp
HEADERS += xdxfplugin.h \
TranslationXdxf.h \
DownloadDict.h \
DictsModel.h \
DictsProxyModel.h \
- HttpDownloader.h
+ HttpDownloader.h \
+ DictsListModel.h \
+ DictsProxyListModel.h
RESOURCES += xdxf.qrc
en_US.ts
OTHER_FILES += ../../mdictionary/qml/XdxfDialog.qml \
- ../../mdictionary/qml/XdxfDictDownloader.qml
+ ../../mdictionary/qml/XdxfDictDownloader.qml \
+ ../../mdictionary/qml/TableWidget.qml \
+ ../../mdictionary/qml/ScrollBar2.qml
unix {
dicts.path = $$PLUGINS_DIR
qmls.path = $$DATA_DIR/qml
qmls.files += ../../mdictionary/qml/XdxfDialog.qml
qmls.files += ../../mdictionary/qml/XdxfDictDownloader.qml
+ qmls.files += ../../mdictionary/qml/TableWidget.qml
+ qmls.files += ../../mdictionary/qml/ScrollBar2.qml
+
}
INSTALLS += dicts \
<qresource prefix="/xdxf">
<file>translations/pl_PL.qm</file>
<file>translations/en_US.qm</file>
+ <file>scrollbar.png</file>
</qresource>
</RCC>