mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-05 02:22:28 +01:00
Add more docs
This commit is contained in:
parent
e8fbe8e565
commit
f60c93ee64
@ -12,6 +12,10 @@
|
||||
\brief .
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief ShaderLibrary::ShaderLibrary
|
||||
* \param parent
|
||||
*/
|
||||
ShaderLibrary::ShaderLibrary(QQuickItem* parent)
|
||||
: QQuickItem(parent)
|
||||
{
|
||||
|
@ -19,6 +19,9 @@ CPU::CPU(QObject* parent)
|
||||
m_updateTimer.start(m_tickRate);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief CPU::update
|
||||
*/
|
||||
void CPU::update()
|
||||
{
|
||||
BOOL status;
|
||||
|
@ -28,8 +28,11 @@ static const char* vendor_name(iware::gpu::vendor_t vendor) noexcept
|
||||
\class GPU
|
||||
\inmodule ScreenPlaySysInfo
|
||||
\brief .
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief GPU::GPU
|
||||
*/
|
||||
GPU::GPU(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "storage.h"
|
||||
|
||||
|
||||
/*!
|
||||
\class Storage
|
||||
\inmodule ScreenPlaySysInfo
|
||||
|
@ -13,6 +13,9 @@
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief SysInfo::SysInfo
|
||||
*/
|
||||
SysInfo::SysInfo(QQuickItem* parent)
|
||||
: QQuickItem(parent)
|
||||
, m_ram(std::make_unique<RAM>())
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <sysinfoapi.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
\class Uptime
|
||||
\inmodule ScreenPlaySysInfo
|
||||
@ -18,11 +17,13 @@ Uptime::Uptime(QObject* parent)
|
||||
m_updateTimer.start(m_tickRate);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Uptime::update
|
||||
*/
|
||||
void Uptime::update()
|
||||
{
|
||||
#ifdef Q_OS_WINDOWS
|
||||
auto ticks = GetTickCount64();
|
||||
auto milliseconds = ticks % 1000;
|
||||
ticks /= 1000;
|
||||
auto seconds = ticks % 60;
|
||||
ticks /= 60;
|
||||
|
@ -37,12 +37,10 @@
|
||||
|
||||
namespace ScreenPlay {
|
||||
/*!
|
||||
\class ScreenPlay::SearchType
|
||||
\namespace ScreenPlay::SearchType
|
||||
\inmodule ScreenPlayUtil
|
||||
\brief Global Enums.
|
||||
|
||||
\brief Global enum for search types. Used in the "Installed" tab.
|
||||
*/
|
||||
|
||||
namespace SearchType {
|
||||
Q_NAMESPACE
|
||||
|
||||
@ -57,12 +55,12 @@ namespace SearchType {
|
||||
|
||||
}
|
||||
/*!
|
||||
\class ScreenPlay::FillMode
|
||||
\namespace ScreenPlay::FillMode
|
||||
\inmodule ScreenPlayUtil
|
||||
\brief Global Enums.
|
||||
|
||||
\brief Global enum for fill mode. This is a c++ representation
|
||||
of HTML fill modes. We use "_" instead of "-" for scale down,
|
||||
because c++ forbids "-" in enum names.
|
||||
*/
|
||||
|
||||
namespace FillMode {
|
||||
Q_NAMESPACE
|
||||
|
||||
@ -77,20 +75,17 @@ namespace FillMode {
|
||||
|
||||
}
|
||||
/*!
|
||||
\class ScreenPlay::InstalledType
|
||||
\namespace ScreenPlay::InstalledType
|
||||
\inmodule ScreenPlayUtil
|
||||
\brief Global Enums.
|
||||
|
||||
\brief When changing the enum, one also needs to change:
|
||||
GlobalVariables::getAvailableWallpaper
|
||||
GlobalVariables::getAvailableWidgets
|
||||
Common/Util.js isWallpaper() and isWidget()
|
||||
ScreenPlayWallpaper: BaseWindow::parseWallpaperType()
|
||||
*/
|
||||
|
||||
namespace InstalledType {
|
||||
Q_NAMESPACE
|
||||
|
||||
// When changing the enum, one also needs to change:
|
||||
// GlobalVariables::getAvailableWallpaper
|
||||
// GlobalVariables::getAvailableWidgets
|
||||
// Common/Util.js isWallpaper() and isWidget()
|
||||
// ScreenPlayWallpaper: BaseWindow::parseWallpaperType()
|
||||
enum class InstalledType {
|
||||
Unknown,
|
||||
//Wallpaper
|
||||
|
@ -41,7 +41,8 @@ std::optional<QJsonObject> openJsonFileToObject(const QString& path)
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief .
|
||||
\brief Writes a QJsonObject into a given file. It defaults to truncate the file
|
||||
or you can set it to append to an existing file.
|
||||
*/
|
||||
bool writeJsonObjectToFile(const QString& absoluteFilePath, const QJsonObject& object, bool truncate)
|
||||
{
|
||||
@ -111,7 +112,7 @@ QString generateRandomString(quint32 length)
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Return .exe in windows otherwise empty string.
|
||||
\brief Return .exe on windows otherwise empty string.
|
||||
*/
|
||||
QString executableEnding()
|
||||
{
|
||||
@ -176,7 +177,6 @@ QString toString(const QStringList& list)
|
||||
|
||||
/*!
|
||||
\brief Util function that converts a QVector of Strings into a QJsonArray.
|
||||
|
||||
*/
|
||||
QJsonArray fillArray(const QVector<QString>& items)
|
||||
{
|
||||
@ -188,9 +188,7 @@ QJsonArray fillArray(const QVector<QString>& items)
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Maps the Search type to an installed type. Used for filtering the installed
|
||||
content.
|
||||
|
||||
\brief Maps the Search type to an installed type. Used for filtering the installed content.
|
||||
*/
|
||||
ScreenPlay::SearchType::SearchType getSearchTypeFromInstalledType(const ScreenPlay::InstalledType::InstalledType type)
|
||||
{
|
||||
@ -264,7 +262,7 @@ QString toLocal(const QString& url)
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief .
|
||||
\brief Returns a list of available wallpaper types like videoWallpaper.
|
||||
*/
|
||||
QStringList getAvailableWallpaper()
|
||||
{
|
||||
@ -279,7 +277,7 @@ QStringList getAvailableWallpaper()
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief .
|
||||
\brief Returns a list of available widget types like qmlWidget.
|
||||
*/
|
||||
QStringList getAvailableWidgets()
|
||||
{
|
||||
@ -290,7 +288,7 @@ QStringList getAvailableWidgets()
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief .
|
||||
\brief Returns a combined list of available widgets and wallpaper types.
|
||||
*/
|
||||
QStringList getAvailableTypes()
|
||||
{
|
||||
@ -298,7 +296,7 @@ QStringList getAvailableTypes()
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief .
|
||||
\brief Returns true of the given type is a wallpaper.
|
||||
*/
|
||||
bool isWallpaper(const ScreenPlay::InstalledType::InstalledType type)
|
||||
{
|
||||
@ -314,7 +312,7 @@ bool isWallpaper(const ScreenPlay::InstalledType::InstalledType type)
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief .
|
||||
\brief Returns true of the given type is a widget.
|
||||
*/
|
||||
bool isWidget(const ScreenPlay::InstalledType::InstalledType type)
|
||||
{
|
||||
@ -325,7 +323,8 @@ bool isWidget(const ScreenPlay::InstalledType::InstalledType type)
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief See https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
|
||||
\brief HTML video fillModes to be used in the QWebEngine video player.
|
||||
See https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
|
||||
*/
|
||||
QStringList getAvailableFillModes()
|
||||
{
|
||||
|
@ -37,6 +37,9 @@ struct WinMonitorStats {
|
||||
WinMonitorStats() { EnumDisplayMonitors(0, 0, MonitorEnum, (LPARAM)this); }
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Searches for the worker window for our window to parent to.
|
||||
*/
|
||||
BOOL WINAPI SearchForWorkerWindow(HWND hwnd, LPARAM lparam)
|
||||
{
|
||||
// 0xXXXXXXX "" WorkerW
|
||||
@ -55,6 +58,10 @@ QPoint g_LastMousePosition { 0, 0 };
|
||||
QPoint g_globalOffset { 0, 0 };
|
||||
QQuickView* g_winGlobalHook = nullptr;
|
||||
|
||||
/*!
|
||||
\brief Windows mouse callback. This hook then forwards the event to the Qt window.
|
||||
We must manually call a release event otherwise QML gets stuck.
|
||||
*/
|
||||
LRESULT __stdcall MouseHookCallback(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
||||
@ -109,6 +116,9 @@ LRESULT __stdcall MouseHookCallback(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
return CallNextHookEx(g_mouseHook, nCode, wParam, lParam);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Setup the SetWindowsHookEx hook to be used to receive mouse events.
|
||||
*/
|
||||
void WinWindow::setupWindowMouseHook()
|
||||
{
|
||||
using ScreenPlay::InstalledType::InstalledType;
|
||||
@ -129,9 +139,20 @@ void WinWindow::setupWindowMouseHook()
|
||||
/*!
|
||||
\class WinWindow
|
||||
\inmodule ScreenPlayWallpaper
|
||||
\brief .
|
||||
\brief ScreenPlayWindow used for the Windows implementation.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\brief Creates a window on Windows from the give parameters:
|
||||
\a activeScreensList
|
||||
\a projectFilePath
|
||||
\a appID
|
||||
\a volume
|
||||
\a fillmode
|
||||
\a type
|
||||
\a checkWallpaperVisible
|
||||
\a debugMode
|
||||
*/
|
||||
WinWindow::WinWindow(
|
||||
const QVector<int>& activeScreensList,
|
||||
const QString& projectFilePath,
|
||||
@ -213,27 +234,27 @@ WinWindow::WinWindow(
|
||||
if (!debugMode)
|
||||
sdk()->start();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calls ShowWindow function to set the main window in/visible.
|
||||
*/
|
||||
void WinWindow::setVisible(bool show)
|
||||
{
|
||||
if (show) {
|
||||
if (!ShowWindow(m_windowHandleWorker, SW_SHOW)) {
|
||||
qDebug() << "Cannot set window handle SW_SHOW";
|
||||
}
|
||||
if (!ShowWindow(m_windowHandle, SW_SHOW)) {
|
||||
qDebug() << "Cannot set window handle SW_SHOW";
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!ShowWindow(m_windowHandleWorker, SW_HIDE)) {
|
||||
qDebug() << "Cannot set window handle SW_HIDE";
|
||||
}
|
||||
if (!ShowWindow(m_windowHandle, SW_HIDE)) {
|
||||
qDebug() << "Cannot set window handle SW_HIDE";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief This function fires a qmlExit() signal to the UI for it to handle
|
||||
nice fade out animation first. Then the UI is responsible for calling
|
||||
WinWindow::terminate().
|
||||
*/
|
||||
void WinWindow::destroyThis()
|
||||
{
|
||||
emit qmlExit();
|
||||
@ -254,6 +275,9 @@ BOOL CALLBACK GetMonitorByIndex(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMo
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief This method is called if the user want to have one wallpaper on one window.
|
||||
*/
|
||||
void WinWindow::setupWallpaperForOneScreen(int activeScreen)
|
||||
{
|
||||
const QRect screenRect = QApplication::screens().at(activeScreen)->geometry();
|
||||
@ -302,6 +326,9 @@ void WinWindow::setupWallpaperForOneScreen(int activeScreen)
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief This method is called if the user want to have one wallpaper on all windows.
|
||||
*/
|
||||
void WinWindow::setupWallpaperForAllScreens()
|
||||
{
|
||||
QRect rect;
|
||||
@ -320,6 +347,9 @@ void WinWindow::setupWallpaperForAllScreens()
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief This method is called if the user want to have one wallpaper on multiple windows.
|
||||
*/
|
||||
void WinWindow::setupWallpaperForMultipleScreens(const QVector<int>& activeScreensList)
|
||||
{
|
||||
QRect rect;
|
||||
@ -360,14 +390,19 @@ bool WinWindow::searchWorkerWindowToParentTo()
|
||||
return EnumWindows(SearchForWorkerWindow, reinterpret_cast<LPARAM>(&m_windowHandleWorker));
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Reads the logicalDotsPerInch and mapps them to scaling factors.
|
||||
This is needed to detect if the user has different monitors with
|
||||
different scaling factors.
|
||||
|
||||
screen->logicalDotsPerInch()
|
||||
100% -> 96 -> 1
|
||||
125% -> 120 -> 1.25
|
||||
150% -> 144 -> 1.5
|
||||
...
|
||||
*/
|
||||
float WinWindow::getScaling(const int monitorIndex)
|
||||
{
|
||||
// screen->logicalDotsPerInch()
|
||||
// 100% - 96
|
||||
// 125% - 120
|
||||
// 150% - 144
|
||||
// 175% - 168
|
||||
// 200% - 192
|
||||
QScreen* screen = QApplication::screens().at(monitorIndex);
|
||||
const int factor = screen->logicalDotsPerInch();
|
||||
switch (factor) {
|
||||
@ -395,6 +430,10 @@ float WinWindow::getScaling(const int monitorIndex)
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Sets the size and the parent to the worker handle to be displayed behind the
|
||||
desktop icons.
|
||||
*/
|
||||
void WinWindow::configureWindowGeometry()
|
||||
{
|
||||
ShowWindow(m_windowHandle, SW_HIDE);
|
||||
@ -403,8 +442,6 @@ void WinWindow::configureWindowGeometry()
|
||||
qFatal("No worker window found");
|
||||
}
|
||||
|
||||
ShowWindow(m_windowHandleWorker, SW_HIDE);
|
||||
|
||||
RECT rect {};
|
||||
if (!GetWindowRect(m_windowHandleWorker, &rect)) {
|
||||
qFatal("Unable to get WindoeRect from worker");
|
||||
@ -473,7 +510,10 @@ int GetMonitorIndex(HMONITOR hMonitor)
|
||||
|
||||
return info.iIndex;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief This method is called via a fixed interval to detect if a window completely
|
||||
covers a monitor. If then sets visualPaused for QML to pause the content.
|
||||
*/
|
||||
void WinWindow::checkForFullScreenWindow()
|
||||
{
|
||||
|
||||
@ -501,7 +541,10 @@ void WinWindow::checkForFullScreenWindow()
|
||||
setVisualsPaused(false);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Custom exit method to force a redraw of the window so that
|
||||
the default desktop wallpaper can be seen agian.
|
||||
*/
|
||||
void WinWindow::terminate()
|
||||
{
|
||||
ShowWindow(m_windowHandle, SW_HIDE);
|
||||
@ -514,6 +557,11 @@ void WinWindow::terminate()
|
||||
QApplication::quit();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Call the qml engine clearComponentCache. This function is used for
|
||||
refreshing wallpaper when the content has changed. For example this
|
||||
is needed for live editing when the content is chached.
|
||||
*/
|
||||
void WinWindow::clearComponentCache()
|
||||
{
|
||||
m_window.engine()->clearComponentCache();
|
||||
|
Loading…
Reference in New Issue
Block a user