void MediaPlayerActivity::onSelectionChanged(const MediaFileRef & file)
	{
		if (bt::Exists(file.path()))
			play_action->setEnabled((action_flags & kt::MEDIA_PLAY) || file != media_player->getCurrentSource());
		else if (!file.path().isEmpty())
			play_action->setEnabled(action_flags & kt::MEDIA_PLAY);
		else
			play_action->setEnabled(false);
	}
	void MediaPlayerActivity::onDoubleClicked(const MediaFileRef & file)
	{
		if (bt::Exists(file.path()))
		{
			play(file);
		}
	}
Ejemplo n.º 3
0
	QModelIndex PlayListWidget::play() 
	{
		QModelIndex pidx = view->currentIndex();
		QModelIndex idx = proxy_model->mapToSource(pidx);
		MediaFileRef file = play_list->fileForIndex(idx);
		if (!file.path().isEmpty())
		{
			player->play(file);
		}
		return pidx;
	}
	void MediaPlayerActivity::play(const MediaFileRef & file)
	{
		media_player->play(file);
		QModelIndex idx = play_list->indexForFile(file.path());
		if (idx.isValid())
		{
			curr_item = idx;
			bool random = play_list->randomOrder();
			QModelIndex n = play_list->next(curr_item,random);
			next_action->setEnabled(n.isValid());
		}
	}
Ejemplo n.º 5
0
 void MediaController::playing(const MediaFileRef& file)
 {
     if (file.path().isEmpty())
     {
         stopped();
     }
     else
     {
         current_file = file;
         metaDataChanged();
     }
 }
	void MediaPlayerActivity::enableActions(unsigned int flags)
	{
		pause_action->setEnabled(flags & kt::MEDIA_PAUSE);
		stop_action->setEnabled(flags & kt::MEDIA_STOP);
		play_action->setEnabled(false);
		
		QModelIndex idx = play_list->selectedItem();
		if (idx.isValid())
		{
			PlayList* pl = play_list->playList();
			MediaFileRef file = pl->fileForIndex(idx);
			if (bt::Exists(file.path()))
				play_action->setEnabled((flags & kt::MEDIA_PLAY) || file != media_player->getCurrentSource());
			else
				play_action->setEnabled(action_flags & kt::MEDIA_PLAY);
		}
		else
			play_action->setEnabled(flags & kt::MEDIA_PLAY);
		
		prev_action->setEnabled(flags & kt::MEDIA_PREV);
		action_flags = flags;
	}
Ejemplo n.º 7
0
	void PlayListWidget::doubleClicked(const QModelIndex & index)
	{
		MediaFileRef file = play_list->fileForIndex(proxy_model->mapToSource(index));
		if (!file.path().isEmpty())
			doubleClicked(file);
	}