Ejemplo 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();
 }
Ejemplo 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'));
         }
     }
 }
Ejemplo 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;
 }
Ejemplo n.º 4
0
 private function checkUpdates()
 {
     /* Updater */
     if ($this->updaterResult === true) {
         $needUpdate = false;
         $vcontrol = c(PQNAME)->pqpackPath . '/update.info.xml';
         $currentVersion = 'unknown';
         if (!file_exists($vcontrol)) {
             $needUpdate = true;
         } else {
             $preUpdater = new UpdateDSApp();
             $result = $preUpdater->check($vcontrol);
             if ($result === true) {
                 $currentVersion = $preUpdater->updateInfo("version") . ' ' . $preUpdater->updateInfo("date");
             }
         }
         $lastVersion = $this->updater->updateInfo("version") . ' ' . $this->updater->updateInfo("date");
         if ($needUpdate === true) {
             $msgbox = new QMessageBox(QMessageBox::Information, tr('PQCreator updater'), tr('Update for package %s is available!') . "\r\n" . "\r\n" . tr('Current version: ') . $currentVersion . "\r\n" . tr('Available version: ') . $lastVersion . "\r\n" . "\r\n" . tr('Update package?'), QMessageBox::Ok | QMessageBox::No, 0, Qt::WindowStaysOnTopHint);
             $answer = $msgbox->exec();
             if ($answer == QMessageBox::Ok) {
                 $msgbox2 = new QMessageBox(QMessageBox::Warning, tr('PQCreator updater'), tr('Sorry, the updates not supported yet... :-('), QMessageBox::Ok, 0, Qt::WindowStaysOnTopHint);
                 $answer = $msgbox2->exec();
             }
             $this->canBeClosed = true;
         }
     } else {
         //  error connection
     }
 }
Ejemplo n.º 5
0
 public function messageClicked()
 {
     $box = new QMessageBox();
     $box->information($this, new QString(tr("Systray")), tr("Sorry, I already gave what help I could.\nMaybe you should try asking a human?"), QMessageBox::Ok, QMessageBox::Cancel);
 }
Ejemplo n.º 6
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();
     }
 }