Cherry-picked upstream versuib 0.9.0+20150923

Switched to experimental because of LXQt namespace change
Added minimum version for liblxqt0 (>= 0.9.0+2015..)
ubuntu/cosmic debian/0.9.0+20150923-1
Alf Gaida 9 years ago
parent 9511fa5de8
commit ea511f9628

@ -30,6 +30,7 @@ add_subdirectory(lxqt-config-input)
add_subdirectory(lxqt-config-file-associations) add_subdirectory(lxqt-config-file-associations)
add_subdirectory(lxqt-config-appearance) add_subdirectory(lxqt-config-appearance)
add_subdirectory(lxqt-config-monitor) add_subdirectory(lxqt-config-monitor)
add_subdirectory(lxqt-config-locale)
# building tarball with CPack ------------------------------------------------- # building tarball with CPack -------------------------------------------------
include(InstallRequiredSystemLibraries) include(InstallRequiredSystemLibraries)

38
debian/changelog vendored

@ -1,38 +1,38 @@
lxqt-config (0.9.0+20150829-1) unstable; urgency=medium lxqt-config (0.9.0+20150923-1) experimental; urgency=medium
* Cherry-picked upstream 0.9.0+20150829 * Cherry-picked upstream versuib 0.9.0+20150923
* Removed debian/patches, fixed upstream * Removed debian/patches, fixed upstream
* .gitignore fixed * Fixed .gitignore
* Fixed and sorted copyright * Fixed and sorted copyright
* cme fix dpkg-control * Beautifyed dpkg-control
* Fixed spelling in lintian-overrides * Fixed spelling in lintian-overrides
* Added upstream signing key and use it in watch file * Added upstream signing key and use it in watch file
* Switched to experimental because of LXQt namespace change
* Added minimum version for liblxqt0-dev (>= 0.9.0+20150911)
-- Alf Gaida <agaida@siduction.org> Wed, 02 Sep 2015 20:00:35 +0200 -- Alf Gaida <agaida@siduction.org> Thu, 24 Sep 2015 00:56:46 +0200
lxqt-config (0.9.0+20150806-1) unstable; urgency=medium lxqt-config (0.9.0+20150806-1) unstable; urgency=medium
[ Alf Gaida ] [ Alf Gaida ]
* Initial release. (Closes: #747597) * Initial release. (Closes: #747597)
* added watch file. * Added watch file.
* Imported Upstream version 0.8.0. * Imported Upstream version 0.8.0.
* bump standards to 3.9.6. * Bump standards to 3.9.6.
* drop build dependency libegl1-mesa-dev, bug in Qt 5.3.0 is fixed. * Drop build dependency libegl1-mesa-dev, bug in Qt 5.3.0 is fixed.
* Min Qt version 5.3.2. * Min Qt version 5.3.2.
* Min liblxqt-qt5-0-dev version 0.8.0. * Min liblxqt-qt5-0-dev version 0.8.0.
* mangled symbols added. * Mangled symbols added.
* lintian-overrides added. * Added intian-overrides.
* patch some desktop files. * Patch some desktop files.
* new release 0.9.0 drop not needed patches cleanup debian $foo add * New release 0.9.0 drop not needed patches cleanup debian $foo add
source/options. source/options.
* Some cleanup in debian $foo. * Some cleanup in debian $foo.
* removed breaks and replaces. * Removed breaks and replaces.
* fixes in copyright. * Fixes in copyright.
* removed debian/symbols. * Removed debian/symbols.
* add link --as-needed to rules to avoid warnings at build time. * Added link --as-needed to rules to avoid warnings at build time.
* licenses hopefully fixed. * Fixed licenses.
* breaks and replaces removed.
* rules improved, link --as-needed not used symbols removed.
[ Andrew Lee (李健秋) ] [ Andrew Lee (李健秋) ]
* Merging upstream version 0.9.0+20150806. * Merging upstream version 0.9.0+20150806.

2
debian/control vendored

@ -9,7 +9,7 @@ Priority: optional
Build-Depends: cmake (>= 3.0.2), Build-Depends: cmake (>= 3.0.2),
debhelper (>= 9), debhelper (>= 9),
libkf5windowsystem-dev, libkf5windowsystem-dev,
liblxqt0-dev, liblxqt0-dev (>= 0.9.0+20150911),
libqt5svg5-dev, libqt5svg5-dev,
libqt5x11extras5-dev, libqt5x11extras5-dev,
libqt5xdg-dev, libqt5xdg-dev,

@ -2,12 +2,16 @@
lxqt-config: binary-without-manpage usr/bin/lxqt-config-appearance lxqt-config: binary-without-manpage usr/bin/lxqt-config-appearance
lxqt-config: binary-without-manpage usr/bin/lxqt-config-file-associations lxqt-config: binary-without-manpage usr/bin/lxqt-config-file-associations
lxqt-config: binary-without-manpage usr/bin/lxqt-config-input lxqt-config: binary-without-manpage usr/bin/lxqt-config-input
lxqt-config: binary-without-manpage usr/bin/lxqt-config-locale
lxqt-config: binary-without-manpage usr/bin/lxqt-config-monitor lxqt-config: binary-without-manpage usr/bin/lxqt-config-monitor
lxqt-config: binary-without-manpage usr/bin/lxqt-config lxqt-config: binary-without-manpage usr/bin/lxqt-config
# not a bug, LXQt has not reached free-desktop yet # not a bug, LXQt has not reached free-desktop yet
lxqt-config: desktop-entry-invalid-category LXQt usr/share/applications/lxqt-config-appearance.desktop lxqt-config: desktop-entry-invalid-category LXQt usr/share/applications/lxqt-config-appearance.desktop
lxqt-config: desktop-entry-invalid-category LXQt usr/share/applications/lxqt-config-file-associations.desktop lxqt-config: desktop-entry-invalid-category LXQt usr/share/applications/lxqt-config-file-associations.desktop
lxqt-config: desktop-entry-invalid-category LXQt usr/share/applications/lxqt-config-input.desktop lxqt-config: desktop-entry-invalid-category LXQt usr/share/applications/lxqt-config-input.desktop
lxqt-config: desktop-entry-invalid-category LXQt usr/share/applications/lxqt-config-locale.desktop
lxqt-config: desktop-entry-invalid-category LXQt usr/share/applications/lxqt-config-monitor.desktop lxqt-config: desktop-entry-invalid-category LXQt usr/share/applications/lxqt-config-monitor.desktop
lxqt-config: desktop-entry-invalid-category LXQt usr/share/applications/lxqt-config.desktop lxqt-config: desktop-entry-invalid-category LXQt usr/share/applications/lxqt-config.desktop

@ -6,6 +6,6 @@ Comment=Appearance settings for LXQt
Exec=lxqt-config-appearance Exec=lxqt-config-appearance
Icon=preferences-desktop-theme Icon=preferences-desktop-theme
Categories=Settings;DesktopSettings;Qt;LXQt; Categories=Settings;DesktopSettings;Qt;LXQt;
OnlyShowIn=LXDE;LXQt; OnlyShowIn=LXQt;
#TRANSLATIONS_DIR=translations #TRANSLATIONS_DIR=translations

@ -6,6 +6,6 @@ Comment=Configure applications associated with known file types
Exec=lxqt-config-file-associations Exec=lxqt-config-file-associations
Icon=preferences-desktop-filetype-association Icon=preferences-desktop-filetype-association
Categories=Settings;DesktopSettings;Qt;LXQt; Categories=Settings;DesktopSettings;Qt;LXQt;
OnlyShowIn=LXDE;LXQt; OnlyShowIn=LXQt;
#TRANSLATIONS_DIR=translations #TRANSLATIONS_DIR=translations

@ -44,7 +44,8 @@ KeyboardConfig::KeyboardConfig(LXQt::Settings* _settings, QSettings* _qtSettings
interval(30), interval(30),
oldInterval(30), oldInterval(30),
beep(true), beep(true),
oldBeep(true) { oldBeep(true),
numlock(false) {
ui.setupUi(this); ui.setupUi(this);
@ -58,6 +59,7 @@ KeyboardConfig::KeyboardConfig(LXQt::Settings* _settings, QSettings* _qtSettings
connect(ui.keyboardInterval, SIGNAL(valueChanged(int)), SLOT(onKeyboardSliderChanged(int))); connect(ui.keyboardInterval, SIGNAL(valueChanged(int)), SLOT(onKeyboardSliderChanged(int)));
connect(ui.keyboardBeep, SIGNAL(toggled(bool)), SLOT(onKeyboardBeepToggled(bool))); connect(ui.keyboardBeep, SIGNAL(toggled(bool)), SLOT(onKeyboardBeepToggled(bool)));
connect(ui.cursorFlashTime, SIGNAL(valueChanged(int)), SLOT(onCorsorFlashTimeChanged(int))); connect(ui.cursorFlashTime, SIGNAL(valueChanged(int)), SLOT(onCorsorFlashTimeChanged(int)));
connect(ui.keyboardNumLock, SIGNAL(toggled(bool)), SLOT(onKeyboardNumLockToggled(bool)));
} }
KeyboardConfig::~KeyboardConfig() { KeyboardConfig::~KeyboardConfig() {
@ -68,6 +70,7 @@ void KeyboardConfig::initControls() {
ui.keyboardDelay->setValue(delay); ui.keyboardDelay->setValue(delay);
ui.keyboardInterval->setValue(interval); ui.keyboardInterval->setValue(interval);
ui.keyboardBeep->setChecked(beep); ui.keyboardBeep->setChecked(beep);
ui.keyboardNumLock->setChecked(numlock);
qtSettings->beginGroup(QLatin1String("Qt")); qtSettings->beginGroup(QLatin1String("Qt"));
int value = qtSettings->value(QLatin1String("cursorFlashTime"), 1000).toInt(); int value = qtSettings->value(QLatin1String("cursorFlashTime"), 1000).toInt();
@ -98,6 +101,11 @@ void KeyboardConfig::onKeyboardBeepToggled(bool checked) {
accept(); accept();
} }
void KeyboardConfig::onKeyboardNumLockToggled(bool checked) {
numlock = checked;
accept();
}
void KeyboardConfig::onCorsorFlashTimeChanged(int value) void KeyboardConfig::onCorsorFlashTimeChanged(int value)
{ {
qtSettings->beginGroup(QLatin1String("Qt")); qtSettings->beginGroup(QLatin1String("Qt"));
@ -115,6 +123,7 @@ void KeyboardConfig::loadSettings() {
oldDelay = delay = settings->value("delay", 500).toInt(); oldDelay = delay = settings->value("delay", 500).toInt();
oldInterval = interval = settings->value("interval", 30).toInt(); oldInterval = interval = settings->value("interval", 30).toInt();
oldBeep = beep = settings->value("beep", true).toBool(); oldBeep = beep = settings->value("beep", true).toBool();
numlock = settings->value("numlock", false).toBool();
settings->endGroup(); settings->endGroup();
} }
@ -123,6 +132,7 @@ void KeyboardConfig::accept() {
settings->setValue("delay", delay); settings->setValue("delay", delay);
settings->setValue("interval", interval); settings->setValue("interval", interval);
settings->setValue("beep", beep); settings->setValue("beep", beep);
settings->setValue("numlock", numlock);
settings->endGroup(); settings->endGroup();
} }

@ -49,6 +49,7 @@ private Q_SLOTS:
void onKeyboardSliderChanged(int value); void onKeyboardSliderChanged(int value);
void onKeyboardBeepToggled(bool checked); void onKeyboardBeepToggled(bool checked);
void onCorsorFlashTimeChanged(int value); void onCorsorFlashTimeChanged(int value);
void onKeyboardNumLockToggled(bool checked);
private: private:
Ui::KeyboardConfig ui; Ui::KeyboardConfig ui;
@ -60,6 +61,7 @@ private:
int oldInterval; int oldInterval;
bool beep; bool beep;
bool oldBeep; bool oldBeep;
bool numlock;
}; };
#endif // KEYBOARDCONFIG_H #endif // KEYBOARDCONFIG_H

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>375</width> <width>375</width>
<height>232</height> <height>276</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -161,6 +161,13 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="keyboardNumLock">
<property name="text">
<string>Turn on NumLock after login</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>

@ -6,6 +6,6 @@ Comment=Configure keyboard, mouse, and other input devices
Exec=lxqt-config-input Exec=lxqt-config-input
Icon=input-keyboard Icon=input-keyboard
Categories=Qt;Settings;HardwareSettings;DesktopSettings;LXQt; Categories=Qt;Settings;HardwareSettings;DesktopSettings;LXQt;
OnlyShowIn=LXDE;LXQt; OnlyShowIn=LXQt;
#TRANSLATIONS_DIR=translations #TRANSLATIONS_DIR=translations

@ -0,0 +1,58 @@
project(lxqt-config-locale)
set(H_FILES
localeconfig.h
)
set(CPP_FILES
main.cpp
localeconfig.cpp
)
set(UI_FILES
localeconfig.ui
)
# Translations **********************************
lxqt_translate_ts(QM_FILES
UPDATE_TRANSLATIONS
${UPDATE_TRANSLATIONS}
SOURCES
${H_FILES}
${CPP_FILES}
${UI_FILES}
INSTALL_DIR
"${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}"
)
lxqt_app_translation_loader(QM_LOADER ${PROJECT_NAME})
lxqt_translate_desktop(DESKTOP_FILES SOURCES ${PROJECT_NAME}.desktop.in)
#************************************************
add_executable(${PROJECT_NAME}
${CPP_FILES}
${RESOURCES}
${QRC_SOURCES}
${QM_FILES}
${DESKTOP_FILES}
${QM_LOADER}
)
target_link_libraries(${PROJECT_NAME}
Qt5::Widgets
Qt5::Xml
lxqt
)
install(TARGETS
${PROJECT_NAME}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT Runtime
)
install(FILES
${DESKTOP_FILES}
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications"
COMPONENT Runtime
)

@ -0,0 +1,452 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)GPL2+
*
*
* Copyright: 2014 LXQt team
* 2014 Sebastian Kügler <sebas@kde.org>
* Authors:
* Julien Lavergne <gilir@ubuntu.com>
* Sebastian Kügler <sebas@kde.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*
* END_COMMON_COPYRIGHT_HEADER
*
* Based on plasma-desktop/kcms/formats module
*/
#include "localeconfig.h"
#include "ui_localeconfig.h"
#include <QApplication>
#include <QComboBox>
#include <QFile>
#include <QDebug>
#include <QLocale>
#include <QStandardPaths>
#include <QTextStream>
#include <QTextCodec>
#include <QDateTime>
#include <QMessageBox>
const static QString lcLang = QStringLiteral("LANG");
const static QString lcNumeric = QStringLiteral("LC_NUMERIC");
const static QString lcTime = QStringLiteral("LC_TIME");
const static QString lcMonetary = QStringLiteral("LC_MONETARY");
const static QString lcMeasurement = QStringLiteral("LC_MEASUREMENT");
const static QString lcCollate = QStringLiteral("LC_COLLATE");
const static QString lcCtype = QStringLiteral("LC_CTYPE");
const static QString lcLanguage = QStringLiteral("LANGUAGE");
LocaleConfig::LocaleConfig(LXQt::Settings* settings, LXQt::Settings* session_settings, QWidget* parent) :
QWidget(parent),
m_ui(new Ui::LocaleConfig),
hasChanged(new bool),
mSettings(settings),
sSettings(session_settings)
{
m_ui->setupUi(this);
m_combos << m_ui->comboGlobal
<< m_ui->comboNumbers
<< m_ui->comboTime
<< m_ui->comboCurrency
<< m_ui->comboMeasurement
<< m_ui->comboCollate;
hasChanged = false;
initControls();
}
LocaleConfig::~LocaleConfig()
{
delete m_ui;
}
bool countryLessThan(const QLocale & c1, const QLocale & c2)
{
return QString::localeAwareCompare(c1.nativeCountryName(), c2.nativeCountryName()) < 0;
}
void LocaleConfig::load()
{
QList<QLocale> allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry);
qSort(allLocales.begin(), allLocales.end(), countryLessThan);
foreach(QComboBox * combo, m_combos)
{
initCombo(combo, allLocales);
}
readConfig();
foreach(QComboBox * combo, m_combos)
{
connectCombo(combo);
}
connect(m_ui->checkDetailed, &QAbstractButton::toggled, [ = ]()
{
updateExample();
updateEnabled();
hasChanged = true;
});
updateEnabled();
updateExample();
hasChanged = false;
}
void LocaleConfig::initCombo(QComboBox *combo, const QList<QLocale> & allLocales)
{
combo->clear();
const QString clabel = tr("No change");
combo->setInsertPolicy(QComboBox::InsertAlphabetically);
combo->addItem(clabel, QString());
foreach(const QLocale & l, allLocales)
{
addLocaleToCombo(combo, l);
}
}
void LocaleConfig::connectCombo(QComboBox *combo)
{
connect(combo, &QComboBox::currentTextChanged, [ = ]()
{
hasChanged = true;
updateExample();
});
}
void LocaleConfig::addLocaleToCombo(QComboBox *combo, const QLocale &locale)
{
const QString clabel = !locale.nativeCountryName().isEmpty() ? locale.nativeCountryName() : locale.countryToString(locale.country());
// This needs to use name() rather than bcp47name() or later on the export will generate a non-sense locale (e.g. "it" instead of
// "it_IT")
// TODO: Properly handle scripts (@foo)
QString cvalue = locale.name();
if (!cvalue.contains('.'))
{ // explicitely add the encoding, otherwise Qt doesn't accept dead keys and garbles the output as well
cvalue.append(QLatin1Char('.') + QTextCodec::codecForLocale()->name());
}
QString flagcode;
const QStringList split = locale.name().split('_');
if (split.count() > 1)
{
flagcode = split[1].toLower();
}
/* TODO Find a better place for flags ... */
QString flag(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kf5/locale/countries/%1/flag.png").arg(flagcode)));
QIcon flagIcon;
if (!flag.isEmpty())
{
flagIcon = QIcon(flag);
}
QString itemResult;
itemResult = QString("%1 - %2 (%3)")
.arg(clabel)
.arg(locale.nativeLanguageName())
.arg(locale.name());
combo->addItem(flagIcon, itemResult, cvalue);
}
void setCombo(QComboBox *combo, const QString &key)
{
const int ix = combo->findData(key);
if (ix > -1)
{
combo->setCurrentIndex(ix);
}
}
void LocaleConfig::readConfig()
{
mSettings->beginGroup("Formats");
bool useDetailed = mSettings->value("useDetailed", false).toBool();
m_ui->checkDetailed->setChecked(useDetailed);
setCombo(m_ui->comboGlobal, mSettings->value(lcLang, qgetenv(lcLang.toLatin1())).toString());
setCombo(m_ui->comboNumbers, mSettings->value(lcNumeric, qgetenv(lcNumeric.toLatin1())).toString());
setCombo(m_ui->comboTime, mSettings->value(lcTime, qgetenv(lcTime.toLatin1())).toString());
setCombo(m_ui->comboCollate, mSettings->value(lcCollate, qgetenv(lcCollate.toLatin1())).toString());
setCombo(m_ui->comboCurrency, mSettings->value(lcMonetary, qgetenv(lcMonetary.toLatin1())).toString());
setCombo(m_ui->comboMeasurement, mSettings->value(lcMeasurement, qgetenv(lcMeasurement.toLatin1())).toString());
updateEnabled();
mSettings->endGroup();
}
void LocaleConfig::writeConfig()
{
mSettings->beginGroup("Formats");
// global ends up empty here when OK button is clicked from kcmshell5,
// apparently the data in the combo is gone by the time save() is called.
// This might be a problem in KCModule, but does not directly affect us
// since within systemsettings, it works fine.
// See https://bugs.kde.org/show_bug.cgi?id=334624
if (m_ui->comboGlobal->count() == 0)
{
qWarning() << "Couldn't read data from UI, writing configuration failed.";
return;
}
const QString global = m_ui->comboGlobal->currentData().toString();
if (!m_ui->checkDetailed->isChecked())
{
// Global setting, clean up config
mSettings->remove("useDetailed");
if (global.isEmpty())
{
mSettings->remove(lcLang);
}
else
{
mSettings->setValue(lcLang, global);
}
mSettings->remove(lcNumeric);
mSettings->remove(lcTime);
mSettings->remove(lcMonetary);
mSettings->remove(lcMeasurement);
mSettings->remove(lcCollate);
mSettings->remove(lcCtype);
}
else
{
// Save detailed settings
mSettings->setValue("useDetailed", true);
if (global.isEmpty())
{
mSettings->remove(lcLang);
}
else
{
mSettings->setValue(lcLang, global);
}
const QString numeric = m_ui->comboNumbers->currentData().toString();
if (numeric.isEmpty())
{
mSettings->remove(lcNumeric);
}
else
{
mSettings->setValue(lcNumeric, numeric);
}
const QString time = m_ui->comboTime->currentData().toString();
if (time.isEmpty())
{
mSettings->remove(lcTime);
}
else
{
mSettings->setValue(lcTime, time);
}
const QString monetary = m_ui->comboCurrency->currentData().toString();
if (monetary.isEmpty())
{
mSettings->remove(lcMonetary);
}
else
{
mSettings->setValue(lcMonetary, monetary);
}
const QString measurement = m_ui->comboMeasurement->currentData().toString();
if (measurement.isEmpty())
{
mSettings->remove(lcMeasurement);
}
else
{
mSettings->setValue(lcMeasurement, measurement);
}
const QString collate = m_ui->comboCollate->currentData().toString();
if (collate.isEmpty())
{
mSettings->remove(lcCollate);
}
else
{
mSettings->setValue(lcCollate, collate);
}
}
mSettings->endGroup();
}
void LocaleConfig::saveSettings()
{
if (hasChanged)
{
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Format Settings Changed"));
msgBox.setText(tr("Save the settings ? (they will take effect the next time you log in)"));
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Cancel);
int ret = msgBox.exec();
if( ret == QMessageBox::Save )
{
writeConfig();
writeExports();
}
}
}
void LocaleConfig::writeExports()
{
sSettings->beginGroup("Environment");
mSettings->beginGroup("Formats");
if (!mSettings->value(lcLang).toString().isNull())
{
sSettings->setValue(lcLang, mSettings->value(lcLang).toString());
if (mSettings->value("useDetailed").toBool())
{
if (!mSettings->value(lcNumeric).toString().isNull())
{
sSettings->setValue(lcNumeric, mSettings->value(lcNumeric).toString());
}
if (!mSettings->value(lcTime).toString().isNull())
{
sSettings->setValue(lcTime, mSettings->value(lcTime).toString());
}
if (!mSettings->value(lcCollate).toString().isNull())
{
sSettings->setValue(lcCollate, mSettings->value(lcCollate).toString());
}
if (!mSettings->value(lcMonetary).toString().isNull())
{
sSettings->setValue(lcMonetary, mSettings->value(lcMonetary).toString());
}
if (!mSettings->value(lcMeasurement).toString().isNull())
{
sSettings->setValue(lcMeasurement, mSettings->value(lcMeasurement).toString());
}
}
else
{
sSettings->setValue(lcNumeric, mSettings->value(lcLang).toString());
sSettings->setValue(lcTime, mSettings->value(lcLang).toString());
sSettings->setValue(lcCollate, mSettings->value(lcLang).toString());
sSettings->setValue(lcMonetary, mSettings->value(lcLang).toString());
sSettings->setValue(lcMeasurement, mSettings->value(lcLang).toString());
}
}
mSettings->endGroup();
sSettings->endGroup();
sSettings->sync();
}
void LocaleConfig::defaults()
{
m_ui->checkDetailed->setChecked(false);
// restore user defaults from env vars
setCombo(m_ui->comboGlobal, qgetenv(lcLang.toLatin1()));
setCombo(m_ui->comboNumbers, qgetenv(lcNumeric.toLatin1()));
setCombo(m_ui->comboTime, qgetenv(lcTime.toLatin1()));
setCombo(m_ui->comboCollate, qgetenv(lcCollate.toLatin1()));
setCombo(m_ui->comboCurrency, qgetenv(lcMonetary.toLatin1()));
setCombo(m_ui->comboMeasurement, qgetenv(lcMeasurement.toLatin1()));
updateEnabled();
}
void LocaleConfig::updateEnabled()
{
const bool enabled = m_ui->checkDetailed->isChecked();
m_ui->labelNumbers->setEnabled(enabled);
m_ui->labelTime->setEnabled(enabled);
m_ui->labelCurrency->setEnabled(enabled);
m_ui->labelMeasurement->setEnabled(enabled);
m_ui->labelCollate->setEnabled(enabled);
m_ui->comboNumbers->setEnabled(enabled);
m_ui->comboTime->setEnabled(enabled);
m_ui->comboCurrency->setEnabled(enabled);
m_ui->comboMeasurement->setEnabled(enabled);
m_ui->comboCollate->setEnabled(enabled);
}
void LocaleConfig::updateExample()
{
const bool useDetailed = m_ui->checkDetailed->isChecked();
QLocale nloc;
QLocale tloc;
QLocale cloc;
QLocale mloc;
if (useDetailed)
{
nloc = QLocale(m_ui->comboNumbers->currentData().toString());
tloc = QLocale(m_ui->comboTime->currentData().toString());
cloc = QLocale(m_ui->comboCurrency->currentData().toString());
mloc = QLocale(m_ui->comboMeasurement->currentData().toString());
}
else
{
nloc = QLocale(m_ui->comboGlobal->currentData().toString());
tloc = QLocale(m_ui->comboGlobal->currentData().toString());
cloc = QLocale(m_ui->comboGlobal->currentData().toString());
mloc = QLocale(m_ui->comboGlobal->currentData().toString());
}
const QString numberExample = nloc.toString(1000.01);
const QString timeExample = tloc.toString(QDateTime::currentDateTime());
const QString currencyExample = cloc.toCurrencyString(24);
QString measurementSetting;
if (mloc.measurementSystem() == QLocale::ImperialUKSystem)
{
measurementSetting = tr("Imperial UK");
}
else if (mloc.measurementSystem() == QLocale::ImperialUSSystem)
{
measurementSetting = tr("Imperial US");
}
else
{
measurementSetting = tr("Metric");
}
m_ui->exampleNumbers->setText(numberExample);
m_ui->exampleTime->setText(timeExample);
m_ui->exampleCurrency->setText(currencyExample);
m_ui->exampleMeasurement->setText(measurementSetting);
}
void LocaleConfig::initControls()
{
defaults();
load();
hasChanged = false;
}

@ -0,0 +1,79 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)GPL2+
*
*
* Copyright: 2014 LXQt team
* 2014 Sebastian Kügler <sebas@kde.org>
* Authors:
* Julien Lavergne <gilir@ubuntu.com>
* Sebastian Kügler <sebas@kde.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef LOCALECONFIG_H
#define LOCALECONFIG_H
#include <QWidget>
#include <LXQt/Settings>
class QTreeWidgetItem;
class QSettings;
namespace Ui {
class LocaleConfig;
}
class QComboBox;
class QMessageWidget;
class LocaleConfig : public QWidget
{
Q_OBJECT
public:
explicit LocaleConfig(LXQt::Settings *settings, LXQt::Settings *session_settings, QWidget *parent = 0);
~LocaleConfig();
void load();
void save();
void defaults();
public slots:
void initControls();
void saveSettings();
private:
void addLocaleToCombo(QComboBox *combo, const QLocale &locale);
void initCombo(QComboBox *combo, const QList<QLocale> &allLocales);
void connectCombo(QComboBox *combo);
QList<QComboBox *> m_combos;
void readConfig();
void writeConfig();
void writeExports();
void updateExample();
void updateEnabled();
Ui::LocaleConfig *m_ui;
bool hasChanged;
LXQt::Settings *mSettings;
LXQt::Settings *sSettings;
};
#endif // LOCALECONFIG_H

