mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +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; }
|
||||
sGui->showHelp(this);
|
||||
});
|
||||
|
||||
this->setScreenGeometry();
|
||||
}
|
||||
|
||||
CConfigurationWizard::~CConfigurationWizard()
|
||||
@@ -126,5 +128,23 @@ namespace BlackGui
|
||||
if (CMathUtils::epsilonEqual(parent->windowOpacity(), opacity)) { return; }
|
||||
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
|
||||
|
||||
@@ -71,6 +71,9 @@ namespace BlackGui
|
||||
//! Set the parent's window opacity
|
||||
void setParentOpacity(qreal opacity);
|
||||
|
||||
//! Set screen geometry based on screen resolution
|
||||
void setScreenGeometry();
|
||||
|
||||
QScopedPointer<Ui::CConfigurationWizard> ui;
|
||||
int m_previousId = -1;
|
||||
int m_minId = -1;
|
||||
|
||||
Reference in New Issue
Block a user