public function __construct($objParentObject, $strFileUploadCallback, $strControlId = null)
 {
     // Call parent constructor and define FileUploadCallback
     parent::__construct($objParentObject, $strControlId);
     $this->strFileUploadCallback = $strFileUploadCallback;
     // Setup the Dialog Box, itself
     $this->strTemplate = __DOCROOT__ . __PHP_ASSETS__ . '/QFileAssetDialog.tpl.php';
     //$this->blnDisplay = false;
     //$this->blnMatteClickable = false;
     $this->AutoOpen = false;
     $this->strTitle = QApplication::Translate("Upload a File");
     // Controls for Upload FileAsset Dialog Box
     $this->lblMessage = new QLabel($this);
     $this->lblMessage->HtmlEntities = false;
     $this->lblError = new QLabel($this);
     $this->lblError->HtmlEntities = false;
     $this->flcFileAsset = new QFileControl($this);
     $this->btnUpload = new QButton($this);
     $this->btnCancel = new QButton($this);
     $this->objSpinner = new QWaitIcon($this);
     // Events on the Dialog Box Controls
     $this->flcFileAsset->AddAction(new QEnterKeyEvent(), new QTerminateAction());
     $this->btnUpload->AddAction(new QClickEvent(), new QToggleEnableAction($this->btnUpload));
     $this->btnUpload->AddAction(new QClickEvent(), new QToggleEnableAction($this->btnCancel));
     $this->btnUpload->AddAction(new QClickEvent(), new QToggleDisplayAction($this->objSpinner));
     $this->btnUpload->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnUpload_Click'));
     $this->btnCancel->AddAction(new QClickEvent(), new QHideDialog($this));
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     $this->textEdit_static_text = tr('Downloading PQPack package');
     $this->setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint | Qt::WindowTitleHint);
     $this->downloader = new PQFileDownloader();
     $this->downloader->connect(SIGNAL('downloaded()'), $this, SLOT('downloaded()'));
     $this->downloader->connect(SIGNAL('downloadProgress(qint64,qint64)'), $this, SLOT('downloadProgress(qint64,qint64)'));
     $this->textEdit = new QTextEdit($this);
     $this->textEdit->html = $this->textEdit_static_text . '... (0Kb of 0Kb)';
     $this->textEdit->readOnly = true;
     $this->textEdit->minimumHeight = $this->textEdit->maximumHeight = 80;
     $this->progressBar = new QProgressBar($this);
     $this->progressBar->setMinimumSize(450, 30);
     $this->button = new QPushButton($this);
     $this->button->text = tr('Continue');
     $this->button->enabled = false;
     $this->button->connect(SIGNAL('clicked()'), $this, SLOT('close()'));
     $this->button->minimumHeight = 30;
     $layout = new QVBoxLayout();
     $layout->addWidget($this->textEdit);
     $layout->addWidget($this->progressBar);
     $layout->addWidget($this->button);
     $this->setLayout($layout);
 }
 public function __construct($objParentObject, $strControlId)
 {
     parent::__construct($objParentObject, $strControlId);
     $this->AutoRenderChildren = true;
     $this->Width = 700;
     $this->objModelConnectorOptions = new QModelConnectorOptions();
     $this->tabs = new QTabs($this);
     $this->tabs->HeightStyle = "auto";
     $this->AddButton('Save', 'save');
     $this->AddButton('Save, Regenerate and Reload', 'saveRefresh');
     $this->AddButton('Cancel', 'cancel');
     $this->AddAction(new QDialog_ButtonEvent(), new QAjaxControlAction($this, 'ButtonClick'));
 }
