1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-25 04:03:30 -05:00

Multi device support: display date/time in ISO format in main window status bar

This commit is contained in:
f4exb 2016-05-12 19:06:38 +02:00
parent 7159004bbe
commit f275e93f16
2 changed files with 14 additions and 20 deletions

View File

@ -24,6 +24,7 @@
#include <QFileDialog>
#include <QTextStream>
#include <QMessageBox>
#include <QDateTime>
#include "mainwindow.h"
#include "ui_mainwindow.h"
@ -93,8 +94,8 @@ MainWindow::MainWindow(QWidget* parent) :
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()), Qt::QueuedConnection);
// connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
// m_statusTimer.start(500);
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(1000);
m_masterTimer.start(50);
@ -259,13 +260,9 @@ void MainWindow::savePresetSettings(Preset* preset)
void MainWindow::createStatusBar()
{
m_sampleRateWidget = new QLabel(tr("Rate: 0 kHz"), this);
m_sampleRateWidget->setToolTip(tr("Sample Rate"));
statusBar()->addPermanentWidget(m_sampleRateWidget);
m_recording = new Indicator(tr("Rec"), this);
m_recording->setToolTip(tr("Recording"));
statusBar()->addPermanentWidget(m_recording);
m_dateTimeWidget = new QLabel(tr("Date"), this);
m_dateTimeWidget->setToolTip(tr("Current date/time"));
statusBar()->addPermanentWidget(m_dateTimeWidget);
}
void MainWindow::closeEvent(QCloseEvent*)
@ -277,12 +274,6 @@ void MainWindow::updateCenterFreqDisplay()
m_deviceUIs.back()->m_spectrum->setCenterFrequency(m_centerFrequency);
}
void MainWindow::updateSampleRate()
{
m_deviceUIs.back()->m_spectrum->setSampleRate(m_sampleRate);
m_sampleRateWidget->setText(tr("Rate: %1 kHz").arg((float)m_sampleRate / 1000));
}
void MainWindow::updatePresetControls()
{
ui->presetTree->resizeColumnToContents(0);
@ -337,7 +328,6 @@ QTreeWidgetItem* MainWindow::addPresetToTree(const Preset* preset)
void MainWindow::applySettings()
{
updateCenterFreqDisplay();
updateSampleRate();
}
void MainWindow::handleMessages()
@ -607,6 +597,11 @@ void MainWindow::on_action_About_triggered()
dlg.exec();
}
void MainWindow::updateStatus()
{
m_dateTimeWidget->setText(QDateTime::currentDateTime().toString("yyyy-MM-ddThh:mm:ss t"));
}
MainWindow::DeviceUISet::DeviceUISet(QTimer& timer)
{
m_spectrum = new GLSpectrum;

View File

@ -101,11 +101,10 @@ private:
DSPEngine* m_dspEngine;
QTimer m_masterTimer;
//QTimer m_statusTimer;
QTimer m_statusTimer;
int m_lastEngineState;
QLabel* m_sampleRateWidget;
Indicator* m_recording;
QLabel* m_dateTimeWidget;
QWidget* m_inputGUI;
@ -123,7 +122,6 @@ private:
void createStatusBar();
void closeEvent(QCloseEvent*);
void updateCenterFreqDisplay();
void updateSampleRate();
void updatePresetControls();
QTreeWidgetItem* addPresetToTree(const Preset* preset);
void applySettings();
@ -132,6 +130,7 @@ private:
private slots:
void handleMessages();
void updateStatus();
void on_action_View_Fullscreen_toggled(bool checked);
void on_presetSave_clicked();
void on_presetUpdate_clicked();