]> cloud.milkyroute.net Git - dolphin.git/blob - src/tagcloud/tagcloud.h
There are some extractable strings in subdirs too.
[dolphin.git] / src / tagcloud / tagcloud.h
1 /*
2 This file is part of the Nepomuk KDE project.
3 Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef _NEPOMUK_TAG_CLOUD_H_
21 #define _NEPOMUK_TAG_CLOUD_H_
22
23 #include <QtGui/QFrame>
24 #include <QtCore/QList>
25
26 #include <nepomuk/tag.h>
27
28 #include <Soprano/Statement>
29
30 class QResizeEvent;
31 class QPaintEvent;
32 class QMouseEvent;
33 class QEvent;
34
35 namespace Nepomuk {
36 class TagCloud : public QFrame
37 {
38 Q_OBJECT
39
40 public:
41 TagCloud( QWidget* parent = 0 );
42 ~TagCloud();
43
44 enum Sorting {
45 SortAlpabetically,
46 SortByWeight,
47 SortRandom
48 };
49
50 int heightForWidth( int w ) const;
51 QSize sizeHint() const;
52 QSize minimumSizeHint() const;
53
54 bool zoomEnabled() const;
55
56 public Q_SLOTS:
57 /**
58 * Set the maximum used font size. The default is 0
59 * which means to calculate proper values from the KDE
60 * defaults.
61 */
62 void setMaxFontSize( int size );
63
64 /**
65 * Set the minimum used font size. The default is 0
66 * which means to calculate proper values from the KDE
67 * defaults.
68 */
69 void setMinFontSize( int size );
70
71 /**
72 * Set the maximum number of displayed tags. The default is 0
73 * which means to display all tags.
74 *
75 * NOT IMPLEMENTED YET
76 */
77 void setMaxNumberDisplayedTags( int n );
78
79 /**
80 * Allow selection of tags, i.e. enabling and disabling of tags.
81 */
82 void setSelectionEnabled( bool enabled );
83
84 void setNewTagButtonEnabled( bool enabled );
85 void setContextMenuEnabled( bool enabled );
86 void setAlignment( Qt::Alignment alignment );
87
88 void setZoomEnabled( bool zoom );
89
90 /**
91 * Default: SortAlpabetically
92 */
93 void setSorting( Sorting );
94
95 /**
96 * Will reset tags set via showTags()
97 */
98 void showAllTags();
99
100 /**
101 * Set the tags to be shown in the tag cloud.
102 * If the new tag button is enabled (setEnableNewTagButton())
103 * new tags will automatically be added to the list of shown tags.
104 */
105 void showTags( const QList<Tag>& tags );
106
107 void showResourceTags( const Resource& resource );
108
109 /**
110 * Select or deselect a tag. This does only make sense
111 * if selection is enabled and \p tag is actually
112 * displayed.
113 *
114 * \sa setSelectionEnabled
115 */
116 void setTagSelected( const Tag& tag, bool selected );
117
118 void setCustomNewTagAction( QAction* action );
119
120 Q_SIGNALS:
121 void tagClicked( const Nepomuk::Tag& tag );
122 void tagAdded( const Nepomuk::Tag& tag );
123 void tagToggled( const Nepomuk::Tag& tag, bool enabled );
124
125 protected:
126 void resizeEvent( QResizeEvent* e );
127 void paintEvent( QPaintEvent* e );
128 void mousePressEvent( QMouseEvent* );
129 void mouseMoveEvent( QMouseEvent* );
130 void leaveEvent( QEvent* );
131
132 private Q_SLOTS:
133 void slotStatementAdded( const Soprano::Statement& s );
134 void slotStatementRemoved( const Soprano::Statement& s );
135
136 private:
137 class Private;
138 Private* const d;
139 };
140 }
141
142 #endif