bi change + completer in line edit
[mdictionary] / src / mdictionary / gui / SearchBarWidget.h
index 0309bd9..0e84bee 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-//! \file SearchBarWidget.h
-//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+/*! \file SearchBarWidget.h
+    \brief Displays search bar
+
+    \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+*/
 
 
 #ifndef SEARCHBARWIDGET_H
 
 #include <QWidget>
 #include <QtGui>
+#include <QDeclarativeView>
+
 #include "../backbone/backbone.h"
 #include "../../include/History.h"
 
-//! Displays search bar
 /*!
     Contains line edit field to input word which user would like to find
     and buttons to start/stop search and browse search history.
@@ -45,8 +49,21 @@ public:
     ~SearchBarWidget();
 
 Q_SIGNALS:
-    //! Requests to search for list of words matching word passed as
-    //! parameter
+
+    void setEnableHistoryNext(QVariant enable);
+    void setEnableHistoryShow(QVariant enable);
+    void setEnableHistoryPrev(QVariant enable);
+    void setButtonText(QVariant text);
+    void setLineEditText(QVariant text);
+    void setLineEditEnables(QVariant enabled);
+    void progresSetMax(QVariant);
+    void progresSetMin(QVariant);
+    void progresSetValue(QVariant);
+    void progresSetValue2(QVariant);
+    void setCompleterText(QVariant);
+
+    //! Requests to search for a list of words matching a word passed as
+    //! a parameter
     void searchForTranslations(QString);
 
     //! Requests to stop all active searchings
@@ -61,7 +78,7 @@ Q_SIGNALS:
     //! Requests to show history list
     /*!
       \param p this argument is used only on desktop, it defines place on
-      which popup with history will be shown
+      which a popup with history will be shown
     */
     void historyShow(QPoint p = QPoint(-1,-1));
 
@@ -69,6 +86,11 @@ Q_SIGNALS:
     void refreshHistoryButtons();
 
 public Q_SLOTS:
+
+    void updateBusyTimer();
+
+    void searchButtonClicked(QString text);
+
     //! Enables or disables search word line edit and history buttons
     /*!
       While searching it disables only history button and line edit.
@@ -90,13 +112,13 @@ public Q_SLOTS:
     */
     void setIdle();
 
-    //! Searches for given word
+    //! Searches for a given word
     /*!
       Sets word as text in search word line edit
     */
     void search(QString word);
 
-    //! Starts to search for given word after 500 ms delay
+    //! Starts to search for a given word after 500 ms delay
     /*!
       Sets word as text in search word line edit, and waits 500 ms to start
       search. If in the meantime this slot is called again it will stop previous
@@ -127,11 +149,27 @@ private Q_SLOTS:
     //! shows history
     void showHistoryButtonClicked();
 
+    void textChange(QString text);
+
+    void nextCompleter();
+
+    void prevCompleter();
 
 private:
-    QLineEdit* searchWordLineEdit;
+
+    QVBoxLayout* mainLayout;
+    QDeclarativeView *view;
+    QDeclarativeView *progressBar;
+    QTimer *busyTimer;
+    bool progressMax;
+    QDeclarativeContext *ctxt;
+    QStringList* completerModel;
     QCompleter* lineEditCompleter;
-    QStringListModel* completerModel;
+    QString preferedCompliter;
+    QString actualString;
+    QStringList completerActualList;
+
+    QLineEdit* searchWordLineEdit;
     QToolButton* clearSearchWordToolButton;
     QPushButton* searchPushButton;
     QToolButton* historyPrevToolButton;
@@ -143,12 +181,12 @@ private:
 
 
     //! generates icon for maemo (some of icons we use don't have inactive
-    //! pixmaps, so we generate them
+    //! pixmaps, so we generate them)
     /*!
-      \param oryginal oryginal icon
+      \param original original icon
       \param rotation rotation of resulting icon
     */
-    QIcon generateIcon(QIcon oryginal, qreal rotation=0);
+    QIcon generateIcon(QIcon original, qreal rotation=0);
 
     QVBoxLayout* verticalLayout;