Author: sh-sh-sh
Date: Mon Sep 3 18:19:54 2007
New Revision: 40741
URL: http://svn.opensuse.org/viewcvs/yast?rev=40741&view=rev
Log:
limit to screen size for ps3
Modified:
branches/tmp/sh/mod-ui/qt/src/QY2LayoutUtils.cc
branches/tmp/sh/mod-ui/qt/src/QY2LayoutUtils.h
branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgChangesDialog.cc
branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgConflictDialog.cc
branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgTextDialog.cc
Modified: branches/tmp/sh/mod-ui/qt/src/QY2LayoutUtils.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/QY2LayoutUtils.cc?rev=40741&r1=40740&r2=40741&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/QY2LayoutUtils.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/QY2LayoutUtils.cc Mon Sep 3 18:19:54 2007
@@ -19,6 +19,7 @@
/-*/
+#include
#include
#include "QY2LayoutUtils.h"
@@ -60,3 +61,26 @@
return spacer;
}
+
+QSize
+limitToScreenSize( const QWidget * widget, int width, int height )
+{
+ return limitToScreenSize( widget, QSize( width, height ) );
+}
+
+
+QSize
+limitToScreenSize( const QWidget * widget, const QSize & desiredSize )
+{
+ QSize availableSize = qApp->desktop()->availableGeometry( const_cast (widget) ).size();
+
+ // Subtract WM decorations. There seems to be no reliable way to tell if
+ // this is necessary at all (even fvwm2 claims it is a NETWM compliant
+ // window manager) or how large the WM decorations are.
+ // For the purpose of this function, let's assume we have to subtract the
+ // common fvwm2 decoration size. This is simplistic and should be improved.
+ availableSize -= QSize( 10, 35 );
+
+ return desiredSize.boundedTo( availableSize );
+}
+
Modified: branches/tmp/sh/mod-ui/qt/src/QY2LayoutUtils.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/QY2LayoutUtils.h?rev=40741&r1=40740&r2=40741&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/QY2LayoutUtils.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/QY2LayoutUtils.h Mon Sep 3 18:19:54 2007
@@ -45,5 +45,10 @@
**/
QWidget * addHSpacing( QWidget * parent, int width = 8 );
+/**
+ * Limit a QSize to what is available on the same screen as 'widget'.
+ **/
+QSize limitToScreenSize( const QWidget * widget, const QSize & desiredSize );
+QSize limitToScreenSize( const QWidget * widget, int width, int height );
#endif // ifndef QY2LayoutUtils_h
Modified: branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgChangesDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgChangesDialog.cc?rev=40741&r1=40740&r2=40741&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgChangesDialog.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgChangesDialog.cc Mon Sep 3 18:19:54 2007
@@ -194,11 +194,7 @@
QSize
YQPkgChangesDialog::sizeHint() const
{
- QRect available = qApp->desktop()->availableGeometry( (QWidget *) this );
- QSize size = QDialog::sizeHint();
- size = size.boundedTo( QSize( available.width(), available.height() ) );
-
- return size;
+ return limitToScreenSize( this, QDialog::sizeHint() );
}
Modified: branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgConflictDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgConflictDialog.cc?rev=40741&r1=40740&r2=40741&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgConflictDialog.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgConflictDialog.cc Mon Sep 3 18:19:54 2007
@@ -207,11 +207,7 @@
QSize
YQPkgConflictDialog::sizeHint() const
{
- QSize size( 550, 450 );
- QRect available = qApp->desktop()->availableGeometry( (QWidget *) this );
- size = size.boundedTo( QSize( available.width(), available.height() ) );
-
- return size;
+ return limitToScreenSize( this, 550, 450 );
}
Modified: branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgTextDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgTextDialog.cc?rev=40741&r1=40740&r2=40741&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgTextDialog.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/pkg/YQPkgTextDialog.cc Mon Sep 3 18:19:54 2007
@@ -131,13 +131,15 @@
{
_rejectButton = 0;
}
+
+ updateGeometry();
}
QSize
YQPkgTextDialog::sizeHint() const
{
- return QSize( 500, 450 );
+ return limitToScreenSize( this, 500, 450 );
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org