1 /***************************************************************************
2 * Copyright 2007 by Enrico Ros <enrico.ros@gmail.com> *
3 * Copyright 2007 by Riccardo Iaconelli <ruphy@kde.org> *
4 * Copyright 2008 by Aaron Seigo <aseigo@kde.org> *
5 * Copyright 2008 by Davide Bettio <davide.bettio@kdemail.net> *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
21 ***************************************************************************/
23 #ifndef __ResultScene_h__
24 #define __ResultScene_h__
26 #include <QtCore/QList>
27 #include <QtCore/QMultiMap>
28 #include <QtCore/QTimer>
29 #include <QtGui/QGraphicsScene>
30 #include <QtGui/QIcon>
31 #include <QtGui/QPixmap>
33 #include <Plasma/QueryMatch>
43 class ResultScene
: public QGraphicsScene
48 explicit ResultScene(Plasma::RunnerManager
*runnerManager
, QObject
*parent
= 0);
51 void resize(int width
, int height
);
52 ResultItem
* defaultResultItem() const;
53 void run(ResultItem
* item
) const;
54 QSize
minimumSizeHint() const;
56 Plasma::RunnerManager
* manager() const;
58 uint
pageCount() const;
63 void setPage(uint index
);
64 void setQueryMatches(const QList
<Plasma::QueryMatch
> &matches
);
65 void launchQuery(const QString
&term
);
66 void launchQuery(const QString
&term
, const QString
&runner
);
70 void itemActivated(ResultItem
*item
);
71 void itemHoverEnter(ResultItem
*item
);
72 void itemHoverLeave(ResultItem
*item
);
73 void matchCountChanged(int count
);
76 void keyPressEvent(QKeyEvent
* keyEvent
);
77 void focusOutEvent(QFocusEvent
*focusEvent
);
78 void wheelEvent(QGraphicsSceneWheelEvent
* wheelEvent
);
81 ResultItem
* addQueryMatch(const Plasma::QueryMatch
&match
, bool useAnyId
);
82 void performResize(int width
, int height
);
84 Plasma::RunnerManager
*m_runnerManager
;
88 QPixmap m_forePixmap1
;
89 QPixmap m_forePixmap2
;
91 // for resize optimization
94 bool m_successfullyResized
;
98 QList
<ResultItem
*> m_items
;
99 QMultiMap
<QString
, ResultItem
*> m_itemsById
;
106 Plasma::FrameSvg
*m_frame
;
110 void slotArrowResultItemPressed();
111 void slotArrowResultItemReleased();