Example #1
0
bool Database::removeProject(const SProject * project)
{
    QDomDocument doc = loadDataBase();
    QDomElement docElem = doc.documentElement();
    QDomNode n = docElem.firstChild();

    while (!n.isNull()) {
        QDomElement e = n.toElement(); 
        if (!e.isNull()) {
            if (e.attribute("name") == project->projectName())
                docElem.removeChild(n);
        }
        n = n.nextSibling();
    }

    QFile file(m_dbfile);
    
    if (file.open(QIODevice::WriteOnly| QIODevice::Text)) {
        QTextStream ts(&file);
        ts << doc.toString();
        file.close();
    } else {
        return false;
    }

    return true;
}
Example #2
0
void startDialog::on_Compile_clicked()
{
    ClearLog();

	if (!loadDataBase()) {
		nd_logerror("load database error\n");
	}

    if (false == compile()){
        WriteLog("compile script error");
        return;
    }
    WriteLog("=========compile script success===========\n");

    const char *packaged_cmd = _getFromIocfg("compiled_rum_cmd");

    if (packaged_cmd && *packaged_cmd)	{
        int ret = system(packaged_cmd);

        if (0 != ret)	{
            nd_logerror("run command error %s %d\n", packaged_cmd, ret);
        }
    }

}
Example #3
0
bool Database::addProject(const SProject * project)
{
    QDomDocument db = loadDataBase();
    QDomNode  root = db.firstChild();
    
    root.appendChild(project->infoToXml(db));
    
    QFile file(m_dbfile);
    
    if (file.open(QIODevice::WriteOnly| QIODevice::Text)) {
        QTextStream ts(&file);
        ts << db.toString();
        file.close();
    } else {
        return false;
    }

    return true;
}
Example #4
0
void startDialog::on_ScriptEdit_clicked()
{
	EditorFrame *pMain = new EditorFrame();
	pMain->setHostWidget(this);
	pMain->setAttribute(Qt::WA_DeleteOnClose, true);

	if (!loadDataBase()) {
		nd_logerror("load database error\n");
	}

	std::string defProj = getPathFromConfig("script_root");

	if (!defProj.empty() && pMain->myInit(defProj.c_str() )) {
		this->setVisible(false);
		pMain->showMaximized();
	}
	else {
		delete pMain;
	}

}
Example #5
0
void Database::setDBFile(const QString& dbfile)
{
    m_dbfile = dbfile;
    loadDataBase();
}
Example #6
0
Database::Database(const QString &dbfile): m_dbfile(dbfile)
{
    loadDataBase();
}
Example #7
0
SProject *Database::loadProject(const QString &projectName)
{
    Parsers::DatabaseParser parser;
    return parser.loadProject( projectName, loadDataBase().toString());
}
Example #8
0
bool Database::exists(const QString &projectName)
{
    Parsers::DatabaseParser parser;
    return parser.exists(projectName, loadDataBase().toString());
}
Example #9
0
Database::ProjectInfo Database::projectInfo(const QString &project)
{
    Parsers::DatabaseParser parser;
    return parser.projectInfo(project, loadDataBase().toString());
}
Example #10
0
QList< Database::ProjectInfo> Database::userProjects(const QString& user)
{
    Parsers::DatabaseParser parser;
    return parser.userProjects(user, loadDataBase().toString());
}
Example #11
0
QList<Database::ProjectInfo> Database::allProjects()
{
    Parsers::DatabaseParser parser;
    return parser.allProjects(loadDataBase().toString());
}