Skip to content

Commit 41826ca

Browse files
committed
Merge branch 'master' into wip-translator
2 parents 74b7458 + 84b8835 commit 41826ca

File tree

12 files changed

+500
-23
lines changed

12 files changed

+500
-23
lines changed

Editor/data_configs/selection_dialog/config_manager.cpp

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ void ConfigManager::on_buttonBox_accepted()
560560
on_configList_itemDoubleClicked(ui->configList->selectedItems().first());
561561
}
562562

563-
bool ConfigManager::isConfigured()
563+
bool ConfigManager::isConfigured(PGE_JsEngine *js)
564564
{
565565
QString settingsFile = DataConfig::buildLocalConfigPath(m_currentConfigPath);
566566
if(!QFile::exists(settingsFile))
@@ -576,9 +576,20 @@ bool ConfigManager::isConfigured()
576576
QString path = settings.value("application-path", QString()).toString();
577577
settings.endGroup();
578578

579+
PGE_JsEngine loc_js;
580+
bool js_valid = js != nullptr;
581+
if(!js)
582+
{
583+
js = &loc_js;
584+
js_valid = configure_loadScript(js);
585+
}
586+
579587
// When directory got moved or deleted, config pack should be marked as not configured because got broken
580588
ret &= !path.isEmpty() && QFileInfo(path).isDir() && QDir(path).exists();
581589

590+
if(js_valid && js->hasFunction("isValidIntegration"))
591+
ret &= js->call<bool>("isValidIntegration", nullptr, path);
592+
582593
return ret;
583594
}
584595

@@ -715,18 +726,8 @@ bool ConfigManager::runConfigureTool()
715726
if(ConfStatus::configIsIntegrational)
716727
{
717728
PGE_JsEngine js;
718-
// QString cpDirName = QDir(m_currentConfigPath).dirName();
719-
QString cpSetupFile = DataConfig::buildLocalConfigPath(m_currentConfigPath);
720-
721-
js.bindProxy(new PGE_JS_Common(parentW), "PGE");
722-
js.bindProxy(new PGE_JS_File(m_currentConfigPath, cpSetupFile, parentW), "FileIO");
723-
js.bindProxy(new PGE_JS_INI(parentW), "INI");
724-
js.bindProxy(new PGE_JS_System(parentW), "System");
725729

726-
bool successfulLoaded = false;
727-
js.loadFileByExpcetedResult<void>(ConfStatus::configConfigureTool, &successfulLoaded);
728-
729-
if(successfulLoaded)
730+
if(configure_loadScript(&js))
730731
{
731732
setEnabled(false);
732733
if(!js.call<bool>("onConfigure", nullptr))
@@ -735,7 +736,7 @@ bool ConfigManager::runConfigureTool()
735736
return false;
736737
}
737738
setEnabled(true);
738-
if(!isConfigured())
739+
if(!isConfigured(&js))
739740
return false;
740741
return true;
741742
}
@@ -761,3 +762,24 @@ bool ConfigManager::runConfigureTool()
761762
return false;
762763
}
763764
}
765+
766+
bool ConfigManager::configure_loadScript(PGE_JsEngine *js)
767+
{
768+
QWidget *parentW = qobject_cast<QWidget *>(parent());
769+
if(!parentW || isVisible())
770+
parentW = this;
771+
772+
bool successfulLoaded = false;
773+
774+
// QString cpDirName = QDir(m_currentConfigPath).dirName();
775+
QString cpSetupFile = DataConfig::buildLocalConfigPath(m_currentConfigPath);
776+
777+
js->bindProxy(new PGE_JS_Common(parentW), "PGE");
778+
js->bindProxy(new PGE_JS_File(m_currentConfigPath, cpSetupFile, parentW), "FileIO");
779+
js->bindProxy(new PGE_JS_INI(parentW), "INI");
780+
js->bindProxy(new PGE_JS_System(parentW), "System");
781+
782+
js->loadFileByExpcetedResult<void>(ConfStatus::configConfigureTool, &successfulLoaded);
783+
784+
return successfulLoaded;
785+
}

