aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2020-04-03 13:42:13 -0400
committerKen Moore <moorekou@gmail.com>2020-04-03 13:42:13 -0400
commit8f36bade9684e225fe74e044216f3dc6308649b6 (patch)
tree55c7d14b1576cbffd08955a7487b55e000748349
parentAdd a new tool: lumina-pingcursor. (diff)
downloadlumina-8f36bade9684e225fe74e044216f3dc6308649b6.tar.gz
lumina-8f36bade9684e225fe74e044216f3dc6308649b6.tar.bz2
lumina-8f36bade9684e225fe74e044216f3dc6308649b6.zip
Get the window transparency and ring animation finished up.
All set now.
-rw-r--r--src-qt5/core/lumina-pingcursor/main.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src-qt5/core/lumina-pingcursor/main.cpp b/src-qt5/core/lumina-pingcursor/main.cpp
index 19d4690e..9dfecd94 100644
--- a/src-qt5/core/lumina-pingcursor/main.cpp
+++ b/src-qt5/core/lumina-pingcursor/main.cpp
@@ -10,22 +10,34 @@
#include <QLabel>
#include <QDateTime>
#include <QPoint>
+#include <QScreen>
+#include <QDesktopWidget>
+#include <QPropertyAnimation>
+
int main(int argc, char **argv){
//Setup the application
QApplication App(argc, argv);
App.setAttribute(Qt::AA_UseHighDpiPixmaps);
//Display the OSD
- QWidget splash(0, Qt::Window | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
+ QLabel splash(0, Qt::Window | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint | Qt::NoDropShadowWindowHint);
splash.setWindowTitle("");
- splash.setStyleSheet("background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0 transparent, stop:0.52 transparent, stop:0.565 rgba(82, 121, 76, 33), stop:0.65 rgba(159, 235, 148, 64), stop:0.721925 rgba(255, 238, 150, 129), stop:0.77 rgba(255, 128, 128, 204), stop:0.89 rgba(191, 128, 255, 64), stop:1 transparent);");
- splash.setWindowOpacity(0);
splash.resize(100,100);
+ QWidget overlay( &splash );
+ overlay.setStyleSheet("margin: 0px; border: none; background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0 rgba(0, 0, 0, 0), stop:0.52 rgba(0, 0, 0, 0), stop:0.565 rgba(82, 121, 76, 33), stop:0.65 rgba(159, 235, 148, 64), stop:0.721925 rgba(255, 238, 150, 129), stop:0.77 rgba(130, 205, 47, 204), stop:0.89 rgba(100, 128, 255, 64), stop:1 rgba(0, 0, 0, 0));");
+ overlay.setGeometry(QRect(0,0,100,100));
//Make sure it is centered on the current screen
QPoint center = QCursor::pos();
splash.move(center.x()-(splash.size().width()/2), center.y()-(splash.size().height()/2));
+ splash.setPixmap(QApplication::screens().at(0)->grabWindow(QApplication::desktop()->winId(), splash.x(), splash.y(), 100,100) );
splash.show();
- QDateTime end = QDateTime::currentDateTime().addMSecs(1000);
- while(QDateTime::currentDateTime() < end){ App.processEvents(); }
+ QPropertyAnimation anim(&splash,"windowOpacity");
+ anim.setDuration(1500);
+ anim.setStartValue(1);
+ anim.setKeyValueAt(0.30, 0); anim.setKeyValueAt(0.31, 1);
+ anim.setKeyValueAt(0.60, 0); anim.setKeyValueAt(0.61, 1);
+ anim.setEndValue(0);
+ anim.start();
+ while(anim.state() != QAbstractAnimation::Stopped){ App.processEvents(); }
splash.hide();
return 0;
}
bgstack15