|
|
|
@ -50,7 +50,7 @@ bool CalculateConfig::getDefaultConfig()
|
|
|
|
|
{
|
|
|
|
|
QDomElement domRoot = xmlVars.documentElement();
|
|
|
|
|
if (domRoot.tagName() == "variables") {
|
|
|
|
|
parseVariables(domRoot);
|
|
|
|
|
parseVariables(domRoot, m_Config);
|
|
|
|
|
} else {
|
|
|
|
|
qDebug() << "Section \"variables\" not found";
|
|
|
|
|
return false;
|
|
|
|
@ -80,7 +80,71 @@ bool CalculateConfig::getDefaultConfig()
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CalculateConfig::parseVariables(const QDomNode& node)
|
|
|
|
|
QStringList CalculateConfig::getPasswordUsers()
|
|
|
|
|
{
|
|
|
|
|
QStringList result;
|
|
|
|
|
|
|
|
|
|
MapConfig migrateUser;
|
|
|
|
|
|
|
|
|
|
QProcess cl_install;
|
|
|
|
|
|
|
|
|
|
QString usersParam;
|
|
|
|
|
|
|
|
|
|
foreach( const QString& user, m_Config["gui_users"].toStringList() )
|
|
|
|
|
{
|
|
|
|
|
usersParam += " --user " + user;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qDebug() << "Start cl-install" << usersParam << " -v --xml --filter *migrate*";
|
|
|
|
|
cl_install.start("cl-install" + usersParam + " -v --xml --filter *migrate*" );
|
|
|
|
|
|
|
|
|
|
if ( !cl_install.waitForStarted() )
|
|
|
|
|
{
|
|
|
|
|
qDebug() << "Process not started";
|
|
|
|
|
return QStringList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !cl_install.waitForFinished() )
|
|
|
|
|
{
|
|
|
|
|
qDebug() << "Process finished with error";
|
|
|
|
|
return QStringList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString outVars = cl_install.readAll();
|
|
|
|
|
|
|
|
|
|
QDomDocument xmlVars;
|
|
|
|
|
QString errMsg;
|
|
|
|
|
int errLine;
|
|
|
|
|
int errColumn;
|
|
|
|
|
|
|
|
|
|
if ( xmlVars.setContent(outVars, true, &errMsg, &errLine, &errColumn) )
|
|
|
|
|
{
|
|
|
|
|
QDomElement domRoot = xmlVars.documentElement();
|
|
|
|
|
if (domRoot.tagName() == "variables") {
|
|
|
|
|
parseVariables(domRoot, migrateUser);
|
|
|
|
|
} else {
|
|
|
|
|
qDebug() << "Section \"variables\" not found";
|
|
|
|
|
return QStringList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( migrateUser["cl_migrate_user"].toStringList().count() !=
|
|
|
|
|
migrateUser["cl_migrate_user_psw"].toStringList().count()
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
return QStringList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( int i(0); i != migrateUser["cl_migrate_user"].toStringList().count(); ++i )
|
|
|
|
|
{
|
|
|
|
|
if ( migrateUser["cl_migrate_user_psw"].toStringList().at(i) == "yes" )
|
|
|
|
|
result << migrateUser["cl_migrate_user"].toStringList().at(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CalculateConfig::parseVariables(const QDomNode& node, MapConfig& cfg)
|
|
|
|
|
{
|
|
|
|
|
QDomNode domNode = node.firstChild();
|
|
|
|
|
while ( !domNode.isNull() )
|
|
|
|
@ -94,11 +158,11 @@ void CalculateConfig::parseVariables(const QDomNode& node)
|
|
|
|
|
{
|
|
|
|
|
if (domElement.attribute("type") == "var")
|
|
|
|
|
{
|
|
|
|
|
parseVar(domElement);
|
|
|
|
|
parseVar(domElement, cfg);
|
|
|
|
|
}
|
|
|
|
|
else if (domElement.attribute("type") == "list")
|
|
|
|
|
{
|
|
|
|
|
parseVarList(domElement);
|
|
|
|
|
parseVarList(domElement, cfg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -107,7 +171,7 @@ void CalculateConfig::parseVariables(const QDomNode& node)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CalculateConfig::parseVar(const QDomNode& node)
|
|
|
|
|
void CalculateConfig::parseVar(const QDomNode& node, MapConfig& cfg)
|
|
|
|
|
{
|
|
|
|
|
QString name = node.toElement().attribute("name");
|
|
|
|
|
QDomNode domNode = node.firstChild();
|
|
|
|
@ -122,7 +186,7 @@ void CalculateConfig::parseVar(const QDomNode& node)
|
|
|
|
|
if (domElement.tagName() == "value")
|
|
|
|
|
{
|
|
|
|
|
//qDebug() << "var " << name << " = " << domElement.text();
|
|
|
|
|
m_Config[name] = QVariant( domElement.text() );
|
|
|
|
|
cfg[name] = QVariant( domElement.text() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -130,7 +194,7 @@ void CalculateConfig::parseVar(const QDomNode& node)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CalculateConfig::parseVarList(const QDomNode& node)
|
|
|
|
|
void CalculateConfig::parseVarList(const QDomNode& node, MapConfig& cfg)
|
|
|
|
|
{
|
|
|
|
|
QStringList resList;
|
|
|
|
|
QString name = node.toElement().attribute("name");
|
|
|
|
@ -154,7 +218,7 @@ void CalculateConfig::parseVarList(const QDomNode& node)
|
|
|
|
|
}
|
|
|
|
|
if ( !resList.isEmpty() )
|
|
|
|
|
{
|
|
|
|
|
m_Config[name] = QVariant( resList );
|
|
|
|
|
cfg[name] = QVariant( resList );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -183,7 +247,7 @@ QStringList CalculateConfig::getInstallParameters()
|
|
|
|
|
foreach(const QString& disk, m_Config["--disk"].toStringList())
|
|
|
|
|
{
|
|
|
|
|
QString disk_t(disk);
|
|
|
|
|
disk_t.replace(" ", "");
|
|
|
|
|
disk_t = disk_t.simplified();
|
|
|
|
|
params << QString("--disk ") + disk_t;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -230,5 +294,14 @@ QStringList CalculateConfig::getInstallParameters()
|
|
|
|
|
if ( !m_Config["gui_install_language"].toString().isEmpty() )
|
|
|
|
|
params << "--lang " + m_Config["gui_install_language"].toString();
|
|
|
|
|
|
|
|
|
|
// users
|
|
|
|
|
if ( m_Config["gui_users"].toStringList().count() > 0 )
|
|
|
|
|
{
|
|
|
|
|
foreach(const QString& user, m_Config["gui_users"].toStringList())
|
|
|
|
|
{
|
|
|
|
|
params << QString("--user ") + user;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return params;
|
|
|
|
|
}
|
|
|
|
|