Subversion Repositories tpanel

Rev

Rev 197 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 197 Rev 208
Line 43... Line 43...
43
#include "terror.h"
43
#include "terror.h"
44
#include "tvalidatefile.h"
44
#include "tvalidatefile.h"
45
#include "tconfig.h"
45
#include "tconfig.h"
46
#include "tfsfreader.h"
46
#include "tfsfreader.h"
47
#include "tdirectory.h"
47
#include "tdirectory.h"
-
 
48
#include "tpagemanager.h"
48
#include "tresources.h"
49
#include "tresources.h"
49
 
50
 
50
#if __cplusplus < 201402L
51
#if __cplusplus < 201402L
51
#   error "This module requires at least C++14 standard!"
52
#   error "This module requires at least C++14 standard!"
52
#else
53
#else
Line 2201... Line 2202...
2201
{
2202
{
2202
    DECL_TRACER("TTPInit::loadSurfaceFromController(bool force)");
2203
    DECL_TRACER("TTPInit::loadSurfaceFromController(bool force)");
2203
 
2204
 
2204
    TFsfReader reader;
2205
    TFsfReader reader;
2205
    reader.regCallbackProgress(bind(&TTPInit::progressCallback, this, std::placeholders::_1));
2206
    reader.regCallbackProgress(bind(&TTPInit::progressCallback, this, std::placeholders::_1));
-
 
2207
    bool temp = TConfig::getTemporary();
-
 
2208
 
-
 
2209
    if (gPageManager && gPageManager->isSetupActive())
-
 
2210
        TConfig::setTemporary(true);
-
 
2211
    else
-
 
2212
        TConfig::setTemporary(false);
-
 
2213
 
-
 
2214
    string surface = TConfig::getFtpSurface();
-
 
2215
    TConfig::setTemporary(temp);
2206
    string target = mPath + "/" + TConfig::getFtpSurface();
2216
    string target = mPath + "/" + surface;
2207
    size_t pos = 0;
2217
    size_t pos = 0;
2208
 
2218
 
2209
    if ((pos = mPath.find_last_of("/")) != string::npos)
2219
    if ((pos = mPath.find_last_of("/")) != string::npos)
2210
        target = mPath.substr(0, pos) + "/" + TConfig::getFtpSurface();
2220
        target = mPath.substr(0, pos) + "/" + surface;
2211
 
2221
 
2212
    if (!force)
2222
    if (!force)
2213
    {
2223
    {
2214
        if (!isVirgin() || TConfig::getFtpDownloadTime() > 0)
2224
        if (!isVirgin() || TConfig::getFtpDownloadTime() > 0)
2215
            return false;
2225
            return false;
Line 2228... Line 2238...
2228
        dir.dropDir(mPath + "/fonts");
2238
        dir.dropDir(mPath + "/fonts");
2229
        dir.dropDir(mPath + "/images");
2239
        dir.dropDir(mPath + "/images");
2230
        dir.dropDir(mPath + "/sounds");
2240
        dir.dropDir(mPath + "/sounds");
2231
    }
2241
    }
2232
 
2242
 
2233
    if (!reader.copyOverFTP(TConfig::getFtpSurface(), target))
2243
    if (!reader.copyOverFTP(surface, target))
2234
    {
2244
    {
2235
        if (TConfig::getFtpDownloadTime() == 0)
2245
        if (TConfig::getFtpDownloadTime() == 0)
2236
            createPanelConfigs();
2246
            createPanelConfigs();
2237
 
2247
 
2238
        return false;
2248
        return false;
Line 2405... Line 2415...
2405
        _processEvents();
2415
        _processEvents();
2406
 
2416
 
2407
    return 1;
2417
    return 1;
2408
}
2418
}
2409
 
2419
 
-
 
2420
off64_t TTPInit::getFileSize(const string& file)
-
 
2421
{
-
 
2422
    DECL_TRACER("TTPInit::getFileSize(const string& file)");
-
 
2423
 
-
 
2424
    vector<FILELIST_t>::iterator iter;
-
 
2425
 
-
 
2426
    if (!mDirList.empty())
-
 
2427
    {
-
 
2428
        for (iter = mDirList.begin(); iter != mDirList.end(); ++iter)
-
 
2429
        {
-
 
2430
            if (iter->fname == file)
-
 
2431
                return iter->size;
-
 
2432
        }
-
 
2433
    }
-
 
2434
 
-
 
2435
    // Here we know that we've no files in our cache. Therefor we'll read from
-
 
2436
    // the NetLinx, if possible.
-
 
2437
    getFileList(".tp4");
-
 
2438
 
-
 
2439
    if (mDirList.empty())
-
 
2440
        return 0;
-
 
2441
 
-
 
2442
    // Now search again for the file.
-
 
2443
    for (iter = mDirList.begin(); iter != mDirList.end(); ++iter)
-
 
2444
    {
-
 
2445
        if (iter->fname == file)
-
 
2446
            return iter->size;
-
 
2447
    }
-
 
2448
 
-
 
2449
    // The file doesn't exist, or we couldn't read from a NetLinx.
-
 
2450
    return 0;
-
 
2451
}
-
 
2452
 
2410
bool TTPInit::isSystemDefault()
2453
bool TTPInit::isSystemDefault()
2411
{
2454
{
2412
    DECL_TRACER("TTPInit::isSystemDefault()");
2455
    DECL_TRACER("TTPInit::isSystemDefault()");
2413
 
2456
 
2414
    try
2457
    try