DocumentMetadata.hpp
1 #pragma once
2 #include <QDateTime>
3 #include <QObject>
4 #include <QString>
5 
6 #include <score_lib_base_export.h>
7 
8 #include <verdigris>
9 class QDir;
10 namespace score
11 {
15 struct SCORE_LIB_BASE_EXPORT DocumentMetadata : public QObject
16 {
17  W_OBJECT(DocumentMetadata)
18  QString m_fileName{QObject::tr("Untitled")};
19  QString m_author;
20  QDateTime m_creation;
21  QDateTime m_lastEdition;
22 
23 public:
24  using QObject::QObject;
25  explicit DocumentMetadata(QString file) noexcept;
26  QString fileName() const noexcept;
27  QString documentName() const noexcept;
28  QString author() const noexcept;
29  QDateTime creation() const noexcept;
30  QDateTime lastEdition() const noexcept;
31 
32  QString projectFolder() const noexcept;
33 
34  void setFileName(QString fileName);
35  void setAuthor(QString author);
36  void setCreation(QDateTime creation);
37  void setLastEdition(QDateTime lastEdition);
38 
39  void fileNameChanged(QString fileName)
40  E_SIGNAL(SCORE_LIB_BASE_EXPORT, fileNameChanged, fileName)
41  void authorChanged(QString author)
42  E_SIGNAL(SCORE_LIB_BASE_EXPORT, authorChanged, author)
43  void creationChanged(QDateTime creation)
44  E_SIGNAL(SCORE_LIB_BASE_EXPORT, creationChanged, creation)
45  void lastEditionChanged(QDateTime lastEdition)
46  E_SIGNAL(SCORE_LIB_BASE_EXPORT, lastEditionChanged, lastEdition)
47 
48  W_PROPERTY(
49  QString, fileName READ fileName WRITE setFileName NOTIFY fileNameChanged, W_Final)
50  W_PROPERTY(QString, author READ author WRITE setAuthor NOTIFY authorChanged, W_Final)
51  W_PROPERTY(
52  QDateTime, creation READ creation WRITE setCreation NOTIFY creationChanged,
53  W_Final)
54  W_PROPERTY(
55  QDateTime,
56  lastEdition READ lastEdition WRITE setLastEdition NOTIFY lastEditionChanged,
57  W_Final)
58 };
59 
68 SCORE_LIB_BASE_EXPORT
69 QString newProcessedFilePath(const QString& sourceFile, const QDir& destination);
70 }
Base toolkit upon which the software is built.
Definition: Application.cpp:90
QString newProcessedFilePath(const QString &sourceFile, const QDir &destination)
Obtains a new file name in the project folder to save a processed file.
Definition: DocumentMetadata.cpp:99
Document-wide metadata.
Definition: DocumentMetadata.hpp:16