-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjaneprefs.cpp
More file actions
75 lines (54 loc) · 1.81 KB
/
janeprefs.cpp
File metadata and controls
75 lines (54 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
Jane
begin : 28 Jan 2024
copyright : (C) Kartik Patel
email : letapk@gmail.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. *
* *
*/
//Last modified 28 Jan 2024
#include "jane.h"
//userpath contains the path to the data subdirectory
extern QString userpath;
void MainWindow::writeprefs()
{
QSettings settings(tr("jane"), tr("jane"));
settings.setValue(tr("pos"), pos());//window position
settings.setValue(tr("size"), size());//window size
settings.setValue(tr("Font"), QString(curfont.toString()));//selected font
settings.setValue(tr("Defdatadir"), Datadirectory);
}
void MainWindow::readprefs()
{
//int i;
QString s, s1;
QFont f;
QSettings settings(tr("jane"), tr("jane"));
QPoint pos = settings.value(tr("pos"), QPoint(20, 20)).toPoint();
QSize size = settings.value(tr("size"), QSize(800, 630)).toSize();
f = QApplication::font();
s1 = f.toString();
s = settings.value(tr("Font"), QString(s1)).toString();
curfont.fromString(s);
QApplication::setFont(curfont);
s = settings.value(tr("Defdatadir"), userpath).toString();
resize(size);
move(pos);
}
void MainWindow::select_font()
{
bool ok;
QFont f;
f = QFontDialog::getFont(&ok, curfont, this);
if (ok == true) {
//set the user selected font everywhere
QApplication::setFont(f);
curfont = f;
} else {
return;
}
}