Lines 1-9
Link Here
|
1 |
#ifndef _FileEngine_h |
1 |
#ifndef _FileEngine_h |
2 |
#define _FileEngine_h |
2 |
#define _FileEngine_h |
3 |
|
3 |
|
4 |
#include <QAbstractFileEngine> |
4 |
#include <private/qabstractfileengine_p.h> |
5 |
#include <QAbstractFileEngineHandler> |
|
|
6 |
#include <QAbstractFileEngineIterator> |
7 |
#include <QDateTime> |
5 |
#include <QDateTime> |
8 |
|
6 |
|
9 |
#include "physfs.h" |
7 |
#include "physfs.h" |
10 |
-- a/QTfrontend/game.cpp |
8 |
++ b/QTfrontend/game.cpp |
Lines 536-542
void HWGame::abort()
Link Here
|
536 |
void HWGame::sendCampaignVar(const QByteArray &varToSend) |
536 |
void HWGame::sendCampaignVar(const QByteArray &varToSend) |
537 |
{ |
537 |
{ |
538 |
QString varToFind = QString::fromUtf8(varToSend); |
538 |
QString varToFind = QString::fromUtf8(varToSend); |
539 |
QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0); |
539 |
QSettings teamfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0); |
540 |
teamfile.setIniCodec("UTF-8"); |
540 |
teamfile.setIniCodec("UTF-8"); |
541 |
QString varValue = teamfile.value("Campaign " + campaign + "/" + varToFind, "").toString(); |
541 |
QString varValue = teamfile.value("Campaign " + campaign + "/" + varToFind, "").toString(); |
542 |
QByteArray command; |
542 |
QByteArray command; |
Lines 553-559
void HWGame::writeCampaignVar(const QByteArray & varVal)
Link Here
|
553 |
QString varToWrite = QString::fromUtf8(varVal.left(i)); |
553 |
QString varToWrite = QString::fromUtf8(varVal.left(i)); |
554 |
QString varValue = QString::fromUtf8(varVal.mid(i + 1)); |
554 |
QString varValue = QString::fromUtf8(varVal.mid(i + 1)); |
555 |
|
555 |
|
556 |
QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0); |
556 |
QSettings teamfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0); |
557 |
teamfile.setIniCodec("UTF-8"); |
557 |
teamfile.setIniCodec("UTF-8"); |
558 |
teamfile.setValue("Campaign " + campaign + "/" + varToWrite, varValue); |
558 |
teamfile.setValue("Campaign " + campaign + "/" + varToWrite, varValue); |
559 |
} |
559 |
} |
560 |
-- a/QTfrontend/team.cpp |
560 |
++ b/QTfrontend/team.cpp |
Lines 171-177
HWTeam & HWTeam::operator = (const HWTeam & other)
Link Here
|
171 |
|
171 |
|
172 |
bool HWTeam::loadFromFile() |
172 |
bool HWTeam::loadFromFile() |
173 |
{ |
173 |
{ |
174 |
QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name)), QSettings::IniFormat, 0); |
174 |
QSettings teamfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name)), QSettings::IniFormat, 0); |
175 |
teamfile.setIniCodec("UTF-8"); |
175 |
teamfile.setIniCodec("UTF-8"); |
176 |
m_name = teamfile.value("Team/Name", m_name).toString(); |
176 |
m_name = teamfile.value("Team/Name", m_name).toString(); |
177 |
m_grave = teamfile.value("Team/Grave", "Statue").toString(); |
177 |
m_grave = teamfile.value("Team/Grave", "Statue").toString(); |
Lines 204-210
bool HWTeam::loadFromFile()
Link Here
|
204 |
|
204 |
|
205 |
bool HWTeam::fileExists() |
205 |
bool HWTeam::fileExists() |
206 |
{ |
206 |
{ |
207 |
QFile f(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name))); |
207 |
QFile f(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name))); |
208 |
return f.exists(); |
208 |
return f.exists(); |
209 |
} |
209 |
} |
210 |
|
210 |
|
Lines 220-226
bool HWTeam::deleteFile()
Link Here
|
220 |
{ |
220 |
{ |
221 |
if(m_isNetTeam) |
221 |
if(m_isNetTeam) |
222 |
return false; |
222 |
return false; |
223 |
QFile cfgfile(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name))); |
223 |
QFile cfgfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name))); |
224 |
cfgfile.remove(); |
224 |
cfgfile.remove(); |
225 |
return true; |
225 |
return true; |
226 |
} |
226 |
} |
Lines 229-240
bool HWTeam::saveToFile()
Link Here
|
229 |
{ |
229 |
{ |
230 |
if (OldTeamName != m_name) |
230 |
if (OldTeamName != m_name) |
231 |
{ |
231 |
{ |
232 |
QFile cfgfile(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(OldTeamName))); |
232 |
QFile cfgfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(OldTeamName))); |
233 |
cfgfile.remove(); |
233 |
cfgfile.remove(); |
234 |
OldTeamName = m_name; |
234 |
OldTeamName = m_name; |
235 |
} |
235 |
} |
236 |
|
236 |
|
237 |
QString fileName = QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name)); |
237 |
QString fileName = QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name)); |
238 |
DataManager::ensureFileExists(fileName); |
238 |
DataManager::ensureFileExists(fileName); |
239 |
QSettings teamfile(fileName, QSettings::IniFormat, 0); |
239 |
QSettings teamfile(fileName, QSettings::IniFormat, 0); |
240 |
teamfile.setIniCodec("UTF-8"); |
240 |
teamfile.setIniCodec("UTF-8"); |
241 |
-- a/QTfrontend/ui/page/pagedata.cpp |
241 |
++ b/QTfrontend/ui/page/pagedata.cpp |
Lines 31-38
Link Here
|
31 |
#include "pagedata.h" |
31 |
#include "pagedata.h" |
32 |
#include "databrowser.h" |
32 |
#include "databrowser.h" |
33 |
#include "hwconsts.h" |
33 |
#include "hwconsts.h" |
34 |
#include "DataManager.h" |
|
|
35 |
#include "FileEngine.h" |
36 |
|
34 |
|
37 |
QLayout * PageDataDownload::bodyLayoutDefinition() |
35 |
QLayout * PageDataDownload::bodyLayoutDefinition() |
38 |
{ |
36 |
{ |
Lines 197-205
void PageDataDownload::fileDownloaded()
Link Here
|
197 |
out.write(reply->readAll()); |
195 |
out.write(reply->readAll()); |
198 |
|
196 |
|
199 |
out.close(); |
197 |
out.close(); |
200 |
|
|
|
201 |
// now mount it |
202 |
FileEngineHandler::mount(fileName); |
203 |
} |
198 |
} |
204 |
} |
199 |
} |
205 |
|
200 |
|
Lines 229-235
void PageDataDownload::onPageLeave()
Link Here
|
229 |
if (m_contentDownloaded) |
224 |
if (m_contentDownloaded) |
230 |
{ |
225 |
{ |
231 |
m_contentDownloaded = false; |
226 |
m_contentDownloaded = false; |
232 |
//DataManager::instance().reload(); |
|
|
233 |
} |
227 |
} |
234 |
} |
228 |
} |
235 |
|
229 |
|
236 |
-- a/QTfrontend/util/DataManager.cpp |
230 |
++ b/QTfrontend/util/DataManager.cpp |
Lines 172-182
QString DataManager::settingsFileName()
Link Here
|
172 |
{ |
172 |
{ |
173 |
if(m_settingsFileName.isEmpty()) |
173 |
if(m_settingsFileName.isEmpty()) |
174 |
{ |
174 |
{ |
175 |
QFile settingsFile("physfs://settings.ini"); |
175 |
QFile settingsFile(cfgdir->absoluteFilePath("settings.ini")); |
176 |
|
176 |
|
177 |
if(!settingsFile.exists()) |
177 |
if(!settingsFile.exists()) |
178 |
{ |
178 |
{ |
179 |
QFile oldSettingsFile("physfs://hedgewars.ini"); |
179 |
QFile oldSettingsFile(cfgdir->absoluteFilePath("hedgewars.ini")); |
180 |
|
180 |
|
181 |
settingsFile.open(QFile::WriteOnly); |
181 |
settingsFile.open(QFile::WriteOnly); |
182 |
settingsFile.close(); |
182 |
settingsFile.close(); |