2021-04-06 23:10:57 +08:00
|
|
|
#ifndef EDITOR_H
|
|
|
|
#define EDITOR_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <utils.h>
|
|
|
|
#include <QTabWidget>
|
|
|
|
#include <Qsci/qsciscintilla.h>
|
|
|
|
|
|
|
|
class Editor : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit Editor(QObject *parent, const QString& filename,
|
|
|
|
FileEncodingType encodingType,
|
|
|
|
bool inProject, bool isNew,
|
|
|
|
QTabWidget* parentPageControl);
|
|
|
|
|
2021-04-07 22:44:08 +08:00
|
|
|
~Editor();
|
|
|
|
|
2021-04-06 23:10:57 +08:00
|
|
|
FileEncodingType encodingType() const;
|
|
|
|
void setFileEncodingType(FileEncodingType type);
|
|
|
|
FileEncodingType fileEncoding() const;
|
|
|
|
const QString& filename();
|
|
|
|
bool inProject() const;
|
|
|
|
bool isNew() const;
|
|
|
|
|
|
|
|
void loadFile();
|
2021-04-07 21:13:15 +08:00
|
|
|
void saveFile(const QString& filename);
|
2021-04-06 23:10:57 +08:00
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
private:
|
|
|
|
FileEncodingType mEncodingType; // the encoding type set by the user
|
|
|
|
FileEncodingType mFileEncoding; // the real encoding of the file (auto detected)
|
|
|
|
QString mFilename;
|
|
|
|
QTabWidget* mParentPageControl;
|
|
|
|
bool mInProject;
|
|
|
|
bool mIsNew;
|
|
|
|
QsciScintilla* mTextEdit;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EDITOR_H
|