genericproject.cpp 17.5 KB
Newer Older
Roberto Raggi's avatar
Roberto Raggi committed
1 2 3 4
/**************************************************************************
**
** This file is part of Qt Creator
**
con's avatar
con committed
5
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
Roberto Raggi's avatar
Roberto Raggi committed
6
**
7
** Contact: Nokia Corporation (qt-info@nokia.com)
Roberto Raggi's avatar
Roberto Raggi committed
8
**
con's avatar
con committed
9
** No Commercial Usage
Roberto Raggi's avatar
Roberto Raggi committed
10
**
con's avatar
con committed
11 12 13 14
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
Roberto Raggi's avatar
Roberto Raggi committed
15 16 17 18 19 20 21 22 23 24
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
con's avatar
con committed
25 26 27 28 29 30
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
Roberto Raggi's avatar
Roberto Raggi committed
31 32 33 34
**
**************************************************************************/

#include "genericproject.h"
Tobias Hunger's avatar
Tobias Hunger committed
35

dt's avatar
dt committed
36
#include "genericbuildconfiguration.h"
Tobias Hunger's avatar
Tobias Hunger committed
37 38
#include "genericprojectconstants.h"
#include "generictarget.h"
Roberto Raggi's avatar
Roberto Raggi committed
39

40
#include <projectexplorer/buildenvironmentwidget.h>
41
#include <projectexplorer/headerpath.h>
42
#include <projectexplorer/customexecutablerunconfiguration.h>
43
#include <projectexplorer/toolchainmanager.h>
Roberto Raggi's avatar
Roberto Raggi committed
44
#include <projectexplorer/projectexplorerconstants.h>
45
#include <cplusplus/ModelManagerInterface.h>
Roberto Raggi's avatar
Roberto Raggi committed
46
#include <extensionsystem/pluginmanager.h>
47
#include <utils/pathchooser.h>
Roberto Raggi's avatar
Roberto Raggi committed
48 49
#include <coreplugin/icore.h>

50
#include <QtCore/QDir>
51
#include <QtCore/QProcessEnvironment>
Roberto Raggi's avatar
Roberto Raggi committed
52

53 54 55
#include <QtGui/QFormLayout>
#include <QtGui/QMainWindow>
#include <QtGui/QComboBox>
Roberto Raggi's avatar
Roberto Raggi committed
56 57 58

using namespace GenericProjectManager;
using namespace GenericProjectManager::Internal;
59
using namespace ProjectExplorer;
Roberto Raggi's avatar
Roberto Raggi committed
60

61
namespace {
62
const char * const TOOLCHAIN_KEY("GenericProjectManager.GenericProject.Toolchain");
63 64
} // end of anonymous namespace

65 66 67 68
////////////////////////////////////////////////////////////////////////////////////
// GenericProject
////////////////////////////////////////////////////////////////////////////////////

Roberto Raggi's avatar
Roberto Raggi committed
69
GenericProject::GenericProject(Manager *manager, const QString &fileName)
70 71 72
    : m_manager(manager),
      m_fileName(fileName),
      m_toolChain(0)
Roberto Raggi's avatar
Roberto Raggi committed
73
{
74
    QFileInfo fileInfo(m_fileName);
75 76
    QDir dir = fileInfo.dir();

77
    m_projectName      = fileInfo.completeBaseName();
78 79 80
    m_filesFileName    = QFileInfo(dir, m_projectName + QLatin1String(".files")).absoluteFilePath();
    m_includesFileName = QFileInfo(dir, m_projectName + QLatin1String(".includes")).absoluteFilePath();
    m_configFileName   = QFileInfo(dir, m_projectName + QLatin1String(".config")).absoluteFilePath();
81

82 83
    m_file = new GenericProjectFile(this, fileName);
    m_rootNode = new GenericProjectNode(this, m_file);
84

85
    m_manager->registerProject(this);
Roberto Raggi's avatar
Roberto Raggi committed
86 87 88 89
}

GenericProject::~GenericProject()
{
90
    m_codeModelFuture.cancel();
91
    m_manager->unregisterProject(this);
92

93
    delete m_rootNode;
94
    // do not delete m_toolChain
Roberto Raggi's avatar
Roberto Raggi committed
95 96
}

