Esempio n. 1
0
 public function __construct()
 {
     parent::__construct();
     $quit = new QPushButton(tr("&Quit"));
     $quit->setFont(new QFont("Times", 18, QFont::Bold));
     QObject::connect($quit, SIGNAL('clicked()'), QApplication::instance(), SLOT('quit()'));
     $angle = new LCDRange();
     $angle->setRange(5, 70);
     $force = new LCDRange();
     $force->setRange(10, 50);
     $cannonField = new CannonField();
     QObject::connect($angle, SIGNAL('valueChanged(int)'), $cannonField, SLOT('setAngle(int)'));
     QObject::connect($cannonField, SIGNAL('angleChanged(int)'), $angle, SLOT('setValue(int)'));
     QObject::connect($force, SIGNAL('valueChanged(int)'), $cannonField, SLOT('setForce(int)'));
     QObject::connect($cannonField, SIGNAL('forceChanged(int)'), $force, SLOT('setValue(int)'));
     $shoot = new QPushButton(tr("&Shoot"));
     $shoot->setFont(new QFont("Times", 18, QFont::Bold));
     QObject::connect($shoot, SIGNAL('clicked()'), $cannonField, SLOT('shoot()'));
     $topLayout = new QHBoxLayout();
     $topLayout->addWidget($shoot);
     $topLayout->addStretch(1);
     $leftLayout = new QVBoxLayout();
     $leftLayout->addWidget($angle);
     $leftLayout->addWidget($force);
     $gridLayout = new QGridLayout();
     $gridLayout->addWidget($quit, 0, 0);
     $gridLayout->addLayout($topLayout, 0, 1);
     $gridLayout->addLayout($leftLayout, 1, 0);
     $gridLayout->addWidget($cannonField, 1, 1, 2, 1);
     $gridLayout->setColumnStretch(1, 10);
     $this->setLayout($gridLayout);
     $angle->setValue(60);
     $force->setValue(25);
     $angle->setFocus();
 }
Esempio n. 2
0
 public function __construct($text, $parent = 0)
 {
     parent::__construct($parent);
     $dialogLabel = new QLabel($this);
     $dialogLabel->text = $text;
     $yesBtn = new QPushButton($this);
     $yesBtn->text = tr('Yes');
     $yesBtn->onClicked = function ($sender, $event) {
         $this->done(1);
     };
     $noBtn = new QPushButton($this);
     $noBtn->text = tr('No');
     $noBtn->onClicked = function ($sender, $event) {
         $this->done(0);
     };
     $dialogLayout = new QGridLayout();
     $dialogLayout->addWidget($dialogLabel, 0, 0, 1, 2);
     $dialogLayout->addWidget($yesBtn, 1, 0);
     $dialogLayout->addWidget($noBtn, 1, 1);
     $this->setLayout($dialogLayout);
 }
Esempio n. 3
0
 private function createOptionsGroupBox()
 {
     $this->optionsGroupBox = new QGroupBox(tr("Options"));
     $this->delaySpinBox = new QSpinBox();
     $this->delaySpinBox->setSuffix(tr(" s"));
     $this->delaySpinBox->setMaximum(60);
     $this->connect($this->delaySpinBox, SIGNAL("valueChanged(int)"), $this, SLOT("updateCheckBox()"));
     $this->delaySpinBoxLabel = new QLabel(tr("Screenshot Delay:"));
     $this->hideThisWindowCheckBox = new QCheckBox(tr("Hide This Window"));
     $this->optionsGroupBoxLayout = new QGridLayout();
     $this->optionsGroupBoxLayout->addWidget($this->delaySpinBoxLabel, 0, 0);
     $this->optionsGroupBoxLayout->addWidget($this->delaySpinBox, 0, 1);
     $this->optionsGroupBoxLayout->addWidget($this->hideThisWindowCheckBox, 1, 0, 1, 2);
     $this->optionsGroupBox->setLayout($this->optionsGroupBoxLayout);
 }
