mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-24 13:08:49 -05:00
Code refactoring and getting to work with launcher in OpenSpace app
This commit is contained in:
@@ -47,6 +47,7 @@ set(HEADER_FILES
|
||||
include/sgctedit/monitorbox.h
|
||||
include/sgctedit/orientation.h
|
||||
include/sgctedit/orientationdialog.h
|
||||
include/sgctedit/sgctedit.h
|
||||
include/sgctedit/windowcontrol.h
|
||||
)
|
||||
|
||||
@@ -68,9 +69,9 @@ set(SOURCE_FILES
|
||||
src/profile/timedialog.cpp
|
||||
src/profile/profileedit.cpp
|
||||
src/profile/propertiesdialog.cpp
|
||||
src/sgctedit/sgctedit.cpp
|
||||
src/sgctedit/display.cpp
|
||||
src/sgctedit/filesupport.cpp
|
||||
src/sgctedit/main.cpp
|
||||
src/sgctedit/monitorbox.cpp
|
||||
src/sgctedit/orientation.cpp
|
||||
src/sgctedit/orientationdialog.cpp
|
||||
@@ -97,6 +98,7 @@ set(HEADER_SOURCE
|
||||
include/sgctedit/monitorbox.h
|
||||
include/sgctedit/orientation.h
|
||||
include/sgctedit/orientationdialog.h
|
||||
include/sgctedit/sgctedit.h
|
||||
include/sgctedit/windowcontrol.h
|
||||
)
|
||||
|
||||
|
||||
@@ -36,10 +36,11 @@ private slots:
|
||||
void removeWindow();
|
||||
|
||||
private:
|
||||
void addWindowControl();
|
||||
void initializeWindowControl();
|
||||
void removeWindowControl();
|
||||
void initializeLayout(bool showLabel, unsigned int numWindowsInit);
|
||||
void showWindows(unsigned int nWindowControlsDisplayed);
|
||||
void addDisplayLayout(unsigned int column, MonitorBox* monBox, QVBoxLayout* layout);
|
||||
std::vector<QRect>& _monitorResolutions;
|
||||
QRect _widgetDims = {0, 0, 400, 400};
|
||||
std::vector<WindowControl*> _windowControl;
|
||||
|
||||
@@ -27,9 +27,7 @@ public:
|
||||
void mapMonitorResolutionToWidgetCoordinates();
|
||||
void mapWindowResolutionToWidgetCoordinates(unsigned int mIdx, unsigned int wIdx,
|
||||
const QRectF& w);
|
||||
void setResolution(unsigned int index, QRect& res);
|
||||
void setNumWindowsDisplayed(unsigned int mIdx, unsigned int nWindows);
|
||||
int numWindows();
|
||||
void windowDimensionsChanged(unsigned int monitorIdx, unsigned int windowIdx,
|
||||
const QRectF& newDimensions);
|
||||
void addWindowControl(WindowControl* wCtrl);
|
||||
@@ -38,6 +36,21 @@ protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
void paintWidgetBorder(QPainter& painter, int width, int height);
|
||||
void paintMonitorOutlines(QPainter& painter);
|
||||
void paintWindowOutline(QPainter& painter, unsigned int monIdx, unsigned int winIdx);
|
||||
void paintOutOfBoundsAreas(QPainter& painter, unsigned int monIdx,unsigned int winIdx);
|
||||
void paintWindowNumber(QPainter& painter, unsigned int monIdx, unsigned int winIdx);
|
||||
void setPenSpecificToWindow(QPainter& painter, unsigned int windowIdx,
|
||||
bool visibleBorder);
|
||||
void computeScaledResolution_landscape(float aspectRatio, float maxWidth);
|
||||
void computeScaledResolution_portrait(float aspectRatio, float maxHeight);
|
||||
void computeOutOfBounds_horizontal(unsigned int mIdx, unsigned int wIdx);
|
||||
void computeOutOfBounds_vertical(unsigned int mIdx, unsigned int wIdx);
|
||||
void addOutOfBoundsArea_horizontal(unsigned int mIdx, unsigned int wIdx,
|
||||
qreal bounds, qreal extent);
|
||||
void addOutOfBoundsArea_vertical(unsigned int mIdx, unsigned int wIdx,
|
||||
qreal bounds, qreal extent);
|
||||
unsigned int _maxNumMonitors = 2;
|
||||
unsigned int _maxNumWindowsPerMonitor = 2;
|
||||
std::vector<QRect> _monitorResolution;
|
||||
@@ -45,15 +58,17 @@ private:
|
||||
std::vector<QRectF> _monitorDimensionsScaled;
|
||||
|
||||
std::vector<QRectF> _windowResolutions;
|
||||
std::vector<std::vector<std::vector<QRectF>>> _outOfBoundsRect = {
|
||||
{{{0.0, 0.0, 0.0, 0.0}},
|
||||
{{0.0, 0.0, 0.0, 0.0}}},
|
||||
{{{0.0, 0.0, 0.0, 0.0}},
|
||||
{{0.0, 0.0, 0.0, 0.0}}}
|
||||
};
|
||||
std::vector<std::vector<QRectF>> _windowRendering = {
|
||||
{
|
||||
{0.0, 0.0, 0.0, 0.0},
|
||||
{0.0, 0.0, 0.0, 0.0}
|
||||
},
|
||||
{
|
||||
{0.0, 0.0, 0.0, 0.0},
|
||||
{0.0, 0.0, 0.0, 0.0}
|
||||
}
|
||||
{{0.0, 0.0, 0.0, 0.0},
|
||||
{0.0, 0.0, 0.0, 0.0}},
|
||||
{{0.0, 0.0, 0.0, 0.0},
|
||||
{0.0, 0.0, 0.0, 0.0}}
|
||||
};
|
||||
float _monitorScaleFactor = 1.0;
|
||||
float _offset[2] = {10.0, 10.0};
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
#ifndef __OPENSPACE_UI_LAUNCHER___SGCTEDIT___H__
|
||||
#define __OPENSPACE_UI_LAUNCHER___SGCTEDIT___H__
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QMainWindow>
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
#include <QScreen>
|
||||
#include <QTextBrowser>
|
||||
#include <QWidget>
|
||||
#include <string>
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
#include <sgctedit/display.h>
|
||||
#include <sgctedit/filesupport.h>
|
||||
#include <sgctedit/monitorbox.h>
|
||||
#include <sgctedit/orientation.h>
|
||||
|
||||
|
||||
class SgctEdit final : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SgctEdit(QWidget* parent, QApplication& qtApp);
|
||||
~SgctEdit();
|
||||
void addDisplayLayout(unsigned int column, MonitorBox* monBox, QHBoxLayout* layout);
|
||||
void createWidgets();
|
||||
|
||||
private slots:
|
||||
|
||||
private:
|
||||
void systemMonitorConfiguration(QApplication& qtApp);
|
||||
std::vector<QRect> _monitorSizeList;
|
||||
std::vector<QVBoxLayout*> _displayLayout = {nullptr, nullptr};
|
||||
std::vector<QFrame*> _displayFrame = {nullptr, nullptr};
|
||||
std::vector<Display*> _displayWidget = {nullptr, nullptr};
|
||||
QRect _monitorWidgetSize = {0, 0, 400, 350};
|
||||
FileSupport* _fileSupportWidget = nullptr;
|
||||
Orientation* _orientationWidget = nullptr;
|
||||
bool _showMonitorLabel = false;
|
||||
};
|
||||
|
||||
#endif // __OPENSPACE_UI_LAUNCHER___SGCTEDIT___H__
|
||||
@@ -28,9 +28,8 @@ public:
|
||||
QRect& widgetDims, QRect& monitorDims, QWidget *parent = nullptr);
|
||||
~WindowControl();
|
||||
void setDimensions(const QRectF& dimensions);
|
||||
void setWindowScaleFactor(float scaleFactor);
|
||||
void setWindowChangeCallback(
|
||||
std::function<void(unsigned int, unsigned int, const QRectF&)> cb);
|
||||
std::function<void(int, int, const QRectF&)> cb);
|
||||
void showWindowLabel(bool show);
|
||||
void cleanupLayouts();
|
||||
QVBoxLayout* initializeLayout(QWidget* parentWidget);
|
||||
@@ -49,15 +48,14 @@ private slots:
|
||||
void onOffsetXChanged(const QString& newText);
|
||||
void onOffsetYChanged(const QString& newText);
|
||||
void onProjectionChanged(int newSelection);
|
||||
void onQualityChanged(int newSelection);
|
||||
void onFullscreenClicked();
|
||||
|
||||
private:
|
||||
void updateScaledWindowDimensions();
|
||||
std::function<void(unsigned int, unsigned int, const QRectF&)> _windowChangeCallback;
|
||||
std::function<void(int, int, const QRectF&)> _windowChangeCallback;
|
||||
QRectF defaultWindowSizes[2] = {
|
||||
{50.0, 50.0, 800.0, 600.0},
|
||||
{900.0, 400.0, 2540.0, 680.0}
|
||||
{50.0, 50.0, 1280.0, 720.0},
|
||||
{900.0, 400.0, 800.0, 600.0}
|
||||
};
|
||||
QList<QString> _projectionTypes = {
|
||||
"Planar", "Fisheye", "Spherical Mirror", "Cylindrical", "Equirectangular"
|
||||
@@ -70,7 +68,7 @@ private:
|
||||
float _marginFractionOfWidgetSize = 0.025;
|
||||
unsigned int _monIndex = 0;
|
||||
unsigned int _index = 0;
|
||||
unsigned int _maxWindowSizePixels = 10000;
|
||||
int _maxWindowSizePixels = 10000;
|
||||
|
||||
QVBoxLayout* _layoutWindowCtrl = nullptr;
|
||||
QVBoxLayout* _layoutFullWindow = nullptr;
|
||||
@@ -89,10 +87,7 @@ private:
|
||||
QIntValidator* _validatorOffset_y = nullptr;
|
||||
|
||||
QRect& _monitorResolution;
|
||||
QRectF _monitorDimsScaled;
|
||||
QRectF _windowDims;
|
||||
QRectF _windowDimsScaled;
|
||||
float _monitorScaleFactor = 1.0;
|
||||
QPushButton* _fullscreenButton = nullptr;
|
||||
QCheckBox* _checkBoxWindowDecor = nullptr;
|
||||
QCheckBox* _checkBoxWebGui = nullptr;
|
||||
@@ -112,10 +107,9 @@ private:
|
||||
QLineEdit* _windowName = nullptr;
|
||||
QLabel* _labelSize = nullptr;
|
||||
QLabel* _labelDelim = nullptr;
|
||||
QGridLayout* _layoutSize = nullptr;
|
||||
QHBoxLayout* _layoutGridFrame= nullptr;
|
||||
QHBoxLayout* _layoutGridSizeValues = nullptr;
|
||||
QHBoxLayout* _layoutGridOffsetValues = nullptr;
|
||||
QHBoxLayout* _layoutSize = nullptr;
|
||||
QWidget* _widgetSize = nullptr;
|
||||
QHBoxLayout* _layoutOffset = nullptr;
|
||||
QLabel* _labelOffset = nullptr;
|
||||
QLabel* _labelComma = nullptr;
|
||||
QHBoxLayout* _layoutCheckboxesFull1 = nullptr;
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
#include <QScreen>
|
||||
#include <string>
|
||||
|
||||
#include "include/monitorbox.h"
|
||||
#include "include/windowcontrol.h"
|
||||
#include "include/display.h"
|
||||
#include "sgctedit/monitorbox.h"
|
||||
#include "sgctedit/windowcontrol.h"
|
||||
#include "sgctedit/display.h"
|
||||
|
||||
|
||||
Display::Display(unsigned int monitorIdx, MonitorBox* monitorRenderBox,
|
||||
@@ -18,8 +18,8 @@ Display::Display(unsigned int monitorIdx, MonitorBox* monitorRenderBox,
|
||||
_removeWindowButton = new QPushButton("Remove Window", this);
|
||||
|
||||
//Add 2 window controls
|
||||
addWindowControl();
|
||||
addWindowControl();
|
||||
initializeWindowControl();
|
||||
initializeWindowControl();
|
||||
initializeLayout(showLabel, numWindowsInit);
|
||||
|
||||
connect(_addWindowButton, SIGNAL(released()), this,
|
||||
@@ -30,9 +30,19 @@ Display::Display(unsigned int monitorIdx, MonitorBox* monitorRenderBox,
|
||||
|
||||
Display::~Display() {
|
||||
delete _addWindowButton;
|
||||
delete _removeWindowButton;
|
||||
delete _monBox;
|
||||
delete _borderFrame;
|
||||
delete _labelMonNum;
|
||||
for (auto w : _windowControl) {
|
||||
delete w;
|
||||
}
|
||||
delete _layoutMonNumLabel;
|
||||
delete _layoutMonBox;
|
||||
delete _layoutMonButton;
|
||||
for (auto w : _layoutWindowWrappers) {
|
||||
delete w;
|
||||
}
|
||||
delete _layoutWindows;
|
||||
delete _layout;
|
||||
}
|
||||
@@ -130,7 +140,7 @@ void Display::showWindows(unsigned int nWindowControlsDisplayed) {
|
||||
}
|
||||
}
|
||||
|
||||
void Display::addWindowControl() {
|
||||
void Display::initializeWindowControl() {
|
||||
if (_nWindowsAllocated < 2) {
|
||||
_windowControl.push_back(
|
||||
new WindowControl(
|
||||
@@ -142,7 +152,7 @@ void Display::addWindowControl() {
|
||||
)
|
||||
);
|
||||
_windowControl.back()->setWindowChangeCallback(
|
||||
[this](unsigned int monIndex, unsigned int winIndex, const QRectF& newDims) {
|
||||
[this](int monIndex, int winIndex, const QRectF& newDims) {
|
||||
_monBox->windowDimensionsChanged(monIndex, winIndex, newDims);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "filesupport.h"
|
||||
#include "sgctedit/filesupport.h"
|
||||
|
||||
FileSupport::FileSupport(QVBoxLayout* parentLayout)
|
||||
{
|
||||
@@ -12,6 +12,7 @@ FileSupport::FileSupport(QVBoxLayout* parentLayout)
|
||||
_cancelButton->setToolTip("Cancel global orientation changes");
|
||||
//connect(_buttonCancel, &QPushButton::clicked, this, &ModulesDialog::listItemCancelSave);
|
||||
_layoutButtonBox->addWidget(_cancelButton);
|
||||
//_layoutButtonBox->setSizeConstraint(QLayout::SetFixedSize);
|
||||
parentLayout->addLayout(_layoutButtonBox);
|
||||
connect(_cancelButton, SIGNAL(released()), this,
|
||||
SLOT(cancel()));
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
#include <QApplication>
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QMainWindow>
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
#include <QScreen>
|
||||
#include <QTextBrowser>
|
||||
#include <QWidget>
|
||||
#include <string>
|
||||
|
||||
#include "include/display.h"
|
||||
#include "include/filesupport.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();
|
||||
std::vector<QRect> monitorSizeList;
|
||||
for (size_t s = 0; s < std::min(screenList.length(), 2); ++s) {
|
||||
int actualWidth = std::max(screenList[s]->size().width(),
|
||||
screenList[s]->availableGeometry().width());
|
||||
int actualHeight = std::max(screenList[s]->size().height(),
|
||||
screenList[s]->availableGeometry().height());
|
||||
monitorSizeList.push_back({
|
||||
screenList[s]->availableGeometry().x(),
|
||||
screenList[s]->availableGeometry().y(),
|
||||
actualWidth,
|
||||
actualHeight
|
||||
});
|
||||
}
|
||||
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();
|
||||
|
||||
orientationWidget = new Orientation();
|
||||
QWidget* mainWindow = new QWidget();
|
||||
mainWindow->setLayout(layoutMainV);
|
||||
win.setCentralWidget(mainWindow);
|
||||
|
||||
bool showMonitorLabel = (monitorSizeList.size() > 1);
|
||||
MonitorBox* monBox = new MonitorBox(
|
||||
{0, 0, 400, 340},
|
||||
monitorSizeList,
|
||||
showMonitorLabel
|
||||
);
|
||||
QHBoxLayout* layoutMonBox = new QHBoxLayout();
|
||||
layoutMonBox->addStretch(1);
|
||||
//_layout->addWidget(_monBox);
|
||||
layoutMonBox->addWidget(monBox);
|
||||
layoutMonBox->addStretch(1);
|
||||
layoutMainV->addLayout(layoutMonBox);
|
||||
|
||||
monBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
monBox->setFixedSize(400, 340);
|
||||
|
||||
std::vector<QVBoxLayout*> displayLayout = {nullptr, nullptr};
|
||||
std::vector<QFrame*> displayFrame = {nullptr, nullptr};
|
||||
std::vector<Display*> displayWidget = {nullptr, nullptr};
|
||||
|
||||
displayLayout[0] = new QVBoxLayout();
|
||||
displayWidget[0] = new Display(0, monBox, monitorSizeList, 1, showMonitorLabel);
|
||||
displayFrame[0] = new QFrame;
|
||||
displayLayout[0]->addWidget(displayWidget[0]);
|
||||
displayFrame[0]->setLayout(displayLayout[0]);
|
||||
displayFrame[0]->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
|
||||
layoutMainH->addWidget(displayFrame[0]);
|
||||
|
||||
if (monitorSizeList.size() > 1) {
|
||||
displayLayout[1] = new QVBoxLayout();
|
||||
displayWidget[1] = new Display(1, monBox, monitorSizeList, 0, showMonitorLabel);
|
||||
displayFrame[1] = new QFrame;
|
||||
displayLayout[1]->addWidget(displayWidget[1]);
|
||||
displayFrame[1]->setLayout(displayLayout[1]);
|
||||
displayFrame[1]->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
|
||||
layoutMainH->addWidget(displayFrame[1]);
|
||||
}
|
||||
|
||||
layoutMainV->addLayout(layoutMainH);
|
||||
orientationWidget->addButtonToLayout(layoutMainV);
|
||||
FileSupport* fileSupportWidget = new FileSupport(layoutMainV);
|
||||
|
||||
win.setWindowTitle("Window Details");
|
||||
win.show();
|
||||
app.exec();
|
||||
|
||||
delete orientationWidget;
|
||||
for (unsigned int i = 0; i <= 1; ++i) {
|
||||
if (displayWidget[i]) delete displayWidget[i];
|
||||
if (displayLayout[i]) delete displayLayout[i];
|
||||
if (displayFrame[i]) delete displayFrame[i];
|
||||
}
|
||||
if (monitorBorderFrame) {
|
||||
delete monitorBorderFrame;
|
||||
}
|
||||
delete monBox;
|
||||
delete layoutMainH;
|
||||
delete layoutMainV;
|
||||
delete mainWindow;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "monitorbox.h"
|
||||
#include "sgctedit/monitorbox.h"
|
||||
|
||||
|
||||
MonitorBox::MonitorBox(QRect widgetDims, std::vector<QRect> monitorResolution,
|
||||
@@ -21,11 +21,24 @@ void MonitorBox::paintEvent(QPaintEvent *event)
|
||||
QPainter painter(this);
|
||||
QPen pen = painter.pen();
|
||||
painter.setPen(pen);
|
||||
//Draw border
|
||||
painter.setPen(QPen(Qt::gray, 4));
|
||||
painter.drawRoundedRect(0, 0, width() - 1, height() - 1, 10, 10);
|
||||
|
||||
//Draw monitor outline(s)
|
||||
paintWidgetBorder(painter, width(), height());
|
||||
paintMonitorOutlines(painter);
|
||||
|
||||
//Draw window outline(s)
|
||||
for (unsigned int i = 0; i < _nMonitors ; ++i) {
|
||||
for (unsigned int j = 0; j < _nWindows[i]; ++j) {
|
||||
paintWindowOutline(painter, i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MonitorBox::paintWidgetBorder(QPainter& painter, int width, int height) {
|
||||
painter.setPen(QPen(Qt::gray, 4));
|
||||
painter.drawRoundedRect(0, 0, width - 1, height - 1, 10, 10);
|
||||
}
|
||||
|
||||
void MonitorBox::paintMonitorOutlines(QPainter& painter) {
|
||||
painter.setPen(QPen(Qt::black, 2));
|
||||
painter.setFont(QFont("Arial", 14));
|
||||
for (unsigned int i = 0; i < _nMonitors; ++i) {
|
||||
@@ -33,35 +46,65 @@ void MonitorBox::paintEvent(QPaintEvent *event)
|
||||
painter.drawRect(_monitorDimensionsScaled[i]);
|
||||
if (_showLabel) {
|
||||
QPointF textPos = QPointF(_monitorDimensionsScaled[i].left() + 5,
|
||||
_monitorDimensionsScaled[i].bottom() - 5);
|
||||
_monitorDimensionsScaled[i].top() + 18);
|
||||
painter.drawText(textPos, QString::fromStdString(std::to_string(i + 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Draw window outline(s)
|
||||
for (unsigned int i = 0; i < _nMonitors ; ++i) {
|
||||
for (unsigned int j = 0; j < _nWindows[i]; ++j) {
|
||||
if (j == 0) {
|
||||
painter.setPen(QColor(0x1C, 0x1B, 0x8B));
|
||||
}
|
||||
else if (j == 1) {
|
||||
painter.setPen(QColor(0xCD, 0x6D, 0x1D));
|
||||
}
|
||||
if (j <= _windowRendering[i].size()) {
|
||||
painter.drawRect(_windowRendering[i][j]);
|
||||
QPointF textPos = QPointF(_windowRendering[i][j].left() + 5,
|
||||
_windowRendering[i][j].bottom() - 5);
|
||||
textPos.setX(std::clamp(textPos.x(), 0.0, _monitorWidgetSize.width() - 10));
|
||||
textPos.setY(std::clamp(textPos.y(), 0.0, _monitorWidgetSize.height() - 10));
|
||||
painter.drawText(textPos, QString::fromStdString(std::to_string(j + 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MonitorBox::paintWindowOutline(QPainter& painter, unsigned int monIdx,
|
||||
unsigned int winIdx)
|
||||
{
|
||||
setPenSpecificToWindow(painter, winIdx, true);
|
||||
if (winIdx <= _windowRendering[monIdx].size()) {
|
||||
painter.drawRect(_windowRendering[monIdx][winIdx]);
|
||||
//Draw areas of window that are past the monitor boundaries
|
||||
if (_outOfBoundsRect[monIdx][winIdx].size() > 0) {
|
||||
paintOutOfBoundsAreas(painter, monIdx, winIdx);
|
||||
}
|
||||
paintWindowNumber(painter, monIdx, winIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void MonitorBox::paintOutOfBoundsAreas(QPainter& painter, unsigned int monIdx,
|
||||
unsigned int winIdx)
|
||||
{
|
||||
painter.setBrush(Qt::BDiagPattern);
|
||||
setPenSpecificToWindow(painter, winIdx, false);
|
||||
for (QRectF r : _outOfBoundsRect[monIdx][winIdx]) {
|
||||
painter.drawRect(r);
|
||||
}
|
||||
setPenSpecificToWindow(painter, winIdx, true);
|
||||
painter.setBrush(Qt::NoBrush);
|
||||
}
|
||||
|
||||
void MonitorBox::paintWindowNumber(QPainter& painter, unsigned int monIdx,
|
||||
unsigned int winIdx)
|
||||
{
|
||||
QPointF textPos = QPointF(_windowRendering[monIdx][winIdx].left() + 5,
|
||||
_windowRendering[monIdx][winIdx].bottom() - 5);
|
||||
textPos.setX(std::clamp(textPos.x(), 0.0,
|
||||
_monitorWidgetSize.width() - 10));
|
||||
textPos.setY(std::clamp(textPos.y(), 0.0,
|
||||
_monitorWidgetSize.height() - 10));
|
||||
painter.drawText(textPos, QString::fromStdString(std::to_string(winIdx + 1)));
|
||||
}
|
||||
|
||||
void MonitorBox::setPenSpecificToWindow(QPainter& painter, unsigned int windowIdx,
|
||||
bool visibleBorder)
|
||||
{
|
||||
int penWidth = (visibleBorder) ? 1 : -1;
|
||||
if (windowIdx == 0) {
|
||||
painter.setPen(QPen(QColor(0x1C, 0x1B, 0x8B), penWidth));
|
||||
}
|
||||
else if (windowIdx == 1) {
|
||||
painter.setPen(QPen(QColor(0xCD, 0x6D, 0x1D), penWidth));
|
||||
}
|
||||
}
|
||||
|
||||
void MonitorBox::windowDimensionsChanged(unsigned int monitorIdx, unsigned int windowIdx,
|
||||
const QRectF& newDimensions)
|
||||
const QRectF& newDimensions)
|
||||
{
|
||||
mapWindowResolutionToWidgetCoordinates(monitorIdx, windowIdx, newDimensions);
|
||||
}
|
||||
@@ -80,34 +123,11 @@ void MonitorBox::mapMonitorResolutionToWidgetCoordinates() {
|
||||
}
|
||||
float aspectRatio = maxWidth / maxHeight;
|
||||
if (aspectRatio >= 1.0) {
|
||||
_marginWidget = _monitorWidgetSize.width() * _marginFractionOfWidgetSize;
|
||||
float virtualWidth = _monitorWidgetSize.width()
|
||||
* (1.0 - _marginFractionOfWidgetSize * 2.0);
|
||||
_monitorScaleFactor = virtualWidth / maxWidth;
|
||||
float newHeight = virtualWidth / aspectRatio;
|
||||
for (size_t m = 0; m < _monitorResolution.size(); ++m) {
|
||||
_monitorOffsets.push_back({
|
||||
_marginWidget + _monitorResolution[m].x() * _monitorScaleFactor,
|
||||
_marginWidget + (_monitorWidgetSize.height() - newHeight) / 2.0 +
|
||||
_monitorResolution[m].y() * _monitorScaleFactor
|
||||
});
|
||||
}
|
||||
computeScaledResolution_landscape(aspectRatio, maxWidth);
|
||||
}
|
||||
else {
|
||||
_marginWidget = _monitorWidgetSize.height() * _marginFractionOfWidgetSize;
|
||||
float virtualHeight = _monitorWidgetSize.height()
|
||||
* (1.0 - _marginFractionOfWidgetSize * 2.0);
|
||||
_monitorScaleFactor = virtualHeight / maxHeight;
|
||||
float newWidth = virtualHeight * aspectRatio;
|
||||
for (size_t m = 0; m < _monitorResolution.size(); ++m) {
|
||||
_monitorOffsets.push_back({
|
||||
_marginWidget + (_monitorWidgetSize.width() - newWidth) / 2.0
|
||||
+ _monitorResolution[m].x() * _monitorScaleFactor,
|
||||
_marginWidget + _monitorResolution[m].y() * _monitorScaleFactor
|
||||
});
|
||||
}
|
||||
computeScaledResolution_portrait(aspectRatio, maxHeight);
|
||||
}
|
||||
|
||||
for (size_t m = 0; m < _monitorResolution.size(); ++m) {
|
||||
_monitorDimensionsScaled.push_back({
|
||||
_monitorOffsets[m].width(),
|
||||
@@ -119,8 +139,34 @@ void MonitorBox::mapMonitorResolutionToWidgetCoordinates() {
|
||||
this->update();
|
||||
}
|
||||
|
||||
void MonitorBox::setResolution(unsigned int index, QRect& res) {
|
||||
_monitorResolution[index] = res;
|
||||
void MonitorBox::computeScaledResolution_landscape(float aspectRatio, float maxWidth) {
|
||||
_marginWidget = _monitorWidgetSize.width() * _marginFractionOfWidgetSize;
|
||||
float virtualWidth = _monitorWidgetSize.width()
|
||||
* (1.0 - _marginFractionOfWidgetSize * 2.0);
|
||||
_monitorScaleFactor = virtualWidth / maxWidth;
|
||||
float newHeight = virtualWidth / aspectRatio;
|
||||
for (size_t m = 0; m < _monitorResolution.size(); ++m) {
|
||||
_monitorOffsets.push_back({
|
||||
_marginWidget + _monitorResolution[m].x() * _monitorScaleFactor,
|
||||
_marginWidget + (_monitorWidgetSize.height() - newHeight) / 2.0 +
|
||||
_monitorResolution[m].y() * _monitorScaleFactor
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void MonitorBox::computeScaledResolution_portrait(float aspectRatio, float maxHeight) {
|
||||
_marginWidget = _monitorWidgetSize.height() * _marginFractionOfWidgetSize;
|
||||
float virtualHeight = _monitorWidgetSize.height()
|
||||
* (1.0 - _marginFractionOfWidgetSize * 2.0);
|
||||
_monitorScaleFactor = virtualHeight / maxHeight;
|
||||
float newWidth = virtualHeight * aspectRatio;
|
||||
for (size_t m = 0; m < _monitorResolution.size(); ++m) {
|
||||
_monitorOffsets.push_back({
|
||||
_marginWidget + (_monitorWidgetSize.width() - newWidth) / 2.0
|
||||
+ _monitorResolution[m].x() * _monitorScaleFactor,
|
||||
_marginWidget + _monitorResolution[m].y() * _monitorScaleFactor
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void MonitorBox::setNumWindowsDisplayed(unsigned int mIdx, unsigned int nWindows) {
|
||||
@@ -130,6 +176,11 @@ void MonitorBox::setNumWindowsDisplayed(unsigned int mIdx, unsigned int nWindows
|
||||
}
|
||||
}
|
||||
|
||||
void printWindowDims(QRectF& r) {
|
||||
std::cout << r.width() << "x" << r.height() << " + " << r.x() << "," << r.y();
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
void MonitorBox::mapWindowResolutionToWidgetCoordinates(unsigned int mIdx,
|
||||
unsigned int wIdx,
|
||||
const QRectF& w)
|
||||
@@ -144,6 +195,84 @@ void MonitorBox::mapWindowResolutionToWidgetCoordinates(unsigned int mIdx,
|
||||
wF.width() * _monitorScaleFactor,
|
||||
wF.height() * _monitorScaleFactor
|
||||
};
|
||||
_outOfBoundsRect[mIdx][wIdx].clear();
|
||||
computeOutOfBounds_horizontal(mIdx, wIdx);
|
||||
computeOutOfBounds_vertical(mIdx, wIdx);
|
||||
this->update();
|
||||
}
|
||||
|
||||
void MonitorBox::computeOutOfBounds_horizontal(unsigned int mIdx, unsigned int wIdx) {
|
||||
qreal windowWidthPlusOffset = _windowRendering[mIdx][wIdx].width()
|
||||
+ _windowRendering[mIdx][wIdx].x() - _monitorDimensionsScaled[mIdx].x();
|
||||
if (windowWidthPlusOffset > _monitorDimensionsScaled[mIdx].width()) {
|
||||
qreal bounds_x = std::max(
|
||||
_monitorDimensionsScaled[mIdx].width() + _monitorDimensionsScaled[mIdx].x(),
|
||||
_windowRendering[mIdx][wIdx].x()
|
||||
);
|
||||
qreal extent_x = std::min(
|
||||
_windowRendering[mIdx][wIdx].width(),
|
||||
windowWidthPlusOffset - _monitorDimensionsScaled[mIdx].width()
|
||||
);
|
||||
addOutOfBoundsArea_horizontal(mIdx, wIdx, bounds_x, extent_x);
|
||||
}
|
||||
if (_windowRendering[mIdx][wIdx].x() < _monitorDimensionsScaled[mIdx].x() ) {
|
||||
qreal extent_x = std::min(
|
||||
_windowRendering[mIdx][wIdx].width(),
|
||||
_monitorDimensionsScaled[mIdx].x() - _windowRendering[mIdx][wIdx].x()
|
||||
);
|
||||
addOutOfBoundsArea_horizontal(mIdx, wIdx, _windowRendering[mIdx][wIdx].x(),
|
||||
extent_x);
|
||||
}
|
||||
}
|
||||
|
||||
void MonitorBox::addOutOfBoundsArea_horizontal(unsigned int mIdx, unsigned int wIdx,
|
||||
qreal bounds, qreal extent)
|
||||
{
|
||||
_outOfBoundsRect[mIdx][wIdx].push_back({
|
||||
bounds,
|
||||
_windowRendering[mIdx][wIdx].y(),
|
||||
extent,
|
||||
_windowRendering[mIdx][wIdx].height()
|
||||
});
|
||||
}
|
||||
|
||||
void MonitorBox::computeOutOfBounds_vertical(unsigned int mIdx, unsigned int wIdx) {
|
||||
qreal windowHeightPlusOffset = _windowRendering[mIdx][wIdx].height()
|
||||
+ _windowRendering[mIdx][wIdx].y() - _monitorDimensionsScaled[mIdx].y();
|
||||
if (windowHeightPlusOffset > _monitorDimensionsScaled[mIdx].height()) {
|
||||
qreal bounds_y = std::max(
|
||||
_monitorDimensionsScaled[mIdx].height() + _monitorDimensionsScaled[mIdx].y(),
|
||||
_windowRendering[mIdx][wIdx].y()
|
||||
);
|
||||
qreal extent_y = std::min(
|
||||
_windowRendering[mIdx][wIdx].height(),
|
||||
windowHeightPlusOffset - _monitorDimensionsScaled[mIdx].height()
|
||||
);
|
||||
addOutOfBoundsArea_vertical(mIdx, wIdx, bounds_y, extent_y);
|
||||
}
|
||||
if (_windowRendering[mIdx][wIdx].y() < _monitorDimensionsScaled[mIdx].y() ) {
|
||||
qreal extent_y = std::min(
|
||||
_windowRendering[mIdx][wIdx].height(),
|
||||
_monitorDimensionsScaled[mIdx].y() - _windowRendering[mIdx][wIdx].y()
|
||||
);
|
||||
_outOfBoundsRect[mIdx][wIdx].push_back({
|
||||
_windowRendering[mIdx][wIdx].x(),
|
||||
_windowRendering[mIdx][wIdx].y(),
|
||||
_windowRendering[mIdx][wIdx].width(),
|
||||
extent_y
|
||||
});
|
||||
addOutOfBoundsArea_vertical(mIdx, wIdx, _windowRendering[mIdx][wIdx].y(),
|
||||
extent_y);
|
||||
}
|
||||
}
|
||||
|
||||
void MonitorBox::addOutOfBoundsArea_vertical(unsigned int mIdx, unsigned int wIdx,
|
||||
qreal bounds, qreal extent)
|
||||
{
|
||||
_outOfBoundsRect[mIdx][wIdx].push_back({
|
||||
_windowRendering[mIdx][wIdx].x(),
|
||||
bounds,
|
||||
_windowRendering[mIdx][wIdx].width(),
|
||||
extent
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "display.h"
|
||||
#include "orientation.h"
|
||||
#include "orientationdialog.h"
|
||||
#include "sgctedit/display.h"
|
||||
#include "sgctedit/orientation.h"
|
||||
#include "sgctedit/orientationdialog.h"
|
||||
|
||||
Orientation::Orientation() {
|
||||
_layoutOrientationFull = new QHBoxLayout();
|
||||
@@ -13,6 +13,7 @@ Orientation::Orientation() {
|
||||
_layoutOrientationFull->addStretch(1);
|
||||
_layoutOrientationFull->addLayout(_layoutOrientationControls);
|
||||
_layoutOrientationFull->addStretch(1);
|
||||
//_layoutOrientationFull->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
connect(_orientationButton, SIGNAL(released()), this,
|
||||
SLOT(orientationDialog()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "display.h"
|
||||
#include "orientationdialog.h"
|
||||
#include "sgctedit/display.h"
|
||||
#include "sgctedit/orientationdialog.h"
|
||||
|
||||
OrientationDialog::OrientationDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
#include "sgctedit/sgctedit.h"
|
||||
|
||||
/*using namespace openspace;
|
||||
|
||||
namespace {
|
||||
|
||||
}*/
|
||||
|
||||
SgctEdit::SgctEdit(QWidget* parent, QApplication& qtApp)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle("Display/Window Editor");
|
||||
systemMonitorConfiguration(qtApp);
|
||||
createWidgets();
|
||||
}
|
||||
|
||||
void SgctEdit::systemMonitorConfiguration(QApplication& qtApp) {
|
||||
QList<QScreen*> screenList = qtApp.screens();
|
||||
if (screenList.length() == 0) {
|
||||
std::cerr << "Error: Qt reports no screens available." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t s = 0; s < std::min(screenList.length(), 2); ++s) {
|
||||
int actualWidth = std::max(screenList[s]->size().width(),
|
||||
screenList[s]->availableGeometry().width());
|
||||
int actualHeight = std::max(screenList[s]->size().height(),
|
||||
screenList[s]->availableGeometry().height());
|
||||
_monitorSizeList.push_back({
|
||||
screenList[s]->availableGeometry().x(),
|
||||
screenList[s]->availableGeometry().y(),
|
||||
actualWidth,
|
||||
actualHeight
|
||||
});
|
||||
}
|
||||
|
||||
//_monitorSizeList.clear();
|
||||
//_monitorSizeList.push_back({3440, 0, 1920, 1200});
|
||||
//_monitorSizeList.push_back({1080, 0, 1920, 1080});
|
||||
}
|
||||
|
||||
void SgctEdit::createWidgets() {
|
||||
// QApplication app(argc, argv);
|
||||
// QMainWindow win(nullptr);
|
||||
|
||||
// QFrame* monitorBorderFrame = nullptr;
|
||||
|
||||
QVBoxLayout* layoutMainV = new QVBoxLayout(this);
|
||||
QHBoxLayout* layoutMainH = new QHBoxLayout;
|
||||
|
||||
_orientationWidget = new Orientation();
|
||||
// QWidget* mainWindow = new QWidget();
|
||||
// mainWindow->setLayout(layoutMainV);
|
||||
// win.setCentralWidget(mainWindow);
|
||||
|
||||
if (_monitorSizeList.size() > 1) {
|
||||
_monitorWidgetSize = QRect(0, 0, 600, 350);
|
||||
_showMonitorLabel = true;
|
||||
}
|
||||
|
||||
{
|
||||
MonitorBox* monBox = new MonitorBox(
|
||||
_monitorWidgetSize,
|
||||
_monitorSizeList,
|
||||
_showMonitorLabel
|
||||
);
|
||||
QHBoxLayout* layoutMonBox = new QHBoxLayout();
|
||||
layoutMonBox->addStretch(1);
|
||||
//_layout->addWidget(_monBox);
|
||||
layoutMonBox->addWidget(monBox);
|
||||
layoutMonBox->addStretch(1);
|
||||
layoutMainV->addLayout(layoutMonBox);
|
||||
|
||||
monBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
monBox->setFixedSize(_monitorWidgetSize.width(), _monitorWidgetSize.height());
|
||||
|
||||
addDisplayLayout(0, monBox, layoutMainH);
|
||||
if (_monitorSizeList.size() > 1) {
|
||||
addDisplayLayout(1, monBox, layoutMainH);
|
||||
}
|
||||
}
|
||||
//layoutMainH->setSizeConstraint(QLayout::SetFixedSize);
|
||||
layoutMainV->addLayout(layoutMainH);
|
||||
_orientationWidget->addButtonToLayout(layoutMainV);
|
||||
_fileSupportWidget = new FileSupport(layoutMainV);
|
||||
|
||||
// win.setWindowTitle("Window Details");
|
||||
// win.show();
|
||||
// app.exec();
|
||||
}
|
||||
|
||||
void SgctEdit::addDisplayLayout(unsigned int column, MonitorBox* monBox,
|
||||
QHBoxLayout* layout)
|
||||
{
|
||||
_displayLayout[column] = new QVBoxLayout();
|
||||
_displayWidget[column] = new Display(column, monBox, _monitorSizeList,
|
||||
(column == 0) ? 1 : 0, _showMonitorLabel);
|
||||
_displayFrame[column] = new QFrame;
|
||||
_displayLayout[column]->addWidget(_displayWidget[column]);
|
||||
_displayFrame[column]->setLayout(_displayLayout[column]);
|
||||
_displayFrame[column]->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
|
||||
layout->addWidget(_displayFrame[column]);
|
||||
}
|
||||
|
||||
SgctEdit::~SgctEdit() {
|
||||
delete _orientationWidget;
|
||||
delete _fileSupportWidget;
|
||||
/* for (unsigned int i = 0; i <= 1; ++i) {
|
||||
if (displayWidget[i]) delete displayWidget[i];
|
||||
if (displayLayout[i]) delete displayLayout[i];
|
||||
if (displayFrame[i]) delete displayFrame[i];
|
||||
}
|
||||
if (monitorBorderFrame) {
|
||||
delete monitorBorderFrame;
|
||||
}
|
||||
delete monBox;
|
||||
delete layoutMonBox;
|
||||
delete layoutMainH;
|
||||
delete layoutMainV;
|
||||
delete mainWindow;*/
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "display.h"
|
||||
#include "monitorbox.h"
|
||||
#include "windowcontrol.h"
|
||||
#include "sgctedit/display.h"
|
||||
#include "sgctedit/monitorbox.h"
|
||||
#include "sgctedit/windowcontrol.h"
|
||||
|
||||
WindowControl::WindowControl(unsigned int monitorIndex, unsigned int windowIndex,
|
||||
QRect& widgetDims, QRect& monitorDims, QWidget *parent)
|
||||
@@ -23,13 +23,13 @@ WindowControl::WindowControl(unsigned int monitorIndex, unsigned int windowIndex
|
||||
QIntValidator* _validatorSize_y
|
||||
= new QIntValidator(10, _maxWindowSizePixels);
|
||||
QIntValidator* _validatorOffset_x
|
||||
= new QIntValidator(10, _maxWindowSizePixels);
|
||||
= new QIntValidator(-_maxWindowSizePixels, _maxWindowSizePixels);
|
||||
QIntValidator* _validatorOffset_y
|
||||
= new QIntValidator(10, _maxWindowSizePixels);
|
||||
= new QIntValidator(-_maxWindowSizePixels, _maxWindowSizePixels);
|
||||
_size_x->setValidator(_validatorSize_x);
|
||||
_size_y->setValidator(_validatorSize_y);
|
||||
_offset_x->setValidator(_validatorSize_y);
|
||||
_offset_y->setValidator(_validatorSize_y);
|
||||
_offset_x->setValidator(_validatorOffset_x);
|
||||
_offset_y->setValidator(_validatorOffset_y);
|
||||
|
||||
_fullscreenButton = new QPushButton(this);
|
||||
_fullscreenButton->setText("Set to Fullscreen");
|
||||
@@ -60,8 +60,6 @@ WindowControl::WindowControl(unsigned int monitorIndex, unsigned int windowIndex
|
||||
|
||||
connect(_comboProjection, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(onProjectionChanged(int)));
|
||||
connect(_comboQuality, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(onQualityChanged(int)));
|
||||
|
||||
connect(_fullscreenButton, SIGNAL(released()), this, SLOT(onFullscreenClicked()));
|
||||
}
|
||||
@@ -73,7 +71,6 @@ QVBoxLayout* WindowControl::initializeLayout(QWidget* parentWidget) {
|
||||
|
||||
_labelWinNum = new QLabel();
|
||||
_labelWinNum->setText("Window " + QString::number(_index + 1));
|
||||
// _labelWinNum->setStyleSheet("QLabel { color : blue; }");
|
||||
if (_index == 1) {
|
||||
_labelWinNum->setStyleSheet("QLabel { color : #CD6D1D; }");
|
||||
}
|
||||
@@ -92,7 +89,6 @@ QVBoxLayout* WindowControl::initializeLayout(QWidget* parentWidget) {
|
||||
_labelName->setText("Window Name: ");
|
||||
_windowName = new QLineEdit(this);
|
||||
_windowName->setFixedWidth(100);
|
||||
// _layoutName->addStretch(1);
|
||||
_layoutName->addWidget(_labelName);
|
||||
_layoutName->addWidget(_windowName);
|
||||
_layoutName->addStretch(1);
|
||||
@@ -101,26 +97,16 @@ QVBoxLayout* WindowControl::initializeLayout(QWidget* parentWidget) {
|
||||
_size_y->setFixedWidth(_lineEditWidthFixed);
|
||||
_labelSize = new QLabel(this);
|
||||
_labelDelim = new QLabel(this);
|
||||
QGridLayout* _layoutSize = new QGridLayout;
|
||||
//_layoutSize = new QHBoxLayout();
|
||||
//_layoutSize->addStretch(1);
|
||||
// _layoutSize->addRow(_labelSize, _size_x, _labelDelim, _size_y);
|
||||
_layoutSize->addWidget(_labelSize, 0, 0);
|
||||
_layoutGridSizeValues = new QHBoxLayout();
|
||||
_layoutGridSizeValues->addWidget(_size_x);
|
||||
_layoutGridSizeValues->addWidget(_labelDelim);
|
||||
_layoutGridSizeValues->addWidget(_size_y);
|
||||
_layoutGridSizeValues->addStretch(1);
|
||||
_layoutSize->addLayout(_layoutGridSizeValues, 0, 1);
|
||||
// _layoutSize->addWidget(_labelSize);
|
||||
//_labelSize->setFixedWidth(50);
|
||||
_layoutSize = new QHBoxLayout();
|
||||
_layoutSize->addWidget(_labelSize);
|
||||
_labelSize->setText("Size:");
|
||||
// _layoutSize->addWidget(_size_x);
|
||||
// _layoutSize->addWidget(_labelDelim);
|
||||
// _layoutSize->addWidget(_size_y);
|
||||
// _layoutSize->addStretch(1);
|
||||
_labelSize->setFixedWidth(55);
|
||||
_layoutSize->addWidget(_size_x);
|
||||
_layoutSize->addWidget(_labelDelim);
|
||||
_layoutSize->addWidget(_size_y);
|
||||
_layoutSize->addStretch(1);
|
||||
_labelDelim->setText("x");
|
||||
_labelDelim->setFixedWidth(10);
|
||||
_labelDelim->setFixedWidth(7);
|
||||
_layoutWindowCtrl->addLayout(_layoutSize);
|
||||
|
||||
//Window offset
|
||||
@@ -128,68 +114,45 @@ QVBoxLayout* WindowControl::initializeLayout(QWidget* parentWidget) {
|
||||
_offset_y->setFixedWidth(_lineEditWidthFixed);
|
||||
_labelOffset = new QLabel(this);
|
||||
_labelComma = new QLabel(this);
|
||||
// _layoutOffset = new QHBoxLayout();
|
||||
// _layoutOffset->addStretch(1);
|
||||
// _layoutOffset->addWidget(_labelOffset);
|
||||
// _layoutSize->addRow(_labelOffset, _offset_x, _labelComma, _offset_y);
|
||||
_layoutSize->addWidget(_labelOffset, 1, 0);
|
||||
_layoutGridOffsetValues = new QHBoxLayout();
|
||||
_layoutGridOffsetValues->addWidget(_offset_x);
|
||||
_layoutGridOffsetValues->addWidget(_labelComma);
|
||||
_layoutGridOffsetValues->addWidget(_offset_y);
|
||||
_layoutGridOffsetValues->addStretch(1);
|
||||
_layoutSize->addLayout(_layoutGridOffsetValues, 1, 1);
|
||||
//_labelOffset->setFixedWidth(50);
|
||||
_layoutOffset = new QHBoxLayout();
|
||||
_layoutOffset->addWidget(_labelOffset);
|
||||
_labelOffset->setText("Offset:");
|
||||
// _layoutOffset->addWidget(_offset_x);
|
||||
// _layoutOffset->addWidget(_labelComma);
|
||||
// _layoutOffset->addWidget(_offset_y);
|
||||
// _layoutOffset->addStretch(1);
|
||||
_labelOffset->setFixedWidth(55);
|
||||
_layoutOffset->addWidget(_offset_x);
|
||||
_layoutOffset->addWidget(_labelComma);
|
||||
_layoutOffset->addWidget(_offset_y);
|
||||
_layoutOffset->addStretch(1);
|
||||
_labelComma->setText(",");
|
||||
_labelComma->setFixedWidth(10);
|
||||
_layoutGridFrame = new QHBoxLayout();
|
||||
_layoutGridFrame->addStretch(1);
|
||||
_layoutGridFrame->addLayout(_layoutSize);
|
||||
_layoutGridFrame->addStretch(1);
|
||||
|
||||
_layoutWindowCtrl->addLayout(_layoutGridFrame);
|
||||
_labelComma->setFixedWidth(7);
|
||||
_layoutWindowCtrl->addLayout(_layoutOffset);
|
||||
|
||||
//Window options
|
||||
_layoutCheckboxesFull1 = new QHBoxLayout();
|
||||
_layoutCheckboxesFull2 = new QVBoxLayout();
|
||||
// _layoutCheckboxesFull1->addStretch(1);
|
||||
_layoutFullscreenButton = new QHBoxLayout();
|
||||
//_layoutFullscreenButton->addStretch(1);
|
||||
_layoutFullscreenButton->addWidget(_fullscreenButton);
|
||||
_layoutFullscreenButton->addStretch(1);
|
||||
_layoutCheckboxesFull2->addLayout(_layoutFullscreenButton);
|
||||
|
||||
_layoutCBoxWindowDecor = new QHBoxLayout();
|
||||
//_layoutCBoxWindowDecor->addStretch(1);
|
||||
_layoutCBoxWindowDecor->addWidget(_checkBoxWindowDecor);
|
||||
_layoutCBoxWindowDecor->addStretch(1);
|
||||
_layoutCheckboxesFull2->addLayout(_layoutCBoxWindowDecor);
|
||||
_layoutCBoxWebGui= new QHBoxLayout();
|
||||
//_layoutCBoxWebGui->addStretch(1);
|
||||
_layoutCBoxWebGui->addWidget(_checkBoxWebGui);
|
||||
_layoutCBoxWebGui->addStretch(1);
|
||||
_layoutCheckboxesFull2->addLayout(_layoutCBoxWebGui);
|
||||
_layoutCBoxSpoutOutput= new QHBoxLayout();
|
||||
//_layoutCBoxSpoutOutput->addStretch(1);
|
||||
_layoutCBoxSpoutOutput->addWidget(_checkBoxSpoutOutput);
|
||||
_layoutCBoxSpoutOutput->addStretch(1);
|
||||
_layoutCheckboxesFull2->addLayout(_layoutCBoxSpoutOutput);
|
||||
|
||||
_layoutComboProjection = new QHBoxLayout();
|
||||
_layoutComboProjection->addWidget(_comboProjection);
|
||||
_layoutComboProjection->addStretch(1);
|
||||
_layoutCheckboxesFull2->addLayout(_layoutComboProjection);
|
||||
|
||||
_layoutComboQuality = new QHBoxLayout();
|
||||
_layoutComboQuality->addWidget(_comboQuality);
|
||||
_layoutComboQuality->addStretch(1);
|
||||
_layoutCheckboxesFull2->addLayout(_layoutComboQuality);
|
||||
|
||||
_layoutFov = new QHBoxLayout();
|
||||
_labelFov = new QLabel();
|
||||
_labelFov->setText("Horizontal FOV:");
|
||||
@@ -208,7 +171,6 @@ QVBoxLayout* WindowControl::initializeLayout(QWidget* parentWidget) {
|
||||
_layoutHeightOffsetWrapper = new QWidget();
|
||||
_layoutHeightOffsetWrapper->setLayout(_layoutHeightOffset);
|
||||
_layoutCheckboxesFull2->addWidget(_layoutHeightOffsetWrapper);
|
||||
|
||||
_layoutCheckboxesFull1->addLayout(_layoutCheckboxesFull2);
|
||||
_layoutCheckboxesFull1->addStretch(1);
|
||||
_layoutWindowCtrl->addLayout(_layoutCheckboxesFull1);
|
||||
@@ -217,7 +179,6 @@ QVBoxLayout* WindowControl::initializeLayout(QWidget* parentWidget) {
|
||||
_comboProjection->setCurrentIndex(0);
|
||||
onProjectionChanged(0);
|
||||
_comboQuality->setCurrentIndex(2);
|
||||
onQualityChanged(2);
|
||||
|
||||
return _layoutFullWindow;
|
||||
}
|
||||
@@ -329,23 +290,16 @@ void WindowControl::onProjectionChanged(int newSelection) {
|
||||
}
|
||||
}
|
||||
|
||||
void WindowControl::onQualityChanged(int newSelection) {
|
||||
}
|
||||
|
||||
void WindowControl::setDimensions(const QRectF& dimensions) {
|
||||
_windowDims = dimensions;
|
||||
}
|
||||
|
||||
void WindowControl::setWindowChangeCallback(
|
||||
std::function<void(unsigned int, unsigned int, const QRectF&)> cb)
|
||||
std::function<void(int, int, const QRectF&)> cb)
|
||||
{
|
||||
_windowChangeCallback = cb;
|
||||
}
|
||||
|
||||
void WindowControl::setWindowScaleFactor(float scaleFactor) {
|
||||
_monitorScaleFactor = scaleFactor;
|
||||
}
|
||||
|
||||
QRectF& WindowControl::dimensions() {
|
||||
return _windowDims;
|
||||
}
|
||||
@@ -391,20 +345,19 @@ WindowControl::~WindowControl()
|
||||
delete _layoutName;
|
||||
delete _labelName;
|
||||
delete _windowName;
|
||||
delete _labelWinNum;
|
||||
delete _labelSize;
|
||||
delete _labelDelim;
|
||||
delete _layoutSize;
|
||||
delete _labelOffset;
|
||||
delete _labelComma;
|
||||
// delete _layoutOffset;
|
||||
delete _layoutGridFrame;
|
||||
delete _layoutGridSizeValues;
|
||||
delete _layoutGridOffsetValues;
|
||||
delete _layoutOffset;
|
||||
delete _checkBoxWindowDecor;
|
||||
delete _checkBoxWebGui;
|
||||
delete _checkBoxSpoutOutput;
|
||||
delete _comboProjection;
|
||||
delete _comboQuality;
|
||||
delete _fullscreenButton;
|
||||
delete _labelFov;
|
||||
delete _lineFov;
|
||||
delete _validatorFov;
|
||||
@@ -423,6 +376,8 @@ WindowControl::~WindowControl()
|
||||
delete _layoutHeightOffsetWrapper;
|
||||
delete _layoutCheckboxesFull2;
|
||||
delete _layoutCheckboxesFull1;
|
||||
delete _layoutWinNum;
|
||||
delete _layoutWindowCtrl;
|
||||
delete _layoutFullWindow;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user