mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-19 06:32:34 +02:00
2024-02-09 Fred Gleason <fredg@paravelsystems.com>
* Added a 'RDEventFilter' class. * Fixed bugs in rdairplay(1) that caused scroll bars to appear when loading web content into the message widget. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
bfa31221f5
commit
a14b878973
@ -24654,3 +24654,7 @@
|
||||
system was configured to use 12 hour time format.
|
||||
2024-02-08 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Implemented the 'Load Message" ['LM'] RML.
|
||||
2024-02-09 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a 'RDEventFilter' class.
|
||||
* Fixed bugs in rdairplay(1) that caused scroll bars to appear when
|
||||
loading web content into the message widget.
|
||||
|
@ -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 Qt5WebKit,,[AC_MSG_ERROR([*** Qt5 not found ***])])
|
||||
PKG_CHECK_MODULES(QT5,Qt5Core Qt5Widgets Qt5Gui Qt5Network Qt5Sql Qt5Xml Qt5WebKitWidgets,,[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)
|
||||
|
@ -132,6 +132,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
rdevent.cpp rdevent.h\
|
||||
rdevent_line.cpp rdevent_line.h\
|
||||
rdevent_player.cpp rdevent_player.h\
|
||||
rdeventfilter.cpp rdeventfilter.h\
|
||||
rdeventimportlist.cpp rdeventimportlist.h\
|
||||
rdexport_settings_dialog.cpp rdexport_settings_dialog.h\
|
||||
rdfeed.cpp rdfeed.h\
|
||||
@ -344,6 +345,7 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
|
||||
moc_rdemptycart.cpp\
|
||||
moc_rdendpointlistmodel.cpp\
|
||||
moc_rdevent_player.cpp\
|
||||
moc_rdeventfilter.cpp\
|
||||
moc_rdexport_settings_dialog.cpp\
|
||||
moc_rdfeed.cpp\
|
||||
moc_rdfeedlistmodel.cpp\
|
||||
|
@ -102,6 +102,7 @@ SOURCES += rdescape_string.cpp
|
||||
SOURCES += rdevent.cpp
|
||||
SOURCES += rdevent_line.cpp
|
||||
SOURCES += rdeventimportlist.cpp
|
||||
SOURCES += rdeventfilter.cpp
|
||||
SOURCES += rdexport_settings_dialog.cpp
|
||||
SOURCES += rdfeedlistmodel.cpp
|
||||
SOURCES += rdfontengine.cpp
|
||||
@ -292,6 +293,7 @@ HEADERS += rdendpointlistmodel.h
|
||||
HEADERS += rdescape_string.h
|
||||
HEADERS += rdevent.h
|
||||
HEADERS += rdevent_line.h
|
||||
HEADERS += rdeventfilter.h
|
||||
HEADERS += rdeventimportlist.h
|
||||
HEADERS += rdexport_settings_dialog.h
|
||||
HEADERS += rdfeedlistmodel.h
|
||||
|
59
lib/rdeventfilter.cpp
Normal file
59
lib/rdeventfilter.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
// rdeventfilter.cpp
|
||||
//
|
||||
// Filter one or more window system events
|
||||
//
|
||||
// (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 <QKeyEvent>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "rdeventfilter.h"
|
||||
|
||||
RDEventFilter::RDEventFilter(QObject *parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QList<QEvent::Type> RDEventFilter::filterList() const
|
||||
{
|
||||
return d_filter_types;
|
||||
}
|
||||
|
||||
|
||||
void RDEventFilter::addFilter(QEvent::Type type)
|
||||
{
|
||||
if(!d_filter_types.contains(type)) {
|
||||
d_filter_types.push_back(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RDEventFilter::removeFilter(QEvent::Type type)
|
||||
{
|
||||
d_filter_types.removeAll(type);
|
||||
}
|
||||
|
||||
|
||||
bool RDEventFilter::eventFilter(QObject *obj,QEvent *e)
|
||||
{
|
||||
if(d_filter_types.contains(e->type())) {
|
||||
// Block it
|
||||
return true;
|
||||
}
|
||||
return QObject::eventFilter(obj,e);
|
||||
}
|
40
lib/rdeventfilter.h
Normal file
40
lib/rdeventfilter.h
Normal file
@ -0,0 +1,40 @@
|
||||
// rdeventfilter.h
|
||||
//
|
||||
// Filter one or more window system events
|
||||
//
|
||||
// (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 RDEVENTFILTER_H
|
||||
#define RDEVENTFILTER_H
|
||||
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
|
||||
class RDEventFilter : public QObject
|
||||
{
|
||||
public:
|
||||
RDEventFilter(QObject *parent);
|
||||
QList<QEvent::Type> filterList() const;
|
||||
void addFilter(QEvent::Type type);
|
||||
void removeFilter(QEvent::Type type);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj,QEvent *e) override;
|
||||
QList<QEvent::Type> d_filter_types;
|
||||
};
|
||||
|
||||
#endif // RDEVENTFILTER_H
|
@ -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@ -I/usr/include/qt5/QtWebKitWidgets @MUSICBRAINZ_CFLAGS@ @IMAGEMAGICK_CFLAGS@
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib -Wno-strict-aliasing -std=c++11 -fPIC @QT5_CFLAGS@ @MUSICBRAINZ_CFLAGS@ @IMAGEMAGICK_CFLAGS@
|
||||
LIBS = -L$(top_srcdir)/lib
|
||||
MOC = @QT_MOC@
|
||||
|
||||
@ -82,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@ -lQt5WebKitWidgets
|
||||
rdairplay_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT5_LIBS@ @MUSICBRAINZ_LIBS@ @IMAGEMAGICK_LIBS@
|
||||
rdairplay_LDFLAGS = -rdynamic
|
||||
|
||||
EXTRA_DIST = rdairplay.pro\
|
||||
|
@ -18,6 +18,12 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <QEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QWebFrame>
|
||||
|
||||
#include <rdeventfilter.h>
|
||||
|
||||
#include "colors.h"
|
||||
#include "messagewidget.h"
|
||||
|
||||
@ -43,7 +49,20 @@ MessageWidget::MessageWidget(QWidget *parent)
|
||||
d_label->setWordWrap(true);
|
||||
d_label->setAlignment(Qt::AlignCenter);
|
||||
d_view=new QWebView(this);
|
||||
connect(d_view,SIGNAL(loadFinished(bool)),
|
||||
this,SLOT(webLoadFinishedData(bool)));
|
||||
d_view->hide();
|
||||
RDEventFilter *filter=new RDEventFilter(this);
|
||||
filter->addFilter(QEvent::Enter);
|
||||
filter->addFilter(QEvent::Leave);
|
||||
filter->addFilter(QEvent::KeyPress);
|
||||
filter->addFilter(QEvent::KeyRelease);
|
||||
filter->addFilter(QEvent::MouseButtonPress);
|
||||
filter->addFilter(QEvent::MouseButtonRelease);
|
||||
filter->addFilter(QEvent::MouseButtonDblClick);
|
||||
filter->addFilter(QEvent::MouseMove);
|
||||
filter->addFilter(QEvent::Wheel);
|
||||
d_view->installEventFilter(filter);
|
||||
}
|
||||
|
||||
|
||||
@ -91,6 +110,15 @@ void MessageWidget::clear()
|
||||
}
|
||||
|
||||
|
||||
void MessageWidget::webLoadFinishedData(bool state)
|
||||
{
|
||||
d_view->page()->mainFrame()->
|
||||
setScrollBarPolicy(Qt::Horizontal,Qt::ScrollBarAlwaysOff);
|
||||
d_view->page()->mainFrame()->
|
||||
setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff);
|
||||
}
|
||||
|
||||
|
||||
void MessageWidget::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
d_label->setGeometry(0,0,size().width(),size().height());
|
||||
|
@ -36,6 +36,9 @@ class MessageWidget : public QWidget
|
||||
bool setUrl(const QString &url);
|
||||
void clear();
|
||||
|
||||
private slots:
|
||||
void webLoadFinishedData(bool state);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user