2016-02-18 21:11:59 +03:00
|
|
|
#include "lrsettingdialog.h"
|
|
|
|
#include "ui_lrsettingdialog.h"
|
2017-12-11 16:48:00 +03:00
|
|
|
#include <QFile>
|
2016-02-18 21:11:59 +03:00
|
|
|
|
2016-03-03 03:08:36 +03:00
|
|
|
namespace LimeReport{
|
|
|
|
|
2016-02-18 21:11:59 +03:00
|
|
|
SettingDialog::SettingDialog(QWidget *parent) :
|
|
|
|
QDialog(parent),
|
|
|
|
ui(new Ui::SettingDialog)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2017-12-11 16:48:00 +03:00
|
|
|
QFile theme(":/qdarkstyle/style.qss");
|
|
|
|
if (!theme.exists()){
|
|
|
|
ui->cbbUseDarkTheme->setVisible(false);
|
|
|
|
}
|
2016-02-18 21:11:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
SettingDialog::~SettingDialog()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
int SettingDialog::verticalGridStep()
|
|
|
|
{
|
|
|
|
return ui->verticalGridStep->value();
|
|
|
|
}
|
|
|
|
|
|
|
|
int SettingDialog::horizontalGridStep()
|
|
|
|
{
|
|
|
|
return ui->horizontalGridStep->value();
|
|
|
|
}
|
|
|
|
|
|
|
|
QFont SettingDialog::defaultFont()
|
|
|
|
{
|
|
|
|
QFont result = ui->defaultFont->currentFont();
|
|
|
|
result.setPointSize(ui->defaultFontSize->value());
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-12-11 16:48:00 +03:00
|
|
|
bool SettingDialog::userDarkTheme()
|
|
|
|
{
|
|
|
|
return ui->cbbUseDarkTheme->isChecked();
|
|
|
|
}
|
|
|
|
|
2016-06-24 23:10:47 +03:00
|
|
|
bool SettingDialog::suppressAbsentFieldsAndVarsWarnings()
|
|
|
|
{
|
|
|
|
return ui->cbSuppressWarnings->isChecked();
|
|
|
|
}
|
|
|
|
|
2018-04-10 16:28:48 +03:00
|
|
|
QLocale::Language SettingDialog::designerLanguage()
|
|
|
|
{
|
2018-05-15 22:14:17 +03:00
|
|
|
foreach (QLocale::Language language, m_aviableLanguages) {
|
2018-04-10 16:28:48 +03:00
|
|
|
if (ui->designerLanguage->currentText().compare(QLocale::languageToString(language)) == 0)
|
|
|
|
return language;
|
|
|
|
}
|
|
|
|
return QLocale().language();
|
|
|
|
}
|
|
|
|
|
2016-06-24 23:10:47 +03:00
|
|
|
void SettingDialog::setSuppressAbsentFieldsAndVarsWarnings(bool value){
|
|
|
|
ui->cbSuppressWarnings->setChecked(value);
|
|
|
|
}
|
|
|
|
|
2016-02-18 21:11:59 +03:00
|
|
|
void SettingDialog::setHorizontalGridStep(int value)
|
|
|
|
{
|
|
|
|
ui->horizontalGridStep->setValue(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingDialog::setVerticalGridStep(int value)
|
|
|
|
{
|
|
|
|
ui->verticalGridStep->setValue(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingDialog::setDefaultFont(const QFont &value)
|
|
|
|
{
|
|
|
|
ui->defaultFont->setCurrentFont(value);
|
|
|
|
ui->defaultFontSize->setValue(value.pointSize());
|
|
|
|
}
|
2016-03-03 03:08:36 +03:00
|
|
|
|
2017-12-11 16:48:00 +03:00
|
|
|
void SettingDialog::setUseDarkTheme(bool value)
|
|
|
|
{
|
|
|
|
ui->cbbUseDarkTheme->setChecked(value);
|
|
|
|
}
|
|
|
|
|
2018-05-15 22:14:17 +03:00
|
|
|
void SettingDialog::setDesignerLanguages(QList<QLocale::Language> languages, QLocale::Language currentLanguage)
|
2018-04-10 16:28:48 +03:00
|
|
|
{
|
2018-05-15 22:14:17 +03:00
|
|
|
m_aviableLanguages = languages;
|
|
|
|
m_currentLanguage = currentLanguage;
|
|
|
|
|
|
|
|
if (languages.isEmpty()) {
|
|
|
|
ui->designerLanguage->setVisible(false);
|
|
|
|
ui->lblLanguage->setVisible(false);
|
|
|
|
return;
|
|
|
|
}
|
2018-04-10 16:28:48 +03:00
|
|
|
ui->designerLanguage->addItem(QLocale::languageToString(currentLanguage));
|
2018-05-15 22:14:17 +03:00
|
|
|
foreach (QLocale::Language language, languages) {
|
2018-04-10 16:28:48 +03:00
|
|
|
if (language != currentLanguage)
|
|
|
|
ui->designerLanguage->addItem(QLocale::languageToString(language));
|
|
|
|
}
|
2018-12-11 20:04:44 +03:00
|
|
|
#ifdef HAVE_QT4
|
|
|
|
ui->designerLanguage->setCurrentIndex(ui->designerLanguage->findText(QLocale::languageToString(currentLanguage)));
|
|
|
|
#else
|
2018-05-15 22:14:17 +03:00
|
|
|
ui->designerLanguage->setCurrentText(QLocale::languageToString(currentLanguage));
|
2018-12-11 20:04:44 +03:00
|
|
|
#endif
|
2018-04-10 16:28:48 +03:00
|
|
|
}
|
|
|
|
|
2016-03-03 03:08:36 +03:00
|
|
|
} // namespace LimeReport
|