Esempio n. 1
0
void PlaybackControls::setSeek()
{
	if (mpParentWindow->seekBox->displayText() != "")
	{
		int pos = mpParentWindow->seekBox->displayText().toInt();
		setSeek(pos);
	}
}
Esempio n. 2
0
bool DBQueue::pop()
{
    if (m_lastOpenMode & std::ios_base::out) {

        TRY(reopenQueue(std::ios_base::in),"Error reopening queue file","");

        if (m_seek >0) {
            TRY(m_queueFile.seekg(m_seek),"Error seeking queue to the "+::itoa(m_seek),"");
        }
        else {
            TRY(m_queueFile.seekg(0,std::ios_base::beg),"Error seeking queue to the beginning","");
        }
    }

    std::string s;
    try {
        std::getline(m_queueFile,s);
    } catch (const std::fstream::failure& e) {
        setLastError(::path_to_filename(__FILE__)+":"+itoa(__LINE__)+" "+"Error getting line from queue","");
        return false;
    }

    TRY(setSeek(m_queueFile.tellg()),"Error setting seek position","");

    TRY(m_queueFile.seekg(0,std::ios_base::end),"Error seeking queue to the end","");

    int t = m_queueFile.tellg();
    if (t <= m_seek) {
        m_empty = true;
        TRY(setSeek(0),"Error setting seek position","");
        TRY(reopenQueue(std::ios_base::out | std::ios_base::trunc),"Error reopening queue file","");
    } else {
        m_empty = false;
        TRY(m_queueFile.seekg(m_seek),"Error seeking queue to the "+::itoa(m_seek),"");
    }
    return true;
}
void PlaybackControls::seekReturned()
{
	setSeek(mpParentWindow->seekBar->value());
}
void PlaybackControls::setSeek()
{
	QString input = mpParentWindow->seekBox->displayText();
	int val = input.toInt();
	setSeek(val*1000);
}