Subversion Repositories tpanel

Rev

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

Rev 463 Rev 486
Line 1... Line 1...
1
/*
1
/*
2
 * Copyright (C) 2020 to 2022 by Andreas Theofilu <andreas@theosys.at>
2
 * Copyright (C) 2020 to 2025 by Andreas Theofilu <andreas@theosys.at>
3
 *
3
 *
4
 * This program is free software; you can redistribute it and/or modify
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
7
 * (at your option) any later version.
Line 18... Line 18...
18
 
18
 
19
#include <unistd.h>
19
#include <unistd.h>
20
#include "tsettings.h"
20
#include "tsettings.h"
21
#include "texpat++.h"
21
#include "texpat++.h"
22
#include "terror.h"
22
#include "terror.h"
-
 
23
#include "ttpinit.h"
23
 
24
 
24
#if __cplusplus < 201402L
25
#if __cplusplus < 201402L
25
#   error "This module requires at least C++14 standard!"
26
#   error "This module requires at least C++14 standard!"
26
#else
27
#else
27
#   if __cplusplus < 201703L
28
#   if __cplusplus < 201703L
Line 69... Line 70...
69
        TError::setError();
70
        TError::setError();
70
        return false;
71
        return false;
71
    }
72
    }
72
 
73
 
73
    TExpat xml(fname);
74
    TExpat xml(fname);
-
 
75
 
-
 
76
    if (!TTPInit::isTP5())
74
    xml.setEncoding(ENC_CP1250);
77
        xml.setEncoding(ENC_CP1250);
-
 
78
    else
-
 
79
        xml.setEncoding(ENC_UTF8);
75
 
80
 
76
    if (!xml.parse())
81
    if (!xml.parse())
77
        return false;
82
        return false;
78
 
83
 
79
    int depth = 0;
84
    int depth = 0;
Line 97... Line 102...
97
    mSetup.versionInfo.g5appsVersion = xml.getElementInt("g5appsVersion", depth, &valid);
102
    mSetup.versionInfo.g5appsVersion = xml.getElementInt("g5appsVersion", depth, &valid);
98
 
103
 
99
    if (!valid)
104
    if (!valid)
100
    {
105
    {
101
        mSetup.versionInfo.g5appsVersion = 0;   // No TP5 file
106
        mSetup.versionInfo.g5appsVersion = 0;   // No TP5 file
-
 
107
        mIsTp5 = false;
102
        MSG_INFO("Detected a TP4 file");
108
        MSG_INFO("Detected a TP4 file");
103
    }
109
    }
104
    else
110
    else
105
    {
111
    {
-
 
112
        mIsTp5 = true;
106
        MSG_INFO("Detected a TP5 file");
113
        MSG_INFO("Detected a TP5 file");
107
    }
114
    }
108
 
115
 
109
    MSG_DEBUG("Reading project info ...");
116
    MSG_DEBUG("Reading project info ...");
110
 
117
 
Line 150... Line 157...
150
 
157
 
151
    mSetup.supportFiles.mapFile = xml.getElement("mapFile", depth);
158
    mSetup.supportFiles.mapFile = xml.getElement("mapFile", depth);
152
    mSetup.supportFiles.colorFile = xml.getElement("colorFile", depth);
159
    mSetup.supportFiles.colorFile = xml.getElement("colorFile", depth);
153
    mSetup.supportFiles.fontFile = xml.getElement("fontFile", depth);
160
    mSetup.supportFiles.fontFile = xml.getElement("fontFile", depth);
154
    mSetup.supportFiles.themeFile = xml.getElement("themeFile", depth);
161
    mSetup.supportFiles.themeFile = xml.getElement("themeFile", depth);
-
 
162
 
-
 
163
    if (!mIsTp5)
155
    mSetup.supportFiles.iconFile = xml.getElement("iconFile", depth);
164
        mSetup.supportFiles.iconFile = xml.getElement("iconFile", depth);
-
 
165
 
156
    mSetup.supportFiles.externalButtonFile = xml.getElement("externalButtonFile", depth);
166
    mSetup.supportFiles.externalButtonFile = xml.getElement("externalButtonFile", depth);
-
 
167
 
-
 
168
    if (mIsTp5)
-
 
169
    {
157
    mSetup.supportFiles.appFile = xml.getElement("appFile", depth);
170
        mSetup.supportFiles.appFile = xml.getElement("appFile", depth);
-
 
171
        mSetup.supportFiles.logFile = xml.getElement("logFile", depth);
-
 
172
    }
158
 
173
 
159
    MSG_DEBUG("Map file:     " << mSetup.supportFiles.mapFile);
174
    MSG_DEBUG("Map file:     " << mSetup.supportFiles.mapFile);
160
    MSG_DEBUG("Color file:   " << mSetup.supportFiles.colorFile);
175
    MSG_DEBUG("Color file:   " << mSetup.supportFiles.colorFile);
161
    MSG_DEBUG("Font file:    " << mSetup.supportFiles.fontFile);
176
    MSG_DEBUG("Font file:    " << mSetup.supportFiles.fontFile);
162
    MSG_DEBUG("Theme file:   " << mSetup.supportFiles.themeFile);
177
    MSG_DEBUG("Theme file:   " << mSetup.supportFiles.themeFile);
163
    
178
    
164
    if (!isTP5())
179
    if (!mIsTp5)
165
        MSG_DEBUG("IconFile:     " << mSetup.supportFiles.iconFile);
180
        MSG_DEBUG("IconFile:     " << mSetup.supportFiles.iconFile);
166
 
181
 
167
    MSG_DEBUG("Ext. buttons: " << mSetup.supportFiles.externalButtonFile);
182
    MSG_DEBUG("Ext. buttons: " << mSetup.supportFiles.externalButtonFile);
168
 
183
 
169
    if (isTP5())
184
    if (mIsTp5)
-
 
185
    {
170
        MSG_DEBUG("App file:     " << mSetup.supportFiles.appFile);
186
        MSG_DEBUG("App file:     " << mSetup.supportFiles.appFile);
-
 
187
        MSG_DEBUG("Log file:     " << mSetup.supportFiles.logFile);
-
 
188
    }
171
 
189
 
172
    MSG_DEBUG("Reading panel setup ...");
190
    MSG_DEBUG("Reading panel setup ...");
173
 
191
 
174
    if ((index = xml.getElementIndex("panelSetup", &depth)) == TExpat::npos)
192
    if ((index = xml.getElementIndex("panelSetup", &depth)) == TExpat::npos)
175
    {
193
    {