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()
21 *Destructor of this class. Should be used to release all allocated resources.
23 CategoryList::~CategoryList()
28 *This is return function.
29 *@return QStringList categoryList
31 QStringList CategoryList::getCategoryList()
33 qDebug() << "_getCategoryList" << realSizeOfCats;
35 if(sizeOfCategoryList() != 0) {
39 for(int i = 0; i < realSizeOfCats; i++)
41 categoryList.append(cats[i].description);
48 *Append an item in the end of the categorylist.
51 void CategoryList::appendCategoryList(QString item)
53 categoryList.append(item);
57 *Input an item into the categorylist.
59 *@param Item to be appended.
61 void CategoryList::fillCategoryList(int index, QString item)
63 categoryList.insert(index, item);
67 *Show an item of the categorylist.
70 QString CategoryList::itemOfCategoryList(int index)
72 return categoryList.at(index);
78 void CategoryList::clearCategoryList()
84 *Read size of categorylist.
86 int CategoryList::sizeOfCategoryList()
88 return categoryList.size();
92 *Append an item in the end of the categoryelementable.
94 *@param Description of category.
98 void CategoryList::appendCats(int ind, QString des, QString uni, QString cat)
100 cats[ind].description = des;
101 cats[ind].unit = uni;
102 cats[ind].category = cat;
106 *Search description for an index af cats table.
109 QString CategoryList::getRecentDescription(int ind)
111 return cats[ind].description;
115 *Search category for an index af cats table.
118 QString CategoryList::getRecentCategory(int ind)
120 return cats[ind].category;
126 void CategoryList::clearCats()
128 for(int i = 0; i < 20; i++)
130 cats[i].description.clear();
131 cats[i].unit.clear();
132 cats[i].category.clear();
137 *This function is used to get items to top list of the category that is chosen from combobox.
138 *@param QString category
140 *@todo Now there is only one (the latest top10List). Later picking up the requested category.
142 QString CategoryList::getTopList( QString category, int size)
144 qDebug() << "_getTopList";
146 if(!(top10List.isEmpty()))
152 QString emptyStr("");
153 qDebug() << "_getTopList: Category not found";