File indexing completed on 2024-04-28 04:32:02

0001 /*
0002  * Copyright (C) 2003-2015 by Stephen Allewell
0003  * steve.allewell@gmail.com
0004  *
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 2 of the License, or
0008  * (at your option) any later version.
0009  */
0010 
0011 #ifndef LibraryPattern_H
0012 #define LibraryPattern_H
0013 
0014 #include <QByteArray>
0015 #include <QDataStream>
0016 #include <QString>
0017 
0018 class LibraryListWidgetItem;
0019 class Pattern;
0020 
0021 class LibraryPattern
0022 {
0023 public:
0024     LibraryPattern();
0025     explicit LibraryPattern(Pattern *, qint32 key = 0, Qt::KeyboardModifiers modifiers = Qt::NoModifier, qint16 baseline = 0);
0026     explicit LibraryPattern(QByteArray, qint32 key = 0, Qt::KeyboardModifiers modifiers = Qt::NoModifier, qint16 baseline = 0);
0027 
0028     qint32 key() const;
0029     Qt::KeyboardModifiers modifiers() const;
0030     qint16 baseline() const;
0031     Pattern *pattern();
0032     LibraryListWidgetItem *libraryListWidgetItem() const;
0033     bool hasChanged() const;
0034 
0035     void setKeyModifiers(qint32, Qt::KeyboardModifiers);
0036     void setBaseline(qint16);
0037     void setLibraryListWidgetItem(LibraryListWidgetItem *);
0038 
0039     friend QDataStream &operator<<(QDataStream &, const LibraryPattern &);
0040     friend QDataStream &operator>>(QDataStream &, LibraryPattern &);
0041 
0042 private:
0043     static const int version = 100;
0044 
0045     Pattern *m_pattern;
0046     qint32 m_key;
0047     Qt::KeyboardModifiers m_modifiers;
0048     qint16 m_baseline;
0049     LibraryListWidgetItem *m_libraryListWidgetItem;
0050     bool m_changed;
0051 };
0052 
0053 QDataStream &operator<<(QDataStream &, const LibraryPattern &);
0054 QDataStream &operator>>(QDataStream &, LibraryPattern &);
0055 
0056 #endif // LibraryPattern_H