mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Added some functionality to the accountPopup (#117)
* Added some buttons. * Added some more functionality. * Finished adding button functionality. * Implemented @fourtf's suggestions.
This commit is contained in:
parent
206a3518b0
commit
881e695189
16 changed files with 555 additions and 130 deletions
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>317</width>
|
<width>461</width>
|
||||||
<height>145</height>
|
<height>301</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -23,52 +23,6 @@
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="1" column="1" rowspan="2" colspan="2">
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Views:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="lblViews">
|
|
||||||
<property name="text">
|
|
||||||
<string>Loading...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Followers:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLabel" name="lblFollowers">
|
|
||||||
<property name="text">
|
|
||||||
<string>Loading...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>Created at:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLabel" name="lblAccountAge">
|
|
||||||
<property name="text">
|
|
||||||
<string>Loading...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" rowspan="3">
|
<item row="0" column="0" rowspan="3">
|
||||||
<widget class="QLabel" name="lblAvatar">
|
<widget class="QLabel" name="lblAvatar">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
|
@ -128,6 +82,248 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1" rowspan="2" colspan="2">
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Views:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="lblViews">
|
||||||
|
<property name="text">
|
||||||
|
<string>Loading...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Followers:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="lblFollowers">
|
||||||
|
<property name="text">
|
||||||
|
<string>Loading...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Created at:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLabel" name="lblAccountAge">
|
||||||
|
<property name="text">
|
||||||
|
<string>Loading...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QWidget" name="profileLayout" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="copy">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>25</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Copy Username</string>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">qproperty-icon: url(:/images/CopyLongTextToClipboard_16x.png)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="profile">
|
||||||
|
<property name="text">
|
||||||
|
<string>Profile</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" colspan="3">
|
||||||
|
<widget class="QWidget" name="userLayout" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="follow">
|
||||||
|
<property name="text">
|
||||||
|
<string>Follow</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="ignore">
|
||||||
|
<property name="text">
|
||||||
|
<string>Ignore</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="disableHighlights">
|
||||||
|
<property name="text">
|
||||||
|
<string>Disable Highlights</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="enableHighlights">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable Highlights</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="sendMessage">
|
||||||
|
<property name="text">
|
||||||
|
<string>Message</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0" colspan="3">
|
||||||
|
<widget class="QWidget" name="modLayout" native="true">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="ban">
|
||||||
|
<property name="text">
|
||||||
|
<string>Ban</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="purge">
|
||||||
|
<property name="text">
|
||||||
|
<string>Purge</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QPushButton" name="unBan">
|
||||||
|
<property name="text">
|
||||||
|
<string>Unban</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QPushButton" name="min10">
|
||||||
|
<property name="text">
|
||||||
|
<string>10 Mins</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QPushButton" name="hour24">
|
||||||
|
<property name="text">
|
||||||
|
<string>24 Hours</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QPushButton" name="min1">
|
||||||
|
<property name="text">
|
||||||
|
<string>1 Min</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QPushButton" name="hour1">
|
||||||
|
<property name="text">
|
||||||
|
<string>1 Hour</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0" colspan="2">
|
||||||
|
<widget class="QWidget" name="ownerLayout" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="mod">
|
||||||
|
<property name="text">
|
||||||
|
<string>Mod</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="unMod">
|
||||||
|
<property name="text">
|
||||||
|
<string>Unmod</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
|
@ -35,6 +35,7 @@ public:
|
||||||
// methods
|
// methods
|
||||||
void addMessage(messages::SharedMessage message);
|
void addMessage(messages::SharedMessage message);
|
||||||
QString name;
|
QString name;
|
||||||
|
QStringList modList;
|
||||||
|
|
||||||
virtual bool canSendMessage() const;
|
virtual bool canSendMessage() const;
|
||||||
virtual void sendMessage(const QString &message);
|
virtual void sendMessage(const QString &message);
|
||||||
|
|
|
@ -270,6 +270,8 @@ void IrcManager::messageReceived(Communi::IrcMessage *message)
|
||||||
this->handleWhisperMessage(message);
|
this->handleWhisperMessage(message);
|
||||||
} else if (command == "USERNOTICE") {
|
} else if (command == "USERNOTICE") {
|
||||||
this->handleUserNoticeMessage(message);
|
this->handleUserNoticeMessage(message);
|
||||||
|
} else if (command == "MODE") {
|
||||||
|
this->handleModeMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,6 +311,18 @@ void IrcManager::handleUserNoticeMessage(Communi::IrcMessage *message)
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IrcManager::handleModeMessage(Communi::IrcMessage *message)
|
||||||
|
{
|
||||||
|
auto channel = channelManager.getTwitchChannel(message->parameter(0).remove(0,1));
|
||||||
|
if(message->parameter(1) == "+o")
|
||||||
|
{
|
||||||
|
channel->modList.append(message->parameter(2));
|
||||||
|
} else if(message->parameter(1) == "-o")
|
||||||
|
{
|
||||||
|
channel->modList.append(message->parameter(2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool IrcManager::isTwitchBlockedUser(QString const &username)
|
bool IrcManager::isTwitchBlockedUser(QString const &username)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&this->twitchBlockedUsersMutex);
|
QMutexLocker locker(&this->twitchBlockedUsersMutex);
|
||||||
|
|
|
@ -90,6 +90,7 @@ private:
|
||||||
void handleUserStateMessage(Communi::IrcMessage *message);
|
void handleUserStateMessage(Communi::IrcMessage *message);
|
||||||
void handleWhisperMessage(Communi::IrcMessage *message);
|
void handleWhisperMessage(Communi::IrcMessage *message);
|
||||||
void handleUserNoticeMessage(Communi::IrcMessage *message);
|
void handleUserNoticeMessage(Communi::IrcMessage *message);
|
||||||
|
void handleModeMessage(Communi::IrcMessage *message);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -35,6 +35,7 @@ SettingsManager::SettingsManager()
|
||||||
, pathHighlightSound(this->settingsItems, "pathHighlightSound", "qrc:/sounds/ping2.wav")
|
, pathHighlightSound(this->settingsItems, "pathHighlightSound", "qrc:/sounds/ping2.wav")
|
||||||
, highlightProperties(this->settingsItems, "highlightProperties",
|
, highlightProperties(this->settingsItems, "highlightProperties",
|
||||||
QMap<QString, QPair<bool, bool>>())
|
QMap<QString, QPair<bool, bool>>())
|
||||||
|
, highlightUserBlacklist(this->settingsItems, "highlightUserBlacklist", "")
|
||||||
, enableTwitchEmotes(this->settingsItems, "enableTwitchEmotes", true)
|
, enableTwitchEmotes(this->settingsItems, "enableTwitchEmotes", true)
|
||||||
, enableBttvEmotes(this->settingsItems, "enableBttvEmotes", true)
|
, enableBttvEmotes(this->settingsItems, "enableBttvEmotes", true)
|
||||||
, enableFfzEmotes(this->settingsItems, "enableFfzEmotes", true)
|
, enableFfzEmotes(this->settingsItems, "enableFfzEmotes", true)
|
||||||
|
|
|
@ -49,6 +49,7 @@ public:
|
||||||
Setting<bool> customHighlightSound;
|
Setting<bool> customHighlightSound;
|
||||||
Setting<QString> pathHighlightSound;
|
Setting<QString> pathHighlightSound;
|
||||||
Setting<QMap<QString, QPair<bool, bool>>> highlightProperties;
|
Setting<QMap<QString, QPair<bool, bool>>> highlightProperties;
|
||||||
|
Setting<QString> highlightUserBlacklist;
|
||||||
Setting<bool> enableTwitchEmotes;
|
Setting<bool> enableTwitchEmotes;
|
||||||
Setting<bool> enableBttvEmotes;
|
Setting<bool> enableBttvEmotes;
|
||||||
Setting<bool> enableFfzEmotes;
|
Setting<bool> enableFfzEmotes;
|
||||||
|
|
|
@ -245,13 +245,6 @@ SharedMessage TwitchMessageBuilder::parse()
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement this xD
|
|
||||||
// if (!isReceivedWhisper &&
|
|
||||||
// AppSettings.HighlightIgnoredUsers.ContainsKey(Username))
|
|
||||||
// {
|
|
||||||
// HighlightTab = false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
return this->getMessage();
|
return this->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,6 +390,8 @@ void TwitchMessageBuilder::parseHighlights()
|
||||||
bool alert;
|
bool alert;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QStringList blackList = settings.highlightUserBlacklist.get().split("\n",QString::SkipEmptyParts);
|
||||||
|
|
||||||
// TODO: This vector should only be rebuilt upon highlights being changed
|
// TODO: This vector should only be rebuilt upon highlights being changed
|
||||||
std::vector<Highlight> activeHighlights;
|
std::vector<Highlight> activeHighlights;
|
||||||
|
|
||||||
|
@ -404,6 +399,7 @@ void TwitchMessageBuilder::parseHighlights()
|
||||||
activeHighlights.emplace_back(currentUsername, settings.enableHighlightSound.get(),
|
activeHighlights.emplace_back(currentUsername, settings.enableHighlightSound.get(),
|
||||||
settings.enableHighlightTaskbar.get());
|
settings.enableHighlightTaskbar.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &highlightProperties = settings.highlightProperties.get();
|
const auto &highlightProperties = settings.highlightProperties.get();
|
||||||
|
|
||||||
for (auto it = highlightProperties.begin(); it != highlightProperties.end(); ++it) {
|
for (auto it = highlightProperties.begin(); it != highlightProperties.end(); ++it) {
|
||||||
|
@ -414,37 +410,39 @@ void TwitchMessageBuilder::parseHighlights()
|
||||||
bool doHighlight = false;
|
bool doHighlight = false;
|
||||||
bool playSound = false;
|
bool playSound = false;
|
||||||
bool doAlert = false;
|
bool doAlert = false;
|
||||||
|
if(!blackList.contains(this->ircMessage->nick(),Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
for (const Highlight &highlight : activeHighlights) {
|
||||||
|
if (this->originalMessage.contains(highlight.target, Qt::CaseInsensitive)) {
|
||||||
|
qDebug() << "Highlight because " << this->originalMessage << " contains "
|
||||||
|
<< highlight.target;
|
||||||
|
doHighlight = true;
|
||||||
|
|
||||||
for (const Highlight &highlight : activeHighlights) {
|
if (highlight.sound) {
|
||||||
if (this->originalMessage.contains(highlight.target, Qt::CaseInsensitive)) {
|
playSound = true;
|
||||||
qDebug() << "Highlight because " << this->originalMessage << " contains "
|
}
|
||||||
<< highlight.target;
|
|
||||||
doHighlight = true;
|
|
||||||
|
|
||||||
if (highlight.sound) {
|
if (highlight.alert) {
|
||||||
playSound = true;
|
doAlert = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (highlight.alert) {
|
if (playSound && doAlert) {
|
||||||
doAlert = true;
|
// Break if no further action can be taken from other highlights
|
||||||
}
|
// This might change if highlights can have custom colors/sounds/actions
|
||||||
|
break;
|
||||||
if (playSound && doAlert) {
|
}
|
||||||
// Break if no further action can be taken from other highlights
|
|
||||||
// This might change if highlights can have custom colors/sounds/actions
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
this->setHighlight(doHighlight);
|
this->setHighlight(doHighlight);
|
||||||
|
|
||||||
if (playSound) {
|
if (playSound) {
|
||||||
player->play();
|
player->play();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doAlert) {
|
if (doAlert) {
|
||||||
QApplication::alert(windowManager.getMainWindow().window(), 2500);
|
QApplication::alert(windowManager.getMainWindow().window(), 2500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "twitchuser.hpp"
|
#include "twitchuser.hpp"
|
||||||
|
#include "util/urlfetch.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace twitch {
|
namespace twitch {
|
||||||
|
@ -22,6 +23,16 @@ const QString &TwitchUser::getOAuthToken() const
|
||||||
return this->_oauthToken;
|
return this->_oauthToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &TwitchUser::getUserId() const
|
||||||
|
{
|
||||||
|
return this->_userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwitchUser::setUserId(const QString &id)
|
||||||
|
{
|
||||||
|
this->_userId = id;
|
||||||
|
}
|
||||||
|
|
||||||
bool TwitchUser::isAnon() const
|
bool TwitchUser::isAnon() const
|
||||||
{
|
{
|
||||||
return this->_isAnon;
|
return this->_isAnon;
|
||||||
|
|
|
@ -14,12 +14,15 @@ public:
|
||||||
|
|
||||||
const QString &getOAuthToken() const;
|
const QString &getOAuthToken() const;
|
||||||
const QString &getOAuthClient() const;
|
const QString &getOAuthClient() const;
|
||||||
|
const QString &getUserId() const;
|
||||||
|
void setUserId(const QString &id);
|
||||||
|
|
||||||
bool isAnon() const;
|
bool isAnon() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString _oauthClient;
|
QString _oauthClient;
|
||||||
QString _oauthToken;
|
QString _oauthToken;
|
||||||
|
QString _userId;
|
||||||
bool _isAnon;
|
bool _isAnon;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "credentials.hpp"
|
#include "credentials.hpp"
|
||||||
|
#include "accountmanager.hpp"
|
||||||
|
|
||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
@ -76,6 +77,32 @@ static void getUserID(QString username, std::function<void(QString)> successCall
|
||||||
successCallback(id.toString());
|
successCallback(id.toString());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
static void put(QUrl url, std::function<void(QJsonObject)> successCallback)
|
||||||
|
{
|
||||||
|
auto manager = new QNetworkAccessManager();
|
||||||
|
QNetworkRequest request(url);
|
||||||
|
|
||||||
|
request.setRawHeader("Client-ID", getDefaultClientID());
|
||||||
|
request.setRawHeader("Accept", "application/vnd.twitchtv.v5+json");
|
||||||
|
request.setRawHeader("Authorization", "OAuth " +
|
||||||
|
AccountManager::getInstance().getTwitchUser().getOAuthToken().toUtf8());
|
||||||
|
QNetworkReply *reply = manager->put(request,"");
|
||||||
|
QObject::connect(reply, &QNetworkReply::finished, [=](){
|
||||||
|
if(reply->error() == QNetworkReply::NetworkError::NoError)
|
||||||
|
{
|
||||||
|
QByteArray data = reply->readAll();
|
||||||
|
QJsonDocument jsonDoc(QJsonDocument::fromJson(data));
|
||||||
|
if(!jsonDoc.isNull())
|
||||||
|
{
|
||||||
|
QJsonObject rootNode = jsonDoc.object();
|
||||||
|
|
||||||
|
successCallback(rootNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reply->deleteLater();
|
||||||
|
manager->deleteLater();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace twitch
|
} // namespace twitch
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
#include "widgets/accountpopup.hpp"
|
#include "widgets/accountpopup.hpp"
|
||||||
|
#include "util/urlfetch.hpp"
|
||||||
|
#include "accountmanager.hpp"
|
||||||
#include "channel.hpp"
|
#include "channel.hpp"
|
||||||
#include "credentials.hpp"
|
#include "credentials.hpp"
|
||||||
|
#include "settingsmanager.hpp"
|
||||||
#include "ui_accountpopupform.h"
|
#include "ui_accountpopupform.h"
|
||||||
|
|
||||||
|
#include <QClipboard>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QDesktopServices>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
@ -25,10 +30,98 @@ AccountPopupWidget::AccountPopupWidget(std::shared_ptr<Channel> channel)
|
||||||
|
|
||||||
setWindowFlags(Qt::FramelessWindowHint);
|
setWindowFlags(Qt::FramelessWindowHint);
|
||||||
|
|
||||||
|
SettingsManager &settings = SettingsManager::getInstance();
|
||||||
|
|
||||||
|
permission = permissions::User;
|
||||||
|
for(auto button : this->_ui->profileLayout->findChildren<QPushButton*>())
|
||||||
|
{
|
||||||
|
button->setFocusProxy(this);
|
||||||
|
}
|
||||||
|
for(auto button: this->_ui->userLayout->findChildren<QPushButton*>())
|
||||||
|
{
|
||||||
|
button->setFocusProxy(this);
|
||||||
|
}
|
||||||
|
for(auto button: this->_ui->modLayout->findChildren<QPushButton*>())
|
||||||
|
{
|
||||||
|
button->setFocusProxy(this);
|
||||||
|
}
|
||||||
|
for(auto button: this->_ui->ownerLayout->findChildren<QPushButton*>())
|
||||||
|
{
|
||||||
|
button->setFocusProxy(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
timeout(this->_ui->purge, 1);
|
||||||
|
timeout(this->_ui->min1, 60);
|
||||||
|
timeout(this->_ui->min10, 600);
|
||||||
|
timeout(this->_ui->hour1, 3600);
|
||||||
|
timeout(this->_ui->hour24, 86400);
|
||||||
|
|
||||||
|
sendCommand(this->_ui->ban, "/ban ");
|
||||||
|
sendCommand(this->_ui->unBan, "/unban ");
|
||||||
|
sendCommand(this->_ui->mod, "/mod ");
|
||||||
|
sendCommand(this->_ui->unMod, "/unmod ");
|
||||||
|
|
||||||
|
QObject::connect(this->_ui->profile, &QPushButton::clicked, this, [=](){
|
||||||
|
QDesktopServices::openUrl(QUrl("https://twitch.tv/" +
|
||||||
|
this->_ui->lblUsername->text()));
|
||||||
|
});
|
||||||
|
|
||||||
|
QObject::connect(this->_ui->sendMessage, &QPushButton::clicked, this, [=](){
|
||||||
|
QDesktopServices::openUrl(QUrl("https://www.twitch.tv/message/compose?to=" +
|
||||||
|
this->_ui->lblUsername->text()));
|
||||||
|
});
|
||||||
|
|
||||||
|
QObject::connect(this->_ui->copy, &QPushButton::clicked, this, [=](){
|
||||||
|
QApplication::clipboard()->setText(this->_ui->lblUsername->text());
|
||||||
|
});
|
||||||
|
|
||||||
|
QObject::connect(this->_ui->follow, &QPushButton::clicked, this, [=](){
|
||||||
|
QUrl requestUrl("https://api.twitch.tv/kraken/users/" +
|
||||||
|
AccountManager::getInstance().getTwitchUser().getUserId() +
|
||||||
|
"/follows/channels/" + this->userID);
|
||||||
|
|
||||||
|
util::twitch::put(requestUrl,[](QJsonObject obj){});
|
||||||
|
});
|
||||||
|
|
||||||
|
QObject::connect(this->_ui->ignore, &QPushButton::clicked, this, [=](){
|
||||||
|
QUrl requestUrl("https://api.twitch.tv/kraken/users/" +
|
||||||
|
AccountManager::getInstance().getTwitchUser().getUserId() +
|
||||||
|
"/blocks/" + this->userID);
|
||||||
|
|
||||||
|
util::twitch::put(requestUrl,[](QJsonObject obj){});
|
||||||
|
});
|
||||||
|
|
||||||
|
QObject::connect(this->_ui->disableHighlights, &QPushButton::clicked, this, [=, &settings](){
|
||||||
|
QString str = settings.highlightUserBlacklist.getnonConst();
|
||||||
|
str.append(this->_ui->lblUsername->text() + "\n");
|
||||||
|
settings.highlightUserBlacklist.set(str);
|
||||||
|
this->_ui->disableHighlights->hide();
|
||||||
|
this->_ui->enableHighlights->show();
|
||||||
|
});
|
||||||
|
|
||||||
|
QObject::connect(this->_ui->enableHighlights, &QPushButton::clicked, this, [=, &settings](){
|
||||||
|
QString str = settings.highlightUserBlacklist.getnonConst();
|
||||||
|
QStringList list = str.split("\n");
|
||||||
|
list.removeAll(this->_ui->lblUsername->text());
|
||||||
|
settings.highlightUserBlacklist.set(list.join("\n"));
|
||||||
|
this->_ui->enableHighlights->hide();
|
||||||
|
this->_ui->disableHighlights->show();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
updateButtons(this->_ui->userLayout,false);
|
||||||
|
updateButtons(this->_ui->modLayout,false);
|
||||||
|
updateButtons(this->_ui->ownerLayout,false);
|
||||||
|
|
||||||
// Close button
|
// Close button
|
||||||
connect(_ui->btnClose, &QPushButton::clicked, [=]() {
|
connect(_ui->btnClose, &QPushButton::clicked, [=]() {
|
||||||
hide(); //
|
hide(); //
|
||||||
});
|
});
|
||||||
|
|
||||||
|
util::twitch::getUserID(AccountManager::getInstance().getTwitchUser().getNickName(),
|
||||||
|
[=](const QString &id){
|
||||||
|
AccountManager::getInstance().getTwitchUser().setUserId(id);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountPopupWidget::setName(const QString &name)
|
void AccountPopupWidget::setName(const QString &name)
|
||||||
|
@ -44,55 +137,20 @@ void AccountPopupWidget::setChannel(std::shared_ptr<Channel> channel)
|
||||||
|
|
||||||
void AccountPopupWidget::getUserId()
|
void AccountPopupWidget::getUserId()
|
||||||
{
|
{
|
||||||
qDebug() << this->_channel.get()->name;
|
util::twitch::getUserID(this->_ui->lblUsername->text(),[=](const QString &id){
|
||||||
QUrl nameUrl("https://api.twitch.tv/kraken/users?login=" + _ui->lblUsername->text());
|
userID = id;
|
||||||
|
getUserData();
|
||||||
QNetworkRequest req(nameUrl);
|
|
||||||
req.setRawHeader(QByteArray("Accept"), QByteArray("application/vnd.twitchtv.v5+json"));
|
|
||||||
req.setRawHeader(QByteArray("Client-ID"), getDefaultClientID());
|
|
||||||
|
|
||||||
static auto manager = new QNetworkAccessManager();
|
|
||||||
auto *reply = manager->get(req);
|
|
||||||
|
|
||||||
QObject::connect(reply, &QNetworkReply::finished, this, [=] {
|
|
||||||
if (reply->error() == QNetworkReply::NoError) {
|
|
||||||
auto doc = QJsonDocument::fromJson(reply->readAll());
|
|
||||||
auto obj = doc.object();
|
|
||||||
auto array = obj.value("users").toArray();
|
|
||||||
|
|
||||||
userID = array.at(0).toObject().value("_id").toString();
|
|
||||||
|
|
||||||
getUserData();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountPopupWidget::getUserData()
|
void AccountPopupWidget::getUserData()
|
||||||
{
|
{
|
||||||
QUrl idUrl("https://api.twitch.tv/kraken/channels/" + userID);
|
util::twitch::get("https://api.twitch.tv/kraken/channels/" + userID,[=](const QJsonObject &obj){
|
||||||
|
_ui->lblFollowers->setText(QString::number(obj.value("followers").toInt()));
|
||||||
|
_ui->lblViews->setText(QString::number(obj.value("views").toInt()));
|
||||||
|
_ui->lblAccountAge->setText(obj.value("created_at").toString().section("T", 0, 0));
|
||||||
|
|
||||||
QNetworkRequest req(idUrl);
|
loadAvatar(QUrl(obj.value("logo").toString()));
|
||||||
req.setRawHeader(QByteArray("Accept"), QByteArray("application/vnd.twitchtv.v5+json"));
|
|
||||||
req.setRawHeader(QByteArray("Client-ID"), getDefaultClientID());
|
|
||||||
|
|
||||||
static auto manager = new QNetworkAccessManager();
|
|
||||||
auto *reply = manager->get(req);
|
|
||||||
|
|
||||||
QObject::connect(reply, &QNetworkReply::finished, this, [=] {
|
|
||||||
if (reply->error() == QNetworkReply::NoError) {
|
|
||||||
auto doc = QJsonDocument::fromJson(reply->readAll());
|
|
||||||
auto obj = doc.object();
|
|
||||||
|
|
||||||
_ui->lblFollowers->setText(QString::number(obj.value("followers").toInt()));
|
|
||||||
_ui->lblViews->setText(QString::number(obj.value("views").toInt()));
|
|
||||||
_ui->lblAccountAge->setText(obj.value("created_at").toString().section("T", 0, 0));
|
|
||||||
|
|
||||||
loadAvatar(QUrl(obj.value("logo").toString()));
|
|
||||||
} else {
|
|
||||||
_ui->lblFollowers->setText("ERROR");
|
|
||||||
_ui->lblViews->setText("ERROR");
|
|
||||||
_ui->lblAccountAge->setText("ERROR");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,10 +180,43 @@ void AccountPopupWidget::loadAvatar(const QUrl &avatarUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AccountPopupWidget::updatePermissions()
|
||||||
|
{
|
||||||
|
if(this->_channel.get()->name == AccountManager::getInstance().getTwitchUser().getNickName())
|
||||||
|
{
|
||||||
|
permission = permissions::Owner;
|
||||||
|
}
|
||||||
|
else if(this->_channel->modList.contains(AccountManager::getInstance().getTwitchUser().getNickName()))
|
||||||
|
{
|
||||||
|
permission = permissions::Mod;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AccountPopupWidget::updateButtons(QWidget* layout, bool state)
|
||||||
|
{
|
||||||
|
for(auto button : layout->findChildren<QPushButton*>())
|
||||||
|
{
|
||||||
|
button->setVisible(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AccountPopupWidget::timeout(QPushButton *button, int time)
|
||||||
|
{
|
||||||
|
QObject::connect(button, &QPushButton::clicked, this, [=](){
|
||||||
|
this->_channel->sendMessage("/timeout " + this->_ui->lblUsername->text() + " " + QString::number(time));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void AccountPopupWidget::sendCommand(QPushButton *button, QString command)
|
||||||
|
{
|
||||||
|
QObject::connect(button, &QPushButton::clicked, this, [=](){
|
||||||
|
this->_channel->sendMessage(command + this->_ui->lblUsername->text());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void AccountPopupWidget::focusOutEvent(QFocusEvent *event)
|
void AccountPopupWidget::focusOutEvent(QFocusEvent *event)
|
||||||
{
|
{
|
||||||
hide();
|
this->hide();
|
||||||
|
|
||||||
_ui->lblFollowers->setText("Loading...");
|
_ui->lblFollowers->setText("Loading...");
|
||||||
_ui->lblViews->setText("Loading...");
|
_ui->lblViews->setText("Loading...");
|
||||||
_ui->lblAccountAge->setText("Loading...");
|
_ui->lblAccountAge->setText("Loading...");
|
||||||
|
@ -133,5 +224,45 @@ void AccountPopupWidget::focusOutEvent(QFocusEvent *event)
|
||||||
_ui->lblAvatar->setText("Loading...");
|
_ui->lblAvatar->setText("Loading...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AccountPopupWidget::showEvent(QShowEvent *event)
|
||||||
|
{
|
||||||
|
if(this->_ui->lblUsername->text() != AccountManager::getInstance().getTwitchUser().getNickName())
|
||||||
|
{
|
||||||
|
updateButtons(this->_ui->userLayout, true);
|
||||||
|
if(permission != permissions::User)
|
||||||
|
{
|
||||||
|
if(!this->_channel->modList.contains(this->_ui->lblUsername->text()))
|
||||||
|
{
|
||||||
|
updateButtons(this->_ui->modLayout, true);
|
||||||
|
}
|
||||||
|
if(permission == permissions::Owner)
|
||||||
|
{
|
||||||
|
updateButtons(this->_ui->ownerLayout, true);
|
||||||
|
updateButtons(this->_ui->modLayout, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
updateButtons(this->_ui->modLayout, false);
|
||||||
|
updateButtons(this->_ui->userLayout, false);
|
||||||
|
updateButtons(this->_ui->ownerLayout, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString blacklisted = SettingsManager::getInstance().highlightUserBlacklist.getnonConst();
|
||||||
|
QStringList list = blacklisted.split("\n",QString::SkipEmptyParts);
|
||||||
|
if(list.contains(this->_ui->lblUsername->text(),Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
this->_ui->disableHighlights->hide();
|
||||||
|
this->_ui->enableHighlights->show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->_ui->disableHighlights->show();
|
||||||
|
this->_ui->enableHighlights->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace widgets
|
} // namespace widgets
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "concurrentmap.hpp"
|
#include "concurrentmap.hpp"
|
||||||
|
#include "twitch/twitchchannel.hpp"
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -24,6 +26,8 @@ public:
|
||||||
void setName(const QString &name);
|
void setName(const QString &name);
|
||||||
void setChannel(std::shared_ptr<Channel> channel);
|
void setChannel(std::shared_ptr<Channel> channel);
|
||||||
|
|
||||||
|
void updatePermissions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AccountPopup *_ui;
|
Ui::AccountPopup *_ui;
|
||||||
|
|
||||||
|
@ -31,6 +35,13 @@ private:
|
||||||
void getUserData();
|
void getUserData();
|
||||||
void loadAvatar(const QUrl &avatarUrl);
|
void loadAvatar(const QUrl &avatarUrl);
|
||||||
|
|
||||||
|
void updateButtons(QWidget* layout, bool state);
|
||||||
|
void timeout(QPushButton* button, int time);
|
||||||
|
void sendCommand(QPushButton* button, QString command);
|
||||||
|
|
||||||
|
enum class permissions { User, Mod, Owner };
|
||||||
|
permissions permission;
|
||||||
|
|
||||||
std::shared_ptr<Channel> _channel;
|
std::shared_ptr<Channel> _channel;
|
||||||
|
|
||||||
QString userID;
|
QString userID;
|
||||||
|
@ -40,6 +51,7 @@ private:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void focusOutEvent(QFocusEvent *event) override;
|
virtual void focusOutEvent(QFocusEvent *event) override;
|
||||||
|
virtual void showEvent(QShowEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace widgets
|
} // namespace widgets
|
||||||
|
|
|
@ -30,7 +30,7 @@ ChannelView::ChannelView(WindowManager &windowManager, BaseWidget *parent)
|
||||||
: BaseWidget(parent)
|
: BaseWidget(parent)
|
||||||
, windowManager(windowManager)
|
, windowManager(windowManager)
|
||||||
, scrollBar(this)
|
, scrollBar(this)
|
||||||
, userPopupWidget(std::shared_ptr<Channel>())
|
, userPopupWidget(std::shared_ptr<twitch::TwitchChannel>())
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
// this->setAttribute(Qt::WA_OpaquePaintEvent);
|
// this->setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
|
@ -787,6 +787,7 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
|
||||||
auto user = link.getValue();
|
auto user = link.getValue();
|
||||||
this->userPopupWidget.setName(user);
|
this->userPopupWidget.setName(user);
|
||||||
this->userPopupWidget.move(event->screenPos().toPoint());
|
this->userPopupWidget.move(event->screenPos().toPoint());
|
||||||
|
this->userPopupWidget.updatePermissions();
|
||||||
this->userPopupWidget.show();
|
this->userPopupWidget.show();
|
||||||
this->userPopupWidget.setFocus();
|
this->userPopupWidget.setFocus();
|
||||||
|
|
||||||
|
|
|
@ -238,7 +238,7 @@ void ChatWidget::doChangeChannel()
|
||||||
{
|
{
|
||||||
this->showChangeChannelPopup("Change channel");
|
this->showChangeChannelPopup("Change channel");
|
||||||
auto popup = this->findChildren<QDockWidget *>();
|
auto popup = this->findChildren<QDockWidget *>();
|
||||||
if (popup.at(0)->isVisible() && !popup.at(0)->isFloating()) {
|
if (popup.size() && popup.at(0)->isVisible() && !popup.at(0)->isFloating()) {
|
||||||
popup.at(0)->hide();
|
popup.at(0)->hide();
|
||||||
doOpenViewerList();
|
doOpenViewerList();
|
||||||
}
|
}
|
||||||
|
@ -426,6 +426,7 @@ void ChatWidget::doOpenAccountPopupWidget(AccountPopupWidget *widget, QString us
|
||||||
{
|
{
|
||||||
widget->setName(user);
|
widget->setName(user);
|
||||||
widget->move(QCursor::pos());
|
widget->move(QCursor::pos());
|
||||||
|
widget->updatePermissions();
|
||||||
widget->show();
|
widget->show();
|
||||||
widget->setFocus();
|
widget->setFocus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,9 +379,12 @@ void SettingsDialog::addTabs()
|
||||||
// Highlighting
|
// Highlighting
|
||||||
vbox = new QVBoxLayout();
|
vbox = new QVBoxLayout();
|
||||||
auto highlights = new QListWidget();
|
auto highlights = new QListWidget();
|
||||||
|
auto highlightUserBlacklist = new QTextEdit();
|
||||||
globalHighlights = highlights;
|
globalHighlights = highlights;
|
||||||
QStringList items = settings.highlightProperties.get().keys();
|
QStringList items = settings.highlightProperties.get().keys();
|
||||||
highlights->addItems(items);
|
highlights->addItems(items);
|
||||||
|
highlightUserBlacklist->setText(settings.highlightUserBlacklist.getnonConst());
|
||||||
|
auto highlightTab = new QTabWidget();
|
||||||
auto customSound = new QHBoxLayout();
|
auto customSound = new QHBoxLayout();
|
||||||
auto soundForm = new QFormLayout();
|
auto soundForm = new QFormLayout();
|
||||||
{
|
{
|
||||||
|
@ -404,6 +407,7 @@ void SettingsDialog::addTabs()
|
||||||
|
|
||||||
soundForm->addRow(customSound);
|
soundForm->addRow(customSound);
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto hbox = new QHBoxLayout();
|
auto hbox = new QHBoxLayout();
|
||||||
auto addBtn = new QPushButton("Add");
|
auto addBtn = new QPushButton("Add");
|
||||||
|
@ -480,14 +484,38 @@ void SettingsDialog::addTabs()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
vbox->addLayout(soundForm);
|
vbox->addLayout(soundForm);
|
||||||
vbox->addWidget(highlights);
|
auto layoutVbox = new QVBoxLayout();
|
||||||
|
auto btnHbox = new QHBoxLayout();
|
||||||
|
|
||||||
hbox->addWidget(addBtn);
|
auto highlightWidget = new QWidget();
|
||||||
hbox->addWidget(editBtn);
|
auto btnWidget = new QWidget();
|
||||||
hbox->addWidget(delBtn);
|
|
||||||
|
btnHbox->addWidget(addBtn);
|
||||||
|
btnHbox->addWidget(editBtn);
|
||||||
|
btnHbox->addWidget(delBtn);
|
||||||
|
btnWidget->setLayout(btnHbox);
|
||||||
|
|
||||||
|
layoutVbox->addWidget(highlights);
|
||||||
|
layoutVbox->addWidget(btnWidget);
|
||||||
|
highlightWidget->setLayout(layoutVbox);
|
||||||
|
|
||||||
|
highlightTab->addTab(highlightWidget,"Highlights");
|
||||||
|
highlightTab->addTab(highlightUserBlacklist,"Disabled Users");
|
||||||
|
vbox->addWidget(highlightTab);
|
||||||
|
|
||||||
vbox->addLayout(hbox);
|
vbox->addLayout(hbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QObject::connect(&this->ui.okButton, &QPushButton::clicked, this, [=, &settings](){
|
||||||
|
QStringList list = highlightUserBlacklist->toPlainText().split("\n",QString::SkipEmptyParts);
|
||||||
|
list.removeDuplicates();
|
||||||
|
settings.highlightUserBlacklist.set(list.join("\n") + "\n");
|
||||||
|
});
|
||||||
|
|
||||||
|
settings.highlightUserBlacklist.valueChanged.connect([=](const QString &str){
|
||||||
|
highlightUserBlacklist->setPlainText(str);
|
||||||
|
});
|
||||||
|
|
||||||
vbox->addStretch(1);
|
vbox->addStretch(1);
|
||||||
addTab(vbox, "Highlighting", ":/images/format_Bold_16xLG.png");
|
addTab(vbox, "Highlighting", ":/images/format_Bold_16xLG.png");
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ public:
|
||||||
void select(SettingsDialogTab *tab);
|
void select(SettingsDialogTab *tab);
|
||||||
|
|
||||||
static void showDialog();
|
static void showDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SettingsSnapshot snapshot;
|
SettingsSnapshot snapshot;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue