mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-26 22:31:49 -04:00
Merge pull request #404 from kiwix/content-type-filter
This commit is contained in:
commit
2c988568c3
@ -41,6 +41,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
src/contenttypefilter.cpp \
|
||||||
src/findinpagebar.cpp \
|
src/findinpagebar.cpp \
|
||||||
src/translation.cpp \
|
src/translation.cpp \
|
||||||
src/main.cpp \
|
src/main.cpp \
|
||||||
@ -72,6 +73,7 @@ SOURCES += \
|
|||||||
src/static_content.cpp
|
src/static_content.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
src/contenttypefilter.h \
|
||||||
src/findinpagebar.h \
|
src/findinpagebar.h \
|
||||||
src/translation.h \
|
src/translation.h \
|
||||||
src/mainwindow.h \
|
src/mainwindow.h \
|
||||||
|
@ -237,6 +237,10 @@ QTabBar::tab:last QToolButton::hover {
|
|||||||
show-decoration-selected: 0;
|
show-decoration-selected: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#contentTypeSelector QCheckBox {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
#categorySelector QScrollBar,
|
#categorySelector QScrollBar,
|
||||||
#languageSelector QScrollBar,
|
#languageSelector QScrollBar,
|
||||||
#readinglistbar QScrollBar {
|
#readinglistbar QScrollBar {
|
||||||
@ -258,6 +262,11 @@ QTabBar::tab:last QToolButton::hover {
|
|||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#contentTypeAllButton,
|
||||||
|
ContentTypeFilter {
|
||||||
|
spacing: 10;
|
||||||
|
}
|
||||||
|
|
||||||
#readinglistbar QLabel {
|
#readinglistbar QLabel {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font: bold;
|
font: bold;
|
||||||
|
@ -104,5 +104,12 @@
|
|||||||
"wikiversity":"Wikiversity",
|
"wikiversity":"Wikiversity",
|
||||||
"wikivoyage":"Wikivoyage",
|
"wikivoyage":"Wikivoyage",
|
||||||
"wiktionary":"Wiktionary",
|
"wiktionary":"Wiktionary",
|
||||||
"fulltext-search":"Fulltext search"
|
"fulltext-search":"Fulltext search",
|
||||||
|
"pictures":"Pictures",
|
||||||
|
"videos":"Videos",
|
||||||
|
"ftindex":"Fulltext index",
|
||||||
|
"details":"Full article",
|
||||||
|
"yes":"yes",
|
||||||
|
"no":"no",
|
||||||
|
"no-filter":"no filter"
|
||||||
}
|
}
|
||||||
|
@ -345,6 +345,12 @@ void ContentManager::setCurrentCategoryFilter(QString category)
|
|||||||
emit(filterParamsChanged());
|
emit(filterParamsChanged());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContentManager::setCurrentContentTypeFilter(QList<ContentTypeFilter*>& contentTypeFilters)
|
||||||
|
{
|
||||||
|
m_contentTypeFilters = contentTypeFilters;
|
||||||
|
emit(filterParamsChanged());
|
||||||
|
}
|
||||||
|
|
||||||
void ContentManager::updateLibrary() {
|
void ContentManager::updateLibrary() {
|
||||||
if (m_local) {
|
if (m_local) {
|
||||||
emit(pendingRequest(false));
|
emit(pendingRequest(false));
|
||||||
@ -378,7 +384,6 @@ QStringList ContentManager::getBookIds()
|
|||||||
std::vector<std::string> tags;
|
std::vector<std::string> tags;
|
||||||
if (m_categoryFilter != "all" && m_categoryFilter != "other") {
|
if (m_categoryFilter != "all" && m_categoryFilter != "other") {
|
||||||
tags.push_back("_category:"+m_categoryFilter.toStdString());
|
tags.push_back("_category:"+m_categoryFilter.toStdString());
|
||||||
filter.acceptTags(tags);
|
|
||||||
}
|
}
|
||||||
if (m_categoryFilter == "other") {
|
if (m_categoryFilter == "other") {
|
||||||
for (auto& category: S_CATEGORIES) {
|
for (auto& category: S_CATEGORIES) {
|
||||||
@ -388,6 +393,18 @@ QStringList ContentManager::getBookIds()
|
|||||||
}
|
}
|
||||||
filter.rejectTags(tags);
|
filter.rejectTags(tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto &contentTypeFilter : m_contentTypeFilters) {
|
||||||
|
auto state = contentTypeFilter->checkState();
|
||||||
|
auto filter = contentTypeFilter->getName();
|
||||||
|
if (state == Qt::PartiallyChecked) {
|
||||||
|
tags.push_back("_" + filter.toStdString() +":yes");
|
||||||
|
} else if (state == Qt::Checked) {
|
||||||
|
tags.push_back("_" + filter.toStdString() +":no");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
filter.acceptTags(tags);
|
||||||
filter.query(m_searchQuery.toStdString());
|
filter.query(m_searchQuery.toStdString());
|
||||||
|
|
||||||
if (m_local) {
|
if (m_local) {
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "contentmanagerview.h"
|
#include "contentmanagerview.h"
|
||||||
#include <kiwix/downloader.h>
|
#include <kiwix/downloader.h>
|
||||||
#include "opdsrequestmanager.h"
|
#include "opdsrequestmanager.h"
|
||||||
|
#include "contenttypefilter.h"
|
||||||
|
|
||||||
class ContentManager : public QObject
|
class ContentManager : public QObject
|
||||||
{
|
{
|
||||||
@ -25,6 +26,7 @@ public:
|
|||||||
QStringList getDownloadIds();
|
QStringList getDownloadIds();
|
||||||
void setCurrentLanguage(QString language);
|
void setCurrentLanguage(QString language);
|
||||||
void setCurrentCategoryFilter(QString category);
|
void setCurrentCategoryFilter(QString category);
|
||||||
|
void setCurrentContentTypeFilter(QList<ContentTypeFilter*>& contentTypeFilter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Library* mp_library;
|
Library* mp_library;
|
||||||
@ -36,6 +38,7 @@ private:
|
|||||||
QString m_currentLanguage;
|
QString m_currentLanguage;
|
||||||
QString m_searchQuery;
|
QString m_searchQuery;
|
||||||
QString m_categoryFilter = "all";
|
QString m_categoryFilter = "all";
|
||||||
|
QList<ContentTypeFilter*> m_contentTypeFilters;
|
||||||
kiwix::supportedListSortBy m_sortBy = kiwix::UNSORTED;
|
kiwix::supportedListSortBy m_sortBy = kiwix::UNSORTED;
|
||||||
bool m_sortOrderAsc = true;
|
bool m_sortOrderAsc = true;
|
||||||
|
|
||||||
|
@ -28,15 +28,58 @@ ContentManagerSide::ContentManagerSide(QWidget *parent) :
|
|||||||
mp_ui->localFileButton ->setText(gt("local-files"));
|
mp_ui->localFileButton ->setText(gt("local-files"));
|
||||||
mp_ui->languageButton->setText(gt("browse-by-language"));
|
mp_ui->languageButton->setText(gt("browse-by-language"));
|
||||||
mp_ui->categoryButton->setText(gt("browse-by-category"));
|
mp_ui->categoryButton->setText(gt("browse-by-category"));
|
||||||
|
mp_ui->contentTypeButton->setText(gt("content-type"));
|
||||||
|
|
||||||
mp_languageButton = mp_ui->languageButton;
|
mp_languageButton = mp_ui->languageButton;
|
||||||
mp_languageSelector = mp_ui->languageSelector;
|
mp_languageSelector = mp_ui->languageSelector;
|
||||||
connect(mp_languageButton, &QCheckBox::toggled, this, [=](bool checked) { mp_languageSelector->setHidden(!checked); });
|
connect(mp_languageButton, &QCheckBox::toggled, this, [=](bool checked) { mp_languageSelector->setHidden(!checked); });
|
||||||
mp_languageSelector->setHidden(true);
|
mp_languageSelector->setHidden(true);
|
||||||
|
|
||||||
mp_categoryButton = mp_ui->categoryButton;
|
mp_categoryButton = mp_ui->categoryButton;
|
||||||
mp_categorySelector = mp_ui->categorySelector;
|
mp_categorySelector = mp_ui->categorySelector;
|
||||||
connect(mp_categoryButton, &QCheckBox::toggled, this, [=](bool checked) { mp_categorySelector->setHidden(!checked); });
|
connect(mp_categoryButton, &QCheckBox::toggled, this, [=](bool checked) { mp_categorySelector->setHidden(!checked); });
|
||||||
mp_categorySelector->setHidden(true);
|
mp_categorySelector->setHidden(true);
|
||||||
mp_ui->contentTypeButton->hide();
|
|
||||||
|
mp_contentTypeButton = mp_ui->contentTypeButton;
|
||||||
|
connect(mp_contentTypeButton, &QCheckBox::toggled, this, [=](bool checked) { mp_ui->contentTypeSelector->setHidden(!checked); });
|
||||||
|
mp_ui->contentTypeSelector->setHidden(true);
|
||||||
|
|
||||||
|
mp_ui->contentTypeAllButton->setText(gt("all"));
|
||||||
|
mp_ui->contentTypeAllButton->setStyleSheet("*{font-weight: bold}");
|
||||||
|
connect(mp_ui->contentTypeAllButton, &QCheckBox::clicked, this, [=](bool checked) {
|
||||||
|
Q_UNUSED(checked);
|
||||||
|
mp_ui->contentTypeAllButton->setStyleSheet("*{font-weight: bold}");
|
||||||
|
for (auto &contentTypeFilter : m_contentTypeFilters) {
|
||||||
|
contentTypeFilter->setCheckState(Qt::Unchecked);
|
||||||
|
}
|
||||||
|
mp_contentManager->setCurrentContentTypeFilter(m_contentTypeFilters);
|
||||||
|
});
|
||||||
|
|
||||||
|
ContentTypeFilter* videosFilter = new ContentTypeFilter("pictures", this);
|
||||||
|
ContentTypeFilter* picturesFilter = new ContentTypeFilter("videos", this);
|
||||||
|
ContentTypeFilter* detailsFilter = new ContentTypeFilter("details", this);
|
||||||
|
ContentTypeFilter* ftindexFilter = new ContentTypeFilter("ftindex", this);
|
||||||
|
m_contentTypeFilters.push_back(videosFilter);
|
||||||
|
m_contentTypeFilters.push_back(picturesFilter);
|
||||||
|
m_contentTypeFilters.push_back(detailsFilter);
|
||||||
|
m_contentTypeFilters.push_back(ftindexFilter);
|
||||||
|
|
||||||
|
auto layout = static_cast<QVBoxLayout*>(mp_ui->contentTypeSelector->layout());
|
||||||
|
for (auto &contentTypeFilter : m_contentTypeFilters) {
|
||||||
|
layout->addWidget(contentTypeFilter, 0, Qt::AlignTop);
|
||||||
|
connect(contentTypeFilter, &QCheckBox::clicked, this, [=](bool checked) {
|
||||||
|
Q_UNUSED(checked);
|
||||||
|
bool activeFilter = false;
|
||||||
|
for (auto &contentTypeFilter : m_contentTypeFilters) {
|
||||||
|
if (contentTypeFilter->checkState() != Qt::Unchecked) {
|
||||||
|
activeFilter = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mp_ui->contentTypeAllButton->setStyleSheet(activeFilter ? "" : "*{font-weight: bold}");
|
||||||
|
mp_contentManager->setCurrentContentTypeFilter(m_contentTypeFilters);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
for(auto lang: S_LANGUAGES)
|
for(auto lang: S_LANGUAGES)
|
||||||
{
|
{
|
||||||
@ -71,7 +114,6 @@ ContentManagerSide::ContentManagerSide(QWidget *parent) :
|
|||||||
item->setSelected(true);
|
item->setSelected(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentManagerSide::~ContentManagerSide()
|
ContentManagerSide::~ContentManagerSide()
|
||||||
@ -79,7 +121,6 @@ ContentManagerSide::~ContentManagerSide()
|
|||||||
delete mp_ui;
|
delete mp_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ContentManagerSide::setContentManager(ContentManager *contentManager)
|
void ContentManagerSide::setContentManager(ContentManager *contentManager)
|
||||||
{
|
{
|
||||||
mp_contentManager = contentManager;
|
mp_contentManager = contentManager;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include "contentmanager.h"
|
#include "contentmanager.h"
|
||||||
|
#include "contenttypefilter.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class contentmanagerside;
|
class contentmanagerside;
|
||||||
@ -27,6 +28,8 @@ private:
|
|||||||
QListWidget* mp_languageSelector;
|
QListWidget* mp_languageSelector;
|
||||||
QCheckBox* mp_categoryButton;
|
QCheckBox* mp_categoryButton;
|
||||||
QListWidget* mp_categorySelector;
|
QListWidget* mp_categorySelector;
|
||||||
|
QCheckBox* mp_contentTypeButton;
|
||||||
|
QList<ContentTypeFilter*> m_contentTypeFilters;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONTENTMANAGERSIDE_H
|
#endif // CONTENTMANAGERSIDE_H
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>197</width>
|
<width>197</width>
|
||||||
<height>366</height>
|
<height>368</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -23,6 +23,9 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetMaximumSize</enum>
|
||||||
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@ -43,7 +46,7 @@
|
|||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0,0,0,0,0,1">
|
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0,0,0,0,0,0,0">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@ -64,6 +67,12 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="allFileButton">
|
<widget class="QRadioButton" name="allFileButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>All Files</string>
|
<string>All Files</string>
|
||||||
</property>
|
</property>
|
||||||
@ -71,6 +80,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="localFileButton">
|
<widget class="QRadioButton" name="localFileButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Local Files</string>
|
<string>Local Files</string>
|
||||||
</property>
|
</property>
|
||||||
@ -81,6 +96,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="languageButton">
|
<widget class="QCheckBox" name="languageButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Browse By Language</string>
|
<string>Browse By Language</string>
|
||||||
</property>
|
</property>
|
||||||
@ -91,7 +112,7 @@
|
|||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>1</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
@ -119,6 +140,12 @@
|
|||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Browse By Category</string>
|
<string>Browse By Category</string>
|
||||||
</property>
|
</property>
|
||||||
@ -129,7 +156,7 @@
|
|||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>1</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
@ -151,14 +178,63 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="contentTypeButton">
|
<widget class="QCheckBox" name="contentTypeButton">
|
||||||
<property name="enabled">
|
<property name="sizePolicy">
|
||||||
<bool>false</bool>
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Content Type</string>
|
<string>Content Type</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="contentTypeSelector">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Sunken</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="contentTypeAllButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>All</string>
|
||||||
|
</property>
|
||||||
|
<property name="tristate">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
21
src/contenttypefilter.cpp
Normal file
21
src/contenttypefilter.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "contenttypefilter.h"
|
||||||
|
#include "kiwixapp.h"
|
||||||
|
|
||||||
|
ContentTypeFilter::ContentTypeFilter(QString name, QWidget *parent)
|
||||||
|
: QCheckBox(parent),
|
||||||
|
m_name(name)
|
||||||
|
{
|
||||||
|
setTristate(true);
|
||||||
|
|
||||||
|
m_states[Qt::Unchecked] = gt("no-filter");
|
||||||
|
m_states[Qt::PartiallyChecked] = gt("yes");
|
||||||
|
m_states[Qt::Checked] = gt("no");
|
||||||
|
setText(gt(m_name) + " : " + m_states[checkState()]);
|
||||||
|
connect(this, &QCheckBox::stateChanged, this, &ContentTypeFilter::onStateChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContentTypeFilter::onStateChanged(int state)
|
||||||
|
{
|
||||||
|
setText(gt(m_name) + " : " + m_states[static_cast<Qt::CheckState>(state)]);
|
||||||
|
setStyleSheet((state == 0) ? "" : "*{font-weight: bold}");
|
||||||
|
}
|
25
src/contenttypefilter.h
Normal file
25
src/contenttypefilter.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef CONTENTTYPEFILTER_H
|
||||||
|
#define CONTENTTYPEFILTER_H
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QMap>
|
||||||
|
|
||||||
|
class ContentTypeFilter : public QCheckBox
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ContentTypeFilter(QString name, QWidget *parent = nullptr);
|
||||||
|
virtual ~ContentTypeFilter() {}
|
||||||
|
|
||||||
|
QString getName() { return m_name; }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void onStateChanged(int state);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_name;
|
||||||
|
QMap<Qt::CheckState, QString> m_states;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CONTENTTYPEFILTER_H
|
Loading…
x
Reference in New Issue
Block a user