1 /******************************************************************************* 2 ** 3 ** Photivo 4 ** 5 ** Copyright (C) 2009-2011 Michael Munzert <mail@mm-log.com> 6 ** Copyright (C) 2011 Bernd Schoeler <brjohn@brother-john.net> 7 ** 8 ** This file is part of Photivo. 9 ** 10 ** Photivo is free software: you can redistribute it and/or modify 11 ** it under the terms of the GNU General Public License version 3 12 ** as published by the Free Software Foundation. 13 ** 14 ** Photivo is distributed in the hope that it will be useful, 15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 ** GNU General Public License for more details. 18 ** 19 ** You should have received a copy of the GNU General Public License 20 ** along with Photivo. If not, see <http://www.gnu.org/licenses/>. 21 ** 22 *******************************************************************************/ 23 /** 24 ** Displays the status overlays in the view window. 25 ** 26 ** - The overlay is displayed for duration() milliseconds. If you set the 27 ** duration to 0 the overlay is displayed until you call stop(). 28 ** - Foreground colours is for the text and wiget border. Background colour 29 **/ 30 31 #ifndef PTREPORTOVERLAY_H 32 #define PTREPORTOVERLAY_H 33 34 #include <QTimer> 35 #include <QLabel> 36 37 38 /////////////////////////////////////////////////////////////////////////// 39 // 40 // class ptReportOverlay 41 // 42 /////////////////////////////////////////////////////////////////////////// 43 44 class ptReportOverlay : public QLabel 45 { 46 Q_OBJECT 47 48 public: 49 explicit ptReportOverlay(QWidget* parent, 50 const QString& text, 51 const QColor& color, 52 const QColor& backgroundColor, 53 const int duration, 54 const Qt::Alignment pos, 55 const int padding); 56 ~ptReportOverlay(); 57 duration()58 inline int duration() { return m_Timer->interval(); } 59 void exec(const QString& newText = ""); 60 void setColors(const QColor& color, const QColor& backgroundColor); setDuration(const int msec)61 inline void setDuration(const int msec) { m_Timer->setInterval(msec); } 62 void stop(); 63 64 private: 65 int m_Padding; 66 Qt::Alignment m_Position; // only left or right for now 67 QTimer* m_Timer; 68 QWidget* m_Parent; 69 70 void UpdatePosition(); 71 72 private slots: 73 void TimerExpired(); 74 }; 75 76 #endif // PTREPORTOVERLAY_H 77