forked from qt-creator/qt-creator
MultiLanguage: Add image generation for excel export
Change-Id: Ied15381d94c391c86438c66fe88f755421bb3492 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
INCLUDEPATH += $$PWD
|
INCLUDEPATH += $$PWD $$PWD/../interfaces
|
||||||
|
|
||||||
HEADERS += $$PWD/synchronizecommand.h \ \
|
HEADERS += $$PWD/synchronizecommand.h \ \
|
||||||
$$PWD/captureddatacommand.h \
|
$$PWD/captureddatacommand.h \
|
||||||
|
@@ -509,6 +509,7 @@ extend_qtc_plugin(QmlDesigner
|
|||||||
include/variantproperty.h
|
include/variantproperty.h
|
||||||
include/viewmanager.h
|
include/viewmanager.h
|
||||||
include/imagecache.h
|
include/imagecache.h
|
||||||
|
include/imagecacheinterface.h
|
||||||
)
|
)
|
||||||
|
|
||||||
extend_qtc_plugin(QmlDesigner
|
extend_qtc_plugin(QmlDesigner
|
||||||
|
@@ -164,6 +164,11 @@ void ItemLibraryView::setResourcePath(const QString &resourcePath)
|
|||||||
m_widget->setResourcePath(resourcePath);
|
m_widget->setResourcePath(resourcePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImageCache &ItemLibraryView::imageCache()
|
||||||
|
{
|
||||||
|
return m_imageCacheData->cache;
|
||||||
|
}
|
||||||
|
|
||||||
void ItemLibraryView::documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &)
|
void ItemLibraryView::documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &)
|
||||||
{
|
{
|
||||||
if (m_hasErrors && errors.isEmpty())
|
if (m_hasErrors && errors.isEmpty())
|
||||||
|
@@ -35,6 +35,7 @@ namespace QmlDesigner {
|
|||||||
class ItemLibraryWidget;
|
class ItemLibraryWidget;
|
||||||
class ImportManagerView;
|
class ImportManagerView;
|
||||||
class ImageCacheData;
|
class ImageCacheData;
|
||||||
|
class ImageCache;
|
||||||
|
|
||||||
class ItemLibraryView : public AbstractView
|
class ItemLibraryView : public AbstractView
|
||||||
{
|
{
|
||||||
@@ -55,6 +56,8 @@ public:
|
|||||||
|
|
||||||
void setResourcePath(const QString &resourcePath);
|
void setResourcePath(const QString &resourcePath);
|
||||||
|
|
||||||
|
ImageCache &imageCache();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateImports();
|
void updateImports();
|
||||||
|
|
||||||
|
@@ -25,22 +25,20 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <utils/smallstring.h>
|
#include "imagecacheinterface.h"
|
||||||
|
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include <QImage>
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class TimeStampProviderInterface;
|
class TimeStampProviderInterface;
|
||||||
class ImageCacheStorageInterface;
|
class ImageCacheStorageInterface;
|
||||||
class ImageCacheGeneratorInterface;
|
class ImageCacheGeneratorInterface;
|
||||||
|
|
||||||
class ImageCache
|
class ImageCache final : public ImageCacheInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using CaptureCallback = std::function<void(const QImage &)>;
|
using CaptureCallback = std::function<void(const QImage &)>;
|
||||||
@@ -55,11 +53,11 @@ public:
|
|||||||
void requestImage(Utils::PathString name,
|
void requestImage(Utils::PathString name,
|
||||||
CaptureCallback captureCallback,
|
CaptureCallback captureCallback,
|
||||||
AbortCallback abortCallback,
|
AbortCallback abortCallback,
|
||||||
Utils::SmallString state = {});
|
Utils::SmallString state = {}) override;
|
||||||
void requestIcon(Utils::PathString name,
|
void requestIcon(Utils::PathString name,
|
||||||
CaptureCallback captureCallback,
|
CaptureCallback captureCallback,
|
||||||
AbortCallback abortCallback,
|
AbortCallback abortCallback,
|
||||||
Utils::SmallString state = {});
|
Utils::SmallString state = {}) override;
|
||||||
|
|
||||||
void clean();
|
void clean();
|
||||||
void waitForFinished();
|
void waitForFinished();
|
||||||
|
@@ -0,0 +1,57 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <utils/smallstring.h>
|
||||||
|
|
||||||
|
#include <QImage>
|
||||||
|
|
||||||
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
class ImageCacheInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using CaptureCallback = std::function<void(const QImage &)>;
|
||||||
|
using AbortCallback = std::function<void()>;
|
||||||
|
|
||||||
|
virtual void requestImage(Utils::PathString name,
|
||||||
|
CaptureCallback captureCallback,
|
||||||
|
AbortCallback abortCallback,
|
||||||
|
Utils::SmallString state = {})
|
||||||
|
= 0;
|
||||||
|
virtual void requestIcon(Utils::PathString name,
|
||||||
|
CaptureCallback captureCallback,
|
||||||
|
AbortCallback abortCallback,
|
||||||
|
Utils::SmallString state = {})
|
||||||
|
= 0;
|
||||||
|
|
||||||
|
void clean();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
~ImageCacheInterface() = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace QmlDesigner
|
@@ -47,6 +47,7 @@ class Edit3DView;
|
|||||||
namespace Internal { class DesignModeWidget; }
|
namespace Internal { class DesignModeWidget; }
|
||||||
|
|
||||||
class ViewManagerData;
|
class ViewManagerData;
|
||||||
|
class ImageCache;
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT ViewManager
|
class QMLDESIGNERCORE_EXPORT ViewManager
|
||||||
{
|
{
|
||||||
@@ -103,6 +104,8 @@ public:
|
|||||||
void disableStandardViews();
|
void disableStandardViews();
|
||||||
void enableStandardViews();
|
void enableStandardViews();
|
||||||
|
|
||||||
|
ImageCache &imageCache();
|
||||||
|
|
||||||
private: // functions
|
private: // functions
|
||||||
Q_DISABLE_COPY(ViewManager)
|
Q_DISABLE_COPY(ViewManager)
|
||||||
|
|
||||||
|
@@ -453,6 +453,11 @@ void ViewManager::enableStandardViews()
|
|||||||
attachViewsExceptRewriterAndComponetView();
|
attachViewsExceptRewriterAndComponetView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImageCache &ViewManager::imageCache()
|
||||||
|
{
|
||||||
|
return d->itemLibraryView.imageCache();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|
||||||
#endif //QMLDESIGNER_TEST
|
#endif //QMLDESIGNER_TEST
|
||||||
|
@@ -561,6 +561,11 @@ void QmlDesignerPlugin::emitUsageStatisticsContextAction(const QString &identifi
|
|||||||
emitUsageStatistics(Constants::EVENT_ACTION_EXECUTED + identifier);
|
emitUsageStatistics(Constants::EVENT_ACTION_EXECUTED + identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImageCache &QmlDesignerPlugin::imageCache()
|
||||||
|
{
|
||||||
|
return m_instance->d->viewManager.imageCache();
|
||||||
|
}
|
||||||
|
|
||||||
QmlDesignerPlugin *QmlDesignerPlugin::instance()
|
QmlDesignerPlugin *QmlDesignerPlugin::instance()
|
||||||
{
|
{
|
||||||
return m_instance;
|
return m_instance;
|
||||||
|
@@ -42,6 +42,7 @@ namespace Core {
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class QmlDesignerPluginPrivate;
|
class QmlDesignerPluginPrivate;
|
||||||
|
class ImageCache;
|
||||||
|
|
||||||
namespace Internal { class DesignModeWidget; }
|
namespace Internal { class DesignModeWidget; }
|
||||||
|
|
||||||
@@ -85,6 +86,8 @@ public:
|
|||||||
static void emitUsageStatistics(const QString &identifier);
|
static void emitUsageStatistics(const QString &identifier);
|
||||||
static void emitUsageStatisticsContextAction(const QString &identifier);
|
static void emitUsageStatisticsContextAction(const QString &identifier);
|
||||||
|
|
||||||
|
static ImageCache &imageCache();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void usageStatisticsNotifier(const QString &identifier);
|
void usageStatisticsNotifier(const QString &identifier);
|
||||||
|
|
||||||
|
@@ -413,6 +413,7 @@ Project {
|
|||||||
"pluginmanager/widgetpluginpath.cpp",
|
"pluginmanager/widgetpluginpath.cpp",
|
||||||
"pluginmanager/widgetpluginpath.h",
|
"pluginmanager/widgetpluginpath.h",
|
||||||
"include/imagecache.h",
|
"include/imagecache.h",
|
||||||
|
"include/imagecacheinterface.h",
|
||||||
"imagecache/imagecachecollector.cpp",
|
"imagecache/imagecachecollector.cpp",
|
||||||
"imagecache/imagecachecollector.h",
|
"imagecache/imagecachecollector.h",
|
||||||
"imagecache/imagecache.cpp",
|
"imagecache/imagecache.cpp",
|
||||||
|
@@ -43,6 +43,7 @@ HEADERS += \
|
|||||||
$$PWD/designercore/imagecache/imagecachegeneratorinterface.h \
|
$$PWD/designercore/imagecache/imagecachegeneratorinterface.h \
|
||||||
$$PWD/designercore/imagecache/timestampproviderinterface.h \
|
$$PWD/designercore/imagecache/timestampproviderinterface.h \
|
||||||
$$PWD/designercore/include/imagecache.h \
|
$$PWD/designercore/include/imagecache.h \
|
||||||
|
$$PWD/designercore/include/imagecacheinterface.h \
|
||||||
$$PWD/designercore/include/modelnode.h \
|
$$PWD/designercore/include/modelnode.h \
|
||||||
$$PWD/designercore/include/model.h \
|
$$PWD/designercore/include/model.h \
|
||||||
$$PWD/../../../share/qtcreator/qml/qmlpuppet/interfaces/commondefines.h \
|
$$PWD/../../../share/qtcreator/qml/qmlpuppet/interfaces/commondefines.h \
|
||||||
|
@@ -397,6 +397,7 @@ extend_qtc_test(unittest
|
|||||||
model/variantproperty.cpp include/variantproperty.h
|
model/variantproperty.cpp include/variantproperty.h
|
||||||
rewritertransaction.cpp rewritertransaction.h
|
rewritertransaction.cpp rewritertransaction.h
|
||||||
imagecache/imagecache.cpp include/imagecache.h
|
imagecache/imagecache.cpp include/imagecache.h
|
||||||
|
include/imagecacheinterface.h
|
||||||
imagecache/imagecachecollectorinterface.h
|
imagecache/imagecachecollectorinterface.h
|
||||||
imagecache/imagecachegenerator.cpp imagecache/imagecachegenerator.h
|
imagecache/imagecachegenerator.cpp imagecache/imagecachegenerator.h
|
||||||
imagecache/imagecachegeneratorinterface.h
|
imagecache/imagecachegeneratorinterface.h
|
||||||
|
Reference in New Issue
Block a user