Routing of server results on GUI.
[speedfreak] / Client / categorylist.cpp
1 /*
2  * Categorylist
3  *
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
7  */
8
9 #include <QDebug>
10 #include "categorylist.h"
11
12 /**
13   *Constructor of this class.
14   */
15 CategoryList::CategoryList()
16 {
17
18 }
19
20 /**
21   *Destructor of this class. Should be used to release all allocated resources.
22   */
23 CategoryList::~CategoryList()
24 {
25 }
26
27 /**
28   *This is return function.
29   *@return QStringList categoryList
30   */
31 QStringList CategoryList::getCategoryList()
32 {
33     qDebug() << "_getCategoryList" ;
34     return categoryList;
35 }
36
37 /**
38   *Append an item in the end of the categorylist.
39   */
40 void CategoryList::appendCategoryList(QString item)
41 {
42     categoryList.append(item);
43 }
44
45 /**
46   *Input an item into the categorylist.
47   */
48 void CategoryList::fillCategoryList(int index, QString item)
49 {
50     categoryList.insert(index, item);
51 }
52
53 /**
54   *Show an item of the categorylist.
55   */
56 QString CategoryList::itemOfCategoryList(int index)
57 {
58     return categoryList.at(index);
59 }
60
61 /**
62   *Clear categorylist.
63   */
64 void CategoryList::clearCategoryList()
65 {
66     categoryList.clear();
67     qDebug() << "_clearCategoryList" ;
68 }
69
70 /**
71   *Read size of categorylist.
72   */
73 int CategoryList::sizeOfCategoryList()
74 {
75     return categoryList.size();
76 }
77
78 /**
79   *This function is used to get items to top list of current category.
80   *@param QString category
81   *@param int size
82   */
83 QString CategoryList::getTopList( QString category, int size)
84 {
85     qDebug() << "_getTopList";
86
87     if(!(top10List.isEmpty()))
88     {
89         return top10List;
90     }
91     else
92     {
93         QString emptyStr("");
94         qDebug() << "_getTopList: Category not found";
95         return emptyStr;
96     }
97 }
98