~ubuntu-branches/ubuntu/utopic/smb4k/utopic-proposed

« back to all changes in this revision

Viewing changes to smb4k/browser/smb4knetworkbrowsertooltip.h

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2012-05-19 18:54:34 UTC
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: package-import@ubuntu.com-20120519185434-kpqpdrg5i47zm7tl
Tags: upstream-1.0.1
ImportĀ upstreamĀ versionĀ 1.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
    smb4knetworkbrowsertooltip  -  Tool tip for the network browser.
3
 
                             -------------------
4
 
    begin                : Sa Jan 20 2007
5
 
    copyright            : (C) 2007-2008 by Alexander Reinholdt
6
 
    email                : dustpuppy@users.berlios.de
7
 
 ***************************************************************************/
8
 
 
9
 
/***************************************************************************
10
 
 *   This program is free software; you can redistribute it and/or modify  *
11
 
 *   it under the terms of the GNU General Public License as published by  *
12
 
 *   the Free Software Foundation; either version 2 of the License, or     *
13
 
 *   (at your option) any later version.                                   *
14
 
 *                                                                         *
15
 
 *   This program is distributed in the hope that it will be useful, but   *
16
 
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
17
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
18
 
 *   General Public License for more details.                              *
19
 
 *                                                                         *
20
 
 *   You should have received a copy of the GNU General Public License     *
21
 
 *   along with this program; if not, write to the                         *
22
 
 *   Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,   *
23
 
 *   MA  02111-1307 USA                                                    *
24
 
 ***************************************************************************/
25
 
 
26
 
#ifndef SMB4KNETWORKBROWSERTOOLTIP_H
27
 
#define SMB4KNETWORKBROWSERTOOLTIP_H
28
 
 
29
 
#ifdef HAVE_CONFIG_H
30
 
#include <config.h>
31
 
#endif
32
 
 
33
 
// Qt includes
34
 
#include <QLabel>
35
 
#include <QFrame>
36
 
#include <QGridLayout>
37
 
 
38
 
// Forward declarations:
39
 
class Smb4KNetworkBrowserItem;
40
 
 
41
 
 
42
 
/**
43
 
 * This class provides the tool tip for the network browser
44
 
 * of Smb4K. It shows information about the associated share.
45
 
 *
46
 
 * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
47
 
 */
48
 
 
49
 
class Smb4KNetworkBrowserToolTip : public QLabel
50
 
