mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
remove pre 4.3 layout restoration code
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
d07f9949ba
commit
faa778989e
5 changed files with 18 additions and 34 deletions
|
@ -175,7 +175,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
int metric(PaintDeviceMetric) const;
|
int metric(PaintDeviceMetric) const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QExplicitlySharedDataPointer<QPixmapData> data;
|
QExplicitlySharedDataPointer<QPixmapData> data;
|
||||||
|
|
||||||
|
|
|
@ -611,12 +611,8 @@ static QList<T> findChildrenHelper(const QObject *o)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//pre4.3 tests the format that was used before 4.3
|
bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
|
||||||
bool QMainWindowLayoutState::checkFormat(QDataStream &stream, bool pre43)
|
|
||||||
{
|
{
|
||||||
#ifdef QT_NO_TOOLBAR
|
|
||||||
Q_UNUSED(pre43);
|
|
||||||
#endif
|
|
||||||
while (!stream.atEnd()) {
|
while (!stream.atEnd()) {
|
||||||
uchar marker;
|
uchar marker;
|
||||||
stream >> marker;
|
stream >> marker;
|
||||||
|
@ -628,7 +624,7 @@ bool QMainWindowLayoutState::checkFormat(QDataStream &stream, bool pre43)
|
||||||
{
|
{
|
||||||
QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);
|
QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);
|
||||||
if (!toolBarAreaLayout.restoreState(stream, toolBars, marker,
|
if (!toolBarAreaLayout.restoreState(stream, toolBars, marker,
|
||||||
pre43 /*testing 4.3 format*/, true /*testing*/)) {
|
true /*testing*/)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -669,13 +665,8 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream ds(copy);
|
QDataStream ds(copy);
|
||||||
const bool oldFormat = !checkFormat(ds, false);
|
if (!checkFormat(ds)) {
|
||||||
if (oldFormat) {
|
return false; //format unknown
|
||||||
//we should try with the old format
|
|
||||||
QDataStream ds2(copy);
|
|
||||||
if (!checkFormat(ds2, true)) {
|
|
||||||
return false; //format unknown
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream stream(copy);
|
QDataStream stream(copy);
|
||||||
|
@ -716,7 +707,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
|
||||||
case QToolBarAreaLayout::ToolBarStateMarkerEx:
|
case QToolBarAreaLayout::ToolBarStateMarkerEx:
|
||||||
{
|
{
|
||||||
QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);
|
QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);
|
||||||
if (!toolBarAreaLayout.restoreState(stream, toolBars, marker, oldFormat))
|
if (!toolBarAreaLayout.restoreState(stream, toolBars, marker))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (int i = 0; i < toolBars.size(); ++i) {
|
for (int i = 0; i < toolBars.size(); ++i) {
|
||||||
|
@ -1474,7 +1465,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
|
||||||
#ifndef QT_NO_TOOLBAR
|
#ifndef QT_NO_TOOLBAR
|
||||||
if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
|
if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
|
||||||
QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(tb->layout());
|
QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(tb->layout());
|
||||||
if (tbl->animating) {
|
if (tbl && tbl->animating) {
|
||||||
tbl->animating = false;
|
tbl->animating = false;
|
||||||
if (tbl->expanded)
|
if (tbl->expanded)
|
||||||
tbl->layoutActions(tb->size());
|
tbl->layoutActions(tb->size());
|
||||||
|
@ -1503,7 +1494,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
|
||||||
|
|
||||||
#ifndef QT_NO_DOCKWIDGET
|
#ifndef QT_NO_DOCKWIDGET
|
||||||
#ifndef QT_NO_TABBAR
|
#ifndef QT_NO_TABBAR
|
||||||
if (qobject_cast<QDockWidget*>(widget) != 0) {
|
if (qobject_cast<QDockWidget*>(widget)) {
|
||||||
// info() might return null if the widget is destroyed while
|
// info() might return null if the widget is destroyed while
|
||||||
// animating but before the animationFinished signal is received.
|
// animating but before the animationFinished signal is received.
|
||||||
if (QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget))
|
if (QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget))
|
||||||
|
|
|
@ -138,7 +138,7 @@ public:
|
||||||
QLayoutItem *unplug(const QList<int> &path, QMainWindowLayoutState *savedState = 0);
|
QLayoutItem *unplug(const QList<int> &path, QMainWindowLayoutState *savedState = 0);
|
||||||
|
|
||||||
void saveState(QDataStream &stream) const;
|
void saveState(QDataStream &stream) const;
|
||||||
bool checkFormat(QDataStream &stream, bool pre43);
|
bool checkFormat(QDataStream &stream);
|
||||||
bool restoreState(QDataStream &stream, const QMainWindowLayoutState &oldState);
|
bool restoreState(QDataStream &stream, const QMainWindowLayoutState &oldState);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1291,21 +1291,15 @@ void QToolBarAreaLayout::saveState(QDataStream &stream) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int getInt(QDataStream &stream, Qt::Orientation o, bool pre43)
|
static inline int getInt(QDataStream &stream)
|
||||||
{
|
{
|
||||||
if (pre43) {
|
int x;
|
||||||
QPoint p;
|
stream >> x;
|
||||||
stream >> p;
|
return x;
|
||||||
return pick(o, p);
|
|
||||||
} else {
|
|
||||||
int x;
|
|
||||||
stream >> x;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*> &_toolBars, uchar tmarker, bool pre43, bool testing)
|
bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*> &_toolBars, uchar tmarker, bool testing)
|
||||||
{
|
{
|
||||||
QList<QToolBar*> toolBars = _toolBars;
|
QList<QToolBar*> toolBars = _toolBars;
|
||||||
int lines;
|
int lines;
|
||||||
|
@ -1330,8 +1324,8 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*
|
||||||
stream >> objectName;
|
stream >> objectName;
|
||||||
uchar shown;
|
uchar shown;
|
||||||
stream >> shown;
|
stream >> shown;
|
||||||
item.pos = getInt(stream, dock.o, pre43);
|
item.pos = getInt(stream);
|
||||||
item.size = getInt(stream, dock.o, pre43);
|
item.size = getInt(stream);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
4.3.0 added floating toolbars, but failed to add the ability to restore them.
|
4.3.0 added floating toolbars, but failed to add the ability to restore them.
|
||||||
|
@ -1344,9 +1338,9 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*
|
||||||
QRect rect;
|
QRect rect;
|
||||||
bool floating = false;
|
bool floating = false;
|
||||||
uint geom0, geom1;
|
uint geom0, geom1;
|
||||||
geom0 = getInt(stream, dock.o, pre43);
|
geom0 = getInt(stream);
|
||||||
if (tmarker == ToolBarStateMarkerEx) {
|
if (tmarker == ToolBarStateMarkerEx) {
|
||||||
geom1 = getInt(stream, dock.o, pre43);
|
geom1 = getInt(stream);
|
||||||
rect = unpackRect(geom0, geom1, &floating);
|
rect = unpackRect(geom0, geom1, &floating);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -238,7 +238,7 @@ public:
|
||||||
QLayoutItem *unplug(const QList<int> &path, QToolBarAreaLayout *other);
|
QLayoutItem *unplug(const QList<int> &path, QToolBarAreaLayout *other);
|
||||||
|
|
||||||
void saveState(QDataStream &stream) const;
|
void saveState(QDataStream &stream) const;
|
||||||
bool restoreState(QDataStream &stream, const QList<QToolBar*> &toolBars, uchar tmarker, bool pre43, bool testing = false);
|
bool restoreState(QDataStream &stream, const QList<QToolBar*> &toolBars, uchar tmarker, bool testing = false);
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue