1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-03-25 05:38:39 -04:00

File Input: use millis instead of percent for navigation slider

This commit is contained in:
f4exb 2018-10-14 02:38:24 +02:00
parent b0b2af252c
commit a6557cd4f9
4 changed files with 14 additions and 14 deletions

View File

@ -303,7 +303,7 @@ void FileSourceGui::on_play_toggled(bool checked)
void FileSourceGui::on_navTimeSlider_valueChanged(int value)
{
if (m_enableNavTime && ((value >= 0) && (value <= 100)))
if (m_enableNavTime && ((value >= 0) && (value <= 1000)))
{
FileSourceInput::MsgConfigureFileSourceSeek* message = FileSourceInput::MsgConfigureFileSourceSeek::create(value);
m_sampleSource->getInputMessageQueue()->push(message);
@ -387,7 +387,7 @@ void FileSourceGui::updateWithStreamTime()
if (!m_enableNavTime)
{
float posRatio = (float) t_sec / (float) m_recordLength;
ui->navTimeSlider->setValue((int) (posRatio * 100.0));
ui->navTimeSlider->setValue((int) (posRatio * 1000.0));
}
}

View File

@ -558,7 +558,7 @@
<string>Time navigator</string>
</property>
<property name="maximum">
<number>100</number>
<number>1000</number>
</property>
<property name="pageStep">
<number>1</number>

View File

@ -138,13 +138,13 @@ void FileSourceInput::openFileStream()
}
}
void FileSourceInput::seekFileStream(int seekPercentage)
void FileSourceInput::seekFileStream(int seekMillis)
{
QMutexLocker mutexLocker(&m_mutex);
if ((m_ifstream.is_open()) && m_fileSourceThread && !m_fileSourceThread->isRunning())
{
quint64 seekPoint = ((m_recordLength * seekPercentage) / 100) * m_sampleRate;
quint64 seekPoint = ((m_recordLength * seekMillis) / 1000) * m_sampleRate;
m_fileSourceThread->setSamplesCount(seekPoint);
seekPoint *= (m_sampleSize == 24 ? 8 : 4); // + sizeof(FileSink::Header)
m_ifstream.clear();
@ -322,8 +322,8 @@ bool FileSourceInput::handleMessage(const Message& message)
else if (MsgConfigureFileSourceSeek::match(message))
{
MsgConfigureFileSourceSeek& conf = (MsgConfigureFileSourceSeek&) message;
int seekPercentage = conf.getPercentage();
seekFileStream(seekPercentage);
int seekMillis = conf.getMillis();
seekFileStream(seekMillis);
return true;
}

View File

@ -113,19 +113,19 @@ public:
MESSAGE_CLASS_DECLARATION
public:
int getPercentage() const { return m_seekPercentage; }
int getMillis() const { return m_seekMillis; }
static MsgConfigureFileSourceSeek* create(int seekPercentage)
static MsgConfigureFileSourceSeek* create(int seekMillis)
{
return new MsgConfigureFileSourceSeek(seekPercentage);
return new MsgConfigureFileSourceSeek(seekMillis);
}
protected:
int m_seekPercentage; //!< percentage of seek position from the beginning 0..100
int m_seekMillis; //!< millis of seek position from the beginning 0..1000
MsgConfigureFileSourceSeek(int seekPercentage) :
MsgConfigureFileSourceSeek(int seekMillis) :
Message(),
m_seekPercentage(seekPercentage)
m_seekMillis(seekMillis)
{ }
};
@ -319,7 +319,7 @@ public:
const QTimer& m_masterTimer;
void openFileStream();
void seekFileStream(int seekPercentage);
void seekFileStream(int seekMillis);
bool applySettings(const FileSourceSettings& settings, bool force = false);
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
};