-
-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved UI for Reading List Bar and Table of Contents #1256
Conversation
@heropj Thank you for your PR. I have rebased it on latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@heropj Please first remove the superfluous changes before we move to a formal review. The changes to some files like the icons may be due to your formatter? It is important to keep commit footprint at a minimum, as it makes it difficult for reviewers to navigate your changes.
src/tableofcontentbar.ui
Outdated
@@ -7,7 +7,7 @@ | |||
<x>0</x> | |||
<y>0</y> | |||
<width>400</width> | |||
<height>300</height> | |||
<height>300</height> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in this file are unnecessary.
src/tableofcontentbar.cpp
Outdated
@@ -94,7 +92,7 @@ void TableOfContentBar::setupTree(const QJsonObject& headers) | |||
if (headerUrl != currentUrl) | |||
return; | |||
|
|||
m_url = headerUrl; | |||
m_url = headerUrl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove trailing space.
src/tableofcontentbar.cpp
Outdated
@@ -9,10 +9,8 @@ TableOfContentBar::TableOfContentBar(QWidget *parent) : | |||
ui(new Ui::tableofcontentbar) | |||
{ | |||
ui->setupUi(this); | |||
ui->titleLabel->setFont(QFont("Selawik", 18, QFont::Weight::Medium)); | |||
// ui->titleLabel->setFont(QFont("Selawik", 18 , QFont::Weight::Medium)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not leave commented out code without explanation.
resources/css/style.css
Outdated
#readinglistbar QLabel { | ||
/* General Style Improvements */ | ||
#readinglistbar, #tableofcontentbar { | ||
/* background-color: #F9F9F9; */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not leave commented out code without reasoning
@ShaopengLin Sorry for the inconvenience caused by the superfluous changes. In my latest commit I have ensured no such changes are present. I’ve addressed other changes also as per your suggestion. |
@heropj There are still 46 files changed. Please only leave those which are relevant. |
@ShaopengLin Got it..I have removed the commits which caused those unnecessary changes and have made a fresh commit with relevant changes only. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@heropj The issue wants you to match ReadingList to the behaviour and look of the TOC, and we should not change the TOC. There are reasons for the design of TOC to be like this so please do not change it and focus on the 3 points I mentioned in the Issue.
SInce there are only a few UI changes, I will first focus on the UI. Once that's up-to-par (Kelson might also grill you similar to how he did to me :) later ), I can review the coding part.
@ShaopengLin Thank you for the feedback, I will undo changes in TOC and make RL ui similar to it. |
02957cf
to
efc5e9e
Compare
src/mainwindow.cpp
Outdated
@@ -197,6 +197,7 @@ void MainWindow::tableOfContentToggled(bool state) | |||
if (state) { | |||
checkActionNoSignal(KiwixApp::ToggleReadingListAction, false); | |||
mp_ui->sideBar->setCurrentWidget(mp_ui->tableofcontentbar); | |||
mp_ui->sideBar->setStyleSheet("background-color: white;"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/readinglistbar.cpp
Outdated
@@ -15,6 +15,16 @@ ReadingListBar::ReadingListBar(QWidget *parent) : | |||
ui(new Ui::readinglistbar) | |||
{ | |||
ui->setupUi(this); | |||
|
|||
//to remove gap between RL components | |||
if (layout()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this check necessary? I don't see setLayout() calls later so this state won't change.
@heropj The change LGTM, but do change the commit message to be more generalized and meaningful. @veloman-yunkan @kelson42 The UI and code look ok to me. Please have a round of review for any further suggestions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the following
src/mainwindow.cpp
Outdated
@@ -197,7 +197,6 @@ void MainWindow::tableOfContentToggled(bool state) | |||
if (state) { | |||
checkActionNoSignal(KiwixApp::ToggleReadingListAction, false); | |||
mp_ui->sideBar->setCurrentWidget(mp_ui->tableofcontentbar); | |||
mp_ui->sideBar->setStyleSheet("background-color: white;"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change shouldn't be there in the first place. Do not let things like this appear in the commit history.
src/readinglistbar.cpp
Outdated
ui(new Ui::readinglistbar) | ||
{ | ||
ui->setupUi(this); | ||
|
||
//to remove gap between RL components | ||
if (layout()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
@heropj We want the commit message to be both concise and informative.
is not informative on the changes you did. The second commit is way too long and thus not concise. |
@ShaopengLin done😢😅 |
@heropj @ShaopengLin Thank you very much. I will review this PR from a user perspective this week-end and I hope @veloman-yunkan can do the same from the code perspective. |
src/readinglistbar.cpp
Outdated
ui(new Ui::readinglistbar) | ||
{ | ||
ui->setupUi(this); | ||
ui->titleLabel->setFont(QFont("Selawik", 18, QFont::Weight::Medium)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the font set in C++ code? Can't it be controlled via CSS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it can be set via CSS but TOC also had font set in cpp code in tableofcontentbar.cpp... so to maintain code consistency i added this line here in readinglistbar.cpp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ShaopengLin Any reason the fonts in TOC sidebar are controlled from C++ rather than CSS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible I am ok with doing this in CSS. Its just my personal preference to control font in Qt, as I remember some widgets doesn't support CSS fonts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello.. I just checked it's working via CSS, so should i do it in CSS??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please
@@ -37,7 +40,6 @@ ReadingListBar::ReadingListBar(QWidget *parent) : | |||
auto importAction = app->getAction(KiwixApp::ImportReadingListAction); | |||
connect(exportAction, &QAction::triggered, this, &ReadingListBar::onExport); | |||
connect(importAction, &QAction::triggered, this, &ReadingListBar::onImport); | |||
ui->label->setText(gt("reading-list-title")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this was replaced with ui->titleLabel->setText(gt("reading-list"));
(and moved to the beginning of the constructor body). The new name of the label data member makes more sense, however it's not clear why the i18n text string id was changed from "reading-list-title"
to "reading-list"
.
But checking resources/i18n/qqq.json
and resources/i18n/en.json
raises another question - do we really need both those strings? One of them is used as the tooltip for the reading list button and the other as the heading of the reading list bar. In English translation file the difference between them is only in capitalization, while their descriptions in qqq.json
are identical. We should either drop one of them, or describe them differently in qqq.json
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! thank you for reviewing.. the reason i changed it from "reading-list-title"
to "reading-list"
is to maintain consistency with code present in tableofcontentbar.cpp😅 and since it worked i didn't got into checking the difference it might cause...but now that you have investigated about these strings, let me know how we should proceed further...drop one of them or change their description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kelson42 Will you please provide your feedback to my comment above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@veloman-yunkan Nomstrong opinion, but if I have to choose I would say that having two strings seems wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@heropj Then let's get rid of the "reading-list-title"
and use "reading-list"
instead. But I think that its capitalization must be changed to title case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@veloman-yunkan Do i need to remove "reading-list-title"
from all translation files?? or just from qqq.json
and en.json
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only qqq.json
and en.json
must be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from a user perspective
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The final result looks good to me, but the commit history falls a little short of what I expect from a good code evolution history. The main problem is that the second commit combines two unrelated changes and rather reflects the review process than a logical and clean series of steps of arriving at the agreed state. Please rewrite the commit history of this PR as follows:
- Dropping of the "reading-list-title" entry from translated strings (C++ code using the removed entry must be updated accordingly, each commit must be self-consistent).
- Restyling of the Reading List sidebar (rest of the changes).
fix #1247
Changes: