Skip to content

Commit 74111c8

Browse files
authored
Merge pull request #1256 from heropj/ui/tr
Improved UI for Reading List Bar and Table of Contents
2 parents 3f90179 + 19707e1 commit 74111c8

File tree

6 files changed

+85
-45
lines changed

6 files changed

+85
-45
lines changed

resources/css/style.css

Lines changed: 66 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,14 @@ QTabBar::scroller {
344344
}
345345

346346
#categorySelector QScrollBar,
347-
#languageSelector QScrollBar,
348-
#readinglistbar QScrollBar {
347+
#languageSelector QScrollBar {
349348
width: 5px;
350349
border: none;
351350
outline: none;
352351
}
353352

354353
#categorySelector QScrollBar::handle,
355-
#languageSelector QScrollBar::handle,
356-
#readinglistbar QScrollBar {
354+
#languageSelector QScrollBar::handle {
357355
background-color: grey;
358356
}
359357

@@ -369,37 +367,6 @@ ContentTypeFilter {
369367
spacing: 10;
370368
}
371369

372-
#readinglistbar QLabel {
373-
font-size: 24px;
374-
font-weight: bold;
375-
padding: 5px;
376-
}
377-
378-
#readinglistbar QListWidget {
379-
show-decoration-selected: 0;
380-
border: none;
381-
padding: 5px;
382-
}
383-
384-
#readinglistbar QListWidget::item {
385-
font-size: 16px;
386-
margin-bottom: 10px;
387-
}
388-
389-
#readinglistbar QPushButton {
390-
margin-left: 4px;
391-
}
392-
393-
#readinglistbar QPushButton::hover {
394-
border: 1px solid #3366CC;
395-
background-color: #D9E9FF;
396-
border-radius: 3px;
397-
}
398-
399-
#readinglistbar QPushButton::menu-indicator {
400-
width: 0;
401-
height: 0;
402-
}
403370

404371
#tableofcontentbar {
405372
background-color: white;
@@ -463,6 +430,70 @@ ContentTypeFilter {
463430
background-color: grey;
464431
}
465432

433+
/*this selector worked after changing class ReadingListBar to a QFrame instead of QWidget in readinglistbar.h file*/
434+
#readinglistbar {
435+
background-color: white;
436+
}
437+
438+
#readinglistbar QPushButton::menu-indicator {
439+
width: 0;
440+
height: 0;
441+
}
442+
443+
#readinglistbar QTreeWidget,
444+
#readinglistbar QLabel,
445+
#readinglistbar QFrame,
446+
#readinglistbar QListWidget,
447+
#readinglistbar QPushButton {
448+
background-color: white;
449+
}
450+
451+
#readinglistbar QPushButton{
452+
margin: 13px 10px 10px;
453+
}
454+
455+
#readinglistbar QListWidget {
456+
outline: none;
457+
}
458+
459+
#readinglistbar QListWidget::item,
460+
#readinglistbar QListWidget::item:selected{
461+
height: 26px;
462+
padding: 0px 10px;
463+
outline: none;
464+
border-top: 1px solid transparent;
465+
border-bottom: 1px solid transparent;
466+
color: black;
467+
}
468+
469+
#readinglistbar QListWidget::item:hover {
470+
outline: none;
471+
border-top: 1px solid #3366CC;
472+
border-bottom: 1px solid #3366CC;
473+
background-color: #D9E9FF;
474+
color: black;
475+
}
476+
477+
#readinglistbar #titleLabel {
478+
padding: 0px;
479+
margin: 10px;
480+
}
481+
482+
#readinglistbar QScrollBar {
483+
width: 5px;
484+
border: none;
485+
outline: none;
486+
}
487+
488+
#readinglistbar QScrollBar::handle {
489+
background-color: grey;
490+
}
491+
492+
#readinglistbar QLabel#titleLabel {
493+
font-family: "Selawik";
494+
font-size: 24px; /*equivalent to font-size 18*/
495+
font-weight: 500; /*equivalent to font-weight medium*/
496+
}
466497
/* ----------------------------------------
467498
Text to Speech Page
468499
*/

