mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-12 00:00:25 +08:00
Removed enum eXmlMode and added XmlAutoFormatting flag anc XmlCompressionEnabled flag to eConfigFlags. Added support for XML compression for the XML generated by the store function. If enabled then XML the generated XML is not human readable anymore but it needs less space when storing into settings file
This commit is contained in:
parent
e978a32a09
commit
c45327aafd
@ -336,8 +336,9 @@ void DockManagerPrivate::emitTopLevelEvents()
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool DockManagerPrivate::restoreState(const QByteArray &state, int version)
|
||||
bool DockManagerPrivate::restoreState(const QByteArray& State, int version)
|
||||
{
|
||||
QByteArray state = State.startsWith("<?xml") ? State : qUncompress(State);
|
||||
if (!checkFormat(state, version))
|
||||
{
|
||||
qDebug() << "checkFormat: Error checking format!!!!!!!";
|
||||
@ -489,11 +490,11 @@ unsigned int CDockManager::zOrderIndex() const
|
||||
|
||||
|
||||
//============================================================================
|
||||
QByteArray CDockManager::saveState(eXmlMode XmlMode, int version) const
|
||||
QByteArray CDockManager::saveState(int version) const
|
||||
{
|
||||
QByteArray xmldata;
|
||||
QXmlStreamWriter s(&xmldata);
|
||||
s.setAutoFormatting(XmlAutoFormattingEnabled == XmlMode);
|
||||
s.setAutoFormatting(d->ConfigFlags.testFlag(XmlAutoFormattingEnabled));
|
||||
s.writeStartDocument();
|
||||
s.writeStartElement("QtAdvancedDockingSystem");
|
||||
s.writeAttribute("Version", QString::number(version));
|
||||
@ -506,7 +507,7 @@ QByteArray CDockManager::saveState(eXmlMode XmlMode, int version) const
|
||||
s.writeEndElement();
|
||||
s.writeEndDocument();
|
||||
|
||||
return xmldata;
|
||||
return d->ConfigFlags.testFlag(XmlCompressionEnabled) ? qCompress(xmldata, 9) : xmldata;
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,7 +51,9 @@ struct DockWidgetTabPrivate;
|
||||
struct DockAreaWidgetPrivate;
|
||||
|
||||
/**
|
||||
* The central dock manager that maintains the complete docking system
|
||||
* The central dock manager that maintains the complete docking system.
|
||||
* With the configuration flags you can globally control the functionality
|
||||
* of the docking system.
|
||||
**/
|
||||
class ADS_EXPORT CDockManager : public CDockContainerWidget
|
||||
{
|
||||
@ -108,12 +110,6 @@ public:
|
||||
MenuAlphabeticallySorted
|
||||
};
|
||||
|
||||
enum eXmlMode
|
||||
{
|
||||
XmlAutoFormattingDisabled,
|
||||
XmlAutoFormattingEnabled
|
||||
};
|
||||
|
||||
/**
|
||||
* These global configuration flags configure some global dock manager
|
||||
* settings.
|
||||
@ -124,7 +120,9 @@ public:
|
||||
DockAreaHasCloseButton = 0x02, //!< If the flag is set each dock area has a close button
|
||||
DockAreaCloseButtonClosesTab = 0x04,//!< If the flag is set, the dock area close button closes the active tab, if not set, it closes the complete cock area
|
||||
OpaqueSplitterResize = 0x08, //!< See QSplitter::setOpaqueResize() documentation
|
||||
DefaultConfig = ActiveTabHasCloseButton | DockAreaHasCloseButton | OpaqueSplitterResize, ///< the default configuration
|
||||
XmlAutoFormattingEnabled = 0x10,//!< If enabled, the XML writer automatically adds line-breaks and indentation to empty sections between elements (ignorable whitespace).
|
||||
XmlCompressionEnabled = 0x20,//!< If enabled, the XML output will be compressed and is not human readable anymore
|
||||
DefaultConfig = ActiveTabHasCloseButton | DockAreaHasCloseButton | OpaqueSplitterResize | XmlCompressionEnabled, ///< the default configuration
|
||||
};
|
||||
Q_DECLARE_FLAGS(ConfigFlags, eConfigFlag)
|
||||
|
||||
@ -228,7 +226,7 @@ public:
|
||||
* The XmlMode XmlAutoFormattingDisabled is better if you would like to have
|
||||
* a more compact XML output - i.e. for storage in ini files.
|
||||
*/
|
||||
QByteArray saveState(eXmlMode XmlMode = XmlAutoFormattingDisabled, int version = 0) const;
|
||||
QByteArray saveState(int version = 0) const;
|
||||
|
||||
/**
|
||||
* Restores the state of this dockmanagers dockwidgets.
|
||||
|
Loading…
Reference in New Issue
Block a user