2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jussi Laitinen - jussi.laitinen@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 #ifndef LISTITEMSTUB_H
23 #define LISTITEMSTUB_H
25 #include "../../src/ui/personlistitem.h"
26 #include "../../src/coordinates/geocoordinate.h"
29 class ListItemStub : public StubBase
32 virtual void ListItemConstructor(QListWidget *parent = 0,
33 int type = QListWidgetItem::Type);
34 enum TextSize{TEXT_SIZE_NORMAL, TEXT_SIZE_SMALL};
35 virtual void setImage(const QPixmap &image);
36 virtual void setTitle(const QString &name);
37 virtual void setSize(const QSize &size);
38 virtual QString shortenText(const QString &text, int textWidth, ListItem::TextSize textSize);
39 virtual QString title();
42 void ListItemStub::ListItemConstructor(QListWidget *parent, int type)
48 void ListItemStub::setImage(const QPixmap &image)
50 QList<ParameterBase *> params;
51 params.append(new Parameter<const QPixmap &>(image));
52 stubMethodEntered("setImage", params);
55 void ListItemStub::setTitle(const QString &name)
57 QList<ParameterBase *> params;
58 params.append(new Parameter<const QString &>(name));
59 stubMethodEntered("setTitle", params);
62 void ListItemStub::setSize(const QSize &size)
64 QList<ParameterBase *> params;
65 params.append(new Parameter<const QSize &>(size));
66 stubMethodEntered("setSize", params);
69 QString ListItemStub::shortenText(const QString &text, int textWidth, ListItem::TextSize textSize)
71 QList<ParameterBase *> params;
72 params.append(new Parameter<const QString &>(text));
73 params.append(new Parameter<int>(textWidth));
74 params.append(new Parameter<ListItem::TextSize>(textSize));
75 stubMethodEntered("shortenText", params);
77 return stubReturnValue<QString>("shortenText");
80 QString ListItemStub::title()
82 return stubReturnValue<QString>("title");
85 //Create a stub instance
86 ListItemStub defaultListItemStub;
87 ListItemStub *listItemStub = &defaultListItemStub;
89 ListItem::ListItem(QListWidget *parent, int type)
90 : QListWidgetItem(parent, type)
92 listItemStub->ListItemConstructor(parent, type);
95 void ListItem::setImage(const QPixmap &image)
97 listItemStub->setImage(image);
100 void ListItem::setTitle(const QString &name)
102 listItemStub->setTitle(name);
105 void ListItem::setSize(const QSize &size)
107 listItemStub->setSize(size);
110 QString ListItem::shortenText(const QString &text, int textWidth, ListItem::TextSize textSize)
112 return listItemStub->shortenText(text, textWidth, textSize);
115 QString ListItem::title()
117 return listItemStub->title();
120 #endif // LISTITEMSTUB_H