Merge branch 'master' of ssh://drop.maemo.org/git/mdictionary
authorMarcin Kaźmierczak <marcin@marcin-desktop.(none)>
Mon, 28 Feb 2011 14:34:12 +0000 (15:34 +0100)
committerMarcin Kaźmierczak <marcin@marcin-desktop.(none)>
Mon, 28 Feb 2011 14:34:12 +0000 (15:34 +0100)
Conflicts:
src/mdictionary/qml/WordListWidget.qml

48 files changed:
data/button/buttonCenterDisabled.png
data/button/buttonCenterFocus.png [new file with mode: 0644]
data/button/buttonCenterPushed.png
data/button/buttonLeftDisabled.png
data/button/buttonLeftFocus.png [new file with mode: 0644]
data/button/buttonLeftPushed.png
data/button/buttonRFocus.png [new file with mode: 0644]
data/button/buttonRightDisabled.png
data/button/buttonRightPushed.png
data/button/checkboxCheckedDis.png [new file with mode: 0644]
data/button/checkboxDis.png [new file with mode: 0644]
data/button/down_enable.png
data/button/down_enable2.png [new file with mode: 0644]
data/button/up_enable.png
data/button/up_enable2.png [new file with mode: 0644]
data/gui.qrc
src/include/ComboBoxModel.cpp
src/mdictionary/gui/SearchBarWidget.cpp
src/mdictionary/gui/SearchBarWidget.h
src/mdictionary/gui/SettingsWidget.cpp
src/mdictionary/gui/TranslationView.cpp
src/mdictionary/qml/AboutWidget.qml
src/mdictionary/qml/Button.qml
src/mdictionary/qml/Checkbox.qml
src/mdictionary/qml/ComboBox.qml
src/mdictionary/qml/DictManagerWidget.qml
src/mdictionary/qml/FlickableWebView.qml
src/mdictionary/qml/GoogleDialog.qml
src/mdictionary/qml/IconButton.qml
src/mdictionary/qml/MySpinBox.qml
src/mdictionary/qml/MyTextLineEdit.qml
src/mdictionary/qml/ProgressBar.qml
src/mdictionary/qml/SearchBarWidget.qml
src/mdictionary/qml/SettingsWidget.qml
src/mdictionary/qml/StarDictDialog.qml
src/mdictionary/qml/TableWidget.qml
src/mdictionary/qml/TranslationView.qml
src/mdictionary/qml/WordListWidget.qml
src/mdictionary/qml/XdxfDialog.qml
src/plugins/xdxf/XdxfDictDownloadProgressDialog.cpp
src/plugins/xdxf/XdxfDictDownloader.cpp
src/plugins/xdxf/XdxfDictSelectDialog.cpp
src/plugins/xdxf/XdxfDictSelectDialog.h
src/plugins/xdxf/xdxf.pro
www/devhowto.html
www/images/Meego.png
www/images/qml/w07.png
www/qmlelements.html

index 2621381..58203c0 100644 (file)
Binary files a/data/button/buttonCenterDisabled.png and b/data/button/buttonCenterDisabled.png differ
diff --git a/data/button/buttonCenterFocus.png b/data/button/buttonCenterFocus.png
new file mode 100644 (file)
index 0000000..0dcc617
Binary files /dev/null and b/data/button/buttonCenterFocus.png differ
index 58203c0..2621381 100644 (file)
Binary files a/data/button/buttonCenterPushed.png and b/data/button/buttonCenterPushed.png differ
index ef89fb8..976abd6 100644 (file)
Binary files a/data/button/buttonLeftDisabled.png and b/data/button/buttonLeftDisabled.png differ
diff --git a/data/button/buttonLeftFocus.png b/data/button/buttonLeftFocus.png
new file mode 100644 (file)
index 0000000..2ea9543
Binary files /dev/null and b/data/button/buttonLeftFocus.png differ
index 976abd6..ef89fb8 100644 (file)
Binary files a/data/button/buttonLeftPushed.png and b/data/button/buttonLeftPushed.png differ
diff --git a/data/button/buttonRFocus.png b/data/button/buttonRFocus.png
new file mode 100644 (file)
index 0000000..5d530b7
Binary files /dev/null and b/data/button/buttonRFocus.png differ
index db3fc2b..30206c5 100644 (file)
Binary files a/data/button/buttonRightDisabled.png and b/data/button/buttonRightDisabled.png differ
index 30206c5..db3fc2b 100644 (file)
Binary files a/data/button/buttonRightPushed.png and b/data/button/buttonRightPushed.png differ
diff --git a/data/button/checkboxCheckedDis.png b/data/button/checkboxCheckedDis.png
new file mode 100644 (file)
index 0000000..33472af
Binary files /dev/null and b/data/button/checkboxCheckedDis.png differ
diff --git a/data/button/checkboxDis.png b/data/button/checkboxDis.png
new file mode 100644 (file)
index 0000000..a5b8e5c
Binary files /dev/null and b/data/button/checkboxDis.png differ
index 8cae783..0bbb98b 100644 (file)
Binary files a/data/button/down_enable.png and b/data/button/down_enable.png differ
diff --git a/data/button/down_enable2.png b/data/button/down_enable2.png
new file mode 100644 (file)
index 0000000..44d756a
Binary files /dev/null and b/data/button/down_enable2.png differ
index a82da53..63db5dd 100644 (file)
Binary files a/data/button/up_enable.png and b/data/button/up_enable.png differ
diff --git a/data/button/up_enable2.png b/data/button/up_enable2.png
new file mode 100644 (file)
index 0000000..0f8a4f4
Binary files /dev/null and b/data/button/up_enable2.png differ
index 7ee2d8f..1f1cdb4 100644 (file)
         <file>button/up_enable.png</file>
         <file>button/down_enable.png</file>
         <file>button/revert.png</file>
+        <file>button/checkboxCheckedDis.png</file>
+        <file>button/checkboxDis.png</file>
+        <file>button/buttonCenterFocus.png</file>
+        <file>button/buttonLeftFocus.png</file>
+        <file>button/buttonRFocus.png</file>
     </qresource>
 </RCC>
index 56e5dfe..56963e1 100644 (file)
@@ -34,7 +34,6 @@ ComboBoxModel::ComboBoxModel(QList<QString> contents, QObject *parent) :
     roles[ContentRole] = "content";
     roles[NumberRole] = "number";
     setRoleNames(roles);
-
     setContents(contents);
 }
 