Tobias Hunger's avatar
Tobias Hunger committed
97
GenericTarget *GenericProject::activeTarget() const
98
{
Tobias Hunger's avatar
Tobias Hunger committed
99
    return static_cast<GenericTarget *>(Project::activeTarget());
100 101
}

102
QString GenericProject::filesFileName() const
103
{ return m_filesFileName; }
104 105

QString GenericProject::includesFileName() const
106
{ return m_includesFileName; }
107 108

QString GenericProject::configFileName() const
109
{ return m_configFileName; }
110

111
static QStringList readLines(const QString &absoluteFileName)
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
{
    QStringList lines;

    QFile file(absoluteFileName);
    if (file.open(QFile::ReadOnly)) {
        QTextStream stream(&file);

        forever {
            QString line = stream.readLine();
            if (line.isNull())
                break;

            lines.append(line);
        }
    }

    return lines;
}

131
bool GenericProject::saveRawFileList(const QStringList &rawFileList)
132
{
133
    // Make sure we can open the file for writing
134
    QFile file(filesFileName());
135 136 137 138
    if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
        return false;

    QTextStream stream(&file);
139 140
    foreach (const QString &filePath, rawFileList)
        stream << filePath << QLatin1Char('\n');
141 142 143 144

    file.close();
    refresh(GenericProject::Files);
    return true;
145
}
146

147 148
bool GenericProject::addFiles(const QStringList &filePaths)
{
149 150 151 152 153
    QStringList newList = m_rawFileList;

    QDir baseDir(QFileInfo(m_fileName).dir());
    foreach (const QString &filePath, filePaths)
        newList.append(baseDir.relativeFilePath(filePath));
154

155
    return saveRawFileList(newList);
156 157 158 159
}

bool GenericProject::removeFiles(const QStringList &filePaths)
{
160
    QStringList newList = m_rawFileList;
161

162 163 164 165
    foreach (const QString &filePath, filePaths) {
        QHash<QString, QString>::iterator i = m_rawListEntries.find(filePath);
        if (i != m_rawListEntries.end())
            newList.removeOne(i.value());
166
    }
167

168
    return saveRawFileList(newList);
169 170
}

171
void GenericProject::parseProject(RefreshOptions options)
Roberto Raggi's avatar
Roberto Raggi committed
172
{
173 174 175
    if (options & Files) {
        m_rawListEntries.clear();
        m_rawFileList = readLines(filesFileName());
176
        m_files = processEntries(m_rawFileList, &m_rawListEntries);
177
    }
178

179
    if (options & Configuration) {
180
        m_projectIncludePaths = processEntries(readLines(includesFileName()));
181

182 183
        // TODO: Possibly load some configuration from the project file
        //QSettings projectInfo(m_fileName, QSettings::IniFormat);
Roberto Raggi's avatar
Roberto Raggi committed
184

185
        m_defines.clear();
Roberto Raggi's avatar
Roberto Raggi committed
186

187 188 189 190
        QFile configFile(configFileName());
        if (configFile.open(QFile::ReadOnly))
            m_defines = configFile.readAll();
    }
191

192 193
    if (options & Files)
        emit fileListChanged();
Roberto Raggi's avatar
Roberto Raggi committed
194 195
}

