Skip to content

Commit

Permalink
Fixing warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
blackears committed Oct 24, 2022
1 parent c5df9a8 commit 9620fcb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 40 deletions.
14 changes: 0 additions & 14 deletions src/pianoroll/internal/pianorollcontroller.cpp
Expand Up @@ -129,13 +129,11 @@ void PianorollController::onNotationChanged()

void PianorollController::onUndoStackChanged()
{
int j = 9;
qDebug() << "onUndoStackChanged";
}

void PianorollController::onCurrentNotationChanged()
{
int j = 9;
qDebug() << "notationChanged";
}

Expand All @@ -157,18 +155,6 @@ void PianorollController::setNoteHeight(int value)
emit noteHeightChanged();
}

void PianorollController::addChord(Chord* chrd, int voice)
{
//for (Chord* c : chrd->graceNotes())
// addChord(c, voice);

//for (Note* note : chrd->notes()) {
// if (note->tieBack())
// continue;
// m_notes.push_back(NoteBlock(note));
//}
}

Fraction PianorollController::widthInBeats()
{
notation::INotationPtr notation = globalContext()->currentNotation();
Expand Down
2 changes: 0 additions & 2 deletions src/pianoroll/internal/pianorollcontroller.h
Expand Up @@ -62,7 +62,6 @@ class PianorollController : public QObject, public IPianorollController, public
INJECT(pianoroll, actions::IActionsDispatcher, dispatcher)
INJECT(pianoroll, context::IGlobalContext, globalContext)
INJECT(pianoroll, IPianorollConfiguration, configuration)
// INJECT(pianoroll, notation::INotationConfiguration, notationConfiguration)
INJECT(pianoroll, audio::IPlayback, playback)

Q_PROPERTY(double xZoom READ xZoom WRITE setXZoom NOTIFY xZoomChanged)
Expand Down Expand Up @@ -102,7 +101,6 @@ class PianorollController : public QObject, public IPianorollController, public
void onSelectionChanged();

void buildNoteBlocks();
void addChord(engraving::Chord* chrd, int voice);

engraving::Measure* lastMeasure();
engraving::Score* score();
Expand Down
2 changes: 1 addition & 1 deletion src/pianoroll/view/pianorollautomationcurves.cpp
Expand Up @@ -101,7 +101,7 @@ void PianorollAutomationCurves::buildNoteData()
m_selectedStaves.clear();
std::vector<EngravingItem*> selectedElements = notation->interaction()->selection()->elements();
for (EngravingItem* e: selectedElements) {
int idx = e->staffIdx();
int idx = (int)e->staffIdx();
m_activeStaff = idx;
if (std::find(m_selectedStaves.begin(), m_selectedStaves.end(), idx) == m_selectedStaves.end()) {
m_selectedStaves.push_back(idx);
Expand Down
2 changes: 1 addition & 1 deletion src/pianoroll/view/pianorollautomationnote.cpp
Expand Up @@ -127,7 +127,7 @@ void PianorollAutomationNote::buildNoteData()
m_selectedStaves.clear();
std::vector<EngravingItem*> selectedElements = notation->interaction()->selection()->elements();
for (EngravingItem* e: selectedElements) {
int idx = e->staffIdx();
int idx = (int)e->staffIdx();
m_activeStaff = idx;
if (std::find(m_selectedStaves.begin(), m_selectedStaves.end(), idx) == m_selectedStaves.end()) {
m_selectedStaves.push_back(idx);
Expand Down
2 changes: 1 addition & 1 deletion src/pianoroll/view/pianorollkeyboard.cpp
Expand Up @@ -184,7 +184,7 @@ Staff* PianorollKeyboard::getActiveStaff()
std::vector<int> selectedStaves;
int activeStaff = -1;
for (EngravingItem* e : selectedElements) {
int idx = e->staffIdx();
int idx = (int)e->staffIdx();
qDebug() << "ele idx " << idx;
activeStaff = idx;
if (std::find(selectedStaves.begin(), selectedStaves.end(), idx) == selectedStaves.end()) {
Expand Down
41 changes: 20 additions & 21 deletions src/pianoroll/view/pianorollview.cpp
Expand Up @@ -67,9 +67,9 @@ void PianorollView::load()
});

playback()->player()->playbackPositionMsecs().onReceive(this,
[this](audio::TrackSequenceId currentTrackSequence,
[this](audio::TrackSequenceId,
const audio::msecs_t newPosMsecs) {
int tick = score()->utime2utick(newPosMsecs / 1000.);
int tick = score()->utime2utick(newPosMsecs / 1000.0);
setPlaybackPosition(Fraction::fromTicks(tick));
});
}
Expand Down Expand Up @@ -134,7 +134,7 @@ void PianorollView::buildNoteData()
Score* score = notation->elements()->msScore();
std::vector<EngravingItem*> selectedElements = notation->interaction()->selection()->elements();
for (EngravingItem* e: selectedElements) {
int idx = e->staffIdx();
int idx = (int)e->staffIdx();
m_activeStaff = idx;
if (std::find(m_selectedStaves.begin(), m_selectedStaves.end(), idx) == m_selectedStaves.end()) {
m_selectedStaves.push_back(idx);
Expand Down Expand Up @@ -358,8 +358,6 @@ void PianorollView::paint(QPainter* p)
Measure* lm = score->lastMeasure();
Fraction end = lm->tick() + lm->ticks();

qreal y1 = pitchToPixelY(0);
qreal y2 = pitchToPixelY(128);
qreal x1 = wholeNoteToPixelX(0);
qreal x2 = wholeNoteToPixelX(end);

Expand Down Expand Up @@ -502,7 +500,7 @@ void PianorollView::drawDraggedNotes(QPainter* painter)

if (endTickFrac != startTickFrac) {
double pitch = pixelYToPitch(m_mouseDownPos.y());
int track = staff->idx() * VOICES + m_editNoteVoice;
int track = (int)staff->idx() * VOICES + m_editNoteVoice;

drawDraggedNote(painter, startTickFrac, endTickFrac - startTickFrac, pitch, track, m_colorNoteDrag);
}
Expand Down Expand Up @@ -551,7 +549,7 @@ void PianorollView::drawDraggedNotes(QPainter* painter)

int pitch = pi->note->pitch();
int voice = pi->note->voice();
int track = staff->idx() * VOICES + voice;
int track = (int)staff->idx() * VOICES + voice;

drawDraggedNote(painter, startNew, lenNew, pitch, track, m_colorNoteDrag);
}
Expand Down Expand Up @@ -609,9 +607,9 @@ void PianorollView::drawDraggedNotes(QPainter* painter)
QXmlStreamReader::TokenType tt = xml.readNext();
if (tt == QXmlStreamReader::StartElement) {
if (xml.name().toString() == "notes") {
int n = xml.attributes().value("firstN").toString().toInt();
int d = xml.attributes().value("firstD").toString().toInt();
firstTick = Fraction(n, d);
int num = xml.attributes().value("firstN").toString().toInt();
int den = xml.attributes().value("firstD").toString().toInt();
firstTick = Fraction(num, den);
}
if (xml.name().toString() == "note") {
int sn = xml.attributes().value("startN").toString().toInt();
Expand All @@ -629,7 +627,7 @@ void PianorollView::drawDraggedNotes(QPainter* painter)
int pitch = xml.attributes().value("pitch").toString().toInt();
int voice = xml.attributes().value("voice").toString().toInt();

int track = staff->idx() * VOICES + voice;
int track = (int)staff->idx() * VOICES + voice;

drawDraggedNote(painter, startTick + pasteTickOffset, tickLen, pitch + pitchOffset, track, m_colorNoteDrag);
}
Expand Down Expand Up @@ -849,7 +847,7 @@ void PianorollView::mouseReleaseEvent(QMouseEvent* event)
Staff* staff = activeStaff();

int voice = m_editNoteVoice;
int track = staff->idx() * VOICES + voice;
int track = (int)staff->idx() * VOICES + voice;

Fraction duration = endTickFrac - startTickFrac;

Expand Down Expand Up @@ -1051,6 +1049,7 @@ Fraction PianorollView::roundToSubdivision(double wholeNote, bool down)

void PianorollView::insertNote(int modifiers)
{
(void)modifiers;
double pickTick = pixelXToWholeNote(m_mouseDownPos.x());
double pickPitch = pixelYToPitch(m_mouseDownPos.y());

Expand All @@ -1066,7 +1065,7 @@ void PianorollView::insertNote(int modifiers)

int voice = m_editNoteVoice;

int track = staff->idx() * VOICES + voice;
int track = (int)staff->idx() * VOICES + voice;
Fraction noteLen = m_editNoteLength;

Segment* seg = curScore->tick2segment(insertPosition);
Expand Down Expand Up @@ -1097,7 +1096,7 @@ void PianorollView::cutChord(const QPointF& pos)
int voice = pn ? pn->note->voice() : m_editNoteVoice;

//Find best chord to add to
int track = staff->idx() * VOICES + voice;
int track = (int)staff->idx() * VOICES + voice;

Fraction insertPosition = roundToSubdivision(pickTick);

Expand Down Expand Up @@ -1261,7 +1260,7 @@ void PianorollView::handleSelectionClick()
NoteSelectType selType = bnShift ? (bnCtrl ? NoteSelectType::SUBTRACT : NoteSelectType::XOR)
: (bnCtrl ? NoteSelectType::ADD : NoteSelectType::REPLACE);

Score* curScore = score();
// Score* curScore = score();

double pickTick = pixelXToWholeNote((int)m_mouseDownPos.x());
double pickPitch = pixelYToPitch(m_mouseDownPos.y());
Expand Down Expand Up @@ -1322,7 +1321,7 @@ QString PianorollView::serializeSelectedNotes()
Fraction startTick = note->chord()->tick();
int pitch = note->pitch();

int voice = note->voice();
int voice = (int)note->voice();

int veloOff = note->veloOffset();
VeloType veloType = note->veloType();
Expand Down Expand Up @@ -1489,9 +1488,9 @@ void PianorollView::pasteNotes(const QString& copiedNotes, Fraction pasteStartTi
QXmlStreamReader::TokenType tt = xml.readNext();
if (tt == QXmlStreamReader::StartElement) {
if (xml.name().toString() == "notes") {
int n = xml.attributes().value("firstN").toString().toInt();
int d = xml.attributes().value("firstD").toString().toInt();
firstTick = Fraction(n, d);
int num = xml.attributes().value("firstN").toString().toInt();
int den = xml.attributes().value("firstD").toString().toInt();
firstTick = Fraction(num, den);
}
if (xml.name().toString() == "note") {
int sn = xml.attributes().value("startN").toString().toInt();
Expand All @@ -1513,7 +1512,7 @@ void PianorollView::pasteNotes(const QString& copiedNotes, Fraction pasteStartTi
QString veloTypeStrn = xml.attributes().value("veloType").toString();
VeloType veloType = veloTypeStrn == "o" ? VeloType::OFFSET_VAL : VeloType::USER_VAL;

int track = staff->idx() * VOICES + voice;
int track = (int)staff->idx() * VOICES + voice;

Fraction pos = xIsOffset ? startTick + pasteStartTick : startTick - firstTick + pasteStartTick;

Expand All @@ -1534,7 +1533,7 @@ void PianorollView::pasteNotes(const QString& copiedNotes, Fraction pasteStartTi
for (Note* note: qAsConst(addedNotes)) {
NoteEventList& evtList = note->playEvents();
if (!evtList.empty()) {
NoteEvent* evt = note->noteEvent(evtList.size() - 1);
NoteEvent* evt = note->noteEvent((int)evtList.size() - 1);
staff->score()->undo(new ChangeNoteEvent(note, evt, ne));
}
}
Expand Down

0 comments on commit 9620fcb

Please sign in to comment.