-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: translation du chines + store preference linke lang, keybind…
… in a .ini file
- Loading branch information
Showing
16 changed files
with
441 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!DOCTYPE TS> | ||
<TS version="2.1" language="en_US"> | ||
<context> | ||
<name>MainWindow</name> | ||
<message> | ||
<location filename="mainwindow.ui" line="32"/> | ||
<location filename="mainwindow.ui" line="119"/> | ||
<source>Only Up! Trainer v2.4</source> | ||
<oldsource>Only Up! Trainer v2.3</oldsource> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="53"/> | ||
<source><html><head/><body><p>If you enjoy my work, you can buy me a coffee ♥ : </p><p><a href="https://www.buymeacoffee.com/t0mz3r"><span style=" text-decoration: underline; color:#e5ac76;">https://www.buymeacoffee.com/t0mz3r</span></a></p></body></html></source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="94"/> | ||
<source>Initialize Trainer</source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="153"/> | ||
<source>Teleport to Position</source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="262"/> | ||
<source>Save Position</source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="290"/> | ||
<source>Enter position name...</source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="310"/> | ||
<source>Position :</source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="452"/> | ||
<source>Update Position</source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="482"/> | ||
<source>Key save</source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="544"/> | ||
<source>Key TP</source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="565"/> | ||
<source>Search a save</source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="610"/> | ||
<source>Drake Speed (Reset)</source> | ||
<oldsource>Speed Drake (Reset)</oldsource> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="728"/> | ||
<source>Pause drake</source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="758"/> | ||
<source>Reset drake</source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.cpp" line="330"/> | ||
<location filename="mainwindow.cpp" line="352"/> | ||
<source>Choisir une touche</source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.cpp" line="331"/> | ||
<location filename="mainwindow.cpp" line="353"/> | ||
<source>Touche :</source> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
</context> | ||
</TS> |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!DOCTYPE TS> | ||
<TS version="2.1" language="zh_CN"> | ||
<context> | ||
<name>MainWindow</name> | ||
<message> | ||
<location filename="mainwindow.ui" line="32"/> | ||
<location filename="mainwindow.ui" line="119"/> | ||
<source>Only Up! Trainer v2.4</source> | ||
<oldsource>Only Up! Trainer v2.3</oldsource> | ||
<translation type="unfinished"></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="53"/> | ||
<source><html><head/><body><p>If you enjoy my work, you can buy me a coffee ♥ : </p><p><a href="https://www.buymeacoffee.com/t0mz3r"><span style=" text-decoration: underline; color:#e5ac76;">https://www.buymeacoffee.com/t0mz3r</span></a></p></body></html></source> | ||
<translation type="unfinished"><html><head/><body><p>如果您认可我的存档器,<br/>希望您可以给我一杯咖啡钱以示鼓励,万分感谢 ♥ : </p><p><a href="https://www.buymeacoffee.com/t0mz3r"><span style=" text-decoration: underline; color:#e5ac76;">https://www.buymeacoffee.com/t0mz3r</span></a></p></body></html></translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="94"/> | ||
<source>Initialize Trainer</source> | ||
<translation>初始化存档器</translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="153"/> | ||
<source>Teleport to Position</source> | ||
<translation>传送至存档点</translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="262"/> | ||
<source>Save Position</source> | ||
<translation>保存存档点</translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="290"/> | ||
<source>Enter position name...</source> | ||
<translation>输入存档点名称…</translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="310"/> | ||
<source>Position :</source> | ||
<translation>坐标 :</translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="452"/> | ||
<source>Update Position</source> | ||
<translation>更新位置</translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="482"/> | ||
<source>Key save</source> | ||
<translation>热键保存</translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="544"/> | ||
<source>Key TP</source> | ||
<translation>热键传送</translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="565"/> | ||
<source>Search a save</source> | ||
<translation>搜索存档点</translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="610"/> | ||
<source>Drake Speed (Reset)</source> | ||
<translation>龙速(重置)</translation> | ||
</message> | ||
<message> | ||
<source>Speed Drake (Reset)</source> | ||
<translation type="vanished">龙速(重置)</translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="728"/> | ||
<source>Pause drake</source> | ||
<translation>暂停</translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.ui" line="758"/> | ||
<source>Reset drake</source> | ||
<translation>初始化龙</translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.cpp" line="330"/> | ||
<location filename="mainwindow.cpp" line="352"/> | ||
<source>Choisir une touche</source> | ||
<translation>设置热键</translation> | ||
</message> | ||
<message> | ||
<location filename="mainwindow.cpp" line="331"/> | ||
<location filename="mainwindow.cpp" line="353"/> | ||
<source>Touche :</source> | ||
<translation>热键 :</translation> | ||
</message> | ||
</context> | ||
</TS> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "config.h" | ||
#include <QFile> | ||
#include <QTextStream> | ||
|
||
Config::Config(const QString &filename) | ||
{ | ||
QFile file(filename); | ||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { | ||
QTextStream in(&file); | ||
while (!in.atEnd()) { | ||
QString line = in.readLine(); | ||
int pos = line.indexOf('='); | ||
if (pos == -1) continue; | ||
QString key = line.left(pos).trimmed(); | ||
QString value = line.mid(pos + 1).trimmed(); | ||
data[key] = value; | ||
} | ||
} | ||
} | ||
|
||
QString Config::get(const QString &key) const | ||
{ | ||
return data.value(key, QString()); | ||
} | ||
|
||
void Config::set(const QString &key, const QString &value) | ||
{ | ||
data[key] = value; | ||
} | ||
|
||
void Config::save(const QString &filename) const | ||
{ | ||
QFile file(filename); | ||
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { | ||
QTextStream out(&file); | ||
for (auto i = data.begin(); i != data.end(); ++i) { | ||
out << i.key() << "=" << i.value() << "\n"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef CONFIG_H | ||
#define CONFIG_H | ||
|
||
#include <QString> | ||
#include <QMap> | ||
|
||
class Config | ||
{ | ||
public: | ||
Config(const QString &filename); | ||
|
||
QString get(const QString &key) const; | ||
void set(const QString &key, const QString &value); | ||
void save(const QString &filename) const; | ||
|
||
private: | ||
QMap<QString, QString> data; | ||
}; | ||
|
||
#endif // CONFIG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lang = zh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.