196
void GenericProject::refresh(RefreshOptions options)
Roberto Raggi's avatar
Roberto Raggi committed
197
{
198 199 200
    QSet<QString> oldFileList;
    if (!(options & Configuration))
        oldFileList = m_files.toSet();
201

202 203 204 205
    parseProject(options);

    if (options & Files)
        m_rootNode->refresh();
Roberto Raggi's avatar
Roberto Raggi committed
206

207
    CPlusPlus::CppModelManagerInterface *modelManager =
208
        CPlusPlus::CppModelManagerInterface::instance();
Roberto Raggi's avatar
Roberto Raggi committed
209

210 211
    if (m_toolChain && modelManager) {
        const QByteArray predefinedMacros = m_toolChain->predefinedMacros();
Roberto Raggi's avatar
Roberto Raggi committed
212

213
        CPlusPlus::CppModelManagerInterface::ProjectInfo pinfo = modelManager->projectInfo(this);
Roberto Raggi's avatar
Roberto Raggi committed
214
        pinfo.defines = predefinedMacros;
Roberto Raggi's avatar
Roberto Raggi committed
215
        pinfo.defines += '\n';
216
        pinfo.defines += m_defines;
Roberto Raggi's avatar
Roberto Raggi committed
217

218 219
        QStringList allIncludePaths;
        QStringList allFrameworkPaths;
Roberto Raggi's avatar
Roberto Raggi committed
220

221 222
        foreach (const HeaderPath &headerPath, m_toolChain->systemHeaderPaths()) {
            if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
Roberto Raggi's avatar
Roberto Raggi committed
223 224 225 226 227
                allFrameworkPaths.append(headerPath.path());
            else
                allIncludePaths.append(headerPath.path());
        }

Roberto Raggi's avatar
Roberto Raggi committed
228
        allIncludePaths += this->allIncludePaths();
Roberto Raggi's avatar
Roberto Raggi committed
229 230 231 232 233

        pinfo.frameworkPaths = allFrameworkPaths;
        pinfo.includePaths = allIncludePaths;

        // ### add _defines.
Roberto Raggi's avatar
Roberto Raggi committed
234 235
        pinfo.sourceFiles = files();
        pinfo.sourceFiles += generated();
Roberto Raggi's avatar
Roberto Raggi committed
236

237 238 239 240 241
        QStringList filesToUpdate;

        if (options & Configuration) {
            filesToUpdate = pinfo.sourceFiles;
            filesToUpdate.append(QLatin1String("<configuration>")); // XXX don't hardcode configuration file name
242 243
            // Full update, if there's a code model update, cancel it
            m_codeModelFuture.cancel();
244 245 246 247 248 249
        } else if (options & Files) {
            // Only update files that got added to the list
            QSet<QString> newFileList = m_files.toSet();
            newFileList.subtract(oldFileList);
            filesToUpdate.append(newFileList.toList());
        }
250

Roberto Raggi's avatar
Roberto Raggi committed
251
        modelManager->updateProjectInfo(pinfo);
252
        m_codeModelFuture = modelManager->updateSourceFiles(filesToUpdate);
Roberto Raggi's avatar
Roberto Raggi committed
253 254 255
    }
}

256
/**
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
 * Expands environment variables in the given \a string when they are written
 * like $$(VARIABLE).
 */
static void expandEnvironmentVariables(const QProcessEnvironment &env, QString &string)
{
    const static QRegExp candidate(QLatin1String("\\$\\$\\((.+)\\)"));

    int index = candidate.indexIn(string);
    while (index != -1) {
        const QString value = env.value(candidate.cap(1));

        string.replace(index, candidate.matchedLength(), value);
        index += value.length();

        index = candidate.indexIn(string, index);
    }
}

/**
 * Expands environment variables and converts the path from relative to the
 * project to an absolute path.
 *
279
 * The \a map variable is an optional argument that will map the returned
280
 * absolute paths back to their original \a entries.
281
 */
282 283
QStringList GenericProject::processEntries(const QStringList &paths,
                                           QHash<QString, QString> *map) const
Roberto Raggi's avatar
Roberto Raggi committed
284
{
285
    const QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
286
    const QDir projectDir(QFileInfo(m_fileName).dir());
287

Roberto Raggi's avatar
Roberto Raggi committed
288
    QStringList absolutePaths;
289
    foreach (const QString &path, paths) {
290 291
        QString trimmedPath = path.trimmed();
        if (trimmedPath.isEmpty())
292 293
            continue;

294 295 296
        expandEnvironmentVariables(env, trimmedPath);

        const QString absPath = QFileInfo(projectDir, trimmedPath).absoluteFilePath();
297 298
        absolutePaths.append(absPath);
        if (map)
299
            map->insert(absPath, trimmedPath);
Roberto Raggi's avatar
Roberto Raggi committed
300 301 302 303 304
    }
    absolutePaths.removeDuplicates();
    return absolutePaths;
}

