mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-28 08:37:22 -08:00
Kobo Libra compatibility; new font: Bitter
This commit is contained in:
parent
028b0063c6
commit
dd8921c859
14 changed files with 113 additions and 22 deletions
|
@ -21,7 +21,7 @@ brightnessDialog::brightnessDialog(QWidget *parent) :
|
||||||
|
|
||||||
// I know, Mini and Touch don't have frontlights but that's a template to include others later...
|
// I know, Mini and Touch don't have frontlights but that's a template to include others later...
|
||||||
int value;
|
int value;
|
||||||
if(global::isN705 == true or global::isN905C == true) {
|
if(global::isN705 == true or global::isN905C == true or global::isN873 == true) {
|
||||||
value = get_brightness();
|
value = get_brightness();
|
||||||
}
|
}
|
||||||
else if(global::isN613 == true) {
|
else if(global::isN613 == true) {
|
||||||
|
@ -63,7 +63,7 @@ brightnessDialog::brightnessDialog(QWidget *parent) :
|
||||||
ui->brightnessLabel->setFont(QFont(crimson_bold));
|
ui->brightnessLabel->setFont(QFont(crimson_bold));
|
||||||
|
|
||||||
// Saving current brightness value in case we want to go backwards
|
// Saving current brightness value in case we want to go backwards
|
||||||
if(global::isN705 == true or global::isN705 == true) {
|
if(global::isN705 == true or global::isN905C == true or global::isN873 == true) {
|
||||||
oldValue = get_brightness();
|
oldValue = get_brightness();
|
||||||
}
|
}
|
||||||
else if(global::isN613 == true) {
|
else if(global::isN613 == true) {
|
||||||
|
@ -127,7 +127,7 @@ void brightnessDialog::on_okBtn_clicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
void brightnessDialog::pre_set_brightness(int brightnessValue) {
|
void brightnessDialog::pre_set_brightness(int brightnessValue) {
|
||||||
if(global::isN705 == true or global::isN905C == true) {
|
if(global::isN705 == true or global::isN905C == true or global::isN873 == true) {
|
||||||
set_brightness(brightnessValue);
|
set_brightness(brightnessValue);
|
||||||
}
|
}
|
||||||
else if(global::isN613 == true) {
|
else if(global::isN613 == true) {
|
||||||
|
|
3
eink.qrc
3
eink.qrc
|
@ -48,5 +48,8 @@
|
||||||
<file>resources/nightmode-full.png</file>
|
<file>resources/nightmode-full.png</file>
|
||||||
<file>resources/backspace.png</file>
|
<file>resources/backspace.png</file>
|
||||||
<file>resources/x-circle.png</file>
|
<file>resources/x-circle.png</file>
|
||||||
|
<file>resources/fonts/Bitter-MediumItalic.ttf</file>
|
||||||
|
<file>resources/fonts/Bitter-Medium.ttf</file>
|
||||||
|
<file>resources/fonts/Bitter-Bold.ttf</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -72,6 +72,7 @@ namespace global {
|
||||||
inline bool isN705;
|
inline bool isN705;
|
||||||
inline bool isN905C;
|
inline bool isN905C;
|
||||||
inline bool isN613;
|
inline bool isN613;
|
||||||
|
inline bool isN873;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/6080853/c-multiple-definition-error-for-global-functions-in-the-header-file/20679534#20679534
|
// https://stackoverflow.com/questions/6080853/c-multiple-definition-error-for-global-functions-in-the-header-file/20679534#20679534
|
||||||
|
@ -402,6 +403,10 @@ namespace {
|
||||||
defaultEpubPageHeight = 450;
|
defaultEpubPageHeight = 450;
|
||||||
defaultEpubPageWidth = 450;
|
defaultEpubPageWidth = 450;
|
||||||
}
|
}
|
||||||
|
if(checkconfig_str_val == "n873\n") {
|
||||||
|
defaultEpubPageHeight = 525;
|
||||||
|
defaultEpubPageWidth = 525;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void pre_set_brightness(int brightnessValue) {
|
void pre_set_brightness(int brightnessValue) {
|
||||||
string_checkconfig_ro("/opt/inkbox_device");
|
string_checkconfig_ro("/opt/inkbox_device");
|
||||||
|
|
|
@ -104,6 +104,9 @@ void koboxAppsDialog::on_launchBtn_clicked()
|
||||||
else if(checkconfig_str_val == "n613\n") {
|
else if(checkconfig_str_val == "n613\n") {
|
||||||
dpiSetting = "175";
|
dpiSetting = "175";
|
||||||
}
|
}
|
||||||
|
else if(checkconfig_str_val == "n873\n") {
|
||||||
|
dpiSetting = "250";
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
dpiSetting = "125";
|
dpiSetting = "125";
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,9 @@ koboxSettings::koboxSettings(QWidget *parent) :
|
||||||
else if(checkconfig_str_val == "n613\n") {
|
else if(checkconfig_str_val == "n613\n") {
|
||||||
dpiSetting = "175";
|
dpiSetting = "175";
|
||||||
}
|
}
|
||||||
|
else if(checkconfig_str_val == "n873\n") {
|
||||||
|
dpiSetting = "250";
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
dpiSetting = "125";
|
dpiSetting = "125";
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,7 +254,7 @@ OK
|
||||||
<number>25</number>
|
<number>25</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>250</number>
|
<number>350</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="singleStep">
|
<property name="singleStep">
|
||||||
<number>25</number>
|
<number>25</number>
|
||||||
|
|
9
main.cpp
9
main.cpp
|
@ -78,16 +78,25 @@ int main(int argc, char *argv[])
|
||||||
global::isN705 = true;
|
global::isN705 = true;
|
||||||
global::isN905C = false;
|
global::isN905C = false;
|
||||||
global::isN613 = false;
|
global::isN613 = false;
|
||||||
|
global::isN873 = false;
|
||||||
}
|
}
|
||||||
else if(checkconfig_str_val == "n905\n") {
|
else if(checkconfig_str_val == "n905\n") {
|
||||||
global::isN705 = false;
|
global::isN705 = false;
|
||||||
global::isN905C = true;
|
global::isN905C = true;
|
||||||
global::isN613 = false;
|
global::isN613 = false;
|
||||||
|
global::isN873 = false;
|
||||||
}
|
}
|
||||||
else if(checkconfig_str_val == "n613\n") {
|
else if(checkconfig_str_val == "n613\n") {
|
||||||
global::isN705 = false;
|
global::isN705 = false;
|
||||||
global::isN905C = false;
|
global::isN905C = false;
|
||||||
global::isN613 = true;
|
global::isN613 = true;
|
||||||
|
global::isN873 = false;
|
||||||
|
}
|
||||||
|
else if(checkconfig_str_val == "n873\n") {
|
||||||
|
global::isN705 = false;
|
||||||
|
global::isN905C = false;
|
||||||
|
global::isN613 = false;
|
||||||
|
global::isN873 = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
;
|
;
|
||||||
|
|
|
@ -719,7 +719,7 @@ void MainWindow::resetIcons() {
|
||||||
void MainWindow::setBatteryIcon() {
|
void MainWindow::setBatteryIcon() {
|
||||||
// Battery
|
// Battery
|
||||||
string_checkconfig_ro("/opt/inkbox_device");
|
string_checkconfig_ro("/opt/inkbox_device");
|
||||||
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n") {
|
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n" or checkconfig_str_val == "n873\n") {
|
||||||
// Hide brightness controls; they won't be very useful there anyway (for anything but the Glo) ...
|
// Hide brightness controls; they won't be very useful there anyway (for anything but the Glo) ...
|
||||||
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
|
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
|
||||||
ui->brightnessBtn->hide();
|
ui->brightnessBtn->hide();
|
||||||
|
|
38
reader.cpp
38
reader.cpp
|
@ -110,6 +110,24 @@ reader::reader(QWidget *parent) :
|
||||||
ui->text->setFont(crimson);
|
ui->text->setFont(crimson);
|
||||||
ui->fontChooser->setCurrentText(checkconfig_str_val);
|
ui->fontChooser->setCurrentText(checkconfig_str_val);
|
||||||
}
|
}
|
||||||
|
else if(checkconfig_str_val == "Bitter") {
|
||||||
|
QString family;
|
||||||
|
{
|
||||||
|
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-Medium.ttf");
|
||||||
|
family = QFontDatabase::applicationFontFamilies(id).at(0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-MediumItalic.ttf");
|
||||||
|
family = QFontDatabase::applicationFontFamilies(id).at(0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
int id = QFontDatabase::addApplicationFont(":/resources/fonts/Bitter-Bold.ttf");
|
||||||
|
family = QFontDatabase::applicationFontFamilies(id).at(0);
|
||||||
|
}
|
||||||
|
QFont bitter(family);
|
||||||
|
ui->text->setFont(bitter);
|
||||||
|
ui->fontChooser->setCurrentText(checkconfig_str_val);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
QFont config_font(checkconfig_str_val);
|
QFont config_font(checkconfig_str_val);
|
||||||
ui->text->setFont(config_font);
|
ui->text->setFont(config_font);
|
||||||
|
@ -117,6 +135,8 @@ reader::reader(QWidget *parent) :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Night mode
|
// Night mode
|
||||||
|
string_checkconfig_ro("/opt/inkbox_device");
|
||||||
|
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n") {
|
||||||
if(checkconfig(".config/10-dark_mode/config") == true) {
|
if(checkconfig(".config/10-dark_mode/config") == true) {
|
||||||
string_writeconfig("/tmp/invertScreen", "y");
|
string_writeconfig("/tmp/invertScreen", "y");
|
||||||
ui->nightModeBtn->setText("");
|
ui->nightModeBtn->setText("");
|
||||||
|
@ -129,6 +149,13 @@ reader::reader(QWidget *parent) :
|
||||||
ui->nightModeBtn->setIcon(QIcon(":/resources/nightmode-empty.png"));
|
ui->nightModeBtn->setIcon(QIcon(":/resources/nightmode-empty.png"));
|
||||||
isNightModeActive = false;
|
isNightModeActive = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->line_7->hide();
|
||||||
|
ui->line_7->deleteLater();
|
||||||
|
ui->nightModeBtn->hide();
|
||||||
|
ui->nightModeBtn->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
// Stylesheet + misc.
|
// Stylesheet + misc.
|
||||||
QFile stylesheetFile(":/resources/eink.qss");
|
QFile stylesheetFile(":/resources/eink.qss");
|
||||||
|
@ -166,7 +193,7 @@ reader::reader(QWidget *parent) :
|
||||||
|
|
||||||
// Getting brightness level
|
// Getting brightness level
|
||||||
int brightness_value;
|
int brightness_value;
|
||||||
if(global::isN705 == true or global::isN905C == true) {
|
if(global::isN705 == true or global::isN905C == true or global::isN873 == true) {
|
||||||
brightness_value = get_brightness();
|
brightness_value = get_brightness();
|
||||||
}
|
}
|
||||||
else if(global::isN613 == true) {
|
else if(global::isN613 == true) {
|
||||||
|
@ -904,7 +931,7 @@ void reader::on_hideOptionsBtn_clicked()
|
||||||
void reader::on_brightnessDecBtn_clicked()
|
void reader::on_brightnessDecBtn_clicked()
|
||||||
{
|
{
|
||||||
int bval;
|
int bval;
|
||||||
if(global::isN705 == true or global::isN905C == true) {
|
if(global::isN705 == true or global::isN905C == true or global::isN873 == true) {
|
||||||
bval = get_brightness();
|
bval = get_brightness();
|
||||||
}
|
}
|
||||||
else if(global::isN613 == true) {
|
else if(global::isN613 == true) {
|
||||||
|
@ -927,7 +954,7 @@ void reader::on_brightnessDecBtn_clicked()
|
||||||
void reader::on_brightnessIncBtn_clicked()
|
void reader::on_brightnessIncBtn_clicked()
|
||||||
{
|
{
|
||||||
int bval;
|
int bval;
|
||||||
if(global::isN705 == true or global::isN905C == true) {
|
if(global::isN705 == true or global::isN905C == true or global::isN873 == true) {
|
||||||
bval = get_brightness();
|
bval = get_brightness();
|
||||||
}
|
}
|
||||||
else if(global::isN613 == true) {
|
else if(global::isN613 == true) {
|
||||||
|
@ -1012,6 +1039,11 @@ void reader::on_fontChooser_currentIndexChanged(const QString &arg1)
|
||||||
ui->text->setFont(crimson);
|
ui->text->setFont(crimson);
|
||||||
string_writeconfig(".config/04-book/font", "Crimson Pro");
|
string_writeconfig(".config/04-book/font", "Crimson Pro");
|
||||||
}
|
}
|
||||||
|
if(arg1 == "Bitter") {
|
||||||
|
QFont bitter("Bitter");
|
||||||
|
ui->text->setFont(bitter);
|
||||||
|
string_writeconfig(".config/04-book/font", "Bitter");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void reader::on_alignLeftBtn_clicked()
|
void reader::on_alignLeftBtn_clicked()
|
||||||
|
|
11
reader.ui
11
reader.ui
|
@ -6,7 +6,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>490</width>
|
<width>549</width>
|
||||||
<height>750</height>
|
<height>750</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -370,12 +370,17 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Crimson Pro</string>
|
<string>Source Serif Pro</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Source Serif Pro</string>
|
<string>Bitter</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Crimson Pro</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
BIN
resources/fonts/Bitter-Bold.ttf
Normal file
BIN
resources/fonts/Bitter-Bold.ttf
Normal file
Binary file not shown.
BIN
resources/fonts/Bitter-Medium.ttf
Normal file
BIN
resources/fonts/Bitter-Medium.ttf
Normal file
Binary file not shown.
BIN
resources/fonts/Bitter-MediumItalic.ttf
Normal file
BIN
resources/fonts/Bitter-MediumItalic.ttf
Normal file
Binary file not shown.
31
settings.cpp
31
settings.cpp
|
@ -80,9 +80,17 @@ settings::settings(QWidget *parent) :
|
||||||
if(checkconfig(".config/05-quote/config") == true) {
|
if(checkconfig(".config/05-quote/config") == true) {
|
||||||
ui->quoteCheckBox->click();
|
ui->quoteCheckBox->click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string_checkconfig_ro("/opt/inkbox_device");
|
||||||
|
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n") {
|
||||||
if(checkconfig(".config/10-dark_mode/config") == true) {
|
if(checkconfig(".config/10-dark_mode/config") == true) {
|
||||||
ui->darkModeCheckBox->click();
|
ui->darkModeCheckBox->click();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->darkModeCheckBox->hide();
|
||||||
|
ui->darkModeCheckBox->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
// Words number
|
// Words number
|
||||||
string_checkconfig(".config/07-words_number/config");
|
string_checkconfig(".config/07-words_number/config");
|
||||||
|
@ -172,6 +180,17 @@ settings::settings(QWidget *parent) :
|
||||||
ui->uiScalingSlider->setValue(2);
|
ui->uiScalingSlider->setValue(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(checkconfig_str_val == "n873\n") {
|
||||||
|
if(dpi_number == 285) {
|
||||||
|
ui->uiScalingSlider->setValue(0);
|
||||||
|
}
|
||||||
|
if(dpi_number == 300) {
|
||||||
|
ui->uiScalingSlider->setValue(1);
|
||||||
|
}
|
||||||
|
if(dpi_number == 315) {
|
||||||
|
ui->uiScalingSlider->setValue(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if(dpi_number == 187) {
|
if(dpi_number == 187) {
|
||||||
ui->uiScalingSlider->setValue(0);
|
ui->uiScalingSlider->setValue(0);
|
||||||
|
@ -587,6 +606,9 @@ void settings::on_uiScalingSlider_valueChanged(int value)
|
||||||
if(checkconfig_str_val == "n613\n") {
|
if(checkconfig_str_val == "n613\n") {
|
||||||
string_writeconfig(".config/09-dpi/config", "195");
|
string_writeconfig(".config/09-dpi/config", "195");
|
||||||
}
|
}
|
||||||
|
if(checkconfig_str_val == "n873\n") {
|
||||||
|
string_writeconfig(".config/09-dpi/config", "285");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(value == 1) {
|
if(value == 1) {
|
||||||
string_checkconfig_ro("/opt/inkbox_device");
|
string_checkconfig_ro("/opt/inkbox_device");
|
||||||
|
@ -599,6 +621,9 @@ void settings::on_uiScalingSlider_valueChanged(int value)
|
||||||
if(checkconfig_str_val == "n613\n") {
|
if(checkconfig_str_val == "n613\n") {
|
||||||
string_writeconfig(".config/09-dpi/config", "210");
|
string_writeconfig(".config/09-dpi/config", "210");
|
||||||
}
|
}
|
||||||
|
if(checkconfig_str_val == "n873\n") {
|
||||||
|
string_writeconfig(".config/09-dpi/config", "300");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(value == 2) {
|
if(value == 2) {
|
||||||
string_checkconfig_ro("/opt/inkbox_device");
|
string_checkconfig_ro("/opt/inkbox_device");
|
||||||
|
@ -611,6 +636,9 @@ void settings::on_uiScalingSlider_valueChanged(int value)
|
||||||
if(checkconfig_str_val == "n613\n") {
|
if(checkconfig_str_val == "n613\n") {
|
||||||
string_writeconfig(".config/09-dpi/config", "225");
|
string_writeconfig(".config/09-dpi/config", "225");
|
||||||
}
|
}
|
||||||
|
if(checkconfig_str_val == "n873\n") {
|
||||||
|
string_writeconfig(".config/09-dpi/config", "315");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Making sense for the user
|
// Making sense for the user
|
||||||
|
@ -712,6 +740,9 @@ void settings::on_enableUiScalingCheckBox_toggled(bool checked)
|
||||||
else if(checkconfig_str_val == "n613\n") {
|
else if(checkconfig_str_val == "n613\n") {
|
||||||
string_writeconfig(".config/09-dpi/config", "195");
|
string_writeconfig(".config/09-dpi/config", "195");
|
||||||
}
|
}
|
||||||
|
else if(checkconfig_str_val == "n873\n") {
|
||||||
|
string_writeconfig(".config/09-dpi/config", "285");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
string_writeconfig(".config/09-dpi/config", "187");
|
string_writeconfig(".config/09-dpi/config", "187");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue