mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
use different window frame for user popup based on the setting
This commit is contained in:
parent
b2ae2e598f
commit
6f4f66b9d0
4 changed files with 13 additions and 9 deletions
|
@ -451,7 +451,7 @@ QString CommandController::execCommand(const QString &textNoEmoji,
|
|||
makeSystemMessage("Usage /usercard [user]"));
|
||||
return "";
|
||||
}
|
||||
auto *userPopup = new UserInfoPopup;
|
||||
auto *userPopup = new UserInfoPopup(false);
|
||||
userPopup->setData(words[1], channel);
|
||||
userPopup->move(QCursor::pos());
|
||||
userPopup->show();
|
||||
|
|
|
@ -87,13 +87,21 @@ namespace {
|
|||
};
|
||||
} // namespace
|
||||
|
||||
UserInfoPopup::UserInfoPopup()
|
||||
: BaseWindow(BaseWindow::EnableCustomFrame)
|
||||
UserInfoPopup::UserInfoPopup(bool closeAutomatically)
|
||||
: BaseWindow(
|
||||
closeAutomatically
|
||||
? FlagsEnum<BaseWindow::Flags>{BaseWindow::EnableCustomFrame,
|
||||
BaseWindow::Frameless,
|
||||
BaseWindow::FramelessDraggable}
|
||||
: BaseWindow::EnableCustomFrame)
|
||||
, hack_(new bool)
|
||||
{
|
||||
this->setWindowTitle("Usercard");
|
||||
this->setStayInScreenRect(true);
|
||||
|
||||
if (closeAutomatically)
|
||||
this->setActionOnFocusLoss(BaseWindow::Delete);
|
||||
|
||||
// Close the popup when Escape is pressed
|
||||
createWindowShortcut(this, "Escape", [this] { this->deleteLater(); });
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class UserInfoPopup final : public BaseWindow
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UserInfoPopup();
|
||||
UserInfoPopup(bool closeAutomatically);
|
||||
|
||||
void setData(const QString &name, const ChannelPtr &channel);
|
||||
|
||||
|
|
|
@ -1820,11 +1820,7 @@ void ChannelView::hideEvent(QHideEvent *)
|
|||
|
||||
void ChannelView::showUserInfoPopup(const QString &userName)
|
||||
{
|
||||
auto *userPopup = new UserInfoPopup;
|
||||
if (getSettings()->autoCloseUserPopup)
|
||||
{
|
||||
userPopup->setActionOnFocusLoss(BaseWindow::Delete);
|
||||
}
|
||||
auto *userPopup = new UserInfoPopup(getSettings()->autoCloseUserPopup);
|
||||
userPopup->setData(userName, this->hasSourceChannel() ? this->sourceChannel_
|
||||
: this->channel_);
|
||||
QPoint offset(int(150 * this->scale()), int(70 * this->scale()));
|
||||
|
|
Loading…
Reference in a new issue