1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Add base multi monitor wallpaper setup

This commit is contained in:
Elias 2019-08-10 16:38:44 +02:00
parent e73471ad79
commit da63c09920
16 changed files with 170 additions and 63 deletions

View File

@ -1,4 +1,5 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
Item { Item {
@ -29,7 +30,7 @@ Item {
} }
} }
Row { RowLayout {
spacing: 30 spacing: 30
anchors { anchors {
top: txtHeadline.bottom top: txtHeadline.bottom
@ -42,9 +43,9 @@ Item {
id: imgIcon id: imgIcon
width: 20 width: 20
height: 20 height: 20
anchors.verticalCenter: parent.verticalCenter
source: iconSource source: iconSource
sourceSize: Qt.size(20, 20) sourceSize: Qt.size(20, 20)
Layout.alignment: Qt.AlignVCenter
} }
Slider { Slider {
@ -52,16 +53,16 @@ Item {
stepSize: 0.01 stepSize: 0.01
from: 0 from: 0
value: 1 value: 1
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
to: 1 to: 1
anchors.verticalCenter: parent.verticalCenter
} }
Text { Text {
id: txtValue id: txtValue
color: "#818181" color: "#818181"
text: Math.round(slider.value * 100) / 100 text: Math.round(slider.value * 100) / 100
anchors.verticalCenter: parent.verticalCenter Layout.alignment: Qt.AlignVCenter
//font.family: "Libre Baskerville"
font.pointSize: 12 font.pointSize: 12
font.italic: true font.italic: true
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter

View File

@ -400,14 +400,29 @@ Item {
} }
onClicked: { onClicked: {
if (type.endsWith("Wallpaper")) { if (type.endsWith("Wallpaper")) {
screenPlay.createWallpaper( let activeMonitors = monitorSelection.getActiveMonitors();
monitorSelection.activeMonitorIndex, installedListModel.absoluteStoragePath + "/" + activeScreen,
installedListModel.get(activeScreen).screenPreview, if(activeMonitors.length === 0)
(Math.round(sliderVolume.value * 100) / 100), return
settingsComboBox.model.get(settingsComboBox.currentIndex).text.toString(
), type) if(activeMonitors.length > 1) {
screenPlay.createWallpaper(
activeMonitors, installedListModel.absoluteStoragePath + "/" + activeScreen,
installedListModel.get(activeScreen).screenPreview,
(Math.round(sliderVolume.value * 100) / 100),
settingsComboBox.model.get(settingsComboBox.currentIndex).text.toString(
), type)
} else {
screenPlay.createWallpaper(
activeMonitors[0], installedListModel.absoluteStoragePath + "/" + activeScreen,
installedListModel.get(activeScreen).screenPreview,
(Math.round(sliderVolume.value * 100) / 100),
settingsComboBox.model.get(settingsComboBox.currentIndex).text.toString(
), type)
}
} else { } else {
screenPlay.createWidget( screenPlay.createWidget(
installedListModel.absoluteStoragePath + "/" + activeScreen, installedListModel.absoluteStoragePath + "/" + activeScreen,

View File

@ -14,25 +14,22 @@ Rectangle {
// Width of the Sidebar or Space that should be used // Width of the Sidebar or Space that should be used
property real availableWidth: 0 property real availableWidth: 0
property real availableHeight: 0 property real availableHeight: 0
property int activeMonitorIndex: 0
property int fontSize: 12 property int fontSize: 12
property string activeMonitorID: "empty" property string activeMonitorID: "empty"
signal requestProjectSettings(var at) signal requestProjectSettings(var at)
function getActiveMonitors(){
function setActiveMonitorIndex(newIndex) { let activeMonitors = [];
activeMonitorIndex = newIndex
activeMonitorID = rp.itemAt(newIndex).monitorID
for (var i = 0; i < rp.count; i++) { for (var i = 0; i < rp.count; i++) {
if (i === newIndex) { if(rp.itemAt(i).isSelected){
rp.itemAt(i).isSelected = true activeMonitors.push(rp.itemAt(i).index)
} else { }
rp.itemAt(i).isSelected = false
}
} }
return activeMonitors;
} }
Component.onCompleted: { Component.onCompleted: {
resize() resize()
} }
@ -42,17 +39,17 @@ Rectangle {
onMonitorReloadCompleted: { onMonitorReloadCompleted: {
resize() resize()
} }
onSetNewActiveMonitor:{ onSetNewActiveMonitor: {
rp.itemAt(index).previewImage = "file:///" + path.trim() rp.itemAt(index).previewImage = "file:///" + path.trim()
rp.itemAt(index).isSelected = true rp.itemAt(index).isSelected = true
} }
} }
Connections { Connections {
target: screenPlay target: screenPlay
onAllWallpaperRemoved:{ onAllWallpaperRemoved: {
for(var i = 0; i < rp.count; i++){ for (var i = 0; i < rp.count; i++) {
rp.itemAt(i).isSelected = false rp.itemAt(i).isSelected = false
rp.itemAt(i).previewImage ="" rp.itemAt(i).previewImage = ""
} }
} }
} }
@ -93,7 +90,6 @@ Rectangle {
rp.itemAt(i).x = rp.itemAt(i).x * monitorWidthRationDelta rp.itemAt(i).x = rp.itemAt(i).x * monitorWidthRationDelta
rp.itemAt(i).y = rp.itemAt(i).y * monitorHeightRationDelta rp.itemAt(i).y = rp.itemAt(i).y * monitorHeightRationDelta
} }
} }
Repeater { Repeater {
@ -102,7 +98,7 @@ Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
model: monitorListModel model: monitorListModel
Component.onCompleted: rp.itemAt(0).isSelected = true Component.onCompleted: rp.itemAt(0).isSelected = true
delegate: MonitorSelectionItem { delegate: MonitorSelectionItem {
id: delegate id: delegate
@ -118,16 +114,12 @@ Rectangle {
fontSize: rect.fontSize fontSize: rect.fontSize
index: monitorNumber index: monitorNumber
//isWallpaperActive: monitorIsWallpaperActive //isWallpaperActive: monitorIsWallpaperActive
//previewImage: monitorPreviewImage previewImage: monitorPreviewImage
onMonitorSelected: {
requestProjectSettings(index)
Connections {
target: delegate
onMonitorSelected: {
setActiveMonitorIndex(index)
requestProjectSettings(index)
}
} }
} }
} }
} }

View File

@ -19,6 +19,13 @@ Item {
property bool isSelected: false property bool isSelected: false
property bool isWallpaperActive: false property bool isWallpaperActive: false
signal monitorSelected(var index) signal monitorSelected(var index)
onMonitorSelected: {
if(isSelected){
isSelected = false
} else {
isSelected = true
}
}
onIsSelectedChanged: { onIsSelectedChanged: {
if (isSelected) { if (isSelected) {
@ -26,7 +33,6 @@ Item {
} else { } else {
wrapper.border.color = "#373737" wrapper.border.color = "#373737"
} }
} }

View File

@ -150,6 +150,10 @@ Item {
headline: qsTr("Playback rate") headline: qsTr("Playback rate")
onValueChanged: screenPlay.setWallpaperValue(activeMonitorIndex,"playbackRate", value) onValueChanged: screenPlay.setWallpaperValue(activeMonitorIndex,"playbackRate", value)
} }
SP.Slider {
headline: qsTr("Current Video Time")
onValueChanged: screenPlay.setWallpaperValue(activeMonitorIndex,"currentTime", value)
}
} }
GridView { GridView {

View File

@ -176,7 +176,8 @@ Monitor::Monitor(QString manufacturer, QString model, QString name, QSize size,
m_number = number; m_number = number;
// FIXME: Use a better way to create an id // FIXME: Use a better way to create an id
// because name and manufacturer are allways empty // because name and manufacturer are allways empty
m_id = name + "_" + QString::number(size.width()) + "x" + QString::number(size.height()) + "_" + QString::number(availableGeometry.x()) + "x" + QString::number(availableGeometry.y()); m_id = QString::number(size.width()) + "x" + QString::number(size.height()) + "_" + QString::number(availableGeometry.x()) + "x" + QString::number(availableGeometry.y());
} }
} }

View File

@ -34,7 +34,7 @@ void ScreenPlayManager::createWallpaper(
m_screenPlayWallpapers.emplace_back( m_screenPlayWallpapers.emplace_back(
make_unique<ScreenPlayWallpaper>( make_unique<ScreenPlayWallpaper>(
vector<int> { monitorIndex }, QVector<int> { monitorIndex },
m_settings, m_settings,
generateID(), generateID(),
path, path,
@ -50,6 +50,31 @@ void ScreenPlayManager::createWallpaper(
m_settings->saveWallpaperToConfig(monitorIndex, path, type); m_settings->saveWallpaperToConfig(monitorIndex, path, type);
} }
void ScreenPlayManager::createWallpaper( QVector<int> monitorIndex, const QString &absoluteStoragePath, const QString &previewImage, const float volume, const QString &fillMode, const QString &type)
{
m_settings->increaseActiveWallpaperCounter();
QString path = absoluteStoragePath;
if(absoluteStoragePath.contains("file:///"))
path = path.remove("file:///");
std::sort(monitorIndex.begin(), monitorIndex.end());
m_screenPlayWallpapers.emplace_back(
make_unique<ScreenPlayWallpaper>(
monitorIndex,
m_settings,
generateID(),
path,
previewImage,
volume,
fillMode,
type,
this));
}
void ScreenPlayManager::createWidget(QUrl absoluteStoragePath, const QString& previewImage) void ScreenPlayManager::createWidget(QUrl absoluteStoragePath, const QString& previewImage)
{ {
ProjectFile project {}; ProjectFile project {};
@ -118,7 +143,7 @@ void ScreenPlayManager::removeWallpaperAt(const int at)
const auto wallsToRemove = remove_if( const auto wallsToRemove = remove_if(
m_screenPlayWallpapers.begin(), m_screenPlayWallpapers.end(), m_screenPlayWallpapers.begin(), m_screenPlayWallpapers.end(),
[&](const unique_ptr<ScreenPlayWallpaper>& uPtrWallpaper) -> bool { [&](const unique_ptr<ScreenPlayWallpaper>& uPtrWallpaper) -> bool {
const vector<int>& screenNumber = uPtrWallpaper->screenNumber(); const QVector<int>& screenNumber = uPtrWallpaper->screenNumber();
const bool isFound = !screenNumber.empty() && screenNumber[0] == at; const bool isFound = !screenNumber.empty() && screenNumber[0] == at;
if (isFound) { if (isFound) {
m_sdkconnector->closeWallpapersAt(at); m_sdkconnector->closeWallpapersAt(at);
@ -200,9 +225,8 @@ void ScreenPlayManager::loadActiveProfiles()
// A wallpaper can span across multiple monitors // A wallpaper can span across multiple monitors
for (const QJsonValueRef monitor : monitorsArray) { for (const QJsonValueRef monitor : monitorsArray) {
QJsonObject obj = monitor.toObject(); QJsonObject obj = monitor.toObject();
int parseMonitorIndexDefaultValue { -1 };
int monitorIndex = obj.value("index").toInt(parseMonitorIndexDefaultValue);
int monitorIndex = obj.value("index").toInt(-1);
if (monitorIndex == -1) if (monitorIndex == -1)
continue; continue;

View File

@ -33,6 +33,7 @@ using std::shared_ptr,
std::size_t, std::size_t,
std::remove_if; std::remove_if;
class ScreenPlayManager final : public QObject { class ScreenPlayManager final : public QObject {
Q_OBJECT Q_OBJECT
@ -56,7 +57,13 @@ public slots:
void createWallpaper(const int monitorIndex, const QString& absoluteStoragePath, void createWallpaper(const int monitorIndex, const QString& absoluteStoragePath,
const QString& previewImage, const float volume, const QString& previewImage, const float volume,
const QString& fillMode, const QString& type); const QString& fillMode, const QString& type);
void createWallpaper( QVector<int> monitorIndex, const QString& absoluteStoragePath,
const QString& previewImage, const float volume,
const QString& fillMode, const QString& type);
void createWidget(QUrl absoluteStoragePath, const QString& previewImage); void createWidget(QUrl absoluteStoragePath, const QString& previewImage);
void closeAllConnections(); void closeAllConnections();
void requestProjectSettingsListModelAt(const int index); void requestProjectSettingsListModelAt(const int index);
void setWallpaperValue(const int at, const QString& key, const QString& value); void setWallpaperValue(const int at, const QString& key, const QString& value);

View File

@ -6,7 +6,7 @@
*/ */
namespace ScreenPlay { namespace ScreenPlay {
ScreenPlayWallpaper::ScreenPlayWallpaper(const vector<int>& screenNumber, ScreenPlayWallpaper::ScreenPlayWallpaper(const QVector<int>& screenNumber,
const shared_ptr<Settings>& settings, const shared_ptr<Settings>& settings,
const QString& appID, const QString& appID,
const QString& projectPath, const QString& projectPath,
@ -17,7 +17,7 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const vector<int>& screenNumber,
QObject* parent) QObject* parent)
: QObject(parent) : QObject(parent)
, m_projectSettingsListModel { make_shared<ProjectSettingsListModel>(projectPath + "/project.json") } , m_projectSettingsListModel { make_shared<ProjectSettingsListModel>(projectPath + "/project.json") }
, m_screenNumber { move(screenNumber) } , m_screenNumber { screenNumber }
, m_projectPath { projectPath } , m_projectPath { projectPath }
, m_previewImage { previewImage } , m_previewImage { previewImage }
, m_appID { appID } , m_appID { appID }
@ -36,8 +36,22 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const vector<int>& screenNumber,
qDebug() << "EX: " << error; qDebug() << "EX: " << error;
}); });
QString tmpScreenNumber;
if (m_screenNumber.length() > 1) {
for (const int number : m_screenNumber) {
// IMPORTANT: NO TRAILING COMMA!
if (number == m_screenNumber.back()) {
tmpScreenNumber += QString::number(number);
} else {
tmpScreenNumber += QString::number(number) + ",";
}
}
} else {
tmpScreenNumber = QString::number(m_screenNumber.first());
}
const QStringList proArgs { const QStringList proArgs {
QString::number(m_screenNumber.empty() ? 0 : m_screenNumber[0]), tmpScreenNumber,
m_projectPath, m_projectPath,
QString { "appID=" + m_appID }, QString { "appID=" + m_appID },
"", "",
@ -45,7 +59,7 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const vector<int>& screenNumber,
fillMode fillMode
}; };
//qDebug() << "Creating ScreenPlayWallpaper " << proArgs; qDebug() << "Creating ScreenPlayWallpaper " << proArgs;
m_process.setArguments(proArgs); m_process.setArguments(proArgs);
m_process.setProgram(m_settings->screenPlayWallpaperPath().toString()); m_process.setProgram(m_settings->screenPlayWallpaperPath().toString());

View File

@ -17,14 +17,14 @@ using std::shared_ptr,
class ScreenPlayWallpaper final : public QObject { class ScreenPlayWallpaper final : public QObject {
Q_OBJECT Q_OBJECT
Q_PROPERTY(vector<int> screenNumber READ screenNumber WRITE setScreenNumber NOTIFY screenNumberChanged) Q_PROPERTY(QVector<int> screenNumber READ screenNumber WRITE setScreenNumber NOTIFY screenNumberChanged)
Q_PROPERTY(QString projectPath READ projectPath WRITE setProjectPath NOTIFY projectPathChanged) Q_PROPERTY(QString projectPath READ projectPath WRITE setProjectPath NOTIFY projectPathChanged)
Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged) Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged)
Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged) Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged)
Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
public: public:
explicit ScreenPlayWallpaper(const vector<int>& screenNumber, explicit ScreenPlayWallpaper(const QVector<int>& screenNumber,
const shared_ptr<Settings>& settings, const shared_ptr<Settings>& settings,
const QString& appID, const QString& appID,
const QString& projectPath, const QString& projectPath,
@ -41,7 +41,7 @@ public:
return m_projectSettingsListModel; return m_projectSettingsListModel;
} }
vector<int> screenNumber() const QVector<int> screenNumber() const
{ {
return m_screenNumber; return m_screenNumber;
} }
@ -67,14 +67,14 @@ public:
} }
signals: signals:
void screenNumberChanged(vector<int> screenNumber); void screenNumberChanged(QVector<int> screenNumber);
void projectPathChanged(QString projectPath); void projectPathChanged(QString projectPath);
void previewImageChanged(QString previewImage); void previewImageChanged(QString previewImage);
void appIDChanged(QString appID); void appIDChanged(QString appID);
void typeChanged(QString type); void typeChanged(QString type);
public slots: public slots:
void setScreenNumber(vector<int> screenNumber) void setScreenNumber(QVector<int> screenNumber)
{ {
if (m_screenNumber == screenNumber) if (m_screenNumber == screenNumber)
return; return;
@ -122,7 +122,7 @@ public slots:
private: private:
QProcess m_process; QProcess m_process;
shared_ptr<ProjectSettingsListModel> m_projectSettingsListModel; shared_ptr<ProjectSettingsListModel> m_projectSettingsListModel;
vector<int> m_screenNumber; QVector<int> m_screenNumber;
QString m_projectPath; QString m_projectPath;
QString m_previewImage; QString m_previewImage;
QString m_appID; QString m_appID;

View File

@ -60,7 +60,11 @@ int main(int argc, char* argv[])
sdk.setAppID(argumentList.at(3)); sdk.setAppID(argumentList.at(3));
QString monitorNumbers = argumentList.at(1); QString monitorNumbers = argumentList.at(1);
QStringList activeScreensList = monitorNumbers.split(",");
qDebug() << activeScreensList;
activeScreensList.removeAll(",");
QVector<int> list; QVector<int> list;
qDebug() << activeScreensList;
if (monitorNumbers.length() == 1) { if (monitorNumbers.length() == 1) {
bool canParseMonitorNumber = false; bool canParseMonitorNumber = false;
@ -70,8 +74,8 @@ int main(int argc, char* argv[])
} }
list.append(monitor); list.append(monitor);
} else { } else {
QStringList activeScreensList = monitorNumbers.split(",");
for (QString s : activeScreensList) { for (const QString& s : activeScreensList) {
bool ok = false; bool ok = false;
int val = s.toInt(&ok); int val = s.toInt(&ok);
if (!ok) { if (!ok) {

View File

@ -118,10 +118,7 @@ Rectangle {
if(desktopProperties.windowsVersion >= 1903){ if(desktopProperties.windowsVersion >= 1903){
var ratio = root.width / root.height var ratio = root.width / root.height
print(ratio)
ratio = Math.round(ratio * 100) / 100 ratio = Math.round(ratio * 100) / 100
print(ratio, root.width, root.height)
// 4:3 // 4:3
if (ratio === 1,3) { if (ratio === 1,3) {
@ -227,10 +224,10 @@ Rectangle {
} }
} }
onPlaybackRateChanged: { onCurrentTimeChanged: {
if (webView.loadProgress === 100) { if (webView.loadProgress === 100) {
webView.runJavaScript( webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.playbackRate = " + playbackRate + ";") "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.currentTime = " + currentTime + " * videoPlayer.duration;")
} }
} }

View File

@ -121,5 +121,14 @@ void BaseWindow::messageReceived(QString key, QString value)
return; return;
} }
if (key == "currentTime") {
bool ok;
float tmp = value.toFloat(&ok);
if (ok) {
setCurrentTime(tmp);
}
return;
}
emit qmlSceneValueReceived(key, value); emit qmlSceneValueReceived(key, value);
} }

View File

@ -25,10 +25,12 @@ public:
Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged) Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
Q_PROPERTY(bool muted READ muted WRITE setMuted NOTIFY mutedChanged) Q_PROPERTY(bool muted READ muted WRITE setMuted NOTIFY mutedChanged)
Q_PROPERTY(float playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged) Q_PROPERTY(float playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged)
Q_PROPERTY(float currentTime READ currentTime WRITE setCurrentTime NOTIFY currentTimeChanged)
Q_PROPERTY(WallpaperType type READ type WRITE setType NOTIFY typeChanged) Q_PROPERTY(WallpaperType type READ type WRITE setType NOTIFY typeChanged)
Q_PROPERTY(QString OSVersion READ OSVersion WRITE setOSVersion NOTIFY OSVersionChanged) Q_PROPERTY(QString OSVersion READ OSVersion WRITE setOSVersion NOTIFY OSVersionChanged)
QSysInfo m_sysinfo; QSysInfo m_sysinfo;
enum class WallpaperType { enum class WallpaperType {
Video, Video,
Html, Html,
@ -37,6 +39,8 @@ public:
}; };
Q_ENUM(WallpaperType) Q_ENUM(WallpaperType)
bool loops() const bool loops() const
{ {
return m_loops; return m_loops;
@ -82,6 +86,11 @@ public:
return m_muted; return m_muted;
} }
float currentTime() const
{
return m_currentTime;
}
signals: signals:
void loopsChanged(bool loops); void loopsChanged(bool loops);
void volumeChanged(float volume); void volumeChanged(float volume);
@ -92,10 +101,9 @@ signals:
void appIDChanged(QString appID); void appIDChanged(QString appID);
void qmlExit(); void qmlExit();
void qmlSceneValueReceived(QString key, QString value); void qmlSceneValueReceived(QString key, QString value);
void OSVersionChanged(QString OSVersion); void OSVersionChanged(QString OSVersion);
void mutedChanged(bool muted); void mutedChanged(bool muted);
void currentTimeChanged(float currentTime);
public slots: public slots:
virtual void destroyThis() {} virtual void destroyThis() {}
@ -187,6 +195,16 @@ public slots:
emit mutedChanged(m_muted); emit mutedChanged(m_muted);
} }
void setCurrentTime(float currentTime)
{
qWarning("Floating point comparison needs context sanity check");
if (qFuzzyCompare(m_currentTime, currentTime))
return;
m_currentTime = currentTime;
emit currentTimeChanged(m_currentTime);
}
private: private:
bool m_loops { true }; bool m_loops { true };
bool m_isPlaying { true }; bool m_isPlaying { true };
@ -200,4 +218,5 @@ private:
WallpaperType m_type = BaseWindow::WallpaperType::Qml; WallpaperType m_type = BaseWindow::WallpaperType::Qml;
QString m_OSVersion; QString m_OSVersion;
float m_currentTime;
}; };

View File

@ -60,7 +60,7 @@ LRESULT __stdcall MouseHookCallback(int nCode, WPARAM wParam, LPARAM lParam)
return CallNextHookEx(mouseHook, nCode, wParam, lParam); return CallNextHookEx(mouseHook, nCode, wParam, lParam);
} }
WinWindow::WinWindow(QVector<int>& activeScreensList, QString projectPath, QString id, QString volume) WinWindow::WinWindow(const QVector<int> &activeScreensList, QString projectPath, QString id, QString volume)
: BaseWindow(projectPath) : BaseWindow(projectPath)
{ {
m_windowHandle = reinterpret_cast<HWND>(m_window.winId()); m_windowHandle = reinterpret_cast<HWND>(m_window.winId());
@ -94,8 +94,13 @@ WinWindow::WinWindow(QVector<int>& activeScreensList, QString projectPath, QStri
// Ether for one Screen or for all // Ether for one Screen or for all
if ((QApplication::screens().length() == activeScreensList.length()) && (activeScreensList.length() != 1)) { if ((QApplication::screens().length() == activeScreensList.length()) && (activeScreensList.length() != 1)) {
setupWallpaperForAllScreens(); setupWallpaperForAllScreens();
qDebug() << "setupWallpaperForAllScreens()";
} else if (activeScreensList.length() == 1) { } else if (activeScreensList.length() == 1) {
setupWallpaperForOneScreen(activeScreensList.at(0)); setupWallpaperForOneScreen(activeScreensList.at(0));
qDebug() << "setupWallpaperForOneScreen()";
} else if (activeScreensList.length() == 1) {
setupWallpaperForMultipleScreens(activeScreensList);
qDebug() << "setupWallpaperForMultipleScreens()";
} }
m_window.setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView); m_window.setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
@ -188,6 +193,12 @@ void WinWindow::setupWallpaperForAllScreens()
} }
} }
void WinWindow::setupWallpaperForMultipleScreens(const QVector<int> &activeScreensList)
{
qDebug() << "######## setupWallpaperForMultipleScreens ########";
}
bool WinWindow::searchWorkerWindowToParentTo() bool WinWindow::searchWorkerWindowToParentTo()
{ {
HWND progman_hwnd = FindWindowW(L"Progman", L"Program Manager"); HWND progman_hwnd = FindWindowW(L"Progman", L"Program Manager");

View File

@ -20,8 +20,9 @@
class WinWindow : public BaseWindow { class WinWindow : public BaseWindow {
Q_OBJECT Q_OBJECT
public: public:
explicit WinWindow(QVector<int>& activeScreensList, QString projectPath, QString id, QString volume); explicit WinWindow(const QVector<int>& activeScreensList, QString projectPath, QString id, QString volume);
public slots: public slots:
void setVisible(bool show) override; void setVisible(bool show) override;
@ -32,8 +33,10 @@ private:
void calcOffsets(); void calcOffsets();
void setupWallpaperForOneScreen(int activeScreen); void setupWallpaperForOneScreen(int activeScreen);
void setupWallpaperForAllScreens(); void setupWallpaperForAllScreens();
void setupWallpaperForMultipleScreens(const QVector<int>& activeScreensList);
bool searchWorkerWindowToParentTo(); bool searchWorkerWindowToParentTo();
private: private:
int m_windowOffsetX = 0; int m_windowOffsetX = 0;
int m_windowOffsetY = 0; int m_windowOffsetY = 0;