resources/i18n/en.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
"table-of-content":"Table of content",
3535
"add-bookmark": "Add to the reading list",
3636
"remove-bookmark": "Remove from the reading list",
37-
"reading-list":"Reading list",
38-
"reading-list-title":"Reading List",
37+
"reading-list":"Reading List",
3938
"zoom-in":"Zoom in",
4039
"zoom-out":"Zoom out",
4140
"zoom-reset":"Zoom reset",

resources/i18n/qqq.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"add-bookmark": "Represents the action of adding a page as a bookmark",
4444
"remove-bookmark": "Represents the action of removing a page from the bookmarks",
4545
"reading-list": "Describes a list of bookmarked articles.",
46-
"reading-list-title": "Describes a list of bookmarked articles.",
4746
"zoom-in": "Represents the action of zooming into the article, making the article content appear larger.",
4847
"zoom-out": "Represents the action of zooming out of the article, making the article content appear smaller.",
4948
"zoom-reset": "Represents the action of resetting the article zoom, changing the article content size back to default",

src/readinglistbar.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
const QString documentsDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
1212

1313
ReadingListBar::ReadingListBar(QWidget *parent) :
14-
QWidget(parent),
14+
QFrame(parent),
1515
ui(new Ui::readinglistbar)
1616
{
1717
ui->setupUi(this);
18+
ui->titleLabel->setText(gt("reading-list"));
19+
1820
connect(KiwixApp::instance()->getLibrary(), &Library::bookmarksChanged,
1921
this, &ReadingListBar::setupList);
2022
connect(ui->listWidget, &QListWidget::itemClicked,
@@ -37,7 +39,6 @@ ReadingListBar::ReadingListBar(QWidget *parent) :
3739
auto importAction = app->getAction(KiwixApp::ImportReadingListAction);
3840
connect(exportAction, &QAction::triggered, this, &ReadingListBar::onExport);
3941
connect(importAction, &QAction::triggered, this, &ReadingListBar::onImport);
40-
ui->label->setText(gt("reading-list-title"));
4142

4243
QMenu *portMenu = new QMenu(this);
4344
portMenu->addAction(exportAction);

src/readinglistbar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Ui {
88
class readinglistbar;
99
}
1010

11-
class ReadingListBar : public QWidget
11+
class ReadingListBar : public QFrame
1212
{
1313
Q_OBJECT
1414

src/readinglistbar.ui

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
<string>Form</string>
1515
</property>
1616
<layout class="QVBoxLayout" name="verticalLayout">
17+
<property name="spacing">
18+
<number>0</number>
19+
</property>
1720
<property name="leftMargin">
1821
<number>0</number>
1922
</property>
@@ -29,7 +32,7 @@
2932
<item>
3033
<layout class="QHBoxLayout" name="horizontalLayout">
3134
<item>
32-
<widget class="QLabel" name="label">
35+
<widget class="QLabel" name="titleLabel">
3336
<property name="font">
3437
<font>
3538
<pointsize>16</pointsize>
@@ -64,8 +67,8 @@
6467
</property>
6568
<property name="iconSize">
6669
<size>
67-
<width>30</width>
68-
<height>30</height>
70+
<width>25</width>
71+
<height>25</height>
6972
</size>
7073
</property>
7174
<property name="flat">
@@ -74,6 +77,13 @@
7477
</widget>
7578
</item>
7679
</layout>
80+
</item>
81+
<item>
82+
<widget class="Line" name="line">
83+
<property name="orientation">
84+
<enum>Qt::Horizontal</enum>
85+
</property>
86+
</widget>
7787
</item>
7888
<item>
7989
<widget class="QListWidget" name="listWidget">
@@ -90,7 +100,7 @@
90100
<enum>QAbstractScrollArea::AdjustToContents</enum>
91101
</property>
92102
<property name="textElideMode">
93-
<enum>Qt::ElideNone</enum>
103+
<enum>Qt::ElideRight</enum>
94104
</property>
95105
<property name="isWrapping" stdset="0">
96106
<bool>false</bool>

0 commit comments

Comments
 (0)