genericproject.cpp 17.3 KB
Newer Older
Roberto Raggi's avatar
Roberto Raggi committed
1 2 3 4
/**************************************************************************
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2010 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/customexecutablerunconfiguration.h>
42
#include <projectexplorer/toolchain.h>
Roberto Raggi's avatar
Roberto Raggi committed
43 44 45
#include <projectexplorer/projectexplorerconstants.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <extensionsystem/pluginmanager.h>
46
#include <utils/pathchooser.h>
Roberto Raggi's avatar
Roberto Raggi committed
47 48
#include <coreplugin/icore.h>

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

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

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

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

64 65 66 67
////////////////////////////////////////////////////////////////////////////////////
// GenericProject
////////////////////////////////////////////////////////////////////////////////////

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

76
    m_projectName      = fileInfo.completeBaseName();
77 78 79
    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();
80

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

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

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

92 93
    delete m_rootNode;
    delete m_toolChain;
Roberto Raggi's avatar
Roberto Raggi committed
94 95
}

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

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

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

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

110
static QStringList readLines(const QString &absoluteFileName)
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
{
    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;
}

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

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

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

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

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

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

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

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

167
    return saveRawFileList(newList);
168 169
}

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

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

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

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

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

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

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

201 202 203 204
    parseProject(options);

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

    CppTools::CppModelManagerInterface *modelManager =
        ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();

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

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

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

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

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

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

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

236 237 238 239 240
        QStringList filesToUpdate;

        if (options & Configuration) {
            filesToUpdate = pinfo.sourceFiles;
            filesToUpdate.append(QLatin1String("<configuration>")); // XXX don't hardcode configuration file name
241 242
            // Full update, if there's a code model update, cancel it
            m_codeModelFuture.cancel();
243 244 245 246 247 248
        } 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());
        }
249

Roberto Raggi's avatar
Roberto Raggi committed
250
        modelManager->updateProjectInfo(pinfo);
251
        m_codeModelFuture = modelManager->updateSourceFiles(filesToUpdate);
Roberto Raggi's avatar
Roberto Raggi committed
252 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
 * 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.
 *
278
 * The \a map variable is an optional argument that will map the returned
279
 * absolute paths back to their original \a entries.
280
 */
281 282
QStringList GenericProject::processEntries(const QStringList &paths,
                                           QHash<QString, QString> *map) const
