mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Remove message-spawning tests
This commit is contained in:
parent
676c7b9017
commit
bf5e619818
3 changed files with 4 additions and 78 deletions
|
@ -58,11 +58,8 @@ private:
|
||||||
std::shared_ptr<twitch::TwitchUser> account = nullptr;
|
std::shared_ptr<twitch::TwitchUser> account = nullptr;
|
||||||
|
|
||||||
std::shared_ptr<Communi::IrcConnection> writeConnection = nullptr;
|
std::shared_ptr<Communi::IrcConnection> writeConnection = nullptr;
|
||||||
|
|
||||||
public:
|
|
||||||
std::shared_ptr<Communi::IrcConnection> readConnection = nullptr;
|
std::shared_ptr<Communi::IrcConnection> readConnection = nullptr;
|
||||||
|
|
||||||
private:
|
|
||||||
std::mutex connectionMutex;
|
std::mutex connectionMutex;
|
||||||
uint32_t connectionGeneration = 0;
|
uint32_t connectionGeneration = 0;
|
||||||
|
|
||||||
|
|
|
@ -79,15 +79,10 @@ Split::Split(ChannelManager &_channelManager, SplitContainer *parent)
|
||||||
ezShortcut(this, "CTRL+R", &Split::doChangeChannel);
|
ezShortcut(this, "CTRL+R", &Split::doChangeChannel);
|
||||||
|
|
||||||
// xd
|
// xd
|
||||||
//ezShortcut(this, "ALT+SHIFT+RIGHT", &Split::doIncFlexX);
|
// ezShortcut(this, "ALT+SHIFT+RIGHT", &Split::doIncFlexX);
|
||||||
//ezShortcut(this, "ALT+SHIFT+LEFT", &Split::doDecFlexX);
|
// ezShortcut(this, "ALT+SHIFT+LEFT", &Split::doDecFlexX);
|
||||||
//ezShortcut(this, "ALT+SHIFT+UP", &Split::doIncFlexY);
|
// ezShortcut(this, "ALT+SHIFT+UP", &Split::doIncFlexY);
|
||||||
//ezShortcut(this, "ALT+SHIFT+DOWN", &Split::doDecFlexY);
|
// ezShortcut(this, "ALT+SHIFT+DOWN", &Split::doDecFlexY);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
// F12: Toggle message spawning
|
|
||||||
ezShortcut(this, "ALT+Q", &Split::doToggleMessageSpawning);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
this->channelName.getValueChangedSignal().connect(
|
this->channelName.getValueChangedSignal().connect(
|
||||||
std::bind(&Split::channelNameUpdated, this, std::placeholders::_1));
|
std::bind(&Split::channelNameUpdated, this, std::placeholders::_1));
|
||||||
|
@ -102,10 +97,6 @@ Split::Split(ChannelManager &_channelManager, SplitContainer *parent)
|
||||||
this->input.clearSelection();
|
this->input.clearSelection();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QTimer *timer = new QTimer(this);
|
|
||||||
connect(timer, &QTimer::timeout, this, &Split::test);
|
|
||||||
timer->start(1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Split::~Split()
|
Split::~Split()
|
||||||
|
@ -462,30 +453,6 @@ void Split::doCopy()
|
||||||
QApplication::clipboard()->setText(this->view.getSelectedText());
|
QApplication::clipboard()->setText(this->view.getSelectedText());
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<std::string> usernameVariants = {
|
|
||||||
"pajlada", //
|
|
||||||
"trump", //
|
|
||||||
"Chancu", //
|
|
||||||
"pajaWoman", //
|
|
||||||
"fourtf", //
|
|
||||||
"weneedmoreautisticbots", //
|
|
||||||
"fourtfbot", //
|
|
||||||
"pajbot", //
|
|
||||||
"snusbot", //
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::vector<std::string> messageVariants = {
|
|
||||||
"hehe", //
|
|
||||||
"lol pajlada", //
|
|
||||||
"hehe BANNEDWORD", //
|
|
||||||
"someone ordered pizza", //
|
|
||||||
"for ice poseidon", //
|
|
||||||
"and delivery guy said it is for enza denino", //
|
|
||||||
"!gn", //
|
|
||||||
"for my laptop", //
|
|
||||||
"should I buy a Herschel backpack?", //
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename Iter, typename RandomGenerator>
|
template <typename Iter, typename RandomGenerator>
|
||||||
static Iter select_randomly(Iter start, Iter end, RandomGenerator &g)
|
static Iter select_randomly(Iter start, Iter end, RandomGenerator &g)
|
||||||
{
|
{
|
||||||
|
@ -502,41 +469,6 @@ static Iter select_randomly(Iter start, Iter end)
|
||||||
return select_randomly(start, end, gen);
|
return select_randomly(start, end, gen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Split::test()
|
|
||||||
{
|
|
||||||
if (this->testEnabled) {
|
|
||||||
messages::MessageParseArgs args;
|
|
||||||
|
|
||||||
auto message =
|
|
||||||
new Communi::IrcPrivateMessage(this->channelManager.ircManager.readConnection.get());
|
|
||||||
|
|
||||||
std::string text = *(select_randomly(messageVariants.begin(), messageVariants.end()));
|
|
||||||
std::string username = *(select_randomly(usernameVariants.begin(), usernameVariants.end()));
|
|
||||||
std::string usernameString = username + "!" + username + "@" + username;
|
|
||||||
|
|
||||||
QStringList params{"#pajlada", text.c_str()};
|
|
||||||
|
|
||||||
qDebug() << params;
|
|
||||||
|
|
||||||
message->setParameters(params);
|
|
||||||
|
|
||||||
message->setPrefix(usernameString.c_str());
|
|
||||||
|
|
||||||
auto twitchChannel = std::dynamic_pointer_cast<twitch::TwitchChannel>(this->channel);
|
|
||||||
|
|
||||||
twitch::TwitchMessageBuilder builder(
|
|
||||||
twitchChannel.get(), this->channelManager.ircManager.resources,
|
|
||||||
this->channelManager.emoteManager, this->channelManager.windowManager, message, args);
|
|
||||||
|
|
||||||
twitchChannel->addMessage(builder.parse());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Split::doToggleMessageSpawning()
|
|
||||||
{
|
|
||||||
this->testEnabled = !this->testEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Split::doIncFlexX()
|
void Split::doIncFlexX()
|
||||||
{
|
{
|
||||||
this->setFlexSizeX(this->getFlexSizeX() * 1.2);
|
this->setFlexSizeX(this->getFlexSizeX() * 1.2);
|
||||||
|
|
|
@ -52,7 +52,6 @@ public:
|
||||||
CompletionManager &completionManager;
|
CompletionManager &completionManager;
|
||||||
pajlada::Settings::Setting<std::string> channelName;
|
pajlada::Settings::Setting<std::string> channelName;
|
||||||
boost::signals2::signal<void()> channelChanged;
|
boost::signals2::signal<void()> channelChanged;
|
||||||
bool testEnabled = false;
|
|
||||||
|
|
||||||
std::shared_ptr<Channel> getChannel() const;
|
std::shared_ptr<Channel> getChannel() const;
|
||||||
std::shared_ptr<Channel> &getChannelRef();
|
std::shared_ptr<Channel> &getChannelRef();
|
||||||
|
@ -122,8 +121,6 @@ public slots:
|
||||||
// Open viewer list of the channel
|
// Open viewer list of the channel
|
||||||
void doOpenViewerList();
|
void doOpenViewerList();
|
||||||
|
|
||||||
void doToggleMessageSpawning();
|
|
||||||
void test();
|
|
||||||
void doIncFlexX();
|
void doIncFlexX();
|
||||||
void doDecFlexX();
|
void doDecFlexX();
|
||||||
void doIncFlexY();
|
void doIncFlexY();
|
||||||
|
|
Loading…
Reference in a new issue