aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h8
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Grav.h15
3 files changed, 13 insertions, 12 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp
index b31ef793..ed224695 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp
@@ -78,7 +78,7 @@ void SSBaseWidget::stopPainting(){
if(ANIM!=0){
ANIM->stop();
ANIM->clear();
- delete ANIM;
+ ANIM->deleteLater();
ANIM = 0;
}
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h
index bdcefa24..9d987178 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h
@@ -14,10 +14,10 @@
class SSBaseWidget : public QWidget{
Q_OBJECT
-public:
+public:
SSBaseWidget(QWidget *parent, QSettings *set);
~SSBaseWidget();
-
+
void setPlugin(QString);
public slots:
@@ -30,7 +30,7 @@ private:
QSettings *settings;
private slots:
-
+
signals:
void InputDetected(); //just in case no event handling setup at the WM level
@@ -49,7 +49,7 @@ protected:
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
-
+
};
#endif
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 ad1b1122..d62fe980 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
@@ -93,13 +93,16 @@ public:
orbit->setTargetObject(planet);
//Creates the random position of the planet, making sure it isn't too close to the sun
- int randwidth = qrand()%(range.width()/2);
- if(randwidth < range.width() + 100 and randwidth > range.width() - 100) randwidth = 100;
- int randheight= qrand()%(range.height()/2);
- if(randheight < range.height() + 100 and randheight > range.height() - 100) randheight = 100;
+ 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;
+ tmp = QPoint(randwidth, randheight);
+ }
//Creates all frames for the animation
- setupLoop(QPoint(randwidth, randheight), &center);
+ setupLoop(tmp, &center);
this->addAnimation(orbit);
planet->show();
@@ -172,13 +175,11 @@ public:
//Loops through all planets and sets up the animations, then adds them to the base group and vector, which
for(int i=0; i<number; i++){
- if(planets.length()>number){ continue; }
Grav *tmp = new Grav(canvas);
this->addAnimation(tmp);
connect(tmp, SIGNAL(finished()), this, SLOT(checkFinished()));
planets << tmp;
}
- while(planets.length()>number){planets.takeAt(number)->deleteLater(); }
}
};
bgstack15