1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-08-03 14:32:25 -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) 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); FileSourceInput::MsgConfigureFileSourceSeek* message = FileSourceInput::MsgConfigureFileSourceSeek::create(value);
m_sampleSource->getInputMessageQueue()->push(message); m_sampleSource->getInputMessageQueue()->push(message);
@ -387,7 +387,7 @@ void FileSourceGui::updateWithStreamTime()
if (!m_enableNavTime) if (!m_enableNavTime)
{ {
float posRatio = (float) t_sec / (float) m_recordLength; 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> <string>Time navigator</string>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>100</number> <number>1000</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <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); QMutexLocker mutexLocker(&m_mutex);
if ((m_ifstream.is_open()) && m_fileSourceThread && !m_fileSourceThread->isRunning()) 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); m_fileSourceThread->setSamplesCount(seekPoint);
seekPoint *= (m_sampleSize == 24 ? 8 : 4); // + sizeof(FileSink::Header) seekPoint *= (m_sampleSize == 24 ? 8 : 4); // + sizeof(FileSink::Header)
m_ifstream.clear(); m_ifstream.clear();
@ -322,8 +322,8 @@ bool FileSourceInput::handleMessage(const Message& message)
else if (MsgConfigureFileSourceSeek::match(message)) else if (MsgConfigureFileSourceSeek::match(message))
{ {
MsgConfigureFileSourceSeek& conf = (MsgConfigureFileSourceSeek&) message; MsgConfigureFileSourceSeek& conf = (MsgConfigureFileSourceSeek&) message;
int seekPercentage = conf.getPercentage(); int seekMillis = conf.getMillis();
seekFileStream(seekPercentage); seekFileStream(seekMillis);
return true; return true;
} }

View File

@ -113,19 +113,19 @@ public:
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: 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: 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(), Message(),
m_seekPercentage(seekPercentage) m_seekMillis(seekMillis)
{ } { }
}; };
@ -319,7 +319,7 @@ public:
const QTimer& m_masterTimer; const QTimer& m_masterTimer;
void openFileStream(); void openFileStream();
void seekFileStream(int seekPercentage); void seekFileStream(int seekMillis);
bool applySettings(const FileSourceSettings& settings, bool force = false); bool applySettings(const FileSourceSettings& settings, bool force = false);
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response); void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
}; };