File indexing completed on 2024-05-12 03:47:48

0001 /*
0002     File                 : Notes.h
0003     Project              : LabPlot
0004     Description          : Widget for taking notes
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2016 Garvit Khatri <garvitdelhi@gmail.com>
0007     SPDX-FileCopyrightText: 2016-2017 Alexander Semke <alexander.semke@web.de>
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #ifndef NOTE_H
0012 #define NOTE_H
0013 
0014 #include "backend/core/AbstractPart.h"
0015 
0016 #include <QFont>
0017 #include <QIcon>
0018 
0019 class QColor;
0020 class NoteView;
0021 
0022 class Note : public AbstractPart {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit Note(const QString& name);
0027 
0028     QWidget* view() const override;
0029     QIcon icon() const override;
0030 
0031     bool exportView() const override;
0032     bool printView() override;
0033     bool printPreview() const override;
0034 
0035     void setNote(const QString&);
0036     void setText(const QString& s) {
0037         this->setNote(s);
0038     }
0039     const QString& note() const;
0040 
0041     void setBackgroundColor(const QColor&);
0042     const QColor& backgroundColor() const;
0043 
0044     void setTextColor(const QColor&);
0045     const QColor& textColor() const;
0046 
0047     void setTextFont(const QFont&);
0048     const QFont& textFont() const;
0049 
0050     void save(QXmlStreamWriter*) const override;
0051     bool load(XmlStreamReader*, bool preview) override;
0052 
0053 Q_SIGNALS:
0054     void backgroundColorChanged(QColor);
0055     void textColorChanged(QColor);
0056     void textFontChanged(QFont);
0057 
0058 private:
0059     mutable NoteView* m_view{nullptr};
0060     QColor m_backgroundColor;
0061     QColor m_textColor;
0062     QFont m_textFont;
0063     QString m_note;
0064 };
0065 
0066 #endif // NOTE_H