@ -0,0 +1,385 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Sebastian Kuegler</author>
<class>LocaleConfig</class>
<widget class="QWidget" name="LocaleConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>450</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Re&amp;gion:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>comboGlobal</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboGlobal">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkDetailed">
<property name="text">
<string>De&amp;tailed Settings</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelNumbers">
<property name="text">
<string>&amp;Numbers:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>comboNumbers</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboNumbers">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelTime">
<property name="text">
<string>&amp;Time:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>comboTime</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboTime">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelCurrency">
<property name="text">
<string>Currenc&amp;y:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>comboCurrency</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="comboCurrency">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelMeasurement">
<property name="text">
<string>Measurement &amp;Units:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>comboMeasurement</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboMeasurement">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="labelCollate">
<property name="text">
<string>Co&amp;llation and Sorting:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>comboCollate</cstring>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="comboCollate">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="labelMeasurement_2">
<property name="text">
<string>&lt;b&gt;Examples&lt;/b&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="lexNumbers">
<property name="text">
<string>Numbers:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="exampleNumbers">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="lexTime">
<property name="text">
<string>Time:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLabel" name="exampleTime">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="lexCurrency">
<property name="text">
<string>Currency:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLabel" name="exampleCurrency">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="lexMeasurement_2">
<property name="text">
<string>Measurement Units:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QLabel" name="exampleMeasurement">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>32</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Name=Locale
GenericName=Locale settings
Comment=Locale settings for LXQt
Exec=lxqt-config-locale
Icon=preferences-desktop-locale
Categories=Settings;DesktopSettings;Qt;LXQt;
OnlyShowIn=LXQt;
#TRANSLATIONS_DIR=translations

