Example #1
0
void AlbumManager::addClicked()
      {
      QStringList files = mscore->getOpenScoreNames(
         tr("MuseScore Files") + " (*.mscz *.mscx);;", tr("Load Score")
         );
      QList<MasterScore*> scores;
      for (const QString& fn : files) {
            MasterScore* score = mscore->readScore(fn);
            Movements* m = score->movements();
            for (MasterScore* ms : *m) {
                  scores.push_back(ms);
                  ms->setMovements(0);
                  }
            delete m;
            }
      if (scores.empty())
            return;
      MasterScore* topScore = album->front();
      scoreList->blockSignals(true);
      for (MasterScore* score : scores) {
            topScore->addMovement(score);
            QString name = getScoreTitle(score);
            QListWidgetItem* li = new QListWidgetItem(name, scoreList);
            li->setFlags(Qt::ItemFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled));
            }
      scoreList->blockSignals(false);
      topScore->setLayoutAll();
      topScore->update();
      }
Example #2
0
void AlbumManager::addNewClicked()
      {
      MasterScore* score = mscore->getNewFile();
      if (!score)
            return;

      delete score->movements();
      MasterScore* topScore = album->front();

      scoreList->blockSignals(true);
      topScore->addMovement(score);
      QString name = getScoreTitle(score);
      QListWidgetItem* li = new QListWidgetItem(name, scoreList);
      li->setFlags(Qt::ItemFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled));
      scoreList->blockSignals(false);

      topScore->setLayoutAll();
      topScore->update();
      }