index 9dc1450..7e9e16d 100644 (file)
 
 
 SearchBarWidget::SearchBarWidget(QWidget *parent) : QWidget(parent) {
-    qDebug()<<"test1";
+
+    completerModel = new QStringList;
+    lineEditCompleter = new QCompleter(this);
+    lineEditCompleter->setModel(new QStringListModel(*completerModel));
+    lineEditCompleter->setCaseSensitivity(Qt::CaseInsensitive);
+    lineEditCompleter->setCompletionMode(QCompleter::InlineCompletion);
+
 #ifndef Q_WS_MAEMO_5
     this->setMaximumHeight(50);
     busyTimer=new QTimer;
@@ -45,6 +51,9 @@ SearchBarWidget::SearchBarWidget(QWidget *parent) : QWidget(parent) {
     progressBar->hide();
 
     view= new QDeclarativeView();
+    ctxt = view->rootContext();
+    ctxt->setContextProperty("focusss",true);
+
     view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/SearchBarWidget.qml"));
     view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
     view->setAlignment(Qt::AlignCenter);
@@ -66,6 +75,16 @@ SearchBarWidget::SearchBarWidget(QWidget *parent) : QWidget(parent) {
             this, SIGNAL(historyPrev()));
     connect(rootObject, SIGNAL(historyShowToolButtonClicked()),
             this, SLOT(showHistoryButtonClicked()));
+    connect(rootObject, SIGNAL(textChange(QString)),
+            this, SLOT(textChange(QString)));
+    connect(rootObject, SIGNAL(nextCompleter()),
+            this, SLOT(nextCompleter()));
+    connect(rootObject, SIGNAL(prevCompleter()),
+            this, SLOT(prevCompleter()));
+    connect(rootObject, SIGNAL(checkFocus()),
+            this, SLOT(checkFocus()));
+    connect(rootObject, SIGNAL(nextFocus()),
+            this, SLOT(nextFocus()));
 
     connect(this, SIGNAL(progresSetMax(QVariant)),
             rootObject2, SLOT(setMax(QVariant)));
@@ -89,6 +108,11 @@ SearchBarWidget::SearchBarWidget(QWidget *parent) : QWidget(parent) {
     connect(this, SIGNAL(setLineEditEnables(QVariant)),
             rootObject, SLOT(setEnableLineEdit(QVariant)));
 
+    connect(this, SIGNAL(setCompleterText(QVariant)),
+            rootObject, SLOT(setCompleterText(QVariant)));
+    connect(this, SIGNAL(focusOff()),
+            rootObject, SLOT(focusOff()));
+
     connect(busyTimer, SIGNAL(timeout()),
             this, SLOT(updateBusyTimer()));
 
@@ -96,12 +120,9 @@ SearchBarWidget::SearchBarWidget(QWidget *parent) : QWidget(parent) {
     emit setEnableHistoryShow(false);
     emit setEnableHistoryPrev(false);
 
-    completerModel = new QStringListModel(this);
     connect(&delayTimer, SIGNAL(timeout()),
             this, SLOT(delaySearchTimeout()));
 
-    view->setFocus();
-
 #else
     initializeUI();
     connect(searchPushButton, SIGNAL(clicked()),
@@ -119,10 +140,9 @@ SearchBarWidget::SearchBarWidget(QWidget *parent) : QWidget(parent) {
     connect(&delayTimer, SIGNAL(timeout()),
             this, SLOT(delaySearchTimeout()));
 
-
     searchWordLineEdit->setFocus();
 #endif
-
+    setFocus();
     busy = false;
     setEnabled(true);
     updateHistoryButtons(false,false,false);
@@ -132,8 +152,80 @@ SearchBarWidget::~SearchBarWidget() {
 
 }
 
+void SearchBarWidget::checkFocus(){
+    if(focusWidget()!=QApplication::focusWidget())
+        emit focusOff();
+}
+
+void SearchBarWidget::nextFocus(){
+    parentWidget()->nextInFocusChain()->setFocus();
+}
+
+void SearchBarWidget::textChange(QString text){
+    QLineEdit line;
+    QString toSend="";
+    QString tempString;
+    actualString=text;
+    completerActualList.clear();
+
+    line.setCompleter(lineEditCompleter);
+    line.completer()->setCompletionPrefix(text);
+    for (int i = 0; lineEditCompleter->setCurrentRow(i); i++)
+        completerActualList.append(lineEditCompleter->currentCompletion());
+
+    completerActualList.sort();
+    if(completerActualList.contains(preferedCompliter)){
+        tempString = preferedCompliter;
+        toSend = tempString.remove(0,text.size());
+        emit setCompleterText(toSend);
+    }
+    else if(completerActualList.size()>0 && text.size()>0){
+        toSend = completerActualList.at(0);
+        preferedCompliter= toSend;
+        toSend=toSend.remove(0,text.size());
+        if(toSend.size()>0)
+            emit setCompleterText(toSend);
+        else if(completerActualList.size()>1){
+            toSend = completerActualList.at(1);
+            preferedCompliter= toSend;
+            toSend=toSend.remove(0,text.size());
+            emit setCompleterText(toSend);
+        }
+    }
+    else{
+        preferedCompliter="";
+        emit setCompleterText(toSend);
+    }
+}
+
+void SearchBarWidget::prevCompleter(){
+    QString tempString;
+    if(!preferedCompliter.isEmpty()){
+        int index = completerActualList.indexOf(preferedCompliter);
+        if(index!=-1 && completerActualList.size()>index+1){
+            preferedCompliter = completerActualList.at(index+1);
+            tempString=preferedCompliter;
+            QString toSend = tempString.remove(0,actualString.size());
+            emit setCompleterText(toSend);
+        }
+    }
+}
+
+void SearchBarWidget::nextCompleter(){
+    QString tempString;
+    if(!preferedCompliter.isEmpty()){
+        int index = completerActualList.indexOf(preferedCompliter);
+        if(index>0){
+            preferedCompliter = completerActualList.at(index-1);
+            tempString=preferedCompliter;
+            QString toSend = tempString.remove(0,actualString.size());
+            emit setCompleterText(toSend);
+        }
+    }
+}
+
+
 QIcon SearchBarWidget::generateIcon(QIcon original, qreal rotation) {
-    qDebug()<<"test2";
     QPixmap p = original.pixmap(64);
 
     if(rotation != 0) {
@@ -170,7 +262,6 @@ QIcon SearchBarWidget::generateIcon(QIcon original, qreal rotation) {
 }
 
 void SearchBarWidget::setFocus() {
-    qDebug()<<"test3";
 #ifndef Q_WS_MAEMO_5
         view->setFocus();
 #else
@@ -179,7 +270,6 @@ void SearchBarWidget::setFocus() {
 }
 
 void SearchBarWidget::initializeUI() {
-    qDebug()<<"test4";
 #ifdef Q_WS_MAEMO_5
     setMaximumHeight(150);
 
@@ -192,12 +282,6 @@ void SearchBarWidget::initializeUI() {
     searchWordLineEdit = new QLineEdit;
     searchWordLineEdit->setMinimumWidth(250);
 
-    completerModel = new QStringListModel(this);
-
-    lineEditCompleter = new QCompleter(searchWordLineEdit);
-    lineEditCompleter->setModel(completerModel);
-    lineEditCompleter->setCaseSensitivity(Qt::CaseInsensitive);
-    lineEditCompleter->setCompletionMode(QCompleter::InlineCompletion);
     searchWordLineEdit->setCompleter(lineEditCompleter);
 
     #ifndef Q_WS_MAEMO_5
@@ -286,7 +370,6 @@ void SearchBarWidget::initializeUI() {
 }
 
 void SearchBarWidget::searchButtonClicked(QString text) {
-    qDebug()<<"test5";
     if(busy)
         Q_EMIT stopSearching();
     else
@@ -294,7 +377,6 @@ void SearchBarWidget::searchButtonClicked(QString text) {
 }
 
 void SearchBarWidget::searchPushButtonClicked() {
-    qDebug()<<"test6";
 #ifdef Q_WS_MAEMO_5
     if(busy) {
         Q_EMIT stopSearching();
@@ -306,13 +388,14 @@ void SearchBarWidget::searchPushButtonClicked() {
 }
 
 void SearchBarWidget::search(QString word) {
-    qDebug()<<"test7";
-    qDebug()<<word;
     if(!busy && !word.isEmpty()) {
-        completerModel->insertRow(completerModel->rowCount());
-        QModelIndex index=completerModel->index(completerModel->rowCount() -1);
-        completerModel->setData(index, word);
-
+        while(word.lastIndexOf(" ")==word.size()-1 && word.size()>0)
+            word=word.remove(word.size()-1,1);
+        if(!completerModel->contains(word))
+            completerModel->append(word);
+        QAbstractItemModel *temp=lineEditCompleter->model();
+        lineEditCompleter->setModel(new QStringListModel(*completerModel));
+        delete temp;
 #ifndef Q_WS_MAEMO_5
         emit setLineEditText(word);
 #else
@@ -323,7 +406,6 @@ void SearchBarWidget::search(QString word) {
 }
 
 void SearchBarWidget::searchDelay(QString word) {
-    qDebug()<<"test8";
     if(!busy && !word.isEmpty()) {
         #ifndef Q_WS_MAEMO_5
             emit setLineEditText(word);
@@ -339,7 +421,6 @@ void SearchBarWidget::searchDelay(QString word) {
 }
 
 void SearchBarWidget::delaySearchTimeout() {
-    qDebug()<<"test9";
     delayTimer.stop();
     if(!busy) {
         Q_EMIT searchForTranslations(delayString);
@@ -347,11 +428,9 @@ void SearchBarWidget::delaySearchTimeout() {
 }
 
 void SearchBarWidget::setEnabled(bool enabled) {
-    qDebug()<<"test10";
 #ifndef Q_WS_MAEMO_5
     emit setLineEditEnables(enabled);
     if(!enabled) {
-        qDebug()<<"tu???";
         emit setEnableHistoryNext(false);
         emit setEnableHistoryShow(false);
         emit setEnableHistoryPrev(false);
@@ -364,11 +443,9 @@ void SearchBarWidget::setEnabled(bool enabled) {
         historyShowToolButton->setEnabled(false);
     }
 #endif
-qDebug()<<"tu2???";
 }
 
 void SearchBarWidget::setBusy() {
-    qDebug()<<"test11";
     if(busy) return;
 
 #ifndef Q_WS_MAEMO_5
@@ -391,7 +468,6 @@ void SearchBarWidget::setBusy() {
 }
 
 void SearchBarWidget::updateBusyTimer(){
-    qDebug()<<"test12";
     if(progressMax==true){
         emit progresSetValue2(0);
         progressMax=false;
@@ -404,7 +480,6 @@ void SearchBarWidget::updateBusyTimer(){
 }
 
 void SearchBarWidget::setIdle() {
-    qDebug()<<"test13";
     if(!busy) return;
 #ifndef Q_WS_MAEMO_5
     progressBar->hide();
@@ -423,7 +498,6 @@ void SearchBarWidget::setIdle() {
 
 
 void SearchBarWidget::clearSearchWordToolButtonClicked() {
-    qDebug()<<"test14";
 #ifdef Q_WS_MAEMO_5
     searchWordLineEdit->clear();
 #endif
@@ -432,7 +506,6 @@ void SearchBarWidget::clearSearchWordToolButtonClicked() {
 
 
 void SearchBarWidget::updateHistoryButtons(bool prev, bool next, bool list) {
-    qDebug()<<"test15";
     if(!busy) {
         #ifndef Q_WS_MAEMO_5
             emit setEnableHistoryNext(next);
@@ -447,7 +520,6 @@ void SearchBarWidget::updateHistoryButtons(bool prev, bool next, bool list) {
 }
 
 void SearchBarWidget::showHistoryButtonClicked() {
-    qDebug()<<"test16";
 #ifndef Q_WS_MAEMO_5
     QPoint p=view->pos(); // = historyShowToolButton->pos();
     p=mapToGlobal(p);
index 427eb53..d19ce21 100644 (file)
@@ -60,6 +60,8 @@ Q_SIGNALS:
     void progresSetMin(QVariant);
     void progresSetValue(QVariant);
     void progresSetValue2(QVariant);
+    void setCompleterText(QVariant);
+    void focusOff();
 
     //! Requests to search for a list of words matching a word passed as
     //! a parameter
@@ -134,6 +136,8 @@ public Q_SLOTS:
     void updateHistoryButtons(bool prev, bool next, bool list);
 
     void setFocus();
+    void nextFocus();
+    void checkFocus();
 
 private Q_SLOTS:
     //! Clears search word line edit
@@ -148,6 +152,12 @@ private Q_SLOTS:
     //! shows history
     void showHistoryButtonClicked();
 
+    void textChange(QString text);
+
+    void nextCompleter();
+
+    void prevCompleter();
+
 
 private:
 
@@ -156,10 +166,14 @@ private:
     QDeclarativeView *progressBar;
     QTimer *busyTimer;
     bool progressMax;
+    QDeclarativeContext *ctxt;
+    QStringList* completerModel;
+    QCompleter* lineEditCompleter;
+    QString preferedCompliter;
+    QString actualString;
+    QStringList completerActualList;
 
     QLineEdit* searchWordLineEdit;
-    QCompleter* lineEditCompleter;
-    QStringListModel* completerModel;
     QToolButton* clearSearchWordToolButton;
     QPushButton* searchPushButton;
     QToolButton* historyPrevToolButton;
index 4c37017..bb070f2 100644 (file)
@@ -321,6 +321,7 @@ void SettingsWidget::changed() {
 #ifndef Q_WS_MAEMO_5
     void SettingsWidget::save() {
         _save = true;
+        qDebug()<<"tuuu";
         hide();
     }
 #endif
index d60a2f0..e54498a 100644 (file)
@@ -49,6 +49,8 @@ TranslationView::TranslationView(QWidget *parent) : QWebView(parent) {
 
     connect(this, SIGNAL(setUrl(QVariant)),
            rootObject, SLOT(setUrl(QVariant)));
+    emit setUrl(QDir::homePath() + "/.mdictionary/" + "html.html");
+
 #else
 
     realParent = qobject_cast<TranslationWidget*>(parent);
@@ -66,7 +68,8 @@ TranslationView::TranslationView(QWidget *parent) : QWebView(parent) {
 
     connect(searchSelectedAction, SIGNAL(triggered()),
             this, SIGNAL(search()));
-    connect(page(), SIGNAL(selectionChanged()), this, SLOT(selection()));
+    connect(page(), SIGNAL(selectionChanged()),
+            this, SLOT(selection()));
 
 #endif
 }
index a600d1b..92c6d07 100644 (file)
@@ -52,13 +52,4 @@ Rectangle {
         anchors.horizontalCenterOffset: 0
         onLinkActivated: linkClicked(link);
     }
-
-  /*  MySpinBox {
-        id: test01
-        y:20;
-        x:20;
-        width: 40
-        height: 20;
-    }
-    */
 }
index d10edc6..953fdbc 100644 (file)
@@ -1,13 +1,27 @@
 import Qt 4.7
 
-BorderImage {
+Rectangle {
     id: button
     property alias textInButton: buttonText.text
-    signal clicked
-    opacity: 1
+    property bool checkable: false
+    property bool checked: false
+
+    height: 20;
+    width: 60;
+
+    signal clicked;
+    signal changeCheck;
 
     function setText(string) { textInButton = qsTr(string); }
-    border { left: 10; top: 10; right: 10; bottom: 10 }
+    function press() { mouseArea.pressed }
+
+    Keys.onReturnPressed: {
+        button.clicked();
+        if(checkable){
+            button.checked=!button.checked;
+            button.changeCheck();
+        }
+    }
 
     MouseArea {
         id: mouseArea
@@ -16,20 +30,27 @@ BorderImage {
         height: parent.height;
         onClicked: {
             button.clicked();
+            if(checkable){
+                button.checked=!button.checked;
+                button.changeCheck();
+            }
         }
     }
 
     Text {
         z:1
         id: buttonText
+        width: parent.width;
         anchors.centerIn: parent;
+        horizontalAlignment: Text.AlignHCenter
         font.pixelSize: parent.height * .5
+        elide: Text.ElideRight;
         style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true
     }
 
     Image {
         id: image1
-        width: (35*parent.height)/107 +1
+        width:  (image1.sourceSize.width*parent.height)/image1.sourceSize.height +1
         height: parent.height
         anchors.left: parent.left
         source: "qrc:/button/buttonLeft.png"
@@ -46,13 +67,15 @@ BorderImage {
         anchors.left: image1.right
         anchors.leftMargin: -1
         source: "qrc:/button/buttonCenter.png"
-        fillMode:Image.Stretch
+        //fillMode:Image.Stretch
+        fillMode: Image.TileHorizontally
+
     }
 
     Image {
         id: image2
         smooth: true
-        width: (35*parent.height)/107 +1
+        width: (image1.sourceSize.width*parent.height)/image1.sourceSize.height +1
         height: parent.height
         anchors.right: parent.right
         source: "qrc:/button/buttonR.png"
@@ -62,7 +85,7 @@ BorderImage {
     states: [
         State {
             name: "pressed";
-            when: (mouseArea.pressed == true && button.enabled == true);
+            when: ((button.enabled) && (mouseArea.pressed || (button.checkable && button.checked) ) )
 
             PropertyChanges { target: image1; source: "qrc:/button/buttonLeftPushed.png" }
             PropertyChanges { target: image3; source: "qrc:/button/buttonCenterPushed.png" }
@@ -75,6 +98,15 @@ BorderImage {
             PropertyChanges { target: image1; source: "qrc:/button/buttonLeftDisabled.png" }
             PropertyChanges { target: image3; source: "qrc:/button/buttonCenterDisabled.png" }
             PropertyChanges { target: image2; source: "qrc:/button/buttonRightDisabled.png" }
+        },
+        State {
+            name: "focused";
+            when: (button.enabled && !mouseArea.pressed && button.focus)
+
+            PropertyChanges { target: image1; source: "qrc:/button/buttonLeftFocus.png" }
+            PropertyChanges { target: image3; source: "qrc:/button/buttonCenterFocus.png" }
+            PropertyChanges { target: image2; source: "qrc:/button/buttonRFocus.png" }
         }
+
     ]
 }
index 3ef0fc3..75046e3 100644 (file)
@@ -29,7 +29,15 @@ Image {
     property bool selected
     property string pathToCheckedImage: "qrc:/button/checkboxChecked.png"
     property string pathToUncheckedImage: "qrc:/button/checkbox.png"
+    property string pathToCheckedDicImage: "qrc:/button/checkboxCheckedDis.png"
+    property string pathToUncheckedDicImage: "qrc:/button/checkboxDis.png"
     signal changed
+
+    Keys.onPressed: {
+        if (event.key == Qt.Key_Space)
+            selected=!selected
+    }
+
     height: {
         var aspectRatio = sourceSize.height / sourceSize.width
         return checkbox.width * aspectRatio
@@ -38,24 +46,55 @@ Image {
     smooth: true
     states: [
         State {
-            name: "checked";
-            when: (checkbox.selected == true);
+            name: "checkeEn";
+            when: (checkbox.selected && checkbox.enabled);
 
             PropertyChanges { target: checkbox; source: pathToCheckedImage }
         },
         State {
-            name: "unchecked";
-            when: (checkbox.selected == false);
+            name: "uncheckeEn";
+            when: ( !checkbox.selected && checkbox.enabled);
 
             PropertyChanges { target: checkbox; source: pathToUncheckedImage }
+        },
+        State {
+            name: "checkeDi";
+            when: (checkbox.selected && !checkbox.enabled);
+
+            PropertyChanges { target: checkbox; source: pathToCheckedDicImage }
+        },
+        State {
+            name: "uncheckeDi";
+            when: ( !checkbox.selected && !checkbox.enabled);
+
+            PropertyChanges { target: checkbox; source: pathToUncheckedDicImage }
         }
     ]
     MouseArea{
         id: area
         anchors.fill: parent
         onClicked: {
-            checkbox.selected = !checkbox.selected
-            changed()
+            if(checkbox.enabled){
+               checkbox.selected = !checkbox.selected
+               changed()
+            }
         }
     }
+
+    Rectangle{
+        id: focusRectangle
+        color: "#000000"
+        border.color: "#000000"
+        opacity: 0;
+        radius: 1
+        anchors.centerIn: parent
+        z:1;
+    }
+
+    onFocusChanged: {
+        if(focus)
+            focusRectangle.opacity=0.5;
+        else
+            focusRectangle.opacity=0;
+    }
 }
index b863e3c..5ceb5b5 100644 (file)
@@ -12,7 +12,9 @@ Rectangle {
     property int expandedHeight
     property int basicHeight
     property string startValue
-    height: basicHeight
+    height: 20
+
+    property variant parentField : rectangle1
 
     function show(Boolean){
         expanded = Boolean
@@ -25,6 +27,19 @@ Rectangle {
 
     signal valueSelected(string selected);
 
+   /* Keys.onPressed: {
+        console.log("tu ----");
+        if (event.key == Qt.Key_Escape)
+            rectangle1.expanded=false;
+        else if (event.key == Qt.Key_Space)
+            rectangle1.expanded=true;
+        else if (event.key == Qt.Key_Return){
+            rectangle1.expanded=false;
+            console.log("tu enter "+list1.content);
+        }
+    }
+    */
+
     Text {
         id: text1
         width: rectangle1.width-15
@@ -33,6 +48,7 @@ Rectangle {
         anchors.centerIn: parent
         font.pixelSize: rectangle1.height * .5;
         onTextChanged: { rectangle1.valueSelected(text) }
+        z: expanded?0:1;
     }
 
     Rectangle {
@@ -77,9 +93,7 @@ Rectangle {
 
     ElementsListView{
         id: list1
-        width: parent.width
         visible: false
-        z: 0
         property string selected: rectangle1.startValue
 
         function selectedValue(nr, value) {
@@ -88,10 +102,13 @@ Rectangle {
             rectangle1.show(false)
         }
 
-        anchors.left: parent.left
-        anchors.verticalCenter: parent.verticalCenter
-        highlightResizeSpeed: 1000
+        anchors.rightMargin: 5
+        anchors.leftMargin: 5
+        anchors.bottomMargin: 10
+        anchors.topMargin: 10
+        anchors.fill: parent
 
+        highlightResizeSpeed: 1000
         delegate: Component{
             id: list1Delegate
             Item {
@@ -118,6 +135,7 @@ Rectangle {
                         id: contentText
                         anchors.verticalCenter: parent.verticalCenter
                         anchors.leftMargin: 5
+                        elide: Text.ElideRight;
                         text: content
                     }
                 }
@@ -142,10 +160,11 @@ Rectangle {
             when: (rectangle1.expanded == true && rectangle1.disabled == false)
             PropertyChanges { target: list1; z: 10; visible: true }
             PropertyChanges { target: text1; z: 10; visible: false }
-            PropertyChanges { target: rectangle1; border.width: 0}
+            PropertyChanges { target: rectangle1; border.width: 1}
             PropertyChanges { target: rectangle1; height: rectangle1.expandedHeight}
             PropertyChanges { target: imageDown; height: 0.5 * rectangle1.basicHeight}
             PropertyChanges { target: shadeDisable; visible: false; z: -1}
+            PropertyChanges { target: rectangle1; anchors.fill: parentField}
         },
         State {
             name: "disabled";
index bf9c2f0..a512f2a 100644 (file)
@@ -137,7 +137,6 @@ Rectangle {
         model: dictModel
     }
 
-    //buttons
 
     Item {
         id: buttonsBox
index edd448d..42818ef 100644 (file)
@@ -72,10 +72,6 @@ Flickable {
         contentsScale: 1
         pressGrabTime: 0
 
-        Keys.onRightPressed: {
-            console.log("test");
-        }
-
         function doZoom(zoom,centerX,centerY)
         {
             var tempX = flickable.width/2 - parent.x*zoom;
index 13e9526..d27cec6 100644 (file)
@@ -26,12 +26,185 @@ Rectangle{
 
     signal saveButtonClicked(string langFrom, string langTo);
 
+
+    id:rectangle1
     height: infoLabel.height + fromLabel.height + toLabel.height + saveButton.height + 50
     width: 200
+    color : myPalette.window;
 
-    id:rectangle1
+    SystemPalette {
+        id: myPalette;
+        colorGroup:SystemPalette.Active
+    }
+
+    Item {
+        id: comboField
+        anchors.bottomMargin: 6
+        anchors.rightMargin: 0
+        anchors.left: fromLabel.right
+        anchors.right: revertButton.left
+        anchors.bottom: saveButton.top
+        anchors.top: parent.top
+        anchors.leftMargin: 2
+        z:2;
+    }
+
+    Text {
+        id: infoLabel
+        height: paintedHeight+5;
+        anchors.right: parent.right
+        anchors.left: parent.left
+        anchors.top: parent.top
+        wrapMode: Text.Wrap;
+        transformOrigin: Item.Left
+        font.pixelSize: 12
+    }
+
+
+    Text {
+        id: fromLabel
+        text: qsTr("From: ")
+        height: paintedHeight+5;
+        anchors.top: infoLabel.bottom
+        anchors.left: parent.left
+        wrapMode: Text.Wrap;
+        transformOrigin: Item.Left
+        font.pixelSize: 12
+    }
+
+    Text {
+        id: toLabel
+        text: qsTr("To: ")
+        anchors.topMargin: 3
+        height: paintedHeight+5;
+        anchors.top: fromLabel.bottom
+        anchors.left: parent.left
+        wrapMode: Text.Wrap;
+        transformOrigin: Item.Left
+        font.pixelSize: 12
+    }
+
+    ComboBox{
+        id: comboFrom
+        model: comboBoxModel
+        anchors.right: revertButton.left
+        anchors.rightMargin: 5
+        anchors.left: fromLabel.right
+        anchors.leftMargin: 10
+        anchors.verticalCenter: fromLabel.verticalCenter
+
+        parentField: comboField
+        expanded: false
+        basicHeight: fromLabel.height
+        onExpandedChanged: {
+            if(expanded==true)
+                z=2;
+            else
+                z=0;
+        }
+    }
+
+    ComboBox{
+        id: comboTo
+        model:  comboBoxModel
+        anchors.right: revertButton.left
+        anchors.rightMargin: 5
+        anchors.left: fromLabel.right
+        anchors.leftMargin: 10
+        anchors.verticalCenter: toLabel.verticalCenter
+
+        parentField: comboField;
+        expanded: false
+        basicHeight: fromLabel.height
+
+        onExpandedChanged: {
+            if(expanded==true)
+                z=2;
+            else
+                z=0;
+        }
+    }
+
+    IconButton{
+        id: revertButton
+        width: height
+        height: fromLabel.height
+        anchors.top: fromLabel.bottom
+        anchors.topMargin: -8
+        anchors.right: parent.right
+        pathToIcon: "qrc:/button/revert.png"
+        onClicked: { rectangle1.revertLang() }
+    }
+
+    Button {
+        id: saveButton
+        height: 30
+        anchors.bottom: parent.bottom
+        anchors.right: parent.right
+        anchors.left: parent.left
+        onClicked: {
+            rectangle1.saveButtonClicked(comboFrom.value, comboTo.value);
+        }
+    }
+
+    MouseArea {
+        id: mouse_area1
+        anchors.fill: parent
+        z:-1
+        onClicked: {
+            comboTo.expanded=false;
+            comboFrom.expanded=false;
+        }
+    }
+
+
+
+    states: [
+        State {
+            name: "new"
+            when: newPlugin==true
+            PropertyChanges { target: saveButton; textInButton: qsTr("Add") }
+        },
+        State {
+            name: "edit"
+            when: newPlugin==false
+            PropertyChanges { target: saveButton; textInButton: qsTr("Save settings") }
+        }
+    ]
+}
+
+
+/*
+Rectangle{
+    property bool newPlugin:false;
+
+    function setInfo(string){
+        infoLabel.text = string;
+    }
+    function setStartValues(startFrom, startTo, startFromIndex, startToIndex){
+        comboFrom.setStartValue(startFrom, startFromIndex)
+        comboTo.setStartValue(startTo, startToIndex)
+    }
+    function revertLang(){
+        var tmpidx = comboFrom.index
+        comboFrom.index = comboTo.index
+        comboTo.index = tmpidx
 
+        var tmpval = comboFrom.value
+        comboFrom.value = comboTo.value
+        comboTo.value = tmpval
+    }
 
+    function setNew(bool){
+        newPlugin=bool;
+    }
+
+    signal saveButtonClicked(string langFrom, string langTo);
+
+
+    id:rectangle1
+    height: infoLabel.height + fromLabel.height + toLabel.height + saveButton.height + 50
+    width: 200
 
     SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
     color : myPalette.window;
@@ -72,6 +245,8 @@ Rectangle{
     }
 
     ComboBox{
+        //parentField: rectangle1
+
         id: comboFrom
         model: comboBoxModel
         anchors.left: parent.left
@@ -96,6 +271,7 @@ Rectangle{
     }
 
     ComboBox{
+        //parentField: rectangle1;
         id: comboTo
         model:  comboBoxModel
         anchors.left: parent.left
@@ -155,4 +331,5 @@ Rectangle{
         }
     ]
 }
+*/
 
index 19d3d70..37825a7 100644 (file)
@@ -4,10 +4,12 @@ Rectangle {
     id: rectangle
 
     property alias pathToIcon: image.source;
-    property int iconWidth:rectangle.width;
-    property int iconHeight:rectangle.height;
+    property int iconWidth:rectangle.width-8;
+    property int iconHeight:rectangle.height-8;
 
     signal clicked;
+    function press() { mouseArea.pressed }
+
     radius: 50
 
     MouseArea {
@@ -31,17 +33,16 @@ Rectangle {
 
     Image {
         id: image1
-        z: 1
         smooth: true
-        width: (35*parent.height)/107 +1
+        width:  (image1.sourceSize.width*parent.height)/image1.sourceSize.height +1 //(35*parent.height)/107 +1
         height: parent.height
         anchors.left: parent.left
         source: "qrc:/button/buttonLeft.png"
+        fillMode:Image.Stretch
     }
 
     Image {
         id: image3
-        z: 1
         smooth: true
         height: parent.height
         anchors.right: image2.left
@@ -49,18 +50,20 @@ Rectangle {
         anchors.left: image1.right
         anchors.leftMargin: -1
         source: "qrc:/button/buttonCenter.png"
+        fillMode:Image.Stretch
+        //fillMode: Image.TileHorizontally
 
     }
 
 
     Image {
         id: image2
-        z: 1
         smooth: true
-        width: (35*parent.height)/107 +1
+        width: (image1.sourceSize.width*parent.height)/image1.sourceSize.height +1//(35*parent.height)/107 +1
         height: parent.height
         anchors.right: parent.right
         source: "qrc:/button/buttonR.png"
+        fillMode:Image.Stretch
     }
 
 
@@ -78,6 +81,14 @@ Rectangle {
             PropertyChanges { target: image1; source: "qrc:/button/buttonLeftPushed.png" }
             PropertyChanges { target: image3; source: "qrc:/button/buttonCenterPushed.png" }
             PropertyChanges { target: image2; source: "qrc:/button/buttonRightPushed.png" }
+        },
+        State {
+            name: "focused";
+            when: (rectangle.enabled && !mouseArea.pressed && rectangle.focus)
+
+            PropertyChanges { target: image1; source: "qrc:/button/buttonLeftFocus.png" }
+            PropertyChanges { target: image3; source: "qrc:/button/buttonCenterFocus.png" }
+            PropertyChanges { target: image2; source: "qrc:/button/buttonRFocus.png" }
         }
     ]
 }
index 9f0d47c..a30ecba 100644 (file)
@@ -7,16 +7,22 @@ Rectangle {
     property int maxValue:500;
     property int minValue:0;
     property alias value:text_input1.text
+    property bool isTextInMinValue:true;
+    property string textInMinValue:"inf";
+    property int singleStep: 2;
 
     signal valueChange(int intiger);
 
     function stringToInt(string){
         var value=0;
         var pow10=1;
-        for (var i=string.length-1;i>=0;i--){
-            value+=(string.charCodeAt(i)-48)*pow10;
-            pow10= pow10*10;
-        }
+        if(isTextInMinValue && textInMinValue==string)
+            value=minValue;
+        else
+            for (var i=string.length-1;i>=0;i--){
+                value+=(string.charCodeAt(i)-48)*pow10;
+                pow10= pow10*10;
+            }
         if(value>maxValue)
             return maxValue;
         if(value<minValue)
@@ -24,6 +30,10 @@ Rectangle {
         return value;
     }
 
+    function setFocus(){
+        text_input1.focus=true;
+    }
+
     TextInput {
         id: text_input1
         x: 1
@@ -36,11 +46,25 @@ Rectangle {
         selectByMouse: true;
         font.pixelSize: rectangle1.height * .5;
         onCursorPositionChanged:  moveCursorSelection(cursorPosition);
-        onTextChanged: rectangle1.valueChange(stringToInt(text_input1.text));
+        onTextChanged:{
+            if(isTextInMinValue && text_input1.text!="" && stringToInt(text_input1.text)==minValue)
+                text_input1.text=textInMinValue;
+
+            rectangle1.valueChange(stringToInt(text_input1.text));
+        }
         onFocusChanged: {
             if(focus==false)
                text=stringToInt(text);
         }
+        Keys.onPressed: {
+            if (event.key == Qt.Key_Up)
+                text_input1.text=((stringToInt(text_input1.text)+singleStep)>maxValue)?(maxValue):(stringToInt(text_input1.text)+singleStep);
+            else if (event.key == Qt.Key_Down){
+                text_input1.text=((stringToInt(text_input1.text)-singleStep)<minValue)?(minValue):(stringToInt(text_input1.text)-singleStep);
+                if(isTextInMinValue && stringToInt(text_input1.text)==minValue)
+                    text_input1.text=textInMinValue
+            }
+        }
     }
 
     Timer {
@@ -50,7 +74,7 @@ Rectangle {
         repeat: true
         onTriggered:{
             if(mouseAreaUp.pressedButtons==Qt.LeftButton)
-                text_input1.text=((stringToInt(text_input1.text)+1)>maxValue)?(maxValue):(stringToInt(text_input1.text)+1);
+                text_input1.text=((stringToInt(text_input1.text)+singleStep)>maxValue)?(maxValue):(stringToInt(text_input1.text)+singleStep);
             else
                 running=false;
         }
@@ -62,8 +86,11 @@ Rectangle {
         running: false;
         repeat: true
         onTriggered:{
-            if(mouseAreaDown.pressedButtons==Qt.LeftButton)
-                text_input1.text=((stringToInt(text_input1.text)-1)<minValue)?(minValue):(stringToInt(text_input1.text)-1);
+            if(mouseAreaDown.pressedButtons==Qt.LeftButton){
+                text_input1.text=((stringToInt(text_input1.text)-singleStep)<minValue)?(minValue):(stringToInt(text_input1.text)-singleStep);
+                if(isTextInMinValue && stringToInt(text_input1.text)==minValue)
+                    text_input1.text=textInMinValue
+            }
             else
                 running=false;
         }
@@ -110,7 +137,7 @@ Rectangle {
         height: rectangle1.height/2;
         anchors.right: parent.right
         anchors.top: parent.top
-        onClicked: text_input1.text=((stringToInt(text_input1.text)+1)>maxValue)?(maxValue):(stringToInt(text_input1.text)+1);
+        onClicked: text_input1.text=((stringToInt(text_input1.text)+singleStep)>maxValue)?(maxValue):(stringToInt(text_input1.text)+singleStep);
         onPressAndHold:{
             timerUp.restart;
             timerUp.running=true;
@@ -124,19 +151,21 @@ Rectangle {
         height: rectangle1.height/2;
         anchors.right: parent.right
         anchors.bottom: parent.bottom
-        onClicked: text_input1.text=((stringToInt(text_input1.text)-1)<minValue)?(minValue):(stringToInt(text_input1.text)-1);
+        onClicked:{
+            text_input1.text=((stringToInt(text_input1.text)-singleStep)<minValue)?(minValue):(stringToInt(text_input1.text)-singleStep);
+            if(isTextInMinValue && stringToInt(text_input1.text)==minValue)
+                text_input1.text=textInMinValue
+        }
         onPressAndHold:{
             timerDown.restart;
             timerDown.running=true;
         }
     }
-
-   /* states: [
+    states: [
         State {
-            name: "DisableState"; when: rectangle1.enabled==false;
-            PropertyChanges { target: shadeDisable; z: 3; opacity: 0.5 }
+            name: "focusState"; when: text_input1.focus && rectangle1.enabled;
+            PropertyChanges { target: rectangle1; border.width: 2 }
         }
     ]
-    */
 }
 
index 2514185..004e198 100644 (file)
@@ -5,10 +5,37 @@ Rectangle {
     radius: 10
     border.color: "#000666";
     property alias textInLineEdit:text_input1.text
+    property bool useCompleter:false
 
     signal enterPressed(string text);
+    signal textChange(string text);
+
+    signal nextCompleter();
+    signal prevCompleter();
+
+    signal isFocused();
+    signal checkFocus();
 
     function setText(string) { textInLineEdit = string; }
+    function setCompleter(string) { completerItemText.text=string; }
+    function hideCompleter() { completerItem.visible=false; }
+
+    function addOneChar(){
+        if(completerItemText.text.length>0)
+            text_input1.text=text_input1.text+completerItemText.text.charAt(0);
+    }
+
+    function addAllChars(){
+        text_input1.text=text_input1.text+completerItemText.text;
+        completerItemText.text="";
+    }
+
+    function setFocus(){
+        if(rectangle1.enabled){
+            text_input1.focus=true;
+            isFocused();
+        }
+    }
 
     TextInput {
         id: text_input1
@@ -19,11 +46,58 @@ Rectangle {
         anchors.centerIn: parent
         selectByMouse: true;
         font.pixelSize: rectangle1.height * .5;
-        onCursorPositionChanged:  moveCursorSelection(cursorPosition);
-        focus: rectangle1.focus;
+        onCursorPositionChanged: {
+            moveCursorSelection(cursorPosition);
+            if(cursorPosition==text.length && useCompleter)
+                completerItem.visible=true;
+            else
+               completerItem.visible=false;
+        }
+        Keys.priority : Keys.AfterItem
         Keys.onPressed: {
-            if ((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return))
+            if ((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return)){
                 rectangle1.enterPressed(text_input1.text)
+                completerItem.visible=false;
+            }
+            if(useCompleter){
+                if (event.key == Qt.Key_Up)
+                    rectangle1.nextCompleter();
+                if (event.key == Qt.Key_Down)
+                    rectangle1.prevCompleter();
+                if ((event.key == Qt.Key_Right) && (cursorPosition==text.length))
+                    addOneChar();
+                if(Qt.ControlModifier){
+                    if (event.key == Qt.Key_Space){
+                        if(completerItem.visible=false)
+                            completerItem.visible=true
+                        else
+                            addAllChars()
+                    }
+                }
+                if(event.key == Qt.Key_Escape)
+                    completerItem.visible=false;
+            }
+        }
+        onTextChanged: rectangle1.textChange(text);
+        onFocusChanged: if(focus) isFocused();
+        onActiveFocusChanged: rectangle1.checkFocus();
+    }
+
+
+    Rectangle {
+        id: completerItem
+        x: text_input1.x + text_input1.positionToRectangle(text_input1.cursorPosition).x +1
+        y: text_input1.y
+        width: completerItemText.paintedWidth;
+        visible: false;
+        height: text_input1.height
+        color: (completerItemText.text.length>0)?"#5e71fb":"#FFFFFF"
+        opacity: 0.5
+        Text {
+            id: completerItemText
+            anchors.fill: parent
+            text:""
+            font.pixelSize: text_input1.font.pixelSize;
         }
     }
 
@@ -39,14 +113,14 @@ Rectangle {
 
     states: [
         State {
-            name: "FokusState"; when: text_input1.focus==true && rectangle1.enabled==true;
+            name: "FokusState"; when: text_input1.focus && rectangle1.enabled;
             PropertyChanges {
                 target: rectangle1
                 border.width: 3
             }
         },
         State {
-            name: "DisableState"; when: rectangle1.enabled==false;
+            name: "DisableState"; when: !rectangle1.enabled;
             PropertyChanges { target: shadeDisable; z: 3; opacity: 0.5 }
         }
     ]
index 2a0de49..ee4b051 100644 (file)
@@ -48,6 +48,7 @@ Rectangle {
 
         Behavior on position {
             SequentialAnimation{
+                id: infinite_animaction;
                 loops:  (value>-1)?0:Animation.Infinite
                 SmoothedAnimation { velocity:450 ; to: progressBar.width - 96}
                 SmoothedAnimation { velocity: 450 ; to: 6 }
index 689480d..6590e45 100644 (file)
@@ -6,19 +6,75 @@ Rectangle {
     color : myPalette.window;
 
     property alias enableLineEdit: inputSearchText.enabled;
+    property int focusIndex:-1;
+
 
     function setButtonText(string) { searchButton.setText(string) }
     function setEnableHistoryPrev(Boolean) { historyPrevToolButton.enabled = Boolean }
     function setEnableHistoryNext(Boolean) { historyNextToolButton.enabled = Boolean }
     function setEnableHistoryShow(Boolean) { historyShowToolButton.enabled = Boolean }
     function setEnableLineEdit(Boolean) { enableLineEdit = Boolean }
-    function setLineEditText(string) { inputSearchText.setText(string) }
     function clear() { inputSearchText.setText("") }
 
+    function setLineEditText(string) { inputSearchText.setText(string) }
+    function setCompleterText(string) { inputSearchText.setCompleter(string) }
+
+    function setFocus(){
+        if(focusIndex==0){
+            inputSearchText.setFocus();
+            if(!inputSearchText.enabled)
+                focusIndex++;
+        }
+        if(focusIndex==1)
+            clearButton.focus=true;
+
+        if(focusIndex==2){
+            searchButton.focus = true
+            if(!searchButton.enabled)
+                focusIndex++;
+        }
+
+        if(focusIndex==3){
+            historyPrevToolButton.focus = true
+            if(!historyPrevToolButton.enabled)
+                focusIndex++;
+        }
+
+        if(focusIndex==4){
+            historyShowToolButton.focus = true
+            if(!historyShowToolButton.enabled)
+                focusIndex++;
+        }
+
+        if(focusIndex==5){
+            historyNextToolButton.focus = true
+            if(!historyNextToolButton.enabled)
+                focusIndex++;
+        }
+
+        if (focusIndex>5){
+            nextFocus();
+            focusIndex=-1;
+            focus=true;
+        }
+    }
+
+    function focusOff(){ focus=true; focusIndex=-1;}
+
+    signal nextFocus();
+    signal checkFocus();
     signal searchButtonClicked(string text);
     signal historyNextToolButtonClicked;
     signal historyShowToolButtonClicked;
     signal historyPrevToolButtonClicked;
+    signal textChange(string text);
+    signal nextCompleter();
+    signal prevCompleter();
+
+    Keys.onTabPressed: {
+        focusIndex++;
+        setFocus();
+    }
 
     MyTextLineEdit{
         id: inputSearchText
@@ -27,7 +83,7 @@ Rectangle {
         anchors.left: parent.left
         anchors.verticalCenter: parent.verticalCenter
         onEnterPressed: searchBarWidget.searchButtonClicked(text);
-        focus: searchBarWidget.focus
+        useCompleter: true;
         IconButton {
             id: clearButton;
             width:  inputSearchText.height-6;
@@ -38,7 +94,13 @@ Rectangle {
             enabled: true;
             pathToIcon: "qrc:/button/go-clear.png";
             onClicked: clear();
+            onActiveFocusChanged:searchBarWidget.checkFocus();
         }
+        onTextChange: searchBarWidget.textChange(text)
+        onNextCompleter: searchBarWidget.nextCompleter();
+        onPrevCompleter: searchBarWidget.prevCompleter();
+        onIsFocused: searchBarWidget.focusIndex=0;
+        onCheckFocus: searchBarWidget.checkFocus();
     }
 
     Item {
@@ -56,7 +118,11 @@ Rectangle {
             anchors.right: historyPrevToolButton.left
             anchors.verticalCenter: parent.verticalCenter
             textInButton: qsTr("Search")
-            onClicked: searchBarWidget.searchButtonClicked(inputSearchText.textInLineEdit);
+            onClicked:{
+                searchBarWidget.searchButtonClicked(inputSearchText.textInLineEdit);
+                inputSearchText.hideCompleter();
+            }
+            onActiveFocusChanged:searchBarWidget.checkFocus();
         }
 
         IconButton {
@@ -68,6 +134,7 @@ Rectangle {
             enabled: true;
             pathToIcon: "qrc:/button/go-next.png";
             onClicked: searchBarWidget.historyNextToolButtonClicked();
+            onActiveFocusChanged:searchBarWidget.checkFocus();
         }
 
         IconButton {
@@ -80,6 +147,7 @@ Rectangle {
             enabled: true;
             pathToIcon: "qrc:/button/go-show.png";
             onClicked: searchBarWidget.historyShowToolButtonClicked();
+            onActiveFocusChanged:searchBarWidget.checkFocus();
         }
 
         IconButton {
@@ -92,6 +160,7 @@ Rectangle {
             enabled: true;
             pathToIcon: "qrc:/button/go-previous.png";
             onClicked: searchBarWidget.historyPrevToolButtonClicked();
+            onActiveFocusChanged:searchBarWidget.checkFocus();
         }
     }
 }
index 74d3a9f..5f32049 100644 (file)
@@ -7,6 +7,9 @@ Rectangle {
 
     SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
     color : myPalette.window;
+    focus: true;
+    property int focusIndex:-1;
+
 
     signal historySizeValueChanged(int intiger);
     signal searchResulValueChanged(int intiger);
@@ -40,6 +43,42 @@ Rectangle {
     function setCheckedDictionaries(bool){
         dictionariesCheckBox.selected=bool;
     }
+    function setFocus(){
+        if(focusIndex==0){
+            searchSpinbox.setFocus();
+            if(!searchSpinbox.enabled)
+                focusIndex++;
+        }
+        if(focusIndex==1){
+            historySpinbox.setFocus();
+            if(!historySpinbox.enabled)
+                focusIndex++;
+        }
+        if(focusIndex==2){
+            bookmarkCheckBox.focus = true
+            if(!bookmarkCheckBox.enabled)
+                focusIndex++;
+        }
+        if(focusIndex==3){
+            dictionariesCheckBox.focus = true
+            if(!dictionariesCheckBox.enabled)
+                focusIndex++;
+        }
+        if(focusIndex==4){
+            saveButton.focus = true
+            if(!saveButton.enabled)
+                focusIndex++;
+        }
+        if(focusIndex>4){
+            focusIndex=-1;
+            focus=true;
+        }
+    }
+
+    Keys.onTabPressed: {
+        focusIndex++;
+        setFocus();
+    }
 
     Text {
         id: textSearch
@@ -107,6 +146,7 @@ Rectangle {
         anchors.left: textSearch.right
         anchors.leftMargin: 20
         onValueChange: rectangle1.searchResulValueChanged(intiger);
+        onFocusChanged: if(focus) focusIndex=0;
     }
 
     MySpinBox {
@@ -117,6 +157,7 @@ Rectangle {
         anchors.top: searchSpinbox.bottom
         anchors.topMargin: 10
         onValueChange: rectangle1.historySizeValueChanged(intiger);
+        onFocusChanged: if(focus) focusIndex=1;
     }
 
     Checkbox {
@@ -128,6 +169,7 @@ Rectangle {
         anchors.top: textSearchIn.bottom
         anchors.topMargin: 0
         onChanged: rectangle1.bookmarksCheckBoxChanged(selected);
+        onFocusChanged: if(focus) focusIndex=2;
     }
 
     Checkbox {
@@ -138,6 +180,7 @@ Rectangle {
         anchors.top: bookmarkCheckBox.bottom
         anchors.topMargin: 3
         onChanged: rectangle1.dictionariesCheckBoxChanged(selected);
+        onFocusChanged: if(focus) focusIndex=3;
     }
 
     Button {
@@ -150,5 +193,6 @@ Rectangle {
         anchors.rightMargin: 5
         textInButton: qsTr("Save")
         onClicked: rectangle1.saveButtonClicked();
+        onFocusChanged: if(focus) focusIndex=4;
     }
 }
index 2291d11..b283f61 100644 (file)
@@ -34,7 +34,6 @@ Rectangle{
     SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
     color : myPalette.window;
 
-
     Text {
         id: textInfo
         text: "Tekst: "
index c07d8a5..5957c85 100644 (file)
@@ -10,160 +10,273 @@ Rectangle {
     anchors.fill: parent
 
     signal dictLink(string link);
+    signal fromChange(string value);
+    signal toChange(string value)
 
-    ScrollBar2 {
-        id: horizontalScrollBar1
-        z:2;
-        width: parent.width-12;
-        windowHeight: parent.height
-        anchors.left: parent.left
-        orientation: Qt.Horizontal
-        position: 100
+
+    function setFromStartValues(startFrom, startTo, startFromIndex, startToIndex){
+        comboFrom.setStartValue(startFrom, startFromIndex)
+        comboTo.setStartValue(startTo, startToIndex)
+    }
+
+    function setToStartValues(startFrom, startTo, startFromIndex, startToIndex){
+        comboFrom.setStartValue(startFrom, startFromIndex)
+        comboTo.setStartValue(startTo, startToIndex)
     }
-    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
+
+    MouseArea {
+        id: mouse_area1
+        anchors.fill: parent
+        z:-1
+        onClicked: {
+            comboTo.expanded=false;
+            comboFrom.expanded=false;
+        }
     }
-    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
+
+    ComboBox {
+        id: comboFrom
+        model: fromModell
+        anchors.right: comboFromField.right
+        anchors.left: comboFromField.left
+        parentField: comboFromField
+        expanded: false
+        height: 20
+        basicHeight:20
+        index: 1
+        onExpandedChanged: {
+            if(expanded==true){
+                z=2;
+                mouse_area1.z=1;
+            }
+            else{
+                z=0;
+                mouse_area1.z=-1;
+            }
+       }
+       onValueSelected: rectangle1.fromChange(value)
     }
 
-    ElementsListView{
-        id: dictList
-        width: rectangle1.width
+    ComboBox {
+        id: comboTo
+        model: fromModell
+        anchors.right: comboToField.right
+        anchors.left: comboToField.left
+        parentField: comboToField
+        expanded: false
+        height: 20
+        basicHeight:20
+        index: 1
+        onExpandedChanged: {
+            if(expanded==true){
+                z=2;
+                mouse_area1.z=1;
+            }
+            else{
+                z=0;
+                mouse_area1.z=-1;
+            }
+       }
+       onValueSelected: rectangle1.toChange(value)
+    }
+
+    Item {
+        id: comboFromField
+        width: 120
+        anchors.left: fromLabel.right
+        anchors.leftMargin: 5
+        anchors.bottom: parent.bottom
+        anchors.bottomMargin: 10
         anchors.top: parent.top
+    }
+
+    Item {
+        id: comboToField
+        width: 120
+        anchors.left: toLabel.right
+        anchors.leftMargin: 5
         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" } }
+        anchors.bottomMargin: 10
+        anchors.top: parent.top
+    }
 
-                        Text {
-                            id: fromTextHeader
-                            text: qsTr("From");
-                            elide: Text.ElideRight
-                            font.pixelSize: 12
-                            anchors.centerIn: parent
+    Text {
+        id: fromLabel
+        text: qsTr("From: ");
+        anchors.top: parent.top
+        anchors.topMargin: 3
+        font.pixelSize: 12
+    }
+
+    Text {
+        id: toLabel
+        text: qsTr("To: ");
+        anchors.left: comboFrom.right
+        anchors.leftMargin: 15
+        anchors.verticalCenterOffset: 0
+        anchors.verticalCenter: fromLabel.verticalCenter
+        font.pixelSize: 12
+    }
+
+    Item {
+        id: item1
+        anchors.topMargin: 30
+        anchors.fill: parent
+        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.topMargin: 0
+            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" } }
+                        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
+                            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" } }
+                        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
+                            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" } }
+                        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
+                            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
+            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: 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
+                        Text {
+                            id: nameText
+                            text: " "+name+" ";
+                            width:  horizontalScrollBar3.position
+                            elide: Text.ElideRight
+                        }
+                        Text {
+                            id: sizeText
+                            text: " "+size+" ";
+                            width:  100
+                            elide: Text.ElideRight
+                        }
                     }
                 }
             }
+            model: dictModel
         }
-        model: dictModel
     }
 }
index c0a546a..79cd850 100644 (file)
@@ -18,6 +18,7 @@ Rectangle {
         id: webView
         width:parent.width
         height:parent.height
+        url:"file:///home/jakub/test.html";
         anchors { top: headerSpace.bottom; left: parent.left; right: parent.right; bottom: parent.bottom }
     }
 
index 742cf49..4cd5f97 100644 (file)
@@ -25,6 +25,9 @@
 import Qt 4.7
 
 Rectangle {
+    id: rectangle1
+    color: myPalette.base
+    anchors.fill: parent
 
     function changeWordState(nr, state) {
         wordList.currentIndex = nr
@@ -43,13 +46,10 @@ Rectangle {
 
     signal wordSelected(string word);
     signal wordSelectedByIndex(int nr);
+    signal checkFocus();
 
     SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
 
-    id: rectangle1
-    color: myPalette.base
-    anchors.fill: parent
-
     ElementsListView{
         id: wordList
         width: rectangle1.width
@@ -69,6 +69,8 @@ Rectangle {
         delegate: Component{
             id: wordListDelegate
             Item {
+                onActiveFocusChanged: rectangle1.checkFocus();
+
                 width: rectangle1.width
                 height: {
                     if (wordText.height + 4 > check.height)
@@ -76,11 +78,11 @@ Rectangle {
                     else
                             return check.height;
                 }
-
                 MouseArea{
                     anchors.fill: parent
-                    onClicked: {
-                        wordList.currentIndex = index
+                    onClicked: wordList.currentIndex = index 
+                    onDoubleClicked: {
+                        wordList.currentIndex = number
                         rectangle1.wordSelected(word)
                     }
                 }
@@ -100,13 +102,12 @@ Rectangle {
                     pathToUncheckedImage: UncheckedPath
                     anchors.right: parent.right
                     anchors.rightMargin: 5
-
+                    pathToCheckedDicImage: CheckedPath
+                    pathToUncheckedDicImage: UncheckedPath
                     anchors.verticalCenter: parent.verticalCenter
                     onChanged: rectangle1.changeWordState(number, selected)
                 }
-
             }
-
         }
 
         Text {
@@ -150,4 +151,12 @@ Rectangle {
             }
         ]
     }
+
+    states: [
+            State {
+                name: "noFocus";
+                when: ((!wordList.focus) && (!rectangle1.focus))
+                PropertyChanges { target: wordList.highlightItem; opacity:0}
+           }
+    ]
 }
index e16180b..1b2a960 100644 (file)
@@ -96,7 +96,7 @@ Rectangle{
     Text {
         id: textInfo
         width: rectangle1.width
-        height: paintedHeight+5;
+        height: (paintedHeight+5)>150?150:paintedHeight+5;
         text: ": "
         wrapMode: Text.Wrap;
         anchors.top: textDescription.bottom
@@ -105,13 +105,26 @@ Rectangle{
         font.pixelSize: 12
     }
 
+
+    Rectangle {
+        anchors.right: parent.right
+        anchors.left: parent.left
+        anchors.bottom: saveButton.bottom
+        anchors.top: optimalizeCheckbox.top
+
+        id: rectangle2
+        color: myPalette.window
+        anchors.topMargin: -2
+    }
+
     Checkbox {
         id: optimalizeCheckbox
         width: 20
         height: 20
+        anchors.bottom: stripCheckbox.top
+        anchors.bottomMargin: 5
         anchors.left: parent.left
         anchors.leftMargin: 5
-        anchors.top: textInfo.bottom
         onChanged: rectangle1.optimalizeCheckboxChanged(selected);
     }
 
@@ -119,8 +132,8 @@ Rectangle{
         id: stripCheckbox
         width: 20
         height: 20
-        anchors.top: optimalizeCheckbox.bottom
-        anchors.topMargin: 5
+        anchors.bottom: saveButton.top
+        anchors.bottomMargin: 15
         anchors.horizontalCenter: optimalizeCheckbox.horizontalCenter
         onChanged: rectangle1.stripCheckboxChanged(selected);
     }
@@ -151,9 +164,8 @@ Rectangle{
     Button {
         id: saveButton
         height: 30
+        anchors.bottom: parent.bottom
         textInButton: qsTr("Save")
-        anchors.top: stripCheckbox.bottom
-        anchors.topMargin: 10
         anchors.right: parent.right
         anchors.left: parent.left
         onClicked: rectangle1.saveButtonClicked();
@@ -200,6 +212,7 @@ Rectangle{
         onClicked: rectangle1.downloadButtonClicked();
     }
 
+
     states: [
         State {
             name: "Stan1"
index 5bf2ca7..69a47f0 100644 (file)
@@ -29,7 +29,6 @@
 
 XdxfDictDownloadProgressDialog::XdxfDictDownloadProgressDialog(QWidget*parent):
     QDialog(parent) {
-qDebug()<<"etap 01";
 #ifndef Q_WS_MAEMO_5
     view= new QDeclarativeView();
     view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/XdxfDictDownloader.qml"));
@@ -85,7 +84,6 @@ qDebug()<<"etap 01";
 
 
 void XdxfDictDownloadProgressDialog::show() {
-qDebug()<<"etap 02";
 #ifndef Q_WS_MAEMO_5
     emit setMaximumValue(0);
     maximumValue=0;
@@ -98,8 +96,6 @@ qDebug()<<"etap 02";
 
 
 void XdxfDictDownloadProgressDialog::setText(QString text) {
-qDebug()<<"etap 03";
-
 #ifndef Q_WS_MAEMO_5
     emit setTextt(text);
 #else
@@ -109,7 +105,6 @@ qDebug()<<"etap 03";
 
 
 void XdxfDictDownloadProgressDialog::updateProgress(float progress) {
-qDebug()<<"etap 04";
 #ifndef Q_WS_MAEMO_5
     if(maximumValue == 0) {
         emit setMaximumValue(100);
@@ -125,9 +120,10 @@ qDebug()<<"etap 04";
 
 
 void XdxfDictDownloadProgressDialog::reject() {
-qDebug()<<"etap 05";
+    qDebug("tu");
     #ifndef Q_WS_MAEMO_5
-        Q_EMIT cancelDownloading();
+        emit cancelDownloading();
+        emit setValue(-1);
     #else
         return;
     #endif
index 9995e9c..2b41d0b 100644 (file)
@@ -71,8 +71,6 @@ void XdxfDictDownloader::download(QWidget *parent) {
             this, SLOT(breakDownloading()));
     connect(this, SIGNAL(downloadProgress(float)),
             progressDialog, SLOT(updateProgress(float)));
-
-    qDebug()<<"etam 3.1";
     progressDialog->setText(tr("Downloading dictionaries list"));
     progressDialog->show();
 }
@@ -99,7 +97,6 @@ void XdxfDictDownloader::breakDownloading() {
     //if user cancel downloading we kill all running processes, hide progress dialog and set flag that user cancel downloading.
     aborted = true;
     http.kill();
-
     if(progressDialog && progressDialog->isVisible()) {
         progressDialog->accept();
     }
index d1575e4..42c1ca8 100644 (file)
@@ -32,9 +32,7 @@ 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")){
@@ -46,11 +44,37 @@ XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
 #ifndef Q_WS_MAEMO_5
     model2 = new DictsListModel(dicts, this);
     proxyModel2 = new DictsProxyListModel;
-    proxyModel2->setSourceModel(model2);
-    proxyModel2->setTo("Polish");
+    proxyModel2->setSourceModel(model2);;
     view= new QDeclarativeView();
     QDeclarativeContext* ctxt=view->rootContext();
     ctxt->setContextProperty("dictModel", proxyModel2);
+
+    QSet<QString> languagesFrom;
+    for(int i=0; i < model2->rowCount(QModelIndex()); i++)
+        languagesFrom.insert(model2->data(model2->index(i, 0),DictsListModel::FromRole).toString());
+    languagesFrom.remove(QString());
+    QStringList langFromList = languagesFrom.toList();
+    qSort(langFromList);
+    QList<QString> langListFrom;
+    langListFrom.append(tr("Any"));
+    foreach(QString lang,langFromList)
+        langListFrom.append(lang);
+    fromModel = new ComboBoxModel(langListFrom);
+    ctxt->setContextProperty("fromModell", fromModel);
+
+    QSet<QString> languagesTo;
+    for(int i=0; i < model2->rowCount(QModelIndex()); i++)
+        languagesTo.insert(model2->data(model2->index(i, 0),DictsListModel::ToRole).toString());
+    languagesTo.remove(QString());
+    QStringList langToList = languagesTo.toList();
+    qSort(langToList);
+    QList<QString> langListTo;
+    langListTo.append(tr("Any"));
+    foreach(QString lang,langToList)
+        langListTo.append(lang);
+    toModel = new ComboBoxModel(langListTo);
+    ctxt->setContextProperty("toModell", toModel);
+
     view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/TableWidget.qml"));
     view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
     view->setAlignment(Qt::AlignCenter);
@@ -58,12 +82,16 @@ XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
     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)));
+    connect(rootObject,SIGNAL(fromChange(QString)),
+            this,SLOT(fromChange(QString)));
+    connect(rootObject,SIGNAL(toChange(QString)),
+            this,SLOT(toChange(QString)));
+
 #else
 
     layout = new QVBoxLayout;
@@ -135,6 +163,19 @@ XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
     #endif
 }
 
+void XdxfDictSelectDialog::toChange(QString lang){
+    if(lang!=tr("Any"))
+        proxyModel2->setTo(lang);
+    else
+        proxyModel2->setTo("");
+}
+
+void XdxfDictSelectDialog::fromChange(QString lang){
+    if(lang!=tr("Any"))
+        proxyModel2->setFrom(lang);
+    else
+        proxyModel2->setFrom("");
+}
 
 void XdxfDictSelectDialog::initializeDicts() {
     //scan of all languages of dictionaries, using QSet to get only distinct languages
@@ -202,7 +243,9 @@ void XdxfDictSelectDialog::itemClicked(QString link) {
 }
 
 void XdxfDictSelectDialog::itemClicked(QModelIndex index) {
-#ifdef Q_WS_MAEMO_5
+#ifndef Q_WS_MAEMO_5
+    index;
+#else
     _link = index.model()->data(index, Qt::UserRole).toString();
     accept();
 #endif
index cbf0d04..fad43b5 100644 (file)
 #include <QDir>
 #include <QDeclarativeView>
 #include <QDeclarativeContext>
+#include <QList>
 
 #include "DownloadDict.h"
 #include "DictsListModel.h"
 #include "DictsModel.h"
 #include "DictsProxyModel.h"
 #include "DictsProxyListModel.h"
+#include "../../include/ComboBoxModel.h"
 
 
 /*!
@@ -77,11 +79,16 @@ private Q_SLOTS:
 
     void itemClicked(QString link);
 
+    void toChange(QString lang);
+    void fromChange(QString lang);
+
 private:
     QVBoxLayout* mainLayout;
     QDeclarativeView *view;
     DictsListModel* model2;
     DictsProxyListModel *proxyModel2;
+    ComboBoxModel *fromModel;
+    ComboBoxModel *toModel;
 
     QTreeView* treeView;
     DictsModel* model;
index d285b44..1c52b1d 100644 (file)
@@ -29,7 +29,8 @@ SOURCES += xdxfplugin.cpp \
     XdxfDictDownloadProgressDialog.cpp \
     DictsModel.cpp \
     HttpDownloader.cpp \
-    DictsListModel.cpp
+    DictsListModel.cpp \
+    ../../include/ComboBoxModel.cpp
 
 HEADERS += xdxfplugin.h \
     TranslationXdxf.h \
@@ -38,6 +39,7 @@ HEADERS += xdxfplugin.h \
     ../../include/translation.h \
     ../../include/settings.h \
     ../../include/CommonDictInterface.h \
+    ../../include/ComboBoxModel.h \
     XdxfCachingDialog.h \
     XdxfDialog.h \
     XdxfDictDownloader.h \
index 2626590..892afa3 100644 (file)
@@ -31,7 +31,7 @@
 <div id="webContainer">
        <div id="topBar">
                <img src="images/mLogo_ie24.png" style="float:left;"></img>
-       <!--    <div class="installs">
+<!--   <div class="installs">
                        INSTALL:
                        <a href="files/mdictionary.install"
                           class="install" style="margin-top:4px;"
@@ -72,8 +72,6 @@
                </div>
        </div>
        <div id="contentContainer">
-
-
                <h1>Developer's HOWTO:<br />making Your own plugin</h1>
                        The manual is available <a href="files/doc-plugin.1.0.4.odt">here</a>
 
@@ -89,7 +87,6 @@
        
 <div class="code">dbus_data = ws_dbus_create ("mDictionaryGui", "v1.0");</div>
 <p>
-Then You configure the remote and local addresses, by using <span class="code">ws_dbus_config</span>. The settings should be the same as in the example, below:
 
 </p>
 <div class="code">ws_dbus_config( dbus_data,
index 33ccaa1..9b7ab96 100644 (file)
Binary files a/www/images/Meego.png and b/www/images/Meego.png differ
index b3235be..7e9dd87 100644 (file)
Binary files a/www/images/qml/w07.png and b/www/images/qml/w07.png differ
index 8969b14..8afc38f 100644 (file)
 <div id="webContainer">
        <div id="topBar">
                <img src="images/mLogo_ie24.png" style="float:left;"></img>
+<<<<<<< HEAD
+       <div class="installs">
+=======
 <!--   <div class="installs">
+>>>>>>> 21a14d392f44458d749c76552e971f33625705ea
                INSTALL:
                <a href="files/mdictionary.install"
                   class="install" style="margin-top:4px;"
                </a>
                <span style="clear:both;text-align:center;display:block;font-size:9px;"><a href="howto.html" style="font-size:9px;text-decoration:none;">(read How To... first)</a></span>
        </div>
+<<<<<<< HEAD
+               <div style="display:block;height:100px;">
+=======
 -->            <div style="display:block;height:100px;">
+>>>>>>> 21a14d392f44458d749c76552e971f33625705ea
                        <p class="title">
                                mDictionary
                        </p>
@@ -141,8 +149,12 @@ When we created a graphic user interface we prepared a few basic components <br/
                        <div class="faq_switcher" onClick="javascript:faq_switcher(this);"></div>
                        Combobox
                        <div class="qml_answer">
+<<<<<<< HEAD
+                               <p> text </p>
+=======
                                <p> ComboBox component allows to select one text item from the dropdown list, In the non-expanded state displays the currently selected item, when you expand it is possible to return without selecting a new element by clicking arrow at the component's right edge. You can use any set of text elements as a data model, as well as the change in size (it can be extended to the width). </p>
                                <img src="images/qml/cb01.png" ></img>
+>>>>>>> 21a14d392f44458d749c76552e971f33625705ea
                        </div>
                </div>
                <div class="faq_question">
@@ -190,7 +202,11 @@ When we created a graphic user interface we prepared a few basic components <br/
                        <div class="faq_switcher" onClick="javascript:faq_switcher(this);"></div>
                        WebView
                        <div class="qml_answer">
+<<<<<<< HEAD
+                               <p> text </p>
+=======
                                <p> This component uses a WebView from QtQuick. It is responsible for displaying html pages formatted using CSS. It has a zoom option, available by two buttons at the bottom right corner. The screen is also movable, the user by touch is able to move screen in all directions </p>
+>>>>>>> 21a14d392f44458d749c76552e971f33625705ea
                                <img src="images/qml/wv01.png" width="460"></img>
                        </div>
                </div>
@@ -214,7 +230,10 @@ When we created a graphic user interface we prepared a few basic components <br/
                                <img src="images/qml/w02.png"></img>
                                <img src="images/qml/w04.png"></img>
                                <img src="images/qml/w06.png"></img>
+<<<<<<< HEAD
+=======
                                <img src="images/qml/w07.png"></img>
+>>>>>>> 21a14d392f44458d749c76552e971f33625705ea
                                <img src="images/qml/widget01.png"></img>
                                <img src="images/qml/widget02.png" width="460"></img>
                        </div>