4 * @author Olavi Pulkkinen <olavi.pulkkinena@fudeco.com>
5 * @copyright (c) 2010 Speed Freak team
6 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
10 #include "categorylist.h"
13 *Constructor of this class.
15 CategoryList::CategoryList()
17 qDebug() << "__CategoryList";
21 *Destructor of this class. Should be used to release all allocated resources.
23 CategoryList::~CategoryList()
25 qDebug() << "__~CategoryList";
29 *This is return function.
30 *@return QStringList categoryList
32 QStringList CategoryList::getCategoryList()
34 qDebug() << "__getCategoryList" << realSizeOfCats;
36 if(sizeOfCategoryList() != 0) {
40 for(int i = 0; i < realSizeOfCats; i++)
42 categoryList.append(cats[i].description);
49 *Append an item in the end of the categorylist.
52 void CategoryList::appendCategoryList(QString item)
54 categoryList.append(item);
58 *Input an item into the categorylist.
60 *@param Item to be appended.
62 void CategoryList::fillCategoryList(int index, QString item)
64 categoryList.insert(index, item);
68 *Show an item of the categorylist.
71 QString CategoryList::itemOfCategoryList(int index)
73 return categoryList.at(index);
79 void CategoryList::clearCategoryList()
85 *Read size of categorylist.
87 int CategoryList::sizeOfCategoryList()
89 return categoryList.size();
93 *Append an item in the end of the categoryelementable.
95 *@param Description of category.
99 void CategoryList::appendCats(int ind, QString des, QString uni, QString cat)
101 cats[ind].description = des;
102 cats[ind].unit = uni;
103 cats[ind].category = cat;
107 *Search description for an index af cats table.
110 QString CategoryList::getRecentDescription(int ind)
112 return cats[ind].description;
116 *Search category for an index af cats table.
119 QString CategoryList::getRecentCategory(int ind)
121 return cats[ind].category;
127 void CategoryList::clearCats()
129 for(int i = 0; i < 20; i++)
131 cats[i].description.clear();
132 cats[i].unit.clear();
133 cats[i].category.clear();
138 *This function is used to get items to top list of the category that is chosen from combobox.
139 *@param QString category
141 *@todo Now there is only one (the latest top10List). Later picking up the requested category.
143 QString CategoryList::getTopList( QString category, int size)
145 qDebug() << "_getTopList";
147 if(!(top10List.isEmpty()))
153 QString emptyStr("");
154 qDebug() << "_getTopList: Category not found";