Commit cbf2aee6 authored by Martin Straka's avatar Martin Straka

User can set fontsize in the settings

parent dc1316f8
......@@ -75,6 +75,29 @@ Component {
wrapMode: Text.Wrap
}
}
Column {
spacing: 1
Label {
id: fontSizeLabel
color: datovkaPalette.text
width: myWidht
text: qsTr("Font size and scale")
}
Slider {
id: ifontSizeSlider
width: myWidht
minimumValue: 10
stepSize: 1
value: 16
maximumValue: 20
}
Text {
color: datovkaPalette.mid
width: myWidht
text: qsTr("Note: Font size will be changed after application restart.")
wrapMode: Text.Wrap
}
}
Column {
spacing: 1
CheckBox {
......@@ -173,6 +196,7 @@ Component {
iusePinCode.checked = usePinCode
ipinCodeString.text = pinCodeString
languageComboBoxId.currentIndex = langIndex
ifontSizeSlider.value = fontSize
ipinCodeString.visible = usePinCode
}
}
......@@ -186,6 +210,7 @@ Component {
iusePinCode.checked = false
}
settings.updateSettings(sLang,
ifontSizeSlider.value.toString(),
idownloadOnlyNewMsgs.checked,
idownloadCompleteMsgs.checked,
isaveFilesToDb.checked,
......
......@@ -78,10 +78,6 @@ int main(int argc, char *argv[])
app.setOrganizationDomain(APP_ORG_DOMAIN);
app.setApplicationName(APP_NAME);
app.setApplicationVersion(VERSION);
QFont font;
font.setFamily(DEFAULT_FONT_FAMILY);
font.setPointSize(DEFAULT_FONT_SIZE);
app.setFont(font);
/* load global settings */
{
......@@ -90,6 +86,12 @@ int main(int argc, char *argv[])
globSet.loadGlobalSettingsFromFile(settings);
}
/* set font family and font size from settings */
QFont font;
font.setFamily(DEFAULT_FONT_FAMILY);
font.setPointSize(globSet.fontSize);
app.setFont(font);
/* load datovka localization and qtbase localization */
QTranslator datovkaTrans;
QTranslator qtbaseTrans;
......
......@@ -34,6 +34,7 @@ Settings globSet;
Settings::Settings(void)
:
language(LANGUAGE_SYSTEM),
fontSize(DEFAULT_FONT_SIZE),
downloadOnlyNewMsgs(true),
downloadCompleteMsgs(false),
saveFilesToDb(true),
......@@ -61,6 +62,7 @@ void Settings::saveGlobalSettingsToFile(QSettings &settings) const
settings.beginGroup(SETTINGS_GLOBAL_GROUP);
settings.setValue(SETTINGS_LANGUAGE, globSet.language);
settings.setValue(SETTINGS_FONTSIZE, globSet.fontSize);
settings.setValue(SETTINGS_ONLY_NEW_MSGS, globSet.downloadOnlyNewMsgs);
settings.setValue(SETTINGS_COMPLETE_MSG, globSet.downloadCompleteMsgs);
settings.setValue(SETTINGS_SAVE_FILE_DB, globSet.saveFilesToDb);
......@@ -85,6 +87,9 @@ void Settings::loadGlobalSettingsFromFile(const QSettings &settings)
globSet.language = settings.value(
SETTINGS_GLOBAL_GROUP "/" SETTINGS_LANGUAGE,
LANGUAGE_SYSTEM).toString();
globSet.fontSize = settings.value(
SETTINGS_GLOBAL_GROUP "/" SETTINGS_FONTSIZE,
DEFAULT_FONT_SIZE).toInt();
globSet.downloadOnlyNewMsgs = settings.value(
SETTINGS_GLOBAL_GROUP "/" SETTINGS_ONLY_NEW_MSGS, true).toBool();
globSet.downloadCompleteMsgs = settings.value(
......
......@@ -46,6 +46,7 @@
#define SETTINGS_PIN_CODE_STRING "pin_code_string"
#define SETTINGS_LAST_UPDATE "last_update"
#define SETTINGS_LANGUAGE "language"
#define SETTINGS_FONTSIZE "font_size"
/*
......@@ -86,6 +87,7 @@ public:
* @brief Holds global settings data.
*/
QString language;
int fontSize;
bool downloadOnlyNewMsgs;
bool downloadCompleteMsgs;
bool saveFilesToDb;
......
......@@ -69,7 +69,7 @@ void GlobalSettingsQmlWrapper::loadSettings(void)
}
/* Send data to QML */
emit sendSettingsData(langugeComboBoxIndex,
emit sendSettingsData(langugeComboBoxIndex, globSet.fontSize,
globSet.downloadOnlyNewMsgs, globSet.downloadCompleteMsgs,
globSet.saveFilesToDb, globSet.fileLifeTimeInDays,
globSet.usePinCode, globSet.pinCodeString);
......@@ -81,12 +81,13 @@ void GlobalSettingsQmlWrapper::loadSettings(void)
* Slot: Set and save global settings from QML to global structure.
*/
void GlobalSettingsQmlWrapper::updateSettings(const QString &language,
bool downloadOnlyNewMsgs, bool downloadCompleteMsgs,
const QString &fontSize, bool downloadOnlyNewMsgs, bool downloadCompleteMsgs,
bool saveFilesToDb, const QString &fileLifeDays, bool usePinCode,
const QString &pinCodeString)
/* ========================================================================= */
{
globSet.language = language;
globSet.fontSize = fontSize.toInt();
globSet.downloadOnlyNewMsgs = downloadOnlyNewMsgs;
globSet.downloadCompleteMsgs = downloadCompleteMsgs;
globSet.saveFilesToDb = saveFilesToDb;
......
......@@ -61,8 +61,9 @@ public:
* @brief Save global settings from QML.
*/
Q_INVOKABLE void updateSettings(const QString &language,
bool downloadOnlyNewMsgs, bool downloadCompleteMsgs,
bool saveFilesToDb, const QString &fileLifeDays, bool usePinCode,
const QString &fontSize, bool downloadOnlyNewMsgs,
bool downloadCompleteMsgs, bool saveFilesToDb,
const QString &fileLifeDays, bool usePinCode,
const QString &pinCodeString);
/*!
......@@ -80,8 +81,9 @@ signals:
/*!
* @brief Send current global settings to QML.
*/
void sendSettingsData(int langIndex, bool downloadOnlyNewMsgs,
bool downloadCompleteMsgs, bool saveFilesToDb, int fileLifeDays,
void sendSettingsData(int langIndex, int fontSize,
bool downloadOnlyNewMsgs, bool downloadCompleteMsgs,
bool saveFilesToDb, int fileLifeDays,
bool usePinCode, QString pinCodeString);
/*!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment