1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00
This commit is contained in:
Elias Steurer 2020-08-23 19:06:17 +02:00
parent 2fc5452272
commit 5e775b202d
13 changed files with 60 additions and 62 deletions

View File

@ -70,12 +70,13 @@ set(l10n
set_source_files_properties(${l10n} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/translations")
qt5_add_translation(qmFiles ${l10n})
#qt5_add_big_resources(resources resources.qrc)
# For development purposes to display source files in QtCreator
#qt5_add_resources(qml qml.qrc resources.qrc)
qt5_add_resources(qml qml.qrc resources.qrc)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
qt5_add_resources(qml qml.qrc resources.qrc)
else()
# qtquick_compiler_add_resources(qml qml.qrc resources.qrc)
qtquick_compiler_add_resources(qml qml.qrc resources.qrc)
endif()
add_executable(${PROJECT_NAME} ${src} ${headers} ${resources} ${qml})
@ -110,4 +111,3 @@ target_include_directories(${PROJECT_NAME}
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/assets/fonts)
configure_file(assets/fonts/NotoSansCJKkr-Regular.otf ${CMAKE_BINARY_DIR}/bin/assets/fonts COPYONLY)

View File

@ -47,7 +47,7 @@ App::App()
QGuiApplication::setOrganizationName("ScreenPlay");
QGuiApplication::setOrganizationDomain("screen-play.app");
QGuiApplication::setApplicationName("ScreenPlay");
QGuiApplication::setApplicationVersion("0.11.0");
QGuiApplication::setApplicationVersion("0.12.0");
QGuiApplication::setQuitOnLastWindowClosed(false);
#ifdef Q_OS_WINDOWS
@ -179,10 +179,7 @@ void App::init()
}
qmlRegisterSingletonInstance("ScreenPlay", 1, 0, "ScreenPlay", this);
if (!loadSteamPlugin())
qWarning() << "Steam plugin not provided!";
loadSteamPlugin();
m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/main.qml")));
}
@ -202,7 +199,7 @@ void App::exit()
}
}
bool App::loadSteamPlugin()
void App::loadSteamPlugin()
{
#ifdef Q_OS_MACOS
const QString fileSuffix = ".dylib";
@ -220,11 +217,11 @@ bool App::loadSteamPlugin()
m_workshopPlugin.setFileName(QApplication::applicationDirPath() + "/ScreenPlayWorkshop" + fileSuffix);
if (!m_workshopPlugin.load()) {
return false;
qWarning() << "Steam plugin not provided!";
qWarning() << m_workshopPlugin.fileName() << " - With error: " << m_workshopPlugin.errorString();
}
const ScreenPlayWorkshopPlugin* workshopPlugin = reinterpret_cast<ScreenPlayWorkshopPlugin*>(m_workshopPlugin.instance());
settings()->setSteamVersion(true);
return true;
}
}

View File

@ -249,7 +249,7 @@ public slots:
}
private:
bool loadSteamPlugin();
void loadSteamPlugin();
private:
QPluginLoader m_workshopPlugin;

View File

