Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
 private function checkPQPack()
 {
     if (!file_exists($this->pqpackPath)) {
         $this->getPQPackDialog();
     } else {
         if (!is_dir($this->pqpackPath)) {
             $messagebox = new QMessageBox();
             $messagebox->critical(0, tr('PQCreator error'), sprintf(tr('Cannot access to PQPack directory `%s`'), $this->pqpackPath), tr('Quit'));
         }
     }
 }
Exemplo n.º 3
0
 private function get_def_dir()
 {
     if (empty(trim($this->user_projects_path))) {
         // TODO: replace
         // $c_def_dir = explode(':',  __DIR__)[0] . ':/PQProjects_tmp'; // sets the value of $c_def_dir to [C|D|E|...]:/PQProjects_tmp
         $c_def_dir = c(PQNAME)->currentPath . '/PQProjects_tmp';
         $def_dir = $c_def_dir;
         // Check that the PATH is not a file
         for ($index = 1; file_exists($def_dir) && is_file($def_dir); $index++) {
             $def_dir = $c_def_dir . $index;
         }
         // Create a directory if not exists
         if (!file_exists($def_dir) && !mkdir($def_dir)) {
             $messageBox = new QMessageBox();
             $messageBox->critical(0, tr('Error creating directory'), sprintf(tr('Cannot create directory `%s`'), u($def_dir)), tr('Ok'));
             $messageBox->free();
             return false;
         }
         $this->user_projects_path = ___pq_prepare_path_to_win($def_dir);
     }
     return $this->user_projects_path;
 }