Example #1
0
 public function __construct($version)
 {
     parent::__construct();
     /* Init */
     $this->updater = new UpdateDSApp();
     $this->frame = 0;
     $this->frames = 150;
     $this->canBeClosed = false;
     $this->windowFlags = Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint;
     $this->setAttribute(Qt::WA_TranslucentBackground);
     $this->setAttribute(Qt::WA_DeleteOnClose);
     $this->setAttribute(Qt::WA_QuitOnClose);
     $this->resize(256, 256);
     $logoPath = __DIR__;
     $logoCircle = new QLabel($this);
     $logoCircle->resize(256, 256);
     $logoCircle->icon = $logoPath . '/data/logo-circle-256.png';
     $this->logoPaw2 = $this->createPaw($logoPath . '/data/paw-256-2.png', $desktopWidth, $desktopHeight);
     $this->logoPaw3 = $this->createPaw($logoPath . '/data/paw-256-3.png', $desktopWidth, $desktopHeight);
     $this->logoPaw4 = $this->createPaw($logoPath . '/data/paw-256-4.png', $desktopWidth, $desktopHeight);
     $this->logoPaw5 = $this->createPaw($logoPath . '/data/paw-256-5.png', $desktopWidth, $desktopHeight);
     $this->logoPaw1 = $this->createPaw($logoPath . '/data/paw-256-1.png', $desktopWidth, $desktopHeight);
     $this->labelVersion = new QLabel($this);
     $this->labelVersion->text = 'Version: ' . $version;
     $this->labelVersion->styleSheet = 'font-size:10px; color:#002040; qproperty-alignment:AlignCenter;';
     /* Timer */
     $this->timer = new QTimer();
     $this->timer->interval = 12;
     $this->timer->running = false;
     $this->timer->onTimer = function () {
         $this->logoPaw1->y = -$this->screenGeometry["height"] / 2 + $this->bounceOut($this->y + $this->screenGeometry["height"] / 2, $this->frame / $this->frames);
         if ($this->frame > 10) {
             $this->logoPaw5->y = -$this->screenGeometry["height"] / 2 + $this->bounceOut($this->y + $this->screenGeometry["height"] / 2, ($this->frame - 10) / $this->frames);
         }
         if ($this->frame > 20) {
             $this->logoPaw4->y = -$this->screenGeometry["height"] / 2 + $this->bounceOut($this->y + $this->screenGeometry["height"] / 2, ($this->frame - 20) / $this->frames);
         }
         if ($this->frame > 30) {
             $this->logoPaw3->y = -$this->screenGeometry["height"] / 2 + $this->bounceOut($this->y + $this->screenGeometry["height"] / 2, ($this->frame - 30) / $this->frames);
         }
         if ($this->frame > 40) {
             $this->logoPaw2->y = -$this->screenGeometry["height"] / 2 + $this->bounceOut($this->y + $this->screenGeometry["height"] / 2, ($this->frame - 40) / $this->frames);
         }
         if ($this->frame > 220) {
             $this->checkUpdates();
             if ($this->canBeClosed) {
                 $this->timer->free();
                 $this->logoPaw1->close();
                 $this->logoPaw2->close();
                 $this->logoPaw3->close();
                 $this->logoPaw4->close();
                 $this->logoPaw5->close();
                 $this->close();
             }
         }
         $this->frame++;
     };
 }