fix: svgify moderation button (#6398)
This commit is contained in:
@@ -95,6 +95,7 @@
|
||||
- Dev: Made "add split" button (part of the split header) a natively rendered button. (#6349)
|
||||
- Dev: Made Settings & Account button on Linux/macOS SVGs. (#6267)
|
||||
- Dev: Made "Chatters" button an SVG. (#6397)
|
||||
- Dev: Made "Moderation" button an SVG. (#6398)
|
||||
- Dev: Made user card "pin" button SVGs. (#6399)
|
||||
- Dev: Some more setting widget refactors. (#6317)
|
||||
- Dev: Emoji style / set is now stored lowercase (and matched case-insensitively). Changing emoji style from this point on and then running an old version might mean you will use the Twitter emoji style by default. (#6300)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 512 B |
Binary file not shown.
|
Before Width: | Height: | Size: 589 B |
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="200mm"
|
||||
height="200mm"
|
||||
viewBox="0 0 200 200"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
sodipodi:docname="drawing.svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
/>
|
||||
<g fill="#ff00ff">
|
||||
<path
|
||||
style="fill:none;stroke:#c0c0c0;stroke-width:12"
|
||||
d="
|
||||
M 185,10
|
||||
H 150
|
||||
L 60,100
|
||||
|
||||
L 40,80
|
||||
L 25,95
|
||||
|
||||
L 50,120
|
||||
|
||||
L 20,150
|
||||
|
||||
L 45,175
|
||||
|
||||
L 75,145
|
||||
|
||||
L 100,170
|
||||
|
||||
L 115,155
|
||||
L 95,135
|
||||
L 185,45
|
||||
Z
|
||||
"
|
||||
sodipodi:nodetypes="cccccccccsccsc" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 853 B |
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="200mm"
|
||||
height="200mm"
|
||||
viewBox="0 0 200 200"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
sodipodi:docname="drawing.svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
/>
|
||||
<g fill="#ff00ff">
|
||||
<path
|
||||
style="fill:none;stroke:#424242;stroke-width:12"
|
||||
d="
|
||||
M 185,10
|
||||
H 150
|
||||
L 60,100
|
||||
|
||||
L 40,80
|
||||
L 25,95
|
||||
|
||||
L 50,120
|
||||
|
||||
L 20,150
|
||||
|
||||
L 45,175
|
||||
|
||||
L 75,145
|
||||
|
||||
L 100,170
|
||||
|
||||
L 115,155
|
||||
L 95,135
|
||||
L 185,45
|
||||
Z
|
||||
"
|
||||
sodipodi:nodetypes="cccccccccsccsc" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 853 B |
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="200mm"
|
||||
height="200mm"
|
||||
viewBox="0 0 200 200"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
sodipodi:docname="drawing.svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
/>
|
||||
<g fill="#ff00ff">
|
||||
<path
|
||||
style="fill:#00ff00;stroke:#424242;stroke-width:12"
|
||||
d="
|
||||
M 185,10
|
||||
H 150
|
||||
L 60,100
|
||||
|
||||
L 40,80
|
||||
L 25,95
|
||||
|
||||
L 50,120
|
||||
|
||||
L 20,150
|
||||
|
||||
L 45,175
|
||||
|
||||
L 75,145
|
||||
|
||||
L 100,170
|
||||
|
||||
L 115,155
|
||||
L 95,135
|
||||
L 185,45
|
||||
Z
|
||||
"
|
||||
sodipodi:nodetypes="cccccccccsccsc" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 856 B |
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="200mm"
|
||||
height="200mm"
|
||||
viewBox="0 0 200 200"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
sodipodi:docname="drawing.svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
/>
|
||||
<g fill="#ff00ff">
|
||||
<path
|
||||
style="fill:#00ff00;stroke:#424242;stroke-width:12"
|
||||
d="
|
||||
M 185,10
|
||||
H 150
|
||||
L 60,100
|
||||
|
||||
L 40,80
|
||||
L 25,95
|
||||
|
||||
L 50,120
|
||||
|
||||
L 20,150
|
||||
|
||||
L 45,175
|
||||
|
||||
L 75,145
|
||||
|
||||
L 100,170
|
||||
|
||||
L 115,155
|
||||
L 95,135
|
||||
L 185,45
|
||||
Z
|
||||
"
|
||||
sodipodi:nodetypes="cccccccccsccsc" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 856 B |
@@ -18,6 +18,7 @@ SvgButton::SvgButton(Src source, BaseWidget *parent, QSize padding)
|
||||
|
||||
void SvgButton::setSource(Src source)
|
||||
{
|
||||
// TODO: compare sources before trying to load / invalidate?
|
||||
this->source_ = std::move(source);
|
||||
this->loadSource();
|
||||
this->invalidateContent();
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "providers/twitch/TwitchAccount.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "singletons/Resources.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/StreamerMode.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
@@ -22,7 +21,6 @@
|
||||
#include "util/LayoutHelper.hpp"
|
||||
#include "widgets/buttons/DrawnButton.hpp"
|
||||
#include "widgets/buttons/LabelButton.hpp"
|
||||
#include "widgets/buttons/PixmapButton.hpp"
|
||||
#include "widgets/buttons/SvgButton.hpp"
|
||||
#include "widgets/dialogs/SettingsDialog.hpp"
|
||||
#include "widgets/helper/CommonTexts.hpp"
|
||||
@@ -290,6 +288,13 @@ void SplitHeader::initializeLayout()
|
||||
{
|
||||
assert(this->layout() == nullptr);
|
||||
|
||||
this->moderationButton_ = new SvgButton(
|
||||
{
|
||||
.dark = ":/buttons/moderationDisabled-darkMode.svg",
|
||||
.light = ":/buttons/moderationDisabled-lightMode.svg",
|
||||
},
|
||||
this, {5, 5});
|
||||
|
||||
this->chattersButton_ = new SvgButton(
|
||||
{
|
||||
.dark = ":/buttons/chatters-darkMode.svg",
|
||||
@@ -336,42 +341,7 @@ void SplitHeader::initializeLayout()
|
||||
w->setMenu(this->createChatModeMenu());
|
||||
}),
|
||||
// moderator
|
||||
this->moderationButton_ = makeWidget<PixmapButton>([&](auto w) {
|
||||
QObject::connect(
|
||||
w, &Button::clicked, this,
|
||||
[this, w](Qt::MouseButton button) mutable {
|
||||
switch (button)
|
||||
{
|
||||
case Qt::LeftButton:
|
||||
if (getSettings()->moderationActions.empty())
|
||||
{
|
||||
getApp()->getWindows()->showSettingsDialog(
|
||||
this, SettingsDialogPreference::
|
||||
ModerationActions);
|
||||
this->split_->setModerationMode(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto moderationMode =
|
||||
this->split_->getModerationMode();
|
||||
|
||||
this->split_->setModerationMode(
|
||||
!moderationMode);
|
||||
w->setDim(moderationMode
|
||||
? DimButton::Dim::Some
|
||||
: DimButton::Dim::None);
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::RightButton:
|
||||
case Qt::MiddleButton:
|
||||
getApp()->getWindows()->showSettingsDialog(
|
||||
this,
|
||||
SettingsDialogPreference::ModerationActions);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}),
|
||||
this->moderationButton_,
|
||||
// chatter list
|
||||
this->chattersButton_,
|
||||
// dropdown
|
||||
@@ -380,6 +350,37 @@ void SplitHeader::initializeLayout()
|
||||
this->addButton_,
|
||||
});
|
||||
|
||||
QObject::connect(
|
||||
this->moderationButton_, &Button::clicked, this,
|
||||
[this](Qt::MouseButton button) mutable {
|
||||
auto *w = this->moderationButton_;
|
||||
switch (button)
|
||||
{
|
||||
case Qt::LeftButton:
|
||||
if (getSettings()->moderationActions.empty())
|
||||
{
|
||||
getApp()->getWindows()->showSettingsDialog(
|
||||
this, SettingsDialogPreference::ModerationActions);
|
||||
this->split_->setModerationMode(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto moderationMode = this->split_->getModerationMode();
|
||||
|
||||
this->split_->setModerationMode(!moderationMode);
|
||||
// w->setDim(moderationMode ? DimButton::Dim::Some
|
||||
// : DimButton::Dim::None);
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::RightButton:
|
||||
case Qt::MiddleButton:
|
||||
getApp()->getWindows()->showSettingsDialog(
|
||||
this, SettingsDialogPreference::ModerationActions);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
QObject::connect(this->chattersButton_, &Button::leftClicked, this,
|
||||
[this]() {
|
||||
this->split_->openChatterList();
|
||||
@@ -923,9 +924,20 @@ void SplitHeader::updateIcons()
|
||||
auto moderationMode = this->split_->getModerationMode() &&
|
||||
!getSettings()->moderationActions.empty();
|
||||
|
||||
this->moderationButton_->setPixmap(
|
||||
moderationMode ? getResources().buttons.modModeEnabled
|
||||
: getResources().buttons.modModeDisabled);
|
||||
if (moderationMode)
|
||||
{
|
||||
this->moderationButton_->setSource({
|
||||
.dark = ":/buttons/moderationEnabled-darkMode.svg",
|
||||
.light = ":/buttons/moderationEnabled-lightMode.svg",
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
this->moderationButton_->setSource({
|
||||
.dark = ":/buttons/moderationDisabled-darkMode.svg",
|
||||
.light = ":/buttons/moderationDisabled-lightMode.svg",
|
||||
});
|
||||
}
|
||||
|
||||
if (twitchChannel->hasModRights() || moderationMode)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace chatterino {
|
||||
|
||||
class SvgButton;
|
||||
class DrawnButton;
|
||||
class PixmapButton;
|
||||
class LabelButton;
|
||||
class Label;
|
||||
class Split;
|
||||
@@ -87,7 +86,7 @@ private:
|
||||
QAction *modeActionSetR9k{};
|
||||
QAction *modeActionSetFollowers{};
|
||||
|
||||
PixmapButton *moderationButton_{};
|
||||
SvgButton *moderationButton_{};
|
||||
SvgButton *chattersButton_{};
|
||||
DrawnButton *addButton_{};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user