Merge with develop

--HG--
branch : compatibility-develop
hg/compatibility-develop
kervala 8 years ago
commit 2e7af6ab0d

@ -422,7 +422,7 @@ namespace NLGUI
{ {
nlassert(key); nlassert(key);
nlassert(isValid()); nlassert(isValid());
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%d" NL_I64 "' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename())); if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%" NL_I64 "d' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename()));
CLuaStackChecker lsc(_LuaState); CLuaStackChecker lsc(_LuaState);
push(); push();
_LuaState->push(key); _LuaState->push(key);

@ -1082,7 +1082,7 @@ NLMISC_CATEGORISED_COMMAND(nel,displayMeasures, "display hierarchical timer", "[
} }
sint depth = 0; sint depth = 0;
bool hasDepth = (sscanf(args[0].c_str(), "%d", &depth) == 1 || (args.size() > 1 && sscanf(args[1].c_str(), "%d", &depth) == 1)); bool hasDepth = (fromString(args[0], depth) || (args.size() > 1 && fromString(args[1], depth)));
CASE_DISPLAYMEASURES(NoSort, -3) CASE_DISPLAYMEASURES(NoSort, -3)
CASE_DISPLAYMEASURES(TotalTime, -2) CASE_DISPLAYMEASURES(TotalTime, -2)

