N705: Switch default DPI to N905's

Why you ask? I'm fed up with Qt layouts
This commit is contained in:
Nicolas Mailloux 2023-12-29 17:08:54 -05:00
parent 2a438a12bc
commit d95c2a370e
2 changed files with 346 additions and 325 deletions

View file

@ -84,9 +84,8 @@ settings::settings(QWidget *parent) :
ui->headerBtn->hide(); ui->headerBtn->hide();
ui->headerLabel->hide(); ui->headerLabel->hide();
ui->line_12->hide(); ui->line_12->hide();
ui->headerBtn->setIcon(QIcon(":/resources/chevron-left.png"));
//ui->headerBtn->setIconSize(QSize(homeIconWidth, homeIconHeight));
ui->headerBtn->setIcon(QIcon(":/resources/chevron-left.png"));
ui->headerBtn->setProperty("type", "borderless"); ui->headerBtn->setProperty("type", "borderless");
ui->headerBtn->setStyleSheet("font-size: 9pt; font-weight: bold; padding: 15px"); ui->headerBtn->setStyleSheet("font-size: 9pt; font-weight: bold; padding: 15px");
ui->headerLabel->setStyleSheet("padding: 15px"); ui->headerLabel->setStyleSheet("padding: 15px");
@ -228,10 +227,7 @@ settings::settings(QWidget *parent) :
QString dpiSettingStr = readFile(".config/09-dpi/config"); QString dpiSettingStr = readFile(".config/09-dpi/config");
if(dpiSettingStr.isEmpty()) { if(dpiSettingStr.isEmpty()) {
// Writing default value depending on the device // Writing default value depending on the device
if(global::deviceID == "n705\n") { if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n") {
writeFile(".config/09-dpi/config", "187");
}
else if(global::deviceID == "n905\n" or global::deviceID == "kt\n") {
writeFile(".config/09-dpi/config", "160"); writeFile(".config/09-dpi/config", "160");
} }
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n" or global::deviceID == "emu\n") { else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n" or global::deviceID == "emu\n") {
@ -249,19 +245,7 @@ settings::settings(QWidget *parent) :
} }
else { else {
int dpi_number = dpiSettingStr.toInt(); int dpi_number = dpiSettingStr.toInt();
// Checking if it's a Mini, Touch or a Glo if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n") {
if(global::deviceID == "n705\n") {
if(dpi_number == 187) {
ui->uiScalingSlider->setValue(0);
}
if(dpi_number == 214) {
ui->uiScalingSlider->setValue(1);
}
if(dpi_number == 227) {
ui->uiScalingSlider->setValue(2);
}
}
else if(global::deviceID == "n905\n" or global::deviceID == "kt\n") {
if(dpi_number == 160) { if(dpi_number == 160) {
ui->uiScalingSlider->setValue(0); ui->uiScalingSlider->setValue(0);
} }
@ -317,13 +301,13 @@ settings::settings(QWidget *parent) :
} }
} }
else { else {
if(dpi_number == 187) { if(dpi_number == 160) {
ui->uiScalingSlider->setValue(0); ui->uiScalingSlider->setValue(0);
} }
if(dpi_number == 214) { if(dpi_number == 187) {
ui->uiScalingSlider->setValue(1); ui->uiScalingSlider->setValue(1);
} }
if(dpi_number == 227) { if(dpi_number == 200) {
ui->uiScalingSlider->setValue(2); ui->uiScalingSlider->setValue(2);
} }
} }

View file

