aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-screensaver
diff options
context:
space:
mode:
authorZackaryWelch <welch.zackary@gmail.com>2017-08-01 15:00:12 -0400
committerZackaryWelch <welch.zackary@gmail.com>2017-08-01 15:00:31 -0400
commit2458ca5221c850389f2def844061a529042fe794 (patch)
treee9b393413b5e91a54cb546809c8a6f391b50aaea /src-qt5/core/lumina-desktop-unified/src-screensaver
parentMerge branch 'master' of http://github.com/trueos/lumina (diff)
downloadlumina-2458ca5221c850389f2def844061a529042fe794.tar.gz
lumina-2458ca5221c850389f2def844061a529042fe794.tar.bz2
lumina-2458ca5221c850389f2def844061a529042fe794.zip
Fixed Grav loop and disabled screensaver brightness
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-screensaver')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp6
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.cpp2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Grav.h18
3 files changed, 16 insertions, 10 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp
index bfcfa54d..f9682c79 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp
@@ -102,8 +102,8 @@ void LScreenSaver::ShowScreenSaver(){
//Now go through and create/show all the various widgets
QList<QScreen*> SCREENS = QApplication::screens();
QRect bounds;
- cBright = LOS::ScreenBrightness();
- if(cBright>0){ LOS::setScreenBrightness(cBright/2); } //cut to half while the screensaver is active
+ //cBright = LOS::ScreenBrightness();
+ //if(cBright>0){ LOS::setScreenBrightness(cBright/2); } //cut to half while the screensaver is active
for(int i=0; i<SCREENS.length(); i++){
bounds = bounds.united(SCREENS[i]->geometry());
if(DEBUG){ qDebug() << " - New SS Base:" << i; }
@@ -144,7 +144,7 @@ void LScreenSaver::HideScreenSaver(){
//QApplication::restoreOverrideCursor();
if(DEBUG){ qDebug() << "Hiding Screen Saver:" << QDateTime::currentDateTime().toString(); }
SSRunning = false;
- if(cBright>0){ LOS::setScreenBrightness(cBright); } //return to current brightness
+ //if(cBright>0){ LOS::setScreenBrightness(cBright); } //return to current brightness
if(!SSLocked){
this->hide();
emit ClosingScreenSaver();
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.cpp
index 017eaf9f..aaae8b41 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.cpp
@@ -31,5 +31,5 @@ BaseAnimGroup* BaseAnimGroup::NewAnimation(QString type, QWidget *parent, QSetti
}
QStringList BaseAnimGroup::KnownAnimations(){
- return (QStringList() << "fireflies" << "grav" << "text");
+ return (QStringList() << "grav");
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Grav.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Grav.h
index d62fe980..a4ea5ed8 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Grav.h
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Grav.h
@@ -14,6 +14,7 @@
#include "BaseAnimGroup.h"
#include <QParallelAnimationGroup>
#include <QtMath>
+#include <QMatrix>
class Grav: public QParallelAnimationGroup{
Q_OBJECT
@@ -56,7 +57,7 @@ private:
QPoint newLoc = QPoint(newX, newY);
//orbit->setKeyValueAt(i/step, newLoc);
path.push_back(newLoc);
- }
+ }
//Sets the time for a full orbit. Increasing makes the orbit slower.
path.push_back(lastP);
@@ -94,13 +95,17 @@ public:
//Creates the random position of the planet, making sure it isn't too close to the sun
QRect invalid = QRect(center+QPoint(-50,-50), center+QPoint(50,50));
- QPoint tmp = center;
- while(invalid.contains(center)){
- int randwidth = qrand()%(range.width() - 2*planet_radius) + planet_radius;
- int randheight= qrand()%(range.height()- 2*planet_radius) + planet_radius;
+ QPoint tmp = center;
+ while(invalid.contains(tmp)){
+ int randwidth = qrand()%(int)(range.width() - 2*planet_radius) + planet_radius;
+ int randheight= qrand()%(int)(range.height()- 2*planet_radius) + planet_radius;
tmp = QPoint(randwidth, randheight);
}
+ /*double tmpDistance = qSqrt((qPow((tmp.x()-center.x()), 2) + qPow((tmp.y()-center.y()), 2)));
+ double theta = qAsin(qAbs(tmp.y()-center.y())/tmpDistance);
+ QMatrix rotation = QMatrix(qCos(theta), qSin(theta), -qSin(theta), qCos(theta), -center.x(), -center.y());*/
+
//Creates all frames for the animation
setupLoop(tmp, &center);
this->addAnimation(orbit);
@@ -174,10 +179,11 @@ public:
int number = settings->value("planets/number",10).toInt();
//Loops through all planets and sets up the animations, then adds them to the base group and vector, which
+ qDebug() << "Starting planets";
for(int i=0; i<number; i++){
Grav *tmp = new Grav(canvas);
this->addAnimation(tmp);
- connect(tmp, SIGNAL(finished()), this, SLOT(checkFinished()));
+ connect(tmp, SIGNAL(finished()), this, SLOT(checkFinished()));
planets << tmp;
}
}
bgstack15