Make a command that shows the Chatterino user card (/usercard) (#1375)

* Make UserInfoPopup be able to show that fetching the information failed.
This commit is contained in:
Mm2PL
2020-01-25 12:59:31 +01:00
committed by pajlada
parent 71337c4dbe
commit 410de82261
4 changed files with 51 additions and 2 deletions
@@ -17,6 +17,7 @@
#include "singletons/Theme.hpp"
#include "util/CombinePath.hpp"
#include "widgets/dialogs/LogsPopup.hpp"
#include "widgets/dialogs/UserInfoPopup.hpp"
#include <QApplication>
#include <QFile>
@@ -481,6 +482,21 @@ QString CommandController::execCommand(const QString &textNoEmoji,
channelName + "/viewercard/" + words[1]);
return "";
}
else if (commandName == "/usercard")
{
if (words.size() < 2)
{
channel->addMessage(
makeSystemMessage("Usage /usercard [user]"));
return "";
}
auto *userPopup = new UserInfoPopup;
userPopup->setData(words[1], channel);
userPopup->setActionOnFocusLoss(BaseWindow::Delete);
userPopup->move(QCursor::pos());
userPopup->show();
return "";
}
}
{