mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 20:44:14 +02:00
add debug details to HMDTools
This commit is contained in:
parent
821cf46ee9
commit
59eeeb9006
2 changed files with 43 additions and 4 deletions
|
@ -44,20 +44,52 @@ HMDToolsDialog::HMDToolsDialog(QWidget* parent) :
|
|||
form->addRow("", leaveModeButton);
|
||||
connect(leaveModeButton,SIGNAL(clicked(bool)),this,SLOT(leaveModeClicked(bool)));
|
||||
|
||||
// Create a label with debug details...
|
||||
_debugDetails = new QLabel();
|
||||
_debugDetails->setText(getDebugDetails());
|
||||
const int WIDTH = 350;
|
||||
const int HEIGHT = 100;
|
||||
_debugDetails->setFixedSize(WIDTH, HEIGHT);
|
||||
form->addRow("", _debugDetails);
|
||||
|
||||
this->QDialog::setLayout(form);
|
||||
|
||||
|
||||
_wasMoved = false;
|
||||
|
||||
_previousRect = Application::getInstance()->getWindow()->rect();
|
||||
|
||||
|
||||
Application::getInstance()->getWindow()->activateWindow();
|
||||
|
||||
QWindow* mainWindow = Application::getInstance()->getWindow()->windowHandle();
|
||||
connect(mainWindow, &QWindow::screenChanged, this, &HMDToolsDialog::applicationWindowScreenChanged);
|
||||
}
|
||||
|
||||
HMDToolsDialog::~HMDToolsDialog() {
|
||||
}
|
||||
|
||||
void HMDToolsDialog::applicationWindowScreenChanged(QScreen* screen) {
|
||||
_debugDetails->setText(getDebugDetails());
|
||||
}
|
||||
|
||||
QString HMDToolsDialog::getDebugDetails() const {
|
||||
QString results;
|
||||
|
||||
int hmdScreenNumber = OculusManager::getHMDScreen();
|
||||
if (hmdScreenNumber > 0) {
|
||||
results += "HMD Screen: " + QGuiApplication::screens()[hmdScreenNumber]->name() + "\n";
|
||||
} else {
|
||||
results += "HMD Screen Name: Unknown\n";
|
||||
}
|
||||
|
||||
int desktopPrimaryScreenNumber = QApplication::desktop()->primaryScreen();
|
||||
QScreen* desktopPrimaryScreen = QGuiApplication::screens()[desktopPrimaryScreenNumber];
|
||||
results += "Desktop's Primary Screen: " + desktopPrimaryScreen->name() + "\n";
|
||||
|
||||
results += "Application Primary Screen: " + QGuiApplication::primaryScreen()->name() + "\n";
|
||||
QScreen* mainWindowScreen = Application::getInstance()->getWindow()->windowHandle()->screen();
|
||||
results += "Application Main Window Screen: " + mainWindowScreen->name() + "\n";
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
void HMDToolsDialog::enterModeClicked(bool checked) {
|
||||
int hmdScreen = OculusManager::getHMDScreen();
|
||||
|
||||
|
@ -74,6 +106,9 @@ void HMDToolsDialog::enterModeClicked(bool checked) {
|
|||
mainWindow->setGeometry(rect);
|
||||
|
||||
_wasMoved = true;
|
||||
} else {
|
||||
// if we're on a single screen setup, then hide our tools window when entering HMD mode
|
||||
hide();
|
||||
}
|
||||
Application::getInstance()->setFullscreen(true);
|
||||
Application::getInstance()->setEnableVRMode(true);
|
||||
|
|
|
@ -20,6 +20,8 @@ public:
|
|||
// Sets up the UI
|
||||
HMDToolsDialog(QWidget* parent);
|
||||
~HMDToolsDialog();
|
||||
|
||||
QString getDebugDetails() const;
|
||||
|
||||
signals:
|
||||
void closed();
|
||||
|
@ -30,6 +32,7 @@ public slots:
|
|||
void leaveModeClicked(bool checked);
|
||||
void activateWindowAfterEnterMode();
|
||||
void moveWindowAfterLeaveMode();
|
||||
void applicationWindowScreenChanged(QScreen* screen);
|
||||
|
||||
protected:
|
||||
// Emits a 'closed' signal when this dialog is closed.
|
||||
|
@ -40,6 +43,7 @@ private:
|
|||
QRect _previousRect;
|
||||
QScreen* _previousScreen;
|
||||
QScreen* _hmdScreen;
|
||||
QLabel* _debugDetails;
|
||||
};
|
||||
|
||||
#endif // hifi_HMDToolsDialog_h
|
||||
|
|
Loading…
Reference in a new issue