File indexing completed on 2024-05-05 04:47:28
0001 /**************************************************************************************** 0002 * Copyright (c) 2011 Bart Cerneels <bart.cerneels@kde.org * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef BROWSERMESSAGEAREA_H 0018 #define BROWSERMESSAGEAREA_H 0019 0020 #include "core/logger/Logger.h" 0021 #include "statusbar/CompoundProgressBar.h" 0022 #include "statusbar/KJobProgressBar.h" 0023 #include "statusbar/NetworkProgressBar.h" 0024 #include "widgets/BoxWidget.h" 0025 0026 #include <QTimer> 0027 0028 class BrowserMessageArea : public BoxWidget, public Amarok::Logger 0029 { 0030 Q_OBJECT 0031 0032 public: 0033 explicit BrowserMessageArea( QWidget *parent ); 0034 0035 ~BrowserMessageArea() override 0036 { 0037 } 0038 0039 protected: 0040 /* Amarok::Logger virtual methods */ 0041 void shortMessageImpl( const QString &text ) override; 0042 void longMessageImpl( const QString &text, MessageType type ) override; 0043 void newProgressOperationImpl( KJob * job, const QString & text, QObject *context, 0044 const std::function<void ()> &function, Qt::ConnectionType type ) override; 0045 0046 void newProgressOperationImpl( QNetworkReply *reply, const QString &text, QObject *obj, 0047 const std::function<void ()> &function, Qt::ConnectionType type ) override; 0048 0049 void newProgressOperationImpl( QObject *sender, const QMetaMethod &increment, const QMetaMethod &end, const QString &text, 0050 int maximum, QObject *obj, const std::function<void ()> &function, Qt::ConnectionType type ) override; 0051 0052 Q_SIGNALS: 0053 void signalLongMessage( const QString & text, MessageType type ); 0054 0055 private Q_SLOTS: 0056 void hideProgress(); 0057 void nextShortMessage(); 0058 void slotLongMessage( const QString &text, MessageType type = Information ); 0059 0060 private: 0061 CompoundProgressBar *m_progressBar; 0062 QLabel *m_messageLabel; 0063 0064 bool m_busy; 0065 QTimer *m_shortMessageTimer; 0066 QList<QString> m_shortMessageQueue; 0067 }; 0068 0069 #endif // BROWSERMESSAGEAREA_H