mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-27 19:30:54 +00:00
CHANGED: #1471 Extended the project file parser a little, now it also takes a MasterGroup name, and the name of a group that's activated after parsing. These are used to activate the groups, so that the Nel GUI widgets can be drawn.
This commit is contained in:
parent
5d04c95e1c
commit
cda0199889
7 changed files with 62 additions and 20 deletions
|
@ -140,9 +140,9 @@ namespace GUIEditor
|
|||
setCursor( Qt::ArrowCursor );
|
||||
return;
|
||||
}
|
||||
projectFiles.clear();
|
||||
projectFiles.clearAll();
|
||||
parser.getProjectFiles( projectFiles );
|
||||
currentProject = parser.getProjectName().c_str();
|
||||
currentProject = projectFiles.projectName.c_str();
|
||||
projectWindow->setupFiles( projectFiles );
|
||||
if( viewPort->parse( projectFiles ) )
|
||||
viewPort->draw();
|
||||
|
|
|
@ -80,6 +80,12 @@ namespace GUIEditor
|
|||
return false;
|
||||
|
||||
CWidgetManager::getInstance()->updateAllLocalisedElements();
|
||||
CWidgetManager::getInstance()->activateMasterGroup( files.masterGroup, true );
|
||||
|
||||
CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( files.activeGroup );
|
||||
if( e != NULL )
|
||||
e->setActive( true );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,9 @@ namespace GUIEditor
|
|||
projectFiles.mapFiles.resize( files.mapFiles.size() );
|
||||
std::copy( files.guiFiles.begin(), files.guiFiles.end(), projectFiles.guiFiles.begin() );
|
||||
std::copy( files.mapFiles.begin(), files.mapFiles.end(), projectFiles.mapFiles.begin() );
|
||||
projectFiles.projectName = files.projectName;
|
||||
projectFiles.masterGroup = files.masterGroup;
|
||||
projectFiles.activeGroup = files.activeGroup;
|
||||
}
|
||||
|
||||
bool CProjectFileParser::parseXMLFile(QFile &f)
|
||||
|
@ -85,18 +88,37 @@ namespace GUIEditor
|
|||
|
||||
bool CProjectFileParser::parseHeader( QXmlStreamReader &reader )
|
||||
{
|
||||
while( !reader.atEnd() && !( reader.isStartElement() && ( reader.name() == "name" ) ) )
|
||||
reader.readNext();
|
||||
if( reader.atEnd() )
|
||||
return false;
|
||||
while( !reader.atEnd() && !( reader.isEndElement() && ( reader.name() == "header" ) ) )
|
||||
{
|
||||
if( reader.isStartElement() )
|
||||
{
|
||||
if( reader.name() == "name" )
|
||||
{
|
||||
QString name = reader.readElementText( QXmlStreamReader::ErrorOnUnexpectedElement );
|
||||
if( name.isEmpty() )
|
||||
return false;
|
||||
files.projectName = name.toStdString();
|
||||
}
|
||||
else
|
||||
if( reader.name() == "mastergroup" )
|
||||
{
|
||||
QString mg = reader.readElementText( QXmlStreamReader::ErrorOnUnexpectedElement );
|
||||
if( mg.isEmpty() )
|
||||
return false;
|
||||
files.masterGroup = mg.toStdString();
|
||||
}
|
||||
else
|
||||
if( reader.name() == "activegroup" )
|
||||
{
|
||||
QString ag = reader.readElementText( QXmlStreamReader::ErrorOnUnexpectedElement );
|
||||
if( ag.isEmpty() )
|
||||
return false;
|
||||
files.activeGroup = ag.toStdString();
|
||||
}
|
||||
}
|
||||
|
||||
QString name = reader.readElementText( QXmlStreamReader::ErrorOnUnexpectedElement );
|
||||
if( name.isEmpty() )
|
||||
return false;
|
||||
projectName = name.toStdString();
|
||||
|
||||
while( !reader.atEnd() && !( reader.isEndElement() ) && ( reader.name() == "header" ) )
|
||||
reader.readNext();
|
||||
}
|
||||
if( reader.atEnd() )
|
||||
return false;
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace GUIEditor
|
|||
~CProjectFileParser();
|
||||
|
||||
bool parseProjectFile( std::string &name );
|
||||
const std::string& getProjectName() const{ return projectName; }
|
||||
void getProjectFiles( SProjectFiles &projectFiles ) const;
|
||||
|
||||
private:
|
||||
|
@ -44,7 +43,6 @@ namespace GUIEditor
|
|||
bool parseMapFiles( QXmlStreamReader &reader );
|
||||
|
||||
SProjectFiles files;
|
||||
std::string projectName;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -26,14 +26,25 @@ namespace GUIEditor
|
|||
struct SProjectFiles
|
||||
{
|
||||
public:
|
||||
std::string projectName;
|
||||
std::string masterGroup;
|
||||
std::string activeGroup;
|
||||
std::vector< std::string > guiFiles;
|
||||
std::vector< std::string > mapFiles;
|
||||
|
||||
void clear()
|
||||
void clearFiles()
|
||||
{
|
||||
guiFiles.clear();
|
||||
mapFiles.clear();
|
||||
}
|
||||
|
||||
void clearAll()
|
||||
{
|
||||
clearFiles();
|
||||
projectName = "";
|
||||
masterGroup = "";
|
||||
activeGroup = "";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
<project>
|
||||
<header>
|
||||
<name>login</name>
|
||||
<mastergroup>ui:login</mastergroup>
|
||||
<activegroup>ui:login:checkpass</activegroup>
|
||||
</header>
|
||||
<files>
|
||||
<guifiles>
|
||||
<file>login_config.xml</file>
|
||||
<file>login_keys.xml</file>
|
||||
<file>login_main.xml</file>
|
||||
<file>login_widgets.xml</file>
|
||||
</files>
|
||||
<file>login_main.xml</file>
|
||||
<file>login_keys.xml</file>
|
||||
</guifiles>
|
||||
<mapfiles>
|
||||
<file>texture_interfaces_v3_login.tga</file>
|
||||
</mapfiles>
|
||||
</project>
|
|
@ -77,7 +77,7 @@ namespace GUIEditor
|
|||
|
||||
void ProjectWindow::updateFiles( SProjectFiles &projectFiles )
|
||||
{
|
||||
projectFiles.clear();
|
||||
projectFiles.clearFiles();
|
||||
|
||||
QTreeWidgetItem *topItem;
|
||||
|
||||
|
|
Loading…
Reference in a new issue