X-Git-Url: http://git.maemo.org/git/?p=speedfreak;a=blobdiff_plain;f=Client%2Fcategorylist.cpp;h=aad2aa28f75d6fe1256d647771b1805fb438e675;hp=243c5d382ab240efc48b378eb86de605e2508315;hb=16f76b90231274365c45d9efa6d662a819ac525d;hpb=a16a5f4ed3711ad28f85951c0d63e666b1f86c11 diff --git a/Client/categorylist.cpp b/Client/categorylist.cpp index 243c5d3..aad2aa2 100644 --- a/Client/categorylist.cpp +++ b/Client/categorylist.cpp @@ -1,7 +1,8 @@ /* * Categorylist * - * @author Olavi Pulkkinen + * @author Olavi Pulkkinen + * @author Toni Jussila * @copyright (c) 2010 Speed Freak team * @license http://opensource.org/licenses/gpl-license.php GNU Public License */ @@ -10,102 +11,139 @@ #include "categorylist.h" /** - *Constructor of this class. + * Constructor of this class. */ CategoryList::CategoryList() { - + qDebug() << "__CategoryList"; } /** - *Destructor of this class. Should be used to release all allocated resources. + * Destructor of this class. Should be used to release all allocated resources. */ CategoryList::~CategoryList() { + qDebug() << "__~CategoryList"; } /** - *This is return function. - *@return QStringList categoryList + * This is return function. + * + * @return QStringList categoryList */ QStringList CategoryList::getCategoryList() { - qDebug() << "_getCategoryList" ; + qDebug() << "__getCategoryList" << realSizeOfCats; + + if(sizeOfCategoryList() != 0) { + clearCategoryList(); + } + + for(int i = 0; i < realSizeOfCats; i++) + { + categoryList.append(cats[i].description); + } + return categoryList; } /** - *Append an item in the end of the categorylist. - *@param Item. + * Append an item in the end of the categorylist. + * + * @param Item. */ void CategoryList::appendCategoryList(QString item) { + qDebug() << "__appendCategoryList"; categoryList.append(item); } /** - *Input an item into the categorylist. - *@param Index. - *@param Item to be appended. + * Input an item into the categorylist. + * + * @param Index. + * @param Item to be appended. */ void CategoryList::fillCategoryList(int index, QString item) { + qDebug() << "__fillCategoryList"; categoryList.insert(index, item); } /** - *Show an item of the categorylist. - *@param Index. + * Show an item of the categorylist. + * + * @param int Index. */ QString CategoryList::itemOfCategoryList(int index) { + qDebug() << "__itemOfCategoryList"; return categoryList.at(index); } /** - *Clear categorylist. + * Clear categorylist. */ void CategoryList::clearCategoryList() { + qDebug() << "__clearCategoryList"; categoryList.clear(); } /** - *Read size of categorylist. + * Read size of categorylist. */ int CategoryList::sizeOfCategoryList() { + qDebug() << "__sizeOfCategoryList"; return categoryList.size(); } /** - *Append an item in the end of the categoryelementable. - *@param Index. - *@param Description of category. - *@param Unit. - *@param Category. + * Append an item in the end of the categoryelementable. + * + * @param int Index. + * @param QString Description of category. + * @param QString Unit. + * @param QString Category. */ void CategoryList::appendCats(int ind, QString des, QString uni, QString cat) { + qDebug() << "__appendCats"; cats[ind].description = des; cats[ind].unit = uni; cats[ind].category = cat; } /** - *Clear categs. + * Search description for an index af cats table. + * + * @param int Index. */ -QString CategoryList::desOfCats(int ind) +QString CategoryList::getRecentDescription(int ind) { + qDebug() << "__getRecentDescription"; return cats[ind].description; } /** - *Clear cats. + * Search category for an index af cats table. + * + * @param int Index. + */ +QString CategoryList::getRecentCategory(int ind) +{ + qDebug() << "__getRecentCategory"; + return cats[ind].category; +} + +/** + * Clear cats. */ void CategoryList::clearCats() { - for(int i = 0; i < 10; i++) + qDebug() << "__clearCats"; + for(int i = 0; i < 20; i++) { cats[i].description.clear(); cats[i].unit.clear(); @@ -114,9 +152,10 @@ void CategoryList::clearCats() } /** - *This function is used to get items to top list of the category that is chosen from combobox. - *@param QString category - *@param int size + * This function is used to get items to top list of the category that is chosen from combobox. + * + * @param QString category + * @param int size */ QString CategoryList::getTopList( QString category, int size) { @@ -133,4 +172,3 @@ QString CategoryList::getTopList( QString category, int size) return emptyStr; } } -