2021-06-23 Fred Gleason <fredg@paravelsystems.com>

* Added a voice tracker widget to the right-hand side of
	rdairplay(1).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-06-23 12:11:59 -04:00
parent b98b33cfe2
commit 25c13af6c0
9 changed files with 529 additions and 315 deletions

View File

@@ -58,6 +58,7 @@ dist_rdairplay_SOURCES = button_log.cpp button_log.h\
rdairplay.cpp rdairplay.h\
start_button.cpp start_button.h\
stop_counter.cpp stop_counter.h\
voicetracker.cpp voicetracker.h\
wall_clock.cpp wall_clock.h
@@ -74,6 +75,7 @@ nodist_rdairplay_SOURCES = moc_button_log.cpp\
moc_rdairplay.cpp\
moc_start_button.cpp\
moc_stop_counter.cpp\
moc_voicetracker.cpp\
moc_wall_clock.cpp
rdairplay_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT5_LIBS@ @MUSICBRAINZ_LIBS@

View File

@@ -51,7 +51,8 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
QString err_msg;
air_panel=NULL;
air_tracker=NULL;
//
// Get the Startup Date/Time
//
@@ -579,6 +580,12 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
this,SLOT(panelChannelStoppedData(int,int,int)));
}
//
// Voice Tracker
//
air_tracker=new VoiceTracker(this);
air_tracker->hide();
//
// Full Log List
//
@@ -642,6 +649,14 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
air_log_list[0]->show();
}
//
// Voice Tracker Button
//
air_tracker_button=new QPushButton(this);
air_tracker_button->setFont(bigButtonFont());
air_tracker_button->setText(tr("Voice\nTracker"));
air_tracker_button->setFocusPolicy(Qt::NoFocus);
connect(air_tracker_button,SIGNAL(clicked()),this,SLOT(trackerButtonData()));
//
// Button Log
@@ -1333,6 +1348,8 @@ void MainWidget::fullLogButtonData(int id)
}
else {
air_panel->hide();
ShowTracker(false);
air_tracker_button->setPalette(palette());
for(int i=0;i<RDAIRPLAY_LOG_QUANTITY;i++) {
if(air_log_list[i]->isVisible()) {
air_log_list[i]->hide();
@@ -1356,11 +1373,28 @@ void MainWidget::panelButtonData()
air_log_button[i]->setPalette(palette());
}
}
ShowTracker(false);
air_tracker_button->setPalette(palette());
air_panel->show();
air_panel_button->setPalette(active_color);
}
void MainWidget::trackerButtonData()
{
for(int i=0;i<RDAIRPLAY_LOG_QUANTITY;i++) {
if(air_log_list[i]->isVisible()) {
air_log_list[i]->hide();
air_log_button[i]->setPalette(palette());
}
}
air_panel->hide();
air_panel_button->setPalette(palette());
ShowTracker(true);
air_tracker_button->setPalette(active_color);
}
void MainWidget::modeButtonData()
{
int mach=-1;
@@ -2011,8 +2045,14 @@ void MainWidget::resizeEvent(QResizeEvent *e)
//
// Sound Panel
//
// air_panel->setGeometry(w/2,140,(w/2)-20,h-210);
air_panel->setGeometry(510,140,w-510,h-215);
if(air_panel!=NULL) {
air_panel->setGeometry(510,140,w-510,h-215);
}
//
// Voice Tracker
//
air_tracker->setGeometry(510,140,w-510,h-215);
//
// Full Log Widgets
@@ -2033,9 +2073,20 @@ void MainWidget::resizeEvent(QResizeEvent *e)
air_empty_cart->setGeometry(520,size().height()-51,32,32);
air_panel_button->setGeometry(562,size().height()-65,80,60);
int xpos=562;
air_panel_button->setGeometry(xpos,size().height()-65,80,60);
xpos+=85;
if((size().width()>=(510+air_tracker->sizeHint().width()))&&
(size().height()>=(140+air_tracker->sizeHint().height()))) {
air_tracker_button->setGeometry(xpos,size().height()-65,80,60);
xpos+=85;
air_tracker_button->show();
}
else {
air_tracker_button->hide();
}
for(int i=0;i<RDAIRPLAY_LOG_QUANTITY;i++) {
air_log_button[i]->setGeometry(647+i*123,size().height()-65,118,60);
air_log_button[i]->setGeometry(xpos+i*123,size().height()-65,118,60);
}
}
@@ -2472,3 +2523,17 @@ RDAirPlayConf::Channel MainWidget::PanelChannel(int mport) const
}
return chan;
}
void MainWidget::ShowTracker(bool state)
{
if(state) {
setMinimumWidth(510+air_tracker->sizeHint().width());
setMinimumHeight(140+air_tracker->sizeHint().height());
air_tracker->show();
}
else {
setMinimumSize(sizeHint());
air_tracker->hide();
}
}

