-
Notifications
You must be signed in to change notification settings - Fork 3
/
tab.h
68 lines (57 loc) · 1.53 KB
/
tab.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
#pragma once
#include <QProcess>
#include <QString>
#include <QTemporaryFile>
#include <QWidget>
#include <Qsci/qsciscintilla.h>
class ViewWidget;
class QTextEdit;
class ViewWidget;
class QSplitter;
class QsciLexer;
class Canvas;
class Tab : public QWidget
{
Q_OBJECT
public:
Tab(QWidget *parent = nullptr);
private:
QsciScintilla *code;
QsciLexer *lexer;
Canvas *canvas;
QToolBar *toolbar;
QTextEdit *console;
QSplitter *v_splitter;
QSplitter *h_splitter;
QString curFile;
QProcess process;
QTemporaryFile stl;
bool reload = false;
QString stderr_;
QString stdout_;
void log(const QString &) const;
void logError(const QString &) const;
std::pair<bool, QString> writeFile(const QString &) const;
void call_implicitcad(const QString &inputFile, const QString outputFile,
const float resolution = 0,
const QString &format = "stl");
void load_stl(const QString &filename, const bool reload = false);
signals:
void fileNameChanged(const QString &fileName);
void copyAvailable(bool) const;
public:
bool hasModifiedCode() const;
bool hasSelectedCode() const;
void newFile();
bool hasFile() const;
void setFileName(const QString &fileName);
const QString &fileName() const;
bool open(const QString& fileName);
public slots:
bool save();
void preview(float res = 0);
void render(const QString &fileName, float res = 0.5);
void cut();
void copy();
void paste();
};