File: importmidi_model.h

package info (click to toggle)
musescore 2.3.2%2Bdfsg2-7~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 187,932 kB
  • sloc: cpp: 264,610; xml: 176,707; sh: 3,311; ansic: 1,384; python: 356; makefile: 188; perl: 82; pascal: 78
file content (66 lines) | stat: -rw-r--r-- 2,077 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef IMPORTMIDI_MODEL_H
#define IMPORTMIDI_MODEL_H

#include "importmidi_operations.h"

#include <memory>


namespace Ms {

class TracksModel : public QAbstractTableModel
      {
   public:
      TracksModel();
      ~TracksModel();

      void reset(const MidiOperations::Opers &opers,
                 const QList<std::string> &lyricsList,
                 int trackCount,
                 const QString &midiFile,
                 bool hasHumanBeats,
                 bool hasTempoText,
                 bool hasChordNames);
      void clear();
      void updateCharset();
      void notifyAllApplied();

      const MidiOperations::Opers& trackOpers() const;
      int trackCount() const { return _trackCount; }
      int trackCountForImport() const;
      int frozenRowCount() const;
      int frozenColCount() const;
      int rowFromTrackIndex(int trackIndex) const;
      int trackIndexFromRow(int row) const;
      bool isAllApplied() const { return _isAllApplied; }

      int rowCount(const QModelIndex &/*parent*/) const;
      int columnCount(const QModelIndex &/*parent*/) const;
      QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
      Qt::ItemFlags flags(const QModelIndex &index) const;
      QVariant headerData(int section, Qt::Orientation orientation, int role) const;
      bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);

  private:
      bool isTrackIndexValid(int trackIndex) const;
      bool isRowValid(int row) const;
      bool isColumnValid(int column) const;
      void forceRowDataChanged(int row);
      void forceColumnDataChanged(int col);
      void forceAllChanged();
      bool editableSingleTrack(int trackIndex, int column) const;
      Qt::ItemFlags editableFlags(int row, int col) const;

      MidiOperations::Opers _trackOpers;
      int _trackCount;
      int _frozenColCount;
      QString _midiFile;
      class Column;
      std::vector<std::unique_ptr<Column>> _columns;
      bool _isAllApplied;
      };

} // namespace Ms


#endif // IMPORTMIDI_MODEL_H