Skip to content

Commit

Permalink
Merge branch 'master' into wip-translator
Browse files Browse the repository at this point in the history
  • Loading branch information
Wohlstand committed Nov 1, 2023
2 parents 1053a08 + 81409de commit 7f2d154
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 54 deletions.
11 changes: 3 additions & 8 deletions Editor/editing/_scenes/level/lvl_item_placing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
11 changes: 3 additions & 8 deletions Editor/editing/_scenes/world/wld_item_placing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
56 changes: 28 additions & 28 deletions Editor/languages/editor_zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ like when choosing an item from the item toolbox or from the tileset item box.</
</message>
<message>
<source>Generator</source>
<translation>连续出现</translation>
<translation>生成器</translation>
</message>
<message>
<source>Type:</source>
Expand Down Expand Up @@ -371,7 +371,7 @@ like when choosing an item from the item toolbox or from the tileset item box.</
<message>
<source>Opacity</source>
<comment>Opacity of locked items (label text)</comment>
<translation>透明度</translation>
<translation>锁定对象透明度</translation>
</message>
<message>
<source>Defines the opacity level that will be applied to all locked elements of the scene.</source>
Expand Down Expand Up @@ -3317,7 +3317,7 @@ Suggested to remove all excess elements.
Do you want to continue the process?</source>
<translation>已超出 SMBX64 标准!
%1
, SMBX 1.3 引擎可能异常终止!
SMBX 1.3 引擎可能异常终止!
建议移除所有超出部分的对象。
您要继续吗?</translation>
</message>
Expand Down Expand Up @@ -3544,7 +3544,7 @@ Do you want to continue?</source>
<name>LvlEventsBox</name>
<message>
<source>Classic Events</source>
<translation>传统事件</translation>
<translation>事件</translation>
</message>
<message>
<source>Events list</source>
Expand Down Expand Up @@ -3990,7 +3990,7 @@ This option using the SMBX&apos;s bug of BGO rendering. For this can be works, y
</message>
<message>
<source>Generator</source>
<translation>连续出现</translation>
<translation>生成器</translation>
</message>
<message>
<source>Type:</source>
Expand Down Expand Up @@ -4959,7 +4959,7 @@ Please, select necessary world map in a list:</source>
</message>
<message>
<source>Create the duplicate warp entry with same settings (except for already placed points)</source>
<translation>使用当前设置新建传送点(已放置的地点除外)</translation>
<translation>使用当前设置创建传送点(已放置的地点除外)</translation>
</message>
<message>
<source>Apply to all</source>
Expand Down Expand Up @@ -5086,7 +5086,7 @@ show the current playable character(s) and number of lives.</source>
</message>
<message>
<source>Warps and Doors</source>
<translation>传送和门</translation>
<translation>传送点</translation>
</message>
<message>
<source>Events</source>
Expand Down Expand Up @@ -5346,7 +5346,7 @@ show the current playable character(s) and number of lives.</source>
</message>
<message>
<source>Restart level after fail</source>
<translation>死后重新开始关卡</translation>
<translation>通关失败之后重新开始</translation>
</message>
<message>
<source>Select and Move</source>
Expand Down Expand Up @@ -6304,7 +6304,7 @@ Please save the file first.</source>
<message>
<source>Warps and Doors</source>
<comment>Vanilla-like toolbar</comment>
<translation>传送和门</translation>
<translation>传送点</translation>
</message>
<message>
<source>Water</source>
Expand Down Expand Up @@ -7203,7 +7203,7 @@ Error description:
</message>
<message>
<source>Restart after fail</source>
<translation>死后重新开始当前关卡</translation>
<translation>通关失败之后重新开始当前关卡</translation>
</message>
<message>
<source>Total stars</source>
Expand Down Expand Up @@ -7345,51 +7345,51 @@ File: %1</source>
<source>SMBX64 standard isn&apos;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.</source>
<translation>SMBX64 标准不允许保存 %1 个场景
<translation>SMBX64 标准下,不允许保存 %1 个场景
场景数量上限为 %2,
如果你继续保存该格式的文件
所有超过 21 的场景设置将会丢失。</translation>
如果你继续保存为该格式的文件
所有超过 21 的场景的内容都将丢失。</translation>
</message>
<message>
<source>SMBX64 standard isn&apos;t allows to save %1 blocks
The maximum number of blocks is %2.</source>
<translation>SMBX64 标准不允许保存 %1 个砖块。
<translation>SMBX64 标准下,不允许保存 %1 个砖块。
砖块数量上限为 %2。</translation>
</message>
<message>
<source>SMBX64 standard isn&apos;t allows to save %1 Background Objects
The maximum number of Background Objects is %2.</source>
<translation>SMBX64 标准不允许保存 %1 个背景。
<translation>SMBX64 标准下,不允许保存 %1 个背景。
背景数量上限为 %2。</translation>
</message>
<message>
<source>SMBX64 standard isn&apos;t allows to save %1 NPC&apos;s
The maximum number of NPC&apos;s is %2.</source>
<translation>SMBX64 标准不允许保存 %1 个 NPC。
<translation>SMBX64 标准下,不允许保存 %1 个 NPC。
NPC 数量上限为 %2。</translation>
</message>
<message>
<source>SMBX64 standard isn&apos;t allows to save %1 Warps
The maximum number of Warps is %2.</source>
<translation>SMBX64 标准不允许保存 %1 个传送点。
<translation>SMBX64 标准下,不允许保存 %1 个传送点。
传送点数量上限为 %2。</translation>
</message>
<message>
<source>SMBX64 standard isn&apos;t allows to save %1 Water Boxes
The maximum number of Water Boxes is %2.</source>
<translation>SMBX64 标准不允许保存 %1 个水流区域。
<translation>SMBX64 标准下,不允许保存 %1 个水流区域。
水流区域数量上限为 %2。</translation>
</message>
<message>
<source>SMBX64 standard isn&apos;t allows to save %1 Layers
The maximum number of Layers is %2.</source>
<translation>SMBX64 标准不允许保存 %1 个图层。
<translation>SMBX64 标准下,不允许保存 %1 个图层。
图层数量上限为 %2。</translation>
</message>
<message>
<source>SMBX64 standard isn&apos;t allows to save %1 Events
The maximum number of Events is %2.</source>
<translation>SMBX64 标准不允许保存 %1 个事件。
<translation>SMBX64 标准下,不允许保存 %1 个事件。
事件数量上限为 %2。</translation>
</message>
<message>
Expand All @@ -7403,31 +7403,31 @@ The maximum number of Events is %2.</source>
<message>
<source>SMBX64 standard isn&apos;t allows to save %1 Tiles
The maximum number of Tiles is %2.</source>
<translation>SMBX64 标准不允许保存 %1 个地形。
<translation>SMBX64 标准下,不允许保存 %1 个地形。
地形数量上限为 %2。</translation>
</message>
<message>
<source>SMBX64 standard isn&apos;t allows to save %1 Sceneries
The maximum number of Sceneries is %2.</source>
<translation>SMBX64 标准不允许保存 %1 个风景。
<translation>SMBX64 标准下,不允许保存 %1 个风景。
风景数量上限为 %2。</translation>
</message>
<message>
<source>SMBX64 standard isn&apos;t allows to save %1 Paths
The maximum number of Paths is %2.</source>
<translation>SMBX64 标准不允许保存 %1 个路线。
<translation>SMBX64 标准下,不允许保存 %1 个路线。
路线数量上限为 %2。</translation>
</message>
<message>
<source>SMBX64 standard isn&apos;t allows to save %1 Levels
The maximum number of Levels is %2.</source>
<translation>SMBX64 标准不允许保存 %1 个关卡对象。
<translation>SMBX64 标准下,不允许保存 %1 个关卡对象。
关卡对象数量上限为 %2。</translation>
</message>
<message>
<source>SMBX64 standard isn&apos;t allows to save %1 Music Boxes
The maximum number of Music Boxes is %2.</source>
<translation>SMBX64 标准不允许保存 %1 个音乐盒。
<translation>SMBX64 标准下,不允许保存 %1 个音乐盒。
音乐盒数量上限为 %2。</translation>
</message>
<message>
Expand Down Expand Up @@ -7691,7 +7691,7 @@ Reason: %1
</message>
<message>
<source>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?</source>
<translation>您的关卡不是 SMBX-38A 格式,因此该游戏将自动转换为 SMBX-38A 格式,且不再兼容经典版的 SMBX。您要接受风险并继续吗?</translation>
<translation>您的关卡不是 SMBX-38A 格式,因此该游戏将自动转换为 SMBX-38A 格式,且不再与原版 SMBX 兼容。您要接受风险并继续吗?</translation>
</message>
<message>
<source>Impossible to launch an episode because of an invalid file.</source>
Expand All @@ -7703,7 +7703,7 @@ Reason: %1
</message>
<message>
<source>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?</source>
<translation>您的大地图不是 SMBX-38A 格式,因此该游戏将自动转换为 SMBX-38A 格式,且不再兼容经典版的 SMBX。您要接受风险并继续吗?</translation>
<translation>您的大地图不是 SMBX-38A 格式,因此该游戏将自动转换为 SMBX-38A 格式,且不再与原版 SMBX 兼容。您要接受风险并继续吗?</translation>
</message>
<message>
<source>Can&apos;t start SMBX-38A game because &quot;%1&quot; is not found. That might happen because of incorrect path to SMBX-38A executable was specified, please check the SMBX-38A path setup.</source>
Expand Down Expand Up @@ -9563,7 +9563,7 @@ Do you want to save your changes?</source>
</message>
<message>
<source>Restart last level after fail</source>
<translation>死后重新开始关卡</translation>
<translation>通关失败之后重新开始上次关卡</translation>
</message>
<message>
<source>Hub-styled world (without world map)</source>
Expand Down
59 changes: 57 additions & 2 deletions Editor/main_window/_settings/settings_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <mainwindow.h>

static void loadToolboxProps(QSettings &s,
QString keyprefix,
const QString &keyprefix,
MWDock_Base *widget,
bool defViz,
bool forceDefault,
Expand All @@ -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<QDockWidget *>(widget);
Expand All @@ -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()
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
26 changes: 18 additions & 8 deletions Editor/main_window/global_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down
Loading

0 comments on commit 7f2d154

Please sign in to comment.