Those extra patches fixes the resize and the flickering issues.

On Tue, Feb 10, 2015 at 1:40 PM, Tomaz Canabrava <[email protected]> wrote:

>
>
> On Tue, Feb 10, 2015 at 1:21 PM, Dirk Hohndel <[email protected]> wrote:
>
>> On Tue, Feb 10, 2015 at 12:36:34PM -0200, Tomaz Canabrava wrote:
>> > There are obvious bugs that i'm working on.
>> > most notably, it forgets the size of the widgets.
>>
>> So do these get us back to a "mostly working" state? I don't want master
>> to be completely unusable...
>>
>
> not completely.
>
>
>>
>> /D
>>
>>
>
From 48902fde938de07cf8e24404b1527b87585d0ba6 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 10 Feb 2015 15:18:05 -0200
Subject: [PATCH 19/21] Save the size of the widgets to restore it later.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/mainwindow.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 42027aa..ed59d47 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1503,6 +1503,8 @@ void MainWindow::setApplicationState(const QByteArray& state) {
 	if (!applicationState.keys().contains(state))
 		return;
 
+	QList<int> topSize = ui.topSplitter->sizes();
+	QList<int> bottomSize = ui.bottomSplitter->sizes();
 	// yes, index is zero both times. please don't change it.
 	if (ui.topSplitter->count() >= 2) {
 		ui.topSplitter->widget(0)->setParent(NULL);
@@ -1518,4 +1520,6 @@ void MainWindow::setApplicationState(const QByteArray& state) {
 	ui.topSplitter->addWidget(curr.topRight);
 	ui.bottomSplitter->addWidget(curr.bottomLeft);
 	ui.bottomSplitter->addWidget(curr.bottomRight);
+	ui.topSplitter->setSizes(topSize);
+	ui.bottomSplitter->setSizes(bottomSize);
 }
-- 
2.3.0

From e1b059723095dd6ae6f1d60e68cd63ae668dbb37 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 10 Feb 2015 15:22:14 -0200
Subject: [PATCH 20/21] Don't set the state if it's the same

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/mainwindow.cpp | 5 +++++
 qt-ui/mainwindow.h   | 1 +
 2 files changed, 6 insertions(+)

diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index ed59d47..e7e0bf0 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1503,8 +1503,13 @@ void MainWindow::setApplicationState(const QByteArray& state) {
 	if (!applicationState.keys().contains(state))
 		return;
 
+	if (currentApplicationState == state)
+		return;
+
+	currentApplicationState = state;
 	QList<int> topSize = ui.topSplitter->sizes();
 	QList<int> bottomSize = ui.bottomSplitter->sizes();
+
 	// yes, index is zero both times. please don't change it.
 	if (ui.topSplitter->count() >= 2) {
 		ui.topSplitter->widget(0)->setParent(NULL);
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index a4eed1b..f3d07fd 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -221,6 +221,7 @@ private:
 		QWidget *bottomRight;
 	};
 	QHash<QByteArray, WidgetForBorder> applicationState;
+	QByteArray currentApplicationState;
 };
 
 #endif // MAINWINDOW_H
-- 
2.3.0

From 5ff7689f77757536577593cc6a4ec5916c62e7e5 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 10 Feb 2015 15:51:30 -0200
Subject: [PATCH 21/21] Remove the flickr issue and the resize issue.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/mainwindow.cpp | 36 ++++++++++++++++--------------------
 qt-ui/mainwindow.ui  | 10 +++++++---
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index e7e0bf0..25b2517 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1497,6 +1497,18 @@ void MainWindow::on_actionFilterTags_triggered()
 void MainWindow::registerApplicationState(const QByteArray& state, QWidget *topLeft, QWidget *bottomLeft, QWidget *topRight, QWidget *bottomRight)
 {
 	applicationState[state] = WidgetForBorder(topLeft, bottomLeft, topRight, bottomRight);
+	if (ui.topLeft->indexOf(topLeft) == -1) {
+		ui.topLeft->addWidget(topLeft);
+	}
+	if (ui.topRight->indexOf(topRight) == -1) {
+		ui.topRight->addWidget(topRight);
+	}
+	if (ui.bottomLeft->indexOf(bottomLeft) == -1) {
+		ui.bottomLeft->addWidget(bottomLeft);
+	}
+	if(ui.bottomRight->indexOf(bottomRight) == -1) {
+		ui.bottomRight->addWidget(bottomRight);
+	}
 }
 
 void MainWindow::setApplicationState(const QByteArray& state) {
@@ -1507,24 +1519,8 @@ void MainWindow::setApplicationState(const QByteArray& state) {
 		return;
 
 	currentApplicationState = state;
-	QList<int> topSize = ui.topSplitter->sizes();
-	QList<int> bottomSize = ui.bottomSplitter->sizes();
-
-	// yes, index is zero both times. please don't change it.
-	if (ui.topSplitter->count() >= 2) {
-		ui.topSplitter->widget(0)->setParent(NULL);
-		ui.topSplitter->widget(0)->setParent(NULL);
-	}
-	if (ui.bottomSplitter->count() >= 2) {
-		ui.bottomSplitter->widget(0)->setParent(NULL);
-		ui.bottomSplitter->widget(0)->setParent(NULL);
-	}
-
-	WidgetForBorder curr = applicationState[state];
-	ui.topSplitter->addWidget(curr.topLeft);
-	ui.topSplitter->addWidget(curr.topRight);
-	ui.bottomSplitter->addWidget(curr.bottomLeft);
-	ui.bottomSplitter->addWidget(curr.bottomRight);
-	ui.topSplitter->setSizes(topSize);
-	ui.bottomSplitter->setSizes(bottomSize);
+	ui.topLeft->setCurrentWidget( applicationState[state].topLeft);
+	ui.bottomLeft->setCurrentWidget( applicationState[state].bottomLeft);
+	ui.topRight->setCurrentWidget( applicationState[state].topRight);
+	ui.bottomRight->setCurrentWidget( applicationState[state].bottomRight);
 }
diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui
index e345c64..5d2e888 100644
--- a/qt-ui/mainwindow.ui
+++ b/qt-ui/mainwindow.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>1682</width>
-    <height>1151</height>
+    <width>861</width>
+    <height>800</height>
    </rect>
   </property>
   <widget class="QWidget" name="centralwidget">
@@ -27,11 +27,15 @@
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
+       <widget class="QStackedWidget" name="topLeft"/>
+       <widget class="QStackedWidget" name="topRight"/>
       </widget>
       <widget class="QSplitter" name="bottomSplitter">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
+       <widget class="QStackedWidget" name="bottomLeft"/>
+       <widget class="QStackedWidget" name="bottomRight"/>
       </widget>
      </widget>
     </item>
@@ -45,7 +49,7 @@
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>1682</width>
+     <width>861</width>
      <height>32</height>
     </rect>
    </property>
-- 
2.3.0

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to