IProject *ProjectManager::loadProject(const QString &filePath)
{
    if (project && project->filePath() == filePath) {
        this->reloadProject();
        return project;
    }

    ProjectFile * file = new ProjectFile(this);
    if (file->open(filePath)) {
        closeProject();
        project = file;
        connect(project,SIGNAL(closeProject()),this,SLOT(closeProject()));
        connect(project,SIGNAL(reloadProject()),this,SLOT(reloadProject()));
        resetProjectTree();
        liteApp->projectEvent()->fireProjectChanged(project);
        return project;
    } else {
        delete file;
    }
    return NULL;
}