refactor: Make Account & Settings buttons SVGs (#6267)
instead of rendering the icons directly in Chatterino, they're now SVGs This has the following consequences: 1. The color does _not_ respect your custom theme. For most users, this will not be a problem/concern. 2. You can no longer drag a split onto those buttons to create a new tab
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "widgets/buttons/InitUpdateButton.hpp"
|
||||
#include "widgets/buttons/NotebookButton.hpp"
|
||||
#include "widgets/buttons/PixmapButton.hpp"
|
||||
#include "widgets/buttons/SvgButton.hpp"
|
||||
#include "widgets/dialogs/SettingsDialog.hpp"
|
||||
#include "widgets/helper/ChannelView.hpp"
|
||||
#include "widgets/helper/NotebookTab.hpp"
|
||||
@@ -1407,7 +1408,12 @@ void SplitNotebook::showEvent(QShowEvent * /*event*/)
|
||||
void SplitNotebook::addCustomButtons()
|
||||
{
|
||||
// settings
|
||||
auto *settingsBtn = this->addCustomButton<NotebookButton>();
|
||||
auto *settingsBtn = this->addCustomButton<SvgButton>(SvgButton::Src{
|
||||
.dark = ":/buttons/settings-darkMode.svg",
|
||||
.light = ":/buttons/settings-lightMode.svg",
|
||||
});
|
||||
|
||||
settingsBtn->setPadding({0, 0});
|
||||
|
||||
// This is to ensure you can't lock yourself out of the settings
|
||||
if (getApp()->getArgs().safeMode)
|
||||
@@ -1426,14 +1432,18 @@ void SplitNotebook::addCustomButtons()
|
||||
this->signalHolder_);
|
||||
}
|
||||
|
||||
settingsBtn->setIcon(NotebookButton::Settings);
|
||||
|
||||
QObject::connect(settingsBtn, &NotebookButton::leftClicked, [this] {
|
||||
QObject::connect(settingsBtn, &Button::leftClicked, [this] {
|
||||
getApp()->getWindows()->showSettingsDialog(this);
|
||||
});
|
||||
|
||||
// account
|
||||
auto *userBtn = this->addCustomButton<NotebookButton>();
|
||||
auto *userBtn = this->addCustomButton<SvgButton>(SvgButton::Src{
|
||||
.dark = ":/buttons/account-darkMode.svg",
|
||||
.light = ":/buttons/account-lightMode.svg",
|
||||
});
|
||||
|
||||
userBtn->setPadding({0, 0});
|
||||
|
||||
userBtn->setVisible(!getSettings()->hideUserButton.getValue());
|
||||
getSettings()->hideUserButton.connect(
|
||||
[userBtn](bool hide, auto) {
|
||||
@@ -1441,8 +1451,7 @@ void SplitNotebook::addCustomButtons()
|
||||
},
|
||||
this->signalHolder_);
|
||||
|
||||
userBtn->setIcon(NotebookButton::User);
|
||||
QObject::connect(userBtn, &NotebookButton::leftClicked, [this, userBtn] {
|
||||
QObject::connect(userBtn, &Button::leftClicked, [this, userBtn] {
|
||||
getApp()->getWindows()->showAccountSelectPopup(
|
||||
this->mapToGlobal(userBtn->rect().bottomRight()));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user