1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

OP-723 Changed default locale to English. Updated default configuration files to have <OverrideLanguage> tag set to en_US.

This commit is contained in:
Fredrik Arvidsson 2012-11-24 14:55:46 +01:00
parent 5f4b028a93
commit 0e55f3c74d
6 changed files with 53 additions and 51 deletions

View File

@ -6,7 +6,7 @@
<Description>Default configuration</Description> <Description>Default configuration</Description>
<Details>Default configuration built to work on all screen sizes</Details> <Details>Default configuration built to work on all screen sizes</Details>
<ExpertMode>false</ExpertMode> <ExpertMode>false</ExpertMode>
<OverrideLanguage>en_AU</OverrideLanguage> <OverrideLanguage>en_US</OverrideLanguage>
<SaveSettingsOnExit>true</SaveSettingsOnExit> <SaveSettingsOnExit>true</SaveSettingsOnExit>
<SettingsWindowHeight>700</SettingsWindowHeight> <SettingsWindowHeight>700</SettingsWindowHeight>
<SettingsWindowWidth>800</SettingsWindowWidth> <SettingsWindowWidth>800</SettingsWindowWidth>

View File

@ -8,6 +8,7 @@
<SaveSettingsOnExit>true</SaveSettingsOnExit> <SaveSettingsOnExit>true</SaveSettingsOnExit>
<SettingsWindowHeight>700</SettingsWindowHeight> <SettingsWindowHeight>700</SettingsWindowHeight>
<SettingsWindowWidth>800</SettingsWindowWidth> <SettingsWindowWidth>800</SettingsWindowWidth>
<OverrideLanguage>en_US</OverrideLanguage>
<UDPMirror>false</UDPMirror> <UDPMirror>false</UDPMirror>
<Description>Wide configuration</Description> <Description>Wide configuration</Description>
<Details>Default configuration built for wide screens (17"up)</Details> <Details>Default configuration built for wide screens (17"up)</Details>

View File

@ -241,6 +241,11 @@ int main(int argc, char **argv)
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
QApplication::setAttribute(Qt::AA_X11InitThreads, true); QApplication::setAttribute(Qt::AA_X11InitThreads, true);
#endif #endif
//Set the default locale to EN, if this is not set the system locale will be used
//and as of now we dont want that behaviour.
QLocale::setDefault(QLocale::English);
QApplication::setGraphicsSystem("raster"); QApplication::setGraphicsSystem("raster");
SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv); SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv);

View File

