1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-18 16:32:33 +02:00

Add new Navigation, new reload feature, installed list realoading

This commit is contained in:
kelteseth 2017-10-28 17:22:26 +02:00
parent 2ddefb2171
commit 7fc01f369f
24 changed files with 301 additions and 174 deletions

View File

@ -46,5 +46,13 @@
<file>assets/icons/icon_multiple_images.svg</file>
<file>assets/icons/icon_single_image.svg</file>
<file>assets/icons/icon_tv.svg</file>
<file>assets/icons/icon_stomt.svg</file>
<file>qml/Components/Feedback.qml</file>
<file>qml/Components/CreateVideoPreviewSmall.qml</file>
<file>qml/Components/CreateLeftArea.qml</file>
<file>qml/Components/Settings/SettingsWrapper.qml</file>
<file>qml/Components/StartupErrorWindow.qml</file>
<file>assets/icons/icon_heavy_metal.svg</file>
<file>qml/Components/InstalledUserHelper.qml</file>
</qresource>
</RCC>

View File

@ -18,7 +18,8 @@ SOURCES += main.cpp \
src/steamworkshoplistmodel.cpp \
src/workshopitem.cpp
RESOURCES += qml.qrc
RESOURCES += \
Resources.qrc \
HEADERS += \
src/steamworkshop.h \

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 469.333 469.333" style="enable-background:new 0 0 469.333 469.333;" xml:space="preserve">
<g transform="matrix(1.25 0 0 -1.25 0 45)">
<g>
<g>
<path style="fill:#D2A077;" d="M276.371-147.467l-91.022-0.239c-12.561,0-21.333-8.533-21.333-21.094s8.772-21.094,21.333-21.094
l59.915-0.239c0,0,10.012,1.183,10.012-7.111c0-3.14-4.21-7.111-7.35-7.111c0,0-51.2,2.367-55.467-78.222
c-0.171-3.14-3.971-7.111-7.111-7.111c-3.14,0-7.111,3.971-7.111,7.111c0,34.247,15.883,67.561,32.62,77.642
c-10.354,0-19.467,0.58-25.509,0.58c-11.378,0-16.361,3.8-16.361,3.789c-1.661-2.628-6.394-14.45-30.572-14.45
c-27.022,0-34.372,26.874-34.372,34.361v57.128l1.661,0.239c0,9.227,5.518,17.146,13.426,20.708l-1.104-75.696
c0-12.572,9.25-23.711,21.811-23.711c8.59,0,14.37,3.88,18.25,10.911c-5.211,5.985-7.703,12.88-7.703,21.447
c0,10.081,3.618,20.423,10.547,26.67l0.478,30.811l1.183,0.239c0,9.227,5.518,17.146,13.426,20.708l-0.626-32.085l-0.239-11.617
c3.584,1.263,6.417,1.661,10.433,1.661l32.711-0.239v33.189l1.183-0.239v102.4c0,9.227,5.518,17.146,13.426,20.708l-0.387-155.42
h41.483l2.367-1.82c10.49,0,19.604-22.756,19.604-22.756s0.023-0.148,0.023-0.171
C293.221-152.826,287.385-147.467,276.371-147.467"/>
<g>
<path style="fill:#F3D2A2;" d="M162.593-143.519c-6.929-6.246-11.378-15.201-11.378-25.281c0-8.567,3.265-16.293,8.476-22.289
c-3.88-7.02-11.264-11.844-19.854-11.844c-12.561,0-22.756,10.194-22.756,22.756v68.267c0,3.334,0.762,6.485,2.048,9.33
c3.561,7.908,11.48,13.426,20.708,13.426c12.561,0,22.756-10.183,22.756-22.756v-11.378V-143.519z"/>
<path style="fill:#F3D2A2;" d="M60.193-20.889c0,12.561,10.194,22.756,22.756,22.756s22.756-10.194,22.756-22.756v-102.4
v-22.756v-34.133c0-7.487,2.469-14.359,6.576-19.945c0.319-0.421,0.694-0.774,1.013-1.161c1.183-1.468,2.389-2.901,3.777-4.164
c0.375-0.307,0.751-0.614,1.138-0.933c1.354-1.115,2.765-2.139,4.289-3.049c0.751-0.444,1.49-0.853,2.287-1.24
c1.582-0.785,3.243-1.422,4.949-1.957c0.774-0.228,1.49-0.512,2.276-0.694c2.526-0.603,5.131-0.99,7.828-0.99
c2.685,0,5.245,0.41,7.748,1.013c0.865,0.193,1.684,0.478,2.526,0.751c1.559,0.501,3.061,1.126,4.506,1.832
c0.933,0.455,1.855,0.876,2.731,1.411c1.866,1.138,3.618,2.423,5.234,3.88c2.298,2.094,4.369,4.403,6.03,7.031
c-0.011,0.011-0.023,0.023-0.034,0.034c2.287-1.308,5.393-4.574,16.771-4.574h28.865
c-20.571-15.531-34.554-45.397-34.554-79.644c0-3.14,2.549-5.689,5.689-5.689c3.14,0,5.689,2.549,5.689,5.689
c0,43.907,24.883,79.644,55.467,79.644h1.422c3.14,0,5.689,2.549,5.689,5.689c0,3.14-2.549,5.689-5.689,5.689H230.86h-45.511
c-12.561,0-22.756,10.194-22.756,22.756s10.194,22.756,22.756,22.756h91.022c11.014,0,16.85-6.781,19.627-11.548
c1.434-2.458,2.105-4.426,2.139-4.551l12.368-40.789c1.172-3.812,5.45-21.288,4.676-24.929
c0-54.716-53.43-111.605-118.454-111.605c-74.377,0-136.533,59.733-136.533,136.533C60.284-203.013,60.193-20.889,60.193-20.889
"/>
<path style="fill:#F3D2A2;" d="M219.482-134.667h-34.133c-4.005,0-7.794-0.819-11.378-2.094v13.471v22.756
c0,3.334,0.762,6.474,2.048,9.33c3.561,7.908,11.48,13.426,20.708,13.426c12.561,0,22.756-10.194,22.756-22.756v-22.756
V-134.667z"/>
<path style="fill:#F3D2A2;" d="M230.86-134.667V13.244c0,3.334,0.762,6.474,2.048,9.33C236.469,30.482,244.388,36,253.615,36
c12.561,0,22.756-10.194,22.756-22.756v-136.533v-11.378h-11.378H230.86z"/>
</g>
</g>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 51 41" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"><path d="M40.735,0l-20.367,0c-5.625,0 -10.184,4.825 -10.184,10.45c0,5.624 4.559,10.45 10.184,10.45l-10.184,0c-5.625,0 -10.184,4.329 -10.184,9.953c0,5.624 4.559,9.953 10.184,9.953l20.367,0c5.625,0 10.184,-4.329 10.184,-9.953c0,-5.624 -4.559,-9.953 -10.184,-9.953l10.184,0c5.625,0 10.184,-4.826 10.184,-10.45c0,-5.625 -4.559,-10.45 -10.184,-10.45" style="fill:#bebebe;"/></svg>

