2024-02-08 Fred Gleason <fredg@paravelsystems.com>

* Implemented the 'Load Message" ['LM'] RML.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2024-02-08 15:36:18 -05:00
parent 38ef094ba3
commit bfa31221f5
14 changed files with 248 additions and 78 deletions

View File

@@ -24652,3 +24652,5 @@
* Fixed a regression in rdlibrary(1) that caused the 'Forced Length' * Fixed a regression in rdlibrary(1) that caused the 'Forced Length'
control in the 'Edit Cart' dialog to be misformatted when the control in the 'Edit Cart' dialog to be misformatted when the
system was configured to use 12 hour time format. system was configured to use 12 hour time format.
2024-02-08 Fred Gleason <fredg@paravelsystems.com>
* Implemented the 'Load Message" ['LM'] RML.

10
INSTALL
View File

@@ -275,26 +275,26 @@ DISTRO-SPECIFIC NOTES
--------------------- ---------------------
1) RedHat Enterprise Linux 7 1) RedHat Enterprise Linux 7
Required build packages: git gcc-c++ automake autoconf libtool qt5-qtbase-devel qt5-qtbase-mysql qt5-linguist libcurl-devel cdparanoia-devel hpklinux-devel alsa-lib-devel jack-audio-connection-kit-devel libsamplerate-devel libsndfile-devel id3lib-devel libvorbis-devel flac-devel pam-devel soundtouch-devel twolame-devel libmad-devel lame-devel rpm-build createrepo fop docbook5-style-xsl libxslt kernel-devel rpm-sign man-pages openssl-devel taglib-devel libmusicbrainz5-devel libdiscid-devel libcoverart libcoverart-devel ImageMagick-c++-devel Required build packages: git gcc-c++ automake autoconf libtool qt5-qtbase-devel qt5-qtbase-mysql qt5-linguist qt5-qtwebkit-devel libcurl-devel cdparanoia-devel hpklinux-devel alsa-lib-devel jack-audio-connection-kit-devel libsamplerate-devel libsndfile-devel id3lib-devel libvorbis-devel flac-devel pam-devel soundtouch-devel twolame-devel libmad-devel lame-devel rpm-build createrepo fop docbook5-style-xsl libxslt kernel-devel rpm-sign man-pages openssl-devel taglib-devel libmusicbrainz5-devel libdiscid-devel libcoverart libcoverart-devel ImageMagick-c++-devel
Configure script invocation: ./configure --prefix=/usr --libdir=/usr/lib64 --libexecdir=/var/www/rd-bin --sysconfdir=/etc/httpd/conf.d Configure script invocation: ./configure --prefix=/usr --libdir=/usr/lib64 --libexecdir=/var/www/rd-bin --sysconfdir=/etc/httpd/conf.d
2) RedHat Enterprise Linux 8 2) RedHat Enterprise Linux 8
Required build packages: git gcc-c++ automake autoconf libtool qt5-qtbase-devel qt5-linguist qt5-qtbase-mysql libcurl-devel cdparanoia-devel alsa-lib-devel libsamplerate-devel libsndfile-devel libvorbis-devel flac-devel pam-devel soundtouch-devel twolame-devel libmad-devel lame-devel rpm-build createrepo libxslt kernel-devel rpm-sign man-pages openssl-devel taglib-devel libmusicbrainz5-devel id3lib-devel libdiscid-devel libcoverart libcoverart-devel jack-audio-connection-kit-devel docbook5-style-xsl ImageMagick-c++-devel fop-static hpklinux-devel Required build packages: git gcc-c++ automake autoconf libtool qt5-qtbase-devel qt5-linguist qt5-qtbase-mysql qt5-qtwebkit-devel libcurl-devel cdparanoia-devel alsa-lib-devel libsamplerate-devel libsndfile-devel libvorbis-devel flac-devel pam-devel soundtouch-devel twolame-devel libmad-devel lame-devel rpm-build createrepo libxslt kernel-devel rpm-sign man-pages openssl-devel taglib-devel libmusicbrainz5-devel id3lib-devel libdiscid-devel libcoverart libcoverart-devel jack-audio-connection-kit-devel docbook5-style-xsl ImageMagick-c++-devel fop-static hpklinux-devel
Configure script invocation: ./configure --prefix=/usr --libdir=/usr/lib64 --libexecdir=/var/www/rd-bin --sysconfdir=/etc/httpd/conf.d Configure script invocation: ./configure --prefix=/usr --libdir=/usr/lib64 --libexecdir=/var/www/rd-bin --sysconfdir=/etc/httpd/conf.d
3) RedHat Enterprise Linux 9 3) RedHat Enterprise Linux 9
Required build packages: git gcc-c++ automake autoconf libtool qt5-qtbase-devel qt5-linguist qt5-qtbase-mysql libcurl-devel cdparanoia-devel alsa-lib-devel libsamplerate-devel libsndfile-devel libvorbis-devel flac-devel pam-devel soundtouch-devel twolame-devel libmad-devel lame-devel rpm-build createrepo libxslt kernel-devel rpm-sign man-pages openssl-devel taglib-devel libmusicbrainz5-devel id3lib-devel libdiscid-devel libcoverart libcoverart-devel pipewire-jack-audio-connection-kit-devel docbook5-style-xsl ImageMagick-c++-devel fop-static hpklinux-devel Required build packages: git gcc-c++ automake autoconf libtool qt5-qtbase-devel qt5-linguist qt5-qtbase-mysql qt5-qtwebkit-devel libcurl-devel cdparanoia-devel alsa-lib-devel libsamplerate-devel libsndfile-devel libvorbis-devel flac-devel pam-devel soundtouch-devel twolame-devel libmad-devel lame-devel rpm-build createrepo libxslt kernel-devel rpm-sign man-pages openssl-devel taglib-devel libmusicbrainz5-devel id3lib-devel libdiscid-devel libcoverart libcoverart-devel pipewire-jack-audio-connection-kit-devel docbook5-style-xsl ImageMagick-c++-devel fop-static hpklinux-devel
Configure script invocation: ./configure --prefix=/usr --libdir=/usr/lib64 --libexecdir=/var/www/rd-bin --sysconfdir=/etc/httpd/conf.d Configure script invocation: ./configure --prefix=/usr --libdir=/usr/lib64 --libexecdir=/var/www/rd-bin --sysconfdir=/etc/httpd/conf.d
4) Ubuntu 20.04 LTS 4) Ubuntu 20.04 LTS
Required build packages: apache2 libexpat1-dev libexpat1 libid3-dev libcurl4-gnutls-dev libcoverart-dev libdiscid-dev libmusicbrainz5-dev libcdparanoia-dev libsndfile1-dev libpam0g-dev libvorbis-dev python3 python3-pycurl python3-pymysql python3-serial python3-requests libsamplerate0-dev qtbase5-dev libqt5sql5-mysql libsoundtouch-dev libsystemd-dev libjack-jackd2-dev libasound2-dev libflac-dev libflac++-dev libmp3lame-dev libmad0-dev libtwolame-dev docbook5-xml libxml2-utils docbook-xsl-ns xsltproc fop make g++ libltdl-dev autoconf automake libssl-dev libtag1-dev qttools5-dev-tools debhelper openssh-server autoconf-archive gnupg pbuilder ubuntu-dev-tools apt-file Required build packages: apache2 libexpat1-dev libexpat1 libid3-dev libcurl4-gnutls-dev libcoverart-dev libdiscid-dev libmusicbrainz5-dev libcdparanoia-dev libsndfile1-dev libpam0g-dev libvorbis-dev python3 python3-pycurl python3-pymysql python3-serial python3-requests libsamplerate0-dev qtbase5-dev libqt5sql5-mysql libqt5webkit5-dev libsoundtouch-dev libsystemd-dev libjack-jackd2-dev libasound2-dev libflac-dev libflac++-dev libmp3lame-dev libmad0-dev libtwolame-dev docbook5-xml libxml2-utils docbook-xsl-ns xsltproc fop make g++ libltdl-dev autoconf automake libssl-dev libtag1-dev qttools5-dev-tools debhelper openssh-server autoconf-archive gnupg pbuilder ubuntu-dev-tools apt-file
Configure script invocation: ./configure --prefix=/usr --libdir=/usr/lib --libexecdir=/var/www/rd-bin --sysconfdir=/etc/apache2/conf-enabled --enable-rdxport-debug MUSICBRAINZ_LIBS="-ldiscid -lmusicbrainz5cc -lcoverartcc" Configure script invocation: ./configure --prefix=/usr --libdir=/usr/lib --libexecdir=/var/www/rd-bin --sysconfdir=/etc/apache2/conf-enabled --enable-rdxport-debug MUSICBRAINZ_LIBS="-ldiscid -lmusicbrainz5cc -lcoverartcc"
@@ -310,7 +310,7 @@ be done by means of the following commands:
5) Ubuntu 22.04 LTS 5) Ubuntu 22.04 LTS
Required build packages: apache2 libexpat1-dev libexpat1 libid3-dev libcurl4-gnutls-dev libcoverart-dev libdiscid-dev libmusicbrainz5-dev libcdparanoia-dev libsndfile1-dev libpam0g-dev libvorbis-dev python3 python3-pycurl python3-pymysql python3-serial python3-requests libsamplerate0-dev qtbase5-dev libqt5sql5-mysql libsoundtouch-dev libsystemd-dev libjack-jackd2-dev libasound2-dev libflac-dev libflac++-dev libmp3lame-dev libmad0-dev libtwolame-dev docbook5-xml libxml2-utils docbook-xsl-ns xsltproc fop make g++ libltdl-dev autoconf automake libssl-dev libtag1-dev qttools5-dev-tools debhelper openssh-server autoconf-archive gnupg pbuilder ubuntu-dev-tools apt-file hpklinux-dev libmagick++-dev Required build packages: apache2 libexpat1-dev libexpat1 libid3-dev libcurl4-gnutls-dev libcoverart-dev libdiscid-dev libmusicbrainz5-dev libcdparanoia-dev libsndfile1-dev libpam0g-dev libvorbis-dev python3 python3-pycurl python3-pymysql python3-serial python3-requests libsamplerate0-dev qtbase5-dev libqt5sql5-mysql libqt5webkit5-dev libsoundtouch-dev libsystemd-dev libjack-jackd2-dev libasound2-dev libflac-dev libflac++-dev libmp3lame-dev libmad0-dev libtwolame-dev docbook5-xml libxml2-utils docbook-xsl-ns xsltproc fop make g++ libltdl-dev autoconf automake libssl-dev libtag1-dev qttools5-dev-tools debhelper openssh-server autoconf-archive gnupg pbuilder ubuntu-dev-tools apt-file hpklinux-dev libmagick++-dev
Configure script invocation: ./configure --prefix=/usr --libdir=/usr/lib --libexecdir=/var/www/rd-bin --sysconfdir=/etc/apache2/conf-enabled --enable-rdxport-debug MUSICBRAINZ_LIBS="-ldiscid -lmusicbrainz5cc -lcoverartcc" Configure script invocation: ./configure --prefix=/usr --libdir=/usr/lib --libexecdir=/var/www/rd-bin --sysconfdir=/etc/apache2/conf-enabled --enable-rdxport-debug MUSICBRAINZ_LIBS="-ldiscid -lmusicbrainz5cc -lcoverartcc"

