mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
Optimization of libraryWidget for low-resolution devices
This commit is contained in:
parent
cbd7f2c7de
commit
20980325de
3 changed files with 177 additions and 77 deletions
|
@ -16,9 +16,33 @@ libraryWidget::libraryWidget(QWidget *parent) :
|
|||
ui->recentlyAddedLabel->hide();
|
||||
ui->booksStackedWidget->hide();
|
||||
|
||||
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Italic.ttf");
|
||||
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
|
||||
QFont crimson_italic(family);
|
||||
QString family;
|
||||
{
|
||||
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Regular.ttf");
|
||||
family = QFontDatabase::applicationFontFamilies(id).at(0);
|
||||
}
|
||||
{
|
||||
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Italic.ttf");
|
||||
family = QFontDatabase::applicationFontFamilies(id).at(0);
|
||||
}
|
||||
{
|
||||
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-Bold.ttf");
|
||||
family = QFontDatabase::applicationFontFamilies(id).at(0);
|
||||
}
|
||||
{
|
||||
int id = QFontDatabase::addApplicationFont(":/resources/fonts/CrimsonPro-BoldItalic.ttf");
|
||||
family = QFontDatabase::applicationFontFamilies(id).at(0);
|
||||
}
|
||||
QFont crimson(family);
|
||||
|
||||
ui->previousBtn->setText("");
|
||||
ui->previousBtn->setProperty("type", "borderless");
|
||||
ui->nextBtn->setText("");
|
||||
ui->nextBtn->setProperty("type", "borderless");
|
||||
ui->previousBtn->setIcon(QIcon(":/resources/chevron-left.png"));
|
||||
ui->nextBtn->setIcon(QIcon(":/resources/chevron-right.png"));
|
||||
ui->pageLabel->setText("1 <i>of</i> 2");
|
||||
ui->pageLabel->setFont(QFont("Source Serif Pro"));
|
||||
|
||||
ui->book1Btn->setText("");
|
||||
ui->book2Btn->setText("");
|
||||
|
@ -28,38 +52,46 @@ libraryWidget::libraryWidget(QWidget *parent) :
|
|||
ui->book6Btn->setText("");
|
||||
ui->book7Btn->setText("");
|
||||
ui->book8Btn->setText("");
|
||||
ui->book1Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book2Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book3Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book4Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book5Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book6Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book7Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book8Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book9Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book10Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book11Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book12Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book13Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book14Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book15Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book16Label->setStyleSheet("font-size: 9pt; font-style: italic");
|
||||
ui->book1Label->setFont(crimson_italic);
|
||||
ui->book2Label->setFont(crimson_italic);
|
||||
ui->book3Label->setFont(crimson_italic);
|
||||
ui->book4Label->setFont(crimson_italic);
|
||||
ui->book5Label->setFont(crimson_italic);
|
||||
ui->book6Label->setFont(crimson_italic);
|
||||
ui->book7Label->setFont(crimson_italic);
|
||||
ui->book8Label->setFont(crimson_italic);
|
||||
ui->book9Label->setFont(crimson_italic);
|
||||
ui->book10Label->setFont(crimson_italic);
|
||||
ui->book11Label->setFont(crimson_italic);
|
||||
ui->book12Label->setFont(crimson_italic);
|
||||
ui->book13Label->setFont(crimson_italic);
|
||||
ui->book14Label->setFont(crimson_italic);
|
||||
ui->book15Label->setFont(crimson_italic);
|
||||
ui->book16Label->setFont(crimson_italic);
|
||||
ui->book9Btn->setText("");
|
||||
ui->book10Btn->setText("");
|
||||
ui->book11Btn->setText("");
|
||||
ui->book12Btn->setText("");
|
||||
ui->book13Btn->setText("");
|
||||
ui->book14Btn->setText("");
|
||||
ui->book15Btn->setText("");
|
||||
ui->book16Btn->setText("");
|
||||
ui->book1Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book2Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book3Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book4Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book5Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book6Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book7Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book8Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book9Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book10Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book11Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book12Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book13Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book14Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book15Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book16Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
|
||||
ui->book1Label->setFont(crimson);
|
||||
ui->book2Label->setFont(crimson);
|
||||
ui->book3Label->setFont(crimson);
|
||||
ui->book4Label->setFont(crimson);
|
||||
ui->book5Label->setFont(crimson);
|
||||
ui->book6Label->setFont(crimson);
|
||||
ui->book7Label->setFont(crimson);
|
||||
ui->book8Label->setFont(crimson);
|
||||
ui->book9Label->setFont(crimson);
|
||||
ui->book10Label->setFont(crimson);
|
||||
ui->book11Label->setFont(crimson);
|
||||
ui->book12Label->setFont(crimson);
|
||||
ui->book13Label->setFont(crimson);
|
||||
ui->book14Label->setFont(crimson);
|
||||
ui->book15Label->setFont(crimson);
|
||||
ui->book16Label->setFont(crimson);
|
||||
|
||||
// Getting the screen's size
|
||||
sW = QGuiApplication::screens()[0]->size().width();
|
||||
|
@ -179,3 +211,17 @@ void libraryWidget::syncCatalog() {
|
|||
} );
|
||||
syncCheckTimer->start();
|
||||
}
|
||||
|
||||
void libraryWidget::on_previousBtn_clicked()
|
||||
{
|
||||
ui->booksStackedWidget->setCurrentIndex(0);
|
||||
ui->pageLabel->setText("1 <i>of</i> 2");
|
||||
}
|
||||
|
||||
|
||||
void libraryWidget::on_nextBtn_clicked()
|
||||
{
|
||||
ui->booksStackedWidget->setCurrentIndex(1);
|
||||
ui->pageLabel->setText("2 <i>of</i> 2");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ private slots:
|
|||
void setupView();
|
||||
void showToast(QString messageToDisplay);
|
||||
|
||||
void on_previousBtn_clicked();
|
||||
void on_nextBtn_clicked();
|
||||
};
|
||||
|
||||
#endif // LIBRARYWIDGET_H
|
||||
|
|
136
librarywidget.ui
136
librarywidget.ui
|
@ -65,7 +65,7 @@
|
|||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="4" column="3">
|
||||
<item row="4" column="2">
|
||||
<widget class="QLabel" name="book7Label">
|
||||
<property name="text">
|
||||
<string>Book 7</string>
|
||||
|
@ -78,34 +78,21 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<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">
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="book3Btn">
|
||||
<property name="text">
|
||||
<string>Book 3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="book4Btn">
|
||||
<property name="text">
|
||||
<string>Book 4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="book3Label">
|
||||
<property name="text">
|
||||
<string>Book 3</string>
|
||||
|
@ -118,14 +105,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="book5Btn">
|
||||
<property name="text">
|
||||
<string>Book 5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="book1Label">
|
||||
<property name="text">
|
||||
<string>Book 1</string>
|
||||
|
@ -138,14 +125,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="book6Btn">
|
||||
<property name="text">
|
||||
<string>Book 6</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="book5Label">
|
||||
<property name="text">
|
||||
<string>Book 5</string>
|
||||
|
@ -158,14 +145,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="book2Btn">
|
||||
<property name="text">
|
||||
<string>Book 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="book2Label">
|
||||
<property name="text">
|
||||
<string>Book 2</string>
|
||||
|
@ -178,7 +165,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="book4Label">
|
||||
<property name="text">
|
||||
<string>Book 4</string>
|
||||
|
@ -191,14 +178,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="book7Btn">
|
||||
<property name="text">
|
||||
<string>Book 7</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="book8Label">
|
||||
<property name="text">
|
||||
<string>Book 8</string>
|
||||
|
@ -211,21 +198,21 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="book1Btn">
|
||||
<property name="text">
|
||||
<string>Book 1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<item row="3" column="3">
|
||||
<widget class="QPushButton" name="book8Btn">
|
||||
<property name="text">
|
||||
<string>Book 8</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="book6Label">
|
||||
<property name="text">
|
||||
<string>Book 6</string>
|
||||
|
@ -238,19 +225,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="5">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<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>
|
||||
</layout>
|
||||
|
@ -286,6 +260,9 @@
|
|||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
|
@ -296,6 +273,9 @@
|
|||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
|
@ -327,6 +307,9 @@
|
|||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
|
@ -351,6 +334,9 @@
|
|||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
|
@ -375,6 +361,9 @@
|
|||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
|
@ -385,6 +374,9 @@
|
|||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
|
@ -395,6 +387,9 @@
|
|||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
|
@ -405,6 +400,9 @@
|
|||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -439,6 +437,60 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="previousBtn">
|
||||
<property name="text">
|
||||
<string>Previous</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<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="4">
|
||||
<widget class="QPushButton" name="nextBtn">
|
||||
<property name="text">
|
||||
<string>Next</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="pageLabel">
|
||||
<property name="text">
|
||||
<string>1 of 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
Loading…
Reference in a new issue