NCL Composer  0.1.5
 All Classes Functions Variables Pages
GeneralPreferences.cpp
1 /* Copyright (c) 2011-2012 Telemidia/PUC-Rio.
2  * All rights reserved. This program and the accompanying materials
3  * are made available under the terms of the Eclipse Public License v1.0
4  * which accompanies this distribution, and is available at
5  * http://www.eclipse.org/legal/epl-v10.html
6  *
7  * Contributors:
8  * Telemidia/PUC-Rio - initial API and implementation
9  */
10 #include "GeneralPreferences.h"
11 #include "ui_GeneralPreferences.h"
12 
13 #include <core/util/ComposerSettings.h>
14 using namespace composer::core::util;
15 
16 #include <QLocale>
17 
18 namespace composer {
19  namespace gui {
20 
21 GeneralPreferences::GeneralPreferences(QWidget *parent)
22  : ui(new Ui::GeneralPreferences), IPreferencesPage(parent)
23 {
24  ui->setupUi(this);
25  GlobalSettings settings;
26  settings.beginGroup("languages");
27  QStringList list = settings.value("supportedLanguages").toStringList();
28 
29  foreach (QString cur, list)
30  {
31  QLocale locale(cur);
32 
33  ui->comboBox->insertItem(ui->comboBox->count(),
34  QLocale::languageToString(locale.language()),
35  cur);
36  }
37 
38  QString current = settings.value("currentLanguage").toString();
39  int index = list.indexOf(current);
40  if(index >= 0)
41  ui->comboBox->setCurrentIndex(index);
42  settings.endGroup();
43 
44 
45  QString currentQss = settings.value("default_stylesheets_dirs").toString();
46  fileChooser = new FileChooser(tr("QSS File Theme:"),
47  FileChooser::GET_EXISTINGDIRECTORY,
48  "", "", this);
49 
50  fileChooser->setText(currentQss);
51  ui->formLayout->setWidget( 6, QFormLayout::FieldRole, fileChooser);
52 }
53 
55 {
56 
57 }
58 
60 {
61  GlobalSettings settings;
62  settings.beginGroup("languages");
63  settings.setValue("currentLanguage",
64  ui->comboBox->itemData(ui->comboBox->currentIndex())
65  .toString());
66  settings.endGroup();
67 
68  settings.setValue("default_stylesheets_dirs", fileChooser->getText());
69 }
70 
72 {
73 
74 }
75 
76 }} //end namespace