Example #4
0
 public function __construct($events, $startIndex, $parent = 0)
 {
     parent::__construct($parent);
     $this->startIndex = $startIndex;
     /*
             $this->csPath = c(PQNAME)->csPath;
             $this->csEvents = c(PQNAME)->csEvents;
             $this->csName = c(PQNAME)->csName;
             
             $component = get_class($object);
             
             $events = array();
             while ($component != null) {
                 $componentPath = $this->csPath . "/$component/" . $this->csName;
                 $eventsPath = $this->csPath . "/$component/" . $this->csEvents;
                 
                 $r = array();
                 
                 if (file_exists($eventsPath) && is_file($eventsPath)) {
                     require ($eventsPath);
     
                     if (count($r) > 0) {
                         $events[$component] = $r;
                     }
                 }
     
                 $component = null;
                 require($componentPath);
     
                 if (isset($r['parent']) && !empty(trim($r['parent']))) {
                     $component = $r['parent'];
                 }
             }
             
             $list = new QListWidget($this);
             $list->alternatingRowColors = true;
             $list->connect(SIGNAL('itemDoubleClicked(int)'), $this, SLOT('itemDoubleClicked(int)'));
             
             foreach($events as $c => $e) {
                 foreach($e as $event) {
                     $list->addItem($event['event']);
                 }
             }*/
     $list = new QListWidget($this);
     $list->alternatingRowColors = true;
     $list->connect(SIGNAL('itemDoubleClicked(int)'), $this, SLOT('itemDoubleClicked(int)'));
     foreach ($events as $eventIndex => $event) {
         $list->addItem($event['event']);
     }
 }
