1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +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>
<Details>Default configuration built to work on all screen sizes</Details>
<ExpertMode>false</ExpertMode>
<OverrideLanguage>en_AU</OverrideLanguage>
<OverrideLanguage>en_US</OverrideLanguage>
<SaveSettingsOnExit>true</SaveSettingsOnExit>
<SettingsWindowHeight>700</SettingsWindowHeight>
<SettingsWindowWidth>800</SettingsWindowWidth>

View File

@ -8,6 +8,7 @@
<SaveSettingsOnExit>true</SaveSettingsOnExit>
<SettingsWindowHeight>700</SettingsWindowHeight>
<SettingsWindowWidth>800</SettingsWindowWidth>
<OverrideLanguage>en_US</OverrideLanguage>
<UDPMirror>false</UDPMirror>
<Description>Wide configuration</Description>
<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
QApplication::setAttribute(Qt::AA_X11InitThreads, true);
#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");
SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv);

View File

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

View File

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

View File

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