Roberto Raggi's avatar
Roberto Raggi committed
305 306 307
QStringList GenericProject::allIncludePaths() const
{
    QStringList paths;
308 309
    paths += m_includePaths;
    paths += m_projectIncludePaths;
Roberto Raggi's avatar
Roberto Raggi committed
310 311 312 313 314
    paths.removeDuplicates();
    return paths;
}

QStringList GenericProject::projectIncludePaths() const
315
{ return m_projectIncludePaths; }
Roberto Raggi's avatar
Roberto Raggi committed
316

Roberto Raggi's avatar
Roberto Raggi committed
317
QStringList GenericProject::files() const
318
{ return m_files; }
Roberto Raggi's avatar
Roberto Raggi committed
319 320

QStringList GenericProject::generated() const
321
{ return m_generated; }
Roberto Raggi's avatar
Roberto Raggi committed
322 323

QStringList GenericProject::includePaths() const
324
{ return m_includePaths; }
Roberto Raggi's avatar
Roberto Raggi committed
325 326

void GenericProject::setIncludePaths(const QStringList &includePaths)
327
{ m_includePaths = includePaths; }
Roberto Raggi's avatar
Roberto Raggi committed
328

Roberto Raggi's avatar
Roberto Raggi committed
329
QByteArray GenericProject::defines() const
330
{ return m_defines; }
Roberto Raggi's avatar
Roberto Raggi committed
331

332
void GenericProject::setToolChain(ToolChain *tc)
Roberto Raggi's avatar
Roberto Raggi committed
333
{
334 335
    if (m_toolChain == tc)
        return;
Roberto Raggi's avatar
Roberto Raggi committed
336

337 338
    m_toolChain = tc;
    emit toolChainChanged(m_toolChain);
Roberto Raggi's avatar
Roberto Raggi committed
339 340
}

341
ToolChain *GenericProject::toolChain() const
342 343 344 345
{
    return m_toolChain;
}

346
QString GenericProject::displayName() const
Roberto Raggi's avatar
Roberto Raggi committed
347
{
348
    return m_projectName;
Roberto Raggi's avatar
Roberto Raggi committed
349 350
}

Tobias Hunger's avatar
Tobias Hunger committed
351 352
QString GenericProject::id() const
{
Tobias Hunger's avatar
Tobias Hunger committed
353
    return QLatin1String(Constants::GENERICPROJECT_ID);
Tobias Hunger's avatar
Tobias Hunger committed
354 355
}

Roberto Raggi's avatar
Roberto Raggi committed
356 357
Core::IFile *GenericProject::file() const
{
358
    return m_file;
Roberto Raggi's avatar
Roberto Raggi committed
359 360
}

361
IProjectManager *GenericProject::projectManager() const
Roberto Raggi's avatar
Roberto Raggi committed
362
{
363
    return m_manager;
Roberto Raggi's avatar
Roberto Raggi committed
364 365
}

366
QList<Project *> GenericProject::dependsOn()
Roberto Raggi's avatar
Roberto Raggi committed
367 368 369 370
{
    return QList<Project *>();
}

371
QList<BuildConfigWidget*> GenericProject::subConfigWidgets()
Roberto Raggi's avatar
Roberto Raggi committed
372
{
373
    QList<BuildConfigWidget*> list;
374 375
    list << new BuildEnvironmentWidget;
    return list;
Roberto Raggi's avatar
Roberto Raggi committed
376 377
}

378
GenericProjectNode *GenericProject::rootProjectNode() const
Roberto Raggi's avatar
Roberto Raggi committed
379
{
380
    return m_rootNode;
Roberto Raggi's avatar
Roberto Raggi committed
381 382 383 384
}

QStringList GenericProject::files(FilesMode fileMode) const
{
385
    Q_UNUSED(fileMode)
386
    return m_files; // ### TODO: handle generated files here.
Roberto Raggi's avatar
Roberto Raggi committed
387 388
}

Tobias Hunger's avatar
Tobias Hunger committed
389
QStringList GenericProject::buildTargets() const
Roberto Raggi's avatar
Roberto Raggi committed
390 391 392 393 394 395 396
{
    QStringList targets;
    targets.append(QLatin1String("all"));
    targets.append(QLatin1String("clean"));
    return targets;
}

