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

@ -358,12 +358,45 @@ Save && Quit
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item>
<widget class="QScrollArea" name="scrollArea_2">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</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> <item>
<layout class="QGridLayout" name="gridLayout_21"> <layout class="QGridLayout" name="gridLayout_21">
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="wordsNumberLabel"> <widget class="QLabel" name="wordsNumberLabel">
<property name="text"> <property name="text">
<string>Words number/page (plain text files)</string> <string>Words/page (text files)</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -411,34 +444,19 @@ Save &amp;&amp; Quit
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QLabel" name="pageSizePageSizeLabel">
<property name="text">
<string>ePUB documents' size:</string>
</property>
</widget>
</item>
<item> <item>
<layout class="QGridLayout" name="gridLayout_15"> <layout class="QGridLayout" name="gridLayout_15">
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="3"> <item row="2" column="5">
<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="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"> <widget class="QPushButton" name="pageSizeHeightIncBtn">
<property name="text"> <property name="text">
<string/> <string/>
@ -449,7 +467,25 @@ Save &amp;&amp; Quit
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="5"> <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"> <widget class="QPushButton" name="pageSizeWidthIncBtn">
<property name="text"> <property name="text">
<string/> <string/>
@ -460,48 +496,7 @@ Save &amp;&amp; Quit
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="4"> <item row="1" column="0">
<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"> <spacer name="horizontalSpacer_11">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -514,13 +509,51 @@ Save &amp;&amp; Quit
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="0"> <item row="1" column="3">
<widget class="QLabel" name="pageSizePageSizeLabel"> <widget class="QLabel" name="pageSizeWidthLabel">
<property name="text"> <property name="text">
<string>ePUB size:</string> <string>450</string>
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
<item> <item>
@ -669,6 +702,10 @@ Save &amp;&amp; Quit
</item> </item>
</layout> </layout>
</widget> </widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="Home"> <widget class="QWidget" name="Home">
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="verticalLayout_9">
<property name="leftMargin"> <property name="leftMargin">