Skip to content
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 filters panel #965

Merged
merged 17 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions kiwix-desktop.pro
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ DEFINES += QT_DEPRECATED_WARNINGS


SOURCES += \
src/choiceitem.cpp \
src/contentmanagerdelegate.cpp \
src/contentmanagerheader.cpp \
src/contentmanagermodel.cpp \
src/contenttypefilter.cpp \
src/descriptionnode.cpp \
src/findinpagebar.cpp \
src/flowlayout.cpp \
src/kiwixchoicebox.cpp \
src/kiwixconfirmbox.cpp \
src/kiwixlineedit.cpp \
src/kiwixlistwidget.cpp \
src/kiwixloader.cpp \
src/rownode.cpp \
src/suggestionlistworker.cpp \
Expand Down Expand Up @@ -74,14 +79,19 @@ SOURCES += \
src/zimview.cpp \

HEADERS += \
src/choiceitem.h \
src/contentmanagerdelegate.h \
src/contentmanagerheader.h \
src/contentmanagermodel.h \
src/contentmanagerview.h \
src/contenttypefilter.h \
src/descriptionnode.h \
src/findinpagebar.h \
src/flowlayout.h \
src/kiwixchoicebox.h \
src/kiwixconfirmbox.h \
src/kiwixlineedit.h \
src/kiwixlistwidget.h \
src/kiwixloader.h \
src/node.h \
src/rownode.h \
Expand Down Expand Up @@ -116,8 +126,10 @@ HEADERS += \
src/zimview.h \

FORMS += \
src/choiceitem.ui \
src/contentmanagerview.ui \
src/findinpagebar.ui \
ui/kiwixchoicebox.ui \
ui/kiwixconfirmbox.ui \
ui/mainwindow.ui \
ui/about.ui \
Expand Down
15 changes: 4 additions & 11 deletions resources/css/_contentManager.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#contentmanagerside {
background-color: red;
}

QTreeView::branch:open:has-children {
image: url(:/icons/caret-down-solid.svg);
padding: 6px;
Expand Down Expand Up @@ -64,14 +68,3 @@ QMenu::item {
QMenu::item:selected {
background-color: #cccccc;
}

QLineEdit {
font-family: 'Selawik';
padding: 4px;
border: none;
border-bottom: 1px solid #cccccc;
color: #666666;
font-size: 16px;
height: 32px;
line-height: 24px;
}
71 changes: 71 additions & 0 deletions resources/css/choiceBox.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
QListWidget::item {
padding: 0;
padding-top: 6px;
padding-bottom: 6px;
padding-left: 2px;
}

QListWidget {
padding: 0;
border: 1px solid #ccc;
}

QListWidget::item::selected {
color: #444444;
background-color: transparent;
}

QLineEdit {
padding: 4px;
border: 0;
}

#choiceLabel {
font-size: 16px;
}

#currentChoices {
margin: 0;
padding: 0;
border: 1px solid #ccc;
border-radius: 1px;
}

#closeButton {
margin: 0;
background: transparent;
color: #eaecf0;
font-size: 12px;
}

ChoiceItem > QFrame {
border: 1px solid #ccc;
border-radius: 2px;
padding: 0;
background-color: #666;
padding-left: 2px;
padding-right: 2px;
margin:0;
}

#itemLabel {
margin: 0;
height: 6px;
background-color: #666;
color: #eaecf0;
font-size: 13px;
}

#clearButton {
background-color: white;
color: #3366cc;
padding: 4px;
font: bold;
font-size: 14px;
border-radius: 4px;
}

#clearButton:hover {
background-color: #3366cc;
color: white;
}
23 changes: 23 additions & 0 deletions resources/css/contentmanagerside.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#searcher {
font-family: 'Selawik';
padding: 4px;
border: none;
border-bottom: 1px solid #cccccc;
color: #666666;
font-size: 16px;
height: 32px;
line-height: 24px;
}

QScrollArea {
border: 0;
}

#allFileButton, #localFileButton, #contentTypeButton {
padding-left: 2px;
}

#allFileButton::indicator, #localFileButton::indicator, #contentTypeButton::indicator {
height: 0;
width: 0;
}
13 changes: 10 additions & 3 deletions resources/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
"fullscreen-notification":"You are now in full screen mode. Press ESC to quit!",
"online-files":"Online Files",
"local-files":"Local Files",
"browse-by-category":"Browse By Category",
"browse-by-language":"Browse By Language",
"category":"Category",
"language":"Language",
"hide":"Hide",
"open-in-browser":"Open in browser",
"start-kiwix-server":"Start Kiwix Server",
Expand Down Expand Up @@ -154,5 +154,12 @@
"couldnt-open-location-text": "Kiwix is not able to open folder {{FOLDER}}",
"move-files-to-trash": "Move deleted files to trash",
"move-files-to-trash-text": "This action will move the file to trash.",
"perma-delete-files-text": "This action will permanently delete the file."
"perma-delete-files-text": "This action will permanently delete the file.",
"clear-filter": "Clear the currently set filters",
"language-searcher-placeholder": "Filter language",
"category-searcher-placeholder": "Filter category",
"content-type-searcher-placeholder": "Filter content type",
"no-details": "Introduction only",
"no-pictures": "No Pictures",
"no-videos": "No Videos"
}
1 change: 1 addition & 0 deletions resources/icons/xmark-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/kiwix.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@
<file>icons/caret-up-solid.svg</file>
<file>icons/kiwix-logo.svg</file>
<file>icons/check-solid.svg</file>
<file>icons/xmark-solid.svg</file>
</qresource>
</RCC>
2 changes: 2 additions & 0 deletions resources/style.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
<file>css/popup.css</file>
<file>css/localServer.css</file>
<file>css/confirmBox.css</file>
<file>css/contentmanagerside.css</file>
<file>css/choiceBox.css</file>
</qresource>
</RCC>
32 changes: 32 additions & 0 deletions src/choiceitem.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "choiceitem.h"
#include "ui_choiceitem.h"
#include <QFile>
#include <QMouseEvent>
#include "kiwixapp.h"

ChoiceItem::ChoiceItem(QString key, QString value, QWidget *parent) :
QWidget(parent),
ui(new Ui::ChoiceItem),
m_key(key),
m_value(value)
{
ui->setupUi(this);
this->setStyleSheet(KiwixApp::instance()->parseStyleFromFile(":/css/choiceBox.css"));
ui->itemLabel->setText(key);
ui->itemLabel->setToolTip(key);
connect(ui->closeButton, &QPushButton::clicked, [=](){
emit(closeButtonClicked(ui->itemLabel->text()));
});
ui->closeButton->setCursor(Qt::PointingHandCursor);
}

ChoiceItem::~ChoiceItem()
{
delete ui;
}

void ChoiceItem::mousePressEvent(QMouseEvent *event)
{
Q_UNUSED(event);
return;
}
32 changes: 32 additions & 0 deletions src/choiceitem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef CHOICEITEM_H
#define CHOICEITEM_H

#include <QWidget>

namespace Ui {
class ChoiceItem;
}

class ChoiceItem : public QWidget
{
Q_OBJECT

public:
explicit ChoiceItem(QString key, QString value, QWidget *parent = nullptr);
~ChoiceItem();
QString getKey() { return m_key; }
QString getValue() { return m_value; }

protected:
void mousePressEvent(QMouseEvent *event) override;

private:
Ui::ChoiceItem *ui;
QString m_key;
QString m_value;

signals:
void closeButtonClicked(QString);
};

#endif // CHOICEITEM_H
Loading
Loading