// // Created by arjun-flowylabs on 1/10/2026. // #include "MainWindow.h" #include #include #include #include #include #include #include #include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { this->setAttribute(Qt::WA_TranslucentBackground, true); this->setAttribute(Qt::WA_AcceptTouchEvents, true); this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); this->setFixedSize(QSize(150, 150)); QWidget *centralWidget = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout(centralWidget); QHBoxLayout *headerLayout = new QHBoxLayout(centralWidget); m_handleBar = new QSvgWidget(QStringLiteral(":/assets/icons/mono/basic/menu-rec.svg"), centralWidget); m_handleBar->setFixedSize(QSize(20, 20)); m_handleBar->setCursor(Qt::OpenHandCursor); QLabel *label = new QLabel("STREAMS", centralWidget); QToolButton *addButton = new QToolButton(centralWidget); addButton->setIcon(QIcon(QStringLiteral(":/assets/icons/mono/basic/plus.svg"))); headerLayout->addWidget(m_handleBar); headerLayout->addWidget(label); headerLayout->addStretch(); headerLayout->addWidget(addButton); QListWidget *listWidget = new QListWidget(centralWidget); listWidget->addItems(QStringList{"echo-1", "beta-2", "dustin-anson", "priority-pickle"}); layout->addLayout(headerLayout); layout->addWidget(listWidget); const QScreen *screen = QGuiApplication::primaryScreen(); const QRect screenSize = screen->geometry(); qDebug() << "Width of window: " << this->width(); qDebug() << "Height of window: " << this->height(); int x = screenSize.right() - this->width(); int y = (screenSize.bottom() / 2) - (this->height() / 2); this->move(x, y); this->setCentralWidget(centralWidget); } void MainWindow::resizeEvent(QResizeEvent *event) { QMainWindow::resizeEvent(event); // Let layout finish first } void MainWindow::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton && m_handleBar->geometry().contains(event->pos())) { dragging = true; dragPosition = event->globalPosition().toPoint() - frameGeometry().topLeft(); setCursor(Qt::ClosedHandCursor); event->accept(); } } void MainWindow::mouseMoveEvent(QMouseEvent *event) { if (dragging && (event->buttons() & Qt::LeftButton)) { move(event->globalPosition().toPoint() - dragPosition); event->accept(); } } void MainWindow::mouseReleaseEvent(QMouseEvent *event) { dragging = false; unsetCursor(); } MainWindow::~MainWindow() { }