Copyright 2010 Comarch S.A.
*******************************************************************************/
-
-//Created by Mateusz Półrola
+//! \file WordListwidget.h
+//! \brief Implements word list widget
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef WORDLISTWIDGET_H
#define WORDLISTWIDGET_H
#include <QtGui>
#include <QStringListModel>
#include "../backbone/backbone.h"
-
+#include "SearchBarWidget.h"
//! Displays list of words found in dictionaries
/*!
It allow user to select word to see it's translation or to mark it as "star"
*/
-class WordListWidget : public QListView {
+class WordListWidget : public QTreeView {
Q_OBJECT
public:
- explicit WordListWidget(Backbone* backbone, QWidget *parent = 0);
+ explicit WordListWidget(QWidget *parent = 0);
+
+
+Q_SIGNALS:
+ //! Request to show translation which is described by passed translations
+ //! objects
+ void showTranslation(QList<Translation*>);
+
+
+ //! Request to add selected word to bookmarks
+ void addBookmark(QList<Translation*>);
+
+ //! Request to remove selected word from bookmarks
+ void removeBookmark(QList<Translation*>);
public Q_SLOTS:
- /*! Request to show search results, requested by backbone when it finished
- search*/
- void showSearchResults();
+ //! Shows search results
+ /*!
+ \param hash of found words and it's translations objects
+ */
+ void showSearchResults(QHash<QString, QList<Translation*> >);
+
+ //! Lock words list, while backbone is doing somethig in background
+ void lockList();
+
+ //! Unlocks words list
+ void unlockList();
+
+protected:
+ void mouseReleaseEvent(QMouseEvent *event);
+ void resizeEvent(QResizeEvent *event);
+
+private Q_SLOTS:
+ void wordClicked(QModelIndex index);
+ void wordChecked(QModelIndex index);
private:
- Backbone *backbone;
- //words are keeping as QStringListModel which allow to sort them
- QStringListModel *wordListModel;
- void addWord(QString word, Translation* trans);
- //clears all list of words
- void clear();
- QHash<QString, Translation*> searchResult;
+ void addWord(QString word, int row);
+ QStandardItemModel* model;
+ int checkBoxWidth;
+ void resizeColumns();
+
+ QHash<QString, QList<Translation*> > searchResult;
};
#endif // WORDLISTWIDGET_H