void OnyxPlayerView::attachModel(PlayListModel *m) { model_ = m; connect(model_, SIGNAL(firstAdded()), this, SLOT(play())); connect(model_, SIGNAL(loadingFinished()), this, SLOT(onLoadingFinished())); connect(model_, SIGNAL(currentChanged()), this, SLOT(onCurrentChanged())); model_->doCurrentVisibleRequest(); loadSettings(); }
void OnyxPlayerView::deattachModel() { if (model_ != 0) { // clear data ODatas empty_data; song_list_view_.setData(empty_data); disconnect(model_, SIGNAL(firstAdded()), this, SLOT(play())); disconnect(model_, SIGNAL(loadingFinished()), this, SLOT(onLoadingFinished())); disconnect(model_, SIGNAL(currentChanged()), this, SLOT(onCurrentChanged())); model_ = 0; } }
void PlayListModel::load(PlayListItem *item) { total_length_ += item->length(); items_ << item; if (item->fileInfo()->path() == init_file_path_) { current_item_ = item; current_ = items_.indexOf(current_item_); emit firstAdded(); } if (!block_update_signals_) { emit listChanged(); } }