X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmdictionary%2Fgui%2FWordListWidget.h;h=71284101ce909389d97c4dcfb29850f62fb47585;hb=08e403fb8f97d1352819f64d81eeda2c65148a40;hp=cc6d72e0c21155d5306e720793a174cf3e1d5163;hpb=6552e14c830b3de28e1688b8a6b94c09317beac1;p=mdictionary diff --git a/src/mdictionary/gui/WordListWidget.h b/src/mdictionary/gui/WordListWidget.h index cc6d72e..7128410 100644 --- a/src/mdictionary/gui/WordListWidget.h +++ b/src/mdictionary/gui/WordListWidget.h @@ -18,17 +18,24 @@ Copyright 2010 Comarch S.A. *******************************************************************************/ -//! \file WordListwidget.h -//! \author Mateusz Półrola +/*! \file WordListwidget.h + \brief Displays list of words found in dictionaries + + \author Mateusz Półrola +*/ #ifndef WORDLISTWIDGET_H #define WORDLISTWIDGET_H #include #include +#include #include "../backbone/backbone.h" +#include "WordListProxyStyle.h" +#include "WordListModel.h" +#include +#include -//! Displays list of words found in dictionaries /*! It allows user to select word to see its translation or to mark or unmark it as "star" (add/remove from bookmarks). It inherits from QTreeView @@ -40,6 +47,7 @@ class WordListWidget : public QTreeView { Q_OBJECT public: explicit WordListWidget(QWidget *parent = 0); + ~WordListWidget(); Q_SIGNALS: @@ -54,6 +62,10 @@ Q_SIGNALS: //! Requests to remove selected word from bookmarks void removeBookmark(QList); + void setWordListState(QVariant state); + void setWordListEmpty(QVariant state); + void setFocusOnQML(); + public Q_SLOTS: //! Shows search results @@ -68,26 +80,41 @@ public Q_SLOTS: //! Unlocks words list void unlockList(); + //! clears list + void clear(); + + void bookmarkModeActive(); + + void setFocusOnElement(); + protected: +#ifdef Q_WS_MAEMO_5 //! Reimplemented standard mouseReleaseEvent to check if user clicked on - //! word or on its star to emit suitable signal + //! a word or on its star to emit suitable signal void mouseReleaseEvent(QMouseEvent *event); //! Resizes the size of columns to assure that stars are always on right //! side next to scroll bar void resizeEvent(QResizeEvent *event); + //! Checks if user press return and if so displays translation of selected word + void keyPressEvent( QKeyEvent * event); +#endif private Q_SLOTS: +#ifdef Q_WS_MAEMO_5 //! Emits signal to show translation of clicked item. Signal is emitted - //! only when word was clicked. + //! only when a word was clicked. void wordClicked(QModelIndex index); //! Emits signal to show add or remove word from bookmarks. - //! Signal is emitted only when star was clicked. + //! Signal is emitted only when a star was clicked. void wordChecked(QModelIndex index); +#else + void wordClicked(QString word); + void addToBookmarks(QString word); + void removeFromBookmarks(QString word); +#endif - //! clears list - void clear(); private: //! Adds word to model. Row is row in the model @@ -95,7 +122,7 @@ private: QStandardItemModel* model; - //! Describes width of star checkbox in pixels + //! Describes width of a star checkbox in pixels int checkBoxWidth; //! Resizes sizes of colums after adding new words or after resize event. @@ -103,6 +130,16 @@ private: //! Association between words and their translations QHash > searchResult; + WordListProxyStyle* proxyStyle; + + bool _isBookmarkModeActive; + +#ifndef Q_WS_MAEMO_5 + QVBoxLayout* verticalLayout; + QDeclarativeView* qmlView; + QDeclarativeContext* ctxt; + WordListModel* listModel; +#endif }; #endif // WORDLISTWIDGET_H