created directory for dialogs
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
#include "NotificationPopup.hpp"
|
||||
|
||||
#include "widgets/helper/ChannelView.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QScreen>
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
|
||||
NotificationPopup::NotificationPopup()
|
||||
: BaseWindow((QWidget *)nullptr, BaseWindow::Frameless)
|
||||
, channel(std::make_shared<Channel>("notifications", Channel::None))
|
||||
|
||||
{
|
||||
this->channelView = new ChannelView(this);
|
||||
|
||||
auto *layout = new QVBoxLayout(this);
|
||||
this->setLayout(layout);
|
||||
|
||||
layout->addWidget(this->channelView);
|
||||
|
||||
this->channelView->setChannel(this->channel);
|
||||
this->setScaleIndependantSize(300, 150);
|
||||
}
|
||||
|
||||
void NotificationPopup::updatePosition()
|
||||
{
|
||||
Location location = BottomRight;
|
||||
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
const QRect rect = desktop->availableGeometry();
|
||||
|
||||
switch (location) {
|
||||
case BottomRight: {
|
||||
this->move(rect.right() - this->width(), rect.bottom() - this->height());
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void NotificationPopup::addMessage(messages::MessagePtr msg)
|
||||
{
|
||||
this->channel->addMessage(msg);
|
||||
|
||||
// QTimer::singleShot(5000, this, [this, msg] { this->channel->remove });
|
||||
}
|
||||
|
||||
} // namespace widgets
|
||||
} // namespace chatterino
|
||||
Reference in New Issue
Block a user