Editor/data_configs/selection_dialog/config_manager.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ namespace Ui {
2929
class ConfigManager;
3030
}
3131

32+
class PGE_JsEngine;
33+
3234
class ConfigManager : public QDialog
3335
{
3436
Q_OBJECT
@@ -70,13 +72,16 @@ class ConfigManager : public QDialog
7072
* @brief Checks is current config pack configured (or non-configurable)
7173
* @return true if config pack is non-configurable or already configured
7274
*/
73-
bool isConfigured();
75+
bool isConfigured(PGE_JsEngine *js = nullptr);
7476
/**
7577
* @brief Starts configure tool if available
7678
* @return true on success configuring, false if no config tool found, rejected or script was been errored
7779
*/
7880
bool runConfigureTool();
7981

82+
private:
83+
bool configure_loadScript(PGE_JsEngine *js);
84+
8085
private slots:
8186

8287
void on_configList_itemDoubleClicked(QListWidgetItem *item);

Editor/js_engine/pge_jsengine.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ class PGE_JsEngine : public QObject
6969
m_jsengine.globalObject().setProperty(regName, m_jsengine.newQObject(obj));
7070
}
7171

72+
bool hasFunction(const QString &functionName, bool *ok = nullptr)
73+
{
74+
QJSValue function = m_jsengine.evaluate(functionName);
75+
return checkForErrors(function, ok);
76+
}
77+
7278
template<typename RetVal, typename... Args>
7379
RetVal call(const QString &functionName, bool *ok, Args &&... args)
7480
{

Editor/languages/editor_zh.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7860,21 +7860,21 @@ Reason: %1
78607860
</message>
78617861
<message>
78627862
<source>Set custom health level</source>
7863-
<translation type="unfinished"></translation>
7863+
<translation>设置初始体力</translation>
78647864
</message>
78657865
<message>
78667866
<source>Reserved item</source>
7867-
<translation type="unfinished"></translation>
7867+
<translation>道具存储</translation>
78687868
</message>
78697869
<message>
78707870
<source>&lt;Unknown&gt;</source>
78717871
<comment>Unknown NPC from the list</comment>
7872-
<translation type="unfinished"></translation>
7872+
<translation>&amp;lt;未知道具&amp;gt;</translation>
78737873
</message>
78747874
<message>
78757875
<source>[No item]</source>
78767876
<comment>Reserve box of player contains no item</comment>
7877-
<translation type="unfinished"></translation>
7877+
<translation>[无道具]</translation>
78787878
</message>
78797879
</context>
78807880
<context>

Editor/testing/luna_tester_engine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,14 +1064,14 @@ void LunaTesterEngine::killProcess()
10641064
#else // anything but _WIN32
10651065

10661066
# ifdef __APPLE__
1067+
Q_UNUSED(lunaExecPath)
10671068
LogDebugNC(QString("LunaEngineWorker: Killing %1 by 'kill'...").arg(smbxExeName));
10681069
QProcess ps;
10691070
ps.start("/bin/ps", {"-A"});
10701071
ps.waitForFinished();
10711072
QString psAll = ps.readAllStandardOutput();
10721073

10731074
QStringList psAllList = psAll.split('\n');
1074-
QString smbxExeName = smbxExeName;
10751075

10761076
QRegExp psReg(QString("(\\d+) .*(wine-preloader).*(%1)").arg(smbxExeName));
10771077
for(QString &psOne : psAllList)

Editor/testing/thextech_engine.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,16 @@ bool TheXTechEngine::doTestLevelIPC(const LevelData &d)
12721272
}
12731273
}
12741274

1275+
if(m_caps.arguments.contains("c"))
1276+
{
1277+
#if __APPLE__
1278+
if(!ConfStatus::configDataPath.endsWith(".app/Content/Resources/assets/", Qt::CaseInsensitive))
1279+
args << "-c" << ConfStatus::configDataPath;
1280+
#else
1281+
args << "-c" << ConfStatus::configDataPath;
1282+
#endif
1283+
}
1284+
12751285
if(m_caps.features.contains("vsync-flag") && m_vsyncEnable)
12761286
args << "--vsync";
12771287