397
QVariantMap GenericProject::toMap() const
Roberto Raggi's avatar
Roberto Raggi committed
398
{
399
    QVariantMap map(Project::toMap());
400
    map.insert(QLatin1String(TOOLCHAIN_KEY), m_toolChain ? m_toolChain->id() : QString());
401 402 403 404 405 406 407
    return map;
}

bool GenericProject::fromMap(const QVariantMap &map)
{
    if (!Project::fromMap(map))
        return false;
Roberto Raggi's avatar
Roberto Raggi committed
408

409 410 411 412 413 414 415 416 417
    // Sanity check: We need both a buildconfiguration and a runconfiguration!
    QList<Target *> targetList = targets();
    foreach (Target *t, targetList) {
        if (!t->activeBuildConfiguration()) {
            removeTarget(t);
            delete t;
            continue;
        }
        if (!t->activeRunConfiguration())
418
            t->addRunConfiguration(new CustomExecutableRunConfiguration(t));
419 420 421
    }

    // Add default setup:
422 423 424 425 426
    if (targets().isEmpty()) {
        GenericTargetFactory *factory =
                ExtensionSystem::PluginManager::instance()->getObject<GenericTargetFactory>();
        addTarget(factory->create(this, QLatin1String(GENERIC_DESKTOP_TARGET_ID)));
    }
427

428 429 430 431 432 433 434 435 436 437 438
    QString id = map.value(QLatin1String(TOOLCHAIN_KEY)).toString();
    if (!id.isNull()) {
        setToolChain(ToolChainManager::instance()->findToolChain(id));
    } else {
        QList<ToolChain *> tcs =
                ToolChainManager::instance()->findToolChains(Abi::hostAbi());
        if (tcs.isEmpty())
            tcs = ToolChainManager::instance()->toolChains();
        if (!tcs.isEmpty())
            setToolChain(tcs.at(0));
    }
Roberto Raggi's avatar
Roberto Raggi committed
439 440

    setIncludePaths(allIncludePaths());
441

442
    refresh(Everything);
dt's avatar
dt committed
443
    return true;
444 445
}

Roberto Raggi's avatar
Roberto Raggi committed
446 447 448
////////////////////////////////////////////////////////////////////////////////////
// GenericBuildSettingsWidget
////////////////////////////////////////////////////////////////////////////////////
449

450
GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericTarget *target)
451
    : m_target(target), m_toolChainChooser(0), m_buildConfiguration(0)
Roberto Raggi's avatar
Roberto Raggi committed
452 453
{
    QFormLayout *fl = new QFormLayout(this);
454 455
    fl->setContentsMargins(0, -1, 0, -1);
    fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
456 457

    // build directory
458
    m_pathChooser = new Utils::PathChooser(this);
459
    m_pathChooser->setEnabled(true);
460
    m_pathChooser->setBaseDirectory(m_target->genericProject()->projectDirectory());
461
    fl->addRow(tr("Build directory:"), m_pathChooser);
con's avatar
con committed
462
    connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
463

464
    // tool chain
465 466 467 468 469 470 471 472 473 474 475 476
    m_toolChainChooser = new QComboBox;
    m_toolChainChooser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    updateToolChainList();

    fl->addRow(tr("Tool chain:"), m_toolChainChooser);
    connect(m_toolChainChooser, SIGNAL(activated(int)), this, SLOT(toolChainSelected(int)));
    connect(m_target->genericProject(), SIGNAL(toolChainChanged(ProjectExplorer::ToolChain*)),
            this, SLOT(toolChainChanged(ProjectExplorer::ToolChain*)));
    connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainAdded(ToolChain*)),
            this, SLOT(updateToolChainList()));
    connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainRemoved(ToolChain*)),
            this, SLOT(updateToolChainList()));
Roberto Raggi's avatar
Roberto Raggi committed
477 478 479 480 481 482 483 484
}

GenericBuildSettingsWidget::~GenericBuildSettingsWidget()
{ }

QString GenericBuildSettingsWidget::displayName() const
{ return tr("Generic Manager"); }

