mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +02:00
Launcher now controls ttf fonts usage directly instead of toggling mod
from extras
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "../render/ColorFilter.h"
|
||||
#include "../render/IScreenHandler.h"
|
||||
|
||||
#include "../../lib/CConfigHandler.h"
|
||||
#include "../../lib/json/JsonUtils.h"
|
||||
#include "../../lib/filesystem/Filesystem.h"
|
||||
#include "../../lib/VCMIDirs.h"
|
||||
@@ -352,7 +353,7 @@ std::shared_ptr<const IFont> RenderHandler::loadFont(EFonts font)
|
||||
|
||||
std::shared_ptr<const IFont> loadedFont;
|
||||
|
||||
if (ttfConf[filename].isNull())
|
||||
if(ttfConf[filename].isNull() || settings["video"]["scalableFonts"].Bool() == false)
|
||||
loadedFont = std::make_shared<CBitmapFont>(filename);
|
||||
else
|
||||
loadedFont = std::make_shared<CTrueTypeFont>(ttfConf[filename]);
|
||||
|
@@ -166,6 +166,7 @@
|
||||
"showfps",
|
||||
"targetfps",
|
||||
"vsync",
|
||||
"scalableFonts",
|
||||
"upscalingFilter",
|
||||
"fontUpscalingFilter",
|
||||
"downscalingFilter"
|
||||
@@ -232,6 +233,10 @@
|
||||
"type" : "boolean",
|
||||
"default" : true
|
||||
},
|
||||
"scalableFonts" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
"fontUpscalingFilter" : {
|
||||
"type" : "string",
|
||||
"enum" : [ "nearest", "bilinear", "xbrz" ],
|
||||
|
@@ -175,17 +175,6 @@ void CSettingsView::loadSettings()
|
||||
ui->lineEditGameLobbyHost->setText(QString::fromStdString(settings["lobby"]["hostname"].String()));
|
||||
ui->spinBoxNetworkPortLobby->setValue(settings["lobby"]["port"].Integer());
|
||||
|
||||
auto mainWindow = getMainWindow();
|
||||
if(mainWindow)
|
||||
{
|
||||
bool fontModAvailable = mainWindow->getModView()->isModInstalled("vcmi-extras.truetypefonts");
|
||||
if(!fontModAvailable)
|
||||
{
|
||||
ui->labelTtfFont->hide();
|
||||
ui->buttonTtfFont->hide();
|
||||
}
|
||||
}
|
||||
|
||||
loadToggleButtonSettings();
|
||||
}
|
||||
|
||||
@@ -206,13 +195,11 @@ void CSettingsView::loadToggleButtonSettings()
|
||||
setCheckbuttonState(ui->buttonRelativeCursorMode, settings["general"]["userRelativePointer"].Bool());
|
||||
setCheckbuttonState(ui->buttonHapticFeedback, settings["general"]["hapticFeedback"].Bool());
|
||||
|
||||
setCheckbuttonState(ui->buttonTtfFont, settings["video"]["scalableFonts"].Bool());
|
||||
|
||||
std::string cursorType = settings["video"]["cursor"].String();
|
||||
int cursorTypeIndex = vstd::find_pos(cursorTypesList, cursorType);
|
||||
setCheckbuttonState(ui->buttonCursorType, cursorTypeIndex);
|
||||
|
||||
auto mainWindow = getMainWindow();
|
||||
if(mainWindow)
|
||||
setCheckbuttonState(ui->buttonTtfFont, mainWindow->getModView()->isModEnabled("vcmi-extras.truetypefonts"));
|
||||
}
|
||||
|
||||
void CSettingsView::fillValidResolutions()
|
||||
@@ -772,10 +759,7 @@ void CSettingsView::on_sliderControllerSticksSensitivity_valueChanged(int value)
|
||||
|
||||
void CSettingsView::on_buttonTtfFont_toggled(bool value)
|
||||
{
|
||||
auto mainWindow = getMainWindow();
|
||||
if(value)
|
||||
mainWindow->getModView()->enableModByName("vcmi-extras.truetypefonts");
|
||||
else
|
||||
mainWindow->getModView()->disableModByName("vcmi-extras.truetypefonts");
|
||||
Settings node = settings.write["video"]["scalableFonts"];
|
||||
node->Bool() = value;
|
||||
updateCheckbuttonText(ui->buttonTtfFont);
|
||||
}
|
||||
|
Reference in New Issue
Block a user