mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-09 05:28:09 +08:00
Use screen geometry to configure screen size
This commit is contained in:
@@ -62,6 +62,8 @@ namespace BlackGui
|
|||||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||||
sGui->showHelp(this);
|
sGui->showHelp(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this->setScreenGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfigurationWizard::~CConfigurationWizard()
|
CConfigurationWizard::~CConfigurationWizard()
|
||||||
@@ -126,5 +128,23 @@ namespace BlackGui
|
|||||||
if (CMathUtils::epsilonEqual(parent->windowOpacity(), opacity)) { return; }
|
if (CMathUtils::epsilonEqual(parent->windowOpacity(), opacity)) { return; }
|
||||||
parent->setWindowOpacity(opacity);
|
parent->setWindowOpacity(opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CConfigurationWizard::setScreenGeometry()
|
||||||
|
{
|
||||||
|
if (!sGui) { return; }
|
||||||
|
const QRect g = CGuiApplication::currentScreenGeometry();
|
||||||
|
|
||||||
|
// 1280/720 on 4k hires
|
||||||
|
// 1920/1280 on non hires 1920 displays
|
||||||
|
const int gw = g.width();
|
||||||
|
const int gh = g.height();
|
||||||
|
const int calcW = qRound(gw * 0.8);
|
||||||
|
const int calcH = qRound(gh * 0.9); // normally critical as buttons are hidden
|
||||||
|
|
||||||
|
// do not get too huge
|
||||||
|
const int w = qMin(900, calcW);
|
||||||
|
const int h = qMin(750, calcH);
|
||||||
|
this->resize(w, h);
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ namespace BlackGui
|
|||||||
//! Set the parent's window opacity
|
//! Set the parent's window opacity
|
||||||
void setParentOpacity(qreal opacity);
|
void setParentOpacity(qreal opacity);
|
||||||
|
|
||||||
|
//! Set screen geometry based on screen resolution
|
||||||
|
void setScreenGeometry();
|
||||||
|
|
||||||
QScopedPointer<Ui::CConfigurationWizard> ui;
|
QScopedPointer<Ui::CConfigurationWizard> ui;
|
||||||
int m_previousId = -1;
|
int m_previousId = -1;
|
||||||
int m_minId = -1;
|
int m_minId = -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user