[PC-BSD Commits] r309 - pcbsd/trunk/PCInstall
svn at pcbsd.org
svn at pcbsd.org
Fri Jun 8 14:08:33 PDT 2007
Author: kris
Date: 2007-06-08 22:08:33 +0100 (Fri, 08 Jun 2007)
New Revision: 309
Modified:
pcbsd/trunk/PCInstall/main.cpp
pcbsd/trunk/PCInstall/pcinstall.ui
pcbsd/trunk/PCInstall/pcinstall.ui.h
Log:
Fixed some more bugs relating to switching languages
Modified: pcbsd/trunk/PCInstall/main.cpp
===================================================================
--- pcbsd/trunk/PCInstall/main.cpp 2007-06-08 18:41:38 UTC (rev 308)
+++ pcbsd/trunk/PCInstall/main.cpp 2007-06-08 21:08:33 UTC (rev 309)
@@ -2,6 +2,7 @@
#include <qstylefactory.h>
#include <qfile.h>
#include <qtranslator.h>
+#include <qmessagebox.h>
#include "pcinstall.h"
#include "background.h"
#include "global.h"
@@ -10,42 +11,37 @@
{
QApplication a( argc, argv );
- PCInstall w(0);
-
- //QWidget *tmp = QApplication::desktop();
- w.setGeometry(64, 48, 896, 672);
-
- qApp = &a;
-
-
+
+ QString nlang;
+
// Check if we need to load a new language
- if ( QFile::exists( "/tmp/.langchange" ) )
+ if ( QFile::exists( "/root/.langchange" ) )
{
- QString nlang;
- QFile file( "/tmp/.langchange" );
+
+ QFile file( "/root/.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 );
- }
-
+
}
+
+ QTranslator translator(0);
+ translator.load( QString("pcinstall_" + nlang), "/usr/local/pcbsd/LANGS/" );
+ a.installTranslator( &translator );
+
+ PCInstall w;
+ a.setMainWidget( &w );
+ w.setGeometry(64, 48, 896, 672);
+ qApp = &a;
w.ProgramInit();
w.setStyle(QStyleFactory::create( "Plastik" ));
//b.showFullScreen();
- w.exec();
+ w.show();
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
return a.exec();
Modified: pcbsd/trunk/PCInstall/pcinstall.ui
===================================================================
--- pcbsd/trunk/PCInstall/pcinstall.ui 2007-06-08 18:41:38 UTC (rev 308)
+++ pcbsd/trunk/PCInstall/pcinstall.ui 2007-06-08 21:08:33 UTC (rev 309)
@@ -7844,7 +7844,6 @@
<function access="private" returnType="QString">BlocksToMB( QString Blocks )</function>
<function access="private">setupInitialSlices()</function>
<function access="private">detectRAIDMirror()</function>
- <function>ProgramInitTrans( int lang, int keyboard, int timezone, bool ntp )</function>
<function access="private">loadComponents()</function>
<function access="private">refreshComponents()</function>
</functions>
Modified: pcbsd/trunk/PCInstall/pcinstall.ui.h
===================================================================
--- pcbsd/trunk/PCInstall/pcinstall.ui.h 2007-06-08 18:41:38 UTC (rev 308)
+++ pcbsd/trunk/PCInstall/pcinstall.ui.h 2007-06-08 21:08:33 UTC (rev 309)
@@ -22,9 +22,7 @@
// 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"));
@@ -82,7 +80,7 @@
// Load the Lang List
loadLangs();
- listBoxLang->setSelected(0, TRUE);
+
// Load the TimeZone Info
loadTZone();
@@ -139,7 +137,12 @@
+ // Connect the list box languages to the slot
+ connect( listBoxLang, SIGNAL( selectionChanged () ), this, SLOT(listBoxLangChanged() ) );
+
+
+
}
@@ -339,9 +342,26 @@
QString tmp;
QString Langcode;
QString Langdescr;
+ QString nlang = "";
+ int count = 0, found = 0;
listBoxLang->clear();
+ // Check the currently running language
+ if ( QFile::exists( "/root/.langchange" ) )
+ {
+
+ QFile file( "/root/.langchange" );
+ if ( file.open( IO_ReadOnly ) ) {
+ QTextStream stream( &file );
+ nlang = stream.readLine(); // line of text excluding '\n'
+ file.close();
+ }
+
+ }
+
+
+
QFile file( "/root/Langs" );
if ( file.open( IO_ReadOnly ) ) {
QTextStream stream( &file );
@@ -352,13 +372,26 @@
tmp.truncate(tmp.find(" ") );
Langcode = tmp;
+
Langdescr = line.remove(0, line.find(" ") + 1 );
listBoxLang->insertItem(Langdescr + " (" + Langcode + ")" );
+
+ if ( nlang == Langcode ) {
+ listBoxLang->setSelected(count, TRUE);
+ found = 1;
+ }
+
+ count++;
}
file.close();
}
+
+ if (found == 0) {
+ listBoxLang->setSelected(0, TRUE);
+ }
+
}
@@ -2413,6 +2446,10 @@
void PCInstall::listBoxLangChanged()
{
QString tmp;
+
+
+
+
tmp = listBoxLang->currentText();
tmp.remove(0, tmp.find("(") + 1 );
@@ -2420,7 +2457,7 @@
// Save the file
- QFile file( "/tmp/.langchange" );
+ QFile file( "/root/.langchange" );
if ( file.open( IO_WriteOnly ) ) {
QTextStream stream( &file );
stream << tmp;
@@ -2531,45 +2568,7 @@
-void PCInstall::ProgramInitTrans( int lang, int keyboard, int timezone, bool ntp )
-{
- QString tmp;
-
-
- listBoxLang->setCurrentItem(lang);
- listBoxKeyLayout->setCurrentItem(keyboard);
- comboTZone->setCurrentItem(timezone);
- checkTimeSync->setChecked(ntp);
-
-
- if ( lang == 0 )
- {
- QFont f( "Sans Serif", 11);
- setFont( f );
- } else {
-
- QFont f( "Sans Serif", 9);
- setFont( f );
- }
-
-
-
- // Get the actual letter code for checking LANG
- tmp = listBoxLang->currentText();
- tmp.remove(0, tmp.find("(") + 1 );
- tmp.truncate(tmp.find(")") );
- LastLang = tmp;
-
- if ( tmp == "ru" )
- {
- QFont f( "DejaVu Sans", 9);
- setFont( f );
- }
-
-
-}
-
void PCInstall::listBoxLayoutChanged()
{
QString tmp;
More information about the Commits
mailing list