/* * This file is part of the QtHPConnect distribution (https://github.com/Indy970/QtHPConnect.git). * Copyright (c) 2020 Ian Gebbie. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 or later. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef TEXTEDITOR_H #define TEXTEDITOR_H #include #include class textEditor : public QTextEdit { Q_OBJECT public: explicit textEditor(QWidget *parent = nullptr); ~textEditor() override; bool save(QFileInfo file); bool saveAs(QFileInfo file); bool save(QString calculator); bool saveAs(QString calculator); bool saveFile(const QString &fileName); QString userFriendlyCurrentFile(); QString currentFile() { return curFile; } protected: private slots: void documentWasModified(); private: QWidget * wParent; void setCurrentFile(const QString &fileName); QString strippedName(const QString &fullFileName); QString curFile; bool isUntitled; QDir defaultPath; }; #endif // TEXTEDITOR_H