@@ -1407,6 +1417,16 @@ bool TheXTechEngine::doTestLevelFile(const QString &levelFile)
14071417
}
14081418
}
14091419

1420+
if(m_caps.arguments.contains("c"))
1421+
{
1422+
#if __APPLE__
1423+
if(!ConfStatus::configDataPath.endsWith(".app/Content/Resources/assets/", Qt::CaseInsensitive))
1424+
args << "-c" << ConfStatus::configDataPath;
1425+
#else
1426+
args << "-c" << ConfStatus::configDataPath;
1427+
#endif
1428+
}
1429+
14101430
if(m_caps.features.contains("vsync-flag") && m_vsyncEnable)
14111431
args << "--vsync";
14121432

@@ -1537,6 +1557,16 @@ bool TheXTechEngine::doTestWorldFile(const QString &worldFile)
15371557
}
15381558
}
15391559

1560+
if(m_caps.arguments.contains("c"))
1561+
{
1562+
#if __APPLE__
1563+
if(!ConfStatus::configDataPath.endsWith(".app/Contents/Resources/assets/", Qt::CaseInsensitive))
1564+
args << "-c" << ConfStatus::configDataPath;
1565+
#else
1566+
args << "-c" << ConfStatus::configDataPath;
1567+
#endif
1568+
}
1569+
15401570
if(m_caps.features.contains("vsync-flag") && m_vsyncEnable)
15411571
args << "--vsync";
15421572

GIFs2PNG/gifs2png.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ int main(int argc, char *argv[])
366366
setup.removeSource = switchRemove.getValue();
367367
setup.skipBackground2 = switchSkipBG.getValue();
368368
setup.skipNonBW = switchSkipNonBW.getValue();
369-
setup.walkSubDirs = switchDigRecursive.getValue() | switchDigRecursiveDEP.getValue();
369+
setup.walkSubDirs = switchDigRecursive.getValue() || switchDigRecursiveDEP.getValue();
370370

371371
setup.pathOut = outputDirectory.getValue();
372372
setup.configPath = configDirectory.getValue();

_Misc/glossary/ta.tbx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE martif PUBLIC "ISO 12200:1999A//DTD MARTIF core (DXFcdV04)//EN" "TBXcdv04.dtd">
3+
<martif type="TBX" xml:lang="en">
4+
<martifHeader>
5+
<fileDesc>
6+
<sourceDesc>
7+
<p>Translate Toolkit</p>
8+
</sourceDesc>
9+
</fileDesc>
10+
</martifHeader>
11+
<text>
12+
<body>
13+
<termEntry>
14+
<langSet xml:lang="en"><tig><term>Moondust</term></tig></langSet>
15+
<langSet xml:lang="ta"><tig><term>நிலவொளி</term></tig></langSet>
16+
</termEntry>
17+
</body>
18+
</text>
19+
</martif>

_common/Graphics/bitmask2rgba.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void bitmask_set_bitblit_bg(uint8_t red, uint8_t green, uint8_t blue)
154154
s_bitblitBG.rgbBlue = blue;
155155
}
156156

157-
void bitmask_reset_bitblit_bg()
157+
void bitmask_reset_bitblit_bg(void)
158158
{
159159
s_bitblitBG.rgbRed = 0;
160160
s_bitblitBG.rgbGreen = 0;

_common/Graphics/bitmask2rgba.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ extern void bitmask_set_bitblit_bg(uint8_t red, uint8_t green, uint8_t blue);
5757
/**
5858
* @brief Restore the default pseudo-background colour
5959
*/
60-
extern void bitmask_reset_bitblit_bg();
60+
extern void bitmask_reset_bitblit_bg(void);
6161

6262
#ifdef __cplusplus
6363
}

0 commit comments

Comments
 (0)