diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index 5c95e10731..37983e3fb9 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * * Copyright (C) 2007 by Dominik Riebeling - * $Id:$ + * $Id$ * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. @@ -22,8 +22,11 @@ #include "configure.h" #include "ui_configurefrm.h" +#define DEFAULT_LANG "English (builtin)" + Config::Config(QWidget *parent) : QDialog(parent) { + programPath = QFileInfo(qApp->arguments().at(0)).absolutePath() + "/"; ui.setupUi(this); ui.radioManualProxy->setChecked(true); QRegExpValidator *proxyValidator = new QRegExpValidator(this); @@ -33,6 +36,19 @@ Config::Config(QWidget *parent) : QDialog(parent) ui.radioSystemProxy->setEnabled(false); // not implemented yet + // build language list and sort alphabetically + QStringList langs = findLanguageFiles(); + for(int i = 0; i < langs.size(); ++i) + lang.insert(languageName(langs[i]), langs[i]); + lang.insert(DEFAULT_LANG, ""); + QMap::const_iterator i = lang.constBegin(); + while (i != lang.constEnd()) { + ui.listLanguages->addItem(i.key()); + i++; + } + ui.listLanguages->setSelectionMode(QAbstractItemView::SingleSelection); + connect(ui.listLanguages, SIGNAL(itemSelectionChanged()), this, SLOT(updateLanguage())); + connect(ui.buttonOk, SIGNAL(clicked()), this, SLOT(accept())); connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(abort())); connect(ui.radioNoProxy, SIGNAL(toggled(bool)), this, SLOT(setNoProxy(bool))); @@ -42,6 +58,7 @@ Config::Config(QWidget *parent) : QDialog(parent) void Config::accept() { qDebug() << "Config::accept()"; + // proxy: save entered proxy values, not displayed. QUrl proxy; proxy.setScheme("http"); proxy.setUserName(ui.proxyUser->text()); @@ -51,13 +68,20 @@ void Config::accept() userSettings->setValue("defaults/proxy", proxy.toString()); qDebug() << "new proxy:" << proxy; - + // proxy type QString proxyType; if(ui.radioNoProxy->isChecked()) proxyType = "none"; else if(ui.radioSystemProxy->isChecked()) proxyType = "system"; else proxyType = "manual"; userSettings->setValue("defaults/proxytype", proxyType); + // language + if(userSettings->value("defaults/lang").toString() != language) + QMessageBox::information(this, tr("Language changed"), + tr("You need to restart the application for the changed language to take effect.")); + userSettings->setValue("defaults/lang", language); + + // sync settings userSettings->sync(); this->close(); emit settingsUpdated(); @@ -76,16 +100,34 @@ void Config::setUserSettings(QSettings *user) userSettings = user; QUrl proxy = userSettings->value("defaults/proxy").toString(); - ui.proxyPort->insert(QString("%1").arg(proxy.port())); - ui.proxyHost->insert(proxy.host()); - ui.proxyUser->insert(proxy.userName()); - ui.proxyPass->insert(proxy.password()); + ui.proxyPort->setText(QString("%1").arg(proxy.port())); + ui.proxyHost->setText(proxy.host()); + ui.proxyUser->setText(proxy.userName()); + ui.proxyPass->setText(proxy.password()); QString proxyType = userSettings->value("defaults/proxytype").toString(); if(proxyType == "manual") ui.radioManualProxy->setChecked(true); else if(proxyType == "system") ui.radioSystemProxy->setChecked(true); else if(proxyType == "none") ui.radioNoProxy->setChecked(true); + // set language selection + QList a; + QString b; + // find key for lang value + QMap::const_iterator i = lang.constBegin(); + while (i != lang.constEnd()) { + if(i.value() == userSettings->value("defaults/lang").toString() + ".qm") { + b = i.key(); + break; + } + i++; + } + a = ui.listLanguages->findItems(b, Qt::MatchExactly); + if(a.size() <= 0) + a = ui.listLanguages->findItems(DEFAULT_LANG, Qt::MatchExactly); + if(a.size() > 0) + ui.listLanguages->setCurrentItem(a.at(0)); + } @@ -98,3 +140,40 @@ void Config::setNoProxy(bool checked) ui.proxyPass->setEnabled(i); } + +QStringList Config::findLanguageFiles() +{ + QDir dir(programPath + "/"); + QStringList fileNames; + fileNames = dir.entryList(QStringList("*.qm"), QDir::Files, QDir::Name); + + QDir resDir(":/lang"); + fileNames += resDir.entryList(QStringList("*.qm"), QDir::Files, QDir::Name); + + fileNames.sort(); + qDebug() << "Config::findLanguageFiles()" << fileNames; + + return fileNames; +} + + +QString Config::languageName(const QString &qmFile) +{ + QTranslator translator; + + if(!translator.load(qmFile, programPath)) + translator.load(qmFile, ":/lang"); + + return translator.translate("Configure", "English"); +} + + +void Config::updateLanguage() +{ + qDebug() << "updateLanguage()"; + QList a = ui.listLanguages->selectedItems(); + if(a.size() > 0) + language = QFileInfo(lang.value(a.at(0)->text())).baseName(); +} + + diff --git a/rbutil/rbutilqt/configure.h b/rbutil/rbutilqt/configure.h index f3b879e333..a37f88b5e7 100644 --- a/rbutil/rbutilqt/configure.h +++ b/rbutil/rbutilqt/configure.h @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * * Copyright (C) 2007 by Dominik Riebeling - * $Id:$ + * $Id$ * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. @@ -40,9 +40,15 @@ class Config : public QDialog private: Ui::ConfigForm ui; QSettings *userSettings; + QStringList findLanguageFiles(void); + QString languageName(const QString&); + QMap lang; + QString language; + QString programPath; private slots: void setNoProxy(bool); + void updateLanguage(void); }; #endif diff --git a/rbutil/rbutilqt/configurefrm.ui b/rbutil/rbutilqt/configurefrm.ui index dee9deab6b..4c0a3a3e2f 100644 --- a/rbutil/rbutilqt/configurefrm.ui +++ b/rbutil/rbutilqt/configurefrm.ui @@ -165,6 +165,11 @@ &Language + + + + + diff --git a/rbutil/rbutilqt/main.cpp b/rbutil/rbutilqt/main.cpp index 8212d04769..39dd3d0735 100644 --- a/rbutil/rbutilqt/main.cpp +++ b/rbutil/rbutilqt/main.cpp @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * * Copyright (C) 2007 by Dominik Riebeling - * $Id:$ + * $Id$ * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. @@ -25,8 +25,22 @@ int main( int argc, char ** argv ) { QApplication app( argc, argv ); + QString absolutePath = QFileInfo(qApp->arguments().at(0)).absolutePath() + "/"; + // portable installation: + // check for a configuration file in the program folder. + QSettings *user; + if(QFileInfo(absolutePath + "RockboxUtility.ini").isFile()) + user = new QSettings(absolutePath + "RockboxUtility.ini", QSettings::IniFormat, 0); + else user = new QSettings(QSettings::IniFormat, QSettings::UserScope, "rockbox.org", "RockboxUtility"); + QTranslator translator; -// translator.load("rbutil_de.qm"); + if(user->value("defaults/lang").toString() != "") + // install translator + if(user->value("defaults/lang", "").toString() != "") { + if(!translator.load(user->value("defaults/lang").toString(), absolutePath)) + translator.load(user->value("defaults/lang").toString(), ":/lang"); + } + delete user; app.installTranslator(&translator); RbUtilQt window(0); diff --git a/rbutil/rbutilqt/rbutil_de.ts b/rbutil/rbutilqt/rbutil_de.ts index abc7650b22..06acae3b8d 100644 --- a/rbutil/rbutilqt/rbutil_de.ts +++ b/rbutil/rbutilqt/rbutil_de.ts @@ -1,173 +1,121 @@ - - + + + Config + + Language changed + Sprache geändert + + + You need to restart the application for the changed language to take effect. + Die Anwendung muss neu gestartet werden um die geänderten Spracheinstallungen anzuwenden. + + ConfigForm - Configuration - Konfiguration + Konfiguration - Configure Rockbox Utility Rockbox Utility konfigurieren - &Ok - &Ok + &Ok - &Cancel - &Abbrechen + &Abbrechen - &Proxy - &Proxy + &Proxy - &No Proxy - &kein Proxy + &kein Proxy - Use &System values - &Systemeinstellungen benutzen + &Systemeinstellungen benutzen - &Manual Proxy settings - &Manuelle Proxyeinstellungen + &Manuelle Proxyeinstellungen - Proxy Values - Proxyeinstellungen + Proxyeinstellungen - &Host: - + &Host: - &Port: - + &Port: - &Username - &Benutzername + &Benutzername - P&assword - P&asswort + P&asswort - &Language - &Sprache + &Sprache - &Scrobbler + + Configure + + English + Deutsch + + Install - Mount point is wrong! Falscher Einhängepunkt! - &Ok - &Ok + &Ok - - Downloading file %1.%2 - Herunterladen von Datei %1.%2 - - - - Download error! - Download-Fehler! - - - - Download finished. - Download abgeschlossen. - - - - Extracting file %1.%2 - Extrahiere Datei %1.%2 - - - - Opening archive failed: %1. - Öffnen des Archives fehlgeschlagen: %1 - - - - Extracting failed: %1. - Extrahieren fehlgeschlagen: %1 - - - - creating installation log - erzeuge Installationshistorie - - - - creating log failed! - Erzeugen der Installationshistorie fehlgeschlagen! - - - - Extraction finished successfully. - Extraktion erfolgreich abgeschlossen. - - - This is the absolute up to the minute Rockbox built. A current build will get updated every time a change is made. - <b>Note:</b> This option will always download a fresh copy. <b>This is the recommended version.</b> - <b>Note:</b> This option will always download a fresh copy. - This is the last released version of Rockbox. - <b>Note:</b>The lastest released version is %1. <b>This is the recommended version.</b> - These are automatically built each day from the current development source code. This generally has more features than the last release but may be much less stable. Features may change regularly. - <b>Note:</b> archived version is %1. @@ -175,144 +123,134 @@ InstallFrm - Install Rockbox Rockbox installieren - Select your device in the filesystem - &Browse - Please select the Rockbox version you want to install on your player: - Version - Version + Version - Rockbox &stable - &Archived Build - &Current Build - Details - + Details - Details about the selected version - Note - + Hinweis - Rockbox Utility stores copies of Rockbox it has downloaded on the local hard disk to save network traffic. If your local copy is no longer working, tick this box to download a fresh copy. - &Don't use locally cached copy - + &keine lokale Zwischenkopie verwenden InstallProgressFrm - Progress - Fortschritt + Fortschritt - &Abort - &Abbrechen + &Abbrechen - QrbUtilMain + RBInstaller - - &File - &Datei + Downloading file %1.%2 + Herunterladen von Datei %1.%2 - - &About - Ü&ber + Download error: received HTTP error %1. + Fehler beim Herunterladen: HTTP Fehler %1. - - Set &Proxy - &Proxy einstellen + &Ok + &Ok - - E&xit - &Beenden + Download error: %1 + Downloadfehler: %1 - - Ctrl+Q - Strg+Q + Download finished. + Download abgeschlossen. - - About &Qt - Über &Qt + Extracting file. + Extrahiere Datei. + + + Opening archive failed: %1. + Öffnen des Archives fehlgeschlagen: %1 + + + Extracting failed: %1. + Extrahieren fehlgeschlagen: %1 + + + creating installation log + erzeuge Installationshistorie + + + Extraction finished successfully. + Extraktion erfolgreich abgeschlossen. RbUtilQt - Network error: %1. Please check your network and proxy settings. - Netzwerkfehler: %1. Bitte Netzwerk und Proxyeinstellungen überprüfen. + Netzwerkfehler: %1. Bitte Netzwerk und Proxyeinstellungen überprüfen. RbUtilQtFrm - Rockbox Utility - &Quick Start - ... - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> @@ -321,7 +259,6 @@ p, li { white-space: pre-wrap; } - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> @@ -330,12 +267,10 @@ p, li { white-space: pre-wrap; } - &Installation - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> @@ -344,7 +279,6 @@ p, li { white-space: pre-wrap; } - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> @@ -352,12 +286,10 @@ p, li { white-space: pre-wrap; } - &Extras - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> @@ -366,7 +298,6 @@ p, li { white-space: pre-wrap; } - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> @@ -375,7 +306,6 @@ p, li { white-space: pre-wrap; } - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> @@ -384,12 +314,10 @@ p, li { white-space: pre-wrap; } - &Uninstallation - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> @@ -398,7 +326,6 @@ p, li { white-space: pre-wrap; } - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> @@ -407,211 +334,231 @@ p, li { white-space: pre-wrap; } - &Manual - &Device - &Autodetect - &File - &Datei + &Datei - &About - Ü&ber + Ü&ber - Empty local download cache - + Download-Cache löschen - Install Rockbox Utility on player - + Rockbox Utility auf dem Gerät installieren - &Configure - + &Konfigurieren - E&xit &Beenden - Ctrl+Q - Strg+Q + Ctrl+Q - About &Qt Über &Qt + + Select the task group you want to perform + + + + InstallationTab + + + + This is the tab view of the tasks you can perform + + + + CompleteInstallationButton + + + + This performs a complete installation of Rockbox. It installs the bootloader, a current build and the extras package. + + + + Install Rockbox + + + + ButtonInstall + + + + This installs a build of Rockbox on your player. It can also upgrade an existing build. + + + + Install Bootloader + Bootloader installieren + + + Install Fonts package + Schriftarten-Paket installieren + + + Install themes + + + + Install game files + + + + Uninstall Bootloader + Bootloader entfernen + + + Uninstall Rockbox + Rockbox entfernen + + + Device selection combo box + + UnZip - ZIP operation completed successfully. - Failed to initialize or load zlib library. - + Initialisieren oder Laden der zlib-Bibliothek fehlgeschlagen. - zlib library error. - + Fehler in zlib-Bibliothek. - Unable to create or open file. - + Erzeugen oder Öffnen der Datei fehlgeschlagen. - Partially corrupted archive. Some files might be extracted. - + Teilweise korruptes Archiv. Einige Dateien wurden möglicherweise extrahiert. - Corrupted archive. - + Korruptes Archiv. - Wrong password. - + Falsches Passwort. - No archive has been created yet. - File or directory does not exist. - + Datei oder Ordner existiert nicht. - File read error. - + Fehler beim Lesen der Datei. - File write error. - + Fehler beim Schreiben der Datei. - File seek error. - + Fehler beim Durchsuchen der Datei. - Unable to create a directory. - Invalid device. - + Ungültiges Gerät. - Invalid or incompatible zip archive. - + Ungültiges oder inkompatibles Zip-Archiv. - Inconsistent headers. Archive might be corrupted. - Unknown error. - + Unbekannter Fehler. Zip - ZIP operation completed successfully. - Failed to initialize or load zlib library. - + Initialisieren oder Laden der zlib-Bibliothek fehlgeschlagen. - zlib library error. - + Fehler in zlib-Bibliothek. - Unable to create or open file. - + Erzeugen oder Öffnen der Datei fehlgeschlagen. - No archive has been created yet. - File or directory does not exist. - + Datei oder Ordner existiert nicht. - File read error. - + Fehler beim Lesen der Datei. - File write error. - + Fehler beim Schreiben der Datei. - File seek error. - + Fehler beim Durchsuchen der Datei. - Unknown error. - + Unbekannter Fehler. aboutBox - About Rockbox Utility - Über Rockbox Utility + Über Rockbox Utility - Installer and housekeeping utility for the Rockbox open source digital audio player firmware. © 2005 - 2007 The Rockbox Team. @@ -620,24 +567,20 @@ Released under the GNU General Public License v2. - &Credits - &License - &Lizenz + &Lizenz - &Ok - &Ok + &Ok - The Rockbox Utility - + Rockbox Utility diff --git a/rbutil/rbutilqt/rbutilqt.qrc b/rbutil/rbutilqt/rbutilqt.qrc index 1353fffaf8..98d8aa2fd3 100644 --- a/rbutil/rbutilqt/rbutilqt.qrc +++ b/rbutil/rbutilqt/rbutilqt.qrc @@ -1,6 +1,5 @@ - COPYING CREDITS gpl-2.0.html @@ -19,4 +18,6 @@ rbutil.ini + +