From 68ee6a0ec973940eb4f799b00f6518a902cbc4e5 Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 26 Aug 2018 20:35:23 +0200 Subject: Implement custom Video player Well, well, well. Due to several unforseen circumstances I ventured into the sources again and implemented a Video player with Qt. Looks very promising so far. There are some bugs to weed out, but I'm getting there... --- smglobals.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'smglobals.cpp') diff --git a/smglobals.cpp b/smglobals.cpp index 7a909b6..278772e 100644 --- a/smglobals.cpp +++ b/smglobals.cpp @@ -13,6 +13,7 @@ #include "mappingtablemodel.h" #include "mappingtreemodel.h" #include "pictureviewer2.h" +#include "videoviewer.h" #include "picfilesmodel.h" #include "configurationdialog.h" #include "archivebrowsermodel.h" @@ -24,9 +25,12 @@ SmGlobals *SmGlobals::mInstance = nullptr; SmGlobals::~SmGlobals(){ - foreach(QAbstractItemModel *model, mModels.values()){ + for(QAbstractItemModel *model : mModels.values()){ model->deleteLater(); } + for(QWidget *w : mWidgets){ + w->close(); + } } SmGlobals *SmGlobals::instance(){ @@ -99,6 +103,14 @@ PictureViewer2 *SmGlobals::pictureViewer() { return mPictureViewer; } +VideoViewer *SmGlobals::videoViewer() { + if(!mVideoViewer){ + mVideoViewer = new VideoViewer; + mVideoViewer->setHidden(true); + } + return mVideoViewer; +} + QSize SmGlobals::cursorSize() { if(!mCursorSize.isValid()){ Display *dpy = XOpenDisplay(nullptr); @@ -117,7 +129,7 @@ QIcon SmGlobals::iconFor(const QString &type){ return retval; } -SmGlobals::SmGlobals() : mPictureViewer(nullptr), mArchiveController(nullptr){ +SmGlobals::SmGlobals() : mPictureViewer(nullptr), mVideoViewer(nullptr), mArchiveController(nullptr){ mIcons.insert("Dildo", ":/dildo.png"); mIcons.insert("Dick to left", ":/back_dick.png"); mIcons.insert("Dick pointing up", ":/up_dick.png"); @@ -158,14 +170,6 @@ SmGlobals::SmGlobals() : mPictureViewer(nullptr), mArchiveController(nullptr){ mReencReasons = s.value("ui/reasons").toStringList(); } -void SmGlobals::registerWidget(const QString &name, QWidget *w){ - mWidgets.insert(name, w); -} - -QWidget *SmGlobals::getRegisteredWidget(const QString &name){ - return mWidgets.value(name); -} - void SmGlobals::setReencReasons(const QStringList reasons){ mReencReasons = reasons; std::sort(mReencReasons.begin(), mReencReasons.end()); -- cgit v1.2.3-70-g09d2