Example #5
0
 protected function Form_Create()
 {
     $this->Draggable = new QPanel($this);
     $this->Draggable->Text = 'Drag me';
     $this->Draggable->CssClass = 'draggable';
     $this->Draggable->Moveable = true;
     //$this->Draggable->AddAction(new QDraggable_StopEvent(), new QJavascriptAction("alert('Dragged to ' + ui.position.top + ',' + ui.position.left)"));
     $this->Draggable->AddAction(new QDraggable_StopEvent(), new QAjaxAction("drag_stop"));
     // Dropable
     $this->Droppable = new QPanel($this);
     $this->Droppable->Text = "Drop here";
     //$this->Droppable->AddAction(new QDroppable_DropEvent(), new QJavascriptAction("alert('Dropped ' + ui.draggable.attr('id'))"));
     $this->Droppable->AddAction(new QDroppable_DropEvent(), new QAjaxAction("droppable_drop"));
     $this->Droppable->CssClass = 'droppable';
     $this->Droppable->Droppable = true;
     // Resizable
     $this->Resizable = new QPanel($this);
     $this->Resizable->CssClass = 'resizable';
     $this->Resizable->Resizable = true;
     $this->Resizable->AddAction(new QResizable_StopEvent(), new QAjaxAction('resizable_stop'));
     // Selectable
     $this->Selectable = new QSelectable($this);
     $this->Selectable->AutoRenderChildren = true;
     $this->Selectable->CssClass = 'selectable';
     for ($i = 1; $i <= 5; ++$i) {
         $pnl = new QPanel($this->Selectable);
         $pnl->Text = 'Item ' . $i;
         $pnl->CssClass = 'selitem';
     }
     $this->Selectable->Filter = 'div.selitem';
     $this->Selectable->SelectedItems = array($pnl->ControlId);
     // pre-select last item
     $this->Selectable->AddAction(new QSelectable_StopEvent(), new QAjaxAction('selectable_stop'));
     // Sortable
     $this->Sortable = new QSortable($this);
     $this->Sortable->AutoRenderChildren = true;
     $this->Sortable->CssClass = 'sortable';
     for ($i = 1; $i <= 5; ++$i) {
         $pnl = new QPanel($this->Sortable);
         $pnl->Text = 'Item ' . $i;
         $pnl->CssClass = 'sortitem';
     }
     $this->Sortable->Items = 'div.sortitem';
     $this->Sortable->AddAction(new QSortable_StopEvent(), new QAjaxAction('sortable_stop'));
     // Accordion
     $this->Accordion = new QAccordion($this);
     $lbl = new QLinkButton($this->Accordion);
     $lbl->Text = 'Header 1';
     $pnl = new QPanel($this->Accordion);
     $pnl->Text = 'Section 1';
     $lbl = new QLinkButton($this->Accordion);
     $lbl->Text = 'Header 2';
     $pnl = new QPanel($this->Accordion);
     $pnl->Text = 'Section 2';
     $lbl = new QLinkButton($this->Accordion);
     $lbl->Text = 'Header 3';
     $pnl = new QPanel($this->Accordion);
     $pnl->Text = 'Section 3';
     $this->Accordion->AddAction(new QChangeEvent(), new QAjaxAction('accordion_change'));
     // Autocomplete
     // Both autocomplete controls below will use the mode
     // "match only on the beginning of the word"
     QAutocomplete::UseFilter(QAutocomplete::FILTER_STARTS_WITH);
     // Client-side only autocomplete
     $this->Autocomplete1 = new QAutocomplete($this);
     $this->Autocomplete1->Source = self::$LANGUAGES;
     $this->Autocomplete1->Name = "Standard Autocomplete";
     $this->Autocomplete2 = new QAutocomplete($this);
     $this->Autocomplete2->Source = self::$LANGUAGES;
     $this->Autocomplete2->AutoFocus = true;
     $this->Autocomplete2->MustMatch = true;
     $this->Autocomplete2->Name = "AutoFocus and MustMatch";
     // Ajax Autocomplete
     // Note: To show the little spinner while the ajax search is happening, you
     // need to define the .ui-autocomplete-loading class in a style sheet. See
     // header.inc.php for an example.
     $this->AjaxAutocomplete = new QAutocomplete($this);
     $this->AjaxAutocomplete->SetDataBinder("update_autocompleteList");
     $this->AjaxAutocomplete->AddAction(new QAutocomplete_ChangeEvent(), new QAjaxAction('ajaxautocomplete_change'));
     $this->AjaxAutocomplete->DisplayHtml = true;
     $this->AjaxAutocomplete->Name = 'With Html Display';
     $this->AjaxAutocomplete2 = new QAutocomplete($this);
     $this->AjaxAutocomplete2->MultipleValueDelimiter = ',';
     $this->AjaxAutocomplete2->SetDataBinder("update_autocompleteList");
     $this->AjaxAutocomplete2->Name = 'Multiple selection';
     // Button
     $this->Button = new QJqButton($this);
     $this->Button->Label = "Click me";
     // Label overrides Text
     $this->Button->AddAction(new QClickEvent(), new QServerAction("button_click"));
     $this->CheckBox = new QJqCheckBox($this);
     $this->CheckBox->Text = "CheckBox";
     $this->RadioButton = new QJqRadioButton($this);
     $this->RadioButton->Text = "RadioButton";
     $this->IconButton = new QJqButton($this);
     $this->IconButton->Text = "Sample";
     $this->IconButton->ShowText = false;
     $this->IconButton->Icons = array("primary" => JqIcon::Lightbulb);
     // Lists
     $this->CheckList1 = new QCheckBoxList($this);
     $this->CheckList1->Name = "CheckBoxList with buttonset";
     foreach (self::$LANGUAGES as $strLang) {
         $this->CheckList1->AddItem($strLang);
     }
     $this->CheckList1->ButtonMode = QCheckBoxList::ButtonModeSet;
     $this->CheckList2 = new QCheckBoxList($this);
     $this->CheckList2->Name = "CheckBoxList with button style";
     foreach (self::$LANGUAGES as $strLang) {
         $this->CheckList2->AddItem($strLang);
     }
     $this->CheckList2->ButtonMode = QCheckBoxList::ButtonModeJq;
     $this->CheckList2->RepeatColumns = 4;
     $this->RadioList1 = new QRadioButtonList($this);
     $this->RadioList1->Name = "RadioButtonList with buttonset";
     foreach (self::$LANGUAGES as $strLang) {
         $this->RadioList1->AddItem($strLang);
     }
     $this->RadioList1->ButtonMode = QCheckBoxList::ButtonModeSet;
     $this->RadioList2 = new QRadioButtonList($this);
     $this->RadioList2->Name = "RadioButtonList with button style";
     foreach (self::$LANGUAGES as $strLang) {
         $this->RadioList2->AddItem($strLang);
     }
     $this->RadioList2->ButtonMode = QCheckBoxList::ButtonModeJq;
     $this->RadioList2->RepeatColumns = 4;
     // Datepicker
     $this->Datepicker = new QDatepicker($this);
     // DatepickerBox
     $this->DatepickerBox = new QDatepickerBox($this);
     // Dialog
     $this->Dialog = new QDialog($this);
     $this->Dialog->Text = 'a non modal dialog';
     $this->Dialog->AddButton('Cancel', 'cancel');
     $this->Dialog->AddButton('OK', 'ok');
     $this->Dialog->AddAction(new QDialog_ButtonEvent(), new QAjaxAction('dialog_press'));
     $this->Dialog->AutoOpen = false;
     $this->btnShowDialog = new QJqButton($this);
     $this->btnShowDialog->Text = 'Show Dialog';
     $this->btnShowDialog->AddAction(new QClickEvent(), new QShowDialog($this->Dialog));
     $this->txtDlgTitle = new QTextBox($this);
     $this->txtDlgTitle->Name = "Set Title To:";
     $this->txtDlgTitle->AddAction(new QKeyPressEvent(10), new QAjaxAction('dlgTitle_Change'));
     $this->txtDlgTitle->AddAction(new QBackspaceKeyEvent(10), new QAjaxAction('dlgTitle_Change'));
     $this->txtDlgText = new QTextBox($this);
     $this->txtDlgText->Name = "Set Text To:";
     $this->txtDlgText->AddAction(new QKeyPressEvent(10), new QAjaxAction('dlgText_Change'));
     $this->txtDlgText->AddAction(new QBackspaceKeyEvent(10), new QAjaxAction('dlgText_Change'));
     // Progressbar
     $this->Progressbar = new QProgressbar($this);
     $this->Progressbar->Value = 37;
     // Slider
     $this->Slider = new QSlider($this);
     $this->Slider->AddAction(new QSlider_SlideEvent(), new QJavascriptAction('jQuery("#' . $this->Progressbar->ControlId . '").progressbar ("value", ui.value)'));
     $this->Slider->AddAction(new QSlider_ChangeEvent(), new QAjaxAction('slider_change'));
     $this->Slider2 = new QSlider($this);
     $this->Slider2->Range = true;
     $this->Slider2->Values = array(10, 50);
     $this->Slider2->AddAction(new QSlider_ChangeEvent(), new QAjaxAction('slider2_change'));
     // Tabs
     $this->Tabs = new QTabs($this);
     $tab1 = new QPanel($this->Tabs);
     $tab1->Text = 'First tab is active by default';
     $tab2 = new QPanel($this->Tabs);
     $tab2->Text = 'Tab 2';
     $tab3 = new QPanel($this->Tabs);
     $tab3->Text = 'Tab 3';
     $this->Tabs->Headers = array('One', 'Two', 'Three');
 }
