readmepanel.h 852 Bytes
Newer Older
Hadi Charara's avatar
Hadi Charara committed
1
2
3
4
5
6
7
8
9
10
#ifndef READMEPANEL_H
#define READMEPANEL_H

#include "panels/panel.h"
#include <QTextBrowser>

class QVBoxLayout;
class QWidget;

namespace KParts {
Hadi Charara's avatar
Hadi Charara committed
11
class ReadOnlyPart;
Hadi Charara's avatar
Hadi Charara committed
12
13
14
15
16
17
18
19
20
21
}
/**
 * @brief Shows a preview of README.md if it is located in the current folder.
 */
class ReadmePanel : public Panel
{
    Q_OBJECT

public:
    explicit ReadmePanel(QWidget* parent = nullptr);
Hadi Charara's avatar
Hadi Charara committed
22
    ~ReadmePanel() override;
Hadi Charara's avatar
Hadi Charara committed
23
24
25
26
27
28
29
    QSharedPointer<QAction> toggleViewAction;

public Q_SLOTS:
    void toggleView(bool);

Q_SIGNALS:
    void triggered(bool checked = false);
Hadi Charara's avatar
Hadi Charara committed
30
31
32
33

protected:
    bool urlChanged() override;

Hadi Charara's avatar
Hadi Charara committed
34
35
    void show();
    void hide();
Hadi Charara's avatar
Hadi Charara committed
36
37

private:
Hadi Charara's avatar
Hadi Charara committed
38
    inline void configureTextBrowser();
Hadi Charara's avatar
Hadi Charara committed
39
40
41
42
    QVBoxLayout* m_layout;
    QWidget* m_readmeWidget;
    KParts::ReadOnlyPart* m_markdownPart;
    QUrl m_readmeUrl;
Hadi Charara's avatar
Hadi Charara committed
43
    QTextBrowser* m_textBrowser;
Hadi Charara's avatar
Hadi Charara committed
44
45
46
};

#endif // READMEPANEL_H