After

Width:  |  Height:  |  Size: 821 B

View File

@ -24,7 +24,6 @@ Item {
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
anchors.bottom: line.top
anchors.bottomMargin: 5
anchors.left: parent.left
anchors.leftMargin: 10
@ -39,12 +38,5 @@ Item {
}
}
Rectangle {
id: line
height: 1
width: parent.width
color: "#BBBBBB"
anchors.bottom: parent.bottom
}
}
}

View File

@ -4,11 +4,39 @@ import QtQuick.Controls 2.2
import QtQuick.Controls.Styles 1.4
CustomPage {
id:pageInstalled
id: pageInstalled
pageName: ""
signal setSidebaractiveItem(var screenId)
Component.onCompleted: {
if(installedListModel.getAmountItemLoaded() === 0){
loaderHelp.active = true
}
}
Loader {
id:loaderHelp
asynchronous: true
active:false
anchors.fill: parent
source: "qrc:/qml/Components/InstalledUserHelper.qml"
}
Button {
z:111
anchors {
top: parent.top
right: parent.right
}
text: qsTr("Reload")
onClicked: {
print("as")
installedListModel.reloadFiles()
}
}
GridView {
id: gridView
@ -17,20 +45,23 @@ CustomPage {
flickDeceleration: 5000
anchors.fill: parent
cellWidth: 330
cacheBuffer: 10000
cellHeight: 200
anchors {
topMargin: 0
rightMargin:0
rightMargin: 0
leftMargin: 30
}
header: Item {
height:10
height: 30
width: parent.width
}
model:installedListModel
model: installedListModel
delegate: ScreenPlayItem {
id:delegate
id: delegate
focus: true
customTitle: screenTitle
@ -46,12 +77,7 @@ CustomPage {
}
ScrollBar.vertical: ScrollBar {
stepSize: 100
snapMode: ScrollBar.SnapOnRelease
}
}
}

View File

@ -0,0 +1,20 @@
import QtQuick 2.0
Item {
anchors {
fill: parent
}
Text {
id: name
text: qsTr("taaaaaaaaaaaaaaaaaaaaaaaaaaaext")
anchors.verticalCenterOffset: 0
anchors.horizontalCenterOffset: 231
font.pixelSize: 30
anchors.centerIn: parent
}
Image {
id: imgRock
source: "qrc:/assets/icons/icon_heavy_metal.svg"
}
}

View File

@ -76,6 +76,7 @@ Rectangle {
x: monitorAvailableGeometry.x
y: monitorAvailableGeometry.y
monitorSize: monitorAvailableGeometry
index: delegate.index
Connections{
target: delegate

View File

@ -22,10 +22,10 @@ Rectangle {
anchors.fill: parent
Text {
renderType: Text.NativeRendering
text: index + " - " + monitorSize.width + ", " + monitorSize.height
text: index + " " + monitorSize.width + ", " + monitorSize.height
anchors.centerIn: parent
color:"white"
font.pixelSize: 16
font.pixelSize: 14
}
}

View File

@ -1,4 +1,5 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtGraphicalEffects 1.0
Item {
@ -40,21 +41,25 @@ Item {
}
MonitorSelection {
id:monitorSelection
anchors.centerIn: parent
anchors.fill: parent
availableWidth: monitorWrapper.width
availableHeight: monitorWrapper.height
}
Button {
id:btn
text:"Remove all wallpaper"
onClicked: screenPlaySettings.removeAll();//screenPlaySettings.removeWallpaperAt(monitorSelection.activeMonitorIndex)
anchors{
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: 30
}
}
}
// DropShadow {
// anchors.fill: monitorWrapper
// radius: 12.0
// cached: true
// samples: 17
// color: "#80000000"
// source: monitorWrapper
// }
states: [
State {

View File

@ -1,49 +1,72 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Controls 2.2
import QtGraphicalEffects 1.0
Rectangle {
id:navigation
height:60
id: navigation
height: 60
clip: true
width: 1366
//color: "#EFffffff"
color: "transparent"
LinearGradient {
anchors.fill: parent
start: Qt.point(0, 40)
end: Qt.point(0, 60)
gradient: Gradient {
GradientStop {
position: 0.0
color: "#ffffff"
}
GradientStop {
position: 1.0
color: "#DFffffff"
}
}
}
property int testyyy: 10
signal changePage(string name)
signal toggleMonitors()
signal toggleMonitors
function onPageChanged(name){
navigation.changePage(name);
if(name ==="Workshop")
{
function onPageChanged(name) {
navigation.changePage(name)
if (name === "Workshop") {
navWorkshop.state = "active"
navInstalled.state = "inactive"
navSettings.state = "inactive"
navFeedback.state = "inactive"
navCreate.state = "inactive"
} else if(name ==="Installed")
{
} else if (name === "Installed") {
navWorkshop.state = "inactive"
navInstalled.state = "active"
navSettings.state = "inactive"
navFeedback.state = "inactive"
navCreate.state = "inactive"
} else if(name ==="Settings")
{
} else if (name === "Settings") {
navWorkshop.state = "inactive"
navInstalled.state = "inactive"
navSettings.state = "active"
navFeedback.state = "inactive"
navCreate.state = "inactive"
} else if(name ==="Create")
{
} else if (name === "Create") {
navWorkshop.state = "inactive"
navInstalled.state = "inactive"
navSettings.state = "inactive"
navCreate.state = "active"
navFeedback.state = "inactive"
} else if (name === "Feedback") {
navWorkshop.state = "inactive"
navInstalled.state = "inactive"
navSettings.state = "inactive"
navFeedback.state = "active"
navCreate.state = "inactive"
}
}
Row {
id: testy
anchors.fill: parent
anchors.left: parent.left
anchors.leftMargin: 20
@ -71,7 +94,6 @@ Rectangle {
name: "Installed"
iconSource: "qrc:/assets/icons/icon_installed.svg"
onPageClicked: navigation.onPageChanged(name)
}
NavigationItem {
@ -80,7 +102,13 @@ Rectangle {
name: "Settings"
iconSource: "qrc:/assets/icons/icon_settings.svg"
onPageClicked: navigation.onPageChanged(name)
}
NavigationItem {
id: navFeedback
state: "inactive"
name: "Feedback"
iconSource: "qrc:/assets/icons/icon_stomt.svg"
onPageClicked: navigation.onPageChanged(name)
}
}
@ -100,10 +128,8 @@ Rectangle {
onClicked: {
toggleMonitors()
}
}
Image {
id: image
width: 24
@ -128,13 +154,10 @@ Rectangle {
font.family: font_Roboto_Regular.name
renderType: Text.NativeRendering
FontLoader{
FontLoader {
id: font_Roboto_Regular
source: "qrc:/assets/fonts/Roboto-Regular.ttf"
}
}
}
}

View File

@ -50,7 +50,7 @@ Item {
navigationItem.pageClicked(navigationItem.name)
}
Rectangle {
Item {
id: item2
width: 100

View File

@ -11,7 +11,7 @@ CustomPage {
VisualItemModel {
id: settingsModel
/*
SettingsWrapper {
height: 180
Column {
@ -19,8 +19,8 @@ CustomPage {
anchors.margins: 30
anchors.fill: parent
Headline {
name: "General"
Text {
text: "General"
height: 50
width: parent.width
}
@ -29,10 +29,11 @@ CustomPage {
height: 50
width: parent.width
isChecked: screenPlaySettings.autostart
onCheckboxChanged: screenPlaySettings.setAutostart(isChecked)
onCheckboxChanged: screenPlaySettings.setAutostart(
isChecked)
}
}
}
}*/
SettingsWrapper {
height: 180
Column {
@ -42,7 +43,7 @@ CustomPage {
Headline {
name: "Save"
height: 50
height: 20
width: parent.width
}
Row {
@ -51,14 +52,13 @@ CustomPage {
spacing: 30
Text {
id: txtSavePathDescription
text: qsTr("text")
text: qsTr("Save Path: ")
anchors.verticalCenter: parent.verticalCenter
}
Text {
id: txtSavePath
anchors.verticalCenter: parent.verticalCenter
text: screenPlaySettings.localStoragePath
}
Button {
id: btnSavePath
@ -72,64 +72,17 @@ CustomPage {
folder: shortcuts.home
selectFolder: true
onAccepted: {
txtSavePath.text = fileDialogOpenSavePath.folder
screenPlaySettings.setLocalStoragePath(fileDialogOpenSavePath.folder)
screenPlaySettings.setLocalStoragePath(
fileDialogOpenSavePath.folder)
}
}
}/**/
}
}
}
SettingsWrapper {
height: 180
Column {
spacing: 10
anchors.margins: 30
anchors.fill: parent
Headline {
name: "About"
height: 50
width: parent.width
}
}
}
SettingsWrapper {
height: 180
Column {
spacing: 10
anchors.margins: 30
anchors.fill: parent
Headline {
name: "About"
height: 50
width: parent.width
}
}
}
SettingsWrapper {
height: 180
Column {
spacing: 10
anchors.margins: 30
anchors.fill: parent
Headline {
name: "About"
height: 50
width: parent.width
}
}
}
}
ListView {
id: settingsListView
anchors {
@ -138,7 +91,7 @@ CustomPage {
leftMargin: 30
}
header: Item {
height:10
height: 10
width: parent.width
}
spacing: 30
@ -150,5 +103,13 @@ CustomPage {
boundsBehavior: Flickable.DragOverBounds
ScrollBar.vertical: ScrollBar {
}
displaced: Transition {
NumberAnimation {
property: "opacity"
from: 0
to: 1.0
duration: 400
}
}
}
}

View File

@ -1,5 +1,25 @@
import QtQuick 2.0
import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
Item {
ApplicationWindow {
id: window
visible: true
height: 200
width: 500
Component.onCompleted: {
setX(Screen.width / 2 - width / 2)
setY(Screen.height / 2 - height / 2)
}
Text {
id: name
text: qsTr("Could not connect to steam Error")
color: "orange"
font.pixelSize: 23
anchors.centerIn: parent
}
}

View File

@ -45,6 +45,7 @@ ApplicationWindow {
id: tabShadow
height: 5
z:99
visible: false
anchors{
top:nav.bottom

View File

@ -49,7 +49,7 @@ bool InstalledListModel::getProjectByAbsoluteStoragePath(QUrl* path, ProjectFile
{
for (int i = 0; i < m_screenPlayFiles.count(); ++i) {
if (m_screenPlayFiles.at(i).m_absoluteStoragePath == *path) {
if (m_screenPlayFiles.at(i).m_absoluteStoragePath == *path) {
*spf = m_screenPlayFiles.at(i);
return true;
}
@ -62,7 +62,7 @@ void InstalledListModel::append(const QJsonObject obj, const QString folderName)
{
int row = 0;
beginInsertRows(QModelIndex(), row, row);
beginInsertRows(QModelIndex(), m_screenPlayFiles.count(), m_screenPlayFiles.count());
ProjectFile tmpFile(obj, folderName, m_absoluteStoragePath);
m_screenPlayFiles.append(tmpFile);
@ -115,3 +115,18 @@ QVariantMap InstalledListModel::get(QString folderId)
return map;
}
int InstalledListModel::getAmountItemLoaded()
{
return m_screenPlayFiles.count();
}
void InstalledListModel::reloadFiles()
{
beginResetModel();
m_screenPlayFiles.clear();
m_screenPlayFiles.squeeze();
endResetModel();
loadScreens();
}

View File

@ -59,11 +59,12 @@ public slots:
m_absoluteStoragePath = absoluteStoragePath;
emit absoluteStoragePathChanged(m_absoluteStoragePath);
}
int getAmountItemLoaded();
void reloadFiles();
signals:
void setScreenVisible(bool visible);
void setScreenToVideo(QString absolutePath);
void absoluteStoragePathChanged(QUrl absoluteStoragePath);
private:

View File

@ -14,6 +14,7 @@ QHash<int, QByteArray> MonitorListModel::roleNames() const
{ AvailableGeometryRole, "monitorAvailableGeometry" },
{ AvailableVirtualGeometryRole, "monitorAvailableVirtualGeometry" },
{ NumberRole, "monitorNumber" },
{ GeometryRole, "monitorGeometry" },
};
return roles;
}
@ -65,6 +66,8 @@ QVariant MonitorListModel::data(const QModelIndex& index, int role) const
return m_monitorList.at(index.row()).m_availableVirtualGeometry;
case NumberRole:
return m_monitorList.at(index.row()).m_number;
case GeometryRole:
return m_monitorList.at(index.row()).m_geometry;
default:
return QVariant();
}
@ -116,7 +119,8 @@ void MonitorListModel::loadMonitors()
screen->availableGeometry(),
// More convenient for the user if the first monitor == 1
i + 1,
screen->availableVirtualGeometry()));
screen->availableVirtualGeometry(),
screen->geometry()));
}
}
@ -125,13 +129,12 @@ int MonitorListModel::size()
return m_monitorList.size();
}
bool MonitorListModel::getMonitorListItemAt(int position, Monitor* monitor)
{
if (position < 0 && position > m_monitorList.size()) {
return false;
} else {
*monitor = m_monitorList.at(position);
*monitor = m_monitorList.at(position);
return true;
}
}
@ -151,11 +154,12 @@ Monitor::Monitor()
{
}
Monitor::Monitor(QString manufacturer, QString model, QString name, QSize size, QRect availableGeometry, int number, QRect availableVirtualGeometry)
Monitor::Monitor(QString manufacturer, QString model, QString name, QSize size, QRect availableGeometry, int number, QRect availableVirtualGeometry, QRect geometry)
{
m_name = name;
m_size = size;
m_geometry = geometry;
m_availableGeometry = availableGeometry;
m_availableVirtualGeometry = availableVirtualGeometry;

View File

@ -30,6 +30,7 @@ public:
AvailableGeometryRole,
AvailableVirtualGeometryRole,
NumberRole,
GeometryRole,
};
Q_ENUM(MonitorRole)
@ -70,13 +71,14 @@ class Monitor {
public:
Monitor();
Monitor(QString manufacturer, QString model, QString name, QSize size, QRect availableGeometry, int number, QRect availableVirtualGeometry);
Monitor(QString manufacturer, QString model, QString name, QSize size, QRect availableGeometry, int number, QRect availableVirtualGeometry,QRect geometry);
QString m_id;
QString m_name;
QSize m_size;
QRect m_availableGeometry;
QRect m_availableVirtualGeometry;
QRect m_geometry;
int m_number;
bool m_isVirtualDesktop;

View File

@ -18,7 +18,7 @@ ProjectFile::ProjectFile(QJsonObject obj, QString folderName, QUrl absolutePath)
if (obj.contains("title"))
m_title = obj.value("title");
m_absolutePath = absolutePath;
m_absoluteStoragePath = QUrl(absolutePath.toString() +"/"+ folderName);
m_folderId = folderName;
}

View File

@ -5,6 +5,7 @@
#include <QUrl>
#include <QVariant>
#include <QVariantList>
#include <QDebug>
class ProjectFile
{
@ -17,7 +18,7 @@ public:
QVariant m_preview;
QVariant m_title;
QString m_folderId;
QUrl m_absolutePath;
QUrl m_absoluteStoragePath;
QVariantList m_tags; //TODO: Implement me!
};

View File

@ -56,7 +56,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
//If empty use steam workshop location
if (QString(configObj.value("absoluteStoragePath").toString()).isEmpty()) {
uint32 size = 5000;
const uint32 size = 5000;
char folder[size];
SteamApps()->GetAppInstallDir(m_steamID, folder, 5000);
QDir steamTmpUrl = QDir(QString(QByteArray(folder).data()));
@ -74,8 +74,6 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
m_ilm->setabsoluteStoragePath(m_localStoragePath);
m_plm->m_localStoragePath = m_localStoragePath;
m_autostart = configObj.value("autostart").toBool();
m_highPriorityStart = configObj.value("highPriorityStart").toBool();
m_sendStatistics = configObj.value("sendStatistics").toBool();
@ -95,57 +93,26 @@ void Settings::constructWallpaper(QString folder, int monitorListAt)
{
}
void Settings::setWallpaper(int monitorIndex, QUrl absoluteStoragePath)
void Settings::setWallpaper(int monitorIndex, QUrl absoluteStoragePath)
{
ProjectFile project;
Monitor monitor;
if (!m_mlm->getMonitorListItemAt(monitorIndex, &monitor)) {
return;
}
if(!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath,&project)){
if (!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) {
return;
}
// Search for active Wallpapers on the same monitor and delte it
for (int i = 0; i < m_wallpapers.length(); ++i) {
if (m_wallpapers.at(i).data()->monitor().m_id == monitor.m_id) {
removeWallpaperAt(i);
}
}
m_wallpapers.append(QSharedPointer<Wallpaper>(new Wallpaper(project, monitor)));
/*
* Profile profile;
//Does the targeted monitor has a profile ?
// 1. Get the requested monitor
if(m_mlm->getMonitorListItemAt(monitorIndex,&monitor)){
// 2. When found search for
for (int i = 0; i < m_mlm->size(); ++i) {
if(m_mlm->getMonitorListItemAt(i,&tmpMonitor)){
for(int i = 0; i < m_activeProfiles.size(); ++i){
if(tmpMonitor._id == m_activeProfiles.at(i).data()->monitorId()) {
}
}
}
}
if (m_wallpapers.length() < monitorIndex && m_wallpapers.length() > 0) {
m_wallpapers.replace(monitorIndex, QSharedPointer<Wallpaper>(new Wallpaper(project, monitor)));
} else {
m_wallpapers.append(QSharedPointer<Wallpaper>(new Wallpaper(project, monitor)));
}
if (m_ilm->getProjectByName(wallpaperID, &project)) {
if(m_mlm->getMonitorListItemAt(monitorIndex,&monitor)){
m_wallpapers.append(QSharedPointer<Wallpaper>(new Wallpaper(profile, monitor)));
}
}*/
}
void Settings::loadActiveProfiles()
@ -173,7 +140,7 @@ void Settings::loadActiveProfiles()
if (!m_plm->getProfileByName(profileName, &profile))
continue;
if(!m_ilm->getProjectByAbsoluteStoragePath(&profile.m_absolutePath, &spf))
if (!m_ilm->getProjectByAbsoluteStoragePath(&profile.m_absolutePath, &spf))
continue;
constructWallpaper(profile, monitorID, spf);
@ -192,8 +159,9 @@ void Settings::createNewWallpaper(int monitorListPosition, Profile profile, Proj
void Settings::removeWallpaperAt(int pos)
{
//Todo is this a memory leak?
m_wallpapers.removeAt(pos);
if (pos > 0 && pos > m_wallpapers.size())
m_wallpapers.removeAt(pos);
}
void Settings::createDefaultConfig()

View File

@ -43,7 +43,7 @@ public:
Q_PROPERTY(QUrl localStoragePath READ localStoragePath WRITE setLocalStoragePath NOTIFY localStoragePathChanged)
void loadActiveProfiles();
void removeAll();
Q_INVOKABLE void removeAll();
enum LocalCopyResult {
NoError,
@ -156,6 +156,8 @@ public slots:
Q_INVOKABLE void setWallpaper(int monitorIndex, QUrl absoluteStoragePath);
void setLocalStoragePath(QUrl localStoragePath)
{
if (m_localStoragePath == localStoragePath)
@ -184,6 +186,7 @@ public slots:
out << QJsonDocument(configObj).toJson();
configTmp.close();
m_ilm->setabsoluteStoragePath(m_localStoragePath);
emit localStoragePathChanged(m_localStoragePath);
}

View File

@ -25,7 +25,6 @@ Wallpaper::Wallpaper( ProjectFile project, Monitor monitor)
m_monitor = monitor;
m_project = project;
QString tmp = m_project.m_absoluteStoragePath.toString() + "/" + m_project.m_file.toString();
tmp.replace("/","\\\\");
setAbsoluteFilePath(tmp);
@ -33,12 +32,13 @@ Wallpaper::Wallpaper( ProjectFile project, Monitor monitor)
// this->setY(m_profile.m_rect.y());
// this->setWidth(m_profile.m_rect.width());
// this->setHeight(m_profile.m_rect.height());
this->setX(m_monitor.m_availableGeometry.x());
this->setY(m_monitor.m_availableGeometry.y());
this->setX(m_monitor.m_geometry.x());
this->setY(m_monitor.m_geometry.y());
this->setWidth(m_monitor.m_availableGeometry.width());
this->setHeight(m_monitor.m_availableGeometry.height());
this->m_hwnd = (HWND)this->winId();
qDebug() << "++++"<< this->x() << this->y() << this->width() << this->height();
HWND progman_hwnd = FindWindowW(L"Progman", L"Program Manager");
// Spawn new worker window below desktop (using some undocumented Win32 magic)