@ -10,47 +10,47 @@ importSettings::importSettings(QWidget *parent) :
ui(new Ui::importSettings) ui(new Ui::importSettings)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->cbConfigs,SIGNAL(currentIndexChanged(int)),this,SLOT(updateDetails(int))); connect(ui->cbConfigs, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDetails(int)));
connect(ui->btnLoad,SIGNAL(clicked()),this,SLOT(accept())); connect(ui->btnLoad, SIGNAL(clicked()), this, SLOT(accept()));
QTimer::singleShot(500,this,SLOT(repaint())); QTimer::singleShot(500, this, SLOT(repaint()));
} }
void importSettings::loadFiles(QString path) void importSettings::loadFiles(QString path)
{ {
QDir myDir(path); QDir myDir(path);
QStringList filters; QStringList filters;
filters << "*.xml"; filters << "*.xml";
QStringList list = myDir.entryList(filters,QDir::Files); QStringList list = myDir.entryList(filters,QDir::Files);
int x=0; int x = 0;
foreach(QString fileStr, list) foreach(QString fileStr, list) {
{ fileInfo *info = new fileInfo;
fileInfo * info=new fileInfo; QSettings settings(path+QDir::separator() + fileStr, XmlConfig::XmlSettingsFormat);
QSettings settings(path+QDir::separator()+fileStr, XmlConfig::XmlSettingsFormat);
settings.beginGroup("General"); settings.beginGroup("General");
info->description=settings.value("Description","None").toString(); info->description = settings.value("Description", "None").toString();
info->details=settings.value("Details","None").toString(); info->details = settings.value("Details", "None").toString();
settings.endGroup(); settings.endGroup();
info->file=path+QDir::separator()+fileStr; info->file = path + QDir::separator() + fileStr;
configList.insert(x,info); configList.insert(x,info);
ui->cbConfigs->addItem(info->description,x); ui->cbConfigs->addItem(info->description, x);
++x; ++x;
} }
} }
void importSettings::updateDetails(int index) void importSettings::updateDetails(int index)
{ {
fileInfo * info=configList.value(ui->cbConfigs->itemData(index).toInt()); fileInfo *info = configList.value(ui->cbConfigs->itemData(index).toInt());
ui->lblDetails->setText(info->details); ui->lblDetails->setText(info->details);
} }
QString importSettings::choosenConfig() QString importSettings::choosenConfig()
{ {
fileInfo * info=configList.value(ui->cbConfigs->itemData(ui->cbConfigs->currentIndex()).toInt()); fileInfo *info = configList.value(ui->cbConfigs->itemData(ui->cbConfigs->currentIndex()).toInt());
return info->file; return info->file;
} }
importSettings::~importSettings() importSettings::~importSettings()
{ {
foreach(fileInfo * info,configList.values()) foreach(fileInfo * info,configList.values()) {
{
delete info; delete info;
} }
delete ui; delete ui;

View File

@ -1,3 +1,4 @@
#ifndef IMPORTSETTINGS_H #ifndef IMPORTSETTINGS_H
#define IMPORTSETTINGS_H #define IMPORTSETTINGS_H
@ -10,8 +11,7 @@ class importSettings;
class importSettings : public QDialog class importSettings : public QDialog
{ {
Q_OBJECT Q_OBJECT
struct fileInfo struct fileInfo {
{
QString file; QString file;
QString description; QString description;
QString details; QString details;
@ -23,9 +23,11 @@ public:
void loadFiles(QString path); void loadFiles(QString path);
QString choosenConfig(); QString choosenConfig();
private: private:
Ui::importSettings *ui; Ui::importSettings *ui;
QMap<int,fileInfo*> configList; QMap<int,fileInfo*> configList;
private slots: private slots:
void updateDetails(int); void updateDetails(int);
}; };

View File

@ -266,18 +266,15 @@ void MainWindow::modeChanged(Core::IMode */*mode*/)
void MainWindow::extensionsInitialized() void MainWindow::extensionsInitialized()
{ {
QSettings *qs = m_settings;
QSettings* qs = m_settings; QSettings *settings;
QSettings * settings;
QString commandLine; QString commandLine;
if ( ! qs->allKeys().count() ){ if ( ! qs->allKeys().count() ) {
foreach(QString str,qApp->arguments()) foreach(QString str, qApp->arguments()) {
{ if(str.contains("configfile")) {
if(str.contains("configfile")) qDebug() << "ass";
{ commandLine = str.split("=").at(1);
qDebug()<<"ass"; qDebug() << commandLine;
commandLine=str.split("=").at(1);
qDebug()<<commandLine;
} }
} }
QDir directory(QCoreApplication::applicationDirPath()); QDir directory(QCoreApplication::applicationDirPath());
@ -289,37 +286,34 @@ void MainWindow::extensionsInitialized()
directory.cd("share"); directory.cd("share");
directory.cd("openpilotgcs"); directory.cd("openpilotgcs");
#endif #endif
directory.cd("default_configurations"); directory.cd("default_configurations");
qDebug() << "Looking for default config files in: " + directory.absolutePath(); qDebug() << "Looking for default config files in: " + directory.absolutePath();
bool showDialog=true; bool showDialog = true;
QString filename; QString filename;
if(!commandLine.isEmpty()) if(!commandLine.isEmpty()) {
{ if(QFile::exists(directory.absolutePath() + QDir::separator()+commandLine)) {
if(QFile::exists(directory.absolutePath()+QDir::separator()+commandLine)) filename = directory.absolutePath() + QDir::separator()+commandLine;
{ qDebug() << "Load configuration from command line";
filename=directory.absolutePath()+QDir::separator()+commandLine; settings = new QSettings(filename, XmlConfig::XmlSettingsFormat);
qDebug()<<"Load configuration from command line"; showDialog = false;
settings=new QSettings(filename, XmlConfig::XmlSettingsFormat);
showDialog=false;
} }
} }
if(showDialog) if(showDialog) {
{ importSettings *dialog = new importSettings(this);
importSettings * dialog=new importSettings(this);
dialog->loadFiles(directory.absolutePath()); dialog->loadFiles(directory.absolutePath());
dialog->exec(); dialog->exec();
filename=dialog->choosenConfig(); filename = dialog->choosenConfig();
settings=new QSettings(filename, XmlConfig::XmlSettingsFormat); settings = new QSettings(filename, XmlConfig::XmlSettingsFormat);
delete dialog; delete dialog;
} }
qs=settings; qs = settings;
qDebug() << "Load default config from resource "<<filename; qDebug() << "Load default config from resource " << filename;
} }
qs->beginGroup("General"); qs->beginGroup("General");
m_config_description=qs->value("Description","none").toString(); m_config_description=qs->value("Description", "none").toString();
m_config_details=qs->value("Details","none").toString(); m_config_details=qs->value("Details", "none").toString();
m_config_stylesheet=qs->value("StyleSheet","none").toString(); m_config_stylesheet=qs->value("StyleSheet", "none").toString();
loadStyleSheet(m_config_stylesheet); loadStyleSheet(m_config_stylesheet);
qs->endGroup(); qs->endGroup();
m_uavGadgetInstanceManager = new UAVGadgetInstanceManager(this); m_uavGadgetInstanceManager = new UAVGadgetInstanceManager(this);