Roberto Raggi's avatar
Roberto Raggi committed
283
{
284
    const QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
285
    const QDir projectDir(QFileInfo(m_fileName).dir());
286

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

293 294 295
        expandEnvironmentVariables(env, trimmedPath);

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

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

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

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

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

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

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

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

331
void GenericProject::setToolChainType(ProjectExplorer::ToolChainType type)
Roberto Raggi's avatar
Roberto Raggi committed
332 333 334
{
    using namespace ProjectExplorer;

335
    m_toolChainType = type;
336

337 338
    delete m_toolChain;
    m_toolChain = 0;
Roberto Raggi's avatar
Roberto Raggi committed
339

340
    if (type == ToolChain_MinGW) {
Roberto Raggi's avatar
Roberto Raggi committed
341 342 343
        const QLatin1String qmake_cxx("g++"); // ### FIXME
        const QString mingwDirectory; // ### FIXME

344
        m_toolChain = ToolChain::createMinGWToolChain(qmake_cxx, mingwDirectory);
Roberto Raggi's avatar
Roberto Raggi committed
345

346
    } else if (type == ToolChain_MSVC) {
Roberto Raggi's avatar
Roberto Raggi committed
347
        const QString msvcVersion; // ### FIXME
348
        m_toolChain = ToolChain::createMSVCToolChain(msvcVersion, false);
Roberto Raggi's avatar
Roberto Raggi committed
349

350
    } else if (type == ToolChain_WINCE) {
Roberto Raggi's avatar
Roberto Raggi committed
351
        const QString msvcVersion, wincePlatform; // ### FIXME
352
        m_toolChain = ToolChain::createWinCEToolChain(msvcVersion, wincePlatform);
353
    } else if (type == ToolChain_GCC) {
Roberto Raggi's avatar
Roberto Raggi committed
354
        const QLatin1String qmake_cxx("g++"); // ### FIXME
355
        m_toolChain = ToolChain::createGccToolChain(qmake_cxx);
356
    } else if (type == ToolChain_LINUX_ICC) {
dt's avatar
dt committed
357
        m_toolChain = ToolChain::createLinuxIccToolChain();
Roberto Raggi's avatar
Roberto Raggi committed
358 359 360
    }
}

361 362 363 364 365
ProjectExplorer::ToolChain *GenericProject::toolChain() const
{
    return m_toolChain;
}

366
ProjectExplorer::ToolChainType GenericProject::toolChainType() const
367
{ return m_toolChainType; }
368

369
QString GenericProject::displayName() const
Roberto Raggi's avatar
Roberto Raggi committed
370
{
371
    return m_projectName;
Roberto Raggi's avatar
Roberto Raggi committed
372 373
}

Tobias Hunger's avatar
Tobias Hunger committed
374 375
QString GenericProject::id() const
{
Tobias Hunger's avatar
Tobias Hunger committed
376
    return QLatin1String(Constants::GENERICPROJECT_ID);
Tobias Hunger's avatar
Tobias Hunger committed
377 378
}

Roberto Raggi's avatar
Roberto Raggi committed
379 380
Core::IFile *GenericProject::file() const
{
381
    return m_file;
Roberto Raggi's avatar
Roberto Raggi committed
382 383 384 385
}

ProjectExplorer::IProjectManager *GenericProject::projectManager() const
{
386
    return m_manager;
Roberto Raggi's avatar
Roberto Raggi committed
387 388 389 390 391 392 393
}

QList<ProjectExplorer::Project *> GenericProject::dependsOn()
{
    return QList<Project *>();
}

dt's avatar
dt committed
394
QList<ProjectExplorer::BuildConfigWidget*> GenericProject::subConfigWidgets()
Roberto Raggi's avatar
Roberto Raggi committed
395
{
396 397 398
    QList<ProjectExplorer::BuildConfigWidget*> list;
    list << new BuildEnvironmentWidget;
    return list;
Roberto Raggi's avatar
Roberto Raggi committed
399 400
}

401
GenericProjectNode *GenericProject::rootProjectNode() const
Roberto Raggi's avatar
Roberto Raggi committed
402
{
403
    return m_rootNode;
Roberto Raggi's avatar
Roberto Raggi committed
404 405 406 407
}

QStringList GenericProject::files(FilesMode fileMode) const
{
408
    Q_UNUSED(fileMode)
409
    return m_files; // ### TODO: handle generated files here.
Roberto Raggi's avatar
Roberto Raggi committed
410 411
}

Tobias Hunger's avatar
Tobias Hunger committed
412
QStringList GenericProject::buildTargets() const
Roberto Raggi's avatar
Roberto Raggi committed
413 414 415 416 417 418 419
{
    QStringList targets;
    targets.append(QLatin1String("all"));
    targets.append(QLatin1String("clean"));
    return targets;
}

420
QVariantMap GenericProject::toMap() const
Roberto Raggi's avatar
Roberto Raggi committed
421
{
422 423 424 425 426 427 428 429 430
    QVariantMap map(Project::toMap());
    map.insert(QLatin1String(TOOLCHAIN_KEY), static_cast<int>(m_toolChainType));
    return map;
}

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

432 433 434 435 436 437 438 439 440 441 442 443 444
    // 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())
            t->addRunConfiguration(new ProjectExplorer::CustomExecutableRunConfiguration(t));
    }

    // Add default setup:
445 446 447 448 449
    if (targets().isEmpty()) {
        GenericTargetFactory *factory =
                ExtensionSystem::PluginManager::instance()->getObject<GenericTargetFactory>();
        addTarget(factory->create(this, QLatin1String(GENERIC_DESKTOP_TARGET_ID)));
    }
450

451 452
    ToolChainType type =
            static_cast<ProjectExplorer::ToolChainType>
453
            (map.value(QLatin1String(TOOLCHAIN_KEY), 0).toInt());
Roberto Raggi's avatar
Roberto Raggi committed
454

455
    setToolChainType(type);
Roberto Raggi's avatar
Roberto Raggi committed
456 457

    setIncludePaths(allIncludePaths());
