[PC-BSD Commits] r2137 - pcbsd/trunk/XGUISource

svn at pcbsd.org svn at pcbsd.org
Fri Jun 20 06:40:18 PDT 2008


Author: kris
Date: 2008-06-20 06:40:17 -0700 (Fri, 20 Jun 2008)
New Revision: 2137

Modified:
   pcbsd/trunk/XGUISource/main.cpp
Log:

Fixed the XGUI to set the right font, and center itself on the desktop properly



Modified: pcbsd/trunk/XGUISource/main.cpp
===================================================================
--- pcbsd/trunk/XGUISource/main.cpp	2008-06-20 03:09:04 UTC (rev 2136)
+++ pcbsd/trunk/XGUISource/main.cpp	2008-06-20 13:40:17 UTC (rev 2137)
@@ -35,7 +35,21 @@
 
     KApplication a;
 
+    QString nlang = QTextCodec::locale();
+    // Check the language we are running in, and set the correct font
+    if (  nlang == "zh_CN" ||  nlang == "zh_TW" )
+    {
+      QFont f( "mingunittf", 10);
+      a.setFont( f);
+    } else if ( nlang == "ja" ) {
+      QFont f( "vlgothic", 10);
+      a.setFont( f);
+    } else {
+      QFont f( "Dejavu", 12);
+      a.setFont( f);
+    }
 
+
     
     QString Tmp = a.argv()[1];
   
@@ -65,15 +79,14 @@
 
     XGUI w;
 
-    QDesktopWidget *desk = QApplication::desktop();
-    int wid = desk->width();     // returns desktop width
-    int hig = desk->height();    // returns desktop height
+    QDesktopWidget *desk = a.desktop();
+    QRect dimensions = desk->screenGeometry();
+    int wid = dimensions.width();     // returns desktop width
+    int hig = dimensions.height();    // returns desktop height
     w.setGeometry((wid/2) - (564/2), (hig/2) - (461/2), 564, 461);
 
     w.ProgramInit();
 
-
-    w.setStyle(QStyleFactory::create( "Plastik" ));
     w.show();
     a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
     return a.exec();



More information about the Commits mailing list