2017-08-20 01:20:47 +02:00
|
|
|
#ifndef SYNCTHINGWIDGETS_TEXTVIEWDIALOG_H
|
|
|
|
#define SYNCTHINGWIDGETS_TEXTVIEWDIALOG_H
|
2016-09-08 23:35:15 +02:00
|
|
|
|
2017-04-23 18:27:31 +02:00
|
|
|
#include "../global.h"
|
|
|
|
|
2016-09-08 23:35:15 +02:00
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QTextBrowser)
|
2017-09-09 21:38:05 +02:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
|
2016-09-08 23:35:15 +02:00
|
|
|
|
2017-07-31 23:56:06 +02:00
|
|
|
namespace Data {
|
2017-08-29 23:52:47 +02:00
|
|
|
class SyncthingConnection;
|
2017-07-31 23:56:06 +02:00
|
|
|
struct SyncthingDir;
|
2017-09-08 16:56:10 +02:00
|
|
|
struct SyncthingLogEntry;
|
2017-09-17 21:48:15 +02:00
|
|
|
} // namespace Data
|
2017-07-31 23:56:06 +02:00
|
|
|
|
2016-09-08 23:35:15 +02:00
|
|
|
namespace QtGui {
|
|
|
|
|
2017-05-01 03:34:43 +02:00
|
|
|
class SYNCTHINGWIDGETS_EXPORT TextViewDialog : public QWidget {
|
2016-09-08 23:35:15 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
TextViewDialog(const QString &title = QString(), QWidget *parent = nullptr);
|
|
|
|
|
|
|
|
QTextBrowser *browser();
|
2018-11-03 21:30:17 +01:00
|
|
|
QVBoxLayout *layout();
|
2017-08-29 23:52:47 +02:00
|
|
|
static TextViewDialog *forLogEntries(Data::SyncthingConnection &connection);
|
2017-09-08 16:56:10 +02:00
|
|
|
static TextViewDialog *forLogEntries(const std::vector<Data::SyncthingLogEntry> &logEntries, const QString &title = QString());
|
2016-09-08 23:35:15 +02:00
|
|
|
|
2017-08-20 01:20:47 +02:00
|
|
|
Q_SIGNALS:
|
2016-12-11 20:52:46 +01:00
|
|
|
void reload();
|
|
|
|
|
|
|
|
protected:
|
2018-10-10 21:26:46 +02:00
|
|
|
void keyPressEvent(QKeyEvent *event) override;
|
2016-12-11 20:52:46 +01:00
|
|
|
|
2016-09-08 23:35:15 +02:00
|
|
|
private:
|
2017-09-08 16:56:10 +02:00
|
|
|
void showLogEntries(const std::vector<Data::SyncthingLogEntry> &logEntries);
|
|
|
|
|
2016-09-08 23:35:15 +02:00
|
|
|
QTextBrowser *m_browser;
|
2017-09-09 21:38:05 +02:00
|
|
|
QVBoxLayout *m_layout;
|
2016-09-08 23:35:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
inline QTextBrowser *TextViewDialog::browser()
|
|
|
|
{
|
|
|
|
return m_browser;
|
|
|
|
}
|
2018-11-03 21:30:17 +01:00
|
|
|
|
|
|
|
inline QVBoxLayout *TextViewDialog::layout()
|
|
|
|
{
|
|
|
|
return m_layout;
|
|
|
|
}
|
|
|
|
|
2017-09-17 21:48:15 +02:00
|
|
|
} // namespace QtGui
|
2016-09-08 23:35:15 +02:00
|
|
|
|
2017-08-20 01:20:47 +02:00
|
|
|
#endif // SYNCTHINGWIDGETS_TEXTVIEWDIALOG_H
|