[PC-BSD Commits] r308 - pcbsd/trunk/PCInstall
svn at pcbsd.org
svn at pcbsd.org
Fri Jun 8 11:41:38 PDT 2007
Author: kris
Date: 2007-06-08 19:41:38 +0100 (Fri, 08 Jun 2007)
New Revision: 308
Modified:
pcbsd/trunk/PCInstall/main.cpp
pcbsd/trunk/PCInstall/pcinstall.ui.h
Log:
Changed the logic behind loading language files, should reduce memory usage, now loads files the "proper" way, at program init
Modified: pcbsd/trunk/PCInstall/main.cpp
===================================================================
--- pcbsd/trunk/PCInstall/main.cpp 2007-06-08 18:39:22 UTC (rev 307)
+++ pcbsd/trunk/PCInstall/main.cpp 2007-06-08 18:41:38 UTC (rev 308)
@@ -1,5 +1,7 @@
#include <qapplication.h>
#include <qstylefactory.h>
+#include <qfile.h>
+#include <qtranslator.h>
#include "pcinstall.h"
#include "background.h"
#include "global.h"
@@ -8,11 +10,6 @@
{
QApplication a( argc, argv );
- //QWidget background(0, "Background", Qt::WindowFullScreen);
-
- //background b(0,0, FALSE);
-
- // PCInstall w(0, 0, FALSE, Qt::WStyle_Customize | Qt::WStyle_Dialog);
PCInstall w(0);
//QWidget *tmp = QApplication::desktop();
@@ -20,6 +17,31 @@
qApp = &a;
+
+ // Check if we need to load a new language
+ if ( QFile::exists( "/tmp/.langchange" ) )
+ {
+ QString nlang;
+ QFile file( "/tmp/.langchange" );
+ if ( file.open( IO_ReadOnly ) ) {
+ QTextStream stream( &file );
+ QString line;
+ while ( !stream.atEnd() ) {
+ nlang = stream.readLine(); // line of text excluding '\n'
+ }
+ file.close();
+ }
+
+ if ( QFile::exists( "/usr/local/pcbsd/LANGS/pcinstall_" + nlang + ".qm" ) )
+ {
+ QTranslator translator(0 );
+ translator.load( QString("pcinstall_" + nlang), "/usr/local/pcbsd/LANGS/" );
+ a.installTranslator( &translator );
+ }
+
+ }
+
+
w.ProgramInit();
w.setStyle(QStyleFactory::create( "Plastik" ));
//b.showFullScreen();
Modified: pcbsd/trunk/PCInstall/pcinstall.ui.h
===================================================================
--- pcbsd/trunk/PCInstall/pcinstall.ui.h 2007-06-08 18:39:22 UTC (rev 307)
+++ pcbsd/trunk/PCInstall/pcinstall.ui.h 2007-06-08 18:41:38 UTC (rev 308)
@@ -22,6 +22,9 @@
// Disable the "next" button until user clicks "I Agree"
//setNextEnabled(page(4), FALSE);
+ // Connect the list box languages to the slot
+ connect( listBoxLang, SIGNAL( selectionChanged () ), this, SLOT(listBoxLangChanged() ) );
+
// Setup Translations
nextButton()->setText(tr("Next"));
backButton()->setText(tr("Back"));
@@ -132,7 +135,10 @@
colourRed = QColor(255, 78, 78);
colourWhite = QColor(255, 255, 255);
+
+
+
}
@@ -157,9 +163,8 @@
if ( Page == tr("Select Language and Keyboard") )
{
- // Connect the language list box to the slot
- connect( listBoxLang, SIGNAL( selectionChanged () ), this, SLOT(listBoxLangChanged() ) );
//backButton()->setHidden(TRUE);
+
}
if ( Page == tr("License") )
@@ -2080,7 +2085,7 @@
EjectCD = new QProcess( this );
EjectCD->addArgument( "/usr/local/pcbsd/scripts/PCBSD.EjectCD.sh" );
- if ( !EjectCD->start() ) {
+ if ( !EjectCD->start() ) {
QMessageBox::warning( this, "PCBSD Installer", "Failed Starting EjectCD", "Retry", "Quit", 0, 0, 1 );
}
@@ -2409,37 +2414,20 @@
{
QString tmp;
-
- QTranslator translator2( this );
- translator2.load( QString("pcinstall_en"), "/usr/local/pcbsd/LANGS/" );
- qApp->installTranslator(&translator2);
-
-
tmp = listBoxLang->currentText();
tmp.remove(0, tmp.find("(") + 1 );
tmp.truncate(tmp.find(")") );
- if ( QFile::exists( "/usr/local/pcbsd/LANGS/pcinstall_" + tmp + ".qm" ) )
- {
- //QMessageBox::warning( this, "PCBSD Installer", "Loading the Lang", "Retry", "Quit", 0, 0, 1 );
- QTranslator translator( this );
- translator.load( QString("pcinstall_" + tmp), "/usr/local/pcbsd/LANGS/" );
- qApp->installTranslator( &translator );
-
-
- PCInstall neww(0,0, FALSE, Qt::WStyle_Customize | Qt::WStyle_Dialog);
-
- //QWidget *tmp = QApplication::desktop();
- neww.setGeometry(64, 48, 896, 672);
- neww.ProgramInit();
- neww.ProgramInitTrans( listBoxLang->currentItem(), listBoxKeyLayout->currentItem(), comboTZone->currentItem(), checkTimeSync->isChecked() );
- neww.setStyle(QStyleFactory::create( "Plastik" ));
- neww.exec();
- done(1);
-
+ // Save the file
+ QFile file( "/tmp/.langchange" );
+ if ( file.open( IO_WriteOnly ) ) {
+ QTextStream stream( &file );
+ stream << tmp;
+ file.close();
}
+ exit(3);
}
@@ -2930,7 +2918,7 @@
listAvailComponents->clear();
listSelectedComponents->clear();
-
+ installComponents = 0;
for ( int i = 0; i < 100; i++ )
{
More information about the Commits
mailing list