discord-awesomeaudio/src/mainwindow.cpp

48 lines
1.1 KiB
C++
Raw Normal View History

2022-07-07 07:11:51 -04:00
#include "mainwindow.h"
#include "virtmic.h"
2022-07-09 16:07:14 -04:00
#include <QApplication>
2022-07-07 15:48:23 -04:00
#include <QColor>
2022-07-07 07:11:51 -04:00
#include <QComboBox>
#include <QFile>
#include <QGridLayout>
#include <QLabel>
#include <QPushButton>
#include <QSpacerItem>
#include <QThread>
#include <QUrl>
#include <QWebEngineScript>
#include <QWebEngineScriptCollection>
#include <QWebEngineSettings>
#include <QWidget>
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
2022-07-09 16:07:14 -04:00
setupWebView();
2022-07-07 07:11:51 -04:00
resize(1000, 700);
showMaximized();
}
void MainWindow::setupWebView() {
auto page = new DiscordPage(this);
2022-07-27 08:13:59 -04:00
connect(page, &QWebEnginePage::fullScreenRequested, this,
&MainWindow::fullScreenRequested);
m_webView = new QWebEngineView(this);
2022-07-09 16:07:14 -04:00
m_webView->setPage(page);
2022-07-27 08:13:59 -04:00
2022-07-07 07:11:51 -04:00
setCentralWidget(m_webView);
}
2022-07-27 08:13:59 -04:00
void MainWindow::fullScreenRequested(
QWebEngineFullScreenRequest fullScreenRequest) {
fullScreenRequest.accept();
if (fullScreenRequest.toggleOn()) {
m_wasMaximized = isMaximized();
showFullScreen();
} else {
m_wasMaximized ? showMaximized() : showNormal();
}
2022-07-27 08:13:59 -04:00
}
void MainWindow::closeEvent(QCloseEvent *event) { QApplication::quit(); }