From 0b78b646c4c3a9a1296574a754e898ce42e4e806 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 9 May 2011 10:08:47 +0200 Subject: [PATCH] Designer: Remove QDesignerIconCacheInterface and Brush manager. Removed QDesignerIconCacheInterface obsoleted by resource system in Qt 4.4. Remove unused Brush manager. Rubber-stamped-by: Jarek Kobus --- .../components/formeditor/brushmanagerproxy.cpp | 303 --------------------- .../src/components/formeditor/brushmanagerproxy.h | 77 ------ .../src/components/formeditor/formeditor.cpp | 10 - .../src/components/formeditor/formeditor.pri | 6 - .../src/components/formeditor/iconcache.cpp | 121 -------- src/designer/src/components/formeditor/iconcache.h | 78 ------ .../src/components/formeditor/qtbrushmanager.cpp | 140 ---------- .../src/components/formeditor/qtbrushmanager.h | 85 ------ .../propertyeditor/designerpropertymanager.cpp | 2 - .../components/propertyeditor/paletteeditor.cpp | 1 - .../src/components/taskmenu/tablewidgeteditor.cpp | 2 +- .../src/components/taskmenu/treewidgeteditor.cpp | 2 +- src/designer/src/lib/sdk/abstractbrushmanager.h | 83 ------ src/designer/src/lib/sdk/abstractformeditor.cpp | 42 --- src/designer/src/lib/sdk/abstractformeditor.h | 20 +- src/designer/src/lib/sdk/abstracticoncache.h | 83 ------ src/designer/src/lib/sdk/abstracticoncache.qdoc | 116 -------- src/designer/src/lib/sdk/sdk.pri | 2 - src/designer/src/lib/shared/actioneditor.cpp | 1 - src/designer/src/lib/shared/qdesigner_utils.cpp | 1 - 20 files changed, 3 insertions(+), 1172 deletions(-) delete mode 100644 src/designer/src/components/formeditor/brushmanagerproxy.cpp delete mode 100644 src/designer/src/components/formeditor/brushmanagerproxy.h delete mode 100644 src/designer/src/components/formeditor/iconcache.cpp delete mode 100644 src/designer/src/components/formeditor/iconcache.h delete mode 100644 src/designer/src/components/formeditor/qtbrushmanager.cpp delete mode 100644 src/designer/src/components/formeditor/qtbrushmanager.h delete mode 100644 src/designer/src/lib/sdk/abstractbrushmanager.h delete mode 100644 src/designer/src/lib/sdk/abstracticoncache.h delete mode 100644 src/designer/src/lib/sdk/abstracticoncache.qdoc diff --git a/src/designer/src/components/formeditor/brushmanagerproxy.cpp b/src/designer/src/components/formeditor/brushmanagerproxy.cpp deleted file mode 100644 index 5980333..0000000 --- a/src/designer/src/components/formeditor/brushmanagerproxy.cpp +++ /dev/null @@ -1,303 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** 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. -** -** 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. -** -** 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. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtbrushmanager.h" -#include "brushmanagerproxy.h" -#include "qsimpleresource_p.h" -#include "qdesigner_utils_p.h" -#include "ui4_p.h" - -#include - -QT_BEGIN_NAMESPACE - -namespace qdesigner_internal { - -class BrushManagerProxyPrivate -{ - BrushManagerProxy *q_ptr; - Q_DECLARE_PUBLIC(BrushManagerProxy) - -public: - BrushManagerProxyPrivate(BrushManagerProxy *bp, QDesignerFormEditorInterface *core); - void brushAdded(const QString &name, const QBrush &brush); - void brushRemoved(const QString &name); - QString uniqueBrushFileName(const QString &brushName) const; - - QtBrushManager *m_Manager; - QString m_designerFolder; - const QString m_BrushFolder; - QString m_BrushPath; - QDesignerFormEditorInterface *m_Core; - QMap m_FileToBrush; - QMap m_BrushToFile; -}; - -BrushManagerProxyPrivate::BrushManagerProxyPrivate(BrushManagerProxy *bp, QDesignerFormEditorInterface *core) : - q_ptr(bp), - m_Manager(0), - m_BrushFolder(QLatin1String("brushes")), - m_Core(core) -{ - m_designerFolder = QDir::homePath(); - m_designerFolder += QDir::separator(); - m_designerFolder += QLatin1String(".designer"); - m_BrushPath = m_designerFolder; - m_BrushPath += QDir::separator(); - m_BrushPath += m_BrushFolder; -} -} // namespace qdesigner_internal - -using namespace qdesigner_internal; - -void BrushManagerProxyPrivate::brushAdded(const QString &name, const QBrush &brush) -{ - const QString filename = uniqueBrushFileName(name); - - QDir designerDir(m_designerFolder); - if (!designerDir.exists(m_BrushFolder)) - designerDir.mkdir(m_BrushFolder); - - QFile file(m_BrushPath + QDir::separator() +filename); - if (file.open(QIODevice::WriteOnly)) { - QSimpleResource resource(m_Core); - - DomBrush *dom = resource.saveBrush(brush); - - QXmlStreamWriter writer(&file); - writer.setAutoFormatting(true); - writer.setAutoFormattingIndent(1); - writer.writeStartDocument(); - writer.writeStartElement(QLatin1String("description")); - writer.writeAttribute(QLatin1String("name"), name); - dom->write(writer); - writer.writeEndElement(); - writer.writeEndDocument(); - - delete dom; - file.close(); - - m_FileToBrush[filename] = name; - m_BrushToFile[name] = filename; - } -} - -void BrushManagerProxyPrivate::brushRemoved(const QString &name) -{ - QDir brushDir(m_BrushPath); - - QString filename = m_BrushToFile[name]; - brushDir.remove(filename); - m_BrushToFile.remove(name); - m_FileToBrush.remove(filename); -} - -QString BrushManagerProxyPrivate::uniqueBrushFileName(const QString &brushName) const -{ - const QString extension = QLatin1String(".br"); - QString filename = brushName.toLower(); - filename += extension; - int i = 0; - while (m_FileToBrush.contains(filename)) { - filename = brushName.toLower(); - filename += QString::number(++i); - filename += extension; - } - return filename; -} - - -BrushManagerProxy::BrushManagerProxy(QDesignerFormEditorInterface *core, QObject *parent) - : QObject(parent), d_ptr(new BrushManagerProxyPrivate(this, core)) -{ -} - -BrushManagerProxy::~BrushManagerProxy() -{ -} - -void BrushManagerProxy::setBrushManager(QtBrushManager *manager) -{ - if (d_ptr->m_Manager == manager) - return; - - if (d_ptr->m_Manager) { - disconnect(d_ptr->m_Manager, SIGNAL(brushAdded(QString,QBrush)), - this, SLOT(brushAdded(QString,QBrush))); - disconnect(d_ptr->m_Manager, SIGNAL(brushRemoved(QString)), - this, SLOT(brushRemoved(QString))); - } - - d_ptr->m_Manager = manager; - - if (!d_ptr->m_Manager) - return; - - // clear the manager - QMap brushes = d_ptr->m_Manager->brushes(); - QMap::ConstIterator it = brushes.constBegin(); - while (it != brushes.constEnd()) { - QString name = it.key(); - d_ptr->m_Manager->removeBrush(name); - - it++; - } - - // fill up the manager from compiled resources or from brush folder here - const QString nameAttribute = QLatin1String("name"); - const QString brush = QLatin1String("brush"); - const QString description = QLatin1String("description"); - - QDir brushDir(d_ptr->m_BrushPath); - bool customBrushesExist = brushDir.exists(); - if (customBrushesExist) { - // load brushes from brush folder - QStringList nameFilters; - nameFilters.append(QLatin1String("*.br")); - - QFileInfoList infos = brushDir.entryInfoList(nameFilters); - QListIterator it(infos); - while (it.hasNext()) { - const QFileInfo fi = it.next(); - - QString filename = fi.absoluteFilePath(); - - QFile file(filename); - if (file.open(QIODevice::ReadOnly)) { - QXmlStreamReader reader(&file); - - // - // - // - // - // - - QString descname; - while (!reader.atEnd()) { - if (reader.readNext() == QXmlStreamReader::StartElement) { - const QString tag = reader.name().toString().toLower(); - if (tag == description) { - if (!reader.attributes().hasAttribute(nameAttribute)) - reader.raiseError(tr("The element '%1' is missing the required attribute '%2'.") - .arg(tag, nameAttribute)); - else - descname = reader.attributes().value(nameAttribute).toString(); - continue; - } - if (tag == brush) { - DomBrush brush; - brush.read(reader); - - if (descname.isEmpty()) { - reader.raiseError(tr("Empty brush name encountered.")); - } else { - QSimpleResource resource(d_ptr->m_Core); - QBrush br = resource.setupBrush(&brush); - d_ptr->m_Manager->addBrush(descname, br); - d_ptr->m_FileToBrush[filename] = descname; - d_ptr->m_BrushToFile[descname] = filename; - } - continue; - } - reader.raiseError(tr("An unexpected element '%1' was encountered.").arg(tag)); - } - } - - file.close(); - - if (reader.hasError()) { - qdesigner_internal::designerWarning(tr("An error occurred when reading the brush definition file '%1' at line line %2, column %3: %4") - .arg(fi.fileName()) - .arg(reader.lineNumber()) - .arg(reader.columnNumber()) - .arg(reader.errorString())); - continue; - } - } - } - } - - connect(d_ptr->m_Manager, SIGNAL(brushAdded(QString,QBrush)), - this, SLOT(brushAdded(QString,QBrush))); - connect(d_ptr->m_Manager, SIGNAL(brushRemoved(QString)), - this, SLOT(brushRemoved(QString))); - - if (!customBrushesExist) { - // load brushes from resources - QFile qrcFile(QLatin1String(":trolltech/brushes/defaultbrushes.xml")); - if (!qrcFile.open(QIODevice::ReadOnly)) - Q_ASSERT(0); - - QXmlStreamReader reader(&qrcFile); - - while (!reader.atEnd()) { - if (reader.readNext() == QXmlStreamReader::StartElement) { - if (reader.name().toString().toLower() == QLatin1String("description")) { - const QString name = reader.attributes().value(nameAttribute).toString(); - do { // forward to element, which DomBrush expects - reader.readNext(); - } while (!reader.atEnd() && reader.tokenType() != QXmlStreamReader::StartElement); - DomBrush brushDom; - brushDom.read(reader); - if (!reader.hasError()) { - QSimpleResource resource(d_ptr->m_Core); - QBrush br = resource.setupBrush(&brushDom); - d_ptr->m_Manager->addBrush(name, br); - } - } - } - } - if (reader.hasError()) { - // Should never happen - qdesigner_internal::designerWarning(tr("An error occurred when reading the resource file '%1' at line %2, column %3: %4") - .arg(qrcFile.fileName()) - .arg(reader.lineNumber()) - .arg(reader.columnNumber()) - .arg(reader.errorString())); - } - - qrcFile.close(); - } -} - -QT_END_NAMESPACE - -#include "moc_brushmanagerproxy.cpp" diff --git a/src/designer/src/components/formeditor/brushmanagerproxy.h b/src/designer/src/components/formeditor/brushmanagerproxy.h deleted file mode 100644 index 934bd8d..0000000 --- a/src/designer/src/components/formeditor/brushmanagerproxy.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** 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. -** -** 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. -** -** 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. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BRUSHMANAGERPROXY_H -#define BRUSHMANAGERPROXY_H - -#include - -QT_BEGIN_NAMESPACE - -class QDesignerFormEditorInterface; - -namespace qdesigner_internal { - -class QtBrushManager; -class BrushManagerProxyPrivate; - -class BrushManagerProxy : public QObject -{ - Q_OBJECT -public: - explicit BrushManagerProxy(QDesignerFormEditorInterface *core, QObject *parent = 0); - ~BrushManagerProxy(); - - void setBrushManager(QtBrushManager *manager); - -private: - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(BrushManagerProxy) - Q_DISABLE_COPY(BrushManagerProxy) - Q_PRIVATE_SLOT(d_func(), void brushAdded(const QString &, const QBrush &)) - Q_PRIVATE_SLOT(d_func(), void brushRemoved(const QString &name)) -}; - -} // namespace qdesigner_internal - -QT_END_NAMESPACE - -#endif diff --git a/src/designer/src/components/formeditor/formeditor.cpp b/src/designer/src/components/formeditor/formeditor.cpp index 847b99d..517c5d7 100644 --- a/src/designer/src/components/formeditor/formeditor.cpp +++ b/src/designer/src/components/formeditor/formeditor.cpp @@ -61,9 +61,6 @@ #include "qdesigner_stackedbox_p.h" #include "qdesigner_toolbox_p.h" #include "qdesigner_tabwidget_p.h" -#include "qtbrushmanager.h" -#include "brushmanagerproxy.h" -#include "iconcache.h" #include "qtresourcemodel_p.h" #include "qdesigner_integration_p.h" #include "itemview_propertysheet.h" @@ -151,13 +148,6 @@ FormEditor::FormEditor(QObject *parent) setExtensionManager(mgr); - setIconCache(new IconCache(this)); - - QtBrushManager *brushManager = new QtBrushManager(this); - setBrushManager(brushManager); - - BrushManagerProxy *brushProxy = new BrushManagerProxy(this, this); - brushProxy->setBrushManager(brushManager); setPromotion(new QDesignerPromotion(this)); QtResourceModel *resourceModel = new QtResourceModel(this); diff --git a/src/designer/src/components/formeditor/formeditor.pri b/src/designer/src/components/formeditor/formeditor.pri index b1a9318..2ec3bff 100644 --- a/src/designer/src/components/formeditor/formeditor.pri +++ b/src/designer/src/components/formeditor/formeditor.pri @@ -28,9 +28,6 @@ HEADERS += $$PWD/qdesigner_resource.h \ $$PWD/qmdiarea_container.h \ $$PWD/qwizard_container.h \ $$PWD/default_layoutdecoration.h \ - $$PWD/qtbrushmanager.h \ - $$PWD/brushmanagerproxy.h \ - $$PWD/iconcache.h \ $$PWD/tool_widgeteditor.h \ $$PWD/formeditor_optionspage.h \ $$PWD/embeddedoptionspage.h \ @@ -62,9 +59,6 @@ SOURCES += $$PWD/qdesigner_resource.cpp \ $$PWD/default_layoutdecoration.cpp \ $$PWD/default_actionprovider.cpp \ $$PWD/tool_widgeteditor.cpp \ - $$PWD/qtbrushmanager.cpp \ - $$PWD/brushmanagerproxy.cpp \ - $$PWD/iconcache.cpp \ $$PWD/formeditor_optionspage.cpp \ $$PWD/embeddedoptionspage.cpp \ $$PWD/formwindowsettings.cpp \ diff --git a/src/designer/src/components/formeditor/iconcache.cpp b/src/designer/src/components/formeditor/iconcache.cpp deleted file mode 100644 index 3fceeea..0000000 --- a/src/designer/src/components/formeditor/iconcache.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** 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. -** -** 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. -** -** 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. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "iconcache.h" -#include -#include -#include - -QT_BEGIN_NAMESPACE - -using namespace qdesigner_internal; - -IconCache::IconCache(QObject *parent) - : QDesignerIconCacheInterface(parent) -{ -} - -QIcon IconCache::nameToIcon(const QString &path, const QString &resourcePath) -{ - Q_UNUSED(path) - Q_UNUSED(resourcePath) - qWarning() << "IconCache::nameToIcon(): IconCache is obsoleted"; - return QIcon(); -} - -QString IconCache::iconToFilePath(const QIcon &pm) const -{ - Q_UNUSED(pm) - qWarning() << "IconCache::iconToFilePath(): IconCache is obsoleted"; - return QString(); -} - -QString IconCache::iconToQrcPath(const QIcon &pm) const -{ - Q_UNUSED(pm) - qWarning() << "IconCache::iconToQrcPath(): IconCache is obsoleted"; - return QString(); -} - -QPixmap IconCache::nameToPixmap(const QString &path, const QString &resourcePath) -{ - Q_UNUSED(path) - Q_UNUSED(resourcePath) - qWarning() << "IconCache::nameToPixmap(): IconCache is obsoleted"; - return QPixmap(); -} - -QString IconCache::pixmapToFilePath(const QPixmap &pm) const -{ - Q_UNUSED(pm) - qWarning() << "IconCache::pixmapToFilePath(): IconCache is obsoleted"; - return QString(); -} - -QString IconCache::pixmapToQrcPath(const QPixmap &pm) const -{ - Q_UNUSED(pm) - qWarning() << "IconCache::pixmapToQrcPath(): IconCache is obsoleted"; - return QString(); -} - -QList IconCache::pixmapList() const -{ - qWarning() << "IconCache::pixmapList(): IconCache is obsoleted"; - return QList(); -} - -QList IconCache::iconList() const -{ - qWarning() << "IconCache::iconList(): IconCache is obsoleted"; - return QList(); -} - -QString IconCache::resolveQrcPath(const QString &filePath, const QString &qrcPath, const QString &wd) const -{ - Q_UNUSED(filePath) - Q_UNUSED(qrcPath) - Q_UNUSED(wd) - qWarning() << "IconCache::resolveQrcPath(): IconCache is obsoleted"; - return QString(); -} - -QT_END_NAMESPACE diff --git a/src/designer/src/components/formeditor/iconcache.h b/src/designer/src/components/formeditor/iconcache.h deleted file mode 100644 index 5d9cc65..0000000 --- a/src/designer/src/components/formeditor/iconcache.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** 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. -** -** 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. -** -** 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. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef ICONCACHE_H -#define ICONCACHE_H - -#include "formeditor_global.h" - -#include - -QT_BEGIN_NAMESPACE - -namespace qdesigner_internal { - -class QT_FORMEDITOR_EXPORT IconCache : public QDesignerIconCacheInterface -{ - Q_OBJECT -public: - explicit IconCache(QObject *parent); - - virtual QIcon nameToIcon(const QString &path, const QString &resourcePath = QString()); - virtual QString iconToFilePath(const QIcon &pm) const; - virtual QString iconToQrcPath(const QIcon &pm) const; - virtual QPixmap nameToPixmap(const QString &path, const QString &resourcePath = QString()); - virtual QString pixmapToFilePath(const QPixmap &pm) const; - virtual QString pixmapToQrcPath(const QPixmap &pm) const; - - virtual QList pixmapList() const; - virtual QList iconList() const; - - virtual QString resolveQrcPath(const QString &filePath, const QString &qrcPath, const QString &workingDirectory = QString()) const; - -private: -}; - -} // namespace qdesigner_internal - -QT_END_NAMESPACE - -#endif // ICONCACHE_H diff --git a/src/designer/src/components/formeditor/qtbrushmanager.cpp b/src/designer/src/components/formeditor/qtbrushmanager.cpp deleted file mode 100644 index 8cba8fa..0000000 --- a/src/designer/src/components/formeditor/qtbrushmanager.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** 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. -** -** 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. -** -** 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. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtbrushmanager.h" -#include -#include - -QT_BEGIN_NAMESPACE - -namespace qdesigner_internal { - -class QtBrushManagerPrivate -{ - QtBrushManager *q_ptr; - Q_DECLARE_PUBLIC(QtBrushManager) -public: - QMap theBrushMap; - QString theCurrentBrush; -}; - -QtBrushManager::QtBrushManager(QObject *parent) - : QDesignerBrushManagerInterface(parent), d_ptr(new QtBrushManagerPrivate) -{ - d_ptr->q_ptr = this; -} - -QtBrushManager::~QtBrushManager() -{ -} - -QBrush QtBrushManager::brush(const QString &name) const -{ - if (d_ptr->theBrushMap.contains(name)) - return d_ptr->theBrushMap[name]; - return QBrush(); -} - -QMap QtBrushManager::brushes() const -{ - return d_ptr->theBrushMap; -} - -QString QtBrushManager::currentBrush() const -{ - return d_ptr->theCurrentBrush; -} - -QString QtBrushManager::addBrush(const QString &name, const QBrush &brush) -{ - if (name.isNull()) - return QString(); - - QString newName = name; - QString nameBase = newName; - int i = 0; - while (d_ptr->theBrushMap.contains(newName)) { - newName = nameBase + QString::number(++i); - } - d_ptr->theBrushMap[newName] = brush; - emit brushAdded(newName, brush); - - return newName; -} - -void QtBrushManager::removeBrush(const QString &name) -{ - if (!d_ptr->theBrushMap.contains(name)) - return; - if (currentBrush() == name) - setCurrentBrush(QString()); - emit brushRemoved(name); - d_ptr->theBrushMap.remove(name); -} - -void QtBrushManager::setCurrentBrush(const QString &name) -{ - QBrush newBrush; - if (!name.isNull()) { - if (d_ptr->theBrushMap.contains(name)) - newBrush = d_ptr->theBrushMap[name]; - else - return; - } - d_ptr->theCurrentBrush = name; - emit currentBrushChanged(name, newBrush); -} - -QPixmap QtBrushManager::brushPixmap(const QBrush &brush) const -{ - int w = 64; - int h = 64; - - QImage img(w, h, QImage::Format_ARGB32_Premultiplied); - QPainter p(&img); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.fillRect(QRect(0, 0, w, h), brush); - return QPixmap::fromImage(img); -} - -} // namespace qdesigner_internal - -QT_END_NAMESPACE diff --git a/src/designer/src/components/formeditor/qtbrushmanager.h b/src/designer/src/components/formeditor/qtbrushmanager.h deleted file mode 100644 index d490523..0000000 --- a/src/designer/src/components/formeditor/qtbrushmanager.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** 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. -** -** 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. -** -** 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. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTBRUSHMANAGER_H -#define QTBRUSHMANAGER_H - -#include -#include "formeditor_global.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace qdesigner_internal { - -class QtBrushManagerPrivate; - -class QT_FORMEDITOR_EXPORT QtBrushManager : public QDesignerBrushManagerInterface -{ - Q_OBJECT -public: - QtBrushManager(QObject *parent = 0); - ~QtBrushManager(); - - QBrush brush(const QString &name) const; - QMap brushes() const; - QString currentBrush() const; - - QString addBrush(const QString &name, const QBrush &brush); - void removeBrush(const QString &name); - void setCurrentBrush(const QString &name); - - QPixmap brushPixmap(const QBrush &brush) const; - -private: - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtBrushManager) - Q_DISABLE_COPY(QtBrushManager) -}; - -} // namespace qdesigner_internal - -QT_END_NAMESPACE - -#endif diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp index 78fb9aa..d96eba9 100644 --- a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp +++ b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp @@ -56,8 +56,6 @@ #include #include -#include - #include #include #include diff --git a/src/designer/src/components/propertyeditor/paletteeditor.cpp b/src/designer/src/components/propertyeditor/paletteeditor.cpp index 55a6da5..c304759 100644 --- a/src/designer/src/components/propertyeditor/paletteeditor.cpp +++ b/src/designer/src/components/propertyeditor/paletteeditor.cpp @@ -46,7 +46,6 @@ #include #include -#include #include #include diff --git a/src/designer/src/components/taskmenu/tablewidgeteditor.cpp b/src/designer/src/components/taskmenu/tablewidgeteditor.cpp index 35f1a0e..c0e57da 100644 --- a/src/designer/src/components/taskmenu/tablewidgeteditor.cpp +++ b/src/designer/src/components/taskmenu/tablewidgeteditor.cpp @@ -50,7 +50,7 @@ #include #include -#include + #include #include #include diff --git a/src/designer/src/components/taskmenu/treewidgeteditor.cpp b/src/designer/src/components/taskmenu/treewidgeteditor.cpp index f5f6035..c26bd18 100644 --- a/src/designer/src/components/taskmenu/treewidgeteditor.cpp +++ b/src/designer/src/components/taskmenu/treewidgeteditor.cpp @@ -50,7 +50,7 @@ #include #include -#include + #include #include #include diff --git a/src/designer/src/lib/sdk/abstractbrushmanager.h b/src/designer/src/lib/sdk/abstractbrushmanager.h deleted file mode 100644 index 87b1bf2..0000000 --- a/src/designer/src/lib/sdk/abstractbrushmanager.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** 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. -** -** 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. -** -** 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. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef ABSTRACTBRUSHMANAGER_H -#define ABSTRACTBRUSHMANAGER_H - -#include - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QObject; - -class QDESIGNER_SDK_EXPORT QDesignerBrushManagerInterface : public QObject -{ - Q_OBJECT -public: - QDesignerBrushManagerInterface(QObject *parentObject = 0) : QObject(parentObject) {} - - virtual QBrush brush(const QString &name) const = 0; - virtual QMap brushes() const = 0; - virtual QString currentBrush() const = 0; - - virtual QString addBrush(const QString &name, const QBrush &brush) = 0; - virtual void removeBrush(const QString &name) = 0; - virtual void setCurrentBrush(const QString &name) = 0; - - virtual QPixmap brushPixmap(const QBrush &brush) const = 0; -Q_SIGNALS: - void brushAdded(const QString &name, const QBrush &brush); - void brushRemoved(const QString &name); - void currentBrushChanged(const QString &name, const QBrush &brush); - -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/designer/src/lib/sdk/abstractformeditor.cpp b/src/designer/src/lib/sdk/abstractformeditor.cpp index 5637816..4fb3903 100644 --- a/src/designer/src/lib/sdk/abstractformeditor.cpp +++ b/src/designer/src/lib/sdk/abstractformeditor.cpp @@ -53,9 +53,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -97,9 +95,7 @@ public: QPointer m_widgetDataBase; QPointer m_widgetFactory; QPointer m_objectInspector; - QPointer m_brushManager; QPointer m_integration; - QPointer m_iconCache; QPointer m_actionEditor; QDesignerSettingsInterface *m_settingsManager; QDesignerPluginManager *m_pluginManager; @@ -192,7 +188,6 @@ QDesignerFormEditorInterface::QDesignerFormEditorInterface(QObject *parent) */ QDesignerFormEditorInterface::~QDesignerFormEditorInterface() { - delete d; } /*! @@ -404,24 +399,6 @@ void QDesignerFormEditorInterface::setObjectInspector(QDesignerObjectInspectorIn /*! \internal - Returns an interface to the brush manager used by the palette editor. -*/ -QDesignerBrushManagerInterface *QDesignerFormEditorInterface::brushManager() const -{ - return d->m_brushManager; -} - -/*! - \internal -*/ -void QDesignerFormEditorInterface::setBrushManager(QDesignerBrushManagerInterface *brushManager) -{ - d->m_brushManager = brushManager; -} - -/*! - \internal - Returns an interface to the integration. */ QDesignerIntegrationInterface *QDesignerFormEditorInterface::integration() const @@ -439,25 +416,6 @@ void QDesignerFormEditorInterface::setIntegration(QDesignerIntegrationInterface /*! \internal - - Returns an interface to the icon cache used by the form editor to - manage icons. -*/ -QDesignerIconCacheInterface *QDesignerFormEditorInterface::iconCache() const -{ - return d->m_iconCache; -} - -/*! - \internal -*/ -void QDesignerFormEditorInterface::setIconCache(QDesignerIconCacheInterface *cache) -{ - d->m_iconCache = cache; -} - -/*! - \internal \since 4.5 Returns the list of options pages that allow the user to configure \QD components. */ diff --git a/src/designer/src/lib/sdk/abstractformeditor.h b/src/designer/src/lib/sdk/abstractformeditor.h index fd83ee5..c626473 100644 --- a/src/designer/src/lib/sdk/abstractformeditor.h +++ b/src/designer/src/lib/sdk/abstractformeditor.h @@ -59,8 +59,6 @@ class QDesignerMetaDataBaseInterface; class QDesignerWidgetFactoryInterface; class QDesignerObjectInspectorInterface; class QDesignerPromotionInterface; -class QDesignerBrushManagerInterface; -class QDesignerIconCacheInterface; class QDesignerActionEditorInterface; class QDesignerIntegrationInterface; class QDesignerPluginManager; @@ -95,8 +93,6 @@ public: QDesignerMetaDataBaseInterface *metaDataBase() const; QDesignerPromotionInterface *promotion() const; QDesignerWidgetFactoryInterface *widgetFactory() const; - QDesignerBrushManagerInterface *brushManager() const; - QDesignerIconCacheInterface *iconCache() const; QDesignerActionEditorInterface *actionEditor() const; QDesignerIntegrationInterface *integration() const; QDesignerPluginManager *pluginManager() const; @@ -129,23 +125,9 @@ protected: void setPromotion(QDesignerPromotionInterface *promotion); void setWidgetFactory(QDesignerWidgetFactoryInterface *widgetFactory); void setExtensionManager(QExtensionManager *extensionManager); - void setBrushManager(QDesignerBrushManagerInterface *brushManager); - void setIconCache(QDesignerIconCacheInterface *cache); private: - QPointer m_pad1; - QPointer m_pad2; - QPointer m_pad3; - QPointer m_pad4; - QPointer m_pad5; - QPointer m_pad6; - QPointer m_pad7; - QPointer m_pad8; - QPointer m_pad9; - QPointer m_pad10; - QPointer m_pad11; - QPointer m_pad12; - QDesignerFormEditorInterfacePrivate *d; + QScopedPointer d; private: QDesignerFormEditorInterface(const QDesignerFormEditorInterface &other); diff --git a/src/designer/src/lib/sdk/abstracticoncache.h b/src/designer/src/lib/sdk/abstracticoncache.h deleted file mode 100644 index ce2ed9d..0000000 --- a/src/designer/src/lib/sdk/abstracticoncache.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** 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. -** -** 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. -** -** 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. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef ABSTRACTICONCACHE_H -#define ABSTRACTICONCACHE_H - -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QIcon; -class QPixmap; -class QString; - -class QDESIGNER_SDK_EXPORT QDesignerIconCacheInterface : public QObject -{ - Q_OBJECT -public: - QDesignerIconCacheInterface(QObject *parent_) - : QObject(parent_) {} - - virtual QIcon nameToIcon(const QString &filePath, const QString &qrcPath = QString()) = 0; - virtual QPixmap nameToPixmap(const QString &filePath, const QString &qrcPath = QString()) = 0; - - virtual QString iconToFilePath(const QIcon &pm) const = 0; - virtual QString iconToQrcPath(const QIcon &pm) const = 0; - - virtual QString pixmapToFilePath(const QPixmap &pm) const = 0; - virtual QString pixmapToQrcPath(const QPixmap &pm) const = 0; - - virtual QList pixmapList() const = 0; - virtual QList iconList() const = 0; - - virtual QString resolveQrcPath(const QString &filePath, const QString &qrcPath, const QString &workingDirectory = QString()) const = 0; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // ABSTRACTICONCACHE_H diff --git a/src/designer/src/lib/sdk/abstracticoncache.qdoc b/src/designer/src/lib/sdk/abstracticoncache.qdoc deleted file mode 100644 index f211c53..0000000 --- a/src/designer/src/lib/sdk/abstracticoncache.qdoc +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** No Commercial Usage -** 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. -** -** GNU Free Documentation License -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of this -** file. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \class QDesignerIconCacheInterface - \brief The QDesignerIconCacheInterface class provides an interface to \QD's icon cache. - \inmodule QtDesigner - \internal -*/ - -/*! - \fn QDesignerIconCacheInterface::QDesignerIconCacheInterface(QObject *parent) - - Constructs a new interface with the given \a parent. -*/ - -/*! - \fn QIcon QDesignerIconCacheInterface::nameToIcon(const QString &filePath, const QString &qrcPath) - - Returns the icon associated with the name specified by \a filePath in the resource - file specified by \a qrcPath. - - If \a qrcPath refers to a valid resource file, the name used for the file path is a path - within those resources; otherwise the file path refers to a local file. - - \sa {The Qt Resource System}, nameToPixmap() -*/ - -/*! - \fn QPixmap QDesignerIconCacheInterface::nameToPixmap(const QString &filePath, const QString &qrcPath) - - Returns the pixmap associated with the name specified by \a filePath in the resource - file specified by \a qrcPath. - - If \a qrcPath refers to a valid resource file, the name used for the file path is a path - within those resources; otherwise the file path refers to a local file. - - \sa {The Qt Resource System}, nameToIcon() -*/ - -/*! - \fn QString QDesignerIconCacheInterface::iconToFilePath(const QIcon &icon) const - - Returns the file path associated with the given \a icon. The file path is a path within - an application resources. -*/ - -/*! - \fn QString QDesignerIconCacheInterface::iconToQrcPath(const QIcon &icon) const - - Returns the path to the resource file that refers to the specified \a icon. The resource - path refers to a local file. -*/ - -/*! - \fn QString QDesignerIconCacheInterface::pixmapToFilePath(const QPixmap &pixmap) const - - Returns the file path associated with the given \a pixmap. The file path is a path within - an application resources. -*/ - -/*! - \fn QString QDesignerIconCacheInterface::pixmapToQrcPath(const QPixmap &pixmap) const - - Returns the path to the resource file that refers to the specified \a pixmap. The resource - path refers to a local file. -*/ - -/*! - \fn QList QDesignerIconCacheInterface::pixmapList() const - - Returns a list of pixmaps for the icons provided by the icon cache. -*/ - -/*! - \fn QList QDesignerIconCacheInterface::iconList() const - - Returns a list of icons provided by the icon cache. -*/ - -/*! - \fn QString QDesignerIconCacheInterface::resolveQrcPath(const QString &filePath, const QString &qrcPath, const QString &workingDirectory) const - - Returns a path to a resource specified by the \a filePath within - the resource file located at \a qrcPath. If \a workingDirectory is - a valid path to a directory, the path returned will be relative to - that directory; otherwise an absolute path is returned. - - \omit - ### Needs checking - \endomit -*/ diff --git a/src/designer/src/lib/sdk/sdk.pri b/src/designer/src/lib/sdk/sdk.pri index bc46a1e..c6a474b 100644 --- a/src/designer/src/lib/sdk/sdk.pri +++ b/src/designer/src/lib/sdk/sdk.pri @@ -18,8 +18,6 @@ HEADERS += $$PWD/abstractformeditor.h \ $$PWD/abstractwidgetfactory.h \ $$PWD/abstractobjectinspector.h \ $$PWD/abstractactioneditor.h \ - $$PWD/abstractbrushmanager.h \ - $$PWD/abstracticoncache.h \ $$PWD/abstractlanguage.h \ $$PWD/abstractoptionspage_p.h \ $$PWD/propertysheet.h \ diff --git a/src/designer/src/lib/shared/actioneditor.cpp b/src/designer/src/lib/shared/actioneditor.cpp index fb882c3..5551584 100644 --- a/src/designer/src/lib/shared/actioneditor.cpp +++ b/src/designer/src/lib/shared/actioneditor.cpp @@ -58,7 +58,6 @@ #include #include #include -#include #include #include diff --git a/src/designer/src/lib/shared/qdesigner_utils.cpp b/src/designer/src/lib/shared/qdesigner_utils.cpp index 1c6c854..5f0a685 100644 --- a/src/designer/src/lib/shared/qdesigner_utils.cpp +++ b/src/designer/src/lib/shared/qdesigner_utils.cpp @@ -46,7 +46,6 @@ #include #include -#include #include #include #include -- 2.7.4