mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix ios build
This commit is contained in:
parent
bcc335e0a8
commit
26ee9c8ece
@ -119,6 +119,39 @@ void CSettingsView::fillValidResolutions()
|
||||
fillValidResolutionsForScreen(ui->comboBoxDisplayIndex->isVisible() ? ui->comboBoxDisplayIndex->currentIndex() : 0);
|
||||
}
|
||||
|
||||
QSize CSettingsView::getPreferredRenderingResolution()
|
||||
{
|
||||
#ifndef VCMI_MOBILE
|
||||
bool fullscreen = settings["video"]["fullscreen"].Bool();
|
||||
bool realFullscreen = settings["video"]["realFullscreen"].Bool();
|
||||
|
||||
if (!fullscreen || realFullscreen)
|
||||
{
|
||||
int resX = settings["video"]["resolution"]["width"].Integer();
|
||||
int resY = settings["video"]["resolution"]["height"].Integer();
|
||||
return QSize(resX, resY);
|
||||
}
|
||||
#endif
|
||||
return QApplication::primaryScreen()->geometry().size();
|
||||
}
|
||||
|
||||
void CSettingsView::fillValidScalingRange()
|
||||
{
|
||||
//FIXME: this code is copy of ScreenHandler::getSupportedScalingRange
|
||||
|
||||
// H3 resolution, any resolution smaller than that is not correctly supported
|
||||
static const QSize minResolution = {800, 600};
|
||||
// arbitrary limit on *downscaling*. Allow some downscaling, if requested by user. Should be generally limited to 100+ for all but few devices
|
||||
static const double minimalScaling = 50;
|
||||
|
||||
QSize renderResolution = getPreferredRenderingResolution();
|
||||
double maximalScalingWidth = 100.0 * renderResolution.width() / minResolution.width();
|
||||
double maximalScalingHeight = 100.0 * renderResolution.height() / minResolution.height();
|
||||
double maximalScaling = std::min(maximalScalingWidth, maximalScalingHeight);
|
||||
|
||||
ui->spinBoxInterfaceScaling->setRange(minimalScaling, maximalScaling);
|
||||
}
|
||||
|
||||
#ifndef VCMI_MOBILE
|
||||
|
||||
static QVector<QSize> findAvailableResolutions(int displayIndex)
|
||||
@ -153,39 +186,6 @@ static QVector<QSize> findAvailableResolutions(int displayIndex)
|
||||
return result;
|
||||
}
|
||||
|
||||
QSize CSettingsView::getPreferredRenderingResolution()
|
||||
{
|
||||
#ifndef VCMI_MOBILE
|
||||
bool fullscreen = settings["video"]["fullscreen"].Bool();
|
||||
bool realFullscreen = settings["video"]["realFullscreen"].Bool();
|
||||
|
||||
if (!fullscreen || realFullscreen)
|
||||
{
|
||||
int resX = settings["video"]["resolution"]["width"].Integer();
|
||||
int resY = settings["video"]["resolution"]["height"].Integer();
|
||||
return QSize(resX, resY);
|
||||
}
|
||||
#endif
|
||||
return QApplication::primaryScreen()->geometry().size();
|
||||
}
|
||||
|
||||
void CSettingsView::fillValidScalingRange()
|
||||
{
|
||||
//FIXME: this code is copy of ScreenHandler::getSupportedScalingRange
|
||||
|
||||
// H3 resolution, any resolution smaller than that is not correctly supported
|
||||
static const QSize minResolution = {800, 600};
|
||||
// arbitrary limit on *downscaling*. Allow some downscaling, if requested by user. Should be generally limited to 100+ for all but few devices
|
||||
static const double minimalScaling = 50;
|
||||
|
||||
QSize renderResolution = getPreferredRenderingResolution();
|
||||
double maximalScalingWidth = 100.0 * renderResolution.width() / minResolution.width();
|
||||
double maximalScalingHeight = 100.0 * renderResolution.height() / minResolution.height();
|
||||
double maximalScaling = std::min(maximalScalingWidth, maximalScalingHeight);
|
||||
|
||||
ui->spinBoxInterfaceScaling->setRange(minimalScaling, maximalScaling);
|
||||
}
|
||||
|
||||
void CSettingsView::fillValidResolutionsForScreen(int screenIndex)
|
||||
{
|
||||
ui->comboBoxResolution->blockSignals(true); // avoid saving wrong resolution after adding first item from the list
|
||||
|
Loading…
Reference in New Issue
Block a user