diff --git a/Editor/editing/_scenes/level/lvl_item_placing.cpp b/Editor/editing/_scenes/level/lvl_item_placing.cpp index 3ced2cf5b..1f75baaf4 100644 --- a/Editor/editing/_scenes/level/lvl_item_placing.cpp +++ b/Editor/editing/_scenes/level/lvl_item_placing.cpp @@ -768,18 +768,13 @@ void LvlScene::setLabelBoxItem(bool show, QPointF pos, QString text) if(!show) return; - QFont font; - font.setFamily("Times"); - font.setWeight(QFont::Black); - font.setPointSize(25); m_labelBox = new QGraphicsSimpleTextItem(text); - m_labelBox->setPen(QPen(QBrush(Qt::black), 2)); - m_labelBox->setBrush(QBrush(Qt::white)); + m_labelBox->setPen(GlobalSettings::LvlOpts.labelBoxPen); + m_labelBox->setBrush(GlobalSettings::LvlOpts.labelBoxBrush); m_labelBox->setBoundingRegionGranularity(1); m_labelBox->setZValue(10000); - m_labelBox->setFont(font); + m_labelBox->setFont(GlobalSettings::LvlOpts.labelBoxFont); this->addItem(m_labelBox); m_labelBox->setPos(pos); } - } diff --git a/Editor/editing/_scenes/world/wld_item_placing.cpp b/Editor/editing/_scenes/world/wld_item_placing.cpp index b4f85712a..73fba281b 100644 --- a/Editor/editing/_scenes/world/wld_item_placing.cpp +++ b/Editor/editing/_scenes/world/wld_item_placing.cpp @@ -702,18 +702,13 @@ void WldScene::setMessageBoxItem(bool show, QPointF pos, QString text) if(!show) return; - QFont font; - font.setFamily("Times"); - font.setWeight(QFont::Black); - font.setPointSize(25); m_labelBox = new QGraphicsSimpleTextItem(text); - m_labelBox->setPen(QPen(QBrush(Qt::black), 2)); - m_labelBox->setBrush(QBrush(Qt::white)); + m_labelBox->setPen(GlobalSettings::LvlOpts.labelBoxPen); + m_labelBox->setBrush(GlobalSettings::LvlOpts.labelBoxBrush); m_labelBox->setBoundingRegionGranularity(1); m_labelBox->setZValue(10000); - m_labelBox->setFont(font); + m_labelBox->setFont(GlobalSettings::LvlOpts.labelBoxFont); this->addItem(m_labelBox); m_labelBox->setPos(pos); } - } diff --git a/Editor/languages/editor_zh.ts b/Editor/languages/editor_zh.ts index 52d663b02..a67b861e7 100644 --- a/Editor/languages/editor_zh.ts +++ b/Editor/languages/editor_zh.ts @@ -200,7 +200,7 @@ like when choosing an item from the item toolbox or from the tileset item box. Generator - 连续出现 + 生成器 Type: @@ -371,7 +371,7 @@ like when choosing an item from the item toolbox or from the tileset item box. Opacity Opacity of locked items (label text) - 透明度 + 锁定对象透明度 Defines the opacity level that will be applied to all locked elements of the scene. @@ -3317,7 +3317,7 @@ Suggested to remove all excess elements. Do you want to continue the process? 已超出 SMBX64 标准! %1 -, SMBX 1.3 引擎可能异常终止! +,SMBX 1.3 引擎可能异常终止! 建议移除所有超出部分的对象。 您要继续吗? @@ -3544,7 +3544,7 @@ Do you want to continue? LvlEventsBox Classic Events - 传统事件 + 事件 Events list @@ -3990,7 +3990,7 @@ This option using the SMBX's bug of BGO rendering. For this can be works, y Generator - 连续出现 + 生成器 Type: @@ -4959,7 +4959,7 @@ Please, select necessary world map in a list: Create the duplicate warp entry with same settings (except for already placed points) - 使用当前设置新建传送点(已放置的地点除外) + 使用当前设置创建传送点(已放置的地点除外) Apply to all @@ -5086,7 +5086,7 @@ show the current playable character(s) and number of lives. Warps and Doors - 传送和门 + 传送点 Events @@ -5346,7 +5346,7 @@ show the current playable character(s) and number of lives. Restart level after fail - 死后重新开始关卡 + 通关失败之后重新开始 Select and Move @@ -6304,7 +6304,7 @@ Please save the file first. Warps and Doors Vanilla-like toolbar - 传送和门 + 传送点 Water @@ -7203,7 +7203,7 @@ Error description: Restart after fail - 死后重新开始当前关卡 + 通关失败之后重新开始当前关卡 Total stars @@ -7345,51 +7345,51 @@ File: %1 SMBX64 standard isn't allows to save %1 section The maximum number of sections is %2. All boundaries and settings of more than 21 sections will be lost. - SMBX64 标准不允许保存 %1 个场景, + 在 SMBX64 标准下,不允许保存 %1 个场景。 场景数量上限为 %2, -如果你继续保存该格式的文件, -所有超过 21 的场景设置将会丢失。 +如果你继续保存为该格式的文件, +所有超过 21 的场景的内容都将丢失。 SMBX64 standard isn't allows to save %1 blocks The maximum number of blocks is %2. - SMBX64 标准不允许保存 %1 个砖块。 + 在 SMBX64 标准下,不允许保存 %1 个砖块。 砖块数量上限为 %2。 SMBX64 standard isn't allows to save %1 Background Objects The maximum number of Background Objects is %2. - SMBX64 标准不允许保存 %1 个背景。 + 在 SMBX64 标准下,不允许保存 %1 个背景。 背景数量上限为 %2。 SMBX64 standard isn't allows to save %1 NPC's The maximum number of NPC's is %2. - SMBX64 标准不允许保存 %1 个 NPC。 + 在 SMBX64 标准下,不允许保存 %1 个 NPC。 NPC 数量上限为 %2。 SMBX64 standard isn't allows to save %1 Warps The maximum number of Warps is %2. - SMBX64 标准不允许保存 %1 个传送点。 + 在 SMBX64 标准下,不允许保存 %1 个传送点。 传送点数量上限为 %2。 SMBX64 standard isn't allows to save %1 Water Boxes The maximum number of Water Boxes is %2. - SMBX64 标准不允许保存 %1 个水流区域。 + 在 SMBX64 标准下,不允许保存 %1 个水流区域。 水流区域数量上限为 %2。 SMBX64 standard isn't allows to save %1 Layers The maximum number of Layers is %2. - SMBX64 标准不允许保存 %1 个图层。 + 在 SMBX64 标准下,不允许保存 %1 个图层。 图层数量上限为 %2。 SMBX64 standard isn't allows to save %1 Events The maximum number of Events is %2. - SMBX64 标准不允许保存 %1 个事件。 + 在 SMBX64 标准下,不允许保存 %1 个事件。 事件数量上限为 %2。 @@ -7403,31 +7403,31 @@ The maximum number of Events is %2. SMBX64 standard isn't allows to save %1 Tiles The maximum number of Tiles is %2. - SMBX64 标准不允许保存 %1 个地形。 + 在 SMBX64 标准下,不允许保存 %1 个地形。 地形数量上限为 %2。 SMBX64 standard isn't allows to save %1 Sceneries The maximum number of Sceneries is %2. - SMBX64 标准不允许保存 %1 个风景。 + 在 SMBX64 标准下,不允许保存 %1 个风景。 风景数量上限为 %2。 SMBX64 standard isn't allows to save %1 Paths The maximum number of Paths is %2. - SMBX64 标准不允许保存 %1 个路线。 + 在 SMBX64 标准下,不允许保存 %1 个路线。 路线数量上限为 %2。 SMBX64 standard isn't allows to save %1 Levels The maximum number of Levels is %2. - SMBX64 标准不允许保存 %1 个关卡对象。 + 在 SMBX64 标准下,不允许保存 %1 个关卡对象。 关卡对象数量上限为 %2。 SMBX64 standard isn't allows to save %1 Music Boxes The maximum number of Music Boxes is %2. - SMBX64 标准不允许保存 %1 个音乐盒。 + 在 SMBX64 标准下,不允许保存 %1 个音乐盒。 音乐盒数量上限为 %2。 @@ -7691,7 +7691,7 @@ Reason: %1 Your level is not in SMBX-38A format. That means, the game WILL automatically convert it into SMBX-38A format. Your level will become incompatible with a Classic SMBX. Do you want to continue on your own risk? - 您的关卡不是 SMBX-38A 格式,因此该游戏将自动转换为 SMBX-38A 格式,且不再兼容经典版的 SMBX。您要接受风险并继续吗? + 您的关卡不是 SMBX-38A 格式,因此该游戏将自动转换为 SMBX-38A 格式,且不再与原版 SMBX 兼容。您要接受风险并继续吗? Impossible to launch an episode because of an invalid file. @@ -7703,7 +7703,7 @@ Reason: %1 Your world map is not in SMBX-38A format. That means, the game will automatically convert it into SMBX-38A format. Your episode will become incompatible with a Classic SMBX. Do you want to continue on your own risk? - 您的大地图不是 SMBX-38A 格式,因此该游戏将自动转换为 SMBX-38A 格式,且不再兼容经典版的 SMBX。您要接受风险并继续吗? + 您的大地图不是 SMBX-38A 格式,因此该游戏将自动转换为 SMBX-38A 格式,且不再与原版 SMBX 兼容。您要接受风险并继续吗? Can't start SMBX-38A game because "%1" is not found. That might happen because of incorrect path to SMBX-38A executable was specified, please check the SMBX-38A path setup. @@ -9563,7 +9563,7 @@ Do you want to save your changes? Restart last level after fail - 死后重新开始关卡 + 通关失败之后重新开始上次关卡 Hub-styled world (without world map) diff --git a/Editor/main_window/_settings/settings_io.cpp b/Editor/main_window/_settings/settings_io.cpp index ed4acd713..b5ab4be0d 100644 --- a/Editor/main_window/_settings/settings_io.cpp +++ b/Editor/main_window/_settings/settings_io.cpp @@ -34,7 +34,7 @@ #include static void loadToolboxProps(QSettings &s, - QString keyprefix, + const QString &keyprefix, MWDock_Base *widget, bool defViz, bool forceDefault, @@ -47,7 +47,7 @@ static void loadToolboxProps(QSettings &s, } static void saveToolboxProps(QSettings &s, - QString keyprefix, + const QString &keyprefix, MWDock_Base *widget) { QDockWidget *dw = dynamic_cast(widget); @@ -56,6 +56,49 @@ static void saveToolboxProps(QSettings &s, s.setValue(keyprefix + QStringLiteral("-geometry"), dw->saveGeometry()); } +static void loadFontProps(QSettings &s, + QString keyprefix, + QFont &dst_f, + QBrush &dst_b, + QPen &dst_p, + const QString &def_family, + QFont::Style def_style, + QFont::Weight def_weight, + int def_point_size, + bool def_underline, + bool def_strikeout, + const QBrush &def_brush, + const QPen &def_pen) +{ + dst_f.setFamily(s.value(keyprefix + QStringLiteral("-family"), def_family).toString()); + dst_f.setStyle((QFont::Style)s.value(keyprefix + QStringLiteral("-style"), def_style).toInt()); + dst_f.setWeight((QFont::Weight)s.value(keyprefix + QStringLiteral("-weight"), def_weight).toInt()); + dst_f.setPointSize(s.value(keyprefix + QStringLiteral("-size"), def_point_size).toInt()); + dst_f.setUnderline(s.value(keyprefix + QStringLiteral("-underline"), def_underline).toBool()); + dst_f.setStrikeOut(s.value(keyprefix + QStringLiteral("-strikeout"), def_strikeout).toBool()); + + dst_b.setColor(s.value(keyprefix + QStringLiteral("-colour"), def_brush.color().name(QColor::HexArgb)).toString()); + dst_p.setColor(s.value(keyprefix + QStringLiteral("-border-colour"), def_pen.color().name(QColor::HexArgb)).toString()); + dst_p.setWidth(s.value(keyprefix + QStringLiteral("-border-width"), def_pen.width()).toInt()); +} + +static void saveFontProps(QSettings &s, + const QString &keyprefix, + const QFont &src_f, + const QBrush &src_b, + const QPen &src_p) +{ + s.setValue(keyprefix + QStringLiteral("-family"), src_f.family()); + s.setValue(keyprefix + QStringLiteral("-style"), (int)src_f.style()); + s.setValue(keyprefix + QStringLiteral("-weight"), (int)src_f.weight()); + s.setValue(keyprefix + QStringLiteral("-size"), src_f.pointSize()); + s.setValue(keyprefix + QStringLiteral("-underline"), src_f.underline()); + s.setValue(keyprefix + QStringLiteral("-strikeout"), src_f.strikeOut()); + + s.setValue(keyprefix + QStringLiteral("-colour"), src_b.color().name(QColor::HexArgb)); + s.setValue(keyprefix + QStringLiteral("-border-colour"), src_p.color().name(QColor::HexArgb)); + s.setValue(keyprefix + QStringLiteral("-border-width"), src_p.width()); +} void MainWindow::loadBasicSettings() @@ -101,6 +144,13 @@ void MainWindow::loadSettings() GlobalSettings::LvlOpts.camera_grid_show = settings.value("camera-grid-show", false).toBool(); GlobalSettings::LvlOpts.default_zoom = settings.value("default-zoom", 100).toUInt(); + loadFontProps(settings, "label-box-font", + GlobalSettings::LvlOpts.labelBoxFont, + GlobalSettings::LvlOpts.labelBoxBrush, + GlobalSettings::LvlOpts.labelBoxPen, + "Times", QFont::StyleNormal, QFont::Black, 25, false, false, + Qt::white, QPen(Qt::black, 2)); + GlobalSettings::LvlItemDefaults.LockedItemOpacity = settings.value("locked-item-opacity", 0.3).toDouble(); GlobalSettings::LvlItemDefaults.npc_direction = settings.value("defaults-npc-directuin", -1).toInt(); GlobalSettings::LvlItemDefaults.npc_generator_type = settings.value("defaults-npc-gen-type", 1).toInt(); @@ -316,6 +366,11 @@ void MainWindow::saveSettings() settings.setValue("default-zoom", GlobalSettings::LvlOpts.default_zoom); settings.setValue("animation-item-limit", QString::number(GlobalSettings::animatorItemsLimit)); + saveFontProps(settings, "label-box-font", + GlobalSettings::LvlOpts.labelBoxFont, + GlobalSettings::LvlOpts.labelBoxBrush, + GlobalSettings::LvlOpts.labelBoxPen); + settings.setValue("defaults-npc-directuin", GlobalSettings::LvlItemDefaults.npc_direction); settings.setValue("defaults-npc-gen-type", GlobalSettings::LvlItemDefaults.npc_generator_type); settings.setValue("defaults-npc-gen-delay", GlobalSettings::LvlItemDefaults.npc_generator_delay); diff --git a/Editor/main_window/global_settings.cpp b/Editor/main_window/global_settings.cpp index c31de4896..c5c23f0c1 100644 --- a/Editor/main_window/global_settings.cpp +++ b/Editor/main_window/global_settings.cpp @@ -18,17 +18,27 @@ #include "global_settings.h" -EditingSettings::EditingSettings() +EditingSettings::EditingSettings() : + labelBoxBrush(Qt::white), + labelBoxPen(Qt::black, 2) { - animationEnabled=true; - collisionsEnabled=true; - grid_snap=true; - grid_override=false; + animationEnabled = true; + collisionsEnabled = true; + grid_snap = true; + grid_override = false; customGrid.setWidth(0); customGrid.setHeight(0); - grid_show=false; - camera_grid_show=false; - semiTransparentPaths=false; + grid_show = false; + camera_grid_show = false; + semiTransparentPaths = false; + + labelBoxFont.setFamily("Times"); + labelBoxFont.setWeight(QFont::Black); + labelBoxFont.setPointSize(25); + + labelBoxBrush.setColor(Qt::white); + labelBoxPen.setColor(Qt::black); + labelBoxPen.setWidth(2); } QString GlobalSettings::locale = ""; diff --git a/Editor/main_window/global_settings.h b/Editor/main_window/global_settings.h index 3bcee14ba..02958623d 100644 --- a/Editor/main_window/global_settings.h +++ b/Editor/main_window/global_settings.h @@ -22,6 +22,9 @@ #include #include +#include +#include +#include #include struct EditingSettings @@ -41,6 +44,10 @@ struct EditingSettings // Auto-saving bool autoSave_enable = true; int autoSave_interval = 3; //!< Autosave interval in minutes + // Font for the label box during the placing + QFont labelBoxFont; + QBrush labelBoxBrush; + QPen labelBoxPen; }; struct SETTINGS_ItemDefaults