2018-05-15 22:14:17 +03:00
|
|
|
#include "designersettingmanager.h"
|
2018-05-24 14:31:10 +03:00
|
|
|
#include <QMessageBox>
|
2018-05-15 22:14:17 +03:00
|
|
|
|
|
|
|
DesignerSettingManager::DesignerSettingManager(QObject *parent) : QObject(parent)
|
|
|
|
{
|
|
|
|
m_setting = new QSettings("LimeReport",QCoreApplication::applicationName());
|
|
|
|
}
|
|
|
|
|
|
|
|
DesignerSettingManager::~DesignerSettingManager()
|
|
|
|
{
|
|
|
|
delete m_setting;
|
|
|
|
}
|
|
|
|
|
2019-06-11 21:28:58 +03:00
|
|
|
void DesignerSettingManager::getAvailableLanguages(QList<QLocale::Language>* languages)
|
2018-05-15 22:14:17 +03:00
|
|
|
{
|
|
|
|
languages->append(QLocale::Russian);
|
|
|
|
languages->append(QLocale::English);
|
2019-07-09 12:35:36 +03:00
|
|
|
// languages->append(QLocale::Arabic);
|
2018-05-22 00:24:38 +03:00
|
|
|
languages->append(QLocale::French);
|
|
|
|
languages->append(QLocale::Chinese);
|
2019-05-29 22:56:27 +03:00
|
|
|
languages->append(QLocale::Spanish);
|
2019-07-09 12:35:36 +03:00
|
|
|
languages->append(QLocale::Polish);
|
2018-05-15 22:14:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
QLocale::Language DesignerSettingManager::getCurrentDefaultLanguage()
|
|
|
|
{
|
|
|
|
m_setting->beginGroup("ReportDesigner");
|
|
|
|
QVariant v = m_setting->value("DesignerLanguage");
|
|
|
|
m_setting->endGroup();
|
|
|
|
if (v.isValid()){
|
|
|
|
return static_cast<QLocale::Language>(v.toInt()) ;
|
|
|
|
} else {
|
|
|
|
return QLocale::system().language();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-11 21:28:58 +03:00
|
|
|
void DesignerSettingManager::currentDefaultLanguageChanged(QLocale::Language language)
|
2018-05-15 22:14:17 +03:00
|
|
|
{
|
2018-05-24 14:31:10 +03:00
|
|
|
QMessageBox::information(0, tr("Warning") , tr("The language will change after the application is restarted"));
|
2018-05-15 22:14:17 +03:00
|
|
|
m_setting->beginGroup("ReportDesigner");
|
|
|
|
m_setting->setValue("DesignerLanguage", (int)language);
|
|
|
|
m_setting->endGroup();
|
|
|
|
}
|