mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +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:
|
||||
int metric(PaintDeviceMetric) const;
|
||||
|
||||
|
||||
private:
|
||||
QExplicitlySharedDataPointer<QPixmapData> data;
|
||||
|
||||
|
|
|
@ -611,12 +611,8 @@ static QList<T> findChildrenHelper(const QObject *o)
|
|||
return result;
|
||||
}
|
||||
|
||||
//pre4.3 tests the format that was used before 4.3
|
||||
bool QMainWindowLayoutState::checkFormat(QDataStream &stream, bool pre43)
|
||||
bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
|
||||
{
|
||||
#ifdef QT_NO_TOOLBAR
|
||||
Q_UNUSED(pre43);
|
||||
#endif
|
||||
while (!stream.atEnd()) {
|
||||
uchar marker;
|
||||
stream >> marker;
|
||||
|
@ -628,7 +624,7 @@ bool QMainWindowLayoutState::checkFormat(QDataStream &stream, bool pre43)
|
|||
{
|
||||
QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);
|
||||
if (!toolBarAreaLayout.restoreState(stream, toolBars, marker,
|
||||
pre43 /*testing 4.3 format*/, true /*testing*/)) {
|
||||
true /*testing*/)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -669,14 +665,9 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
|
|||
}
|
||||
|
||||
QDataStream ds(copy);
|
||||
const bool oldFormat = !checkFormat(ds, false);
|
||||
if (oldFormat) {
|
||||
//we should try with the old format
|
||||
QDataStream ds2(copy);
|
||||
if (!checkFormat(ds2, true)) {
|
||||
if (!checkFormat(ds)) {
|
||||
return false; //format unknown
|
||||
}
|
||||
}
|
||||
|
||||
QDataStream stream(copy);
|
||||
|
||||
|
@ -716,7 +707,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
|
|||
case QToolBarAreaLayout::ToolBarStateMarkerEx:
|
||||
{
|
||||
QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);
|
||||
if (!toolBarAreaLayout.restoreState(stream, toolBars, marker, oldFormat))
|
||||
if (!toolBarAreaLayout.restoreState(stream, toolBars, marker))
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < toolBars.size(); ++i) {
|
||||
|
@ -1474,7 +1465,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
|
|||
#ifndef QT_NO_TOOLBAR
|
||||
if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
|
||||
QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(tb->layout());
|
||||
if (tbl->animating) {
|
||||
if (tbl && tbl->animating) {
|
||||
tbl->animating = false;
|
||||
if (tbl->expanded)
|
||||
tbl->layoutActions(tb->size());
|
||||
|
@ -1503,7 +1494,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
|
|||
|
||||
#ifndef QT_NO_DOCKWIDGET
|
||||
#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
|
||||
// animating but before the animationFinished signal is received.
|
||||
if (QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget))
|
||||
|
|
|
@ -138,7 +138,7 @@ public:
|
|||
QLayoutItem *unplug(const QList<int> &path, QMainWindowLayoutState *savedState = 0);
|
||||
|
||||
void saveState(QDataStream &stream) const;
|
||||
bool checkFormat(QDataStream &stream, bool pre43);
|
||||
bool checkFormat(QDataStream &stream);
|
||||
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) {
|
||||
QPoint p;
|
||||
stream >> p;
|
||||
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;
|
||||
int lines;
|
||||
|
@ -1330,8 +1324,8 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*
|
|||
stream >> objectName;
|
||||
uchar shown;
|
||||
stream >> shown;
|
||||
item.pos = getInt(stream, dock.o, pre43);
|
||||
item.size = getInt(stream, dock.o, pre43);
|
||||
item.pos = getInt(stream);
|
||||
item.size = getInt(stream);
|
||||
|
||||
/*
|
||||
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;
|
||||
bool floating = false;
|
||||
uint geom0, geom1;
|
||||
geom0 = getInt(stream, dock.o, pre43);
|
||||
geom0 = getInt(stream);
|
||||
if (tmarker == ToolBarStateMarkerEx) {
|
||||
geom1 = getInt(stream, dock.o, pre43);
|
||||
geom1 = getInt(stream);
|
||||
rect = unpackRect(geom0, geom1, &floating);
|
||||
}
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ public:
|
|||
QLayoutItem *unplug(const QList<int> &path, QToolBarAreaLayout *other);
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue