コード例 #1
0
	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);
	}
コード例 #2
0
	void MediaPlayerActivity::onDoubleClicked(const MediaFileRef & file)
	{
		if (bt::Exists(file.path()))
		{
			play(file);
		}
	}
コード例 #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;
	}
コード例 #4
0
	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());
		}
	}
コード例 #5
0
ファイル: mediacontroller.cpp プロジェクト: biwin/ktorrent
 void MediaController::playing(const MediaFileRef& file)
 {
     if (file.path().isEmpty())
     {
         stopped();
     }
     else
     {
         current_file = file;
         metaDataChanged();
     }
 }
コード例 #6
0
	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;
	}
コード例 #7
0
	void PlayListWidget::doubleClicked(const QModelIndex & index)
	{
		MediaFileRef file = play_list->fileForIndex(proxy_model->mapToSource(index));
		if (!file.path().isEmpty())
			doubleClicked(file);
	}