mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-25 13:38:34 -06:00
Draft with all controls added
This commit is contained in:
@@ -44,6 +44,9 @@ set(HEADER_FILES
|
||||
include/profile/propertiesdialog.h
|
||||
include/sgctedit/display.h
|
||||
include/sgctedit/monitorbox.h
|
||||
include/sgctedit/orientation.h
|
||||
include/sgctedit/orientationdialog.h
|
||||
include/sgctedit/projectiondialog.h
|
||||
include/sgctedit/windowcontrol.h
|
||||
)
|
||||
|
||||
@@ -68,6 +71,9 @@ set(SOURCE_FILES
|
||||
src/sgctedit/display.cpp
|
||||
src/sgctedit/main.cpp
|
||||
src/sgctedit/monitorbox.cpp
|
||||
src/sgctedit/orientation.cpp
|
||||
src/sgctedit/orientationdialog.cpp
|
||||
src/sgctedit/projectiondialog.cpp
|
||||
src/sgctedit/windowcontrol.cpp
|
||||
)
|
||||
|
||||
@@ -88,6 +94,9 @@ set(HEADER_SOURCE
|
||||
include/profile/propertiesdialog.h
|
||||
include/sgctedit/display.h
|
||||
include/sgctedit/monitorbox.h
|
||||
include/sgctedit/orientation.h
|
||||
include/sgctedit/orientationdialog.h
|
||||
include/sgctedit/projectiondialog.h
|
||||
include/sgctedit/windowcontrol.h
|
||||
)
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class Display : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Display();
|
||||
explicit Display(QHBoxLayout* parentLayout, QSize* monitorDims);
|
||||
~Display();
|
||||
|
||||
private slots:
|
||||
@@ -36,7 +36,7 @@ private slots:
|
||||
private:
|
||||
void addWindowControl();
|
||||
void removeWindowControl();
|
||||
void initializeLayout();
|
||||
void initializeLayout(QHBoxLayout* parentLayout);
|
||||
void hideSecondWindow();
|
||||
void showSecondWindow();
|
||||
unsigned int _monitorResolution[2] = {1920, 1080};
|
||||
@@ -45,8 +45,8 @@ private:
|
||||
std::vector<WindowControl*> _windowControl;
|
||||
unsigned int _nWindowsAllocated = 0;
|
||||
unsigned int _nWindowsDisplayed = 0;
|
||||
QPushButton* _toggleNumMonitorsButton = nullptr;
|
||||
MonitorBox* _monBox = nullptr;
|
||||
QPushButton* _toggleNumWindowsButton = nullptr;
|
||||
MonitorBox* _monBox;
|
||||
QVBoxLayout* _layout = nullptr;
|
||||
QHBoxLayout* _layoutMonBox = nullptr;
|
||||
QHBoxLayout* _layoutMonButton = nullptr;
|
||||
|
||||
@@ -20,12 +20,12 @@ class MonitorBox : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MonitorBox(QRect widgetDims, QRect monitorResolution,
|
||||
explicit MonitorBox(QRect widgetDims, QSize monitorResolution,
|
||||
QWidget *parent = nullptr);
|
||||
~MonitorBox();
|
||||
void mapMonitorResolutionToWidgetCoordinates(QRect r);
|
||||
void mapMonitorResolutionToWidgetCoordinates(QSize r);
|
||||
void mapWindowResolutionToWidgetCoordinates(unsigned int index, const QRectF& w);
|
||||
void setResolution(QRect& res);
|
||||
void setResolution(QSize& res);
|
||||
void setNumWindowsDisplayed(unsigned int nWindows);
|
||||
int numWindows();
|
||||
void windowDimensionsChanged(unsigned int index, const QRectF newDimensions);
|
||||
@@ -39,7 +39,7 @@ private:
|
||||
QLineEdit* _size_x = nullptr;
|
||||
QLineEdit* _size_y = nullptr;
|
||||
|
||||
QRect _monitorResolution;
|
||||
QSize _monitorResolution;
|
||||
QRectF _monitorDimensionsScaled;
|
||||
|
||||
std::vector<QRectF> _windowResolutions;
|
||||
|
||||
37
apps/OpenSpace/ext/launcher/include/sgctedit/orientation.h
Normal file
37
apps/OpenSpace/ext/launcher/include/sgctedit/orientation.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef ORIENTATION_H
|
||||
#define ORIENTATION_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QFrame>
|
||||
#include <QIntValidator>
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QPoint>
|
||||
#include <QPushButton>
|
||||
#include <QVector>
|
||||
#include <QWidget>
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
class Orientation : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Orientation(QVBoxLayout* parentLayout);
|
||||
~Orientation();
|
||||
|
||||
private slots:
|
||||
void orientationDialog();
|
||||
|
||||
private:
|
||||
QHBoxLayout* _layoutOrientationButton = nullptr;
|
||||
QPushButton* _orientationButton = nullptr;
|
||||
};
|
||||
|
||||
#endif // ORIENTATION_H
|
||||
@@ -0,0 +1,54 @@
|
||||
#ifndef ORIENTATION_DIALOG_H
|
||||
#define ORIENTATION_DIALOG_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialog>
|
||||
#include <QFrame>
|
||||
#include <QIntValidator>
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QPoint>
|
||||
#include <QPushButton>
|
||||
#include <QVector>
|
||||
#include <QWidget>
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
class OrientationDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OrientationDialog(QWidget* parent);
|
||||
~OrientationDialog();
|
||||
|
||||
private slots:
|
||||
|
||||
private:
|
||||
QVBoxLayout* _layoutWindow = nullptr;
|
||||
QHBoxLayout* _layoutPitch = nullptr;
|
||||
QHBoxLayout* _layoutRoll = nullptr;
|
||||
QHBoxLayout* _layoutYaw = nullptr;
|
||||
QHBoxLayout* _layoutButtonBox = nullptr;
|
||||
|
||||
QLabel* _labelPitch = nullptr;
|
||||
QLabel* _labelRoll = nullptr;
|
||||
QLabel* _labelYaw = nullptr;
|
||||
|
||||
QLineEdit* _linePitch = nullptr;
|
||||
QLineEdit* _lineRoll = nullptr;
|
||||
QLineEdit* _lineYaw = nullptr;
|
||||
QDoubleValidator* _validatorPitch = nullptr;
|
||||
QDoubleValidator* _validatorRoll = nullptr;
|
||||
QDoubleValidator* _validatorYaw = nullptr;
|
||||
|
||||
QPushButton* _buttonSave = nullptr;
|
||||
QPushButton* _buttonCancel = nullptr;
|
||||
};
|
||||
|
||||
#endif // ORIENTATION_DIALOG_H
|
||||
@@ -0,0 +1,54 @@
|
||||
#ifndef PROJECTION_DIALOG_H
|
||||
#define PROJECTION_DIALOG_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialog>
|
||||
#include <QFrame>
|
||||
#include <QIntValidator>
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QPoint>
|
||||
#include <QPushButton>
|
||||
#include <QVector>
|
||||
#include <QWidget>
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
class ProjectionDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ProjectionDialog(QWidget* parent);
|
||||
~ProjectionDialog();
|
||||
|
||||
private slots:
|
||||
|
||||
private:
|
||||
QVBoxLayout* _layoutWindow = nullptr;
|
||||
QHBoxLayout* _layoutPitch = nullptr;
|
||||
QHBoxLayout* _layoutRoll = nullptr;
|
||||
QHBoxLayout* _layoutYaw = nullptr;
|
||||
QHBoxLayout* _layoutButtonBox = nullptr;
|
||||
|
||||
QLabel* _labelPitch = nullptr;
|
||||
QLabel* _labelRoll = nullptr;
|
||||
QLabel* _labelYaw = nullptr;
|
||||
|
||||
QLineEdit* _linePitch = nullptr;
|
||||
QLineEdit* _lineRoll = nullptr;
|
||||
QLineEdit* _lineYaw = nullptr;
|
||||
QDoubleValidator* _validatorPitch = nullptr;
|
||||
QDoubleValidator* _validatorRoll = nullptr;
|
||||
QDoubleValidator* _validatorYaw = nullptr;
|
||||
|
||||
QPushButton* _buttonSave = nullptr;
|
||||
QPushButton* _buttonCancel = nullptr;
|
||||
};
|
||||
|
||||
#endif // PROJECTION_DIALOG_H
|
||||
@@ -2,6 +2,7 @@
|
||||
#define WINDOWCONTROL_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QFrame>
|
||||
#include <QIntValidator>
|
||||
#include <QLabel>
|
||||
@@ -45,6 +46,8 @@ private slots:
|
||||
void onSizeYChanged(const QString& newText);
|
||||
void onOffsetXChanged(const QString& newText);
|
||||
void onOffsetYChanged(const QString& newText);
|
||||
void onProjectionChanged(int newSelection);
|
||||
void onQualityChanged(int newSelection);
|
||||
|
||||
private:
|
||||
void updateScaledWindowDimensions();
|
||||
@@ -53,18 +56,30 @@ private:
|
||||
{50.0, 50.0, 800.0, 600.0},
|
||||
{900.0, 400.0, 640.0, 480.0}
|
||||
};
|
||||
QList<QString> _projectionTypes = {
|
||||
"Planar", "Fisheye", "Spherical Mirror", "Cylindrical", "Equirectangular"
|
||||
};
|
||||
QList<QString> _qualityTypes = {
|
||||
"Low (256)", "Medium (512)", "High (1K)", "1.5K (1536)", "2K (2048)",
|
||||
"4K (4096)", "8K (8192)", "16K (16384)", "32K (32768)", "64K (65536)"
|
||||
};
|
||||
int _lineEditWidthFixed = 50;
|
||||
float _marginFractionOfWidgetSize = 0.025;
|
||||
int _index = 0;
|
||||
|
||||
QVBoxLayout* _layoutWindowCtrl;
|
||||
QVBoxLayout* _layoutFullWindow;
|
||||
QVBoxLayout* _layoutWindowCtrl = nullptr;
|
||||
QVBoxLayout* _layoutFullWindow = nullptr;
|
||||
|
||||
QLineEdit* _size_x = nullptr;
|
||||
QLineEdit* _size_y = nullptr;
|
||||
QLineEdit* _offset_x = nullptr;
|
||||
QLineEdit* _offset_y = nullptr;
|
||||
|
||||
QIntValidator* _validatorSize_x = nullptr;
|
||||
QIntValidator* _validatorSize_y = nullptr;
|
||||
QIntValidator* _validatorOffset_x = nullptr;
|
||||
QIntValidator* _validatorOffset_y = nullptr;
|
||||
|
||||
QRect _monitorResolution;
|
||||
QRectF _monitorDimsScaled;
|
||||
QRectF _windowDims;
|
||||
@@ -75,6 +90,18 @@ private:
|
||||
QCheckBox* _checkBoxWebGui = nullptr;
|
||||
QCheckBox* _checkBoxSpoutOutput = nullptr;
|
||||
|
||||
QComboBox* _comboProjection = nullptr;
|
||||
QComboBox* _comboQuality = nullptr;
|
||||
QLabel* _labelFov = nullptr;
|
||||
QLineEdit* _lineFov = nullptr;
|
||||
QDoubleValidator* _validatorFov = nullptr;
|
||||
QLabel* _labelHeightOffset = nullptr;
|
||||
QLineEdit* _lineHeightOffset = nullptr;
|
||||
QDoubleValidator* _validatorHeightOffset = nullptr;
|
||||
|
||||
QHBoxLayout* _layoutName = nullptr;
|
||||
QLabel* _labelName = nullptr;
|
||||
QLineEdit* _windowName = nullptr;
|
||||
QLabel* _labelSize = nullptr;
|
||||
QLabel* _labelDelim = nullptr;
|
||||
QHBoxLayout* _layoutSize = nullptr;
|
||||
@@ -87,6 +114,12 @@ private:
|
||||
QHBoxLayout* _layoutCBoxVsync = nullptr;
|
||||
QHBoxLayout* _layoutCBoxWebGui = nullptr;
|
||||
QHBoxLayout* _layoutCBoxSpoutOutput = nullptr;
|
||||
QHBoxLayout* _layoutComboProjection = nullptr;
|
||||
QHBoxLayout* _layoutComboQuality = nullptr;
|
||||
QHBoxLayout* _layoutFov = nullptr;
|
||||
QWidget* _layoutFovWrapper = nullptr;
|
||||
QHBoxLayout* _layoutHeightOffset = nullptr;
|
||||
QWidget* _layoutHeightOffsetWrapper = nullptr;
|
||||
};
|
||||
|
||||
#endif // WINDOWCONTROL_H
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
#include <QScreen>
|
||||
#include <string>
|
||||
|
||||
#include "include/monitorbox.h"
|
||||
@@ -7,23 +8,23 @@
|
||||
#include "include/display.h"
|
||||
|
||||
|
||||
Display::Display()
|
||||
Display::Display(QHBoxLayout* parentLayout, QSize* monitorDims)
|
||||
{
|
||||
_toggleNumMonitorsButton = new QPushButton("Add 2nd Window", this);
|
||||
_toggleNumMonitorsButton->setObjectName("toggleNumMonitors");
|
||||
_toggleNumWindowsButton = new QPushButton("Add 2nd Window", this);
|
||||
_toggleNumWindowsButton->setObjectName("toggleNumWindows");
|
||||
|
||||
_monBox = new MonitorBox(_widgetDims, _monitorRes, this);
|
||||
_monBox = new MonitorBox(_widgetDims, *monitorDims, this);
|
||||
//Add 2 window controls
|
||||
addWindowControl();
|
||||
addWindowControl();
|
||||
initializeLayout();
|
||||
initializeLayout(parentLayout);
|
||||
|
||||
connect(_toggleNumMonitorsButton, SIGNAL(released()), this,
|
||||
connect(_toggleNumWindowsButton, SIGNAL(released()), this,
|
||||
SLOT(toggleWindows()));
|
||||
}
|
||||
|
||||
Display::~Display() {
|
||||
delete _toggleNumMonitorsButton;
|
||||
delete _toggleNumWindowsButton;
|
||||
delete _monBox;
|
||||
delete _layoutMonBox;
|
||||
delete _layoutMonButton;
|
||||
@@ -31,7 +32,7 @@ Display::~Display() {
|
||||
delete _layout;
|
||||
}
|
||||
|
||||
void Display::initializeLayout() {
|
||||
void Display::initializeLayout(QHBoxLayout* parentLayout) {
|
||||
_layout = new QVBoxLayout(this);
|
||||
_layoutMonBox = new QHBoxLayout(this);
|
||||
_layoutMonBox->addStretch(1);
|
||||
@@ -39,11 +40,12 @@ void Display::initializeLayout() {
|
||||
_layoutMonBox->addWidget(_monBox);
|
||||
_layoutMonBox->addStretch(1);
|
||||
_layout->addLayout(_layoutMonBox);
|
||||
|
||||
_monBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
_monBox->setFixedSize(400, 400);
|
||||
_layoutMonButton = new QHBoxLayout(this);
|
||||
_layoutMonButton->addStretch(1);
|
||||
_layoutMonButton->addWidget(_toggleNumMonitorsButton);
|
||||
_layoutMonButton->addWidget(_toggleNumWindowsButton);
|
||||
_layoutMonButton->addStretch(1);
|
||||
_layout->addLayout(_layoutMonButton);
|
||||
_layoutWindows = new QHBoxLayout(this);
|
||||
@@ -62,28 +64,30 @@ void Display::initializeLayout() {
|
||||
hideSecondWindow();
|
||||
_layout->addLayout(_layoutWindows);
|
||||
|
||||
this->setLayout(_layout);
|
||||
parentLayout->addLayout(_layout);
|
||||
// this->setLayout(parentLayoutWrapper);
|
||||
|
||||
QRect defaultMonitorResolution(_monitorResolution[0], _monitorResolution[1], 0, 0);
|
||||
_monBox->setResolution(defaultMonitorResolution);
|
||||
//QSize defaultMonitorResolution(_monitorResolution[0], _monitorResolution[1], 0, 0);
|
||||
//_monBox->setResolution(defaultMonitorResolution);
|
||||
|
||||
for (WindowControl* w : _windowControl) {
|
||||
w->cleanupLayouts();
|
||||
}
|
||||
//for (WindowControl* w : _windowControl) {
|
||||
// w->cleanupLayouts();
|
||||
//}
|
||||
}
|
||||
|
||||
void Display::toggleWindows() {
|
||||
if (_nWindowsDisplayed == 1) {
|
||||
_toggleNumMonitorsButton->setText("Remove 2nd window");
|
||||
_toggleNumWindowsButton->setText("Remove 2nd window");
|
||||
showSecondWindow();
|
||||
}
|
||||
else if (_nWindowsDisplayed == 2) {
|
||||
_toggleNumMonitorsButton->setText("Add 2nd window");
|
||||
_toggleNumWindowsButton->setText("Add 2nd window");
|
||||
hideSecondWindow();
|
||||
int minWidth = minimumWidth();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Display::hideSecondWindow() {
|
||||
_borderFrame->setVisible(false);
|
||||
_layoutWindowWrappers[1]->setVisible(false);
|
||||
|
||||
@@ -13,29 +13,82 @@
|
||||
#include "include/display.h"
|
||||
#include "include/monitorbox.h"
|
||||
#include "include/windowcontrol.h"
|
||||
#include "include/orientation.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[ ])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
QMainWindow win(nullptr);
|
||||
|
||||
//Temporary code for monitor detection
|
||||
QList<QScreen*> screenList = app.screens();
|
||||
for (QScreen* s : screenList) {
|
||||
std::cout << "Monitor ";
|
||||
std::cout << s->size().width() << "x" << s->size().height();
|
||||
std::cout << std::endl;
|
||||
std::vector<QSize> monitorSizeList;
|
||||
for (size_t s = 0; s < std::min(screenList.length(), 2); ++s) {
|
||||
monitorSizeList.push_back({//QRect(
|
||||
screenList[s]->size().width(),
|
||||
screenList[s]->size().height(),
|
||||
});
|
||||
}
|
||||
QScreen* screen = app.primaryScreen();
|
||||
QRect screenGeometry = screen->geometry();
|
||||
//for (QScreen* s : screenList) {
|
||||
// std::cout << "Monitor ";
|
||||
// std::cout << s->size().width() << "x" << s->size().height() << std::endl;
|
||||
//}
|
||||
//std::cout << "Primary";
|
||||
//QScreen* screen = app.primaryScreen();
|
||||
//std::cout << screen->size().width() << "x" << screen->size().height() << std::endl;
|
||||
//QRect screenGeometry = screen->geometry();
|
||||
//End code for monitor detection
|
||||
|
||||
QMainWindow win(nullptr);
|
||||
Display* displayWidget = new Display();
|
||||
win.setCentralWidget(displayWidget);
|
||||
win.setWindowTitle("Test Qt14");
|
||||
Display* displayWidget = nullptr;
|
||||
Display* displayWidget2 = nullptr;
|
||||
QFrame* monitorBorderFrame = nullptr;
|
||||
Orientation* orientationWidget = nullptr;
|
||||
|
||||
if (screenList.length() == 0) {
|
||||
std::cerr << "Error: Qt reports no screens available." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
QVBoxLayout* layoutMainV = new QVBoxLayout();
|
||||
QHBoxLayout* layoutMainH = new QHBoxLayout();
|
||||
// QWidget* layoutMainHWrapper = new QWidget();
|
||||
// layoutMainHWrapper->setLayout(layoutMainH);
|
||||
displayWidget = new Display(layoutMainH, &monitorSizeList[0]);
|
||||
layoutMainH->addWidget(displayWidget);
|
||||
|
||||
screenList.push_back(screenList[0]);
|
||||
QSize* m2 = new QSize(1080, 1920);
|
||||
monitorSizeList.push_back({m2->width(), m2->height()});
|
||||
|
||||
if (screenList.size() > 1) {
|
||||
std::cout << "Add display2." << std::endl;
|
||||
// displayWidget2 = new Display(layoutMainH, &monitorSizeList[1]);
|
||||
displayWidget2 = new Display(layoutMainH, &monitorSizeList[1]);
|
||||
monitorBorderFrame = new QFrame();
|
||||
monitorBorderFrame->setFrameShape(QFrame::VLine);
|
||||
layoutMainH->addWidget(monitorBorderFrame);
|
||||
layoutMainH->addWidget(displayWidget2);
|
||||
}
|
||||
|
||||
layoutMainV->addLayout(layoutMainH);
|
||||
orientationWidget = new Orientation(layoutMainV);
|
||||
|
||||
QWidget* mainWindow = new QWidget();
|
||||
mainWindow->setLayout(layoutMainV);
|
||||
win.setCentralWidget(mainWindow);
|
||||
|
||||
win.setWindowTitle("Window Details");
|
||||
win.show();
|
||||
app.exec();
|
||||
|
||||
delete orientationWidget;
|
||||
delete displayWidget;
|
||||
if (displayWidget2) {
|
||||
delete displayWidget2;
|
||||
}
|
||||
if (monitorBorderFrame) {
|
||||
delete monitorBorderFrame;
|
||||
}
|
||||
delete layoutMainH;
|
||||
delete layoutMainV;
|
||||
delete mainWindow;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
|
||||
MonitorBox::MonitorBox(QRect widgetDims, QRect monitorResolution, QWidget *parent)
|
||||
MonitorBox::MonitorBox(QRect widgetDims, QSize monitorResolution, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, _monitorWidgetSize(widgetDims)
|
||||
{
|
||||
@@ -42,7 +42,7 @@ void MonitorBox::windowDimensionsChanged(unsigned int index, const QRectF newDim
|
||||
mapWindowResolutionToWidgetCoordinates(index, newDimensions);
|
||||
}
|
||||
|
||||
void MonitorBox::mapMonitorResolutionToWidgetCoordinates(QRect r) {
|
||||
void MonitorBox::mapMonitorResolutionToWidgetCoordinates(QSize r) {
|
||||
float aspectRatio = static_cast<float>(r.width()) /
|
||||
static_cast<float>(r.height());
|
||||
_marginWidget = _monitorWidgetSize.width() * _marginFractionOfWidgetSize;
|
||||
@@ -73,7 +73,7 @@ void MonitorBox::mapMonitorResolutionToWidgetCoordinates(QRect r) {
|
||||
this->update();
|
||||
}
|
||||
|
||||
void MonitorBox::setResolution(QRect& res) {
|
||||
void MonitorBox::setResolution(QSize& res) {
|
||||
_monitorResolution = res;
|
||||
}
|
||||
|
||||
|
||||
26
apps/OpenSpace/ext/launcher/src/sgctedit/orientation.cpp
Normal file
26
apps/OpenSpace/ext/launcher/src/sgctedit/orientation.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "display.h"
|
||||
#include "orientation.h"
|
||||
#include "orientationdialog.h"
|
||||
|
||||
Orientation::Orientation(QVBoxLayout* parentLayout)
|
||||
{
|
||||
_orientationButton = new QPushButton("Global Orientation");
|
||||
_orientationButton->setObjectName("globalOrientation");
|
||||
_layoutOrientationButton = new QHBoxLayout();
|
||||
_layoutOrientationButton->addStretch(1);
|
||||
_layoutOrientationButton->addWidget(_orientationButton);
|
||||
_layoutOrientationButton->addStretch(1);
|
||||
parentLayout->addLayout(_layoutOrientationButton);
|
||||
connect(_orientationButton, SIGNAL(released()), this,
|
||||
SLOT(orientationDialog()));
|
||||
}
|
||||
|
||||
void Orientation::orientationDialog() {
|
||||
OrientationDialog(this).exec();
|
||||
}
|
||||
|
||||
Orientation::~Orientation()
|
||||
{
|
||||
delete _layoutOrientationButton;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
#include "display.h"
|
||||
#include "orientationdialog.h"
|
||||
|
||||
OrientationDialog::OrientationDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle("Global Orientation");
|
||||
_layoutWindow = new QVBoxLayout(this);
|
||||
_layoutPitch = new QHBoxLayout(this);
|
||||
_layoutRoll = new QHBoxLayout(this);
|
||||
_layoutYaw = new QHBoxLayout(this);
|
||||
|
||||
_labelPitch = new QLabel(this);
|
||||
_labelRoll = new QLabel(this);
|
||||
_labelYaw = new QLabel(this);
|
||||
_labelPitch->setText("Pitch: ");
|
||||
_labelRoll ->setText("Roll: ");
|
||||
_labelYaw ->setText("Yaw: ");
|
||||
|
||||
_linePitch = new QLineEdit(this);
|
||||
_lineRoll = new QLineEdit(this);
|
||||
_lineYaw = new QLineEdit(this);
|
||||
_linePitch->setText("0.0");
|
||||
_lineRoll->setText("0.0");
|
||||
_lineYaw->setText("0.0");
|
||||
_validatorPitch = new QDoubleValidator(-90.0, 90.0, 15);
|
||||
_validatorPitch->setNotation(QDoubleValidator::StandardNotation);
|
||||
_validatorRoll = new QDoubleValidator(-360.0, 360.0, 15);
|
||||
_validatorRoll->setNotation(QDoubleValidator::StandardNotation);
|
||||
_validatorYaw = new QDoubleValidator(-180.0, 180.0, 15);
|
||||
_validatorYaw->setNotation(QDoubleValidator::StandardNotation);
|
||||
_linePitch->setValidator(_validatorPitch);
|
||||
_lineRoll->setValidator(_validatorRoll);
|
||||
_lineYaw->setValidator(_validatorYaw);
|
||||
|
||||
_layoutPitch->addStretch(1);
|
||||
_layoutPitch->addWidget(_labelPitch);
|
||||
_layoutPitch->addWidget(_linePitch);
|
||||
//_layoutPitch->addStretch(1);
|
||||
_layoutWindow->addLayout(_layoutPitch);
|
||||
|
||||
_layoutRoll->addStretch(1);
|
||||
_layoutRoll->addWidget(_labelRoll);
|
||||
_layoutRoll->addWidget(_lineRoll);
|
||||
//_layoutRoll->addStretch(1);
|
||||
_layoutWindow->addLayout(_layoutRoll);
|
||||
|
||||
_layoutYaw->addStretch(1);
|
||||
_layoutYaw->addWidget(_labelYaw);
|
||||
_layoutYaw->addWidget(_lineYaw);
|
||||
//_layoutYaw->addStretch(1);
|
||||
_layoutWindow->addLayout(_layoutYaw);
|
||||
|
||||
_layoutButtonBox = new QHBoxLayout;
|
||||
_buttonSave = new QPushButton("Save");
|
||||
_buttonSave->setToolTip("Save global orientation changes");
|
||||
//connect(_buttonSave, &QPushButton::clicked, this, &ModulesDialog::listItemSave);
|
||||
_layoutButtonBox->addStretch(1);
|
||||
_layoutButtonBox->addWidget(_buttonSave);
|
||||
|
||||
_buttonCancel = new QPushButton("Cancel");
|
||||
_buttonCancel->setToolTip("Cancel global orientation changes");
|
||||
//connect(_buttonCancel, &QPushButton::clicked, this, &ModulesDialog::listItemCancelSave);
|
||||
_layoutButtonBox->addWidget(_buttonCancel);
|
||||
_layoutButtonBox->addStretch(1);
|
||||
|
||||
_layoutWindow->addLayout(_layoutButtonBox);
|
||||
|
||||
}
|
||||
|
||||
OrientationDialog::~OrientationDialog()
|
||||
{
|
||||
delete _labelPitch;
|
||||
delete _labelRoll;
|
||||
delete _labelYaw;
|
||||
delete _validatorPitch;
|
||||
delete _validatorRoll;
|
||||
delete _validatorYaw;
|
||||
delete _linePitch;
|
||||
delete _lineRoll;
|
||||
delete _lineYaw;
|
||||
delete _buttonSave;
|
||||
delete _buttonCancel;
|
||||
delete _layoutPitch;
|
||||
delete _layoutRoll;
|
||||
delete _layoutYaw;
|
||||
delete _layoutButtonBox;
|
||||
delete _layoutWindow;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
#include "display.h"
|
||||
#include "projectiondialog.h"
|
||||
|
||||
ProjectionDialog::ProjectionDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle("Global Orientation");
|
||||
_layoutWindow = new QVBoxLayout(this);
|
||||
_layoutPitch = new QHBoxLayout(this);
|
||||
_layoutRoll = new QHBoxLayout(this);
|
||||
_layoutYaw = new QHBoxLayout(this);
|
||||
|
||||
_labelPitch = new QLabel(this);
|
||||
_labelRoll = new QLabel(this);
|
||||
_labelYaw = new QLabel(this);
|
||||
_labelPitch->setText("Pitch: ");
|
||||
_labelRoll ->setText("Roll: ");
|
||||
_labelYaw ->setText("Yaw: ");
|
||||
|
||||
_linePitch = new QLineEdit(this);
|
||||
_lineRoll = new QLineEdit(this);
|
||||
_lineYaw = new QLineEdit(this);
|
||||
_validatorPitch = new QDoubleValidator(-90.0, 90.0, 15);
|
||||
_validatorPitch->setNotation(QDoubleValidator::StandardNotation);
|
||||
_validatorRoll = new QDoubleValidator(-360.0, 360.0, 15);
|
||||
_validatorRoll->setNotation(QDoubleValidator::StandardNotation);
|
||||
_validatorYaw = new QDoubleValidator(-180.0, 180.0, 15);
|
||||
_validatorYaw->setNotation(QDoubleValidator::StandardNotation);
|
||||
_linePitch->setValidator(_validatorPitch);
|
||||
_lineRoll->setValidator(_validatorRoll);
|
||||
_lineYaw->setValidator(_validatorYaw);
|
||||
|
||||
_layoutPitch->addStretch(1);
|
||||
_layoutPitch->addWidget(_labelPitch);
|
||||
_layoutPitch->addWidget(_linePitch);
|
||||
//_layoutPitch->addStretch(1);
|
||||
_layoutWindow->addLayout(_layoutPitch);
|
||||
|
||||
_layoutRoll->addStretch(1);
|
||||
_layoutRoll->addWidget(_labelRoll);
|
||||
_layoutRoll->addWidget(_lineRoll);
|
||||
//_layoutRoll->addStretch(1);
|
||||
_layoutWindow->addLayout(_layoutRoll);
|
||||
|
||||
_layoutYaw->addStretch(1);
|
||||
_layoutYaw->addWidget(_labelYaw);
|
||||
_layoutYaw->addWidget(_lineYaw);
|
||||
//_layoutYaw->addStretch(1);
|
||||
_layoutWindow->addLayout(_layoutYaw);
|
||||
|
||||
_layoutButtonBox = new QHBoxLayout;
|
||||
_buttonSave = new QPushButton("Save");
|
||||
_buttonSave->setToolTip("Save global orientation changes");
|
||||
//connect(_buttonSave, &QPushButton::clicked, this, &ModulesDialog::listItemSave);
|
||||
_layoutButtonBox->addStretch(1);
|
||||
_layoutButtonBox->addWidget(_buttonSave);
|
||||
|
||||
_buttonCancel = new QPushButton("Cancel");
|
||||
_buttonCancel->setToolTip("Cancel global orientation changes");
|
||||
//connect(_buttonCancel, &QPushButton::clicked, this, &ModulesDialog::listItemCancelSave);
|
||||
_layoutButtonBox->addWidget(_buttonCancel);
|
||||
_layoutButtonBox->addStretch(1);
|
||||
|
||||
_layoutWindow->addLayout(_layoutButtonBox);
|
||||
|
||||
}
|
||||
|
||||
ProjectionDialog::~ProjectionDialog()
|
||||
{
|
||||
delete _labelPitch;
|
||||
delete _labelRoll;
|
||||
delete _labelYaw;
|
||||
delete _validatorPitch;
|
||||
delete _validatorRoll;
|
||||
delete _validatorYaw;
|
||||
delete _linePitch;
|
||||
delete _lineRoll;
|
||||
delete _lineYaw;
|
||||
delete _buttonSave;
|
||||
delete _buttonCancel;
|
||||
delete _layoutPitch;
|
||||
delete _layoutRoll;
|
||||
delete _layoutYaw;
|
||||
delete _layoutButtonBox;
|
||||
delete _layoutWindow;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,18 @@ WindowControl::WindowControl(unsigned int windowIndex, QRect& widgetDims,
|
||||
_checkBoxVsync = new QCheckBox("VSync", this);
|
||||
_checkBoxWebGui = new QCheckBox("WebGUI here", this);
|
||||
_checkBoxSpoutOutput = new QCheckBox("Spout Output", this);
|
||||
_comboProjection = new QComboBox(this);
|
||||
_comboProjection->addItems(_projectionTypes);
|
||||
|
||||
_comboQuality = new QComboBox(this);
|
||||
_comboQuality->addItems(_qualityTypes);
|
||||
|
||||
_lineFov = new QLineEdit("0.0", parent);
|
||||
_validatorFov = new QDoubleValidator(-180.0, 180.0, 10);
|
||||
_lineFov->setValidator(_validatorFov);
|
||||
_lineHeightOffset = new QLineEdit("0.0", parent);
|
||||
_validatorHeightOffset = new QDoubleValidator(-1000000.0, 1000000.0, 12);
|
||||
_lineHeightOffset->setValidator(_validatorHeightOffset);
|
||||
|
||||
connect(_size_x, SIGNAL(textChanged(const QString&)), this,
|
||||
SLOT(onSizeXChanged(const QString&)));
|
||||
@@ -43,12 +55,27 @@ WindowControl::WindowControl(unsigned int windowIndex, QRect& widgetDims,
|
||||
SLOT(onOffsetXChanged(const QString&)));
|
||||
connect(_offset_y, SIGNAL(textChanged(const QString&)), this,
|
||||
SLOT(onOffsetYChanged(const QString&)));
|
||||
|
||||
connect(_comboProjection, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(onProjectionChanged(int)));
|
||||
connect(_comboQuality, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(onQualityChanged(int)));
|
||||
}
|
||||
|
||||
QVBoxLayout* WindowControl::initializeLayout(QWidget* parentWidget/*, QHBoxLayout* layout*/) {
|
||||
_layoutFullWindow = new QVBoxLayout(parentWidget);
|
||||
//Window size
|
||||
_layoutWindowCtrl = new QVBoxLayout(parentWidget);
|
||||
_layoutName = new QHBoxLayout(parentWidget);
|
||||
_labelName = new QLabel(this);
|
||||
_labelName->setText("Window Name: ");
|
||||
_windowName = new QLineEdit(this);
|
||||
_windowName->setFixedWidth(100);
|
||||
_layoutName->addStretch(1);
|
||||
_layoutName->addWidget(_labelName);
|
||||
_layoutName->addWidget(_windowName);
|
||||
_layoutName->addStretch(1);
|
||||
_layoutWindowCtrl->addLayout(_layoutName);
|
||||
_size_x->setFixedWidth(_lineEditWidthFixed);
|
||||
_size_y->setFixedWidth(_lineEditWidthFixed);
|
||||
_labelSize = new QLabel(this);
|
||||
@@ -107,19 +134,51 @@ QVBoxLayout* WindowControl::initializeLayout(QWidget* parentWidget/*, QHBoxLayou
|
||||
_layoutCBoxSpoutOutput->addStretch(1);
|
||||
_layoutCheckboxesFull2->addLayout(_layoutCBoxSpoutOutput);
|
||||
|
||||
_layoutComboProjection = new QHBoxLayout(parentWidget);
|
||||
_layoutComboProjection->addWidget(_comboProjection);
|
||||
_layoutComboProjection->addStretch(1);
|
||||
_layoutCheckboxesFull2->addLayout(_layoutComboProjection);
|
||||
|
||||
_layoutComboQuality = new QHBoxLayout(parentWidget);
|
||||
_layoutComboQuality->addWidget(_comboQuality);
|
||||
_layoutComboQuality->addStretch(1);
|
||||
_layoutCheckboxesFull2->addLayout(_layoutComboQuality);
|
||||
|
||||
_layoutFov = new QHBoxLayout(parentWidget);
|
||||
_labelFov = new QLabel();
|
||||
_labelFov->setText("Horizontal FOV:");
|
||||
_layoutFov->addWidget(_labelFov);
|
||||
_layoutFov->addWidget(_lineFov);
|
||||
_layoutFov->addStretch(1);
|
||||
_layoutFovWrapper = new QWidget();
|
||||
_layoutFovWrapper->setLayout(_layoutFov);
|
||||
_layoutCheckboxesFull2->addWidget(_layoutFovWrapper);
|
||||
_layoutHeightOffset = new QHBoxLayout(parentWidget);
|
||||
_labelHeightOffset = new QLabel();
|
||||
_labelHeightOffset->setText("Height Offset:");
|
||||
_layoutHeightOffset->addWidget(_labelHeightOffset);
|
||||
_layoutHeightOffset->addWidget(_lineHeightOffset);
|
||||
_layoutHeightOffset->addStretch(1);
|
||||
_layoutHeightOffsetWrapper = new QWidget();
|
||||
_layoutHeightOffsetWrapper->setLayout(_layoutHeightOffset);
|
||||
_layoutCheckboxesFull2->addWidget(_layoutHeightOffsetWrapper);
|
||||
|
||||
_layoutCheckboxesFull1->addLayout(_layoutCheckboxesFull2);
|
||||
_layoutCheckboxesFull1->addStretch(1);
|
||||
_layoutWindowCtrl->addLayout(_layoutCheckboxesFull1);
|
||||
_layoutFullWindow->addLayout(_layoutWindowCtrl);
|
||||
|
||||
_comboProjection->setCurrentIndex(0);
|
||||
onProjectionChanged(0);
|
||||
_comboQuality->setCurrentIndex(2);
|
||||
onQualityChanged(2);
|
||||
|
||||
return _layoutFullWindow;
|
||||
}
|
||||
|
||||
void WindowControl::cleanupLayouts() {
|
||||
int labelSize1 = _labelSize->width();
|
||||
int labelSize2 = _labelOffset->width();
|
||||
std::cout << "label1 = " << std::to_string(labelSize1) << std::endl;
|
||||
std::cout << "label2 = " << std::to_string(labelSize2) << std::endl;
|
||||
int labelWidthStandard = std::max(labelSize1, labelSize2);
|
||||
_labelSize->setFixedWidth(labelWidthStandard);
|
||||
_labelOffset->setFixedWidth(labelWidthStandard);
|
||||
@@ -169,6 +228,38 @@ void WindowControl::onOffsetYChanged(const QString& newText) {
|
||||
}
|
||||
}
|
||||
|
||||
void WindowControl::onProjectionChanged(int newSelection) {
|
||||
switch (newSelection) {
|
||||
case 0:
|
||||
_layoutFovWrapper->setVisible(true);
|
||||
_layoutHeightOffsetWrapper->setVisible(false);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
_layoutFovWrapper->setVisible(false);
|
||||
_layoutHeightOffsetWrapper->setVisible(false);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
_layoutFovWrapper->setVisible(false);
|
||||
_layoutHeightOffsetWrapper->setVisible(false);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
_layoutFovWrapper->setVisible(false);
|
||||
_layoutHeightOffsetWrapper->setVisible(true);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
_layoutFovWrapper->setVisible(false);
|
||||
_layoutHeightOffsetWrapper->setVisible(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WindowControl::onQualityChanged(int newSelection) {
|
||||
}
|
||||
|
||||
void WindowControl::setDimensions(const QRectF& dimensions) {
|
||||
_windowDims = dimensions;
|
||||
}
|
||||
@@ -221,8 +312,15 @@ WindowControl::~WindowControl()
|
||||
{
|
||||
delete _size_x;
|
||||
delete _size_y;
|
||||
delete _validatorSize_x;
|
||||
delete _validatorSize_y;
|
||||
delete _offset_x;
|
||||
delete _offset_y;
|
||||
delete _validatorOffset_x;
|
||||
delete _validatorOffset_y;
|
||||
delete _layoutName;
|
||||
delete _labelName;
|
||||
delete _windowName;
|
||||
delete _labelSize;
|
||||
delete _labelDelim;
|
||||
delete _layoutSize;
|
||||
@@ -233,10 +331,24 @@ WindowControl::~WindowControl()
|
||||
delete _checkBoxVsync;
|
||||
delete _checkBoxWebGui;
|
||||
delete _checkBoxSpoutOutput;
|
||||
delete _comboProjection;
|
||||
delete _comboQuality;
|
||||
delete _labelFov;
|
||||
delete _lineFov;
|
||||
delete _validatorFov;
|
||||
delete _labelHeightOffset;
|
||||
delete _lineHeightOffset;
|
||||
delete _validatorHeightOffset;
|
||||
delete _layoutCBoxFullscreen;
|
||||
delete _layoutCBoxVsync;
|
||||
delete _layoutCBoxWebGui;
|
||||
delete _layoutCBoxSpoutOutput;
|
||||
delete _layoutComboProjection;
|
||||
delete _layoutComboQuality;
|
||||
delete _layoutFov;
|
||||
delete _layoutFovWrapper;
|
||||
delete _layoutHeightOffset;
|
||||
delete _layoutHeightOffsetWrapper;
|
||||
delete _layoutCheckboxesFull2;
|
||||
delete _layoutCheckboxesFull1;
|
||||
delete _layoutWindowCtrl;
|
||||
|
||||
Reference in New Issue
Block a user