1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -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 <QFileDialog>
#include <QTextStream> #include <QTextStream>
#include <QMessageBox> #include <QMessageBox>
#include <QDateTime>
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_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_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()), Qt::QueuedConnection);
// connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
// m_statusTimer.start(500); m_statusTimer.start(1000);
m_masterTimer.start(50); m_masterTimer.start(50);
@ -259,13 +260,9 @@ void MainWindow::savePresetSettings(Preset* preset)
void MainWindow::createStatusBar() void MainWindow::createStatusBar()
{ {
m_sampleRateWidget = new QLabel(tr("Rate: 0 kHz"), this); m_dateTimeWidget = new QLabel(tr("Date"), this);
m_sampleRateWidget->setToolTip(tr("Sample Rate")); m_dateTimeWidget->setToolTip(tr("Current date/time"));
statusBar()->addPermanentWidget(m_sampleRateWidget); statusBar()->addPermanentWidget(m_dateTimeWidget);
m_recording = new Indicator(tr("Rec"), this);
m_recording->setToolTip(tr("Recording"));
statusBar()->addPermanentWidget(m_recording);
} }
void MainWindow::closeEvent(QCloseEvent*) void MainWindow::closeEvent(QCloseEvent*)
@ -277,12 +274,6 @@ void MainWindow::updateCenterFreqDisplay()
m_deviceUIs.back()->m_spectrum->setCenterFrequency(m_centerFrequency); 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() void MainWindow::updatePresetControls()
{ {
ui->presetTree->resizeColumnToContents(0); ui->presetTree->resizeColumnToContents(0);
@ -337,7 +328,6 @@ QTreeWidgetItem* MainWindow::addPresetToTree(const Preset* preset)
void MainWindow::applySettings() void MainWindow::applySettings()
{ {
updateCenterFreqDisplay(); updateCenterFreqDisplay();
updateSampleRate();
} }
void MainWindow::handleMessages() void MainWindow::handleMessages()
@ -607,6 +597,11 @@ void MainWindow::on_action_About_triggered()
dlg.exec(); dlg.exec();
} }
void MainWindow::updateStatus()
{
m_dateTimeWidget->setText(QDateTime::currentDateTime().toString("yyyy-MM-ddThh:mm:ss t"));
}
MainWindow::DeviceUISet::DeviceUISet(QTimer& timer) MainWindow::DeviceUISet::DeviceUISet(QTimer& timer)
{ {
m_spectrum = new GLSpectrum; m_spectrum = new GLSpectrum;

View File

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