mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-08-03 20:56:49 -04:00
Introduce Select All Button to MultiZim
This commit is contained in:
parent
7fe06f5738
commit
fdfd0efca0
@ -121,6 +121,32 @@ ZimItemWidget QRadioButton::indicator:checked {
|
||||
image: url(:/icons/tick.svg);
|
||||
}
|
||||
|
||||
#selectAllButton {
|
||||
background-color: white;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
font-weight: 500;
|
||||
padding: 5px 10px 10px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#selectAllButton::indicator {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
#selectAllButton::indicator:focus {
|
||||
background-color: #D9E9FF;
|
||||
}
|
||||
|
||||
#selectAllButton::indicator:unchecked {
|
||||
image: url(:/icons/checkbox.svg);
|
||||
}
|
||||
|
||||
#selectAllButton::indicator:checked {
|
||||
image: url(:/icons/checkbox-active.svg);
|
||||
}
|
||||
|
||||
TopWidget QToolButton:pressed,
|
||||
TopWidget QToolButton::hover {
|
||||
border: 1px solid #3366CC;
|
||||
|
@ -173,5 +173,6 @@
|
||||
"scroll-next-tab": "Scroll to next tab",
|
||||
"scroll-previous-tab": "Scroll to previous tab",
|
||||
"kiwix-search": "Kiwix search",
|
||||
"search-options": "Search Options"
|
||||
"search-options": "Search Options",
|
||||
"select-all": "Select all"
|
||||
}
|
||||
|
@ -181,5 +181,6 @@
|
||||
"scroll-next-tab": "Represents the action of scrolling to the next tab of the current tab which toward the end of the tab bar.",
|
||||
"scroll-previous-tab": "Represents the action of scrolling to the previous tab of the current tab which toward the start of the tab bar.",
|
||||
"kiwix-search": "Title text for a list of search results, which notes to the user those are from Kiwix's Search Engine",
|
||||
"search-options": "The term for a collection of additional search filtering options to help users narrow down search results."
|
||||
"search-options": "The term for a collection of additional search filtering options to help users narrow down search results.",
|
||||
"select-all": "Represents the action of selecting all items in a collection."
|
||||
}
|
||||
|
@ -12,16 +12,23 @@ QString getElidedText(const QFont& font, int length, const QString& text);
|
||||
MultiZimButton::MultiZimButton(QWidget *parent) :
|
||||
QToolButton(parent),
|
||||
mp_buttonList(new QListWidget),
|
||||
mp_radioButtonGroup(new QButtonGroup(this))
|
||||
mp_radioButtonGroup(new QButtonGroup(this)),
|
||||
mp_selectAllButton(new QCheckBox(gt("select-all"), this))
|
||||
{
|
||||
setMenu(new QMenu(this));
|
||||
setPopupMode(QToolButton::InstantPopup);
|
||||
setDefaultAction(KiwixApp::instance()->getAction(KiwixApp::OpenMultiZimAction));
|
||||
connect(this, &QToolButton::triggered, this, &MultiZimButton::showMenu);
|
||||
|
||||
const auto popupAction = new QWidgetAction(menu());
|
||||
popupAction->setDefaultWidget(mp_buttonList);
|
||||
menu()->addAction(popupAction);
|
||||
mp_selectAllButton->setObjectName("selectAllButton");
|
||||
const auto align = KiwixApp::isRightToLeft() ? Qt::LeftToRight : Qt::RightToLeft;
|
||||
mp_selectAllButton->setLayoutDirection(align);
|
||||
|
||||
const auto buttonListAction = new QWidgetAction(menu());
|
||||
const auto selectAllAction = new QWidgetAction(menu());
|
||||
buttonListAction->setDefaultWidget(mp_buttonList);
|
||||
selectAllAction->setDefaultWidget(mp_selectAllButton);
|
||||
menu()->addActions({buttonListAction, selectAllAction});
|
||||
|
||||
connect(mp_buttonList, &QListWidget::currentRowChanged, this, [=](int row){
|
||||
if (const auto widget = getZimWidget(row))
|
||||
|
@ -8,6 +8,7 @@ class QButtonGroup;
|
||||
class QListWidgetItem;
|
||||
class QRadioButton;
|
||||
class QLabel;
|
||||
class QCheckBox;
|
||||
|
||||
class ZimItemWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
@ -36,6 +37,7 @@ public slots:
|
||||
private:
|
||||
QListWidget* mp_buttonList;
|
||||
QButtonGroup* mp_radioButtonGroup;
|
||||
QCheckBox* mp_selectAllButton;
|
||||
|
||||
ZimItemWidget* getZimWidget(int row) const;
|
||||
void setItemZimWidget(QListWidgetItem* item, const QString& title, const QIcon& icon);
|
||||
|
Loading…
x
Reference in New Issue
Block a user