File indexing completed on 2021-12-21 13:27:55

0001 /**
0002  * Copyright (C) 2012 Martin Sandsmark <martin.sandsmark@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 LYRICSWIDGET_H
0018 #define LYRICSWIDGET_H
0019 
0020 #include <QTextBrowser>
0021 #include "filehandle.h"
0022 
0023 class QNetworkAccessManager;
0024 class QNetworkReply;
0025 
0026 
0027 class LyricsWidget : public QTextBrowser
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     explicit LyricsWidget(QWidget *parent);
0033 
0034     virtual ~LyricsWidget();
0035 
0036     QSize minimumSize() const { return QSize(100, 0); }
0037 
0038 public Q_SLOTS:
0039     void playing(const FileHandle &file);
0040 
0041 protected:
0042     virtual void showEvent(QShowEvent*) override;
0043 
0044 private:
0045     void makeLyricsRequest();
0046 
0047 private Q_SLOTS:
0048     void receiveListReply(QNetworkReply*);
0049     void receiveLyricsReply(QNetworkReply*);
0050     void saveConfig();
0051 
0052 private:
0053     FileHandle m_playingFile;
0054     QNetworkAccessManager *m_networkAccessManager;
0055     QString m_title;
0056     bool m_lyricsCurrent;
0057 };
0058 
0059 #endif//LYRICSWIDGET_H