[PC-BSD Commits] r5036 - pbibuild/pbi-source/PBCsource

svn at pcbsd.org svn at pcbsd.org
Tue Nov 17 07:21:53 PST 2009


Author: kris
Date: 2009-11-17 07:21:53 -0800 (Tue, 17 Nov 2009)
New Revision: 5036

Modified:
   pbibuild/pbi-source/PBCsource/main.cpp
   pbibuild/pbi-source/PBCsource/pbcwizard.cpp
   pbibuild/pbi-source/PBCsource/pbcwizard.h
Log:

Update PBC, updated how we do i18n, works much more reliably now



Modified: pbibuild/pbi-source/PBCsource/main.cpp
===================================================================
--- pbibuild/pbi-source/PBCsource/main.cpp	2009-11-17 14:51:19 UTC (rev 5035)
+++ pbibuild/pbi-source/PBCsource/main.cpp	2009-11-17 15:21:53 UTC (rev 5036)
@@ -5,6 +5,7 @@
 #include <qtextcodec.h>
 #include <qtranslator.h>
 #include <qfile.h>
+#include <QDebug>
 #include "pbcwizard.h"
 #include "exedialog.h"
 #include "mimedialog.h"
@@ -35,14 +36,38 @@
     
    KApplication a;
 
+   // Check what directory our app is in
+   QString appDir;
+   if ( QFile::exists("/Programs/share/PBICreator") )
+   {
+     appDir = "/Programs/share/PBICreator";
+   } else {
+     appDir = QCoreApplication::applicationDirPath();
+   }
+
+   // Check that we have the right app dir
+   if ( ! QFile::exists(appDir + "/createpbi.sh" ) )
+   {
+     qDebug() << "Bad AppDir:" << appDir;
+     exit(150);
+   }
+
+   qDebug() << "Valid AppDir:" << appDir;
+
+
    QTranslator translator( 0 );
    QLocale mylocale;
-   translator.load( QString("PBC_") + QLocale::languageToString(mylocale.language()), "/Programs/PBICreator6/i18n/" );
+   QString langCode = mylocale.name();
+   if ( QFile::exists(appDir + "/i18n/PBC_" + langCode + ".qm" ) )
+     langCode.truncate(langCode.indexOf("_"));
+   translator.load( QString("PBC_") + langCode, appDir + "/i18n/" );
+   qDebug() << "Locale:" << langCode;
+
    a.installTranslator( &translator );
 
     PBCwizard w;
     w.ProgramInit();
-    w.SetAppDir();
+    w.SetAppDir(appDir);
     if ( argc == 2)
     {
        QString tmp = argv[1];

Modified: pbibuild/pbi-source/PBCsource/pbcwizard.cpp
===================================================================
--- pbibuild/pbi-source/PBCsource/pbcwizard.cpp	2009-11-17 14:51:19 UTC (rev 5035)
+++ pbibuild/pbi-source/PBCsource/pbcwizard.cpp	2009-11-17 15:21:53 UTC (rev 5036)
@@ -395,15 +395,9 @@
 
 
 // Set the application directory
-void PBCwizard::SetAppDir()
+void PBCwizard::SetAppDir(QString appDir)
 {
-    QSettings settings("PCBSD"); 
-    PBCAppDir  = settings.value("/PBC/ProgramDir", "NONE").toString();
-    if ( PBCAppDir == "NONE" )
-    {
-       KMessageBox::information(this, tr("/PBC/ProgramDir is unset! Please re-install the application!"));
-    }
-    
+    PBCAppDir = appDir;
 }
 
 

Modified: pbibuild/pbi-source/PBCsource/pbcwizard.h
===================================================================
--- pbibuild/pbi-source/PBCsource/pbcwizard.h	2009-11-17 14:51:19 UTC (rev 5035)
+++ pbibuild/pbi-source/PBCsource/pbcwizard.h	2009-11-17 15:21:53 UTC (rev 5036)
@@ -34,7 +34,7 @@
 	void RemoveExeButtonSlot();
 	void CheckExeItems();
 	void StartPackageCreationSlot();
-	void SetAppDir();
+	void SetAppDir(QString appDir);
 	void InstallFileDoneSlot();
 	void AddMimeButtonSlot();
 	void EditMimeButtonSlot();



More information about the Commits mailing list