View File

@@ -93,7 +93,7 @@ AC_ARG_ENABLE(i18n-updates,[ --enable-i18n-updates enable I18N metadata updat
# #
# Check for Qt5 (Mandatory) # Check for Qt5 (Mandatory)
# #
PKG_CHECK_MODULES(QT5,Qt5Core Qt5Widgets Qt5Gui Qt5Network Qt5Sql Qt5Xml,,[AC_MSG_ERROR([*** Qt5 not found ***])]) PKG_CHECK_MODULES(QT5,Qt5Core Qt5Widgets Qt5Gui Qt5Network Qt5Sql Qt5Xml Qt5WebKit,,[AC_MSG_ERROR([*** Qt5 not found ***])])
PKG_CHECK_MODULES(QT5_CLI,Qt5Core Qt5Network Qt5Sql Qt5Xml,,[AC_MSG_ERROR([*** Qt5 not found ***])]) PKG_CHECK_MODULES(QT5_CLI,Qt5Core Qt5Network Qt5Sql Qt5Xml,,[AC_MSG_ERROR([*** Qt5 not found ***])])
AC_CHECK_PROG(MOC_NAME,moc-qt5,[moc-qt5],[moc]) AC_CHECK_PROG(MOC_NAME,moc-qt5,[moc-qt5],[moc])
AC_SUBST(QT_MOC,$MOC_NAME) AC_SUBST(QT_MOC,$MOC_NAME)

View File

@@ -1227,6 +1227,33 @@
</para> </para>
</sect2> </sect2>
<sect2 xml:id="sect.rml.load_message__lm_">
<title>Load Message [LM]</title>
<para>
<variablelist>
<varlistentry>
<term>Module</term>
<listitem><command>rdairplay</command><manvolnum>1</manvolnum></listitem>
</varlistentry>
<varlistentry>
<term>Mnemonic</term>
<listitem><userinput>LM</userinput></listitem>
</varlistentry>
</variablelist>
</para>
<para>
Load a webpage into RDAirPlay's Message Area.
</para>
<para>
<userinput>LM
<replaceable>url</replaceable>!</userinput>
</para>
<para>
Display the web page specified by <replaceable>url</replaceable> in the
message widget.
</para>
</sect2>
<sect2 xml:id="sect.load_panel__pe_"> <sect2 xml:id="sect.load_panel__pe_">
<title>Load Panel [PE]</title> <title>Load Panel [PE]</title>
<para> <para>

View File

@@ -80,6 +80,7 @@ void RDMacro::setCommand(const QString &str)
case RDMacro::LB: case RDMacro::LB:
case RDMacro::LC: case RDMacro::LC:
case RDMacro::LL: case RDMacro::LL:
case RDMacro::LM:
case RDMacro::LO: case RDMacro::LO:
case RDMacro::MB: case RDMacro::MB:
case RDMacro::MD: case RDMacro::MD:
@@ -320,6 +321,7 @@ RDMacro RDMacro::fromString(const QString &str,RDMacro::Role role)
case RDMacro::LB: case RDMacro::LB:
case RDMacro::LC: case RDMacro::LC:
case RDMacro::LL: case RDMacro::LL:
case RDMacro::LM:
case RDMacro::LO: case RDMacro::LO:
case RDMacro::MB: case RDMacro::MB:
case RDMacro::MD: case RDMacro::MD:

View File

@@ -38,14 +38,14 @@ class RDMacro
enum Command {AG=0x4147,AL=0x414C,BO=0x424F,CC=0x4343,CE=0x4345,CL=0x434C, enum Command {AG=0x4147,AL=0x414C,BO=0x424F,CC=0x4343,CE=0x4345,CL=0x434C,
CP=0x4350,DL=0x444C,DP=0x4450,DS=0x4453,DX=0x4458,EX=0x4558, CP=0x4350,DL=0x444C,DP=0x4450,DS=0x4453,DX=0x4458,EX=0x4558,
FS=0x4653,GE=0x4745,GI=0x4749,GO=0x474F,JC=0x4A43,JD=0x4A44, FS=0x4653,GE=0x4745,GI=0x4749,GO=0x474F,JC=0x4A43,JD=0x4A44,
JZ=0x4A5A,LB=0x4C42,LC=0x4C43,LL=0x4C4C,LO=0x4C4F,MB=0x4D42, JZ=0x4A5A,LB=0x4C42,LC=0x4C43,LL=0x4C4C,LM=0x4C4D,LO=0x4C4F,
MD=0x4D44,MN=0x4D4E,MT=0x4D54,NN=0x4E4E,PB=0x5042,PC=0x5043, MB=0x4D42,MD=0x4D44,MN=0x4D4E,MT=0x4D54,NN=0x4E4E,PB=0x5042,
PD=0x5044,PE=0x5045,PL=0x504C,PM=0x504D,PN=0x504E,PP=0x5050, PC=0x5043,PD=0x5044,PE=0x5045,PL=0x504C,PM=0x504D,PN=0x504E,
PS=0x5053,PT=0x5054,PU=0x5055,PW=0x5057,PX=0x5058,RL=0x524C, PP=0x5050,PS=0x5053,PT=0x5054,PU=0x5055,PW=0x5057,PX=0x5058,
RN=0x524E,RS=0x5253,RR=0x5252,SA=0x5341,SC=0x5343,SD=0x5344, RL=0x524C,RN=0x524E,RS=0x5253,RR=0x5252,SA=0x5341,SC=0x5343,
SG=0x5347,SI=0x5349,SL=0x534C,SN=0x534e,SO=0x534F,SP=0x5350, SD=0x5344,SG=0x5347,SI=0x5349,SL=0x534C,SN=0x534e,SO=0x534F,
SR=0x5352,ST=0x5354,SX=0x5358,SY=0x5359,SZ=0x535A,TA=0x5441, SP=0x5350,SR=0x5352,ST=0x5354,SX=0x5358,SY=0x5359,SZ=0x535A,
UO=0x554F}; TA=0x5441,UO=0x554F};
enum Role {Invalid=0,Cmd=1,Reply=2}; enum Role {Invalid=0,Cmd=1,Reply=2};
RDMacro(); RDMacro();
RDMacro::Role role() const; RDMacro::Role role() const;

View File

@@ -2,7 +2,7 @@
## ##
## Automake.am for rivendell/rdairplay ## Automake.am for rivendell/rdairplay
## ##
## (C) 2002-2023 Fred Gleason <fredg@paravelsystems.com> ## (C) 2002-2024 Fred Gleason <fredg@paravelsystems.com>
## ##
## This program is free software; you can redistribute it and/or modify ## 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 ## it under the terms of the GNU General Public License version 2 as
@@ -20,7 +20,7 @@
## ##
## Use automake to process this into a Makefile.in ## Use automake to process this into a Makefile.in
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib -Wno-strict-aliasing -std=c++11 -fPIC @QT5_CFLAGS@ @MUSICBRAINZ_CFLAGS@ @IMAGEMAGICK_CFLAGS@ AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib -Wno-strict-aliasing -std=c++11 -fPIC @QT5_CFLAGS@ -I/usr/include/qt5/QtWebKitWidgets @MUSICBRAINZ_CFLAGS@ @IMAGEMAGICK_CFLAGS@
LIBS = -L$(top_srcdir)/lib LIBS = -L$(top_srcdir)/lib
MOC = @QT_MOC@ MOC = @QT_MOC@
@@ -48,6 +48,7 @@ dist_rdairplay_SOURCES = button_log.cpp button_log.h\
local_macros.cpp colors.h\ local_macros.cpp colors.h\
loglinebox.cpp loglinebox.h\ loglinebox.cpp loglinebox.h\
logtableview.cpp logtableview.h\ logtableview.cpp logtableview.h\
messagewidget.cpp messagewidget.h\
mode_display.cpp mode_display.h\ mode_display.cpp mode_display.h\
pie_counter.cpp pie_counter.h\ pie_counter.cpp pie_counter.h\
post_counter.cpp post_counter.h\ post_counter.cpp post_counter.h\
@@ -68,6 +69,7 @@ nodist_rdairplay_SOURCES = moc_button_log.cpp\
moc_list_logs.cpp\ moc_list_logs.cpp\
moc_loglinebox.cpp\ moc_loglinebox.cpp\
moc_logtableview.cpp\ moc_logtableview.cpp\
moc_messagewidget.cpp\
moc_mode_display.cpp\ moc_mode_display.cpp\
moc_pie_counter.cpp\ moc_pie_counter.cpp\
moc_post_counter.cpp\ moc_post_counter.cpp\
@@ -80,7 +82,7 @@ nodist_rdairplay_SOURCES = moc_button_log.cpp\
moc_voicetracker.cpp\ moc_voicetracker.cpp\
moc_wall_clock.cpp moc_wall_clock.cpp
rdairplay_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT5_LIBS@ @MUSICBRAINZ_LIBS@ @IMAGEMAGICK_LIBS@ rdairplay_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT5_LIBS@ @MUSICBRAINZ_LIBS@ @IMAGEMAGICK_LIBS@ -lQt5WebKitWidgets
rdairplay_LDFLAGS = -rdynamic rdairplay_LDFLAGS = -rdynamic
EXTRA_DIST = rdairplay.pro\ EXTRA_DIST = rdairplay.pro\

View File

@@ -2,7 +2,7 @@
// //
// Local RML Macros for the Rivendell's RDAirPlay // Local RML Macros for the Rivendell's RDAirPlay
// //
// (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2024 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@@ -58,13 +58,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
str+=(rml->arg(i)+" "); str+=(rml->arg(i)+" ");
} }
str+=rml->arg(rml->argQuantity()-1); str+=rml->arg(rml->argQuantity()-1);
pal=air_top_strip->messageWidget()->palette(); air_top_strip->messageWidget()->setText(str,QColor(Qt::black));
pal.setColor(QPalette::Active,QPalette::Foreground,QColor(Qt::black));
pal.setColor(QPalette::Inactive,QPalette::Foreground,
QColor(Qt::black));
air_top_strip->messageWidget()->setPalette(pal);
air_top_strip->messageWidget()->setFont(MessageFont(str));
air_top_strip->messageWidget()->setText(str);
} }
if(rml->echoRequested()) { if(rml->echoRequested()) {
rml->acknowledge(true); rml->acknowledge(true);
@@ -85,12 +79,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
str+=(rml->arg(i)+" "); str+=(rml->arg(i)+" ");
} }
str+=rml->arg(rml->argQuantity()-1); str+=rml->arg(rml->argQuantity()-1);
pal=air_top_strip->messageWidget()->palette(); air_top_strip->messageWidget()->setText(str,color);
pal.setColor(QPalette::Active,QPalette::Foreground,color);
pal.setColor(QPalette::Inactive,QPalette::Foreground,color);
air_top_strip->messageWidget()->setPalette(pal);
air_top_strip->messageWidget()->setFont(MessageFont(str));
air_top_strip->messageWidget()->setText(str);
} }
if(rml->echoRequested()) { if(rml->echoRequested()) {
rml->acknowledge(true); rml->acknowledge(true);
@@ -98,6 +87,22 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
} }
break; break;
case RDMacro::LM: // Load Message Widget
if(rml->argQuantity()==0) {
air_top_strip->messageWidget()->clear();
}
else {
for(int i=0;i<(rml->argQuantity());i++) {
str+=(rml->arg(i)+" ");
}
ok=air_top_strip->messageWidget()->setUrl(str.trimmed());
}
if(rml->echoRequested()) {
rml->acknowledge(ok);
rda->ripc()->sendRml(rml);
}
break;
case RDMacro::LL: // Load Log case RDMacro::LL: // Load Log
if((rml->argQuantity()<1)||(rml->argQuantity()>3)) { if((rml->argQuantity()<1)||(rml->argQuantity()>3)) {
if(rml->echoRequested()) { if(rml->echoRequested()) {
@@ -960,17 +965,6 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
} }
QFont MainWidget::MessageFont(QString str)
{
for(int i=(AIR_MESSAGE_FONT_QUANTITY-1);i>=0;i--) {
if(air_message_metrics[i]->width(str)<MESSAGE_WIDGET_WIDTH) {
return air_message_fonts[i];
}
}
return air_message_fonts[0];
}
bool MainWidget::GetPanel(QString str,RDAirPlayConf::PanelType *type, bool MainWidget::GetPanel(QString str,RDAirPlayConf::PanelType *type,
int *panel) int *panel)
{ {

109
rdairplay/messagewidget.cpp Normal file
View File

@@ -0,0 +1,109 @@
// messagewidget.cpp
//
// Message Widget for RDAirPlay Rivendell
//
// (C) Copyright 2024 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 "colors.h"
#include "messagewidget.h"
MessageWidget::MessageWidget(QWidget *parent)
: QWidget(parent)
{
setStyleSheet("background-color: "+
QColor(LOGLINEBOX_BACKGROUND_COLOR).name());
//
// Generate Fonts
//
for(unsigned i=0;i<MESSAGE_FONT_QUANTITY;i++) {
d_message_fonts[i]=QFont(font().family(),12+2*i,QFont::Normal);
d_message_fonts[i].setPixelSize(12+2*i);
d_message_metrics[i]=new QFontMetrics(d_message_fonts[i]);
}
//
// Message Display
//
d_label=new QLabel(this);
d_label->setWordWrap(true);
d_label->setAlignment(Qt::AlignCenter);
d_view=new QWebView(this);
d_view->hide();
}
void MessageWidget::setText(const QString &str,const QColor &col)
{
QPalette pal=d_label->palette();
pal.setColor(QPalette::Active,QPalette::Foreground,col);
pal.setColor(QPalette::Inactive,QPalette::Foreground,col);
d_label->setPalette(pal);
d_label->setFont(MessageFont(str));
d_label->setText(str);
d_label->show();
d_view->hide();
}
bool MessageWidget::setUrl(const QString &str)
{
QUrl url(str);
if(!url.isValid()) {
setText(tr("invalid URL")+": "+str.toUtf8().constData(),Qt::black);
return false;
}
if((url.scheme().toLower()!="http")&&
(url.scheme().toLower()!="https")&&
(url.scheme().toLower()!="file")) {
setText(tr("unsupported URL scheme")+": "+str.toUtf8().constData(),
Qt::black);
return false;
}
d_view->load(url);
d_view->show();
d_label->hide();
return true;
}
void MessageWidget::clear()
{
d_label->clear();
d_label->show();
d_view->hide();
}
void MessageWidget::resizeEvent(QResizeEvent *e)
{
d_label->setGeometry(0,0,size().width(),size().height());
d_view->setGeometry(0,0,size().width(),size().height());
}
QFont MessageWidget::MessageFont(QString str) const
{
for(int i=(MESSAGE_FONT_QUANTITY-1);i>=0;i--) {
if(d_message_metrics[i]->width(str)<MESSAGE_WIDGET_WIDTH) {
return d_message_fonts[i];
}
}
return d_message_fonts[0];
}

50
rdairplay/messagewidget.h Normal file
View File

@@ -0,0 +1,50 @@
// messagewidget.h
//
// Message Widget for RDAirPlay Rivendell
//
// (C) Copyright 2024 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 MESSAGEWIDGET_H
#define MESSAGEWIDGET_H
#include <QLabel>
#include <QWebView>
#define MESSAGE_FONT_QUANTITY 8
#define MESSAGE_WIDGET_WIDTH 410
class MessageWidget : public QWidget
{
Q_OBJECT
public:
MessageWidget(QWidget *parent=0);
void setText(const QString &str,const QColor &col);
bool setUrl(const QString &url);
void clear();
protected:
void resizeEvent(QResizeEvent *e);
private:
QFont MessageFont(QString str) const;
QLabel *d_label;
QWebView *d_view;
QFont d_message_fonts[MESSAGE_FONT_QUANTITY];
QFontMetrics *d_message_metrics[MESSAGE_FONT_QUANTITY];
};
#endif // MESSAGEWIDGET_H

View File

@@ -2,7 +2,7 @@
// //
// The On Air Playout Utility for Rivendell. // The On Air Playout Utility for Rivendell.
// //
// (C) Copyright 2002-2023 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2024 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@@ -134,15 +134,6 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
// //
srandom(QTime::currentTime().msec()); srandom(QTime::currentTime().msec());
//
// Generate Fonts
//
for(unsigned i=0;i<AIR_MESSAGE_FONT_QUANTITY;i++) {
air_message_fonts[i]=QFont(font().family(),12+2*i,QFont::Normal);
air_message_fonts[i].setPixelSize(12+2*i);
air_message_metrics[i]=new QFontMetrics(air_message_fonts[i]);
}
// //
// Create And Set Icon // Create And Set Icon
// //

View File

@@ -2,7 +2,7 @@
// //
// The On Air Playout Utility for Rivendell. // The On Air Playout Utility for Rivendell.
// //
// (C) Copyright 2002-2023 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2024 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@@ -42,11 +42,9 @@
#define AIR_LOG_PORTS 2 #define AIR_LOG_PORTS 2
#define AIR_PANEL_PORTS 1 #define AIR_PANEL_PORTS 1
#define AIR_TOTAL_PORTS 3 #define AIR_TOTAL_PORTS 3
#define AIR_MESSAGE_FONT_QUANTITY 8
#define AIR_CHANNEL_LOCKOUT_INTERVAL 1000 #define AIR_CHANNEL_LOCKOUT_INTERVAL 1000
#define METER_INTERVAL 20 #define METER_INTERVAL 20
#define MASTER_TIMER_INTERVAL 100 #define MASTER_TIMER_INTERVAL 100
#define MESSAGE_WIDGET_WIDTH 410
#define RDAIRPLAY_USAGE "[OPTIONS]\n" #define RDAIRPLAY_USAGE "[OPTIONS]\n"
class MainWidget : public RDMainWindow class MainWidget : public RDMainWindow
@@ -99,7 +97,6 @@ class MainWidget : public RDMainWindow
void SetLiveAssistMode(int mach); void SetLiveAssistMode(int mach);
void SetActionMode(StartButton::Mode mode); void SetActionMode(StartButton::Mode mode);
bool GetPanel(QString str,RDAirPlayConf::PanelType *type,int *panel); bool GetPanel(QString str,RDAirPlayConf::PanelType *type,int *panel);
QFont MessageFont(QString str);
bool AssertChannelLock(int dir,int card,int port); bool AssertChannelLock(int dir,int card,int port);
bool AssertChannelLock(int dir,int achan); bool AssertChannelLock(int dir,int achan);
int AudioChannel(int card,int port) const; int AudioChannel(int card,int port) const;
@@ -150,8 +147,6 @@ class MainWidget : public RDMainWindow
RDAirPlayConf::ExitCode rdairplay_previous_exit_code; RDAirPlayConf::ExitCode rdairplay_previous_exit_code;
QDateTime air_startup_datetime; QDateTime air_startup_datetime;
QPixmap *air_refresh_pixmap; QPixmap *air_refresh_pixmap;
QFont air_message_fonts[AIR_MESSAGE_FONT_QUANTITY];
QFontMetrics *air_message_metrics[AIR_MESSAGE_FONT_QUANTITY];
int air_audio_channels[RDAirPlayConf::LastChannel]; int air_audio_channels[RDAirPlayConf::LastChannel];
int air_start_gpi_matrices[RDAirPlayConf::LastChannel]; int air_start_gpi_matrices[RDAirPlayConf::LastChannel];
int air_start_gpi_lines[RDAirPlayConf::LastChannel]; int air_start_gpi_lines[RDAirPlayConf::LastChannel];

View File

@@ -2,7 +2,7 @@
// //
// Top row of indicator widgets for rdairplay(1) // Top row of indicator widgets for rdairplay(1)
// //
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2021-2024 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@@ -18,6 +18,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// //
#include <QUrl>
#include <rdapplication.h> #include <rdapplication.h>
#include <rd.h> #include <rd.h>
@@ -45,18 +47,10 @@ TopStrip::TopStrip(QWidget *parent)
// Audio Meters // Audio Meters
// //
d_meter_widget=new RDMeterStrip(this); d_meter_widget=new RDMeterStrip(this);
// //
// Message Display // Message Widget
// //
d_message_widget=new QLabel(this); d_message_widget=new MessageWidget(this);
d_message_widget->setStyleSheet("background-color: "+
QColor(LOGLINEBOX_BACKGROUND_COLOR).name());
d_message_widget->setWordWrap(true);
d_message_widget->setLineWidth(1);
d_message_widget->setMidLineWidth(1);
d_message_widget->setFrameStyle(QFrame::Box|QFrame::Raised);
d_message_widget->setAlignment(Qt::AlignCenter);
// //
// Logo // Logo
@@ -114,7 +108,7 @@ RDMeterStrip *TopStrip::meterWidget()
} }
QLabel *TopStrip::messageWidget() const MessageWidget *TopStrip::messageWidget() const
{ {
return d_message_widget; return d_message_widget;
} }
@@ -131,6 +125,8 @@ void TopStrip::setOnairFlag(bool state)
void TopStrip::resizeEvent(QResizeEvent *e) void TopStrip::resizeEvent(QResizeEvent *e)
{ {
int w=size().width();
d_wall_clock_widget->setGeometry(10,5, d_wall_clock_widget->setGeometry(10,5,
d_wall_clock_widget->sizeHint().width(), d_wall_clock_widget->sizeHint().width(),
d_wall_clock_widget->sizeHint().height()); d_wall_clock_widget->sizeHint().height());
@@ -148,10 +144,10 @@ void TopStrip::resizeEvent(QResizeEvent *e)
d_message_widget->setGeometry(10+d_meter_widget->geometry().x()+ d_message_widget->setGeometry(10+d_meter_widget->geometry().x()+
d_meter_widget->geometry().width(), d_meter_widget->geometry().width(),
5, 5,
size().width()-(30+d_meter_widget->geometry().x()+d_meter_widget->geometry().width()+RD_RDAIRPLAY_LOGO_WIDTH), w-(30+d_meter_widget->geometry().x()+d_meter_widget->geometry().width()+RD_RDAIRPLAY_LOGO_WIDTH),
125); 125);
d_logo->setGeometry(size().width()-RD_RDAIRPLAY_LOGO_WIDTH-10, d_logo->setGeometry(w-RD_RDAIRPLAY_LOGO_WIDTH-10,
5, 5,
RD_RDAIRPLAY_LOGO_WIDTH, RD_RDAIRPLAY_LOGO_WIDTH,
RD_RDAIRPLAY_LOGO_HEIGHT); RD_RDAIRPLAY_LOGO_HEIGHT);

View File

@@ -2,7 +2,7 @@
// //
// Top row of indicator widgets for rdairplay(1) // Top row of indicator widgets for rdairplay(1)
// //
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2021-2024 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@@ -22,10 +22,12 @@
#define TOPSTRIP_H #define TOPSTRIP_H
#include <QLabel> #include <QLabel>
#include <QWebView>
#include <rdmeterstrip.h> #include <rdmeterstrip.h>
#include <rdwidget.h> #include <rdwidget.h>
#include "messagewidget.h"
#include "mode_display.h" #include "mode_display.h"
#include "wall_clock.h" #include "wall_clock.h"
@@ -40,8 +42,7 @@ class TopStrip : public RDWidget
WallClock *wallClockWidget() const; WallClock *wallClockWidget() const;
ModeDisplay *modeDisplayWidget() const; ModeDisplay *modeDisplayWidget() const;
RDMeterStrip *meterWidget(); RDMeterStrip *meterWidget();
QLabel *messageWidget() const; MessageWidget *messageWidget() const;
public slots: public slots:
void setOnairFlag(bool state); void setOnairFlag(bool state);
@@ -50,10 +51,11 @@ class TopStrip : public RDWidget
void paintEvent(QPaintEvent *e); void paintEvent(QPaintEvent *e);
private: private:
// QFont MessageFont(QString str) const;
WallClock *d_wall_clock_widget; WallClock *d_wall_clock_widget;
ModeDisplay *d_mode_display_widget; ModeDisplay *d_mode_display_widget;
RDMeterStrip *d_meter_widget; RDMeterStrip *d_meter_widget;
QLabel *d_message_widget; MessageWidget *d_message_widget;
QLabel *d_logo; QLabel *d_logo;
bool d_onair_flag; bool d_onair_flag;
}; };