aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h
index 3ec0af82..6ba18b22 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h
@@ -12,6 +12,8 @@
#include <QParallelAnimationGroup>
#include <QtMath>
+#include <unistd.h>
+
class Text: public QParallelAnimationGroup{
Q_OBJECT
private:
@@ -38,15 +40,15 @@ private slots:
void stopped(){ qDebug() << "Text Stopped"; text->hide();}
public:
- Text(QWidget *parent) : QParallelAnimationGroup(parent){
+ Text(QWidget *parent, QString display) : QParallelAnimationGroup(parent){
text = new QLabel(parent);
range = parent->size();
- QPoint center = parent->geometry().center();
+ QPoint center = QRect( QPoint(0,0), parent->size()).center();
QString color = "rgba(" + QString::number(qrand() % 206 + 50) + ", " + QString::number(qrand() % 206 + 50) + ", " + QString::number(qrand() % 206 + 50);
- text->setStyleSheet("QLabel {background-color: rgba(255, 255, 255, 10); color: " + color + "); }");
+ text->setStyleSheet("QLabel {background-color: transparent; color: " + color + "); }");
text->setFont(QFont("Courier", 24, QFont::Bold));
- text->setText("test");
+ text->setText(display);
QFontMetrics metrics(text->font());
text->setMinimumSize(QSize( metrics.width(text->text())+10, metrics.height()*text->text().count("\n") +10));
@@ -60,7 +62,7 @@ public:
v.setY((qrand() % 100 + 50) * qPow(-1, qrand() % 2));
movement->setStartValue(center);
//Ensures the screensaver will not stop until the user wishes to login or it times out
- this->setLoopCount(2000); //number of movements
+ this->setLoopCount(200); //number of wall bounces
movement->setDuration(200);
movement->setEndValue(QPoint(qrand() % (int)range.height(), qrand() % range.width()));
LoopChanged(); //load initial values
@@ -75,14 +77,22 @@ public:
class TextAnimation : public BaseAnimGroup{
Q_OBJECT
public:
- TextAnimation(QWidget *parent, QSettings *set) : BaseAnimGroup(parent, set){}
+ TextAnimation(QWidget *parent) : BaseAnimGroup(parent){}
~TextAnimation(){
this->stop();
}
void LoadAnimations(){
canvas->setStyleSheet("background: black;");
- Text *tmp = new Text(canvas);
+ //Read off the text that needs to be displayed
+ QString textToShow = readSetting("text", "").toString();
+ if(textToShow.isEmpty()){
+ char hname[300];
+ gethostname(hname, 300);
+ textToShow = QString::fromLocal8Bit(hname);
+ }
+ // Now create the animation
+ Text *tmp = new Text(canvas, textToShow);
this->addAnimation(tmp);
}
bgstack15