@ -359,314 +359,351 @@ Save && Quit
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<layout class="QGridLayout" name="gridLayout_21"> <widget class="QScrollArea" name="scrollArea_2">
<item row="1" column="0"> <property name="frameShape">
<widget class="QLabel" name="wordsNumberLabel"> <enum>QFrame::NoFrame</enum>
<property name="text">
<string>Words number/page (plain text files)</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="wordsNumberDecBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/minus.png</normaloff>:/resources/minus.png</iconset>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="wordsNumberValueLabel">
<property name="text">
<string>30</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="wordsNumberIncBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/plus.png</normaloff>:/resources/plus.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_15">
<property name="bottomMargin">
<number>0</number>
</property> </property>
<item row="0" column="3"> <property name="frameShadow">
<widget class="QPushButton" name="pageSizeWidthDecBtn"> <enum>QFrame::Sunken</enum>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/minus.png</normaloff>:/resources/minus.png</iconset>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QPushButton" name="pageSizeHeightDecBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/minus.png</normaloff>:/resources/minus.png</iconset>
</property>
</widget>
</item>
<item row="0" column="10">
<widget class="QPushButton" name="pageSizeHeightIncBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/plus.png</normaloff>:/resources/plus.png</iconset>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="pageSizeWidthIncBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/plus.png</normaloff>:/resources/plus.png</iconset>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="pageSizeWidthLabel">
<property name="text">
<string>450</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Height:</string>
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="QLabel" name="pageSizeHeightLabel">
<property name="text">
<string>450</string>
</property>
</widget>
</item>
<item row="0" column="6">
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Width:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="pageSizePageSizeLabel">
<property name="text">
<string>ePUB size:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_9">
<property name="bottomMargin">
<number>0</number>
</property> </property>
<item row="0" column="0"> <property name="widgetResizable">
<widget class="QLabel" name="screenRefreshLabel"> <bool>true</bool>
<property name="text">
<string>Screen refresh</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboBox">
<item>
<property name="text">
<string>Every page</string>
</property>
</item>
<item>
<property name="text">
<string>1 page</string>
</property>
</item>
<item>
<property name="text">
<string>2 pages</string>
</property>
</item>
<item>
<property name="text">
<string>3 pages</string>
</property>
</item>
<item>
<property name="text">
<string>4 pages</string>
</property>
</item>
<item>
<property name="text">
<string>5 pages</string>
</property>
</item>
<item>
<property name="text">
<string>6 pages</string>
</property>
</item>
<item>
<property name="text">
<string>Never refresh</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="globalReadingSettingsCheckBox">
<property name="text">
<string>Global reading settings</string>
</property> </property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>419</width>
<height>726</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_21">
<item row="1" column="0">
<widget class="QLabel" name="wordsNumberLabel">
<property name="text">
<string>Words/page (text files)</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="wordsNumberDecBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/minus.png</normaloff>:/resources/minus.png</iconset>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="wordsNumberValueLabel">
<property name="text">
<string>30</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="wordsNumberIncBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/plus.png</normaloff>:/resources/plus.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="pageSizePageSizeLabel">
<property name="text">
<string>ePUB documents' size:</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_15">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="2" column="5">
<widget class="QPushButton" name="pageSizeHeightIncBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/plus.png</normaloff>:/resources/plus.png</iconset>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pageSizeHeightDecBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/minus.png</normaloff>:/resources/minus.png</iconset>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Height:</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QPushButton" name="pageSizeWidthIncBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/plus.png</normaloff>:/resources/plus.png</iconset>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QLabel" name="pageSizeWidthLabel">
<property name="text">
<string>450</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pageSizeWidthDecBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/minus.png</normaloff>:/resources/minus.png</iconset>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Width:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="pageSizeHeightLabel">
<property name="text">
<string>450</string>
</property>
</widget>
</item>
<item row="1" column="6">
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_9">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="screenRefreshLabel">
<property name="text">
<string>Screen refresh</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboBox">
<item>
<property name="text">
<string>Every page</string>
</property>
</item>
<item>
<property name="text">
<string>1 page</string>
</property>
</item>
<item>
<property name="text">
<string>2 pages</string>
</property>
</item>
<item>
<property name="text">
<string>3 pages</string>
</property>
</item>
<item>
<property name="text">
<string>4 pages</string>
</property>
</item>
<item>
<property name="text">
<string>5 pages</string>
</property>
</item>
<item>
<property name="text">
<string>6 pages</string>
</property>
</item>
<item>
<property name="text">
<string>Never refresh</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="globalReadingSettingsCheckBox">
<property name="text">
<string>Global reading settings</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="readerScrollBarCheckBox">
<property name="text">
<string>Show scroll bar if needed</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="menuBarCheckBox">
<property name="text">
<string>Always show status bar</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_16">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QPushButton" name="exportHighlightsBtn">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="exportHighlightsLabel">
<property name="text">
<string>Export highlights</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="readerScrollBarCheckBox">
<property name="text">
<string>Show scroll bar if needed</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="menuBarCheckBox">
<property name="text">
<string>Always show status bar</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_16">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QPushButton" name="exportHighlightsBtn">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="exportHighlightsLabel">
<property name="text">
<string>Export highlights</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="Home"> <widget class="QWidget" name="Home">