From bfa31221f58312ce0bdd8fccd898ca75128e3e40 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Thu, 8 Feb 2024 15:36:18 -0500 Subject: [PATCH] 2024-02-08 Fred Gleason * Implemented the 'Load Message" ['LM'] RML. Signed-off-by: Fred Gleason --- ChangeLog | 2 + INSTALL | 10 ++-- configure.ac | 2 +- docs/opsguide/rml.xml | 27 +++++++++ lib/rdmacro.cpp | 2 + lib/rdmacro.h | 16 +++--- rdairplay/Makefile.am | 8 ++- rdairplay/local_macros.cpp | 44 +++++++-------- rdairplay/messagewidget.cpp | 109 ++++++++++++++++++++++++++++++++++++ rdairplay/messagewidget.h | 50 +++++++++++++++++ rdairplay/rdairplay.cpp | 11 +--- rdairplay/rdairplay.h | 7 +-- rdairplay/topstrip.cpp | 28 ++++----- rdairplay/topstrip.h | 10 ++-- 14 files changed, 248 insertions(+), 78 deletions(-) create mode 100644 rdairplay/messagewidget.cpp create mode 100644 rdairplay/messagewidget.h diff --git a/ChangeLog b/ChangeLog index 245c7688..0a00cc38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24652,3 +24652,5 @@ * Fixed a regression in rdlibrary(1) that caused the 'Forced Length' control in the 'Edit Cart' dialog to be misformatted when the system was configured to use 12 hour time format. +2024-02-08 Fred Gleason + * Implemented the 'Load Message" ['LM'] RML. diff --git a/INSTALL b/INSTALL index 593f5be3..4882a683 100644 --- a/INSTALL +++ b/INSTALL @@ -275,26 +275,26 @@ DISTRO-SPECIFIC NOTES --------------------- 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 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 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 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" @@ -310,7 +310,7 @@ be done by means of the following commands: 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" diff --git a/configure.ac b/configure.ac index e0cddade..0007e54b 100644 --- a/configure.ac +++ b/configure.ac @@ -93,7 +93,7 @@ AC_ARG_ENABLE(i18n-updates,[ --enable-i18n-updates enable I18N metadata updat # # 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 ***])]) AC_CHECK_PROG(MOC_NAME,moc-qt5,[moc-qt5],[moc]) AC_SUBST(QT_MOC,$MOC_NAME) diff --git a/docs/opsguide/rml.xml b/docs/opsguide/rml.xml index 97ef75d8..7d3a1f47 100644 --- a/docs/opsguide/rml.xml +++ b/docs/opsguide/rml.xml @@ -1227,6 +1227,33 @@ + + Load Message [LM] + + + + Module + rdairplay1 + + + Mnemonic + LM + + + + + Load a webpage into RDAirPlay's Message Area. + + + LM + url! + + + Display the web page specified by url in the + message widget. + + + Load Panel [PE] diff --git a/lib/rdmacro.cpp b/lib/rdmacro.cpp index 34960a4b..d7082b72 100644 --- a/lib/rdmacro.cpp +++ b/lib/rdmacro.cpp @@ -80,6 +80,7 @@ void RDMacro::setCommand(const QString &str) case RDMacro::LB: case RDMacro::LC: case RDMacro::LL: + case RDMacro::LM: case RDMacro::LO: case RDMacro::MB: case RDMacro::MD: @@ -320,6 +321,7 @@ RDMacro RDMacro::fromString(const QString &str,RDMacro::Role role) case RDMacro::LB: case RDMacro::LC: case RDMacro::LL: + case RDMacro::LM: case RDMacro::LO: case RDMacro::MB: case RDMacro::MD: diff --git a/lib/rdmacro.h b/lib/rdmacro.h index fca7ee39..35f302b4 100644 --- a/lib/rdmacro.h +++ b/lib/rdmacro.h @@ -38,14 +38,14 @@ class RDMacro 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, FS=0x4653,GE=0x4745,GI=0x4749,GO=0x474F,JC=0x4A43,JD=0x4A44, - JZ=0x4A5A,LB=0x4C42,LC=0x4C43,LL=0x4C4C,LO=0x4C4F,MB=0x4D42, - MD=0x4D44,MN=0x4D4E,MT=0x4D54,NN=0x4E4E,PB=0x5042,PC=0x5043, - PD=0x5044,PE=0x5045,PL=0x504C,PM=0x504D,PN=0x504E,PP=0x5050, - PS=0x5053,PT=0x5054,PU=0x5055,PW=0x5057,PX=0x5058,RL=0x524C, - RN=0x524E,RS=0x5253,RR=0x5252,SA=0x5341,SC=0x5343,SD=0x5344, - SG=0x5347,SI=0x5349,SL=0x534C,SN=0x534e,SO=0x534F,SP=0x5350, - SR=0x5352,ST=0x5354,SX=0x5358,SY=0x5359,SZ=0x535A,TA=0x5441, - UO=0x554F}; + JZ=0x4A5A,LB=0x4C42,LC=0x4C43,LL=0x4C4C,LM=0x4C4D,LO=0x4C4F, + MB=0x4D42,MD=0x4D44,MN=0x4D4E,MT=0x4D54,NN=0x4E4E,PB=0x5042, + PC=0x5043,PD=0x5044,PE=0x5045,PL=0x504C,PM=0x504D,PN=0x504E, + PP=0x5050,PS=0x5053,PT=0x5054,PU=0x5055,PW=0x5057,PX=0x5058, + RL=0x524C,RN=0x524E,RS=0x5253,RR=0x5252,SA=0x5341,SC=0x5343, + SD=0x5344,SG=0x5347,SI=0x5349,SL=0x534C,SN=0x534e,SO=0x534F, + SP=0x5350,SR=0x5352,ST=0x5354,SX=0x5358,SY=0x5359,SZ=0x535A, + TA=0x5441,UO=0x554F}; enum Role {Invalid=0,Cmd=1,Reply=2}; RDMacro(); RDMacro::Role role() const; diff --git a/rdairplay/Makefile.am b/rdairplay/Makefile.am index ebc76fa5..0f498008 100644 --- a/rdairplay/Makefile.am +++ b/rdairplay/Makefile.am @@ -2,7 +2,7 @@ ## ## Automake.am for rivendell/rdairplay ## -## (C) 2002-2023 Fred Gleason +## (C) 2002-2024 Fred Gleason ## ## 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 @@ -20,7 +20,7 @@ ## ## 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 MOC = @QT_MOC@ @@ -48,6 +48,7 @@ dist_rdairplay_SOURCES = button_log.cpp button_log.h\ local_macros.cpp colors.h\ loglinebox.cpp loglinebox.h\ logtableview.cpp logtableview.h\ + messagewidget.cpp messagewidget.h\ mode_display.cpp mode_display.h\ pie_counter.cpp pie_counter.h\ post_counter.cpp post_counter.h\ @@ -68,6 +69,7 @@ nodist_rdairplay_SOURCES = moc_button_log.cpp\ moc_list_logs.cpp\ moc_loglinebox.cpp\ moc_logtableview.cpp\ + moc_messagewidget.cpp\ moc_mode_display.cpp\ moc_pie_counter.cpp\ moc_post_counter.cpp\ @@ -80,7 +82,7 @@ nodist_rdairplay_SOURCES = moc_button_log.cpp\ moc_voicetracker.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 EXTRA_DIST = rdairplay.pro\ diff --git a/rdairplay/local_macros.cpp b/rdairplay/local_macros.cpp index d7ad8a92..8679734b 100644 --- a/rdairplay/local_macros.cpp +++ b/rdairplay/local_macros.cpp @@ -2,7 +2,7 @@ // // Local RML Macros for the Rivendell's RDAirPlay // -// (C) Copyright 2002-2022 Fred Gleason +// (C) Copyright 2002-2024 Fred Gleason // // 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 @@ -58,13 +58,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml) str+=(rml->arg(i)+" "); } str+=rml->arg(rml->argQuantity()-1); - pal=air_top_strip->messageWidget()->palette(); - 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); + air_top_strip->messageWidget()->setText(str,QColor(Qt::black)); } if(rml->echoRequested()) { rml->acknowledge(true); @@ -85,12 +79,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml) str+=(rml->arg(i)+" "); } str+=rml->arg(rml->argQuantity()-1); - pal=air_top_strip->messageWidget()->palette(); - 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); + air_top_strip->messageWidget()->setText(str,color); } if(rml->echoRequested()) { rml->acknowledge(true); @@ -98,6 +87,22 @@ void MainWidget::RunLocalMacros(RDMacro *rml) } 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 if((rml->argQuantity()<1)||(rml->argQuantity()>3)) { 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) +// +// 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;isetWordWrap(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) +// +// 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 +#include + +#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 diff --git a/rdairplay/rdairplay.cpp b/rdairplay/rdairplay.cpp index 16db170d..1a281950 100644 --- a/rdairplay/rdairplay.cpp +++ b/rdairplay/rdairplay.cpp @@ -2,7 +2,7 @@ // // The On Air Playout Utility for Rivendell. // -// (C) Copyright 2002-2023 Fred Gleason +// (C) Copyright 2002-2024 Fred Gleason // // 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 @@ -134,15 +134,6 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent) // srandom(QTime::currentTime().msec()); - // - // Generate Fonts - // - for(unsigned i=0;i +// (C) Copyright 2002-2024 Fred Gleason // // 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 @@ -42,11 +42,9 @@ #define AIR_LOG_PORTS 2 #define AIR_PANEL_PORTS 1 #define AIR_TOTAL_PORTS 3 -#define AIR_MESSAGE_FONT_QUANTITY 8 #define AIR_CHANNEL_LOCKOUT_INTERVAL 1000 #define METER_INTERVAL 20 #define MASTER_TIMER_INTERVAL 100 -#define MESSAGE_WIDGET_WIDTH 410 #define RDAIRPLAY_USAGE "[OPTIONS]\n" class MainWidget : public RDMainWindow @@ -99,7 +97,6 @@ class MainWidget : public RDMainWindow void SetLiveAssistMode(int mach); void SetActionMode(StartButton::Mode mode); 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 achan); int AudioChannel(int card,int port) const; @@ -150,8 +147,6 @@ class MainWidget : public RDMainWindow RDAirPlayConf::ExitCode rdairplay_previous_exit_code; QDateTime air_startup_datetime; 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_start_gpi_matrices[RDAirPlayConf::LastChannel]; int air_start_gpi_lines[RDAirPlayConf::LastChannel]; diff --git a/rdairplay/topstrip.cpp b/rdairplay/topstrip.cpp index 3af1d577..528bed25 100644 --- a/rdairplay/topstrip.cpp +++ b/rdairplay/topstrip.cpp @@ -2,7 +2,7 @@ // // Top row of indicator widgets for rdairplay(1) // -// (C) Copyright 2021 Fred Gleason +// (C) Copyright 2021-2024 Fred Gleason // // 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 @@ -18,6 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // +#include + #include #include @@ -45,18 +47,10 @@ TopStrip::TopStrip(QWidget *parent) // Audio Meters // d_meter_widget=new RDMeterStrip(this); - // - // Message Display + // Message Widget // - d_message_widget=new QLabel(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); + d_message_widget=new MessageWidget(this); // // Logo @@ -114,7 +108,7 @@ RDMeterStrip *TopStrip::meterWidget() } -QLabel *TopStrip::messageWidget() const +MessageWidget *TopStrip::messageWidget() const { return d_message_widget; } @@ -131,6 +125,8 @@ void TopStrip::setOnairFlag(bool state) void TopStrip::resizeEvent(QResizeEvent *e) { + int w=size().width(); + d_wall_clock_widget->setGeometry(10,5, d_wall_clock_widget->sizeHint().width(), 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_meter_widget->geometry().width(), - 5, - size().width()-(30+d_meter_widget->geometry().x()+d_meter_widget->geometry().width()+RD_RDAIRPLAY_LOGO_WIDTH), - 125); - d_logo->setGeometry(size().width()-RD_RDAIRPLAY_LOGO_WIDTH-10, + 5, + w-(30+d_meter_widget->geometry().x()+d_meter_widget->geometry().width()+RD_RDAIRPLAY_LOGO_WIDTH), + 125); + d_logo->setGeometry(w-RD_RDAIRPLAY_LOGO_WIDTH-10, 5, RD_RDAIRPLAY_LOGO_WIDTH, RD_RDAIRPLAY_LOGO_HEIGHT); diff --git a/rdairplay/topstrip.h b/rdairplay/topstrip.h index 4e86d1f4..a39362eb 100644 --- a/rdairplay/topstrip.h +++ b/rdairplay/topstrip.h @@ -2,7 +2,7 @@ // // Top row of indicator widgets for rdairplay(1) // -// (C) Copyright 2021 Fred Gleason +// (C) Copyright 2021-2024 Fred Gleason // // 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 @@ -22,10 +22,12 @@ #define TOPSTRIP_H #include +#include #include #include +#include "messagewidget.h" #include "mode_display.h" #include "wall_clock.h" @@ -40,8 +42,7 @@ class TopStrip : public RDWidget WallClock *wallClockWidget() const; ModeDisplay *modeDisplayWidget() const; RDMeterStrip *meterWidget(); - QLabel *messageWidget() const; - + MessageWidget *messageWidget() const; public slots: void setOnairFlag(bool state); @@ -50,10 +51,11 @@ class TopStrip : public RDWidget void paintEvent(QPaintEvent *e); private: + // QFont MessageFont(QString str) const; WallClock *d_wall_clock_widget; ModeDisplay *d_mode_display_widget; RDMeterStrip *d_meter_widget; - QLabel *d_message_widget; + MessageWidget *d_message_widget; QLabel *d_logo; bool d_onair_flag; };