1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

AbstractButtonInterface: Rename badgeLabelText -> badgeText

This commit is contained in:
David Rosca 2018-01-06 15:56:09 +01:00
parent 15a2afb4b6
commit ba2ea9cb09
4 changed files with 15 additions and 15 deletions

View File

@ -382,8 +382,8 @@ void NavigationBar::aboutToShowToolsMenu()
AbstractButtonInterface *button = data.button; AbstractButtonInterface *button = data.button;
if (button && !m_layoutIds.contains(data.id)) { if (button && !m_layoutIds.contains(data.id)) {
QString title = button->title(); QString title = button->title();
if (!button->badgeLabelText().isEmpty()) { if (!button->badgeText().isEmpty()) {
title.append(QSL(" (%1)").arg(button->badgeLabelText())); title.append(QSL(" (%1)").arg(button->badgeText()));
} }
m_menuTools->addAction(button->icon(), title, this, &NavigationBar::toolActionActivated)->setData(data.id); m_menuTools->addAction(button->icon(), title, this, &NavigationBar::toolActionActivated)->setData(data.id);
} }

View File

@ -43,7 +43,7 @@ NavigationBarToolButton::NavigationBarToolButton(AbstractButtonInterface *button
connect(button, &AbstractButtonInterface::iconChanged, this, &NavigationBarToolButton::updateIcon); connect(button, &AbstractButtonInterface::iconChanged, this, &NavigationBarToolButton::updateIcon);
connect(button, &AbstractButtonInterface::activeChanged, this, &NavigationBarToolButton::updateIcon); connect(button, &AbstractButtonInterface::activeChanged, this, &NavigationBarToolButton::updateIcon);
connect(button, &AbstractButtonInterface::toolTipChanged, this, &NavigationBarToolButton::setToolTip); connect(button, &AbstractButtonInterface::toolTipChanged, this, &NavigationBarToolButton::setToolTip);
connect(button, &AbstractButtonInterface::badgeLabelTextChanged, this, &NavigationBarToolButton::updateBadge); connect(button, &AbstractButtonInterface::badgeTextChanged, this, &NavigationBarToolButton::updateBadge);
connect(this, &ToolButton::clicked, this, &NavigationBarToolButton::clicked); connect(this, &ToolButton::clicked, this, &NavigationBarToolButton::clicked);
} }
@ -74,10 +74,10 @@ void NavigationBarToolButton::updateIcon()
void NavigationBarToolButton::updateBadge() void NavigationBarToolButton::updateBadge()
{ {
if (m_button->badgeLabelText().isEmpty()) { if (m_button->badgeText().isEmpty()) {
m_badgeLabel->hide(); m_badgeLabel->hide();
} else { } else {
m_badgeLabel->setText(m_button->badgeLabelText()); m_badgeLabel->setText(m_button->badgeText());
m_badgeLabel->resize(m_badgeLabel->sizeHint()); m_badgeLabel->resize(m_badgeLabel->sizeHint());
m_badgeLabel->move(width() - m_badgeLabel->width(), 0); m_badgeLabel->move(width() - m_badgeLabel->width(), 0);
m_badgeLabel->show(); m_badgeLabel->show();

View File

@ -83,19 +83,19 @@ void AbstractButtonInterface::setIcon(const QIcon &icon)
emit iconChanged(icon); emit iconChanged(icon);
} }
QString AbstractButtonInterface::badgeLabelText() const QString AbstractButtonInterface::badgeText() const
{ {
return m_badgeLabelText; return m_badgeText;
} }
void AbstractButtonInterface::setBadgeLabelText(const QString &badgeLabelText) void AbstractButtonInterface::setBadgeText(const QString &badgeText)
{ {
if (m_badgeLabelText == badgeLabelText) { if (m_badgeText == badgeText) {
return; return;
} }
m_badgeLabelText = badgeLabelText; m_badgeText = badgeText;
emit badgeLabelTextChanged(m_badgeLabelText); emit badgeTextChanged(m_badgeText);
} }
WebPage *AbstractButtonInterface::webPage() const WebPage *AbstractButtonInterface::webPage() const

View File

@ -55,8 +55,8 @@ public:
QIcon icon() const; QIcon icon() const;
void setIcon(const QIcon &icon); void setIcon(const QIcon &icon);
QString badgeLabelText() const; QString badgeText() const;
void setBadgeLabelText(const QString &badgeLabelText); void setBadgeText(const QString &badgeText);
WebPage *webPage() const; WebPage *webPage() const;
void setWebPage(WebPage *page); void setWebPage(WebPage *page);
@ -66,7 +66,7 @@ signals:
void titleChanged(const QString &title); void titleChanged(const QString &title);
void toolTipChanged(const QString &toolTip); void toolTipChanged(const QString &toolTip);
void iconChanged(const QIcon &icon); void iconChanged(const QIcon &icon);
void badgeLabelTextChanged(const QString &badgeLabelText); void badgeTextChanged(const QString &badgeText);
void webPageChanged(WebPage *page); void webPageChanged(WebPage *page);
void clicked(ClickController *controller); void clicked(ClickController *controller);
@ -75,6 +75,6 @@ private:
QString m_title; QString m_title;
QString m_toolTip; QString m_toolTip;
QIcon m_icon; QIcon m_icon;
QString m_badgeLabelText; QString m_badgeText;
WebPage *m_page = nullptr; WebPage *m_page = nullptr;
}; };