Merge pull request #1256 from heropj/ui/tr

Improved UI for Reading List Bar and Table of Contents
This commit is contained in:
Kelson 2024-12-12 21:26:38 +01:00 committed by GitHub
commit 74111c8b1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 85 additions and 45 deletions

View File

@ -344,16 +344,14 @@ QTabBar::scroller {
} }
#categorySelector QScrollBar, #categorySelector QScrollBar,
#languageSelector QScrollBar, #languageSelector QScrollBar {
#readinglistbar QScrollBar {
width: 5px; width: 5px;
border: none; border: none;
outline: none; outline: none;
} }
#categorySelector QScrollBar::handle, #categorySelector QScrollBar::handle,
#languageSelector QScrollBar::handle, #languageSelector QScrollBar::handle {
#readinglistbar QScrollBar {
background-color: grey; background-color: grey;
} }
@ -369,37 +367,6 @@ ContentTypeFilter {
spacing: 10; spacing: 10;
} }
#readinglistbar QLabel {
font-size: 24px;
font-weight: bold;
padding: 5px;
}
#readinglistbar QListWidget {
show-decoration-selected: 0;
border: none;
padding: 5px;
}
#readinglistbar QListWidget::item {
font-size: 16px;
margin-bottom: 10px;
}
#readinglistbar QPushButton {
margin-left: 4px;
}
#readinglistbar QPushButton::hover {
border: 1px solid #3366CC;
background-color: #D9E9FF;
border-radius: 3px;
}
#readinglistbar QPushButton::menu-indicator {
width: 0;
height: 0;
}
#tableofcontentbar { #tableofcontentbar {
background-color: white; background-color: white;
@ -463,6 +430,70 @@ ContentTypeFilter {
background-color: grey; background-color: grey;
} }
/*this selector worked after changing class ReadingListBar to a QFrame instead of QWidget in readinglistbar.h file*/
#readinglistbar {
background-color: white;
}
#readinglistbar QPushButton::menu-indicator {
width: 0;
height: 0;
}
#readinglistbar QTreeWidget,
#readinglistbar QLabel,
#readinglistbar QFrame,
#readinglistbar QListWidget,
#readinglistbar QPushButton {
background-color: white;
}
#readinglistbar QPushButton{
margin: 13px 10px 10px;
}
#readinglistbar QListWidget {
outline: none;
}
#readinglistbar QListWidget::item,
#readinglistbar QListWidget::item:selected{
height: 26px;
padding: 0px 10px;
outline: none;
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
color: black;
}
#readinglistbar QListWidget::item:hover {
outline: none;
border-top: 1px solid #3366CC;
border-bottom: 1px solid #3366CC;
background-color: #D9E9FF;
color: black;
}
#readinglistbar #titleLabel {
padding: 0px;
margin: 10px;
}
#readinglistbar QScrollBar {
width: 5px;
border: none;
outline: none;
}
#readinglistbar QScrollBar::handle {
background-color: grey;
}
#readinglistbar QLabel#titleLabel {
font-family: "Selawik";
font-size: 24px; /*equivalent to font-size 18*/
font-weight: 500; /*equivalent to font-weight medium*/
}
/* ---------------------------------------- /* ----------------------------------------
Text to Speech Page Text to Speech Page
*/ */

View File

@ -34,8 +34,7 @@
"table-of-content":"Table of content", "table-of-content":"Table of content",
"add-bookmark": "Add to the reading list", "add-bookmark": "Add to the reading list",
"remove-bookmark": "Remove from the reading list", "remove-bookmark": "Remove from the reading list",
"reading-list":"Reading list", "reading-list":"Reading List",
"reading-list-title":"Reading List",
"zoom-in":"Zoom in", "zoom-in":"Zoom in",
"zoom-out":"Zoom out", "zoom-out":"Zoom out",
"zoom-reset":"Zoom reset", "zoom-reset":"Zoom reset",

