Fixed welcome screen layout
[mdictionary] / trunk / src / base / gui / WordListWidget.h
index 6223e1d..7ad634d 100644 (file)
 #include <QStringListModel>
 #include "../backbone/backbone.h"
 #include "SearchBarWidget.h"
-#include "WordListItem.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 QScrollArea {
+class WordListWidget : public QTreeView {
     Q_OBJECT
 public:
     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:
     //! Shows search results
     /*!
@@ -60,23 +67,21 @@ public Q_SLOTS:
     //! Unlocks words list
     void unlockList();
 
+protected:
+    void mouseReleaseEvent(QMouseEvent *event);
+    void resizeEvent(QResizeEvent *event);
 
 private Q_SLOTS:
-    void itemClicked(QString key);
-    void itemSelected(QString key);
+    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);
-    //clears all list of words
-    void clear();
-    QHash<QString, QList<Translation*> > searchResult;
-    QList<WordListItem*> items;
+    void addWord(QString word, int row);
+    QStandardItemModel* model;
+    int checkBoxWidth;
+    void resizeColumns();
 
-    QVBoxLayout* layout;
-    //QString _exactMatchString;
+    QHash<QString, QList<Translation*> > searchResult;
 };
 
 #endif // WORDLISTWIDGET_H