vnote/veditor.h
Le Tan 7bce2cb298 use QWebEngineView to display markdown files
Thanks to [marked JavaScript library](https://github.com/chjj/marked) by
Christopher Jeffrey. The
[style sheet](http://kevinburke.bitbucket.org/markdowncss/markdown.css)
was created by Kevin Burke.

Signed-off-by: Le Tan <tamlokveer@gmail.com>
2016-10-09 20:47:20 +08:00

44 lines
875 B
C++

#ifndef VEDITOR_H
#define VEDITOR_H
#include <QStackedWidget>
#include <QString>
#include "vconstants.h"
#include "vnotefile.h"
#include "vdocument.h"
class QTextBrowser;
class VEdit;
class QWebEngineView;
class VEditor : public QStackedWidget
{
public:
VEditor(const QString &path, const QString &name, bool modifiable,
QWidget *parent = 0);
~VEditor();
bool requestClose();
// Enter edit mode
void editFile();
// Enter read mode
void readFile();
// Save file
bool saveFile();
private:
bool isMarkdown(const QString &name);
void setupUI();
void showFileReadMode();
void showFileEditMode();
void setupMarkdownPreview();
VNoteFile *noteFile;
bool isEditMode;
QTextBrowser *textBrowser;
VEdit *textEditor;
QWebEngineView *webPreviewer;
VDocument document;
};
#endif // VEDITOR_H