View File

@ -43,7 +43,6 @@
"add-bookmark": "Represents the action of adding a page as a bookmark", "add-bookmark": "Represents the action of adding a page as a bookmark",
"remove-bookmark": "Represents the action of removing a page from the bookmarks", "remove-bookmark": "Represents the action of removing a page from the bookmarks",
"reading-list": "Describes a list of bookmarked articles.", "reading-list": "Describes a list of bookmarked articles.",
"reading-list-title": "Describes a list of bookmarked articles.",
"zoom-in": "Represents the action of zooming into the article, making the article content appear larger.", "zoom-in": "Represents the action of zooming into the article, making the article content appear larger.",
"zoom-out": "Represents the action of zooming out of the article, making the article content appear smaller.", "zoom-out": "Represents the action of zooming out of the article, making the article content appear smaller.",
"zoom-reset": "Represents the action of resetting the article zoom, changing the article content size back to default", "zoom-reset": "Represents the action of resetting the article zoom, changing the article content size back to default",

View File

@ -11,10 +11,12 @@
const QString documentsDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); const QString documentsDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
ReadingListBar::ReadingListBar(QWidget *parent) : ReadingListBar::ReadingListBar(QWidget *parent) :
QWidget(parent), QFrame(parent),
ui(new Ui::readinglistbar) ui(new Ui::readinglistbar)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->titleLabel->setText(gt("reading-list"));
connect(KiwixApp::instance()->getLibrary(), &Library::bookmarksChanged, connect(KiwixApp::instance()->getLibrary(), &Library::bookmarksChanged,
this, &ReadingListBar::setupList); this, &ReadingListBar::setupList);
connect(ui->listWidget, &QListWidget::itemClicked, connect(ui->listWidget, &QListWidget::itemClicked,
@ -37,7 +39,6 @@ ReadingListBar::ReadingListBar(QWidget *parent) :
auto importAction = app->getAction(KiwixApp::ImportReadingListAction); auto importAction = app->getAction(KiwixApp::ImportReadingListAction);
connect(exportAction, &QAction::triggered, this, &ReadingListBar::onExport); connect(exportAction, &QAction::triggered, this, &ReadingListBar::onExport);
connect(importAction, &QAction::triggered, this, &ReadingListBar::onImport); connect(importAction, &QAction::triggered, this, &ReadingListBar::onImport);
ui->label->setText(gt("reading-list-title"));
QMenu *portMenu = new QMenu(this); QMenu *portMenu = new QMenu(this);
portMenu->addAction(exportAction); portMenu->addAction(exportAction);

View File

@ -8,7 +8,7 @@ namespace Ui {
class readinglistbar; class readinglistbar;
} }
class ReadingListBar : public QWidget class ReadingListBar : public QFrame
{ {
Q_OBJECT Q_OBJECT

View File

@ -14,6 +14,9 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -29,7 +32,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="titleLabel">
<property name="font"> <property name="font">
<font> <font>
<pointsize>16</pointsize> <pointsize>16</pointsize>
@ -64,8 +67,8 @@
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
<width>30</width> <width>25</width>
<height>30</height> <height>25</height>
</size> </size>
</property> </property>
<property name="flat"> <property name="flat">
@ -75,6 +78,13 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QListWidget" name="listWidget"> <widget class="QListWidget" name="listWidget">
<property name="frameShape"> <property name="frameShape">
@ -90,7 +100,7 @@
<enum>QAbstractScrollArea::AdjustToContents</enum> <enum>QAbstractScrollArea::AdjustToContents</enum>
</property> </property>
<property name="textElideMode"> <property name="textElideMode">
<enum>Qt::ElideNone</enum> <enum>Qt::ElideRight</enum>
</property> </property>
<property name="isWrapping" stdset="0"> <property name="isWrapping" stdset="0">
<bool>false</bool> <bool>false</bool>