1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-02 13:17:48 -04:00

SDRDaemonSink: GUI cosmetic changes

This commit is contained in:
f4exb 2017-06-06 01:53:21 +02:00
parent 5e62da4437
commit e4332a16b6
3 changed files with 70 additions and 10 deletions

View File

@ -60,6 +60,9 @@ SDRdaemonSinkGui::SDRdaemonSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
nn_setsockopt (m_nnSender, NN_SOL_SOCKET, NN_SNDTIMEO, &millis, sizeof (millis)); nn_setsockopt (m_nnSender, NN_SOL_SOCKET, NN_SNDTIMEO, &millis, sizeof (millis));
assert (rc == 0); assert (rc == 0);
m_countUnrecoverable = 0;
m_countRecovered = 0;
m_paletteGreenText.setColor(QPalette::WindowText, Qt::green); m_paletteGreenText.setColor(QPalette::WindowText, Qt::green);
m_paletteRedText.setColor(QPalette::WindowText, Qt::red); m_paletteRedText.setColor(QPalette::WindowText, Qt::red);
m_paletteWhiteText.setColor(QPalette::WindowText, Qt::white); m_paletteWhiteText.setColor(QPalette::WindowText, Qt::white);
@ -83,6 +86,10 @@ SDRdaemonSinkGui::SDRdaemonSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection); connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
m_time.start();
displayEventCounts();
displayEventTimer();
displaySettings(); displaySettings();
sendControl(true); sendControl(true);
sendSettings(); sendSettings();
@ -509,6 +516,32 @@ void SDRdaemonSinkGui::on_startStop_toggled(bool checked)
} }
} }
void SDRdaemonSinkGui::on_eventCountsReset_clicked(bool checked __attribute__((unused)))
{
m_countUnrecoverable = 0;
m_countRecovered = 0;
m_time.start();
displayEventCounts();
displayEventTimer();
}
void SDRdaemonSinkGui::displayEventCounts()
{
QString nstr = QString("%1").arg(m_countUnrecoverable, 3, 10, QChar('0'));
ui->eventUnrecText->setText(nstr);
nstr = QString("%1").arg(m_countRecovered, 3, 10, QChar('0'));
ui->eventRecText->setText(nstr);
}
void SDRdaemonSinkGui::displayEventTimer()
{
int elapsedTimeMillis = m_time.elapsed();
QTime recordLength(0, 0, 0, 0);
recordLength = recordLength.addSecs(elapsedTimeMillis/1000);
QString s_time = recordLength.toString("hh:mm:ss");
ui->eventCountsTimeText->setText(s_time);
}
void SDRdaemonSinkGui::updateWithStreamTime() void SDRdaemonSinkGui::updateWithStreamTime()
{ {
int t_sec = 0; int t_sec = 0;
@ -540,11 +573,11 @@ void SDRdaemonSinkGui::tick()
if ((len > 0) && msgBuf) if ((len > 0) && msgBuf)
{ {
std::string msg((char *) msgBuf, len); std::string msg((char *) msgBuf, len);
//qDebug("SDRdaemonSinkGui::tick: %s", msg.c_str());
std::vector<std::string> strs; std::vector<std::string> strs;
boost::split(strs, msg, boost::is_any_of(":")); boost::split(strs, msg, boost::is_any_of(":"));
unsigned int nbTokens = strs.size(); unsigned int nbTokens = strs.size();
unsigned int status = 0; unsigned int status = 0;
bool updateEventCounts = false;
if (nbTokens > 0) // at least the queue length is given if (nbTokens > 0) // at least the queue length is given
{ {
@ -591,10 +624,22 @@ void SDRdaemonSinkGui::tick()
if (nbTokens > 1) // the quality status is given also if (nbTokens > 1) // the quality status is given also
{ {
if (strs[1] == "2") { if (strs[1] == "2")
{
status = 2; status = 2;
} else if (strs[1] == "1") { }
else if (strs[1] == "1")
{
status = 1; status = 1;
if (m_countUnrecoverable < 999) m_countUnrecoverable++;
updateEventCounts = true;
qDebug("SDRdaemonSinkGui::tick: %s", msg.c_str());
}
else
{
if (m_countRecovered < 999) m_countRecovered++;
updateEventCounts = true;
qDebug("SDRdaemonSinkGui::tick: %s", msg.c_str());
} }
} }
@ -610,6 +655,13 @@ void SDRdaemonSinkGui::tick()
} else { // recoverable errors or unknown status } else { // recoverable errors or unknown status
ui->allFramesDecoded->setStyleSheet("QToolButton { background:rgb(56,56,56); }"); ui->allFramesDecoded->setStyleSheet("QToolButton { background:rgb(56,56,56); }");
} }
if (updateEventCounts)
{
displayEventCounts();
}
} }
displayEventTimer();
} }
} }

View File

@ -18,6 +18,7 @@
#define INCLUDE_SDRDAEMONSINKGUI_H #define INCLUDE_SDRDAEMONSINKGUI_H
#include <QTimer> #include <QTimer>
#include <QTime>
#include "plugin/plugingui.h" #include "plugin/plugingui.h"
#include "sdrdaemonsinksettings.h" #include "sdrdaemonsinksettings.h"
@ -69,6 +70,10 @@ private:
int m_nnSender; int m_nnSender;
uint32_t m_countUnrecoverable;
uint32_t m_countRecovered;
QTime m_time;
QPalette m_paletteGreenText; QPalette m_paletteGreenText;
QPalette m_paletteRedText; QPalette m_paletteRedText;
QPalette m_paletteWhiteText; QPalette m_paletteWhiteText;
@ -80,6 +85,8 @@ private:
void sendSettings(); void sendSettings();
void updateWithStreamTime(); void updateWithStreamTime();
void updateSampleRateAndFrequency(); void updateSampleRateAndFrequency();
void displayEventCounts();
void displayEventTimer();
private slots: private slots:
void handleDSPMessages(); void handleDSPMessages();
@ -96,6 +103,7 @@ private slots:
void on_applyButton_clicked(bool checked); void on_applyButton_clicked(bool checked);
void on_sendButton_clicked(bool checked); void on_sendButton_clicked(bool checked);
void on_startStop_toggled(bool checked); void on_startStop_toggled(bool checked);
void on_eventCountsReset_clicked(bool checked);
void updateHardware(); void updateHardware();
void updateStatus(); void updateStatus();
void tick(); void tick();

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>380</width> <width>411</width>
<height>217</height> <height>217</height>
</rect> </rect>
</property> </property>
@ -371,7 +371,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>000/000</string> <string>000/00</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -439,7 +439,7 @@
<widget class="QLabel" name="qualityStatusText"> <widget class="QLabel" name="qualityStatusText">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>50</width> <width>52</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
@ -471,7 +471,7 @@
<widget class="QLabel" name="eventUnrecText"> <widget class="QLabel" name="eventUnrecText">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>18</width> <width>25</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
@ -479,7 +479,7 @@
<string>Number of uncrecoverable errors since event counts reset</string> <string>Number of uncrecoverable errors since event counts reset</string>
</property> </property>
<property name="text"> <property name="text">
<string>00</string> <string>000</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -487,7 +487,7 @@
<widget class="QLabel" name="eventRecText"> <widget class="QLabel" name="eventRecText">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>18</width> <width>25</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
@ -495,7 +495,7 @@
<string>Number of correctable errors since event counts reset</string> <string>Number of correctable errors since event counts reset</string>
</property> </property>
<property name="text"> <property name="text">
<string>00</string> <string>000</string>
</property> </property>
</widget> </widget>
</item> </item>