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 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;
 }
Exemplo n.º 3
0
 public function pqRunAction($sender, $checked)
 {
     $filename = $this->projectDir . '/main.php';
     $exec = $this->projectDir . '/pqengine.exe';
     if (file_put_contents($filename, $this->codegen->getCode()) === false) {
         $messagebox = new QMessageBox();
         $messagebox->warning(0, tr('PQCreator error'), sprintf(tr("Cannot write data to file: %1\r\n" . 'Please check that the file is not opened in another application'), $filename));
         $messagebox->free();
     } else {
         $pipes = array();
         $this->runningProcess = proc_open($exec, array(), $pipes, $this->projectDir);
         $this->runAction->enabled = false;
         $this->stopAction->enabled = true;
         $this->processCheckTimer->start();
     }
 }