00001 #ifndef FILTERPANEL_H
00002 #define FILTERPANEL_H
00003
00004 #include <QWidget>
00005 #include <QVariant>
00006 #include <QMetaType>
00007
00008 class QIcon;
00009 class QToolBar;
00010 class QString;
00011 class QActionGroup;
00012 class DriverInfo;
00013
00014 #ifdef Q_WS_MAEMO_5
00015 #define TOOLBAR_ICON_SIZE 26
00016 #else
00017 #define TOOLBAR_ICON_SIZE 32
00018 #endif
00019
00020 struct FilteredService
00021 {
00022 QAction* action;
00023 DriverInfo* driverInfo;
00024 int index;
00025 };
00026 Q_DECLARE_METATYPE(FilteredService)
00027
00028 class FilterPanel : public QWidget
00029 {
00030 Q_OBJECT
00031
00032 QToolBar* mToolbar;
00033 QActionGroup* mActionGroup;
00034 int mLastIndex;
00035 int mCurrentIndex;
00036
00037 void createToolbar();
00038
00039 public:
00040 explicit FilterPanel(QWidget *parent = 0);
00041
00042 void addItem(QAction* action, DriverInfo* driver, bool checked = false);
00043 QList<QAction*> getServiceActions();
00044
00045 signals:
00046 void itemSelected(DriverInfo* driverInfo, int index);
00047
00048 private slots:
00049 void serviceSelected(QAction* act);
00050
00051 public slots:
00052 void addItem(const QIcon& icon, DriverInfo* driver, bool checked = false);
00053 void addItem(const QString& string, DriverInfo* driver, bool checked = false);
00054 void clear();
00055 void checkItem(DriverInfo*, int index);
00056 };
00057
00058 #endif // FILTERPANEL_H