Skip to content

Commit dd8921c

Browse files
committed
Kobo Libra compatibility; new font: Bitter
1 parent 028b006 commit dd8921c

14 files changed

+113
-22
lines changed

brightnessdialog.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ brightnessDialog::brightnessDialog(QWidget *parent) :
2121

2222
// I know, Mini and Touch don't have frontlights but that's a template to include others later...
2323
int value;
24-
if(global::isN705 == true or global::isN905C == true) {
24+
if(global::isN705 == true or global::isN905C == true or global::isN873 == true) {
2525
value = get_brightness();
2626
}
2727
else if(global::isN613 == true) {
@@ -63,7 +63,7 @@ brightnessDialog::brightnessDialog(QWidget *parent) :
6363
ui->brightnessLabel->setFont(QFont(crimson_bold));
6464

6565
// Saving current brightness value in case we want to go backwards
66-
if(global::isN705 == true or global::isN705 == true) {
66+
if(global::isN705 == true or global::isN905C == true or global::isN873 == true) {
6767
oldValue = get_brightness();
6868
}
6969
else if(global::isN613 == true) {
@@ -127,7 +127,7 @@ void brightnessDialog::on_okBtn_clicked()
127127
}
128128

129129
void brightnessDialog::pre_set_brightness(int brightnessValue) {
130-
if(global::isN705 == true or global::isN905C == true) {
130+
if(global::isN705 == true or global::isN905C == true or global::isN873 == true) {
131131
set_brightness(brightnessValue);
132132
}
133133
else if(global::isN613 == true) {

eink.qrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,8 @@
4848
<file>resources/nightmode-full.png</file>
4949
<file>resources/backspace.png</file>
5050
<file>resources/x-circle.png</file>
51+
<file>resources/fonts/Bitter-MediumItalic.ttf</file>
52+
<file>resources/fonts/Bitter-Medium.ttf</file>
53+
<file>resources/fonts/Bitter-Bold.ttf</file>
5154
</qresource>
5255
</RCC>

functions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ namespace global {
7272
inline bool isN705;
7373
inline bool isN905C;
7474
inline bool isN613;
75+
inline bool isN873;
7576
}
7677

7778
// https://stackoverflow.com/questions/6080853/c-multiple-definition-error-for-global-functions-in-the-header-file/20679534#20679534
@@ -402,6 +403,10 @@ namespace {
402403
defaultEpubPageHeight = 450;
403404
defaultEpubPageWidth = 450;
404405
}
406+
if(checkconfig_str_val == "n873\n") {
407+
defaultEpubPageHeight = 525;
408+
defaultEpubPageWidth = 525;
409+
}
405410
}
406411
void pre_set_brightness(int brightnessValue) {
407412
string_checkconfig_ro("/opt/inkbox_device");

koboxappsdialog.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ void koboxAppsDialog::on_launchBtn_clicked()
104104
else if(checkconfig_str_val == "n613\n") {
105105
dpiSetting = "175";
106106
}
107+
else if(checkconfig_str_val == "n873\n") {
108+
dpiSetting = "250";
109+
}
107110
else {
108111
dpiSetting = "125";
109112
}

koboxsettings.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ koboxSettings::koboxSettings(QWidget *parent) :
4444
else if(checkconfig_str_val == "n613\n") {
4545
dpiSetting = "175";
4646
}
47+
else if(checkconfig_str_val == "n873\n") {
48+
dpiSetting = "250";
49+
}
4750
else {
4851
dpiSetting = "125";
4952
}

koboxsettings.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ OK
254254
<number>25</number>
255255
</property>
256256
<property name="maximum">
257-
<number>250</number>
257+
<number>350</number>
258258
</property>
259259
<property name="singleStep">
260260
<number>25</number>

main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,25 @@ int main(int argc, char *argv[])
7878
global::isN705 = true;
7979
global::isN905C = false;
8080
global::isN613 = false;
81+
global::isN873 = false;
8182
}
8283
else if(checkconfig_str_val == "n905\n") {
8384
global::isN705 = false;
8485
global::isN905C = true;
8586
global::isN613 = false;
87+
global::isN873 = false;
8688
}
8789
else if(checkconfig_str_val == "n613\n") {
8890
global::isN705 = false;
8991
global::isN905C = false;
9092
global::isN613 = true;
93+
global::isN873 = false;
94+
}
95+
else if(checkconfig_str_val == "n873\n") {
96+
global::isN705 = false;
97+
global::isN905C = false;
98+
global::isN613 = false;
99+
global::isN873 = true;
91100
}
92101
else {
93102
;

mainwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ void MainWindow::resetIcons() {
719719
void MainWindow::setBatteryIcon() {
720720
// Battery
721721
string_checkconfig_ro("/opt/inkbox_device");
722-
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n") {
722+
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n" or checkconfig_str_val == "n873\n") {
723723
// Hide brightness controls; they won't be very useful there anyway (for anything but the Glo) ...
724724
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
725725
ui->brightnessBtn->hide();

reader.cpp

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,24 +110,51 @@ reader::reader(QWidget *parent) :
110110
ui->text->setFont(crimson);
111111
ui->fontChooser->setCurrentText(checkconfig_str_val);
112112
}
113+
else if(checkconfig_str_val == "Bitter") {
114+
QString family;
115+
{
116+
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-Medium.ttf");
117+
family = QFontDatabase::applicationFontFamilies(id).at(0);
118+
}
119+
{
120+
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-MediumItalic.ttf");
121+
family = QFontDatabase::applicationFontFamilies(id).at(0);
122+
}
123+
{
124+
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-Bold.ttf");
125+
family = QFontDatabase::applicationFontFamilies(id).at(0);
126+
}
127+
QFont bitter(family);
128+
ui->text->setFont(bitter);
129+
ui->fontChooser->setCurrentText(checkconfig_str_val);
130+
}
113131
else {
114132
QFont config_font(checkconfig_str_val);
115133
ui->text->setFont(config_font);
116134
ui->fontChooser->setCurrentText(checkconfig_str_val);
117135
}
118136
}
119137
// Night mode
120-
if(checkconfig(".config/10-dark_mode/config") == true) {
121-
string_writeconfig("/tmp/invertScreen", "y");
122-
ui->nightModeBtn->setText("");
123-
ui->nightModeBtn->setIcon(QIcon(":/resources/nightmode-full.png"));
124-
isNightModeActive = true;
138+
string_checkconfig_ro("/opt/inkbox_device");
139+
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n") {
140+
if(checkconfig(".config/10-dark_mode/config") == true) {
141+
string_writeconfig("/tmp/invertScreen", "y");
142+
ui->nightModeBtn->setText("");
143+
ui->nightModeBtn->setIcon(QIcon(":/resources/nightmode-full.png"));
144+
isNightModeActive = true;
145+
}
146+
else {
147+
string_writeconfig("/tmp/invertScreen", "n");
148+
ui->nightModeBtn->setText("");
149+
ui->nightModeBtn->setIcon(QIcon(":/resources/nightmode-empty.png"));
150+
isNightModeActive = false;
151+
}
125152
}
126153
else {
127-
string_writeconfig("/tmp/invertScreen", "n");
128-
ui->nightModeBtn->setText("");
129-
ui->nightModeBtn->setIcon(QIcon(":/resources/nightmode-empty.png"));
130-
isNightModeActive = false;
154+
ui->line_7->hide();
155+
ui->line_7->deleteLater();
156+
ui->nightModeBtn->hide();
157+
ui->nightModeBtn->deleteLater();
131158
}
132159

133160
// Stylesheet + misc.
@@ -166,7 +193,7 @@ reader::reader(QWidget *parent) :
166193

167194
// Getting brightness level
168195
int brightness_value;
169-
if(global::isN705 == true or global::isN905C == true) {
196+
if(global::isN705 == true or global::isN905C == true or global::isN873 == true) {
170197
brightness_value = get_brightness();
171198
}
172199
else if(global::isN613 == true) {
@@ -904,7 +931,7 @@ void reader::on_hideOptionsBtn_clicked()
904931
void reader::on_brightnessDecBtn_clicked()
905932
{
906933
int bval;
907-
if(global::isN705 == true or global::isN905C == true) {
934+
if(global::isN705 == true or global::isN905C == true or global::isN873 == true) {
908935
bval = get_brightness();
909936
}
910937
else if(global::isN613 == true) {
@@ -927,7 +954,7 @@ void reader::on_brightnessDecBtn_clicked()
927954
void reader::on_brightnessIncBtn_clicked()
928955
{
929956
int bval;
930-
if(global::isN705 == true or global::isN905C == true) {
957+
if(global::isN705 == true or global::isN905C == true or global::isN873 == true) {
931958
bval = get_brightness();
932959
}
933960
else if(global::isN613 == true) {
@@ -1012,6 +1039,11 @@ void reader::on_fontChooser_currentIndexChanged(const QString &arg1)
10121039
ui->text->setFont(crimson);
10131040
string_writeconfig(".config/04-book/font", "Crimson Pro");
10141041
}
1042+
if(arg1 == "Bitter") {
1043+
QFont bitter("Bitter");
1044+
ui->text->setFont(bitter);
1045+
string_writeconfig(".config/04-book/font", "Bitter");
1046+
}
10151047
}
10161048

10171049
void reader::on_alignLeftBtn_clicked()

reader.ui

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>490</width>
9+
<width>549</width>
1010
<height>750</height>
1111
</rect>
1212
</property>
@@ -370,12 +370,17 @@
370370
</item>
371371
<item>
372372
<property name="text">
373-
<string>Crimson Pro</string>
373+
<string>Source Serif Pro</string>
374374
</property>
375375
</item>
376376
<item>
377377
<property name="text">
378-
<string>Source Serif Pro</string>
378+
<string>Bitter</string>
379+
</property>
380+
</item>
381+
<item>
382+
<property name="text">
383+
<string>Crimson Pro</string>
379384
</property>
380385
</item>
381386
<item>

0 commit comments

Comments
 (0)