mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Meter widget on linux (#3454)
Enable Meter Widgets overlaid on Video Window for Linux Meter Widgets, with a transparent background over the video window, use little screen estate while providing all the needed information. They were added for WIN32 first but actually work fine on Linux with minor flag adjustments.
This commit is contained in:
@@ -25,11 +25,16 @@
|
||||
MeterWidget::MeterWidget(QString Name, QWidget *parent, QString Source) : QWidget(parent), m_Name(Name), m_container(parent), m_Source(Source)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
#else
|
||||
setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
|
||||
setAttribute(Qt::WA_NoSystemBackground);
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
setAttribute(Qt::WA_PaintOnScreen);
|
||||
#endif
|
||||
|
||||
setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
|
||||
@@ -86,30 +86,23 @@ VideoWindow::VideoWindow(Context *context) :
|
||||
|
||||
//vlc_exceptions(&exceptions);
|
||||
|
||||
|
||||
/* This is a non working code that show how to hooks into a window,
|
||||
* if we have a window around */
|
||||
#ifdef Q_OS_LINUX
|
||||
#if QT_VERSION > 0x50000
|
||||
x11Container = new QWidget(this); //XXX PORT TO 5.1 BROKEN CODE XXX
|
||||
#if (defined Q_OS_LINUX) && QT_VERSION <= 0x50000
|
||||
container = new QX11EmbedContainer(this);
|
||||
#else
|
||||
x11Container = new QX11EmbedContainer(this);
|
||||
#endif
|
||||
layout->addWidget(x11Container);
|
||||
libvlc_media_player_set_xwindow (mp, x11Container->winId());
|
||||
container = new QWidget(this);
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
container = new QWidget(this);
|
||||
layout->addWidget(container);
|
||||
libvlc_media_player_set_nsobject (mp, (void*)(container->winId()));
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
container = new QWidget(this);
|
||||
layout->addWidget(container);
|
||||
#if defined(WIN32)
|
||||
libvlc_media_player_set_hwnd (mp, (HWND)(container->winId()));
|
||||
#elif defined(Q_OS_MAC)
|
||||
libvlc_media_player_set_nsobject (mp, (void*)(container->winId()));
|
||||
#elif defined(Q_OS_LINUX)
|
||||
libvlc_media_player_set_xwindow (mp, container->winId());
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) || defined(Q_OS_LINUX)
|
||||
// Video Overlays Initialization: if video config file is not present
|
||||
// copy a default one to be used as a model by the user.
|
||||
// An empty video-layout.xml file disables video overlays
|
||||
@@ -179,7 +172,7 @@ VideoWindow::~VideoWindow()
|
||||
|
||||
#if (defined Q_OS_LINUX) && (QT_VERSION < 0x050000) && (defined GC_VIDEO_VLC)
|
||||
// unembed vlc backend first
|
||||
x11Container->discardClient();
|
||||
container->discardClient();
|
||||
#endif
|
||||
|
||||
stopPlayback();
|
||||
|
||||
@@ -209,16 +209,10 @@ class VideoWindow : public GcChartWindow
|
||||
QMediaPlayer *mp;
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#if QT_VERSION > 0x050000
|
||||
QWidget *x11Container;
|
||||
#else
|
||||
QX11EmbedContainer *x11Container;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) || defined (Q_OS_MAC)
|
||||
#if defined(WIN32) || defined (Q_OS_MAC) || (defined(Q_OS_LINUX) && QT_VERSION > 0x050000)
|
||||
QWidget *container;
|
||||
#elif defined(Q_OS_LINUX)
|
||||
QX11EmbedContainer *container;
|
||||
#endif
|
||||
|
||||
bool init; // we initialised ok ?
|
||||
|
||||
Reference in New Issue
Block a user