@ -419,13 +419,13 @@ int main(int argc, char* argv[])
float weldThreshold, middleEdgeWeldThreshold; float weldThreshold, middleEdgeWeldThreshold;
if (::sscanf(argv[2], "%f", &weldThreshold) != 1) if (!fromString(argv[2], weldThreshold))
{ {
nlinfo("invalid weldThreshold"); nlinfo("invalid weldThreshold");
return -1; return -1;
} }
if (::sscanf(argv[3], "%f", &middleEdgeWeldThreshold) != 1) if (!fromString(argv[3], middleEdgeWeldThreshold))
{ {
nlinfo("invalid middleEdgeWeldThreshold"); nlinfo("invalid middleEdgeWeldThreshold");
return -1; return -1;

@ -894,7 +894,7 @@ void CObjectInteger::inPlaceCopy(const CObjectInteger &src)
} }
std::string CObjectInteger::doToString() const { return NLMISC::toString("%" NL_I64 "d", _Value); } std::string CObjectInteger::doToString() const { return NLMISC::toString(_Value); }
void CObjectInteger::doSerialize(std::string& out, CSerializeContext& /* context */) const void CObjectInteger::doSerialize(std::string& out, CSerializeContext& /* context */) const
{ {

@ -3122,8 +3122,8 @@ static void setRyzomDebugDate(CRyzomDate &rd)
NLMISC_COMMAND(setDebugHour, "set the current debug hour", "<hour>") NLMISC_COMMAND(setDebugHour, "set the current debug hour", "<hour>")
{ {
if (args.size() != 1) return false; if (args.size() != 1) return false;
int hour; sint hour;
if (sscanf(args[0].c_str(), "%d", &hour) != 1) return false; if (!fromString(args[0], hour)) return false;
CRyzomDate rd; CRyzomDate rd;
getRyzomDebugDate(rd); getRyzomDebugDate(rd);
rd.Time = fmodf(rd.Time, 1.f) + (float) hour; rd.Time = fmodf(rd.Time, 1.f) + (float) hour;
@ -3134,8 +3134,8 @@ NLMISC_COMMAND(setDebugHour, "set the current debug hour", "<hour>")
NLMISC_COMMAND(setDebugDayOfYear, "set the current debug day of year (first day has index 1)", "<day>") NLMISC_COMMAND(setDebugDayOfYear, "set the current debug day of year (first day has index 1)", "<day>")
{ {
if (args.size() != 1) return false; if (args.size() != 1) return false;
int day; sint day;
if (sscanf(args[0].c_str(), "%d", &day) != 1) return false; if (!fromString(args[0], day)) return false;
CRyzomDate rd; CRyzomDate rd;
getRyzomDebugDate(rd); getRyzomDebugDate(rd);
rd.Day = day - 1; // for the user, days start at '1' rd.Day = day - 1; // for the user, days start at '1'

@ -1002,7 +1002,7 @@ ENTITY_VARIABLE(Money, "Money")
if (get) if (get)
{ {
value = toString("%"NL_I64"u", c->getMoney()); value = toString(c->getMoney());
} }
else else
{ {
@ -1054,7 +1054,7 @@ ENTITY_VARIABLE(MoneyGuild, "MoneyGuild")
if (get) if (get)
{ {
value = toString("%"NL_I64"u", guild->getMoney()); value = toString(guild->getMoney());
} }
else else
{ {

@ -3916,7 +3916,8 @@ NLMISC_COMMAND( db, "Display or set the value of a property in the database", "<
{ {
// Set // Set
sint64 value; sint64 value;
sscanf( args[2].c_str(), "%"NL_I64"d", &value ); fromString(args[2], value);
if ( (args.size() > 3) && (args[3]!="0") ) if ( (args.size() > 3) && (args[3]!="0") )
{ {
res = e->_PropertyDatabase.x_setPropButDontSend( entry, value ); res = e->_PropertyDatabase.x_setPropButDontSend( entry, value );

@ -1011,7 +1011,7 @@ NLMISC_COMMAND(getMoney, "get money of player", "<uid>")
{ {
GET_ACTIVE_CHARACTER GET_ACTIVE_CHARACTER
string value = toString("%"NL_I64"u", c->getMoney()); string value = toString(c->getMoney());
log.displayNL(value.c_str()); log.displayNL(value.c_str());

@ -1217,7 +1217,7 @@ NLMISC_COMMAND(dumpToXml, "dump the content of an object into an xml file", "<da
if (id == NLMISC::CEntityId::Unknown) if (id == NLMISC::CEntityId::Unknown)
{ {
if (sscanf(args[1].c_str(), "%"NL_I64"u", &key) != 1) if (!fromString(args[1], key))
{ {
log.displayNL("id '%s' is not recognized as an EntityId, an ObjectIndex nor a 64 bits raw key", args[1].c_str()); log.displayNL("id '%s' is not recognized as an EntityId, an ObjectIndex nor a 64 bits raw key", args[1].c_str());
return false; return false;

@ -26,7 +26,7 @@
#define new DEBUG_NEW #define new DEBUG_NEW
#endif #endif
CDownloader::CDownloader(QObject *parent, IOperationProgressListener *listener):QObject(parent), m_listener(listener), m_manager(NULL), m_reply(NULL), m_timer(NULL), CDownloader::CDownloader(QObject *parent, IOperationProgressListener *listener):QObject(parent), m_listener(listener), m_manager(NULL), m_timer(NULL),
m_offset(0), m_size(0), m_supportsAcceptRanges(false), m_supportsContentRange(false), m_offset(0), m_size(0), m_supportsAcceptRanges(false), m_supportsContentRange(false),
m_downloadAfterHead(false), m_file(NULL) m_downloadAfterHead(false), m_file(NULL)
{ {
@ -169,10 +169,10 @@ void CDownloader::getFileHead()
request.setRawHeader("Range", QString("bytes=%1-").arg(m_offset).toLatin1()); request.setRawHeader("Range", QString("bytes=%1-").arg(m_offset).toLatin1());
} }
m_reply = m_manager->head(request); QNetworkReply *reply = m_manager->head(request);
connect(m_reply, SIGNAL(finished()), SLOT(onHeadFinished())); connect(reply, SIGNAL(finished()), SLOT(onHeadFinished()));
connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onError(QNetworkReply::NetworkError))); connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onError(QNetworkReply::NetworkError)));
startTimer(); startTimer();
} }
@ -212,12 +212,12 @@ void CDownloader::downloadFile()
request.setRawHeader("Range", QString("bytes=%1-%2").arg(m_offset).arg(m_size-1).toLatin1()); request.setRawHeader("Range", QString("bytes=%1-%2").arg(m_offset).arg(m_size-1).toLatin1());
} }
m_reply = m_manager->get(request); QNetworkReply *reply = m_manager->get(request);
connect(m_reply, SIGNAL(finished()), SLOT(onDownloadFinished())); connect(reply, SIGNAL(finished()), SLOT(onDownloadFinished()));
connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onError(QNetworkReply::NetworkError))); connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onError(QNetworkReply::NetworkError)));
connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)), SLOT(onDownloadProgress(qint64, qint64))); connect(reply, SIGNAL(downloadProgress(qint64, qint64)), SLOT(onDownloadProgress(qint64, qint64)));
connect(m_reply, SIGNAL(readyRead()), SLOT(onDownloadRead())); connect(reply, SIGNAL(readyRead()), SLOT(onDownloadRead()));
if (m_listener) m_listener->operationStart(); if (m_listener) m_listener->operationStart();
@ -254,24 +254,35 @@ void CDownloader::onHeadFinished()
{ {
stopTimer(); stopTimer();
int status = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
QString url = reply->url().toString();
QString redirection = reply->header(QNetworkRequest::LocationHeader).toString();
m_size = reply->header(QNetworkRequest::ContentLengthHeader).toInt();
m_lastModified = reply->header(QNetworkRequest::LastModifiedHeader).toDateTime().toUTC();
QString redirection = m_reply->header(QNetworkRequest::LocationHeader).toString(); QString acceptRanges = QString::fromLatin1(reply->rawHeader("Accept-Ranges"));
QString contentRange = QString::fromLatin1(reply->rawHeader("Content-Range"));
m_size = m_reply->header(QNetworkRequest::ContentLengthHeader).toInt(); reply->deleteLater();
m_lastModified = m_reply->header(QNetworkRequest::LastModifiedHeader).toDateTime().toUTC();
QString acceptRanges = QString::fromLatin1(m_reply->rawHeader("Accept-Ranges")); nlinfo("HTTP status code %d on HEAD for %s", status, Q2C(url));
QString contentRange = QString::fromLatin1(m_reply->rawHeader("Content-Range"));
m_reply->deleteLater(); if (!redirection.isEmpty())
m_reply = NULL; {
nlinfo("Redirected to %s", Q2C(redirection));
}
// redirection // redirection
if (status == 302) if (status == 302)
{ {
if (redirection.isEmpty()) if (redirection.isEmpty())
{ {
nlwarning("No redirection defined");
if (m_listener) m_listener->operationFail(tr("Redirection URL is not defined")); if (m_listener) m_listener->operationFail(tr("Redirection URL is not defined"));
return; return;
} }
@ -298,6 +309,8 @@ void CDownloader::onHeadFinished()
if (!m_supportsAcceptRanges && acceptRanges == "bytes") if (!m_supportsAcceptRanges && acceptRanges == "bytes")
{ {
nlinfo("Server supports resume for %s", Q2C(url));
// server supports resume, part 1 // server supports resume, part 1
m_supportsAcceptRanges = true; m_supportsAcceptRanges = true;
@ -309,6 +322,7 @@ void CDownloader::onHeadFinished()
// server doesn't support resume or // server doesn't support resume or
// we requested range, but server always returns 200 // we requested range, but server always returns 200
// download from the beginning // download from the beginning
nlwarning("Server doesn't support resume, download %s from the beginning", Q2C(url));
} }
// we requested with a range // we requested with a range
@ -327,10 +341,12 @@ void CDownloader::onHeadFinished()
// update offset and size // update offset and size
if (m_listener) m_listener->operationInit(m_offset, m_size); if (m_listener) m_listener->operationInit(m_offset, m_size);
nlinfo("Server supports resume for %s: offset %" NL_I64 "d, size %" NL_I64 "d", Q2C(url), m_offset, m_size);
} }
else else
{ {
qDebug() << "Unable to parse"; nlwarning("Unable to parse %s", Q2C(contentRange));
} }
} }
@ -367,10 +383,14 @@ void CDownloader::onHeadFinished()
void CDownloader::onDownloadFinished() void CDownloader::onDownloadFinished()
{ {
int status = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
QString url = reply->url().toString();
m_reply->deleteLater(); reply->deleteLater();
m_reply = NULL;
nlwarning("Download finished with HTTP status code %d when downloading %s", status, Q2C(url));
closeFile(); closeFile();
@ -401,6 +421,10 @@ void CDownloader::onDownloadFinished()
void CDownloader::onError(QNetworkReply::NetworkError error) void CDownloader::onError(QNetworkReply::NetworkError error)
{ {
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
nlwarning("Network error %s (%d) when downloading %s", Q2C(reply->errorString()), error, Q2C(m_url));
if (!m_listener) return; if (!m_listener) return;
if (error == QNetworkReply::OperationCanceledError) if (error == QNetworkReply::OperationCanceledError)
@ -415,13 +439,17 @@ void CDownloader::onDownloadProgress(qint64 current, qint64 total)
if (!m_listener) return; if (!m_listener) return;
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
m_listener->operationProgress(m_offset + current, m_url); m_listener->operationProgress(m_offset + current, m_url);
// abort download // abort download
if (m_listener->operationShouldStop() && m_reply) m_reply->abort(); if (m_listener->operationShouldStop() && reply) reply->abort();
} }
void CDownloader::onDownloadRead() void CDownloader::onDownloadRead()
{ {
if (m_file) m_file->write(m_reply->readAll()); QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
if (m_file && reply) m_file->write(reply->readAll());
} }

@ -76,7 +76,6 @@ protected:
bool checkDownloadedFile(); bool checkDownloadedFile();
QNetworkAccessManager *m_manager; QNetworkAccessManager *m_manager;
QNetworkReply *m_reply;
QTimer *m_timer; QTimer *m_timer;
QString m_url; QString m_url;

@ -132,17 +132,18 @@ void CInstallDialog::accept()
// check free disk space // check free disk space
qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData()); qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData());
// shouldn't happen
if (freeSpace == 0) if (freeSpace == 0)
{ {
QString error = qFromUtf8(NLMISC::formatErrorMessage(NLMISC::getLastError())); int error = NLMISC::getLastError();
QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Error"), tr("Error '%1' occured when trying to check free disk space on %2.").arg(error).arg(m_dstDirectory)); nlwarning("Error '%s' (%d) occured when trying to check free disk space on %s, continue anyway", NLMISC::formatErrorMessage(error).c_str(), error, Q2C(m_dstDirectory));
return;
} }
const CServer &server = CConfigFile::getInstance()->getServer(); const CServer &server = CConfigFile::getInstance()->getServer();
if (freeSpace < server.dataUncompressedSize) // compare with exact size of current directory
if (freeSpace && freeSpace < server.dataUncompressedSize)
{ {
QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Not enough free disk space"), tr("You don't have enough free space on this disk, please make more space or choose a directory on another disk.")); QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Not enough free disk space"), tr("You don't have enough free space on this disk, please make more space or choose a directory on another disk."));
return; return;

@ -152,6 +152,11 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
// init log
CLogHelper logHelper(config.getInstallationDirectory());
nlinfo("Launched %s", Q2C(config.getInstallerCurrentFilePath()));
#if defined(Q_OS_WIN) && !defined(_DEBUG) #if defined(Q_OS_WIN) && !defined(_DEBUG)
// under Windows, Ryzom Installer should always be copied in TEMP directory // under Windows, Ryzom Installer should always be copied in TEMP directory
QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation); QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
@ -159,6 +164,8 @@ int main(int argc, char *argv[])
// check if launched from TEMP directory // check if launched from TEMP directory
if (step == Done && !config.getInstallerCurrentDirPath().startsWith(tempPath)) if (step == Done && !config.getInstallerCurrentDirPath().startsWith(tempPath))
{ {
nlinfo("Not launched from TEMP directory");
// try to delete all temporary installers // try to delete all temporary installers
QDir tempDir(tempPath); QDir tempDir(tempPath);
@ -173,17 +180,25 @@ int main(int argc, char *argv[])
QDir dirToRemove(tempDir); QDir dirToRemove(tempDir);
dirToRemove.cd(dir); dirToRemove.cd(dir);
dirToRemove.removeRecursively(); dirToRemove.removeRecursively();
nlinfo("Delete directory %s", Q2C(dir));
} }
tempPath += QString("/ryzom_installer_%1").arg(QDateTime::currentMSecsSinceEpoch()); tempPath += QString("/ryzom_installer_%1").arg(QDateTime::currentMSecsSinceEpoch());
nlinfo("Creating directory %s", Q2C(tempPath));
// copy installer and required files to TEMP directory // copy installer and required files to TEMP directory
if (QDir().mkdir(tempPath) && copyInstallerFiles(config.getInstallerRequiredFiles(), tempPath)) if (QDir().mkdir(tempPath) && copyInstallerFiles(config.getInstallerRequiredFiles(), tempPath))
{ {
QString tempFile = tempPath + "/" + QFileInfo(config.getInstallerCurrentFilePath()).fileName(); QString tempFile = tempPath + "/" + QFileInfo(config.getInstallerCurrentFilePath()).fileName();
nlinfo("Launching %s", Q2C(tempFile));
// launch copy in TEMP directory with same arguments // launch copy in TEMP directory with same arguments
if (QProcess::startDetached(tempFile, QApplication::arguments())) return 0; if (QProcess::startDetached(tempFile, QApplication::arguments())) return 0;
nlwarning("Unable to launch %s", Q2C(tempFile));
} }
} }
#endif #endif
@ -193,6 +208,8 @@ int main(int argc, char *argv[])
if (parser.isSet(uninstallOption)) if (parser.isSet(uninstallOption))
{ {
nlinfo("Uninstalling...");
SComponents components; SComponents components;
// add all servers by default // add all servers by default
@ -227,6 +244,8 @@ int main(int argc, char *argv[])
if (step == ShowMigrateWizard) if (step == ShowMigrateWizard)
{ {
nlinfo("Display migration dialog");
CMigrateDialog dialog; CMigrateDialog dialog;
if (!dialog.exec()) return 1; if (!dialog.exec()) return 1;
@ -235,6 +254,8 @@ int main(int argc, char *argv[])
} }
else if (step == ShowInstallWizard) else if (step == ShowInstallWizard)
{ {
nlinfo("Display installation dialog");
CInstallDialog dialog; CInstallDialog dialog;
if (!dialog.exec()) return 1; if (!dialog.exec()) return 1;
@ -242,6 +263,8 @@ int main(int argc, char *argv[])
step = config.getInstallNextStep(); step = config.getInstallNextStep();
} }
nlinfo("Next step is %s", Q2C(stepToString(step)));
bool restartInstaller = false; bool restartInstaller = false;
if (step != Done) if (step != Done)
@ -254,6 +277,8 @@ int main(int argc, char *argv[])
step = config.getInstallNextStep(); step = config.getInstallNextStep();
nlinfo("Last step is %s", Q2C(stepToString(step)));
if (step == LaunchInstalledInstaller) if (step == LaunchInstalledInstaller)
{ {
// restart more recent installed Installer version // restart more recent installed Installer version
@ -271,6 +296,8 @@ int main(int argc, char *argv[])
if (restartInstaller) if (restartInstaller)
{ {
#ifndef _DEBUG #ifndef _DEBUG
nlinfo("Restart Installer %s", Q2C(config.getInstallerInstalledFilePath()));
#ifndef Q_OS_WIN32 #ifndef Q_OS_WIN32
// fix executable permissions under UNIX // fix executable permissions under UNIX
QFile::setPermissions(config.getInstallerInstalledFilePath(), QFile::permissions(config.getInstallerInstalledFilePath()) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther); QFile::setPermissions(config.getInstallerInstalledFilePath(), QFile::permissions(config.getInstallerInstalledFilePath()) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther);

@ -147,16 +147,16 @@ void CMigrateDialog::accept()
// check free disk space // check free disk space
qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData()); qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData());
// shouldn't happen
if (freeSpace == 0) if (freeSpace == 0)
{ {
QString error = qFromUtf8(NLMISC::formatErrorMessage(NLMISC::getLastError())); int error = NLMISC::getLastError();
QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Error"), tr("Error '%1' occured when trying to check free disk space on %2.").arg(error).arg(m_dstDirectory)); nlwarning("Error '%s' (%d) occured when trying to check free disk space on %s, continue anyway", NLMISC::formatErrorMessage(error).c_str(), error, Q2C(m_dstDirectory));
return;
} }
// compare with exact size of current directory // compare with exact size of current directory
if (freeSpace < getDirectorySize(m_currentDirectory, true)) if (freeSpace && freeSpace < getDirectorySize(m_currentDirectory, true))
{ {
QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Not enough free disk space"), tr("You don't have enough free space on this disk, please make more space or choose a directory on another disk.")); QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Not enough free disk space"), tr("You don't have enough free space on this disk, please make more space or choose a directory on another disk."));
return; return;

@ -73,6 +73,8 @@ enum OperationStep
Done Done
}; };
QString stepToString(OperationStep);
enum OperationType enum OperationType
{ {
OperationNone, OperationNone,

@ -54,8 +54,10 @@
#include <string> #include <string>
#include <nel/misc/types_nl.h> #include "nel/misc/types_nl.h"
#include <nel/misc/config_file.h> #include "nel/misc/debug.h"
#include "nel/misc/path.h"
#include "nel/misc/system_info.h"
#endif #endif

@ -563,3 +563,51 @@ CCOMHelper::~CCOMHelper()
if (m_mustUninit) CoUninitialize(); if (m_mustUninit) CoUninitialize();
#endif #endif
} }
CLogHelper::CLogHelper(const QString &logPath)
{
// disable nldebug messages in logs in Release
#ifdef NL_RELEASE
NLMISC::DisableNLDebug = true;
#endif
// don't create a file for the moment, we'll create it manually
NLMISC::createDebug(NULL, false);
// ryzom_installer.Log displayer
NLMISC::CFileDisplayer *LogDisplayer = new NLMISC::CFileDisplayer(qToUtf8(logPath) + "/ryzom_installer.log", true, "DEFAULT_FD");
NLMISC::DebugLog->addDisplayer(LogDisplayer);
NLMISC::InfoLog->addDisplayer(LogDisplayer);
NLMISC::WarningLog->addDisplayer(LogDisplayer);
NLMISC::ErrorLog->addDisplayer(LogDisplayer);
NLMISC::AssertLog->addDisplayer(LogDisplayer);
std::string type;
#ifdef NL_RELEASE
type = "RELEASE";
#else
type = "DEBUG";
#endif
// Display installer version
nlinfo("RYZOM INSTALLER VERSION: %s (%s)", Q2C(QApplication::applicationVersion()), type.c_str());
nlinfo("Memory: %s/%s", NLMISC::bytesToHumanReadable(NLMISC::CSystemInfo::availablePhysicalMemory()).c_str(), NLMISC::bytesToHumanReadable(NLMISC::CSystemInfo::totalPhysicalMemory()).c_str());
nlinfo("OS: %s", NLMISC::CSystemInfo::getOS().c_str());
nlinfo("Processor: %s", NLMISC::CSystemInfo::getProc().c_str());
}
CLogHelper::~CLogHelper()
{
NLMISC::IDisplayer *LogDisplayer = NLMISC::ErrorLog->getDisplayer("DEFAULT_FD");
if (LogDisplayer)
{
NLMISC::DebugLog->removeDisplayer(LogDisplayer);
NLMISC::InfoLog->removeDisplayer(LogDisplayer);
NLMISC::WarningLog->removeDisplayer(LogDisplayer);
NLMISC::ErrorLog->removeDisplayer(LogDisplayer);
NLMISC::AssertLog->removeDisplayer(LogDisplayer);
delete LogDisplayer;
}
}

@ -58,6 +58,8 @@ QString qFromWide(const wchar_t *str);
// convert an QString to wchar_t* // convert an QString to wchar_t*
wchar_t* qToWide(const QString &str); wchar_t* qToWide(const QString &str);
#define Q2C(x) qToUtf8(x).c_str()
// check if a shortcut already exists (the extension will be added) // check if a shortcut already exists (the extension will be added)
bool shortcutExists(const QString &shortcut); bool shortcutExists(const QString &shortcut);
@ -92,4 +94,12 @@ public:
~CCOMHelper(); ~CCOMHelper();
}; };
// a little helper class to init/uninit log
class CLogHelper
{
public:
CLogHelper(const QString &logPath);
~CLogHelper();
};
#endif #endif

Loading…
Cancel
Save