Пример #1
0
void TmultiScore::setNote(const Tnote& note) {
  if (insertMode() != e_single) {
      if (currentIndex() == -1)
        changeCurrentIndex(0);
      TscoreStaff *thisStaff = currentStaff();
      if (insertMode() == e_record) {
          if (m_clickedOff > 0)
            checkAndAddNote(thisStaff, currentIndex() % staff()->maxNoteCount());
          changeCurrentIndex(currentIndex() + m_clickedOff);
          thisStaff = currentStaff();
          m_clickedOff = 1;
      }
      thisStaff->setNote(currentIndex() % staff()->maxNoteCount(), note);
      if (staffCount() > 1)
        QTimer::singleShot(5, this, SLOT(ensureNoteIsVisible()));
  } else {
      TsimpleScore::setNote(0, note);
  }
}
Пример #2
0
PlaylistWidget::PlaylistWidget(Playlist *playl, QWidget *parent) : QWidget(parent) // This widget allows the user to do some actions on the playlist
{
    m_playlist = playl;

    m_tableWidget = new QTableWidget(this);
    m_tableWidget->setSortingEnabled(true);
    m_tableWidget->setSelectionMode(QAbstractItemView::ContiguousSelection);
    m_tableWidget->setDragEnabled(true);
    m_tableWidget->viewport()->setAcceptDrops(true);
    m_tableWidget->setDropIndicatorShown(true);
    m_tableWidget->setDragDropMode(QAbstractItemView::InternalMove);
    m_tableWidget->setShowGrid(false);
    m_tableWidget->verticalHeader()->hide();
    m_tableWidget->horizontalHeader()->resizeSections(QHeaderView::Stretch);
    m_tableWidget->setColumnCount(5);
    m_tableWidget->setToolTip(tr("Lists of all the files of the current playlist"));
    connect(m_tableWidget, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(changeCurrentMusic(QTableWidgetItem*)));
    connect(m_tableWidget, SIGNAL(itemSelectionChanged()), this, SLOT(changeCurrentRow()));

    m_searchLine = new QLineEdit(this);
    m_searchLine->setPlaceholderText(tr("Search"));
    m_searchLine->setToolTip(tr("Search in this playlist"));
    connect(m_searchLine, SIGNAL(textChanged(QString)), this, SLOT(search(QString)));

    m_removeButton = new QPushButton(QIcon(":/Remove.png"), "", this);
    m_removeButton->setGeometry(width() - 32, 0, 32, 32);
    m_removeButton->setIconSize(QSize(31, 31));
    m_removeButton->setFlat(true);
    m_removeButton->setToolTip(tr("Remove the selected music of this playlist"));
    connect(m_removeButton, SIGNAL(clicked()), this, SLOT(remove()));

    connect(m_playlist, SIGNAL(currentIndexChanged()), this, SLOT(changeCurrentIndex()));
    connect(m_playlist, SIGNAL(musicAdded(Music *)), this, SLOT(addMusic(Music *)));
    connect(m_playlist, SIGNAL(musicRemoved(int)), this, SLOT(removeRow(int)));
    connect(m_playlist, SIGNAL(refresh()), this, SLOT(refresh()));

    refresh();
    m_tableWidget->setCurrentCell(0, 0);
}
Пример #3
0
void TmultiScore::selectNote(int id) {
  if (id >= -1 && id < notesCount())
    changeCurrentIndex(id);
}