mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 21:25:44 +08:00
Merge branch 'version_fix' into focused_dockwidget
This commit is contained in:
commit
adb72737e8
@ -79,6 +79,16 @@ static void initResource()
|
||||
|
||||
namespace ads
|
||||
{
|
||||
/**
|
||||
* Internal file version in case the sturture changes interbally
|
||||
*/
|
||||
enum eStateFileVersion
|
||||
{
|
||||
InitialVersion = 0, //!< InitialVersion
|
||||
Version1 = 1, //!< Version1
|
||||
CurrentVersion = Version1//!< CurrentVersion
|
||||
};
|
||||
|
||||
static CDockManager::ConfigFlags StaticConfigFlags = CDockManager::DefaultNonOpaqueConfig;
|
||||
|
||||
/**
|
||||
@ -256,6 +266,13 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
|
||||
return false;
|
||||
}
|
||||
|
||||
ADS_PRINT(s.attributes().value("UserVersion"));
|
||||
v = s.attributes().value("UserVersion").toInt(&ok);
|
||||
if (!ok || v != version)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
s.setFileVersion(v);
|
||||
bool Result = true;
|
||||
#ifdef ADS_DEBUG_PRINT
|
||||
@ -643,7 +660,8 @@ QByteArray CDockManager::saveState(int version) const
|
||||
s.setAutoFormatting(ConfigFlags.testFlag(XmlAutoFormattingEnabled));
|
||||
s.writeStartDocument();
|
||||
s.writeStartElement("QtAdvancedDockingSystem");
|
||||
s.writeAttribute("Version", QString::number(version));
|
||||
s.writeAttribute("Version", QString::number(CurrentVersion));
|
||||
s.writeAttribute("UserVersion", QString::number(version));
|
||||
s.writeAttribute("Containers", QString::number(d->Containers.count()));
|
||||
for (auto Container : d->Containers)
|
||||
{
|
||||
|
@ -326,8 +326,12 @@ public:
|
||||
* If auto formatting is enabled, the output is intended and line wrapped.
|
||||
* The XmlMode XmlAutoFormattingDisabled is better if you would like to have
|
||||
* a more compact XML output - i.e. for storage in ini files.
|
||||
* The version number is stored as part of the data.
|
||||
* To restore the saved state, pass the return value and version number
|
||||
* to restoreState().
|
||||
* \see restoreState()
|
||||
*/
|
||||
QByteArray saveState(int version = Version1) const;
|
||||
QByteArray saveState(int version = 0) const;
|
||||
|
||||
/**
|
||||
* Restores the state of this dockmanagers dockwidgets.
|
||||
@ -335,8 +339,9 @@ public:
|
||||
* not match, the dockmanager's state is left unchanged, and this function
|
||||
* returns false; otherwise, the state is restored, and this function
|
||||
* returns true.
|
||||
* \see saveState()
|
||||
*/
|
||||
bool restoreState(const QByteArray &state, int version = Version1);
|
||||
bool restoreState(const QByteArray &state, int version = 0);
|
||||
|
||||
/**
|
||||
* Saves the current perspective to the internal list of perspectives.
|
||||
|
@ -64,13 +64,6 @@ QT_FORWARD_DECLARE_CLASS(QSplitter)
|
||||
|
||||
namespace ads
|
||||
{
|
||||
enum eStateFileVersion
|
||||
{
|
||||
InitialVersion = 0,
|
||||
Version1 = 1,
|
||||
CurrentVersion = Version1
|
||||
};
|
||||
|
||||
class CDockSplitter;
|
||||
|
||||
enum DockWidgetArea
|
||||
|
Loading…
Reference in New Issue
Block a user