aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-09-26 14:04:24 -0400
committerKen Moore <ken@ixsystems.com>2017-09-26 14:04:24 -0400
commita8ab0934e4782a14206cba544c846a34947cce36 (patch)
treef032428eca9b7938b43b6f06f67da554d0faf2b0 /src-qt5/desktop-utils
parentFix up the close event handling in lumina-textedit. Now it will actually clos... (diff)
parentMerge branch 'master' of github.com:trueos/lumina (diff)
downloadlumina-a8ab0934e4782a14206cba544c846a34947cce36.tar.gz
lumina-a8ab0934e4782a14206cba544c846a34947cce36.tar.bz2
lumina-a8ab0934e4782a14206cba544c846a34947cce36.zip
Merge branch 'master' of github.com:trueos/lumina
Diffstat (limited to 'src-qt5/desktop-utils')
-rw-r--r--src-qt5/desktop-utils/lumina-fm/widgets/fmwebdav.cpp36
-rw-r--r--src-qt5/desktop-utils/lumina-fm/widgets/fmwebdav.h36
-rw-r--r--src-qt5/desktop-utils/lumina-fm/widgets/vidnail.cpp33
-rw-r--r--src-qt5/desktop-utils/lumina-fm/widgets/vidnail.h25
4 files changed, 130 insertions, 0 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/fmwebdav.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/fmwebdav.cpp
new file mode 100644
index 00000000..6e65ebaf
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-fm/widgets/fmwebdav.cpp
@@ -0,0 +1,36 @@
+#include "fmwebdav.h"
+
+fmwebdav::fmwebdav(QObject *parent) : QNetworkAccessManager(parent) ,wdRootPath(), wdUsername(), wdUassword(), wdBaseUrl(), wdCurrentConnectionType(QWebdav::HTTP){
+// typical Qnetwork connection stuff goes here
+// probably ssl parts too
+}
+
+fmwebdav::~fmwebdav(){
+}
+
+QString fmwebdav::hostname() const{ return wdBaseUrl.host(); }
+
+int fmwebdav::port() const{ return wdBaseUrl.port(); }
+
+QString fmwebdav::rootPath() const{ return wdRootPath;}
+
+QString fmwebdav::username() const{ return wdUsername; }
+
+QString fmwebdav::password() const{ return wdPassword; }
+
+fmwebdav::QWebdavConnectionType : fmwebdav::connectionType() const{ return wdCurrentConnectionType; }
+
+bool fmwebdav::isSSL() const{ return (wdCurrentConnectionType==QWebdav::HTTPS); }
+
+void QWebdav::setConnectionSettings(const QWebdavConnectionType connectionType, const QString *hostname, const QString *rootPath, const QString *username, const QString *password, int *port){
+ wdRootPath = rootPath;
+ if ((wdRootPath.endsWith("/")){ wdRootPath.chop(1); }
+ wdCurrentConnectionType = connectionType;
+ wdBaseUrl.setScheme();
+ wdBaseUrl.setHost(hostname);
+ wdBaseUrl.setPath(rootPath);
+ if (port != 0) { // use user-defined port number if not 80 or 443
+ if ( ! ( ( (port == 80) && (wdCurrentConnectionType==QWebdav::HTTP) ) || ( (port == 443) && (wdCurrentConnectionType==QWebdav::HTTPS) ) ) ){ wdBaseUrl.setPort(port); }
+ wdUsername = username;
+ wdPassword = password;
+}
diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/fmwebdav.h b/src-qt5/desktop-utils/lumina-fm/widgets/fmwebdav.h
new file mode 100644
index 00000000..04d29e3b
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-fm/widgets/fmwebdav.h
@@ -0,0 +1,36 @@
+#ifndef FMWEBDAV_H
+#define FMWEBDAV_H
+
+#include <QtCore>
+#include <QtNetwork>
+#include <QNetworkAccessManager>
+
+public:
+
+ enum QWebdavConnectionType {HTTP = 1, HTTPS};
+
+ QString hostname() const;
+ int port() const;
+ QString rootPath() const;
+ QString username() const;
+ QString password() const;
+ QWebdavConnectionType connectionType() const;
+ bool isSSL() const;
+
+ void setConnectionSettings( const QWebdavConnectionType connectionType, const QString *hostname, const QString *rootPath = "/", const QString *username = "", const QString *password = "", int *port = 0;
+
+
+private:
+
+ QString wdRootPath;
+ QString wdUsername;
+ QString wdPassword;
+ QUrl wdBaseUrl;
+ QWebdavConnectionType wdCurrentConnectionType;
+
+
+
+
+
+
+#endif // FMWEBDAV
diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/vidnail.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/vidnail.cpp
new file mode 100644
index 00000000..ee7fb9e3
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-fm/widgets/vidnail.cpp
@@ -0,0 +1,33 @@
+#include "vidnail.h"
+vidnail::vidnail(QWidget *parent) : QMainWindow(parent), mplayer(parent, QMediaPlayer::VideoSurface){ //there is no UI, so not sure how to alter the constructor
+}
+
+vidnail::~vidnail()
+{
+
+vidnail::grabvideothumbnail(){
+ vsurface = new QAbstractVideoSurface();
+ mplayer.setVideoOutput(vsurface);
+ mplayer.setMedia($file); // video file to get thumbnail of
+ imageCaptured = QPixmap();
+ mplayer.setPosition(2000); // time in milliseconds
+ mplayer.setMuted(true); // just to make sure no sound is emited
+ mplayer.play();
+
+ currentFrame = frame;
+ const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
+ const QSize size = format.frameSize();
+
+ this->imageFormat = imageFormat;
+ QAbstractVideoSurface::start(format);
+ QImage image( currentFrame.bits(), currentFrame.width(), currentFrame.height(), currentFrame.bytesPerLine(), imageFormat);
+ imageCaptured = QPixmap::fromImage(image.copy(image.rect()));
+
+// Now do scaling with regular thumbnail process to make proper size
+
+ mplayer.stop();
+ vsurface.stop();
+}
+
+
+
diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/vidnail.h b/src-qt5/desktop-utils/lumina-fm/widgets/vidnail.h
new file mode 100644
index 00000000..ad565749
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-fm/widgets/vidnail.h
@@ -0,0 +1,25 @@
+#ifndef VIDNAIL_H
+#define VIDNAIL_H
+
+#include <QMediaPlayer>
+#include <QtMultimediaWidgets>
+#include "videowidgetsurface.h"
+#include <QPixmap>
+#include <QAbstractVideoSurface>
+#include <QImage>
+#include <QRect>
+#include <QVideoFrame>
+
+public:
+
+ void grabvideothumbnail();
+
+private:
+
+ QAbstractVideoSurface *vsurface;
+ QImage::Format imageFormat;
+ QPixmap imageCaptured;
+
+
+#endif // VIDNAIL_H
+
bgstack15