dt's avatar
dt committed
485
void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
Roberto Raggi's avatar
Roberto Raggi committed
486
{
487
    m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
488
    m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory());
Roberto Raggi's avatar
Roberto Raggi committed
489 490 491 492
}

void GenericBuildSettingsWidget::buildDirectoryChanged()
{
493
    m_buildConfiguration->setBuildDirectory(m_pathChooser->rawPath());
Roberto Raggi's avatar
Roberto Raggi committed
494 495
}

496 497 498 499
void GenericBuildSettingsWidget::toolChainSelected(int index)
{
    using namespace ProjectExplorer;

500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
    ToolChain *tc = static_cast<ToolChain *>(m_toolChainChooser->itemData(index).value<void *>());
    m_target->genericProject()->setToolChain(tc);
}

void GenericBuildSettingsWidget::toolChainChanged(ProjectExplorer::ToolChain *tc)
{
    for (int i = 0; i < m_toolChainChooser->count(); ++i) {
        ToolChain * currentTc = static_cast<ToolChain *>(m_toolChainChooser->itemData(i).value<void *>());
        if (currentTc != tc)
            continue;
        m_toolChainChooser->setCurrentIndex(i);
        return;
    }
}

void GenericBuildSettingsWidget::updateToolChainList()
{
    m_toolChainChooser->clear();

    QList<ToolChain *> tcs = ToolChainManager::instance()->toolChains();
    if (!m_target->genericProject()->toolChain()) {
        m_toolChainChooser->addItem(tr("<Invalid Toolchain>"), qVariantFromValue(static_cast<void *>(0)));
        m_toolChainChooser->setCurrentIndex(0);
    }
    foreach (ToolChain *tc, tcs) {
        m_toolChainChooser->addItem(tc->displayName(), qVariantFromValue(static_cast<void *>(tc)));
        if (m_target->genericProject()->toolChain()
                && m_target->genericProject()->toolChain()->id() == tc->id())
            m_toolChainChooser->setCurrentIndex(m_toolChainChooser->count() - 1);
    }
530 531
}

Roberto Raggi's avatar
Roberto Raggi committed
532 533 534
////////////////////////////////////////////////////////////////////////////////////
// GenericProjectFile
////////////////////////////////////////////////////////////////////////////////////
535

Roberto Raggi's avatar
Roberto Raggi committed
536 537
GenericProjectFile::GenericProjectFile(GenericProject *parent, QString fileName)
    : Core::IFile(parent),
538 539
      m_project(parent),
      m_fileName(fileName)
Roberto Raggi's avatar
Roberto Raggi committed
540 541 542 543 544 545 546 547 548 549 550 551
{ }

GenericProjectFile::~GenericProjectFile()
{ }

bool GenericProjectFile::save(const QString &)
{
    return false;
}

QString GenericProjectFile::fileName() const
{
552
    return m_fileName;
Roberto Raggi's avatar
Roberto Raggi committed
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584
}

QString GenericProjectFile::defaultPath() const
{
    return QString();
}

QString GenericProjectFile::suggestedFileName() const
{
    return QString();
}

QString GenericProjectFile::mimeType() const
{
    return Constants::GENERICMIMETYPE;
}

bool GenericProjectFile::isModified() const
{
    return false;
}

bool GenericProjectFile::isReadOnly() const
{
    return true;
}

bool GenericProjectFile::isSaveAsAllowed() const
{
    return false;
}

dt's avatar
dt committed
585 586 587 588 589 590 591
void GenericProjectFile::rename(const QString &newName)
{
    // Can't happen
    Q_UNUSED(newName);
    Q_ASSERT(false);
}

592
Core::IFile::ReloadBehavior GenericProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
Roberto Raggi's avatar
Roberto Raggi committed
593
{
594 595 596 597 598 599 600 601 602
    Q_UNUSED(state)
    Q_UNUSED(type)
    return BehaviorSilent;
}

void GenericProjectFile::reload(ReloadFlag flag, ChangeType type)
{
    Q_UNUSED(flag)
    Q_UNUSED(type)
Roberto Raggi's avatar
Roberto Raggi committed
603
}