WidgetsDemo::WidgetsDemo(int argc, char* argv[]) : Application(&argc, &argv, (AppOptions) (OptDaleAuto | OptSound)) { setMargins(5, 5, 5, 5); setLayout(new VBoxLayout()); // ToolBar ToolBar* bar = new ToolBar(); bar->addWidget(new Label("ilixi_widgets")); bar->addWidget(new Spacer(Horizontal)); ToolBarButton* barButton = new ToolBarButton("Quit"); barButton->setIcon(StyleHint::Cross); barButton->sigClicked.connect(sigc::ptr_fun(WidgetsDemo::quit)); bar->addWidget(barButton); setToolbar(bar); // TabPanel TabPanel* tab = new TabPanel(); // tab->surface()->setSurfaceFlag(Surface::SubSurface); // tab->surface()->unsetSurfaceFlag(Surface::SharedSurface); addWidget(tab); // Buttons Tab VBoxLayout* vBox = new VBoxLayout(); tab->addTab(vBox, "Tab 1"); // Label vBox->addWidget(createLabelGroup()); vBox->addWidget(new LineSeperator()); // CheckBox and RadioButton HBoxLayout* box1 = new HBoxLayout(); box1->addWidget(createCheckGroup()); box1->addWidget(createRadioGroup()); vBox->addWidget(box1); vBox->addWidget(new LineSeperator()); // PushButton vBox->addWidget(createPBGroup()); vBox->addWidget(new LineSeperator()); // ToolButton vBox->addWidget(createTBGroup()); vBox->addWidget(new LineSeperator()); // ButtonGroup DirectionalButton* db1 = new DirectionalButton("Left"); DirectionalButton* db2 = new DirectionalButton("1"); DirectionalButton* db3 = new DirectionalButton("2"); DirectionalButton* db4 = new DirectionalButton("3"); DirectionalButton* db5 = new DirectionalButton("Right"); ButtonGroup* bg = new ButtonGroup(Horizontal); bg->addButton(db1); bg->addButton(db2); bg->addButton(db3); bg->addButton(db4); bg->addButton(db5); vBox->addWidget(bg); vBox->addWidget(new Spacer(Vertical)); // Disabled VBoxLayout* vBox4 = new VBoxLayout(); tab->addTab(vBox4, "Tab 2"); tab->setTabEnabled(1, false); // LineInput Tab VBoxLayout* vBox2 = new VBoxLayout(); tab->addTab(vBox2, "Tab 3"); LineInput *li1 = new LineInput("123..."); li1->sigTextEntered.connect(sigc::mem_fun(this, &WidgetsDemo::print)); vBox2->addWidget(li1); vBox2->addWidget(new Spacer(Vertical)); LineInput *li2 = new LineInput("Line input has some text..."); vBox2->addWidget(li2); vBox2->addWidget(new Spacer(Vertical)); LineInput *li3 = new LineInput("Line input has some text..."); vBox2->addWidget(li3); vBox2->addWidget(new Spacer(Vertical)); LineInput *li4 = new LineInput("Line input has some text..."); vBox2->addWidget(li4); li4->setDisabled(); vBox2->addWidget(new Spacer(Vertical)); LineInput *li5 = new LineInput("Line input has some text..."); vBox2->addWidget(li5); VBoxLayout* vBox3 = new VBoxLayout(); tab->addTab(vBox3, "Tab 4"); ProgressBar* bar1 = new ProgressBar(); bar1->setValue(5); vBox3->addWidget(bar1); ProgressBar* bar1d = new ProgressBar(); bar1d->setValue(5); bar1d->setDisabled(); vBox3->addWidget(bar1d); Slider* slider1 = new Slider(); slider1->sigValueChanged.connect(sigc::mem_fun(bar1, &ProgressBar::setValue)); vBox3->addWidget(slider1); Slider* slider11 = new Slider(); slider11->setValue(48); slider11->setDisabled(); vBox3->addWidget(slider11); Slider* slider2 = new Slider(); slider2->setInverted(true); slider2->sigValueChanged.connect(sigc::mem_fun(bar1, &ProgressBar::setValue)); vBox3->addWidget(slider2); ScrollBar* sb1 = new ScrollBar(Horizontal); sb1->setRange(0, 10); vBox3->addWidget(sb1); ScrollBar* sb12 = new ScrollBar(Horizontal); sb12->setDisabled(); sb12->setRange(0, 10); sb12->setValue(5); vBox3->addWidget(sb12); // Verticals HBoxLayout* vSliderLayout = new HBoxLayout(); vBox3->addWidget(vSliderLayout); ProgressBar* bar2 = new ProgressBar(); bar2->setValue(5); bar2->setOrientation(Vertical); vSliderLayout->addWidget(bar2); Slider* slider3 = new Slider(); slider3->setOrientation(Vertical); slider3->sigValueChanged.connect(sigc::mem_fun(bar2, &ProgressBar::setValue)); vSliderLayout->addWidget(slider3); Slider* slider4 = new Slider(); slider4->setOrientation(Vertical); slider4->setInverted(true); slider4->sigValueChanged.connect(sigc::mem_fun(bar2, &ProgressBar::setValue)); vSliderLayout->addWidget(slider4); ScrollBar* sb2 = new ScrollBar(Vertical); sb2->setRange(0, 10); vSliderLayout->addWidget(sb2); ComboBox::StringList list; char str[5]; for (int i = 2005; i > 1900; --i) { sprintf(str, "%d", i); list.push_back(str); } ComboBox* co1 = new ComboBox("Select your date of birth:"); co1->addItems(list); vBox3->addWidget(co1); SpinBox* spin1 = new SpinBox(5); vBox3->addWidget(spin1); }
ConfigDialog::ConfigDialog(MovieRecorderImpl* recorder) : recorder(recorder), updateViewComboLater(std::bind(&ConfigDialog::updateViewCombo, this)) { setWindowTitle(_("Movie Recorder")); QVBoxLayout* vbox = new QVBoxLayout(); setLayout(vbox); QHBoxLayout* hbox = new QHBoxLayout(); hbox->addWidget(new QLabel(_("Target view:"))); targetViewCombo.sigCurrentIndexChanged().connect( std::bind(&ConfigDialog::onTargetViewIndexChanged, this, std::placeholders::_1)); hbox->addWidget(&targetViewCombo); viewMarkerCheck.setText(_("Show the marker")); viewMarkerCheck.sigToggled().connect( std::bind(&MovieRecorderImpl::onViewMarkerToggled, recorder, std::placeholders::_1)); hbox->addWidget(&viewMarkerCheck); hbox->addStretch(); vbox->addLayout(hbox); hbox = new QHBoxLayout(); hbox->addWidget(new QLabel(_("Recording mode: "))); ButtonGroup* modeGroup = new ButtonGroup(); for(int i=0; i < N_RECORDING_MODES; ++i){ RadioButton* radio = &modeRadioButtons[i]; radio->setText(recorder->recordingMode.label(i)); modeGroup->addButton(radio, i); hbox->addWidget(radio); } modeRadioButtons[0].setChecked(true); modeGroup->sigButtonClicked().connect( std::bind(&ConfigDialog::onRecordingModeRadioClicked, this, std::placeholders::_1)); hbox->addStretch(); vbox->addLayout(hbox); hbox = new QHBoxLayout(); hbox->addWidget(new QLabel(_("Directory"))); hbox->addWidget(&directoryEntry); QIcon folderIcon = QIcon::fromTheme("folder"); if(folderIcon.isNull()){ directoryButton.setText(_("Select")); } else { directoryButton.setIcon(folderIcon); } directoryButton.sigClicked().connect( std::bind(&ConfigDialog::showDirectorySelectionDialog, this)); hbox->addWidget(&directoryButton); vbox->addLayout(hbox); hbox = new QHBoxLayout(); hbox->addWidget(new QLabel(_("Basename"))); basenameEntry.setText("scene"); hbox->addWidget(&basenameEntry); hbox->addStretch(); vbox->addLayout(hbox); hbox = new QHBoxLayout(); hbox->addWidget(new QLabel(_("Frame rate"))); fpsSpin.setDecimals(1); fpsSpin.setRange(1.0, 9999.9); fpsSpin.setValue(30.0); fpsSpin.setSingleStep(0.1); hbox->addWidget(&fpsSpin); hbox->addWidget(new QLabel(_("[fps]"))); hbox->addStretch(); vbox->addLayout(hbox); hbox = new QHBoxLayout(); startTimeCheck.setText(_("Start time")); hbox->addWidget(&startTimeCheck); startTimeSpin.setDecimals(2); startTimeSpin.setRange(0.00, 9999.99); startTimeSpin.setSingleStep(0.1); hbox->addWidget(&startTimeSpin); hbox->addWidget(new QLabel(_("[s]"))); hbox->addSpacing(4); finishTimeCheck.setText(_("Finish time")); hbox->addWidget(&finishTimeCheck); finishTimeSpin.setDecimals(2); finishTimeSpin.setRange(0.00, 9999.99); finishTimeSpin.setSingleStep(0.1); hbox->addWidget(&finishTimeSpin); hbox->addWidget(new QLabel(_("[s]"))); hbox->addStretch(); vbox->addLayout(hbox); hbox = new QHBoxLayout(); imageSizeCheck.setText(_("Image size")); hbox->addWidget(&imageSizeCheck); imageWidthSpin.setRange(1, 9999); imageWidthSpin.setValue(640); hbox->addWidget(&imageWidthSpin); hbox->addWidget(new QLabel("x")); imageHeightSpin.setRange(1, 9999); imageHeightSpin.setValue(480); hbox->addWidget(&imageHeightSpin); hbox->addStretch(); vbox->addLayout(hbox); if(ENABLE_MOUSE_CURSOR_CAPTURE){ hbox = new QHBoxLayout(); mouseCursorCheck.setText(_("Capture the mouse cursor")); hbox->addWidget(&mouseCursorCheck); hbox->addStretch(); vbox->addLayout(hbox); } vbox->addWidget(new HSeparator()); QDialogButtonBox* buttonBox = new QDialogButtonBox(this); recordingToggle.setText(_("&Record")); recordingToggle.setDefault(true); recordingToggle.sigToggled().connect( std::bind(&MovieRecorderImpl::activateRecording, recorder, std::placeholders::_1, true)); buttonBox->addButton(&recordingToggle, QDialogButtonBox::ActionRole); vbox->addWidget(buttonBox); }