Subversion Repositories tpanel

Rev

Rev 462 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 462 Rev 463
Line 76... Line 76...
76
    if (!xml.parse())
76
    if (!xml.parse())
77
        return false;
77
        return false;
78
 
78
 
79
    int depth = 0;
79
    int depth = 0;
80
    size_t index = 0;
80
    size_t index = 0;
-
 
81
    MSG_DEBUG("Reading version info ...");
81
 
82
 
82
    if (xml.getElementIndex("versionInfo", &depth) == TExpat::npos)
83
    if (xml.getElementIndex("versionInfo", &depth) == TExpat::npos)
83
    {
84
    {
84
        MSG_ERROR("Couldn't find the project version information! Broken surface?");
85
        MSG_ERROR("Couldn't find the project version information! Broken surface?");
85
        TError::setError();
86
        TError::setError();
Line 94... Line 95...
94
    mSetup.versionInfo.fileVersion = xml.getElement("fileVersion", depth);
95
    mSetup.versionInfo.fileVersion = xml.getElement("fileVersion", depth);
95
    mSetup.versionInfo.designVersion = xml.getElement("designVersion", depth);
96
    mSetup.versionInfo.designVersion = xml.getElement("designVersion", depth);
96
    mSetup.versionInfo.g5appsVersion = xml.getElementInt("g5appsVersion", depth, &valid);
97
    mSetup.versionInfo.g5appsVersion = xml.getElementInt("g5appsVersion", depth, &valid);
97
 
98
 
98
    if (!valid)
99
    if (!valid)
-
 
100
    {
99
        mSetup.versionInfo.g5appsVersion = 0;   // No TP5 file
101
        mSetup.versionInfo.g5appsVersion = 0;   // No TP5 file
-
 
102
        MSG_INFO("Detected a TP4 file");
100
 
103
    }
101
    depth--;
104
    else
102
 
-
 
103
    if (xml.getElementIndex("versionInfo", &depth) == TExpat::npos)
-
 
104
    {
105
    {
105
        MSG_ERROR("Couldn't find the project version information! Broken surface?");
-
 
106
        TError::setError();
106
        MSG_INFO("Detected a TP5 file");
107
        return false;
-
 
108
    }
107
    }
109
 
108
 
110
    depth++;
-
 
111
    valid = false;
-
 
112
 
-
 
113
    mSetup.supportFiles.mapFile = xml.getElement("mapFile", depth);
109
    MSG_DEBUG("Reading project info ...");
114
    mSetup.supportFiles.colorFile = xml.getElement("colorFile", depth);
-
 
115
    mSetup.supportFiles.fontFile = xml.getElement("fontFile", depth);
-
 
116
    mSetup.supportFiles.themeFile = xml.getElement("themeFile", depth);
-
 
117
    mSetup.supportFiles.iconFile = xml.getElement("iconFile", depth);
-
 
118
    mSetup.supportFiles.externalButtonFile = xml.getElement("externalButtonFile", depth);
-
 
119
    mSetup.supportFiles.appFile = xml.getElement("appFile", depth);
-
 
120
 
-
 
121
    depth--;
-
 
122
 
110
 
123
    if (xml.getElementIndex("projectInfo", &depth) == TExpat::npos)
111
    if (xml.getElementIndex("projectInfo", &depth) == TExpat::npos)
124
    {
112
    {
125
        MSG_ERROR("Couldn't find the project information! Broken surface?");
113
        MSG_ERROR("Couldn't find the project information! Broken surface?");
126
        TError::setError();
114
        TError::setError();
Line 146... Line 134...
146
    mProject.fileName = xml.getElement("fileName", depth);
134
    mProject.fileName = xml.getElement("fileName", depth);
147
    mProject.colorChoice = xml.getElement("colorChoice", depth);
135
    mProject.colorChoice = xml.getElement("colorChoice", depth);
148
    mProject.specifyPortCount = xml.getElementInt("specifyPortCount", depth);
136
    mProject.specifyPortCount = xml.getElementInt("specifyPortCount", depth);
149
    mProject.specifyChanCount = xml.getElementInt("specifyChanCount", depth);
137
    mProject.specifyChanCount = xml.getElementInt("specifyChanCount", depth);
150
 
138
 
-
 
139
    MSG_DEBUG("Reading support file list ...");
-
 
140
 
-
 
141
    if (xml.getElementIndex("supportFileList", &depth) == TExpat::npos)
-
 
142
    {
-
 
143
        MSG_ERROR("Couldn't find the support file list! Broken surface?");
-
 
144
        TError::setError();
-
 
145
        return false;
-
 
146
    }
-
 
147
 
-
 
148
    depth++;
-
 
149
    valid = false;
-
 
150
 
-
 
151
    mSetup.supportFiles.mapFile = xml.getElement("mapFile", depth);
-
 
152
    mSetup.supportFiles.colorFile = xml.getElement("colorFile", depth);
-
 
153
    mSetup.supportFiles.fontFile = xml.getElement("fontFile", depth);
-
 
154
    mSetup.supportFiles.themeFile = xml.getElement("themeFile", depth);
-
 
155
    mSetup.supportFiles.iconFile = xml.getElement("iconFile", depth);
-
 
156
    mSetup.supportFiles.externalButtonFile = xml.getElement("externalButtonFile", depth);
-
 
157
    mSetup.supportFiles.appFile = xml.getElement("appFile", depth);
-
 
158
 
-
 
159
    MSG_DEBUG("Map file:     " << mSetup.supportFiles.mapFile);
-
 
160
    MSG_DEBUG("Color file:   " << mSetup.supportFiles.colorFile);
-
 
161
    MSG_DEBUG("Font file:    " << mSetup.supportFiles.fontFile);
-
 
162
    MSG_DEBUG("Theme file:   " << mSetup.supportFiles.themeFile);
-
 
163
    
-
 
164
    if (!isTP5())
-
 
165
        MSG_DEBUG("IconFile:     " << mSetup.supportFiles.iconFile);
-
 
166
 
-
 
167
    MSG_DEBUG("Ext. buttons: " << mSetup.supportFiles.externalButtonFile);
-
 
168
 
-
 
169
    if (isTP5())
-
 
170
        MSG_DEBUG("App file:     " << mSetup.supportFiles.appFile);
-
 
171
 
-
 
172
    MSG_DEBUG("Reading panel setup ...");
-
 
173
 
151
    if ((index = xml.getElementIndex("panelSetup", &depth)) == TExpat::npos)
174
    if ((index = xml.getElementIndex("panelSetup", &depth)) == TExpat::npos)
152
    {
175
    {
153
        MSG_ERROR("Couldn't find the section \"panelSetup\" in file!");
176
        MSG_ERROR("Couldn't find the section \"panelSetup\" in file!");
154
        TError::setError();
177
        TError::setError();
155
        return false;
178
        return false;
Line 227... Line 250...
227
    mSetup.activePalette = xml.getElementInt("activePalette", depth);
250
    mSetup.activePalette = xml.getElementInt("activePalette", depth);
228
    mSetup.marqueeSpeed = xml.getElementInt("marqueeSpeed", depth);
251
    mSetup.marqueeSpeed = xml.getElementInt("marqueeSpeed", depth);
229
    mSetup.setupPagesProject = xml.getElementInt("setupPagesProject", depth);
252
    mSetup.setupPagesProject = xml.getElementInt("setupPagesProject", depth);
230
    mSetup.voipCommandPort = xml.getElementInt("voipCommandPort", depth);
253
    mSetup.voipCommandPort = xml.getElementInt("voipCommandPort", depth);
231
 
254
 
-
 
255
    MSG_DEBUG("Reading resource list ...");
-
 
256
 
232
    if ((index = xml.getElementIndex("resourceList", &depth)) == TExpat::npos)
257
    if ((index = xml.getElementIndex("resourceList", &depth)) == TExpat::npos)
233
    {
258
    {
234
        MSG_WARNING("Missing element \"resourceList\" in file!");
259
        MSG_WARNING("Missing element \"resourceList\" in file!");
235
    }
260
    }
236
 
261
 
Line 305... Line 330...
305
                    index = oldIndex + 2;
330
                    index = oldIndex + 2;
306
            }
331
            }
307
 
332
 
308
            vector<RESOURCE_LIST_T>::iterator itResList;
333
            vector<RESOURCE_LIST_T>::iterator itResList;
309
 
334
 
310
            for (itResList = mResourceLists.begin(); itResList != mResourceLists.end(); itResList++)
335
            for (itResList = mResourceLists.begin(); itResList != mResourceLists.end(); ++itResList)
311
            {
336
            {
312
                if (itResList->type.compare(type) == 0)
337
                if (itResList->type.compare(type) == 0)
313
                {
338
                {
314
                    mResourceLists.erase(itResList);
339
                    mResourceLists.erase(itResList);
315
                    mResourceLists.push_back(list);
340
                    mResourceLists.push_back(list);
Line 318... Line 343...
318
            }
343
            }
319
        }
344
        }
320
        while ((index = xml.getNextElementIndex("resourceList", depth)) != TExpat::npos);
345
        while ((index = xml.getNextElementIndex("resourceList", depth)) != TExpat::npos);
321
    }
346
    }
322
 
347
 
-
 
348
    MSG_DEBUG("Reading palette list ...");
-
 
349
 
323
    if (xml.getElementIndex("paletteList", &depth) == TExpat::npos)
350
    if (xml.getElementIndex("paletteList", &depth) == TExpat::npos)
324
    {
351
    {
325
        if (!isTP5())
352
        if (!isTP5())
326
        {
353
        {
327
            MSG_WARNING("There exists no color palette! There will be only the system colors available.");
354
            MSG_WARNING("There exists no color palette! There will be only the system colors available.");