458

459
    refresh(Everything);
dt's avatar
dt committed
460
    return true;
461 462
}

Roberto Raggi's avatar
Roberto Raggi committed
463 464 465
////////////////////////////////////////////////////////////////////////////////////
// GenericBuildSettingsWidget
////////////////////////////////////////////////////////////////////////////////////
466

467 468
GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericTarget *target)
    : m_target(target), m_buildConfiguration(0)
Roberto Raggi's avatar
Roberto Raggi committed
469 470
{
    QFormLayout *fl = new QFormLayout(this);
471 472
    fl->setContentsMargins(0, -1, 0, -1);
    fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
473 474

    // build directory
475
    m_pathChooser = new Utils::PathChooser(this);
476
    m_pathChooser->setEnabled(true);
477
    m_pathChooser->setBaseDirectory(m_target->genericProject()->projectDirectory());
478
    fl->addRow(tr("Build directory:"), m_pathChooser);
con's avatar
con committed
479
    connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
480

481
    // tool chain
482
    QComboBox *toolChainChooser = new QComboBox;
483
    toolChainChooser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
484
    using namespace ProjectExplorer;
485 486
    int index = 0;
    int selectedIndex = -1;
487 488
    foreach (ToolChainType tc, ToolChain::supportedToolChains()) {
        toolChainChooser->addItem(ToolChain::toolChainName(tc), QVariant::fromValue<ToolChainType>(tc));
489
        if (m_target->genericProject()->toolChainType() == tc)
490 491
            selectedIndex = index;
        ++index;
492 493
    }

494
    toolChainChooser->setCurrentIndex(selectedIndex);
Leena Miettinen's avatar
Leena Miettinen committed
495
    fl->addRow(tr("Tool chain:"), toolChainChooser);
496
    connect(toolChainChooser, SIGNAL(activated(int)), this, SLOT(toolChainSelected(int)));
Roberto Raggi's avatar
Roberto Raggi committed
497 498 499 500 501 502 503 504
}

GenericBuildSettingsWidget::~GenericBuildSettingsWidget()
{ }

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

dt's avatar
dt committed
505
void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
Roberto Raggi's avatar
Roberto Raggi committed
506
{
507
    m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
508
    m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory());
Roberto Raggi's avatar
Roberto Raggi committed
509 510 511 512
}

void GenericBuildSettingsWidget::buildDirectoryChanged()
{
513
    m_buildConfiguration->setBuildDirectory(m_pathChooser->rawPath());
Roberto Raggi's avatar
Roberto Raggi committed
514 515
}

516 517 518 519 520
void GenericBuildSettingsWidget::toolChainSelected(int index)
{
    using namespace ProjectExplorer;

    QComboBox *toolChainChooser = qobject_cast<QComboBox*>(sender());
521
    ToolChainType type = toolChainChooser->itemData(index).value<ToolChainType>();
522
    m_target->genericProject()->setToolChainType(type);
523 524
}

Roberto Raggi's avatar
Roberto Raggi committed
525 526 527
////////////////////////////////////////////////////////////////////////////////////
// GenericProjectFile
////////////////////////////////////////////////////////////////////////////////////
528

Roberto Raggi's avatar
Roberto Raggi committed
529 530
GenericProjectFile::GenericProjectFile(GenericProject *parent, QString fileName)
    : Core::IFile(parent),
531 532
      m_project(parent),
      m_fileName(fileName)
Roberto Raggi's avatar
Roberto Raggi committed
533 534 535 536 537 538 539 540 541 542 543 544
{ }

GenericProjectFile::~GenericProjectFile()
{ }

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

QString GenericProjectFile::fileName() const
{
545
    return m_fileName;
Roberto Raggi's avatar
Roberto Raggi committed
546 547 548 549 550 551 552 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
}

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
578 579 580 581 582 583 584
void GenericProjectFile::rename(const QString &newName)
{
    // Can't happen
    Q_UNUSED(newName);
    Q_ASSERT(false);
}

585
Core::IFile::ReloadBehavior GenericProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
Roberto Raggi's avatar
Roberto Raggi committed
586
{
587 588 589 590 591 592 593 594 595
    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
596
}