Пример #1
0
/*!
 \brief

 \param other
 \return bool PlayList::operator
*/
bool PlayList::operator==(const PlayList& other) const {

    bool res = name() == other.name();    
    res &= folders_ == other.folders();
    res &= extensions_ == other.extensions() && randomize_ == other.randomize() && includeSubFolders_ == other.includeSubFolders();
    res &= relativePath_ == other.relativePath() && includeExtInf_ == other.includeExtInf();
    res &= makeUnique_ == other.makeUnique() && copyFilesToDir_ == other.copyFilesToDir() && copyFiles_ == other.copyFiles();
    res &= individualFiles_ == other.individualFiles() && script_ == other.script();    

    return res;
}
Пример #2
0
 bool forward()
 {
     playIndex_++;
     if (playIndex_ >= playList_.size())
     {
         playIndex_ = playList_.size() - 1;
         return false;
     }
     else
     {
         return true;
     }
 }
Пример #3
0
int PlayListRecord::coverIndex()
{
    if (m_coverIndex == PlayListRecord::EMPTY_COVER_INDEX) {
        PlayList *pl = playList();
        for (int i = 0; i < pl->count(); ++i) {
            if (pl->at(i)->thumbnailPath() == m_coverPath) {
                m_coverIndex = i;
                break;
            }
        }
    }

    return m_coverIndex;
}
Пример #4
0
void MainWindow::fire_( const PlayList & tracks ) {
	if( tracks.empty() ) {
		this->showErrorMessage_( tr( "Run-time error!" ), tr( "No track selected." ) );
		return;
	}

	// get option widget
	this->conversion_->convert( tracks );
}
Пример #5
0
    bool readPlayList()
    {
        scoped_ptr<SharedMemory> shm(monapi_file_read_directory(APPLICATION_DATA_DIR));
        if (NULL == shm.get()) return false;
        int size = *(int*)shm->data();
        if (size == 0) return false;

        monapi_directoryinfo* p = (monapi_directoryinfo*)shm->data()[sizeof(int)];
        for (int i = 0; i < size; i++, p++)
        {
            string file = p->name;

            if (StringHelper::endsWith(file, ".MML"))
            {
                playList_.push_back(file);
            }
        }
        return playList_.size() != 0;
    }
Пример #6
0
void MainWindow::open( const QList< QUrl > & uris ) {
	if( uris.isEmpty() ) {
		return;
	}

	PlayList tracks;

	std::for_each( uris.begin(), uris.end(), [&]( const QUrl & uri ) {
		if( uri.isEmpty() ) {
			return;
		}

		try {
			tracks.append( PlayList::fromURI( uri ) );
		} catch( BaseError & e ) {
			this->showErrorMessage_( tr( "Can not open this file!" ), e.getMessage() );
		}
	} );

	this->ui_->player->append( tracks );
}
Пример #7
0
    bool readPlayList()
    {
        monapi_cmemoryinfo* mi = monapi_file_read_directory(APPLICATION_DATA_DIR);
        if (NULL == mi) return false;
        int size = *(int*)mi->Data;
        if (size == 0) return false;

        monapi_directoryinfo* p = (monapi_directoryinfo*)&mi->Data[sizeof(int)];
        for (int i = 0; i < size; i++, p++)
        {
            string file = p->name;

            if (StringHelper::endsWith(file, ".MML"))
            {
                playList_.push_back(file);
            }
        }
        monapi_cmemoryinfo_dispose(mi);
        monapi_cmemoryinfo_delete(mi);
        return playList_.size() != 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;
	}
Пример #9
0
 void play()
 {
     syscall_get_io();
     for (uint32_t i = playIndex_; i < playList_.size(); i++)
     {
         string path = APPLICATION_DATA_DIR"/" + playList_[i];
         scoped_ptr<SharedMemory> shm(monapi_file_read_all(path.c_str()));
         if (NULL == shm.get() || shm->size() == 0) return;
         string mml = string((char*)shm->data(), shm->size());
         statusLabel_->setText(beeper_.title(mml.c_str()).c_str());
         beeper_.play(mml.c_str());
         beeper_.rest(1000);
     }
     playIndex_ = 0;
     playButton_->revert();
 }
Пример #10
0
 void play()
 {
     syscall_get_io();
     for (uint32_t i = playIndex_; i < playList_.size(); i++)
     {
         string path = APPLICATION_DATA_DIR"/" + playList_[i];
         monapi_cmemoryinfo* mi = monapi_file_read_all(path.c_str());
         if (NULL == mi || mi->Size == 0) return;
         string mml = string((char*)mi->Data, mi->Size);
         statusLabel_->setText(beeper_.title(mml.c_str()).c_str());
         beeper_.play(mml.c_str());
         beeper_.rest(1000);
     }
     playIndex_ = 0;
     playButton_->revert();
 }
Пример #11
0
int main()
{
	PlayList *playList = nullptr;
	cout << "Starting program !!";
	while (true)
	{
		cout << "\nEnter an operation 'Create', 'Insert', 'Delete', 'Play', 'Shuffle', 'Exit'" << "\n";
		string operation;
		cin >> operation;
		

		try
		{
			switch (FetchOpCode(operation))
			{
			case 1:
				int size;
				cout << "Enter the size : ";
				cin >> size;
				playList = (PlayList::Create(size));
				playList->Print();
				break;
			case 2:
				int ordinal, value;
				cout << "Enter ordinal : ";
				cin >> ordinal;
				cout << "Enter trackId : ";
				cin >> value;
				if (playList == nullptr) {
					throw "PlayList is not created yet";
				}
				playList->Insert(ordinal, value);
				playList->Print();
				break;
			case 3:
				cout << "Enter ordinal : ";
				cin >> ordinal;
				if (playList == nullptr) {
					throw "PlayList is not created yet";
				}
				playList->Delete(ordinal);
				playList->Print();
				break;
			case 4:
				cout << "Enter ordinal : ";
				cin >> ordinal;
				if (playList == nullptr) {
					throw "PlayList is not created yet";
				}
				playList->Play(ordinal);
				playList->Print();
				break;
			case 5:
				if (playList == nullptr) {
					throw "PlayList is not created yet";
				}
				playList->Shuffle();
				playList->Print();
				break;
			case 6:
				return 0;
			default:
				throw "Invalid operation";
				break;
			}
		}
		catch (const std::exception& ex)
		{
			cout << &ex;
		}
		
	}
}