[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kcontrol/kcontrol
From:       Waldo Bastian <bastian () kde ! org>
Date:       2005-02-20 16:20:12
Message-ID: 20050220162012.E374B1BBEC () office ! kde ! org
[Download RAW message or body]

CVS commit by waba: 

Make initial size dependant on dpi / font size.


  M +14 -2     main.cpp   1.62


--- kdebase/kcontrol/kcontrol/main.cpp  #1.61:1.62
@@ -33,4 +33,6 @@
  */
 
+#include <qpaintdevicemetrics.h>
+
 #include <kcmdlineargs.h>
 #include <dcopclient.h>
@@ -65,8 +67,18 @@ KControlApp::KControlApp()
   KConfig *config = KGlobal::config();
   config->setGroup("General");
+  // Initial size is:
+  // never bigger than workspace as reported by desk
+  // 940x700 on 96 dpi, 12 pt font
+  // 800x600 on 72 dpi, 12 pt font
+  // --> 368 + 6 x dpiX, 312 + 4 x dpiY
+  // Adjusted for font size
+  QPaintDeviceMetrics pdm(toplevel);
+  int fontSize = toplevel->fontInfo().pointSize();
+  if (fontSize == 0)
+    fontSize = (toplevel->fontInfo().pixelSize() * 72) / pdm.logicalDpiX();
   int x = config->readNumEntry(QString::fromLatin1("InitialWidth %1").arg(desk.width()), 
-                               QMIN( desk.width() * 3/4 , 800 ) );
+                               QMIN( desk.width(), 368 + (6*pdm.logicalDpiX()*fontSize)/12 ) );
   int y = config->readNumEntry(QString::fromLatin1("InitialHeight %1").arg(desk.height()), 
-                               QMIN( desk.height() * 3/4 , 600 ) );
+                               QMIN( desk.height(), 312 + (4*pdm.logicalDpiX()*fontSize)/12 ) );
   toplevel->resize(x,y);
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic