features of DictManagerWidget restored in qml version.
[mdictionary] / src / mdictionary / gui / DictManagerModel.h
index 6c599f1..034867f 100644 (file)
@@ -1,3 +1,30 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+/*! \file DictManagerModel.h
+    \brief Contains dictionaries data for qml UI
+
+    \author Marcin Kaźmierczak <marcin.kazmierczak@comarch.pl>
+*/
+
 #ifndef DICTMANAGERMODEL_H
 #define DICTMANAGERMODEL_H
 
@@ -23,7 +50,7 @@ public:
 
     //! Constructor
     /*!
-      \param dictionaries list of dictionaries
+      \param dictionaries hash set (dictionary, is active) with dictionaries
       \param parent parent of this class.
     */
     explicit DictManagerModel(QHash<CommonDictInterface*, bool> dictionaries, QObject *parent = 0);
@@ -34,21 +61,48 @@ public:
     bool setData(const QModelIndex &index, const QVariant &value, int role);
 
     Qt::ItemFlags flags(const QModelIndex &index) const;
+
+    //! Replace model data and refresh ui.
+    /*!
+      \param dictionaries hash set (dictionary, is active) with dictionaries
+    */
     void setDictionaries(QHash<CommonDictInterface*, bool> dictionaries);
+
+    //! Get dictionary hash set
     QHash<CommonDictInterface*, bool> dictionaries();
+
+    //! Get dictionary list
     QList<CommonDictInterface*> dictList();
 
+    //! Clear model data and refresh UI
     void clear();
+    //! Get current selected dictionary
+    CommonDictInterface* currentDict();
+    //! Get true if current selected dictionary was active. Otherwise return false.
+    bool isCurrentDictSelected();
 
 public Q_SLOTS:
+    //! Set value at role in index row of data.
+    /*!
+      \param index dictionary position in data list
+      \param value new value for role
+      \param role role name
+      */
     void setModelProperty(int index, const QVariant value, QString role);
+    //! Set index of current selected dictionary
+    /*!
+      \param index dictionary position in data list
+      */
+    void itemSelected(int index);
 
 Q_SIGNALS:
+    //! emits when user changed data
     void itemChanged();
 
 private:
     QHash<CommonDictInterface*, bool> _dictionaries;
     QList<CommonDictInterface*> _dictList;
+    int _currentIndex;
 
     int setDataPriv(int index, const QVariant &value, int role);
     void addDictionary(CommonDictInterface* dictionary, bool isActive);