diff --git a/src/centralwidget.cpp b/src/centralwidget.cpp index 2e7aaf1..32ed67a 100644 --- a/src/centralwidget.cpp +++ b/src/centralwidget.cpp @@ -7,6 +7,7 @@ #include #include #include +#include CentralWidget::CentralWidget(QWidget *parent) : QWidget(parent) { setStyleSheet("background-color:#313338;"); diff --git a/src/centralwidget.h b/src/centralwidget.h index a9c63d0..3803426 100644 --- a/src/centralwidget.h +++ b/src/centralwidget.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef CENTRALWIDGET_H +#define CENTRALWIDGET_H #include #include @@ -7,23 +8,28 @@ #include #include +#ifdef KNOTIFICATIONS +constexpr bool USE_KF5_NOTIFICATIONS = true; +#else +constexpr bool USE_KF5_NOTIFICATIONS = false; +#endif + class CentralWidget : public QWidget { Q_OBJECT public: CentralWidget(QWidget *parent = nullptr); +public slots: + void setLoadingIndicator(QString text); + private: void setupWebView(); + QVBoxLayout *m_layout; QWebEngineView *m_webView; -#ifdef KNOTIFICATIONS - bool m_useKF5Notifications = true; -#else - bool m_useKF5Notifications = false; -#endif - QLabel *m_loadingLabel = nullptr; - -public Q_SLOTS: - void setLoadingIndicator(QString text); + QLabel *m_loadingLabel; + bool m_useKF5Notifications; }; + +#endif // CENTRALWIDGET_H diff --git a/src/userscript.cpp b/src/userscript.cpp index 9aba347..dee529b 100644 --- a/src/userscript.cpp +++ b/src/userscript.cpp @@ -21,6 +21,7 @@ UserScript::UserScript() : QObject() { setupVirtmic(); } + void UserScript::setupHelpMenu() { #ifdef KXMLGUI m_kxmlgui = true; @@ -83,8 +84,7 @@ void UserScript::setupShortcutsDialog() { void UserScript::setupStreamDialog() { m_streamDialog = new StreamDialog(MainWindow::instance()); - connect(m_streamDialog, &StreamDialog::requestedStreamStart, this, - &UserScript::startStream); + connect(m_streamDialog, &StreamDialog::requestedStreamStart, this, &UserScript::startStream); } void UserScript::setupVirtmic() { @@ -155,13 +155,13 @@ void UserScript::startVirtmic(QString target) { m_virtmicProcess.start(QApplication::arguments()[0], {"--virtmic", target}); } -void UserScript::startStream(bool video, bool audio, int width, int height, - int frameRate, QString target) { +void UserScript::startStream(bool video, bool audio, int width, int height, int frameRate, QString target) { stopVirtmic(); startVirtmic(audio ? target : "[None]"); // Wait a bit for the virtmic to start - QTimer::singleShot( - 200, [=]() { emit streamStarted(video, width, height, frameRate); }); + QTimer::singleShot(200, [=]() { + emit streamStarted(video, width, height, frameRate); + }); } void UserScript::showStreamDialog() { @@ -173,8 +173,7 @@ void UserScript::showStreamDialog() { } void UserScript::showThemeDialog() { - auto url = QInputDialog::getText(MainWindow::instance(), "Theme Installation", - "Please enter the URL of the Theme"); + auto url = QInputDialog::getText(MainWindow::instance(), "Theme Installation", "Please enter the URL of the Theme"); if (url != "") emit shouldInstallUserStyles(url); }