From 0eb244df0da2ac95f6868d7a77cf190c1ca49a11 Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 17 Dec 2010 16:41:38 +0100 Subject: [PATCH] serachBar + progressBar --- data/button/go-previous.png | Bin 0 -> 1135 bytes data/gui.qrc | 1 + src/mdictionary/gui/AboutWidget.cpp | 1 + src/mdictionary/gui/AboutWidget.h | 2 +- src/mdictionary/gui/MainWindow.cpp | 5 +- src/mdictionary/gui/SearchBarWidget.cpp | 169 +++++++++++++++++++++---------- src/mdictionary/gui/SearchBarWidget.h | 17 ++++ src/mdictionary/mdictionary.pro | 8 +- src/mdictionary/qml/AboutWidget.qml | 17 ---- src/mdictionary/qml/Button.qml | 73 ++++++++++++- src/mdictionary/qml/MyTextLineEdit.qml | 34 +++++++ src/mdictionary/qml/ProgressBar.qml | 48 +++++++++ src/mdictionary/qml/SearchBarWidget.qml | 45 +++++--- src/plugins/google/GooglePlugin.cpp | 1 + 14 files changed, 328 insertions(+), 93 deletions(-) create mode 100644 data/button/go-previous.png create mode 100644 src/mdictionary/qml/ProgressBar.qml diff --git a/data/button/go-previous.png b/data/button/go-previous.png new file mode 100644 index 0000000000000000000000000000000000000000..44e803d51f6714431d65d308340cf401d148cd00 GIT binary patch literal 1135 zcmV-#1d#iQP)%VuRI+#`s`wP!_1-CD3B4ZNz9&AvUem2OG-eQAxDwgQbZN z8Z{;~F)>On5KT3)jn!&VOsc^I0TU5Ji9!(yg}u$iIkWR{LbMBL`^1<1oo_RHa=zbw z-_ALUrC8#>QryUDN*X+kMFz#v6(Z<0N~nmprp~;l<6(+dG67d)~qWm<8t0w6s+zL$R;(gDBVQmPW3XWr6hQo=v}h_!_D5o~6?52g zwbt_&2siM3IoY|byDIB5Cf>U8^G6Qj457d@H&)A*+ti~R~_ z1Sm_grJ%u9)IQ3N!DWL$GD{5?G=NHZC;a^^#x4zrYEjeEIyp5_S^eP7&~Wre49$F> zlrZ>XcnzTZ0UK9SDUB%(@H5<`fkHq+3h* zED(Y2Xou=OCePebp4i$ckG&t>Sa#!v4Nq|Bpa67Gd=3dGC+G8rM7wsy0y*k4_?74% zIFYFM`rEVTPJVVWD&i_2V2M~@R+`cFHpMy9d&%lfKv&WqPcWZPZMVDBLzX7||Ie2&`f6D*>002ovPDHLkV1f*s B3oZZv literal 0 HcmV?d00001 diff --git a/data/gui.qrc b/data/gui.qrc index d01ab42..bb4db8a 100644 --- a/data/gui.qrc +++ b/data/gui.qrc @@ -14,5 +14,6 @@ button/buttonCenter.png button/buttonLeft.png button/buttonR.png + button/go-previous.png diff --git a/src/mdictionary/gui/AboutWidget.cpp b/src/mdictionary/gui/AboutWidget.cpp index daae50d..b422a39 100644 --- a/src/mdictionary/gui/AboutWidget.cpp +++ b/src/mdictionary/gui/AboutWidget.cpp @@ -44,6 +44,7 @@ AboutWidget::AboutWidget(GUIInterface *parent): QDialog(parent) QGraphicsObject *rootObject = view->rootObject(); connect(rootObject, SIGNAL(linkClicked(QString)), this, SLOT(openUrl(QString))); this->setLayout(mainLayout); + #else setModal(true); QString infoNote, licenseNote, comarchNote; diff --git a/src/mdictionary/gui/AboutWidget.h b/src/mdictionary/gui/AboutWidget.h index 8fee222..6bf4d3e 100644 --- a/src/mdictionary/gui/AboutWidget.h +++ b/src/mdictionary/gui/AboutWidget.h @@ -48,8 +48,8 @@ private slots: private: QDeclarativeView *view; - QVBoxLayout* mainLayout; + QVBoxLayout *scrollLayout; QLabel* mainLabel, * licenseLabel, *imageLabel; QScrollArea* scroll; diff --git a/src/mdictionary/gui/MainWindow.cpp b/src/mdictionary/gui/MainWindow.cpp index 915cf2d..431ccf0 100644 --- a/src/mdictionary/gui/MainWindow.cpp +++ b/src/mdictionary/gui/MainWindow.cpp @@ -116,7 +116,8 @@ void MainWindow::initializeSearchWidgets() { splitter->setStretchFactor(1, 150); mainLayout->addWidget(splitter, 1); - mainLayout->addWidget(searchBarWidget, 0, Qt::AlignBottom); + + mainLayout->addWidget(searchBarWidget,0, Qt::AlignBottom); #endif } @@ -294,7 +295,7 @@ QHash MainWindow::getDictionaries() { return backbone->getDictionaries(); } - +/**/ void MainWindow::search(QString word) { setExactSearch(false); searchBarWidget->search(word); diff --git a/src/mdictionary/gui/SearchBarWidget.cpp b/src/mdictionary/gui/SearchBarWidget.cpp index b53d664..0726d76 100644 --- a/src/mdictionary/gui/SearchBarWidget.cpp +++ b/src/mdictionary/gui/SearchBarWidget.cpp @@ -33,42 +33,74 @@ SearchBarWidget::SearchBarWidget(QWidget *parent) : QWidget(parent) { +#ifndef Q_WS_MAEMO_5 + this->setMaximumHeight(50); - initializeUI(); + view= new QDeclarativeView(); + view->setSource(QUrl("src/mdictionary/qml/SearchBarWidget.qml")); + view->setResizeMode(QDeclarativeView::SizeRootObjectToView); + view->setAlignment(Qt::AlignCenter); + view->show(); + mainLayout = new QVBoxLayout; + mainLayout->addWidget(view); + setLayout(mainLayout); - busy = false; + QGraphicsObject *rootObject = view->rootObject(); + connect(rootObject, SIGNAL(searchButtonClicked(QString)), + this, SLOT(searchButtonClicked(QString))); + connect(rootObject, SIGNAL(historyNextToolButtonClicked()), + this, SIGNAL(historyNext())); + connect(rootObject, SIGNAL(historyPrevToolButtonClicked()), + this, SIGNAL(historyPrev())); + connect(rootObject, SIGNAL(historyShowToolButtonClicked()), + this, SIGNAL(historyShow())); + + connect(this, SIGNAL(setEnableHistoryNext(QVariant)), + rootObject, SLOT(setEnableHistoryNext(QVariant))); + connect(this, SIGNAL(setEnableHistoryShow(QVariant)), + rootObject, SLOT(setEnableHistoryShow(QVariant))); + connect(this, SIGNAL(setEnableHistoryPrev(QVariant)), + rootObject, SLOT(setEnableHistoryPrev(QVariant))); + connect(this, SIGNAL(setButtonText(QVariant)), + rootObject, SLOT(setButtonText(QVariant))); + connect(this, SIGNAL(setLineEditText(QVariant)), + rootObject, SLOT(setLineEditText(QVariant))); + connect(this, SIGNAL(setLineEditEnables(QVariant)), + rootObject, SLOT(setEnableLineEdit(QVariant))); + + emit setEnableHistoryNext(false); + emit setEnableHistoryShow(false); + emit setEnableHistoryPrev(false); + + completerModel = new QStringListModel(this); + connect(&delayTimer, SIGNAL(timeout()), + this, SLOT(delaySearchTimeout())); +#else + initializeUI(); connect(searchPushButton, SIGNAL(clicked()), this, SLOT(searchPushButtonClicked())); - connect(searchWordLineEdit, SIGNAL(returnPressed()), this, SLOT(searchPushButtonClicked())); - connect(historyNextToolButton, SIGNAL(clicked()), this, SIGNAL(historyNext())); - connect(historyPrevToolButton, SIGNAL(clicked()), this, SIGNAL(historyPrev())); - connect(historyShowToolButton, SIGNAL(clicked()), this, SLOT(showHistoryButtonClicked())); - connect(clearSearchWordToolButton, SIGNAL(clicked()), this, SLOT(clearSearchWordToolButtonClicked())); - - connect(&delayTimer, SIGNAL(timeout()), this, SLOT(delaySearchTimeout())); searchWordLineEdit->setFocus(); +#endif - historyPrevToolButton->setEnabled(false); - historyNextToolButton->setEnabled(false); - historyShowToolButton->setEnabled(false); - + busy = false; setEnabled(true); + updateHistoryButtons(false,false,false); } SearchBarWidget::~SearchBarWidget() { @@ -78,7 +110,6 @@ SearchBarWidget::~SearchBarWidget() { QIcon SearchBarWidget::generateIcon(QIcon original, qreal rotation) { QPixmap p = original.pixmap(64); - if(rotation != 0) { QMatrix m; m.rotate(rotation); @@ -112,49 +143,38 @@ QIcon SearchBarWidget::generateIcon(QIcon original, qreal rotation) { return newIcon; } - void SearchBarWidget::setFocus() { - searchWordLineEdit->setFocus(); +#ifdef Q_WS_MAEMO_5 + searchWordLineEdit->setFocus(); +#endif } void SearchBarWidget::initializeUI() { - - #ifdef Q_WS_MAEMO_5 - setMaximumHeight(150); - #else - setMaximumHeight(100); - #endif - +#ifdef Q_WS_MAEMO_5 + setMaximumHeight(150); horizontalLayout = new QHBoxLayout; verticalLayout = new QVBoxLayout; - searchPushButton = new QPushButton(tr("Search")); searchPushButton->setMinimumWidth(125); - 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 searchWordLineEdit->setMinimumHeight( searchWordLineEdit->sizeHint().height()*3/2); #endif - //create layout for lineEdit to have clear button on it QHBoxLayout* lineEditLayout = new QHBoxLayout; searchWordLineEdit->setLayout(lineEditLayout); @@ -217,7 +237,6 @@ void SearchBarWidget::initializeUI() { #endif searchingProgressBar->hide(); - setLayout(verticalLayout); verticalLayout->addWidget(searchingProgressBar); @@ -232,46 +251,56 @@ void SearchBarWidget::initializeUI() { //adding clear toolButton to textEdit with right alignment lineEditLayout->addWidget(clearSearchWordToolButton, 0, Qt::AlignRight); - verticalLayout->addLayout(horizontalLayout); +#endif } +void SearchBarWidget::searchButtonClicked(QString text) { + if(busy) + Q_EMIT stopSearching(); + else + search(text); +} void SearchBarWidget::searchPushButtonClicked() { +#ifdef Q_WS_MAEMO_5 if(busy) { Q_EMIT stopSearching(); } else { search(searchWordLineEdit->text()); } +#endif } - void SearchBarWidget::search(QString word) { + qDebug()<insertRow(completerModel->rowCount()); - QModelIndex index = - completerModel->index(completerModel->rowCount() -1); - + QModelIndex index=completerModel->index(completerModel->rowCount() -1); completerModel->setData(index, word); - +#ifndef Q_WS_MAEMO_5 + emit setLineEditText(word); +#else searchWordLineEdit->setText(word); +#endif Q_EMIT searchForTranslations(word); } } void SearchBarWidget::searchDelay(QString word) { if(!busy && !word.isEmpty()) { - searchWordLineEdit->setText(word); + #ifndef Q_WS_MAEMO_5 + emit setLineEditText(word); + #else + searchWordLineEdit->setText(word); + #endif + if(delayTimer.isActive()) + delayTimer.stop(); + delayString = word; + delayTimer.start(500); - - if(delayTimer.isActive()) { - delayTimer.stop(); - } - - delayString = word; - delayTimer.start(500); } } @@ -283,27 +312,47 @@ void SearchBarWidget::delaySearchTimeout() { } void SearchBarWidget::setEnabled(bool enabled) { +#ifndef Q_WS_MAEMO_5 + emit setLineEditEnables(enabled); + if(!enabled) { + emit setEnableHistoryNext(false); + emit setEnableHistoryShow(false); + emit setEnableHistoryPrev(false); + } +#else searchWordLineEdit->setEnabled(enabled); - if(!enabled) { historyPrevToolButton->setEnabled(false); historyNextToolButton->setEnabled(false); historyShowToolButton->setEnabled(false); } +#endif } void SearchBarWidget::setBusy() { if(busy) return; + +#ifndef Q_WS_MAEMO_5 + emit setButtonText(tr("Stop")); +// searchingProgressBar->show(); +#else searchingProgressBar->show(); searchPushButton->setText(tr("Stop")); +#endif + setEnabled(false); busy = true; } void SearchBarWidget::setIdle() { if(!busy) return; +#ifndef Q_WS_MAEMO_5 +// searchingProgressBar->hide(); + emit setButtonText(tr("Search")); +#else searchingProgressBar->hide(); searchPushButton->setText(tr("Search")); +#endif setEnabled(true); busy = false; Q_EMIT refreshHistoryButtons(); @@ -311,25 +360,33 @@ void SearchBarWidget::setIdle() { void SearchBarWidget::clearSearchWordToolButtonClicked() { +#ifdef Q_WS_MAEMO_5 searchWordLineEdit->clear(); +#endif } void SearchBarWidget::updateHistoryButtons(bool prev, bool next, bool list) { if(!busy) { - historyPrevToolButton->setEnabled(prev); - historyNextToolButton->setEnabled(next); - historyShowToolButton->setEnabled(list); + #ifndef Q_WS_MAEMO_5 + emit setEnableHistoryNext(next); + emit setEnableHistoryShow(list); + emit setEnableHistoryPrev(prev); + #else + historyPrevToolButton->setEnabled(prev); + historyNextToolButton->setEnabled(next); + historyShowToolButton->setEnabled(list); + #endif } } void SearchBarWidget::showHistoryButtonClicked() { - #ifdef Q_WS_MAEMO_5 - emit historyShow(); - #else - QPoint p = historyShowToolButton->pos(); - p.setY(p.y()); - emit historyShow(mapToGlobal(p)); - #endif +#ifndef Q_WS_MAEMO_5 + QPoint p=view->pos(); // = historyShowToolButton->pos(); + p.setY(p.y()); + emit historyShow(mapToGlobal(p)); + #else + emit historyShow(); +#endif } diff --git a/src/mdictionary/gui/SearchBarWidget.h b/src/mdictionary/gui/SearchBarWidget.h index afef2f5..52a8e65 100644 --- a/src/mdictionary/gui/SearchBarWidget.h +++ b/src/mdictionary/gui/SearchBarWidget.h @@ -30,6 +30,8 @@ #include #include +#include + #include "../backbone/backbone.h" #include "../../include/History.h" @@ -47,6 +49,14 @@ public: ~SearchBarWidget(); Q_SIGNALS: + + void setEnableHistoryNext(QVariant enable); + void setEnableHistoryShow(QVariant enable); + void setEnableHistoryPrev(QVariant enable); + void setButtonText(QVariant text); + void setLineEditText(QVariant text); + void setLineEditEnables(QVariant enabled); + //! Requests to search for a list of words matching a word passed as //! a parameter void searchForTranslations(QString); @@ -71,6 +81,9 @@ Q_SIGNALS: void refreshHistoryButtons(); public Q_SLOTS: + + void searchButtonClicked(QString text); + //! Enables or disables search word line edit and history buttons /*! While searching it disables only history button and line edit. @@ -131,6 +144,10 @@ private Q_SLOTS: private: + + QVBoxLayout* mainLayout; + QDeclarativeView *view; + QLineEdit* searchWordLineEdit; QCompleter* lineEditCompleter; QStringListModel* completerModel; diff --git a/src/mdictionary/mdictionary.pro b/src/mdictionary/mdictionary.pro index fd4b0bc..c31eed0 100644 --- a/src/mdictionary/mdictionary.pro +++ b/src/mdictionary/mdictionary.pro @@ -82,7 +82,8 @@ OTHER_FILES += \ qml/AboutWidget.qml \ qml/SearchBarWidget.qml \ qml/IconButton.qml \ - qml/MyTextLineEdit.qml + qml/MyTextLineEdit.qml \ + qml/ProgressBar.qml target.path = $$BIN_DIR INSTALLS += target @@ -128,8 +129,8 @@ unix { css_images.files += ../../data/css_meego/images/shadow-white-bg.png css_images.files += ../../data/css_meego/images/tab-background.png css_images.files += ../../data/css_meego/images/key-background.png - css_images.files += ../../data/css_meego/images/shadow-transparent-bg. png - css_images.files += ../../data/css_meego/images/splash2.png + css_images.files += ../../data/css_meego/images/shadow-transparent-bg. png + css_images.files += ../../data/css_meego/images/splash2.png } else:maemo5 { css.path = $$DATA_DIR/css @@ -177,6 +178,7 @@ unix { qmls.files += ./qml/SearchBarWidget.qml qmls.files += ./qml/IconButton.qml qmls.files += ./qml/MyTextLineEdit.qml + qmls.files += ./qml/ProgressBar.qml } INSTALLS += desktop icon64 shared service css css_images qmls diff --git a/src/mdictionary/qml/AboutWidget.qml b/src/mdictionary/qml/AboutWidget.qml index 24ad67e..500508e 100644 --- a/src/mdictionary/qml/AboutWidget.qml +++ b/src/mdictionary/qml/AboutWidget.qml @@ -3,8 +3,6 @@ import QtWebKit 1.0 Rectangle { id: item - //width: 400; - // height: 400; opacity: 1 anchors.fill: parent @@ -54,19 +52,4 @@ Rectangle { anchors.horizontalCenterOffset: 0 onLinkActivated: linkClicked(link); } - - Button{ - x:100; - y:100; - width: 500 - height: 30 - textInButton: "ala ma kota" - } - - SearchBarWidget { - id: searchbarwidget1 - y:50; - width: item.width; - height: 30; - } } diff --git a/src/mdictionary/qml/Button.qml b/src/mdictionary/qml/Button.qml index 650786c..748ba3c 100644 --- a/src/mdictionary/qml/Button.qml +++ b/src/mdictionary/qml/Button.qml @@ -6,11 +6,78 @@ BorderImage { signal clicked opacity: 1 + function setText(string) { textInButton = string; } border { left: 10; top: 10; right: 10; bottom: 10 } MouseArea { id: mouseArea anchors.centerIn: parent; + width: parent.width; + height: parent.height; + onClicked: { + button.clicked(); + } + } + + Text { + z:1 + id: buttonText + anchors.centerIn: parent; + font.pixelSize: parent.height * .5 + style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true + } + + Rectangle { + id: shade + anchors.centerIn: parent; + radius: parent.height*.4; + color: "black"; + opacity: 0 + width: parent.width; + height: parent.height; + } + + Image { + id: image1 + width: (35*parent.height)/107 +1 + height: parent.height + anchors.left: parent.left + source: "qrc:/button/buttonLeft.png" + } + + Image { + id: image3 + smooth: true + width: parent.width - ((70*parent.height)/107) +1; + height: parent.height + anchors.horizontalCenter: parent.horizontalCenter + source: "qrc:/button/buttonCenter.png" + } + + Image { + id: image2 + smooth: true + width: (35*parent.height)/107 +1 + height: parent.height + anchors.right: parent.right + source: "qrc:/button/buttonR.png" + } + + states: [ + State { + name: "pressed"; when: mouseArea.pressed == true + PropertyChanges { target: shade; opacity: 0.4 } + PropertyChanges { target: image1; opacity: 0.5 } + PropertyChanges { target: image3; opacity: 0.5 } + PropertyChanges { target: image2; opacity: 0.5 } + } + ] + + + +/* MouseArea { + id: mouseArea + anchors.centerIn: parent; width: ((parent.width > buttonText.text.length*buttonText.font.pixelSize*.8) ? (parent.width) : (buttonText.text.length*buttonText.font.pixelSize*.60)) - ((70*parent.height)/107) height: parent.height onClicked: { @@ -24,6 +91,10 @@ BorderImage { anchors.centerIn: parent; font.pixelSize: parent.height * .5 style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true + PropertyChanges { + target: button; + width: (button.width> buttonText.text.length*buttonText.font.pixelSize*.8) ? (parent.width) : (buttonText.text.length*buttonText.font.pixelSize*.8) + } } Rectangle { @@ -38,7 +109,6 @@ BorderImage { Image { id: image1 - smooth: true width: (35*parent.height)/107 +1 height: parent.height anchors.left: parent.left @@ -74,4 +144,5 @@ BorderImage { PropertyChanges { target: image2; opacity: 0.5 } } ] + */ } diff --git a/src/mdictionary/qml/MyTextLineEdit.qml b/src/mdictionary/qml/MyTextLineEdit.qml index 7093c02..1c551a5 100644 --- a/src/mdictionary/qml/MyTextLineEdit.qml +++ b/src/mdictionary/qml/MyTextLineEdit.qml @@ -4,6 +4,11 @@ Rectangle { id: rectangle1 radius: 10 border.color: "#000666"; + property alias textInLineEdit:text_input1.text + + signal enterPressed(string text); + + function setText(string) { textInLineEdit = string; } TextInput { id: text_input1 @@ -15,5 +20,34 @@ Rectangle { selectByMouse: true; font.pixelSize: rectangle1.height * .5; onCursorPositionChanged: moveCursorSelection(cursorPosition); + activeFocusOnPress: true; + Keys.onPressed: { + if ((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return)) + rectangle1.enterPressed(text_input1.text) + } } + + Rectangle { + id: shadeDisable + anchors.centerIn: parent; + radius: parent.radius + color: "grey"; + opacity: 0 + width: parent.width; + height: parent.height; + } + + states: [ + State { + name: "FokusState"; when: text_input1.focus==true && rectangle1.enabled==true; + PropertyChanges { + target: rectangle1 + border.width: 3 + } + }, + State { + name: "DisableState"; when: rectangle1.enabled==false; + PropertyChanges { target: shadeDisable; z: 3; opacity: 0.5 } + } + ] } diff --git a/src/mdictionary/qml/ProgressBar.qml b/src/mdictionary/qml/ProgressBar.qml new file mode 100644 index 0000000..ea3ec86 --- /dev/null +++ b/src/mdictionary/qml/ProgressBar.qml @@ -0,0 +1,48 @@ +import Qt 4.7 + +Item { + id: progressBar + + property int minimum: 0 + property int maximum: 100 + property int value: 0 + property alias color: gradient1.color + property alias secondColor: gradient2.color + + function setMax(intiger) { maximum=intiger } + function setMin(intiger) { minimum=intiger } + function setValue(intiger) { value= intiger } + + width: 250; + height: 23 + clip: true + + BorderImage { + source: "background.png" + width: parent.width; height: parent.height + border { left: 4; top: 4; right: 4; bottom: 4 } + } + + Rectangle { + id: highlight + + property int widthDest: ((progressbar.width * (value - minimum)) / (maximum - minimum) - 6) + + width: highlight.widthDest + Behavior on width { SmoothedAnimation { velocity: 1200 } } + + anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: 3 } + radius: 1 + gradient: Gradient { + GradientStop { id: gradient1; position: 0.0 } + GradientStop { id: gradient2; position: 1.0 } + } + } + + Text { + anchors { right: highlight.right; rightMargin: 6; verticalCenter: parent.verticalCenter } + color: "white" + font.bold: true + text: Math.floor((value - minimum) / (maximum - minimum) * 100) + '%' + } +} diff --git a/src/mdictionary/qml/SearchBarWidget.qml b/src/mdictionary/qml/SearchBarWidget.qml index 64c0142..8bd574e 100644 --- a/src/mdictionary/qml/SearchBarWidget.qml +++ b/src/mdictionary/qml/SearchBarWidget.qml @@ -2,15 +2,30 @@ import Qt 4.7 Rectangle { id: searchBarWidget - SystemPalette { id: myPalette; colorGroup: SystemPalette.Active } color : myPalette.window; + property alias enableLineEdit: inputSearchText.enabled; + + 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) } + + signal searchButtonClicked(string text); + signal historyNextToolButtonClicked; + signal historyShowToolButtonClicked; + signal historyPrevToolButtonClicked; + MyTextLineEdit{ id: inputSearchText width: (searchBarWidget.width - (searchBarWidget.height*3.5 + searchButton.width + 9)); - height: searchBarWidget.height - anchors.left: searchBarWidget.left + height: searchBarWidget.height -1; + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + onEnterPressed: searchBarWidget.searchButtonClicked(text); IconButton { id: clearButton; width: inputSearchText.height-6; @@ -19,7 +34,7 @@ Rectangle { anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter enabled: true; - pathToIcon: "/home/jakub/go-previous.png"; + pathToIcon: "qrc:/button/go-previous.png"; } } @@ -35,41 +50,45 @@ Rectangle { width: 100 height: searchBarWidget.height; anchors.rightMargin: 3 - anchors.right: historyButton3.left + anchors.right: historyPrevToolButton.left anchors.verticalCenter: parent.verticalCenter textInButton: "Search" + onClicked: searchBarWidget.searchButtonClicked(inputSearchText.textInLineEdit); } IconButton { - id: historyButton1; + id: historyNextToolButton; width: searchBarWidget.height height: searchBarWidget.height anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter enabled: true; - pathToIcon: "/home/jakub/go-previous.png"; + pathToIcon: "qrc:/button/go-previous.png"; + onClicked: searchBarWidget.historyNextToolButtonClicked(); } IconButton { - id: historyButton2; + id: historyShowToolButton; width: searchBarWidget.height height: searchBarWidget.height anchors.rightMargin: 3 - anchors.right: historyButton1.left + anchors.right: historyNextToolButton.left anchors.verticalCenter: parent.verticalCenter enabled: true; - pathToIcon: "/home/jakub/go-previous.png"; + pathToIcon: "qrc:/button/go-previous.png"; + onClicked: searchBarWidget.historyShowToolButtonClicked(); } IconButton { - id: historyButton3; + id: historyPrevToolButton; width: searchBarWidget.height height: searchBarWidget.height anchors.rightMargin: 3 - anchors.right: historyButton2.left + anchors.right: historyShowToolButton.left anchors.verticalCenter: parent.verticalCenter enabled: true; - pathToIcon: "/home/jakub/go-previous.png"; + pathToIcon: "qrc:/button/go-previous.png"; + onClicked: searchBarWidget.historyPrevToolButtonClicked(); } } } diff --git a/src/plugins/google/GooglePlugin.cpp b/src/plugins/google/GooglePlugin.cpp index be60c32..0374115 100644 --- a/src/plugins/google/GooglePlugin.cpp +++ b/src/plugins/google/GooglePlugin.cpp @@ -213,6 +213,7 @@ QList GooglePlugin::searchWordList(QString word, int ) { } QString text = QString::fromUtf8(http->readAll()); +// qDebug()<<"google test"<" + "" + text + ""; -- 1.7.9.5