1
0
mirror of https://github.com/jaredtao/TaoQuick.git synced 2025-01-31 21:22:58 +08:00
This commit is contained in:
jared 2020-07-18 02:59:38 +08:00
parent 44af220075
commit d1baadc1d3
6 changed files with 16 additions and 11 deletions

View File

@ -8,8 +8,6 @@ Item {
height: 900
Component.onCompleted: {
appInfo.splashShow = false;
trans.loadFolder(appPath + "/Trans")
componentsMgr.loadFolder(contentsPath)
}
Splash {
id: splash

View File

@ -63,6 +63,7 @@ void ComponentsMgr::beforeUiReady(QQmlContext* ctx)
void ComponentsMgr::afterUiReady()
{
loadFolder(contentsPath);
}
const QJsonArray& ComponentsMgr::comps() const

View File

@ -1,5 +1,11 @@
#include "TaoFramework.h"
#include <QQmlContext>
TaoFramework *TaoFramework::instance()
{
static TaoFramework framework;
return &framework;
}
TaoFramework::~TaoFramework()
{
uninit();

View File

@ -6,13 +6,9 @@ class QQmlContext;
class QQuickView;
class TaoFramework {
public:
static TaoFramework* instance()
{
static TaoFramework framework;
return &framework;
}
~TaoFramework();
static TaoFramework* instance();
~TaoFramework();
public:
//初始化
void init();

View File

@ -3,6 +3,7 @@
#include <QDir>
#include <QQmlContext>
#include <QtConcurrent>
#include <QCoreApplication>
const static auto cEnglisthStr = QStringLiteral("English");
const static auto cChineseStr = QStringLiteral("简体中文");
Trans::Trans(QObject* parent)
@ -18,13 +19,16 @@ void Trans::beforeUiReady(QQmlContext* ctx)
ctx->setContextProperty("trans", this);
}
void Trans::afterUiReady() {}
void Trans::afterUiReady()
{
loadFolder(qApp->applicationDirPath() + "/Trans");
}
void Trans::loadFolder(const QString& folder)
{
QDir dir(folder);
auto infos = dir.entryInfoList({ "language_*.json" }, QDir::Files);
QStringList paths;
// QStringList paths;
QString lang;
for (auto info : infos) {
// paths.append(info.absoluteFilePath());

View File

@ -22,8 +22,8 @@ int main(int argc, char** argv)
{
prepareApp();
QGuiApplication app(argc, argv);
qWarning() << "appPath" << app.applicationDirPath();
Logger::initLog();
qWarning() << "appPath" << app.applicationDirPath();
TaoView view;