1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 11:32:42 +01:00
This commit is contained in:
Elias 2019-06-09 12:26:11 +02:00
parent 55b3d0f3f3
commit 5146a34a70
7 changed files with 52 additions and 71 deletions

View File

@ -28,7 +28,7 @@ int main(int argc, char* argv[])
{ {
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication::setOrganizationName("Aimber"); QGuiApplication::setOrganizationName("Kelteseth");
QGuiApplication::setOrganizationDomain("screen-play.app"); QGuiApplication::setOrganizationDomain("screen-play.app");
QGuiApplication::setApplicationName("ScreenPlay"); QGuiApplication::setApplicationName("ScreenPlay");
QGuiApplication::setApplicationVersion("0.2.0"); QGuiApplication::setApplicationVersion("0.2.0");
@ -78,6 +78,9 @@ int main(int argc, char* argv[])
// Instead of setting "renderType: Text.NativeRendering" every time // Instead of setting "renderType: Text.NativeRendering" every time
// we can set it here once :) // we can set it here once :)
auto* window = static_cast<QQuickWindow*>(mainWindowEngine.rootObjects().first()); auto* window = static_cast<QQuickWindow*>(mainWindowEngine.rootObjects().first());
if(!window)
qFatal("Could not receive window to set font rendering.");
window->setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering); window->setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
// Set visible if the -silent parameter was not set // Set visible if the -silent parameter was not set

View File

@ -6,10 +6,10 @@ ScreenPlay::ScreenPlay(const shared_ptr<InstalledListModel> &ilm,
const shared_ptr<SDKConnector>& sdkc, const shared_ptr<SDKConnector>& sdkc,
QObject* parent) QObject* parent)
: QObject { parent } : QObject { parent }
, m_ilm { ilm } , m_installedListModel { ilm }
, m_settings { settings } , m_settings { settings }
, m_mlm { mlm } , m_monitorListModel { mlm }
, m_sdkc { sdkc } , m_sdkconnector { sdkc }
, m_qGuiApplication { static_cast<QGuiApplication*>(QGuiApplication::instance()) } , m_qGuiApplication { static_cast<QGuiApplication*>(QGuiApplication::instance()) }
{ {
} }
@ -20,12 +20,12 @@ void ScreenPlay::createWallpaper(
const QString& fillMode, const QString& type) const QString& fillMode, const QString& type)
{ {
ProjectFile project {}; ProjectFile project {};
if (!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) { if (!m_installedListModel->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) {
return; return;
} }
// Remove previous wallpaper, if any // Remove previous wallpaper, if any
this->removeWallpaperAt(0); //this->removeWallpaperAt(0);
m_settings->increaseActiveWallpaperCounter(); m_settings->increaseActiveWallpaperCounter();
m_screenPlayWallpapers.emplace_back( m_screenPlayWallpapers.emplace_back(
@ -40,7 +40,7 @@ void ScreenPlay::createWallpaper(
type, type,
this)); this));
m_mlm->setWallpaperActiveMonitor(m_qGuiApplication->screens().at(monitorIndex), m_monitorListModel->setWallpaperActiveMonitor(m_qGuiApplication->screens().at(monitorIndex),
QString { absoluteStoragePath.toLocalFile() + "/" + previewImage }); QString { absoluteStoragePath.toLocalFile() + "/" + previewImage });
} }
@ -48,7 +48,7 @@ void ScreenPlay::createWidget(QUrl absoluteStoragePath, const QString& previewIm
{ {
ProjectFile project {}; ProjectFile project {};
if (!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) { if (!m_installedListModel->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) {
return; return;
} }
@ -64,8 +64,8 @@ void ScreenPlay::createWidget(QUrl absoluteStoragePath, const QString& previewIm
void ScreenPlay::removeAllWallpaper() noexcept void ScreenPlay::removeAllWallpaper() noexcept
{ {
if (m_sdkc && m_settings && !m_screenPlayWallpapers.empty()) { if (m_sdkconnector && m_settings && !m_screenPlayWallpapers.empty()) {
m_sdkc->closeAllWallpapers(); m_sdkconnector->closeAllWallpapers();
m_settings->setActiveWallpaperCounter(0); m_settings->setActiveWallpaperCounter(0);
m_screenPlayWallpapers.clear(); m_screenPlayWallpapers.clear();
emit allWallpaperRemoved(); emit allWallpaperRemoved();
@ -88,10 +88,10 @@ void ScreenPlay::requestProjectSettingsListModelAt(const int index) noexcept
void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QString& value) noexcept void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QString& value) noexcept
{ {
Q_ASSERT(static_cast<size_t>(at) < m_screenPlayWallpapers.size() && m_sdkc); Q_ASSERT(static_cast<size_t>(at) < m_screenPlayWallpapers.size() && m_sdkconnector);
for (const unique_ptr<ScreenPlayWallpaper>& uPtrWallpaper : m_screenPlayWallpapers) { for (const unique_ptr<ScreenPlayWallpaper>& uPtrWallpaper : m_screenPlayWallpapers) {
if (!uPtrWallpaper->screenNumber().empty() && m_sdkc && uPtrWallpaper->screenNumber()[0] == at) { // ??? only at index == 0 if (!uPtrWallpaper->screenNumber().empty() && m_sdkconnector && uPtrWallpaper->screenNumber()[0] == at) { // ??? only at index == 0
m_sdkc->setWallpaperValue(uPtrWallpaper->appID(), key, value); m_sdkconnector->setWallpaperValue(uPtrWallpaper->appID(), key, value);
return; return;
} }
} }
@ -99,47 +99,34 @@ void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QStri
void ScreenPlay::setAllWallpaperValue(const QString& key, const QString& value) noexcept void ScreenPlay::setAllWallpaperValue(const QString& key, const QString& value) noexcept
{ {
Q_ASSERT(m_sdkc); Q_ASSERT(m_sdkconnector);
for (const unique_ptr<ScreenPlayWallpaper>& uPtrWallpaper : m_screenPlayWallpapers) { for (const unique_ptr<ScreenPlayWallpaper>& uPtrWallpaper : m_screenPlayWallpapers) {
if (m_sdkc) if (m_sdkconnector)
m_sdkc->setWallpaperValue(uPtrWallpaper->appID(), key, value); m_sdkconnector->setWallpaperValue(uPtrWallpaper->appID(), key, value);
} }
} }
void ScreenPlay::removeWallpaperAt(const int at) void ScreenPlay::removeWallpaperAt(const int at)
{ {
Q_ASSERT(m_sdkc);
qDebug() << "No of walls in list: " << m_screenPlayWallpapers.size();
if (m_screenPlayWallpapers.empty()) if (m_screenPlayWallpapers.empty())
return; // done here; return;
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) noexcept->bool { [&](const unique_ptr<ScreenPlayWallpaper>& uPtrWallpaper) -> bool {
const vector<int>& screenNumber = uPtrWallpaper->screenNumber(); const vector<int>& screenNumber = uPtrWallpaper->screenNumber();
qDebug() << "Screen No. or vector size :" << screenNumber.size();
const bool isFound = !screenNumber.empty() && screenNumber[0] == at; const bool isFound = !screenNumber.empty() && screenNumber[0] == at;
if (isFound) { if (isFound) {
// m_mlm m_sdkconnector->closeWallpapersAt(at);
m_sdkc->closeWallpapersAt(at);
m_settings->decreaseActiveWallpaperCounter(); m_settings->decreaseActiveWallpaperCounter();
qDebug() << "current wall count... " << m_settings->activeWallpaperCounter();
} }
return isFound; return isFound;
}); });
m_screenPlayWallpapers.erase(wallsToRemove, m_screenPlayWallpapers.end()); m_screenPlayWallpapers.erase(wallsToRemove, m_screenPlayWallpapers.end());
qDebug() << "After removing: No of walls in list: " << m_screenPlayWallpapers.size();
} }
vector<int> ScreenPlay::getMonitorByAppID(const QString& appID) const
{
for (const unique_ptr<ScreenPlayWallpaper>& uPtrWallpaper : m_screenPlayWallpapers) {
if (uPtrWallpaper->appID() == appID) {
return uPtrWallpaper->screenNumber();
}
}
return vector<int> {};
}
QString ScreenPlay::generateID() const QString ScreenPlay::generateID() const
{ {

View File

@ -59,14 +59,13 @@ public slots:
void setWallpaperValue(const int at, const QString& key, const QString& value) noexcept; void setWallpaperValue(const int at, const QString& key, const QString& value) noexcept;
void setAllWallpaperValue(const QString& key, const QString& value) noexcept; void setAllWallpaperValue(const QString& key, const QString& value) noexcept;
void removeWallpaperAt(const int at = 0); void removeWallpaperAt(const int at = 0);
vector<int> getMonitorByAppID(const QString& appID) const;
QString generateID() const; QString generateID() const;
private: private:
const shared_ptr<InstalledListModel> m_ilm; const shared_ptr<InstalledListModel> m_installedListModel;
const shared_ptr<Settings> m_settings; const shared_ptr<Settings> m_settings;
const shared_ptr<MonitorListModel> m_mlm; const shared_ptr<MonitorListModel> m_monitorListModel;
const shared_ptr<SDKConnector> m_sdkc; const shared_ptr<SDKConnector> m_sdkconnector;
QGuiApplication* const m_qGuiApplication; QGuiApplication* const m_qGuiApplication;
vector<unique_ptr<ScreenPlayWallpaper>> m_screenPlayWallpapers; vector<unique_ptr<ScreenPlayWallpaper>> m_screenPlayWallpapers;

View File

@ -17,10 +17,10 @@ Settings::Settings(const shared_ptr<InstalledListModel>& ilm,
QObject* parent) QObject* parent)
: QObject(parent) : QObject(parent)
, m_version(QVersionNumber(0, 0, 1)) , m_version(QVersionNumber(0, 0, 1))
, m_plm(plm) , m_profileListModel(plm)
, m_ilm(ilm) , m_installedListModel(ilm)
, m_mlm(mlm) , m_monitorListModel(mlm)
, m_sdkc(sdkc) , m_sdkconnector(sdkc)
{ {
auto* app = static_cast<QGuiApplication*>(QGuiApplication::instance()); auto* app = static_cast<QGuiApplication*>(QGuiApplication::instance());
@ -91,10 +91,10 @@ Settings::Settings(const shared_ptr<InstalledListModel>& ilm,
configObj = configJsonDocument.object(); configObj = configJsonDocument.object();
QString tmp(configObj.value("version").toVariant().toString()); QString tmp(configObj.value("version").toVariant().toString());
int major, minor, patch;
major = QString(tmp.at(0)).toInt(); int major = QString(tmp.at(0)).toInt();
minor = QString(tmp.at(2)).toInt(); int minor = QString(tmp.at(2)).toInt();
patch = QString(tmp.at(4)).toInt(); int patch = QString(tmp.at(4)).toInt();
QVersionNumber fileVersion(major, minor, patch); QVersionNumber fileVersion(major, minor, patch);
//Checks if the settings file has the same version as ScreeenPlay //Checks if the settings file has the same version as ScreeenPlay
@ -124,8 +124,8 @@ Settings::Settings(const shared_ptr<InstalledListModel>& ilm,
m_qSettings.sync(); m_qSettings.sync();
} }
m_ilm->setabsoluteStoragePath(m_localStoragePath); m_installedListModel->setabsoluteStoragePath(m_localStoragePath);
m_plm->m_localStoragePath = m_localStoragePath; m_profileListModel->m_localStoragePath = m_localStoragePath;
m_autostart = configObj.value("autostart").toBool(); m_autostart = configObj.value("autostart").toBool();
m_highPriorityStart = configObj.value("highPriorityStart").toBool(); m_highPriorityStart = configObj.value("highPriorityStart").toBool();

View File

@ -66,14 +66,6 @@ public:
QObject* parent = nullptr); QObject* parent = nullptr);
~Settings() {} ~Settings() {}
enum LocalCopyResult {
NoError,
CopyError,
NotEnoughDiskSpace,
NameCollision,
};
Q_ENUM(LocalCopyResult)
QVersionNumber version() const QVersionNumber version() const
{ {
return m_version; return m_version;
@ -213,11 +205,11 @@ public slots:
writeSingleSettingConfig("absoluteStoragePath", cleanedPath); writeSingleSettingConfig("absoluteStoragePath", cleanedPath);
m_ilm->setabsoluteStoragePath(cleanedPath.toString()); m_installedListModel->setabsoluteStoragePath(cleanedPath.toString());
m_localStoragePath = cleanedPath.toString(); m_localStoragePath = cleanedPath.toString();
emit localStoragePathChanged(cleanedPath.toString()); emit localStoragePathChanged(cleanedPath.toString());
m_ilm->reset(); m_installedListModel->reset();
m_ilm->loadInstalledContent(); m_installedListModel->loadInstalledContent();
} }
void setDecoder(QString decoder) void setDecoder(QString decoder)
@ -282,10 +274,10 @@ private:
QSettings m_qSettings; QSettings m_qSettings;
QTranslator m_translator; QTranslator m_translator;
const shared_ptr<ProfileListModel> m_plm; const shared_ptr<ProfileListModel> m_profileListModel;
const shared_ptr<InstalledListModel> m_ilm; const shared_ptr<InstalledListModel> m_installedListModel;
const shared_ptr<MonitorListModel> m_mlm; const shared_ptr<MonitorListModel> m_monitorListModel;
const shared_ptr<SDKConnector> m_sdkc; const shared_ptr<SDKConnector> m_sdkconnector;
QUrl m_localStoragePath; QUrl m_localStoragePath;
QUrl m_localSettingsPath; QUrl m_localSettingsPath;

View File

@ -8,10 +8,10 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
color: Material.color(Material.Grey, Material.Shade800) color: Material.color(Material.Grey, Material.Shade800)
property int attStrength: 8000000 property int attStrength: 800000
//Emitter //Emitter
property bool isEnabled: true property bool isEnabled: true
property int emitRate: 25 property int emitRate: 250
property int lifeSpan: 5000 property int lifeSpan: 5000
property int size: 4 property int size: 4
property int endSize: 8 property int endSize: 8
@ -30,8 +30,8 @@ Rectangle {
} }
onPositionChanged: { onPositionChanged: {
if (ma.pressed) {
setPosition() setPosition()
if (ma.pressed) {
} }
} }
onClicked: { onClicked: {
@ -48,6 +48,7 @@ Rectangle {
id: mouseDot id: mouseDot
property int center: mouseDot.width * .5 property int center: mouseDot.width * .5
width: 10 width: 10
visible: false
height: width height: width
radius: width radius: width
color: "orange" color: "orange"

View File

@ -1,7 +1,6 @@
setlocal EnableExtensions setlocal EnableExtensions
cd Common cd Common
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg cd vcpkg
git pull git pull
call bootstrap-vcpkg.bat call bootstrap-vcpkg.bat