@ -0,0 +1,53 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)GPL2+
*
*
* Copyright: 2014 LXQt team
*
* Authors:
* Julien Lavergne <gilir@ubuntu.com>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*
* END_COMMON_COPYRIGHT_HEADER */
#include <LXQt/SingleApplication>
#include <XdgIcon>
#include <LXQt/Settings>
#include <LXQt/ConfigDialog>
#include "localeconfig.h"
int main (int argc, char **argv)
{
LXQt::SingleApplication app(argc, argv);
LXQt::Settings settings("LXQt-config-locale");
LXQt::Settings session_settings("LXQt-session");
LXQt::ConfigDialog* dialog = new LXQt::ConfigDialog(QObject::tr("LXQt Locale Configuration"), &settings);
app.setActivationWindow(dialog);
LocaleConfig* localePage = new LocaleConfig(&settings, &session_settings, dialog);
dialog->addPage(localePage, QObject::tr("Locale Settings"), QStringList() << "preferences-desktop-locale" << "preferences-desktop");
QObject::connect(dialog, SIGNAL(reset()), localePage, SLOT(initControls()));
QObject::connect(dialog, SIGNAL(save()), localePage, SLOT(saveSettings()));
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setWindowIcon(QIcon::fromTheme("preferences-desktop-locale"));
dialog->show();
return app.exec();
}

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>LocaleConfig</name>
<message>
<location filename="../localeconfig.ui" line="47"/>
<source>Re&amp;gion:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.ui" line="76"/>
<source>De&amp;tailed Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.ui" line="83"/>
<source>&amp;Numbers:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.ui" line="112"/>
<source>&amp;Time:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.ui" line="141"/>
<source>Currenc&amp;y:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.ui" line="170"/>
<source>Measurement &amp;Units:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.ui" line="199"/>
<source>Co&amp;llation and Sorting:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.ui" line="238"/>
<source>&lt;b&gt;Examples&lt;/b&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.ui" line="248"/>
<source>Numbers:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.ui" line="268"/>
<source>Time:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.ui" line="288"/>
<source>Currency:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.ui" line="308"/>
<source>Measurement Units:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.cpp" line="118"/>
<source>No change</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.cpp" line="306"/>
<source>Format Settings Changed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.cpp" line="307"/>
<source>Save the settings ? (they will take effect the next time you log in)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.cpp" line="428"/>
<source>Imperial UK</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.cpp" line="432"/>
<source>Imperial US</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../localeconfig.cpp" line="436"/>
<source>Metric</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../main.cpp" line="38"/>
<source>LXQt Locale Configuration</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.cpp" line="43"/>
<source>Locale Settings</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

@ -6,6 +6,6 @@ Comment=Configure your system
Exec=lxqt-config Exec=lxqt-config
Icon=preferences-system Icon=preferences-system
Categories=Settings;DesktopSettings;Qt;LXQt; Categories=Settings;DesktopSettings;Qt;LXQt;
OnlyShowIn=LXDE;LXQt; OnlyShowIn=LXQt;
#TRANSLATIONS_DIR=translations #TRANSLATIONS_DIR=translations

Loading…
Cancel
Save