[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src common/Utils.cpp common/Utils.h co...
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src common/Utils.cpp common/Utils.h co... |
Date: |
Sat, 07 Feb 2009 22:58:42 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 09/02/07 22:58:42
Modified files:
src/common : Utils.cpp Utils.h
src/core : Config.cpp
src/traverso : Interface.cpp Main.cpp
Log message:
* added convenience functions to get a list of available i18n files,
and their language names
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/common/Utils.cpp?cvsroot=traverso&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/traverso/src/common/Utils.h?cvsroot=traverso&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Config.cpp?cvsroot=traverso&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/Interface.cpp?cvsroot=traverso&r1=1.160&r2=1.161
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/Main.cpp?cvsroot=traverso&r1=1.12&r2=1.13
Patches:
Index: common/Utils.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/common/Utils.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- common/Utils.cpp 3 Dec 2007 20:45:13 -0000 1.9
+++ common/Utils.cpp 7 Feb 2009 22:58:41 -0000 1.10
@@ -29,7 +29,8 @@
#include <QRegExp>
#include <QLocale>
#include <QChar>
-
+#include <QTranslator>
+#include <QDir>
TimeRef msms_to_timeref(QString str)
{
@@ -230,3 +231,24 @@
return timeref_to_ms_3(ref);
}
}
+
+
+QStringList find_qm_files()
+{
+ QDir dir(":/translations");
+ QStringList fileNames = dir.entryList(QStringList("*.qm"), QDir::Files,
QDir::Name);
+ QMutableStringListIterator i(fileNames);
+ while (i.hasNext()) {
+ i.next();
+ i.setValue(dir.filePath(i.value()));
+ }
+ return fileNames;
+}
+
+QString language_name_from_qm_file(const QString& lang)
+{
+ QTranslator translator;
+ translator.load(lang);
+ return translator.translate("LanguageName", "English", "The name of
this Language, e.g. German would be Deutch");
+}
+
Index: common/Utils.h
===================================================================
RCS file: /sources/traverso/traverso/src/common/Utils.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- common/Utils.h 30 Jan 2008 13:56:48 -0000 1.6
+++ common/Utils.h 7 Feb 2009 22:58:41 -0000 1.7
@@ -46,6 +46,10 @@
qint64 create_id();
+QStringList find_qm_files();
+QString language_name_from_qm_file(const QString& lang);
+
+
static inline unsigned int is_power_of_two (unsigned int n)
{
return !(n & (n - 1));
Index: core/Config.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Config.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- core/Config.cpp 26 Jan 2009 20:11:42 -0000 1.21
+++ core/Config.cpp 7 Feb 2009 22:58:41 -0000 1.22
@@ -23,6 +23,7 @@
#include "../config.h"
#include "InputEngine.h"
#include "AudioDevice.h"
+#include "Utils.h"
#include <QSettings>
#include <QString>
@@ -58,7 +59,6 @@
set_audiodevice_driver_properties();
}
-
void Config::reset_settings( )
{
QSettings settings(QSettings::IniFormat, QSettings::UserScope,
"Traverso-DAW", "Traverso");
Index: traverso/Interface.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/Interface.cpp,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -b -r1.160 -r1.161
--- traverso/Interface.cpp 7 Feb 2009 17:46:03 -0000 1.160
+++ traverso/Interface.cpp 7 Feb 2009 22:58:41 -0000 1.161
@@ -113,6 +113,7 @@
{
PENTERCONS;
setWindowTitle("Traverso");
+ tr("English");
setMinimumSize(400, 300);
setWindowIcon(QPixmap (":/windowicon") );
// setMaximumWidth(1024);
Index: traverso/Main.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/Main.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- traverso/Main.cpp 2 Feb 2009 20:26:41 -0000 1.12
+++ traverso/Main.cpp 7 Feb 2009 22:58:41 -0000 1.13
@@ -119,9 +119,9 @@
QString systemLanguage = QLocale::system().name();
QString userLanguage = config().get_property("Interface", "Language",
"").toString();
if (userLanguage.isEmpty() || userLanguage.isNull()) {
- traversoTranslator.load(":/traverso_" + systemLanguage );
+ traversoTranslator.load(":/translations/traverso_" +
systemLanguage );
} else {
- traversoTranslator.load(":/traverso_" + userLanguage );
+ traversoTranslator.load(":/translations/traverso_" +
userLanguage );
}
traverso->installTranslator(&traversoTranslator);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src common/Utils.cpp common/Utils.h co...,
Remon Sijrier <=