-
Notifications
You must be signed in to change notification settings - Fork 9
/
mainwindow.h
128 lines (107 loc) · 2.73 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef LIVETIKZ_H
#define LIVETIKZ_H
#include <QMenuBar>
#include <QDesktopWidget>
#include <QFileDialog>
#include <QScrollBar>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QInputDialog>
#include <QLabel>
#include <QLineEdit>
#include <QProcess>
#include <QPushButton>
#include <QScrollArea>
#include <QSettings>
#include <QSplitter>
#include <QTemporaryFile>
#include <QTemporaryDir>
#include <QFileSystemWatcher>
#include <QTextEdit>
#include <QTextCursor>
#include <QTimer>
#include <QMessageLogger>
#include <KParts/MainWindow>
#include <KTextEditor/Document>
#include <KTextEditor/View>
#include <poppler-qt5.h>
#include <ZoomScrollImage.h>
class MainWindow : public KParts::MainWindow {
Q_OBJECT
public:
MainWindow();
virtual ~MainWindow();
public slots:
void load(const QUrl &url);
void load();
void textChanged(KTextEditor::Document *document);
void documentSaved(KTextEditor::Document *document, bool saveas);
void refresh();
void browse();
void chooseWorkdir();
void render(double scale);
void renderFinished(int code);
void renderFailed(QProcess::ProcessError);
void showCompilerSelection();
void updateLog();
void watchme(const QString& filename);
void handleTemplateChanged(const QString& filename);
void handleTexfileChanged(const QString& filename);
void gotoPreviousImage();
void gotoNextImage();
void updateTemplate(const QString& filename);
void exportPNG();
void exportPDF();
private:
void setupActions();
void setupMenu();
void setupUI();
void setupEditor();
void render();
void compile();
void clearLog();
void appendLog(QString str);
void updateRootDirectory();
bool isEmptyLine(QImage& img, int line);
bool isEmptyCol(QImage& img, int col);
QImage image;
QWidget *window;
QSplitter *splitView;
QHBoxLayout *mainLayout;
QHBoxLayout *templateLayout;
QHBoxLayout *workdirLayout;
QHBoxLayout *logLayout;
QSpacerItem *spacerItem;
QVBoxLayout *containerLayout;
QHBoxLayout *wdtmplLayout;
QSplitter* splitLogView;
QWidget *logWidget;
KParts::ReadWritePart *katePart;
KTextEditor::View *view;
KTextEditor::Document *doc;
ZoomScrollImage *display;
QFileInfo texdir;
QFileInfo workdir;
QTemporaryDir* dir;
Poppler::Document *currentDoc;
QTimer *refreshTimer;
QTimer *renderTimer;
QTextEdit *log;
QUrl templateFile;
QLineEdit *templateLabel;
QPushButton *browseButton;
QLineEdit *workdirLabel;
QPushButton *workdirButton;
QPushButton* killButton;
QFileSystemWatcher templateWatcher;
QFileSystemWatcher *texfileWatcher;
QProcess *renderProcess;
QString renderOutput;
QAction* nextImage;
QAction* prevImage;
QAction* exportImgPng;
QAction* exportImgPdf;
int currentPage;
bool usersaved;
};
#endif