Example #6
0
 public function exec()
 {
     $this->textEdit->setFocus();
     return parent::exec();
 }
Example #7
0
 public function __construct($fileName, QWidget $parent = NULL)
 {
     parent::__construct($parent);
     $fileInfo = new QFileInfo($fileName);
     $this->tabWidget = new QTabWidget();
     $this->tabWidget->addTab(new GeneralTab($fileInfo), tr("General"));
     $this->tabWidget->addTab(new PermissionsTab($fileInfo), tr("Permissions"));
     $this->tabWidget->addTab(new ApplicationsTab($fileInfo), tr("Applications"));
     $this->buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
     $this->connect($this->buttonBox, SIGNAL("accepted()"), $this, SLOT("accept()"));
     $this->connect($this->buttonBox, SIGNAL("rejected()"), $this, SLOT("reject()"));
     $mainLayout = new QVBoxLayout();
     $mainLayout->addWidget($this->tabWidget);
     $mainLayout->addWidget($this->buttonBox);
     $this->setLayout($mainLayout);
     $this->setWindowTitle(tr("Tab Dialog"));
 }
 public function __set($strName, $mixValue)
 {
     $this->blnModified = true;
     switch ($strName) {
         case "Value":
             // Depending on the format of $mixValue, set $this->fltValue appropriately
             // It will try to cast to Integer if possible, otherwise Float, otherwise just 0
             $this->fltValue = 0;
             try {
                 $this->fltValue = QType::Cast($mixValue, QType::Float);
                 break;
             } catch (QInvalidCastException $objExc) {
             }
             try {
                 $this->fltValue = QType::Cast($mixValue, QType::Integer);
                 break;
             } catch (QInvalidCastException $objExc) {
             }
             break;
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
 function eventFilter($target, $event)
 {
     if ($target == $display) {
         if ($event->type() == QEvent::MouseButtonPress || $event->type() == QEvent::MouseButtonDblClick || $event->type() == QEvent::MouseButtonRelease || $event->type() == QEvent::ContextMenu) {
             $mouseEvent = $event;
             if ($mouseEvent->buttons() & Qt::LeftButton) {
                 $newPalette = $this->palette();
                 $newPalette->setColor(QPalette::Base, $this->display->palette()->color(QPalette::Text));
                 $newPalette->setColor(QPalette::Text, $this->display->palette()->color(QPalette::Base));
                 $this->display->setPalette($newPalette);
             } else {
                 $this->display->setPalette($palette());
             }
             return true;
         }
     }
     return parent::eventFilter($target, $event);
 }
 /**
  * Create a message dialog. Automatically adds an OK button that closes the dialog. To detect the close,
  * add an action on the QDialog_CloseEvent. To change the message, use the return value and set ->Text.
  * To detect a button click, add a QDialog_ButtonEvent.
  *
  * If you specify no buttons, a close box in the corner will be created that will just close the dialog. If you
  * specify just a string in $strButtons, or just one string in the button array, one button will be shown that will just close the message.
  *
  * If you specify more than one button, the first button will be the default button (the one pressed if the user presses the return key). In
  * this case, you will need to detect the button by adding a QDialog_ButtonEvent. You will also be responsible for calling "Close()" on
  * the dialog after detecting a button.
  *
  * @param QForm $objForm	// The parent object, which should always be the form itself.
  * @param string $strMessage		// The message
  * @param string|string[]|null $strButtons
  * @param string|null $strControlId
  * @return QDialog
  */
 public static function Alert($strMessage, $strButtons = null, $strControlId = null)
 {
     global $_FORM;
     $objForm = $_FORM;
     $dlg = new QDialog($objForm, $strControlId);
     $dlg->Modal = true;
     $dlg->Resizable = false;
     $dlg->Text = $strMessage;
     $dlg->AddAction(new QDialog_CloseEvent(), new QAjaxControlAction($dlg, 'alert_Close'));
     if ($strButtons) {
         $dlg->blnHasCloseButton = false;
         if (is_string($strButtons)) {
             $dlg->AddCloseButton($strButtons);
         } elseif (count($strButtons) == 1) {
             $dlg->AddCloseButton($strButtons[0]);
         } else {
             $strButton = array_shift($strButtons);
             $dlg->AddButton($strButton, null, false, true);
             // primary button
             foreach ($strButtons as $strButton) {
                 $dlg->AddButton($strButton);
             }
         }
     } else {
         $dlg->blnHasCloseButton = true;
         $dlg->Height = 100;
         // fix problem with jquery ui dialog making space for buttons that don't exist
     }
     $dlg->Open();
     return $dlg;
 }
 /**
  * Here we respond to the button click. $strParameter will contain the text of the button clicked.
  */
 protected function infoClick($strFormId, $strControlId, $strParameter)
 {
     $dlg = $this->GetControl($strControlId);
     // get the dialog object from the form.
     $dlg->Close();
     // close the dialog. Note that you could detect which button was clicked and only close on some of the buttons.
     QDialog::Alert($strParameter . ' was clicked.', ['OK']);
 }
 /**
  * Constructor
  *
  * @param QDialog $objControl
  *
  * @throws QCallerException
  */
 public function __construct($objControl)
 {
     if (!$objControl instanceof QDialog) {
         throw new QCallerException('First parameter of constructor is expecting an object of type QDialog');
     }
     $strControlId = $objControl->getJqControlId();
     $this->strJavaScript = sprintf('jQuery("#%s").dialog("close");', $strControlId);
 }