diff --git a/Pdf4QtViewer/pdfmediaviewerdialog.cpp b/Pdf4QtViewer/pdfmediaviewerdialog.cpp
new file mode 100644
index 0000000..b811da5
--- /dev/null
+++ b/Pdf4QtViewer/pdfmediaviewerdialog.cpp
@@ -0,0 +1,164 @@
+// Copyright (C) 2022 Jakub Melka
+//
+// This file is part of PDF4QT.
+//
+// PDF4QT is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// with the written consent of the copyright owner, any later version.
+//
+// PDF4QT 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 Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with PDF4QT. If not, see .
+
+#include "pdfmediaviewerdialog.h"
+#include "ui_pdfmediaviewerdialog.h"
+#include "pdfwidgetutils.h"
+#include "pdfdbgheap.h"
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace pdfviewer
+{
+
+PDFMediaViewerDialog::PDFMediaViewerDialog(QWidget* parent) :
+ QDialog(parent, Qt::Window | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
+ ui(new Ui::PDFMediaViewerDialog)
+{
+ ui->setupUi(this);
+
+ setAttribute(Qt::WA_DeleteOnClose);
+
+ m_3dWindow = new Qt3DExtras::Qt3DWindow(this->screen());
+ m_3dWindow->defaultFrameGraph()->setClearColor(Qt::white);
+
+ QWidget* container = QWidget::createWindowContainer(m_3dWindow, this);
+ container->setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(container, QSize(300, 300)));
+ ui->gridLayout->addWidget(container, 0, 0);
+
+ m_rootEntity = new Qt3DCore::QEntity();
+ m_3dWindow->setRootEntity(m_rootEntity);
+ m_sceneEntity = new Qt3DCore::QEntity(m_rootEntity);
+
+ Qt3DRender::QCamera* camera = m_3dWindow->camera();
+ Qt3DExtras::QOrbitCameraController* cameraController = new Qt3DExtras::QOrbitCameraController(m_rootEntity);
+ cameraController->setCamera(camera);
+}
+
+PDFMediaViewerDialog::~PDFMediaViewerDialog()
+{
+ delete ui;
+ delete m_rootEntity;
+}
+
+void PDFMediaViewerDialog::initDemo()
+{
+ // Setup camera
+ Qt3DRender::QCamera* camera = m_3dWindow->camera();
+ camera->lens()->setPerspectiveProjection(25.0f, 16.0f / 9.0f, 0.001f, 1000.0f);
+ camera->setUpVector(QVector3D(0.0f, -1.0f, 0.0f));
+ camera->setPosition(QVector3D(-20.0f, 0.0f, 0.0f));
+ camera->setViewCenter(QVector3D(0.0f, 0.0f, 0.0f));
+
+ // Sphere
+ Qt3DExtras::QSphereMesh* sphere = new Qt3DExtras::QSphereMesh();
+ sphere->setRadius(2.0);
+ sphere->setRings(60);
+ sphere->setSlices(30);
+
+ Qt3DCore::QTransform* sphereTransform = new Qt3DCore::QTransform();
+ sphereTransform->setTranslation(QVector3D(2.0f, 0.0f, 3.00f));
+
+ Qt3DExtras::QPhongMaterial* sphereMaterial = new Qt3DExtras::QPhongMaterial();
+ sphereMaterial->setDiffuse(Qt::green);
+
+ Qt3DCore::QEntity* sphereEntity = new Qt3DCore::QEntity(m_sceneEntity);
+ sphereEntity->addComponent(sphere);
+ sphereEntity->addComponent(sphereTransform);
+ sphereEntity->addComponent(sphereMaterial);
+
+ // Torus
+ Qt3DExtras::QTorusMesh* torus = new Qt3DExtras::QTorusMesh();
+ torus->setRadius(2.0);
+ torus->setMinorRadius(0.5);
+ torus->setRings(120);
+ torus->setSlices(25);
+
+ Qt3DCore::QTransform* torusTransform = new Qt3DCore::QTransform();
+ torusTransform->setScale(1.74f);
+ torusTransform->setRotationY(25);
+ torusTransform->setTranslation(QVector3D(0.5f, 0.7f, 0.03f));
+
+ Qt3DExtras::QPhongMaterial* torusMaterial = new Qt3DExtras::QPhongMaterial();
+ torusMaterial->setDiffuse(Qt::blue);
+
+ Qt3DCore::QEntity* torusEntity = new Qt3DCore::QEntity(m_sceneEntity);
+ torusEntity->addComponent(torus);
+ torusEntity->addComponent(torusTransform);
+ torusEntity->addComponent(torusMaterial);
+
+ // Cuboid
+ Qt3DExtras::QCuboidMesh* cuboid = new Qt3DExtras::QCuboidMesh();
+ cuboid->setXExtent(1.37f);
+ cuboid->setYExtent(1.74f);
+ cuboid->setZExtent(2.0f);
+
+ Qt3DCore::QTransform* cuboidTransform = new Qt3DCore::QTransform();
+ cuboidTransform->setTranslation(QVector3D(0.0f, 7.0f, 0.00f));
+
+ Qt3DExtras::QPhongMaterial* cuboidMaterial = new Qt3DExtras::QPhongMaterial();
+ cuboidMaterial->setDiffuse(Qt::red);
+
+ Qt3DCore::QEntity* cuboidEntity = new Qt3DCore::QEntity(m_sceneEntity);
+ cuboidEntity->addComponent(cuboid);
+ cuboidEntity->addComponent(cuboidTransform);
+ cuboidEntity->addComponent(cuboidMaterial);
+
+ // Cylinder
+ Qt3DExtras::QCylinderMesh* cylinder = new Qt3DExtras::QCylinderMesh();
+ cylinder->setRadius(2.0);
+ cylinder->setLength(6.0);
+ cylinder->setRings(120);
+ cylinder->setSlices(25);
+
+ Qt3DCore::QTransform* cylinderTransform = new Qt3DCore::QTransform();
+ cylinderTransform->setTranslation(QVector3D(0.0f, -7.0f, 0.00f));
+
+ Qt3DExtras::QPhongMaterial* cylinderMaterial = new Qt3DExtras::QPhongMaterial();
+ cylinderMaterial->setDiffuse(Qt::yellow);
+
+ Qt3DCore::QEntity* cylinderEntity = new Qt3DCore::QEntity(m_sceneEntity);
+ cylinderEntity->addComponent(cylinder);
+ cylinderEntity->addComponent(cylinderTransform);
+ cylinderEntity->addComponent(cylinderMaterial);
+
+ // Light
+ Qt3DCore::QEntity* lightEntity = new Qt3DCore::QEntity(m_sceneEntity);
+ Qt3DRender::QPointLight* light = new Qt3DRender::QPointLight(lightEntity);
+ light->setColor(Qt::white);
+ light->setIntensity(1.0);
+ lightEntity->addComponent(light);
+
+ Qt3DCore::QTransform* lightTransform = new Qt3DCore::QTransform(lightEntity);
+ lightTransform->setTranslation(QVector3D(10.0f, 10.0f, 10.0f));
+ lightEntity->addComponent(lightTransform);
+}
+
+} // namespace pdfviewer
diff --git a/Pdf4QtViewer/pdfmediaviewerdialog.h b/Pdf4QtViewer/pdfmediaviewerdialog.h
new file mode 100644
index 0000000..7b3f412
--- /dev/null
+++ b/Pdf4QtViewer/pdfmediaviewerdialog.h
@@ -0,0 +1,60 @@
+// Copyright (C) 2022 Jakub Melka
+//
+// This file is part of PDF4QT.
+//
+// PDF4QT is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// with the written consent of the copyright owner, any later version.
+//
+// PDF4QT 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 Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with PDF4QT. If not, see .
+
+#ifndef PDFMEDIAVIEWERDIALOG_H
+#define PDFMEDIAVIEWERDIALOG_H
+
+#include
+
+namespace Qt3DCore
+{
+class QEntity;
+}
+
+namespace Qt3DExtras
+{
+class Qt3DWindow;
+}
+
+namespace Ui
+{
+class PDFMediaViewerDialog;
+}
+
+namespace pdfviewer
+{
+
+class PDFMediaViewerDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit PDFMediaViewerDialog(QWidget* parent);
+ virtual ~PDFMediaViewerDialog() override;
+
+ void initDemo();
+
+private:
+ Ui::PDFMediaViewerDialog* ui;
+ Qt3DExtras::Qt3DWindow* m_3dWindow = nullptr;
+ Qt3DCore::QEntity* m_rootEntity = nullptr;
+ Qt3DCore::QEntity* m_sceneEntity = nullptr;
+};
+
+} // namespace pdfviewer
+
+#endif // PDFMEDIAVIEWERDIALOG_H
diff --git a/Pdf4QtViewer/pdfmediaviewerdialog.ui b/Pdf4QtViewer/pdfmediaviewerdialog.ui
new file mode 100644
index 0000000..9613439
--- /dev/null
+++ b/Pdf4QtViewer/pdfmediaviewerdialog.ui
@@ -0,0 +1,71 @@
+
+
+ PDFMediaViewerDialog
+
+
+
+ 0
+ 0
+ 761
+ 580
+
+
+
+ Media Viewer
+
+
+ -
+
+
+ GroupBox
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ PDFMediaViewerDialog
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ PDFMediaViewerDialog
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/Pdf4QtViewer/pdfprogramcontroller.cpp b/Pdf4QtViewer/pdfprogramcontroller.cpp
index 7e66eb8..1562448 100644
--- a/Pdf4QtViewer/pdfprogramcontroller.cpp
+++ b/Pdf4QtViewer/pdfprogramcontroller.cpp
@@ -40,6 +40,7 @@
#include "pdfrecentfilemanager.h"
#include "pdftexttospeech.h"
#include "pdfencryptionsettingsdialog.h"
+#include "pdfmediaviewerdialog.h"
#include
#include
@@ -526,6 +527,10 @@ void PDFProgramController::initialize(Features features,
{
connect(action, &QAction::triggered, this, &PDFProgramController::onActionDeveloperCreateInstaller);
}
+ if (QAction* action = m_actionManager->getAction(PDFActionManager::DeveloperShow3DWindowDemo))
+ {
+ connect(action, &QAction::triggered, this, &PDFProgramController::onActionDeveloperShow3DWindowDemo);
+ }
if (QAction* action = m_actionManager->getAction(PDFActionManager::GetSource))
{
connect(action, &QAction::triggered, this, &PDFProgramController::onActionGetSource);
@@ -2459,6 +2464,13 @@ void PDFProgramController::onActionDeveloperCreateInstaller()
}
}
+void PDFProgramController::onActionDeveloperShow3DWindowDemo()
+{
+ PDFMediaViewerDialog* dialog = new PDFMediaViewerDialog(getMainWindow());
+ dialog->initDemo();
+ dialog->open();
+}
+
void PDFProgramController::onActionGetSource()
{
QDesktopServices::openUrl(QUrl("https://github.com/JakubMelka/PDF4QT"));
diff --git a/Pdf4QtViewer/pdfprogramcontroller.h b/Pdf4QtViewer/pdfprogramcontroller.h
index 4a3fbdf..e9cd476 100644
--- a/Pdf4QtViewer/pdfprogramcontroller.h
+++ b/Pdf4QtViewer/pdfprogramcontroller.h
@@ -172,6 +172,7 @@ public:
ToolScreenshot,
ToolExtractImage,
DeveloperCreateInstaller,
+ DeveloperShow3DWindowDemo,
LastAction
};
@@ -353,6 +354,7 @@ private:
void onActionOpenTriggered();
void onActionCloseTriggered();
void onActionDeveloperCreateInstaller();
+ void onActionDeveloperShow3DWindowDemo();
void onActionGetSource();
void onActionBecomeSponsor();
void onActionAutomaticDocumentRefresh();
diff --git a/Pdf4QtViewer/pdfviewermainwindow.cpp b/Pdf4QtViewer/pdfviewermainwindow.cpp
index 16b0fe4..22ac6d6 100644
--- a/Pdf4QtViewer/pdfviewermainwindow.cpp
+++ b/Pdf4QtViewer/pdfviewermainwindow.cpp
@@ -180,6 +180,7 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
m_actionManager->setAction(PDFActionManager::ToolScreenshot, ui->actionScreenshot);
m_actionManager->setAction(PDFActionManager::ToolExtractImage, ui->actionExtractImage);
m_actionManager->setAction(PDFActionManager::DeveloperCreateInstaller, ui->actionDeveloperCreateInstaller);
+ m_actionManager->setAction(PDFActionManager::DeveloperShow3DWindowDemo, ui->actionDeveloperShow3DWindowDemo);
m_actionManager->initActions(pdf::PDFWidgetUtils::scaleDPI(this, QSize(24, 24)), true);
for (QAction* action : m_programController->getRecentFileManager()->getActions())
diff --git a/Pdf4QtViewer/pdfviewermainwindow.ui b/Pdf4QtViewer/pdfviewermainwindow.ui
index f1a0959..eae2d28 100644
--- a/Pdf4QtViewer/pdfviewermainwindow.ui
+++ b/Pdf4QtViewer/pdfviewermainwindow.ui
@@ -123,6 +123,7 @@
+