MuseScore  3.4
Music composition and notation
importmidi_model.h
Go to the documentation of this file.
1 #ifndef IMPORTMIDI_MODEL_H
2 #define IMPORTMIDI_MODEL_H
3 
5 
6 #include <memory>
7 
8 
9 namespace Ms {
10 
11 class TracksModel : public QAbstractTableModel
12  {
13  public:
14  TracksModel();
15  ~TracksModel();
16 
17  void reset(const MidiOperations::Opers &opers,
18  const QList<std::string> &lyricsList,
19  int trackCount,
20  const QString &midiFile,
21  bool hasHumanBeats,
22  bool hasTempoText,
23  bool hasChordNames);
24  void clear();
25  void updateCharset();
26  void notifyAllApplied();
27 
28  const MidiOperations::Opers& trackOpers() const;
29  int trackCount() const { return _trackCount; }
30  int trackCountForImport() const;
31  int frozenRowCount() const;
32  int frozenColCount() const;
33  int rowFromTrackIndex(int trackIndex) const;
34  int trackIndexFromRow(int row) const;
35  bool isAllApplied() const { return _isAllApplied; }
36 
37  int rowCount(const QModelIndex &/*parent*/) const;
38  int columnCount(const QModelIndex &/*parent*/) const;
39  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
40  Qt::ItemFlags flags(const QModelIndex &index) const;
41  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
42  bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
43 
44  private:
45  bool isTrackIndexValid(int trackIndex) const;
46  bool isRowValid(int row) const;
47  bool isColumnValid(int column) const;
48  void forceRowDataChanged(int row);
49  void forceColumnDataChanged(int col);
50  void forceAllChanged();
51  bool editableSingleTrack(int trackIndex, int column) const;
52  Qt::ItemFlags editableFlags(int row, int col) const;
53 
57  QString _midiFile;
58  class Column;
59  std::vector<std::unique_ptr<Column>> _columns;
61  };
62 
63 } // namespace Ms
64 
65 
66 #endif // IMPORTMIDI_MODEL_H
int trackCountForImport() const
Definition: importmidi_model.cpp:773
bool editableSingleTrack(int trackIndex, int column) const
Definition: importmidi_model.cpp:805
~TracksModel()
Definition: importmidi_model.cpp:38
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: importmidi_model.cpp:810
int _frozenColCount
Definition: importmidi_model.h:56
bool isRowValid(int row) const
Definition: importmidi_model.cpp:1054
int rowFromTrackIndex(int trackIndex) const
Definition: importmidi_model.cpp:760
Qt::ItemFlags flags(const QModelIndex &index) const
Definition: importmidi_model.cpp:944
void clear()
Definition: importmidi_model.cpp:733
int rowCount(const QModelIndex &) const
Definition: importmidi_model.cpp:795
MidiOperations::Opers _trackOpers
Definition: importmidi_model.h:54
Qt::ItemFlags editableFlags(int row, int col) const
Definition: importmidi_model.cpp:921
bool isColumnValid(int column) const
Definition: importmidi_model.cpp:1059
bool isAllApplied() const
Definition: importmidi_model.h:35
TracksModel()
Definition: importmidi_model.cpp:31
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: importmidi_model.cpp:995
const MidiOperations::Opers & trackOpers() const
Definition: importmidi_model.cpp:744
std::vector< std::unique_ptr< Column > > _columns
Definition: importmidi_model.h:58
void forceAllChanged()
Definition: importmidi_model.cpp:988
Definition: importmidi_model.cpp:10
bool isTrackIndexValid(int trackIndex) const
Definition: importmidi_model.cpp:1049
QVariant headerData(int section, Qt::Orientation orientation, int role) const
Definition: importmidi_model.cpp:1025
int trackCount() const
Definition: importmidi_model.h:29
bool _isAllApplied
Definition: importmidi_model.h:60
int columnCount(const QModelIndex &) const
Definition: importmidi_model.cpp:800
void updateCharset()
Definition: importmidi_model.cpp:749
Definition: aeolus.cpp:26
void forceRowDataChanged(int row)
Definition: importmidi_model.cpp:974
void reset(const MidiOperations::Opers &opers, const QList< std::string > &lyricsList, int trackCount, const QString &midiFile, bool hasHumanBeats, bool hasTempoText, bool hasChordNames)
Definition: importmidi_model.cpp:42
void forceColumnDataChanged(int col)
Definition: importmidi_model.cpp:981
int frozenColCount() const
Definition: importmidi_model.cpp:790
QString _midiFile
Definition: importmidi_model.h:57
void notifyAllApplied()
Definition: importmidi_model.cpp:755
int _trackCount
Definition: importmidi_model.h:55
Definition: importmidi_operations.h:137
int trackIndexFromRow(int row) const
Definition: importmidi_model.cpp:766
int frozenRowCount() const
Definition: importmidi_model.cpp:783
Definition: importmidi_model.h:11