File indexing completed on 2024-02-25 16:46:51

0001 /***************************************************************************
0002     smb4ktooltip  -  Provides tooltips for Smb4K
0003                              -------------------
0004     begin                : Sa Dez 23 2010
0005     copyright            : (C) 2010-2017 by Alexander Reinholdt
0006     email                : alexander.reinholdt@kdemail.net
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *   This program is free software; you can redistribute it and/or modify  *
0011  *   it under the terms of the GNU General Public License as published by  *
0012  *   the Free Software Foundation; either version 2 of the License, or     *
0013  *   (at your option) any later version.                                   *
0014  *                                                                         *
0015  *   This program is distributed in the hope that it will be useful, but   *
0016  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
0017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
0018  *   General Public License for more details.                              *
0019  *                                                                         *
0020  *   You should have received a copy of the GNU General Public License     *
0021  *   along with this program; if not, write to the                         *
0022  *   Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,*
0023  *   MA 02110-1335, USA                                                    *
0024  ***************************************************************************/
0025 
0026 #ifndef SMB4KTOOLTIP_H
0027 #define SMB4KTOOLTIP_H
0028 
0029 // application specific includes
0030 #include "core/smb4kglobal.h"
0031 
0032 // Qt includes
0033 #include <QPoint>
0034 #include <QWidget>
0035 #include <QGridLayout>
0036 #include <QHBoxLayout>
0037 #include <QVBoxLayout>
0038 #include <QLabel>
0039 
0040 // forward declarations
0041 class Smb4KBasicNetworkItem;
0042 
0043 class Q_DECL_EXPORT Smb4KToolTip : public QWidget
0044 {
0045   Q_OBJECT
0046   
0047   public:
0048     enum Parent { 
0049       NetworkBrowser,
0050       SharesView,
0051       UnknownParent
0052     };
0053     explicit Smb4KToolTip(QWidget *parent = 0);
0054     ~Smb4KToolTip();
0055     void setup(Parent parent, const NetworkItemPtr &item);
0056     void update(Parent parent, const NetworkItemPtr &item);
0057     void show(const QPoint &pos);
0058     void hide();
0059     const NetworkItemPtr &networkItem() { return m_item; }
0060     
0061   protected:
0062     void paintEvent(QPaintEvent *e) override;
0063     
0064   protected slots:
0065     void slotHideToolTip();
0066     
0067   private:
0068     NetworkItemPtr m_item;
0069     QHBoxLayout *m_tip_layout;
0070     QVBoxLayout *m_info_layout;
0071     QGridLayout *m_text_layout;
0072     void setupNetworkBrowserToolTip();
0073     void updateNetworkBrowserToolTip();
0074     void setupSharesViewToolTip();
0075     void updateSharesViewToolTip();
0076     static void arc(QPainterPath& path,
0077                     qreal cx, qreal cy,
0078                     qreal radius, qreal angle,
0079                     qreal sweepLength);
0080     QLabel *m_master_browser_label;
0081     QLabel *m_comment_label;
0082     QLabel *m_ip_label;
0083     QLabel *m_mounted_label;
0084     QLabel *m_size_label;
0085 };
0086 
0087 #endif