Commit 25135e9e authored by dt's avatar dt
Browse files

Long dead code. It even used the QWorkbench namespace.

And there seems to be no value in the code anyway.
parent af625797
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "qhelpproject.h"
#include "qhelpprojectmanager.h"
#include "qhelpprojectitems.h"
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#include <qhelpsystem.h>
using namespace ProjectExplorer;
using namespace QHelpProjectPlugin::Internal;
QHelpProject::QHelpProject(QHelpProjectManager *manager)
{
m_manager = manager;
ProjectExplorerInterface *projectExplorer = m_manager->projectExplorer();
projectExplorer->addProjectItem(this);
m_filesFolder = new QHelpProjectFolder();
m_filesFolder->setName(QObject::tr("Files"));
projectExplorer->addProjectItem(m_filesFolder, this);
}
QHelpProject::~QHelpProject()
{
}
bool QHelpProject::open(const QString &fileName)
{
m_projectFile = fileName;
QHelpProjectParser parser;
if (!parser.parse(m_projectFile))
return false;
m_name = parser.namespaceURI();
m_files = parser.files();
QFileInfo fi(fileName);
QString dir = fi.absolutePath() + QDir::separator();
ProjectExplorerInterface *projectExplorer = m_manager->projectExplorer();
QHelpProjectFile *file;
foreach (QString f, m_files) {
file = new QHelpProjectFile(dir + f);
projectExplorer->addProjectItem(file, m_filesFolder);
}
m_manager->projectExplorer()->updateItem(this);
return true;
}
bool QHelpProject::save(const QString &fileName)
{
return true;
}
QString QHelpProject::fileName() const
{
return m_projectFile;
}
QString QHelpProject::defaultPath() const
{
return QString();
}
QString QHelpProject::suggestedFileName() const
{
return QString();
}
QString QHelpProject::fileFilter() const
{
return QString();
}
QString QHelpProject::fileExtension() const
{
return QString();
}
bool QHelpProject::isModified() const
{
return false;
}
bool QHelpProject::isReadOnly() const
{
return false;
}
bool QHelpProject::isSaveAsAllowed() const
{
return true;
}
void QHelpProject::modified(QWorkbench::FileInterface::ReloadBehavior *behavior)
{
}
IProjectManager *QHelpProject::projectManager() const
{
return m_manager;
}
QVariant QHelpProject::projectProperty(const QString &key) const
{
return QVariant();
}
void QHelpProject::setProjectProperty(const QString &key, const QVariant &value) const
{
}
void QHelpProject::executeProjectCommand(int cmd)
{
}
bool QHelpProject::supportsProjectCommand(int cmd)
{
return false;
}
bool QHelpProject::hasProjectProperty(ProjectProperty property) const
{
return false;
}
QList<QWorkbench::FileInterface*> QHelpProject::dependencies()
{
return QList<QWorkbench::FileInterface*>();
}
void QHelpProject::setExtraApplicationRunArguments(const QStringList &args)
{
}
void QHelpProject::setCustomApplicationOutputHandler(QObject *handler)
{
}
QStringList QHelpProject::files(const QList<QRegExp> &fileMatcher)
{
return m_files;
}
ProjectItemInterface::ProjectItemKind QHelpProject::kind() const
{
return ProjectItemInterface::Project;
}
QString QHelpProject::name() const
{
return m_name;
}
QIcon QHelpProject::icon() const
{
return QIcon();
}
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef QHELPPROJECT_H
#define QHELPPROJECT_H
#include <projectexplorer/ProjectExplorerInterfaces>
#include <QtCore/QObject>
namespace QHelpProjectPlugin {
namespace Internal {
class QHelpProjectManager;
class QHelpProjectFolder;
class QHelpProject : public QObject,
public ProjectExplorer::ProjectInterface
{
Q_OBJECT
Q_INTERFACES(ProjectExplorer::ProjectInterface
ProjectExplorer::ProjectItemInterface
QWorkbench::FileInterface)
public:
QHelpProject(QHelpProjectManager *manager);
~QHelpProject();
bool open(const QString &fileName);
//QWorkbench::FileInterface
bool save(const QString &fileName = QString());
QString fileName() const;
QString defaultPath() const;
QString suggestedFileName() const;
QString fileFilter() const;
QString fileExtension() const;
bool isModified() const;
bool isReadOnly() const;
bool isSaveAsAllowed() const;
void modified(QWorkbench::FileInterface::ReloadBehavior *behavior);
//ProjectExplorer::ProjectInterface
ProjectExplorer::IProjectManager *projectManager() const;
QVariant projectProperty(const QString &key) const;
void setProjectProperty(const QString &key, const QVariant &value) const;
void executeProjectCommand(int cmd);
bool supportsProjectCommand(int cmd);
bool hasProjectProperty(ProjectProperty property) const;
QList<QWorkbench::FileInterface *> dependencies();
void setExtraApplicationRunArguments(const QStringList &args);
void setCustomApplicationOutputHandler(QObject *handler);
QStringList files(const QList<QRegExp> &fileMatcher);
//ProjectExplorer::ProjectItemInterface
ProjectItemKind kind() const;
QString name() const;
QIcon icon() const;
signals:
void buildFinished(const QString &error);
void changed();
private:
QHelpProjectManager *m_manager;
QHelpProjectFolder *m_filesFolder;
QString m_projectFile;
QString m_name;
QStringList m_files;
};
} // namespace Internal
} // namespace QHelpProject
#endif // QHELPPROJECT_H
TEMPLATE = lib
TARGET = QHelpProject
include(../../qworkbenchplugin.pri)
include(../../../../helpsystem/qhelpsystem.pri)
include(../../plugins/coreplugin/coreplugin.pri)
SOURCES += qhelpprojectmanager.cpp \
qhelpproject.cpp \
qhelpprojectitems.cpp
HEADERS += qhelpprojectmanager.h \
qhelpproject.h \
qhelpprojectitems.h
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "qhelpprojectitems.h"
#include <QtGui/QFileIconProvider>
using namespace ProjectExplorer;
using namespace QHelpProjectPlugin::Internal;
QIcon QHelpProjectFile::m_icon = QIcon();
QIcon QHelpProjectFolder::m_icon = QIcon();
QHelpProjectFile::QHelpProjectFile(const QString &fileName)
{
m_file = fileName;
if (m_icon.isNull()) {
QFileIconProvider iconProvider;
m_icon = iconProvider.icon(QFileIconProvider::File);
}
}
QString QHelpProjectFile::fullName() const
{
return m_file;
}
ProjectItemInterface::ProjectItemKind QHelpProjectFile::kind() const
{
return ProjectItemInterface::ProjectFile;
}
QString QHelpProjectFile::name() const
{
QFileInfo fi(m_file);
return fi.fileName();
}
QIcon QHelpProjectFile::icon() const
{
return m_icon;
}
QHelpProjectFolder::QHelpProjectFolder()
{
if (m_icon.isNull()) {
QFileIconProvider iconProvider;
m_icon = iconProvider.icon(QFileIconProvider::Folder);
}
}
QHelpProjectFolder::~QHelpProjectFolder()
{
}
void QHelpProjectFolder::setName(const QString &name)
{
m_name = name;
}
ProjectItemInterface::ProjectItemKind QHelpProjectFolder::kind() const
{
return ProjectItemInterface::ProjectFolder;
}
QString QHelpProjectFolder::name() const
{
return m_name;
}
QIcon QHelpProjectFolder::icon() const
{
return m_icon;
}
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef QHELPPROJECTITEMS_H
#define QHELPPROJECTITEMS_H
#include <projectexplorer/ProjectExplorerInterfaces>
#include <QtGui/QIcon>
namespace QHelpProjectPlugin {
namespace Internal {
class QHelpProjectFile : public QObject,
public ProjectExplorer::ProjectFileInterface
{
Q_OBJECT
Q_INTERFACES(ProjectExplorer::ProjectFileInterface ProjectExplorer::ProjectItemInterface)
public:
QHelpProjectFile(const QString &fileName);
QString fullName() const;
//ProjectExplorer::ProjectItemInterface
ProjectItemKind kind() const;
QString name() const;
QIcon icon() const;
private:
QString m_file;
static QIcon m_icon;
};
class QHelpProjectFolder : public QObject,
public ProjectExplorer::ProjectFolderInterface
{
Q_OBJECT
Q_INTERFACES(ProjectExplorer::ProjectFolderInterface ProjectExplorer::ProjectItemInterface)
public:
QHelpProjectFolder();
~QHelpProjectFolder();
void setName(const QString &name);
//ProjectExplorer::ProjectItemInterface
ProjectItemKind kind() const;
QString name() const;
QIcon icon() const;
private:
QString m_name;
static QIcon m_icon;
};
} // namespace Internal
} // namespace QHelpProject
#endif // QHELPPROJECTITEMS_H
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "qhelpprojectmanager.h"
#include "qhelpproject.h"
#include <QtCore/qplugin.h>
#include <QtCore/QFileInfo>
#include <QtCore/QDebug>
using namespace QHelpProjectPlugin::Internal;
QHelpProjectManager::QHelpProjectManager()
{
}
QHelpProjectManager::~QHelpProjectManager()
{
}
bool QHelpProjectManager::init(ExtensionSystem::PluginManager *pm, QString *error_message)
{
m_pm = pm;
m_core = m_pm->interface<QWorkbench::ICore>();
QWorkbench::ActionManager *am = m_core->actionManager();
m_projectContext = m_core->uniqueIDManager()->
uniqueIdentifier(QLatin1String("QHelpProject"));
m_languageId = m_core->uniqueIDManager()->
uniqueIdentifier(QLatin1String("QHelpLanguage"));
m_projectExplorer = m_pm->interface<ProjectExplorer::ProjectExplorerInterface>();
return true;
}
void QHelpProjectManager::extensionsInitialized()
{
}
void QHelpProjectManager::cleanup()
{
}
int QHelpProjectManager::projectContext() const
{
return m_projectContext;
}
int QHelpProjectManager::projectLanguage() const
{
return m_languageId;
}
bool QHelpProjectManager::canOpen(const QString &fileName)
{
qDebug() << "can open " << fileName;
QFileInfo fi(fileName);
if (fi.suffix() == QLatin1String("qthp"))
return true;
return false;
}
QList<ProjectExplorer::Project*> QHelpProjectManager::open(const QString &fileName)
{
QList<ProjectExplorer::Project*> lst;
QHelpProject *pro = new QHelpProject(this);