{
51
 
  Q_OBJECT
52
 
 
53
 
  public:
54
 
    /**
55
 
     * The constructor
56
 
     *
57
 
     * @param parent          The parent widget of the tool tip.
58
 
     */
59
 
    Smb4KNetworkBrowserToolTip( QWidget *parent = 0 );
60
 
 
61
 
    /**
62
 
     * The destructor
63
 
     */
64
 
    ~Smb4KNetworkBrowserToolTip();
65
 
 
66
 
    /**
67
 
     * If you need to update the tool tip while it is shown, this is the function
68
 
     * you want to use. It rereads the entries from the assossiated
69
 
     * Smb4KNetworkBrowserItem object and modifies the tool tip if changes happened.
70
 
     */
71
 
    void update();
72
 
 
73
 
    /**
74
 
     * Returns the Smb4KNetworkBrowserItem object for which the tool tip
75
 
     * should be shown.
76
 
     *
77
 
     * @returns a pointer to a Smb4KNetworkBrowserItem object.
78
 
     */
79
 
    Smb4KNetworkBrowserItem *item() { return m_item; }
80
 
 
81
 
    /**
82
 
     * Set up the tool tip. This function takes the network browser item @p item
83
 
     * for which the tool tip should be shown. Before the tool tip is set up according
84
 
     * to the data of @p item, the tool tip is cleared.
85
 
     *
86
 
     * @param item            The network browser item for which the tool tip should
87
 
     *                        be shown.
88
 
     */
89
 
    void setupToolTip( Smb4KNetworkBrowserItem *item );
90
 
 
91
 
    /**
92
 
     * Clear the tool tip and reset the internal pointer to the network item. The
93
 
     * tool tip will be blank after this function was called.
94
 
     */
95
 
    void clearToolTip();
96
 
 
97
 
    /**
98
 
     * This function returns TRUE if the tool tip is cleared, i.e. is blank, and
99
 
     * FALSE otherwise.
100
 
     *
101
 
     * @returns TRUE if the tool tip is cleared.
102
 
     */
103
 
    bool isCleared() const { return m_cleared; }
104
 
 
105
 
  signals:
106
 
    /**
107
 
     * This signal is emitted when the tool tip is about to be shown.
108
 
     *
109
 
     * @param item            The network item that carries the data that
110
 
     *                        is about to be shown.
111
 
     */
112
 
    void aboutToShow( Smb4KNetworkBrowserItem *item );
113
 
 
114
 
    /**
115
 
     * This signal is emitted when the tool tip is about to be hidden.
116
 
     */
117
 
    void aboutToHide();
118
 
 
119
 
  protected:
120
 
    /**
121
 
     * Reimplemented from QLabel.
122
 
     */
123
 
    void mousePressEvent( QMouseEvent *e );
124
 
 
125
 
    /**
126
 
     * Reimplemented from QLabel.
127
 
     */
128
 
    void leaveEvent( QEvent *e );
129
 
 
130
 
    /**
131
 
     * Reimplemented from QLabel.
132
 
     */
133
 
    void showEvent( QShowEvent *e );
134
 
 
135
 
    /**
136
 
     * Reimplemented from QLabel.
137
 
     */
138
 
    void hideEvent( QHideEvent *e );
139
 
 
140
 
  private:
141
 
    /**
142
 
     * The pointer to the Smb4KNetworkBrowserItem object
143
 
     */
144
 
    Smb4KNetworkBrowserItem *m_item;
145
 
 
146
 
    /**
147
 
     * The layout for the tool tip
148
 
     */
149
 
    QGridLayout *m_layout;
150
 
 
151
 
    /**
152
 
     * Workgroup label
153
 
     */
154
 
    QLabel *m_workgroup_label;
155
 
 
156
 
    /**
157
 
     * Workgroup
158
 
     */
159
 
    QLabel *m_workgroup;
160
 
 
161
 
    /**
162
 
     * Master browser label
163
 
     */
164
 
    QLabel *m_master_browser_label;
165
 
 
166
 
    /**
167
 
     * Master browser
168
 
     */
169
 
    QLabel *m_master_browser;
170
 
 
171
 
    /**
172
 
     * Host label
173
 
     */
174
 
    QLabel *m_host_label;
175
 
 
176
 
    /**
177
 
     * Host
178
 
     */
179
 
    QLabel *m_host;
180
 
 
181
 
    /**
182
 
     * Comment label
183
 
     */
184
 
    QLabel *m_comment_label;
185
 
 
186
 
    /**
187
 
     * Comment
188
 
     */
189
 
    QLabel *m_comment;
190
 
 
191
 
    /**
192
 
     * IP address label
193
 
     */
194
 
    QLabel *m_ip_label;
195
 
 
196
 
    /**
197
 
     * IP address
198
 
     */
199
 
    QLabel *m_ip;
200
 
 
201
 
    /**
202
 
     * Operating system label
203
 
     */
204
 
    QLabel *m_os_label;
205
 
 
206
 
    /**
207
 
     * Operating system
208
 
     */
209
 
    QLabel *m_os;
210
 
 
211
 
    /**
212
 
     * Server label
213
 
     */
214
 
    QLabel *m_server_label;
215
 
 
216
 
    /**
217
 
     * Server
218
 
     */
219
 
    QLabel *m_server;
220
 
 
221
 
    /**
222
 
     * Separating line
223
 
     */
224
 
    QFrame *m_line;
225
 
 
226
 
    /**
227
 
     * Share label
228
 
     */
229
 
    QLabel *m_share_label;
230
 
 
231
 
    /**
232
 
     * Share
233
 
     */
234
 
    QLabel *m_share;
235
 
 
236
 
    /**
237
 
     * Type label
238
 
     */
239
 
    QLabel *m_type_label;
240
 
 
241
 
    /**
242
 
     * Type
243
 
     */
244
 
    QLabel *m_type;
245
 
 
246
 
    /**
247
 
     * Mounted label
248
 
     */
249
 
    QLabel *m_mounted_label;
250
 
 
251
 
    /**
252
 
     * Mounted
253
 
     */
254
 
    QLabel *m_mounted;
255
 
 
256
 
    /**
257
 
     * Icon
258
 
     */
259
 
    QLabel *m_icon;
260
 
 
261
 
    /**
262
 
     * Is the tool tip cleared?
263
 
     */
264
 
    bool m_cleared;
265
 
};
266
 
 
267
 
#endif