lyricswidget.h 1.48 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/**
 * Copyright (C) 2012 Martin Sandsmark <martin.sandsmark@kde.org>
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 */
16

17 18 19
#ifndef LYRICSWIDGET_H
#define LYRICSWIDGET_H

20
#include <QTextBrowser>
21 22 23 24 25 26
#include "filehandle.h"

class QNetworkAccessManager;
class QNetworkReply;


27
class LyricsWidget : public QTextBrowser
28 29 30 31 32
{
    Q_OBJECT

public:
    explicit LyricsWidget(QWidget *parent);
Michael Pyne's avatar
Michael Pyne committed
33

34
    virtual ~LyricsWidget();
Michael Pyne's avatar
Michael Pyne committed
35

36
    QSize minimumSize() const { return QSize(100, 0); }
Michael Pyne's avatar
Michael Pyne committed
37

38 39 40
public Q_SLOTS:
    void playing(const FileHandle &file);

41
protected:
42
    virtual void showEvent(QShowEvent*) override;
43 44 45

private:
    void makeLyricsRequest();
46

47 48 49
private Q_SLOTS:
    void receiveListReply(QNetworkReply*);
    void receiveLyricsReply(QNetworkReply*);
50
    void saveConfig();
Michael Pyne's avatar
Michael Pyne committed
51

52
private:
53
    FileHandle m_playingFile;
54
    QNetworkAccessManager *m_networkAccessManager;
55
    QString m_title;
56
    bool m_lyricsCurrent;
57
};
Michael Pyne's avatar
Michael Pyne committed
58

59
#endif//LYRICSWIDGET_H