ICF 3.1.1.10
Technical documentation of ICF Libraries
CRenderedObjectFileLoaderComp.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9// STL includes
10#include <map>
11
12// Qt includes
13#include <QtCore/QDateTime>
14
15// ICF includes
16#include <iser/ISerializable.h>
19#include <iimg/CBitmap.h>
20#include <iproc/IProcessor.h>
21
22
23namespace iipr
24{
25
26
29 virtual public ifile::IFilePersistence,
30 virtual public iser::ISerializable
31{
32public:
34
35 I_BEGIN_COMPONENT(CRenderedObjectFileLoaderComp);
36 I_REGISTER_INTERFACE(istd::IChangeable);
37 I_REGISTER_INTERFACE(ifile::IFilePersistence);
38 I_REGISTER_INTERFACE(iser::ISerializable);
39 I_ASSIGN_MULTI_0(m_fileLoadersCompPtr, "FileLoaders", "List of the supported file loaders, which will be used to open the input file", true);
40 I_ASSIGN_MULTI_0(m_dataObjectFactCompPtr, "DataObjectFactories", "List of factories used for creation of preview's data model", true);
41 I_ASSIGN_MULTI_0(m_previewGenerationProcessorsCompPtr, "PreviewGenerationProcessors", "Processor used for generation of the preview bitmap", true);
42 I_ASSIGN(m_widthAttrPtr, "BitmapWidth", "Width of the generated preview bitmap", true, 128);
43 I_ASSIGN(m_heightAttrPtr, "BitmapHeight", "Height of the generated preview bitmap", true, 128);
44 I_ASSIGN(m_maxCacheSizeAttrPtr, "MaxCacheSize", "Maximal number of bitmaps in cache", false, 100);
45 I_ASSIGN(m_useTempFileAttrPtr, "UseTempFile", "If enabled, the temporary copy of the input file will be created and used for rendering", true, true);
46 I_END_COMPONENT;
47
48 // reimplemented (ifile::IFilePersistence)
50 const istd::IChangeable* dataObjectPtr,
51 const QString* filePathPtr = nullptr,
52 int flags = -1,
53 bool beQuiet = true) const override;
56 const QString& filePath = QString(),
57 iproc::IProgressManager* progressManagerPtr = nullptr) const override;
59 const istd::IChangeable& data,
60 const QString& filePath = QString(),
61 iproc::IProgressManager* progressManagerPtr = nullptr) const override;
62
63 // reimplemented (ifile::IFileTypeInfo)
64 bool GetFileExtensions(QStringList& result, const istd::IChangeable* dataObjectPtr = nullptr, int flags = -1, bool doAppend = false) const override;
65 QString GetTypeDescription(const QString* extensionPtr = nullptr) const override;
66
67 // reimplemented (iser::ISerializable)
68 bool Serialize(iser::IArchive& archive) override;
69
70protected:
77
78 const Configuration* GetConfigForFile(const QString& filePath) const;
79
80 // reimplemented (icomp::CComponentBase)
81 void OnComponentCreated() override;
82
83private:
84 I_MULTIREF(ifile::IFilePersistence, m_fileLoadersCompPtr);
85 I_MULTIFACT(istd::IChangeable, m_dataObjectFactCompPtr);
86 I_MULTIREF(iproc::IProcessor, m_previewGenerationProcessorsCompPtr);
87 I_ATTR(int, m_widthAttrPtr);
88 I_ATTR(int, m_heightAttrPtr);
89 I_ATTR(int, m_maxCacheSizeAttrPtr);
90 I_ATTR(bool, m_useTempFileAttrPtr);
91
92 struct FileInfo
93 {
94 QDateTime fileTimeStamp;
95 std::unique_ptr<iimg::CBitmap> fileBitmapPtr;
96 };
97
98 mutable std::map<QString, FileInfo> m_previewCache;
99
100 std::list<Configuration> m_workingConfigurations;
101};
102
103
104} // namespace iipr
105
106
Base class for component implementation.
Interface providing loading and saving of data objects.
virtual iproc::CTaskState SaveToFile(const istd::IChangeable &data, const QString &filePath=QString(), iproc::IProgressManager *progressManagerPtr=nullptr) const override
This function saves data data to file filePath.
bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
virtual bool IsOperationSupported(const istd::IChangeable *dataObjectPtr, const QString *filePathPtr=nullptr, int flags=-1, bool beQuiet=true) const override
Returns true if object dataObject can be loaded/saved.
virtual iproc::CTaskState LoadFromFile(istd::IChangeable &data, const QString &filePath=QString(), iproc::IProgressManager *progressManagerPtr=nullptr) const override
This function loads data data from file filePath.
const Configuration * GetConfigForFile(const QString &filePath) const
QString GetTypeDescription(const QString *extensionPtr=nullptr) const override
Get description of object type associated with single extension.
bool GetFileExtensions(QStringList &result, const istd::IChangeable *dataObjectPtr=nullptr, int flags=-1, bool doAppend=false) const override
Get file extensions supported by this loader.
Represent state of asynchronous operation.
Definition CTaskState.h:28
Interface for all synchrone and asynchrone processors with "push data" model.
Definition IProcessor.h:26
Consume information about progress of some process.
Represent input/output persistence archive.
Definition IArchive.h:34
Common class for all classes which objects can be archived or restored from archive.
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
Contains the image processing classes.

© Witold Gantzke and Kirill Lepskiy