Esempio n. 4
0
 public function __construct()
 {
     parent::__construct();
     $quit = new QPushButton(tr("Quit"));
     $quit->setFont(new QFont("Times", 18, QFont::Bold));
     //	    QObject::connect($quit, SIGNAL('clicked()'), qApp(), SLOT('quit()'));
     QObject::connect($quit, SIGNAL('clicked()'), QApplication::instance(), SLOT('quit()'));
     $angle = new LCDRange();
     $angle->setRange(5, 70);
     $cannonField = new CannonField();
     QObject::connect($angle, SIGNAL('valueChanged(int)'), $cannonField, SLOT('setAngle(int)'));
     QObject::connect($cannonField, SIGNAL('angleChanged(int)'), $angle, SLOT('setValue(int)'));
     $gridLayout = new QGridLayout();
     $gridLayout->addWidget($quit, 0, 0);
     $gridLayout->addWidget($angle, 1, 0);
     $gridLayout->addWidget($cannonField, 1, 1, 2, 1);
     $gridLayout->setColumnStretch(1, 10);
     $this->setLayout($gridLayout);
     $angle->setValue(60);
     $angle->setFocus();
 }
Esempio n. 5
0
 public function __construct()
 {
     parent::__construct();
     $this->iconsPath = c(PQNAME)->iconsPath;
     $openProject = $this->create_button(tr('Open project'), 'open.png', '', false);
     $qwidgetProject = $this->create_button(tr('Qt QWidget application'), 'widget.png', SLOT('new_QWidget_project()'));
     $qmainwindowProject = $this->create_button(tr('Qt QMainWindow application'), 'window.png', SLOT('new_QMainWindow_project()'));
     $consoleProject = $this->create_button(tr('Console application'), 'console.png', '', false);
     $silentProject = $this->create_button(tr('Hidden application'), 'hidden.png', '', false);
     //$label1 = new QLabel($this);
     //$label1->text = tr('Open project');
     $label2 = new QLabel($this);
     $label2->text = tr('New project');
     $label2->styleSheet = 'font-weight:bold;font-size:12px;margin-bottom:4px;margin-left:-2px;';
     $hline = new QFrame($this);
     $hline->frameShape = QFrame::HLine;
     $hline->frameShadow = QFrame::Raised;
     $newProject = new QWidget($this);
     // NewProject name
     $newProjectName_label = new QLabel($newProject);
     $newProjectName_label->text = tr('Project name:');
     $newProjectName_label->styleSheet = 'margin-left:1px;';
     $newProjectName_lineEdit = new QLineEdit($newProject);
     $newProjectName_lineEdit->text = $this->get_def_project_name();
     $newProjectName_lineEdit->setRegExpValidator('[a-zA-Z0-9\\-\\_]*');
     $this->newProjectName_lineEdit = $newProjectName_lineEdit;
     // NewProject FileDialog
     $newProjectFD_label = new QLabel($newProject);
     $newProjectFD_label->text = tr('Create in:');
     $newProjectFD_label->styleSheet = 'margin-left:1px;';
     $newProjectFD_lineEdit = new QLineEdit($newProject);
     $newProjectFD_lineEdit->readOnly = true;
     $newProjectFD_lineEdit->text = $this->get_def_dir();
     $newProjectFD_button = new QPushButton($newProject);
     $newProjectFD_button->text = tr('View...');
     $newProjectFD_button->connect(SIGNAL('clicked()'), $this, SLOT('open_newProjectFD()'));
     // NewProject layout
     $newProject_layout = new QGridLayout();
     $newProject_layout->setMargin(0);
     $newProject_layout->addWidget($newProjectName_label, 0, 0);
     $newProject_layout->addWidget($newProjectName_lineEdit, 0, 1, 1, 2);
     $newProject_layout->addWidget(new QWidget($newProject), 1, 1, 1, 3);
     // Empty widget uses as small spacer
     $newProject_layout->addWidget($newProjectFD_label, 2, 0);
     $newProject_layout->addWidget($newProjectFD_lineEdit, 2, 1);
     $newProject_layout->addWidget($newProjectFD_button, 2, 2);
     $newProject->setLayout($newProject_layout);
     $this->newProjectFD = new QFileDialog();
     $this->newProjectFD_lineEdit = $newProjectFD_lineEdit;
     $emptyw0 = new QWidget($this);
     $emptyw0->minimumHeight = 8;
     $emptyw0->maximumHeight = 8;
     $layout = new QGridLayout();
     $layout->addWidget($openProject, 1, 0, 1, 2);
     $layout->addWidget($hline, 2, 0, 1, 2);
     $layout->addWidget($label2, 3, 0, 1, 2);
     $layout->addWidget($newProject, 4, 0, 1, 2);
     $layout->addWidget($emptyw0, 5, 0, 1, 2);
     $layout->addWidget($qwidgetProject, 6, 0);
     $layout->addWidget($qmainwindowProject, 6, 1);
     $layout->addWidget($consoleProject, 7, 0);
     $layout->addWidget($silentProject, 7, 1);
     $this->minimumWidth = 500;
     $this->windowFlags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint;
     $this->setLayout($layout);
     $this->windowTitle = 'PQCreator';
 }
