public function downloaded() { $messagebox = new QMessageBox(); if ($this->progressBar->value != $this->progressBar->maximum) { $this->hide(); $messagebox->critical(0, tr('PQCreator error'), tr('Error download PQPack! :-( Please, try later...'), tr('Quit')); qApp::quit(); } $this->textEdit->html .= "\n" . tr('Writing in file...'); file_put_contents($this->tempFilePath, $this->downloader->downloadedData()); $this->textEdit->html .= "\n" . sprintf(tr('Unzip data in `%s`'), $this->destinationDir); $zip = new ZipArchive(); if ($zip->open($this->tempFilePath) === TRUE) { if (!mkdir($this->destinationDir)) { $this->hide(); $messagebox->critical(0, tr('PQCreator error'), sprintf(tr('Error creating directory `%s`!'), $this->destinationDir), tr('Quit')); $zip->close(); qApp::quit(); } $zip->extractTo($this->destinationDir); $zip->close(); $this->textEdit->html .= "\n<b>" . tr('Done!') . '</b>'; $this->button->enabled = true; $messagebox->free(); unset($messagebox); qApp::beep(); return; } $this->hide(); $messagebox->critical(0, tr('PQCreator error'), sprintf(tr('Error unzip PQPack package `%s`!'), $this->tempFilePath), tr('Quit')); qApp::quit(); }
private function getPQPackDialog() { $messagebox = new QMessageBox(); $answer = (int) $messagebox->question(0, tr('Package not found'), sprintf(tr("PQPack package not found in `%s` directory.\r\n" . "Without PQPack package you can't compile applications.\r\n\r\n" . "Download and install it?"), $this->pqpackPath), tr('Yes'), tr('No (Quit)')); if ($answer == 1) { qApp::quit(); } else { $this->downloadPQPack(); } if (!file_exists($this->pqpackPath)) { qApp::quit(); } }