summaryrefslogtreecommitdiff
path: root/src/plugins/boostbuildprojectmanager/b2projectmanager.cpp
blob: 7985d9a7938a7e19274aa4ba6bdb534711b08660 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// Copyright (C) 2013 Mateusz Łoskot <mateusz@loskot.net>
//
// This file is part of Qt Creator Boost.Build plugin project.
//
// This is free software; you can redistribute and/or modify it under
// the terms of the  GNU Lesser General Public License, Version 2.1
// as published by the Free Software Foundation.
// See accompanying file LICENSE.txt or copy at
// http://www.gnu.org/licenses/lgpl-2.1-standalone.html.
//
#include "b2projectmanager.h"
#include "b2projectmanagerconstants.h"
#include "b2project.h"
#include "b2utility.h"

#include <projectexplorer/iprojectmanager.h>

#include <QFileInfo>
#include <QString>

namespace BoostBuildProjectManager {
namespace Internal {

ProjectManager::ProjectManager()
{
}

QString ProjectManager::mimeType() const
{
    BBPM_QDEBUG(Constants::MIMETYPE_PROJECT);

    return QLatin1String(Constants::MIMETYPE_PROJECT);
}

ProjectExplorer::Project*
ProjectManager::openProject(QString const& fileName, QString* errorString)
{
    BBPM_QDEBUG("opening project:" << fileName);

    if (!QFileInfo(fileName).isFile()) {
        if (errorString)
            *errorString = tr("Failed opening project \"%1\": Project is not a file.")
                .arg(fileName);
        return 0;
    }

    return new Project(this, fileName);
}

void ProjectManager::registerProject(Project* project)
{
    Q_ASSERT(project);
    m_projects.append(project);
}

void ProjectManager::unregisterProject(Project* project)
{
    Q_ASSERT(project);
    m_projects.removeAll(project);
}

} // namespace Internal
} // namespace BoostBuildProjectManager