@ -31,7 +31,7 @@ ApplicationWindow {
visible: false
width: 1400
height: 788
title: "ScreenPlay Alpha - V0.11.0"
title: "ScreenPlay Alpha - V0.12.0"
minimumHeight: 450
minimumWidth: 1050
onVisibilityChanged: {

View File

@ -20,6 +20,7 @@ ColumnLayout {
onWallpaperChanged: {
if(!wallpaper)
{
slPlaybackRate.slider.value = 1
return
}
slVolume.slider.value = wallpaper.volume
@ -43,7 +44,7 @@ ColumnLayout {
id:slVolume
headline: qsTr("Volume")
slider.stepSize: 0.1
slider.onMoved: {
slider.onValueChanged: {
ScreenPlay.screenPlayManager.setWallpaperValueAtMonitorIndex(
activeMonitorIndex, "volume", Number(slider.value).toFixed(1))
}
@ -55,17 +56,18 @@ ColumnLayout {
SP.Slider {
id:slPlaybackRate
headline: qsTr("Playback rate")
slider.onMoved: ScreenPlay.screenPlayManager.setWallpaperValueAtMonitorIndex(
slider.onValueChanged: ScreenPlay.screenPlayManager.setWallpaperValueAtMonitorIndex(
activeMonitorIndex, "playbackRate", Number(slider.value).toFixed(1))
Layout.fillWidth: true
slider.stepSize: 0.1
slider.to: 1
Layout.leftMargin: 10
Layout.rightMargin: 10
}
SP.Slider {
id: slCurrentVideoTime
headline: qsTr("Current Video Time")
slider.onMoved: ScreenPlay.screenPlayManager.setWallpaperValueAtMonitorIndex(
slider.onValueChanged: ScreenPlay.screenPlayManager.setWallpaperValueAtMonitorIndex(
activeMonitorIndex, "currentTime", Number(slider.value).toFixed(1))
Layout.fillWidth: true
slider.stepSize: 0.1

View File

@ -50,7 +50,7 @@ Rectangle {
}
}
function deselectOthers(index) {
function selectOnly(index) {
for (var i = 0; i < rp.count; i++) {
if (i === index) {
@ -82,6 +82,20 @@ Rectangle {
return root.activeMonitors
}
function selectMonitorAt(index) {
if (!multipleMonitorsSelectable) {
selectOnly(index)
} else {
rp.itemAt(index).isSelected = !rp.itemAt(index).isSelected
}
getActiveMonitors()
if (rp.itemAt(index).hasContent)
root.requestProjectSettings(index, rp.itemAt(index).installedType,
rp.itemAt(index).appID)
}
function resize() {
var absoluteDesktopSize = ScreenPlay.monitorListModel.getAbsoluteDesktopSize()
@ -151,9 +165,6 @@ Rectangle {
model: ScreenPlay.monitorListModel
property int contentWidth
property int contentHeight
Component.onCompleted: rp.itemAt(0).isSelected = true
delegate: MonitorSelectionItem {
id: delegate
monitorID: m_monitorID
@ -171,23 +182,7 @@ Rectangle {
previewImage: m_previewImage
installedType: m_installedType
monitorWithoutContentSelectable: root.monitorWithoutContentSelectable
onMonitorSelected: {
if (!multipleMonitorsSelectable) {
deselectOthers(index)
} else {
rp.itemAt(index).isSelected = !rp.itemAt(
index).isSelected
}
getActiveMonitors()
if (delegate.hasContent)
root.requestProjectSettings(delegate.index,
delegate.installedType,
delegate.appID)
}
onMonitorSelected: root.selectMonitorAt(delegate.index)
}
}
}

View File

@ -41,7 +41,7 @@ Popup {
}
onOpened: {
ScreenPlay.screenPlayManager.requestProjectSettingsAtMonitorIndex(0)
monitorSelection.selectMonitorAt(0)
}
Item {
@ -81,7 +81,6 @@ Popup {
id: monitorSelection
radius: 3
height: 200
z: 99
width: parent.width * .9
multipleMonitorsSelectable: false
monitorWithoutContentSelectable: false

View File

@ -78,7 +78,7 @@ Item {
anchors.leftMargin: navigationItem.amount == "" ? 0 : 5
text: "name"
font.pointSize: 14
color: Material.foreground
color: Material.primaryTextColor
anchors.verticalCenter: parent.verticalCenter
font.family: ScreenPlay.settings.font
font.weight: Font.Normal

View File

@ -59,7 +59,6 @@ Settings::Settings(const std::shared_ptr<GlobalVariables>& globalVariables,
setAutostart(m_qSettings.value("Autostart", true).toBool());
}
setCheckWallpaperVisible(m_qSettings.value("CheckWallpaperVisible", false).toBool());
setHighPriorityStart(m_qSettings.value("ScreenPlayExecutable", false).toBool());
if (m_qSettings.contains("VideoFillMode")) {
@ -68,7 +67,7 @@ Settings::Settings(const std::shared_ptr<GlobalVariables>& globalVariables,
} else {
setVideoFillMode(FillMode::FillMode::Cover);
}
if (m_qSettings.contains("Theme")) {
auto value = m_qSettings.value("Theme").toString();
setTheme(QStringToEnum<Theme>(value, Theme::Dark));

View File

@ -45,6 +45,8 @@ set( src
set( headers
src/basewindow.h)
# For development purposes to display source files in QtCreator
#qt5_add_resources(resources SPWResources.qrc)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(resources SPWResources.qrc)

View File

@ -56,7 +56,7 @@ Rectangle {
// We need to check if the old type
// was also Video not get called twice
if (oldType === Wallpaper.WallpaperType.Video)
return
return
imgCover.state = "in"
loader.source = "qrc:/WebView.qml"
@ -186,8 +186,10 @@ Rectangle {
Component.onCompleted: {
if (Qt.platform.os !== "windows")
if (Qt.platform.os !== "windows") {
root.canFadeByWallpaperFillMode = false
return
}
switch (Wallpaper.windowsDesktopProperties.wallpaperStyle) {
case 10:
@ -211,7 +213,7 @@ Rectangle {
}
break
case 22:
canFadeByWallpaperFillMode = false
root.canFadeByWallpaperFillMode = false
break
}
}

View File

@ -27,7 +27,7 @@ int main(int argc, char* argv[])
// Displays wrong DPI scaled monitor resolution
// 4k with 150% scaling to FULL HD on Windows
// https://bugreports.qt.io/browse/QTBUG-81694
//QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QApplication app(argc, argv);
@ -44,11 +44,11 @@ int main(int argc, char* argv[])
#if defined(Q_OS_WIN)
//WinWindow window1({ 0 }, "test", "appid", "1", "fill");
WinWindow window1({ 0 }, "test", "appid", "1", "fill", true);
//WinWindow window2({ 1 }, "test", "appid", "1", "fill");
//WinWindow window3({ 2 }, "test", "appid", "1", "fill");
WinWindow window({ 0 }, "C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/1958068745", "appid", "1", "fill", true);
// WinWindow window({ 0 }, "C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/qmlParticles", "appid", "1", "fill", true);
#endif
#if defined(Q_OS_LINUX)
LinuxWindow window({ 0 }, "/home/graphicscore/Desktop/wallpapers/MechaGirl", "appid", "1", "fill", false);
@ -102,7 +102,6 @@ int main(int argc, char* argv[])
// Args: which monitor, (2) path to project, (3)wallpaper secret to identify the connected socket, (4) volume, (5) fillmode, (6) type, (7)
// See screenplay.h @ScreenPlayWallpaper constructor how the args get created
qDebug() << argumentList;
bool okParseCheckWallpaperVisible = false;
bool checkWallpaperVisible = argumentList.at(7).toInt(&okParseCheckWallpaperVisible);

View File

@ -72,6 +72,21 @@ LRESULT __stdcall MouseHookCallback(int nCode, WPARAM wParam, LPARAM lParam)
return CallNextHookEx(g_mouseHook, nCode, wParam, lParam);
}
void WinWindow::setupWindowMouseHook()
{
// MUST be called before setting hook for events!
if (type() != BaseWindow::WallpaperType::Video) {
qInfo() << "Enable mousehook";
g_winGlobalHook = &m_window;
HINSTANCE hInstance = GetModuleHandle(NULL);
if (!(g_mouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookCallback, hInstance, 0))) {
qDebug() << "Faild to install mouse hook!";
}
qInfo() << "Setup mousehook";
}
}
WinWindow::WinWindow(
const QVector<int>& activeScreensList,
const QString& projectPath,
@ -242,18 +257,6 @@ void WinWindow::setupWallpaperForMultipleScreens(const QVector<int>& activeScree
}
}
void WinWindow::setupWindowMouseHook()
{
// MUST be called before setting hook for events!
if (type() != BaseWindow::WallpaperType::Video) {
qInfo() << "Enable mousehook";
g_winGlobalHook = &m_window;
if (!(g_mouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookCallback, nullptr, 0))) {
qDebug() << "Faild to install mouse hook!";
}
}
}
bool WinWindow::searchWorkerWindowToParentTo()
{