- Moved the resource URL inside the QML app
- Updated local path for all the platforms - Fixed local path creation problem on Linux
This commit is contained in:
@@ -116,10 +116,11 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath)
|
||||
userPath = "/sdcard/Wagic/Res/";
|
||||
systemPath = "";
|
||||
#elif defined (QT_CONFIG)
|
||||
// userPath = USERDIR;
|
||||
// systemPath = RESDIR;
|
||||
userPath = QDir::toNativeSeparators(QDir::homePath()).toStdString() + "/.wagic/";
|
||||
systemPath = "";
|
||||
QDir dir(QDir::homePath());
|
||||
dir.cd(USERDIR);
|
||||
|
||||
userPath = QDir::toNativeSeparators(dir.absolutePath()).toStdString();
|
||||
systemPath = "";
|
||||
#else
|
||||
//Find the Res.txt file and matching Res folders for backwards compatibility
|
||||
ifstream mfile("Res.txt");
|
||||
|
||||
+2
-3
@@ -629,14 +629,13 @@ int main(int argc, char* argv[])
|
||||
QScopedPointer<QApplication> app(createApplication(argc, argv));
|
||||
app->setApplicationName(g_launcher->GetName());
|
||||
|
||||
FileDownloader fileDownloader(QUrl("http://wagic.googlecode.com/files/core_017.zip"),
|
||||
QDir::toNativeSeparators(QDir::homePath()) + "/.wagic/core_017.zip", 0);
|
||||
FileDownloader fileDownloader(USERDIR);
|
||||
|
||||
QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
|
||||
g_glwidget = viewer.data();
|
||||
viewer->setMainQmlFile(QLatin1String("qml/QmlWagic/main.qml"));
|
||||
|
||||
viewer->rootContext()->setContextProperty("fileDownloader", &fileDownloader);
|
||||
viewer->setMainQmlFile(QLatin1String("qml/QmlWagic/main.qml"));
|
||||
|
||||
viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
|
||||
QGLWidget *glWidget = new QGLWidget;
|
||||
|
||||
@@ -78,7 +78,9 @@ WagicCore::~WagicCore()
|
||||
m_launcher = NULL;
|
||||
}
|
||||
|
||||
m_engine->SetApp(NULL);
|
||||
if(m_engine)
|
||||
m_engine->SetApp(NULL);
|
||||
|
||||
if (m_app)
|
||||
{
|
||||
m_app->Destroy();
|
||||
|
||||
@@ -1,14 +1,30 @@
|
||||
#include "filedownloader.h"
|
||||
#include <QDir>
|
||||
|
||||
FileDownloader::FileDownloader(QUrl url, QString localPath, QObject *parent) :
|
||||
QObject(parent), m_received(0), m_localPath(localPath), m_OK(false), m_done(false)
|
||||
FileDownloader::FileDownloader(QString localPath, QUrl url, QObject *parent) :
|
||||
QObject(parent), m_received(0), m_OK(false), m_done(false)
|
||||
|
||||
{
|
||||
QDir dir(QDir::homePath());
|
||||
if(!dir.mkpath(localPath))
|
||||
{
|
||||
m_OK = false;
|
||||
return;
|
||||
}
|
||||
dir.cd(localPath);
|
||||
m_localPath = dir.filePath("core.zip");
|
||||
|
||||
QFile local(m_localPath);
|
||||
if(local.exists()) {
|
||||
m_done = true;
|
||||
return;
|
||||
}
|
||||
if(!url.isEmpty())
|
||||
setDownloadUrl(url);
|
||||
}
|
||||
|
||||
void FileDownloader::setDownloadUrl(QUrl url)
|
||||
{
|
||||
connect(&m_WebCtrl, SIGNAL(finished(QNetworkReply*)),
|
||||
SLOT(fileDownloaded(QNetworkReply*)));
|
||||
|
||||
@@ -21,7 +37,8 @@ FileDownloader::FileDownloader(QUrl url, QString localPath, QObject *parent) :
|
||||
m_OK = m_tmp.open();
|
||||
}
|
||||
|
||||
|
||||
FileDownloader::~FileDownloader()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user