Commit 2e193da3 authored by con's avatar con
Browse files

Delete dead code.

parent dfedba30
......@@ -56,7 +56,6 @@ SOURCES += mainwindow.cpp \
progressmanager/progressbar.cpp \
progressmanager/futureprogress.cpp \
scriptmanager/scriptmanager.cpp \
scriptmanager/qworkbench_wrapper.cpp \
basemode.cpp \
statusbarwidget.cpp \
coreplugin.cpp \
......@@ -165,7 +164,6 @@ HEADERS += mainwindow.h \
icorelistener.h \
versiondialog.h \
scriptmanager/metatypedeclarations.h \
scriptmanager/qworkbench_wrapper.h \
scriptmanager/scriptmanager.h \
scriptmanager/scriptmanager_p.h \
core_global.h \
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (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 http://qt.nokia.com/contact.
**
**************************************************************************/
#include "qworkbench_wrapper.h"
#include <wrap_helpers.h>
#include <coreplugin/messagemanager.h>
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/QSettings>
#include <QtGui/QMainWindow>
#include <QtScript/QScriptEngine>
namespace {
enum { debugQWorkbenchWrappers = 0 };
}
namespace Core {
namespace Internal {
// -- CorePrototype
CorePrototype::CorePrototype(QObject *parent) :
QObject(parent)
{
}
Core::MessageManager *CorePrototype::messageManager() const
{
return callee()->messageManager();
}
Core::FileManager *CorePrototype::fileManager() const
{
return callee()->fileManager();
}
Core::EditorManager *CorePrototype::editorManager() const
{
return callee()->editorManager();
}
QMainWindow *CorePrototype::mainWindow() const
{
return callee()->mainWindow();
}
QSettings *CorePrototype::settings() const
{
return callee()->settings();
}
void CorePrototype::updateAdditionalContexts(const Context &remove, const Context &add)
{
callee()->updateAdditionalContexts(remove, add);
}
QString CorePrototype::toString() const
{
return QLatin1String("Core");
}
CorePrototype::ICore *CorePrototype::callee() const
{
ICore *rc = qscriptvalue_cast<ICore *>(thisObject());
QTC_ASSERT(rc, return 0);
return rc;
}
// -- MessageManager
MessageManagerPrototype::MessageManagerPrototype(QObject *parent) :
QObject(parent)
{
}
void MessageManagerPrototype::printToOutputPane(const QString &text, bool bringToForeground)
{
MessageManager *mm = qscriptvalue_cast<MessageManager *>(thisObject());
QTC_ASSERT(mm, return);
mm->printToOutputPane(text, bringToForeground);
}
void MessageManagerPrototype::printToOutputPanePopup(const QString &text)
{
MessageManager *mm = qscriptvalue_cast<MessageManager *>(thisObject());
QTC_ASSERT(mm, return);
mm->printToOutputPanePopup(text);
}
void MessageManagerPrototype::printToOutputPane(const QString &text)
{
MessageManager *mm = qscriptvalue_cast<MessageManager *>(thisObject());
QTC_ASSERT(mm, return);
mm->printToOutputPane(text);
}
QString MessageManagerPrototype::toString() const
{
return QLatin1String("MessageManager");
}
// -- FileManagerPrototype
FileManagerPrototype::FileManagerPrototype(QObject *parent) :
QObject(parent)
{
}
FileManager *FileManagerPrototype::callee() const
{
FileManager *rc = qscriptvalue_cast<FileManager *>(thisObject());
QTC_ASSERT(rc, return 0);
return rc;
}
void FileManagerPrototype::addFiles(const QList<Core::IFile *> &files)
{
callee()->addFiles(files);
}
void FileManagerPrototype::addFile(Core::IFile *file)
{
callee()->addFile(file);
}
void FileManagerPrototype::removeFile(Core::IFile *file)
{
callee()->removeFile(file);
}
QList<Core::IFile*>
FileManagerPrototype::saveModifiedFilesSilently(const QList<Core::IFile*> &files)
{
return callee()->saveModifiedFilesSilently(files);
}
QString FileManagerPrototype::getSaveAsFileName(Core::IFile *file)
{
return callee()->getSaveAsFileName(file);
}
void FileManagerPrototype::blockFileChange(Core::IFile *file)
{
callee()->blockFileChange(file);
}
void FileManagerPrototype::unblockFileChange(Core::IFile *file)
{
return callee()->unblockFileChange(file);
}
void FileManagerPrototype::addToRecentFiles(const QString &fileName)
{
return callee()->addToRecentFiles(fileName);
}
QStringList FileManagerPrototype::recentFiles() const
{
return callee()->recentFiles();
}
QString FileManagerPrototype::toString() const
{
return QLatin1String("FileManager");
}
// ------- FilePrototype
FilePrototype::FilePrototype(QObject *parent) :
QObject(parent)
{
}
IFile *FilePrototype::callee() const
{
IFile *rc = qscriptvalue_cast<IFile *>(thisObject());
QTC_ASSERT(rc, return 0);
return rc;
}
QString FilePrototype::fileName () const { return callee()->fileName(); }
QString FilePrototype::defaultPath () const { return callee()->defaultPath(); }
QString FilePrototype::suggestedFileName () const { return callee()->suggestedFileName(); }
bool FilePrototype::isModified () const { return callee()->isModified(); }
bool FilePrototype::isReadOnly () const { return callee()->isReadOnly(); }
bool FilePrototype::isSaveAsAllowed () const { return callee()->isSaveAsAllowed(); }
QString FilePrototype::toString() const
{
QString rc = QLatin1String("File(");
rc += fileName();
rc += QLatin1Char(')');
return rc;
}
// ------------- EditorManagerPrototype
EditorManagerPrototype::EditorManagerPrototype(QObject *parent) :
QObject(parent)
{
}
Core::IEditor *EditorManagerPrototype::currentEditor() const
{
return callee()->currentEditor();
}
void EditorManagerPrototype::activateEditor(Core::IEditor *editor)
{
callee()->activateEditor(editor);
}
QList<Core::IEditor*> EditorManagerPrototype::openedEditors() const
{
return callee()->openedEditors();
}
QList<Core::IEditor*> EditorManagerPrototype::editorsForFiles(QList<Core::IFile*> files) const
{
return callee()->editorsForFiles(files);
}
bool EditorManagerPrototype::closeEditors(const QList<Core::IEditor*> editorsToClose, bool askAboutModifiedEditors)
{
return callee()->closeEditors(editorsToClose, askAboutModifiedEditors);
}
Core::IEditor *EditorManagerPrototype::openEditor(const QString &fileName, const QString &editorId)
{
return callee()->openEditor(fileName, editorId);
}
Core::IEditor *EditorManagerPrototype::newFile(const QString &editorId, QString titlePattern, const QString &contents)
{
return callee()->openEditorWithContents(editorId, &titlePattern, contents);
}
int EditorManagerPrototype::makeEditorWritable(Core::IEditor *editor)
{
return callee()->makeEditorWritable(editor);
}
QString EditorManagerPrototype::toString() const
{
return QLatin1String("EditorManager");
}
EditorManagerPrototype::EditorManager *EditorManagerPrototype::callee() const
{
EditorManager *rc = qscriptvalue_cast<EditorManager *>(thisObject());
QTC_ASSERT(rc, return 0);
return rc;
}
// ------------- EditorPrototype
EditorPrototype::EditorPrototype(QObject *parent)
: QObject(parent)
{
}
QString EditorPrototype::displayName() const
{
return callee()->displayName();
}
void EditorPrototype::setDisplayName(const QString &title)
{
callee()->setDisplayName(title);
}
QString EditorPrototype::id() const
{
return callee()->id();
}
bool EditorPrototype::duplicateSupported() const
{
return callee()->duplicateSupported();
}
bool EditorPrototype::createNew(const QString &contents)
{
return callee()->createNew(contents);
}
bool EditorPrototype::open(const QString &fileName)
{
return callee()->open(fileName);
}
Core::IEditor *EditorPrototype::duplicate(QWidget *parent)
{
return callee()->duplicate(parent);
}
Core::IFile *EditorPrototype::file() const
{
return callee()->file();
}
QWidget* EditorPrototype::toolBar() const
{
return callee()->toolBar();
}
Core::IEditor *EditorPrototype::callee() const
{
IEditor *rc = qscriptvalue_cast<IEditor *>(thisObject());
QTC_ASSERT(rc, return 0);
return rc;
}
QString EditorPrototype::toString() const
{
QString rc = QLatin1String("Editor(");
rc += displayName();
rc += QLatin1Char(')');
return rc;
}
} // namespace Internal
} // namespace Core
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (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 http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef QWORKBENCH_WRAPPER_H
#define QWORKBENCH_WRAPPER_H
#include "metatypedeclarations.h" // required for property declarations
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtScript/QScriptable>
#include <QtScript/QScriptValue>
namespace Core {
namespace Internal {
// Script prototype for the core interface.
class CorePrototype : public QObject, public QScriptable
{
Q_OBJECT
Q_PROPERTY(Core::MessageManager *messageManager READ messageManager DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(Core::FileManager *fileManager READ fileManager DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(Core::EditorManager *editorManager READ editorManager DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(QMainWindow *mainWindow READ mainWindow DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(QSettings *settings READ settings DESIGNABLE false SCRIPTABLE true STORED false)
public:
typedef Core::ICore ICore;
CorePrototype(QObject *parent);
Core::MessageManager *messageManager() const;
Core::FileManager *fileManager() const;
Core::EditorManager *editorManager() const;
QMainWindow *mainWindow() const;
QSettings *settings() const;
public slots:
void updateAdditionalContexts(const Context &remove, const Context &add);
QString toString() const;
private:
ICore *callee() const;
};
// Script prototype for the message manager.
class MessageManagerPrototype : public QObject, public QScriptable
{
Q_OBJECT
public:
typedef Core::MessageManager MessageManager;
MessageManagerPrototype(QObject *parent = 0);
public slots:
void printToOutputPane(const QString &text, bool bringToForeground);
void printToOutputPanePopup(const QString &text); // pops up
void printToOutputPane(const QString &text);
QString toString() const;
};
// Script prototype for the file manager interface.
class FileManagerPrototype : public QObject, public QScriptable
{
Q_OBJECT
Q_PROPERTY(QStringList recentFiles READ recentFiles DESIGNABLE false SCRIPTABLE true STORED false)
public:
typedef Core::FileManager FileManager;
FileManagerPrototype(QObject *parent = 0);
QStringList recentFiles() const;
public slots:
void addFiles(const QList<Core::IFile *> &files);
void addFile(Core::IFile *file);
void removeFile(Core::IFile *file);
QList<Core::IFile*> saveModifiedFilesSilently(const QList<Core::IFile*> &files);
QString getSaveAsFileName(Core::IFile *file);
void blockFileChange(Core::IFile *file);
void unblockFileChange(Core::IFile *file);
void addToRecentFiles(const QString &fileName);
QString toString() const;
private:
FileManager *callee() const;
};
// Script prototype for the file interface.
class FilePrototype : public QObject, public QScriptable
{
Q_OBJECT
Q_PROPERTY(QString fileName READ fileName DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(QString defaultPath READ defaultPath DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(QString suggestedFileName READ suggestedFileName DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(bool isModified READ isModified DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(bool isReadOnly READ isReadOnly DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(bool isSaveAsAllowed READ isSaveAsAllowed DESIGNABLE false SCRIPTABLE true STORED false)
public:
typedef Core::IFile IFile;
FilePrototype(QObject *parent = 0);
QString fileName() const;
QString defaultPath() const;
QString suggestedFileName() const;
bool isModified() const;
bool isReadOnly() const;
bool isSaveAsAllowed() const;
public slots:
QString toString() const;
private:
IFile *callee() const;
};
// Script prototype for the editor manager interface.
class EditorManagerPrototype : public QObject, public QScriptable
{
Q_OBJECT
Q_PROPERTY(Core::IEditor* currentEditor READ currentEditor WRITE activateEditor DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(QList<Core::IEditor*> openedEditors READ openedEditors DESIGNABLE false SCRIPTABLE true STORED false)
public:
typedef Core::EditorManager EditorManager;
EditorManagerPrototype(QObject *parent = 0);
Core::IEditor *currentEditor() const;
void activateEditor(Core::IEditor *editor);
QList<Core::IEditor*> openedEditors() const;
QList<Core::IEditor*> editorHistory() const;
public slots:
QList<Core::IEditor*> editorsForFiles(QList<Core::IFile*> files) const;
bool closeEditors(const QList<Core::IEditor*> editorsToClose, bool askAboutModifiedEditors);
Core::IEditor *openEditor(const QString &fileName, const QString &editorId);
Core::IEditor *newFile(const QString &editorId, QString titlePattern, const QString &contents);
int makeEditorWritable(Core::IEditor *editor);
QString toString() const;
private:
EditorManager *callee() const;
};
// Script prototype for the editor interface.
class EditorPrototype : public QObject, public QScriptable
{
Q_OBJECT
Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(QString id READ id DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(bool duplicateSupported READ duplicateSupported DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(Core::IFile* file READ file DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(QWidget* toolBar READ toolBar DESIGNABLE false SCRIPTABLE true STORED false)
public:
EditorPrototype(QObject *parent = 0);
QString displayName() const;
void setDisplayName(const QString &title);
QString id() const;
bool duplicateSupported() const;
Core::IFile *file() const;
QWidget* toolBar() const;
public slots:
bool createNew(const QString &contents);
bool open(const QString &fileName);
Core::IEditor *duplicate(QWidget *parent);
QString toString() const;
private:
Core::IEditor *callee() const;
};
} // namespace Internal