View File

@@ -35,6 +35,7 @@
#include "post_counter.h"
#include "pie_counter.h"
#include "stop_counter.h"
#include "voicetracker.h"
#include "wall_clock.h"
//
@@ -80,6 +81,7 @@ class MainWidget : public RDMainWindow
void copyButtonData();
void fullLogButtonData(int);
void panelButtonData();
void trackerButtonData();
void modeButtonData();
void selectClickedData(int id,int line,RDLogLine::Status status);
void selectClickedData(unsigned cartnum,int row,int col);
@@ -112,9 +114,12 @@ class MainWidget : public RDMainWindow
bool AssertChannelLock(int dir,int card,int port);
bool AssertChannelLock(int dir,int achan);
int AudioChannel(int card,int port) const;
void ShowTracker(bool state);
RDAirPlayConf::Channel PanelChannel(int mport) const;
RDLogPlay *air_log[RDAIRPLAY_LOG_QUANTITY];
RDSoundPanel *air_panel;
VoiceTracker *air_tracker;
QPushButton *air_tracker_button;
PostCounter *air_post_counter;
PieCounter *air_pie_counter;
RDStereoMeter *air_stereo_meter;

View File

@@ -0,0 +1,72 @@
// voicetracker.cpp
//
// Voice tracker panel for RDAirPlay
//
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <rdlist_logs.h>
#include "voicetracker.h"
VoiceTracker::VoiceTracker(QWidget *parent)
: RDWidget(parent)
{
d_tracker_widget=new RDTrackerWidget(&d_import_path,this);
d_load_button=new QPushButton(tr("Load\nLog"),this);
d_load_button->setFont(bigButtonFont());
connect(d_load_button,SIGNAL(clicked()),this,SLOT(loadData()));
}
QSize VoiceTracker::sizeHint() const
{
return d_tracker_widget->sizeHint();
}
void VoiceTracker::loadData()
{
QString logname;
RDListLogs *d=new RDListLogs(&logname,RDLogFilter::StationFilter,"RDAirPlay",
this);
if(d->exec()) {
if(d_tracker_widget->load(logname)) {
d_load_button->disconnect();
connect(d_load_button,SIGNAL(clicked()),this,SLOT(unloadData()));
d_load_button->setText(tr("Unload\nLog"));
}
}
delete d;
}
void VoiceTracker::unloadData()
{
d_tracker_widget->unload();
d_load_button->disconnect();
connect(d_load_button,SIGNAL(clicked()),this,SLOT(loadData()));
d_load_button->setText(tr("Load\nLog"));
}
void VoiceTracker::resizeEvent(QResizeEvent *e)
{
d_tracker_widget->setGeometry(0,0,size().width(),size().height());
d_load_button->setGeometry(size().width()-90,size().height()-50,80,50);
}

50
rdairplay/voicetracker.h Normal file
View File

@@ -0,0 +1,50 @@
// voicetracker.h
//
// Voice tracker panel for RDAirPlay
//
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef VOICETRACKER_H
#define VOICETRACKER_H
#include <QLabel>
#include <QPushButton>
#include <rdtrackerwidget.h>
#include <rdwidget.h>
class VoiceTracker : public RDWidget
{
Q_OBJECT
public:
VoiceTracker(QWidget *parent=0);
QSize sizeHint() const;
private slots:
void loadData();
void unloadData();
protected:
void resizeEvent(QResizeEvent *e);
private:
RDTrackerWidget *d_tracker_widget;
QPushButton *d_load_button;
QString d_import_path;
};
#endif // VOICETRACKER_H