コード例 #1
0
ファイル: edittagdialog.cpp プロジェクト: vranki/Clementine
void EditTagDialog::SelectionChanged() {
  const QModelIndexList sel =
      ui_->song_list->selectionModel()->selectedIndexes();
  if (sel.isEmpty()) return;

  // Set the editable fields
  UpdateUI(sel);

  // If we're editing multiple songs then we have to disable certain tabs
  const bool multiple = sel.count() > 1;
  ui_->tab_widget->setTabEnabled(ui_->tab_widget->indexOf(ui_->summary_tab),
                                 !multiple);

  if (!multiple) {
    const Song& song = data_[sel.first().row()].original_;
    UpdateSummaryTab(song);
    UpdateStatisticsTab(song);
  }
}
コード例 #2
0
void EditTagDialog::ResetPlayCounts() {
  const QModelIndexList sel =
      ui_->song_list->selectionModel()->selectedIndexes();
  if (sel.isEmpty()) return;
  Song* song = &data_[sel.first().row()].original_;
  if (!song->is_valid() || song->id() == -1) return;

  if (QMessageBox::question(
          this, tr("Reset play counts"),
          tr("Are you sure you want to reset this song's statistics?"),
          QMessageBox::Reset, QMessageBox::Cancel) != QMessageBox::Reset) {
    return;
  }

  song->set_playcount(0);
  song->set_skipcount(0);
  song->set_lastplayed(-1);
  song->set_score(0);
  app_->library_backend()->ResetStatisticsAsync(song->id());
  UpdateStatisticsTab(*song);
}