Esempio n. 6
0
 public function createMessageGroupBox()
 {
     $this->messageGroupBox = new QGroupBox($this->tr("Balloon Message"));
     $this->typeLabel = new QLabel($this->tr("Type:"));
     $this->typeComboBox = new QComboBox();
     $this->typeComboBox->addItem($this->tr("None"), new QVariant(QSystemTrayIcon::NoIcon));
     $this->typeComboBox->addItem($this->style()->standardIcon(QStyle::SP_MessageBoxInformation), $this->tr("Information"), new QVariant(QSystemTrayIcon::Information));
     $this->typeComboBox->addItem($this->style()->standardIcon(QStyle::SP_MessageBoxWarning), $this->tr("Warning"), new QVariant(QSystemTrayIcon::Warning));
     $this->typeComboBox->addItem($this->style()->standardIcon(QStyle::SP_MessageBoxCritical), $this->tr("Critical"), new QVariant(QSystemTrayIcon::Critical));
     $this->typeComboBox->setCurrentIndex(1);
     $this->durationLabel = new QLabel($this->tr("Duration:"));
     $this->durationSpinBox = new QSpinBox();
     $this->durationSpinBox->setRange(5, 60);
     $this->durationSpinBox->setSuffix(" s");
     $this->durationSpinBox->setValue(15);
     $this->durationWarningLabel = new QLabel($this->tr("(some systems might " . "ignore this hint)"));
     $this->durationWarningLabel->setIndent(10);
     $this->titleLabel = new QLabel($this->tr("Title:"));
     $this->titleEdit = new QLineEdit($this->tr("Cannot connect to network"));
     $this->bodyLabel = new QLabel($this->tr("Body:"));
     $this->bodyEdit = new QTextEdit();
     $this->bodyEdit->setPlainText($this->tr("Don't believe me. Honestly, I " . "don't have a clue.\nClick this balloon for details."));
     /*
      */
     $this->showMessageButton = new QPushButton($this->tr("Show Message"));
     $this->showMessageButton->setDefault(True);
     $messageLayout = new QGridLayout();
     $messageLayout->addWidget($this->typeLabel, 0, 0);
     $messageLayout->addWidget($this->typeComboBox, 0, 1, 1, 2);
     $messageLayout->addWidget($this->durationLabel, 1, 0);
     $messageLayout->addWidget($this->durationSpinBox, 1, 1);
     $messageLayout->addWidget($this->durationWarningLabel, 1, 2, 1, 3);
     $messageLayout->addWidget($this->titleLabel, 2, 0);
     $messageLayout->addWidget($this->titleEdit, 2, 1, 1, 4);
     $messageLayout->addWidget($this->bodyLabel, 3, 0);
     $messageLayout->addWidget($this->bodyEdit, 3, 1, 2, 4);
     $messageLayout->addWidget($this->showMessageButton, 5, 4);
     $messageLayout->setColumnStretch(3, 1);
     $messageLayout->setRowStretch(4, 1);
     $this->messageGroupBox->setLayout($messageLayout);
 }