AddDeviceDialog::AddDeviceDialog(QWidget *parent, const QString &caption) : KDialog(parent) { setObjectName("AddDeviceDialog"); setModal(true); setButtons(KDialog::Ok|KDialog::Cancel); setCaption(caption); showButtonSeparator(true); QWidget *w = new QWidget(this); QVBoxLayout *vl = new QVBoxLayout(w); setMainWidget(w); QLabel *lab = new QLabel(i18n("<qt>" "<p>" "If your scanner has not been automatically detected, you can specify it here. " "The <b>Scanner device name</b> should be a backend name (with optional parameters) " "that is understood by SANE, see <a href=\"man:/sane\">sane(7)</a> or " "<a href=\"man:/sane-dll\">sane-dll(5)</a> for more information on available backends. " "The <b>Type</b> and <b>Description</b> can be used to identify the scanner later." "<p>" "For the information that needs to be entered here, try to locate the device using the " "<a href=\"man:/sane-find-scanner\">sane-find-scanner(1)</a> command. For a " "USB or networked HP scanner using <a href=\"http://hplip.sourceforge.net/\">HPLIP</a>, " "try using the <u>hp-probe</u> command to locate it, for example " "'hp-probe -b usb' or 'hp-probe -b net'. " "If the scanner is found, then enter the device name displayed by these commands; note " "that if using HPLIP then \"hp:\" needs to be replaced by \"hpaio:\"." "<p>" "If these commands fail to locate your scanner, then it may not be supported " "by SANE. Check the SANE documentation for a " "<a href=\"http://www.sane-project.org/sane-supported-devices.html\">list of supported devices</a>." "<br>"),w); lab->setWordWrap(true); lab->setOpenExternalLinks(true); vl->addWidget(lab); vl->addSpacing(KDialog::spacingHint()); vl->addStretch(1); lab = new QLabel(i18n("Scanner device name:"), w); vl->addWidget(lab); mDevEdit = new KLineEdit(w); connect(mDevEdit, SIGNAL(textChanged(const QString &)), SLOT(slotTextChanged())); vl->addWidget(mDevEdit); lab->setBuddy(mDevEdit); lab = new QLabel(i18n("Device type:"), w); vl->addWidget(lab); mTypeCombo = new QComboBox(w); vl->addWidget(mTypeCombo); lab->setBuddy(mTypeCombo); lab = new QLabel(i18n("Description:"), w); vl->addWidget(lab); mDescEdit = new KLineEdit(w); connect(mDescEdit, SIGNAL(textChanged(const QString &)), SLOT(slotTextChanged())); vl->addWidget(mDescEdit); lab->setBuddy(mDescEdit); w->setMinimumSize(QSize(450, 420)); // This list from http://www.sane-project.org/html/doc011.html#s4.2.8 QStringList types; types << "scanner" << "film scanner" << "flatbed scanner" << "frame grabber" << "handheld scanner" << "multi-function peripheral" << "sheetfed scanner" << "still camera" << "video camera" << "virtual device"; mTypeCombo->addItems(types); slotTextChanged(); }
void PathDeformControls::layoutForSmallScreen() { QGroupBox* mainGroup = new QGroupBox(this); mainGroup->setTitle(tr("Controls")); QLabel *radiusLabel = new QLabel(mainGroup); radiusLabel->setText(tr("Lens Radius:")); QSlider *radiusSlider = new QSlider(Qt::Horizontal, mainGroup); radiusSlider->setRange(15, 150); radiusSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QLabel *deformLabel = new QLabel(mainGroup); deformLabel->setText(tr("Deformation:")); QSlider *deformSlider = new QSlider(Qt::Horizontal, mainGroup); deformSlider->setRange(-100, 100); deformSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QLabel *fontSizeLabel = new QLabel(mainGroup); fontSizeLabel->setText(tr("Font Size:")); QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, mainGroup); fontSizeSlider->setRange(16, 200); fontSizeSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QPushButton *animateButton = new QPushButton(tr("Animated"), mainGroup); animateButton->setCheckable(true); #ifdef QT_OPENGL_SUPPORT QPushButton *enableOpenGLButton = new QPushButton(mainGroup); enableOpenGLButton->setText(tr("Use OpenGL")); enableOpenGLButton->setCheckable(mainGroup); enableOpenGLButton->setChecked(m_renderer->usesOpenGL()); if (!QGLFormat::hasOpenGL()) enableOpenGLButton->hide(); #endif QPushButton *quitButton = new QPushButton(tr("Quit"), mainGroup); QPushButton *okButton = new QPushButton(tr("OK"), mainGroup); QGridLayout *mainGroupLayout = new QGridLayout(mainGroup); mainGroupLayout->setMargin(0); mainGroupLayout->addWidget(radiusLabel, 0, 0, Qt::AlignRight); mainGroupLayout->addWidget(radiusSlider, 0, 1); mainGroupLayout->addWidget(deformLabel, 1, 0, Qt::AlignRight); mainGroupLayout->addWidget(deformSlider, 1, 1); mainGroupLayout->addWidget(fontSizeLabel, 2, 0, Qt::AlignRight); mainGroupLayout->addWidget(fontSizeSlider, 2, 1); mainGroupLayout->addWidget(animateButton, 3,0, 1,2); #ifdef QT_OPENGL_SUPPORT mainGroupLayout->addWidget(enableOpenGLButton, 4,0, 1,2); #endif QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(mainGroup); mainLayout->addStretch(1); mainLayout->addWidget(okButton); mainLayout->addWidget(quitButton); connect(quitButton, SIGNAL(clicked()), this, SLOT(emitQuitSignal())); connect(okButton, SIGNAL(clicked()), this, SLOT(emitOkSignal())); connect(radiusSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setRadius(int))); connect(deformSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setIntensity(int))); connect(fontSizeSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setFontSize(int))); connect(animateButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setAnimated(bool))); #ifdef QT_OPENGL_SUPPORT connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool))); #endif animateButton->animateClick(); deformSlider->setValue(80); fontSizeSlider->setValue(120); QRect screen_size = QApplication::desktop()->screenGeometry(); radiusSlider->setValue(qMin(screen_size.width(), screen_size.height())/5); m_renderer->setText(tr("Qt")); }
AboutDlg::AboutDlg(QWidget *parent) : QDialog(parent) { this->setWindowTitle(tr("About QtRptDesigner")); QSize MaxSize(420, 450); QSize MinSize(420, 450); setMaximumSize(MaxSize); setMinimumSize(MinSize); QRect gry = geometry(); gry.moveCenter(qApp->desktop()->availableGeometry().center()); setGeometry(gry); QPushButton *btnOK = new QPushButton(this); btnOK->setText("OK"); QObject::connect(btnOK, SIGNAL(clicked()), this, SLOT(close())); QLabel *labImg = new QLabel(this); labImg->setPixmap(QPixmap(":/new/prefix1/images/Logo128.png")); QString lbl1 = "<h2><b><p style='color:#0033FF'>"+QApplication::applicationName()+"</p></b></h2>"+ tr("Version: ")+QApplication::applicationVersion()+"<br>"+ tr("Programmer: Aleksey Osipov")+"<br>"+ "WebSite: <a href='http://www.aliks-os.tk'>http://www.aliks-os.tk</a>"+"<br>"+ "E-mail: [email protected]"+"<br>"+ "<a href='http://www.qtrpt.tk'>http://www.qtrpt.tk</a>"+"<br>"+ tr("2012-2015 years")+"<br><br>"; QString lbl2 = "<b>"+tr("Thanks for donation:")+"</b>"+ "<ul>"+ "<li>"+tr("Sailendram")+"</li>"+ "</ul>"+ "<b>"+tr("Thanks for project developing:")+"</b>"+ "<ul>"+ "<li>"+tr("Lukas Lalinsky for DBmodel")+"</li>"+ "<li>"+tr("Norbert Schlia for help in developing")+"</li>"+ "<li>"+tr("Muhamad Bashir Al-Noimi for Arabic translation")+"</li>"+ "<li>"+tr("Luis Brochado for Portuguese translation")+"</li>"+ "<li>"+tr("Li Wei for Chinese translation")+"</li>"+ "<li>"+tr("Laurent Guilbert for French translation")+"</li>"+ "<li>"+tr("David Heremans for Dutch translation")+"</li>"+ "<li>"+tr("Mirko Marx for German translation")+"</li>"+ "<li>"+tr("Manuel Soriano for Spanish translation")+"</li>"+ "</ul>"; QLabel *lab1 = new QLabel(lbl1, this); QObject::connect(lab1, SIGNAL(linkActivated(const QString)), this, SLOT(openLink(const QString))); QLabel *lab2 = new QLabel(lbl2, this); QHBoxLayout *hLayout2 = new QHBoxLayout; hLayout2->addWidget(labImg); hLayout2->addWidget(lab1); hLayout2->addStretch(); QHBoxLayout *hLayout1 = new QHBoxLayout; //hLayout->addSpacerItem(spacer1); hLayout1->addStretch(); hLayout1->addWidget(btnOK); //hLayout->addSpacerItem(spacer2); hLayout1->addStretch(); QVBoxLayout *vLayout = new QVBoxLayout; //vLayout->addSpacerItem(spacer3); vLayout->addLayout(hLayout2); vLayout->addWidget(lab2); vLayout->addStretch(); vLayout->addLayout(hLayout1); this->setLayout(vLayout); }
QVBoxLayout* ColormapEditWidget::createButtonPanel() { QVBoxLayout* vLayout = new QVBoxLayout(); QHBoxLayout* hLayout = new QHBoxLayout(); m_cLabel = new QLabel( this ); m_sliders.clear(); QImage* image; image = createImage( this->width() - 20 ); QPixmap pix( this->width() - 20, 20 ); pix.convertFromImage( *image ); m_cLabel->setPixmap( pix ); hLayout->addStretch(); hLayout->addWidget( m_cLabel ); hLayout->addStretch(); vLayout->addLayout( hLayout ); vLayout->addSpacing( 5 ); int i = 0; { QHBoxLayout* hLayout2 = new QHBoxLayout(); PushButtonWithId* insertButton = new PushButtonWithId( "+", i ); insertButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } "); connect( insertButton, SIGNAL( signalClicked( int ) ), this, SLOT( newEntry( int ) ) ); insertButton->setDisabled( true ); PushButtonWithId* deleteButton = new PushButtonWithId( "-", i ); deleteButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } "); connect( deleteButton, SIGNAL( signalClicked( int ) ), this, SLOT( removeEntry( int ) ) ); deleteButton->setDisabled( true ); PushButtonWithId* upButton = new PushButtonWithId( "^", i ); upButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } "); upButton->setDisabled( true ); //connect( upButton, SIGNAL( signalClicked( int ) ), this, SLOT( moveUp( int ) ) ); PushButtonWithId* downButton = new PushButtonWithId( "v", i ); downButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } "); connect( downButton, SIGNAL( signalClicked( int ) ), this, SLOT( moveDown( int ) ) ); SliderWithEdit* slider = new SliderWithEdit( tr(""), Fn::Position::EAST, i ); m_sliders.push_back( slider ); slider->setMin( 0.0f ); slider->setMax( m_colormap.get( i + 1 ).value ); slider->setValue( m_colormap.get( i ).value ); connect( slider, SIGNAL( valueChanged( float, int ) ), this, SLOT( sliderChanged( float, int ) ) ); ColorWidgetWithLabel* colorWidget = new ColorWidgetWithLabel( QString::number( i ), i ); colorWidget->setValue( m_colormap.get( i ).color ); connect( colorWidget, SIGNAL( colorChanged( QColor, int ) ), this, SLOT( colorChanged( QColor, int ) ) ); hLayout2->addWidget( insertButton ); hLayout2->addWidget( deleteButton ); hLayout2->addWidget( upButton ); hLayout2->addWidget( downButton ); hLayout2->addWidget( slider ); hLayout2->addWidget( colorWidget ); vLayout->addLayout( hLayout2 ); } for ( int i = 1; i < m_colormap.size() - 1; ++i ) { QHBoxLayout* hLayout4 = new QHBoxLayout(); PushButtonWithId* insertButton = new PushButtonWithId( "+", i ); hLayout4->addWidget( insertButton ); insertButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } "); connect( insertButton, SIGNAL( signalClicked( int ) ), this, SLOT( newEntry( int ) ) ); PushButtonWithId* deleteButton = new PushButtonWithId( "-", i ); hLayout4->addWidget( deleteButton ); deleteButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } "); connect( deleteButton, SIGNAL( signalClicked( int ) ), this, SLOT( removeEntry( int ) ) ); PushButtonWithId* upButton = new PushButtonWithId( "^", i ); hLayout4->addWidget( upButton ); upButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } "); connect( upButton, SIGNAL( signalClicked( int ) ), this, SLOT( moveUp( int ) ) ); PushButtonWithId* downButton = new PushButtonWithId( "v", i ); hLayout4->addWidget( downButton ); downButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } "); connect( downButton, SIGNAL( signalClicked( int ) ), this, SLOT( moveDown( int ) ) ); SliderWithEdit* slider = new SliderWithEdit( tr(""), Fn::Position::EAST, i ); m_sliders.push_back( slider ); slider->setMin( m_colormap.get( i - 1 ).value ); slider->setMax( m_colormap.get( i + 1 ).value ); slider->setValue( m_colormap.get( i ).value ); connect( slider, SIGNAL( valueChanged( float, int ) ), this, SLOT( sliderChanged( float, int ) ) ); hLayout4->addWidget( slider ); ColorWidgetWithLabel* colorWidget = new ColorWidgetWithLabel( QString::number( i ), i ); colorWidget->setValue( m_colormap.get( i ).color ); connect( colorWidget, SIGNAL( colorChanged( QColor, int ) ), this, SLOT( colorChanged( QColor, int ) ) ); hLayout4->addWidget( colorWidget ); vLayout->addLayout( hLayout4 ); } { i = m_colormap.size() - 1; QHBoxLayout* hLayout2 = new QHBoxLayout(); PushButtonWithId* insertButton = new PushButtonWithId( "+", i ); insertButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } "); connect( insertButton, SIGNAL( signalClicked( int ) ), this, SLOT( newEntry( int ) ) ); PushButtonWithId* deleteButton = new PushButtonWithId( "-", i ); deleteButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } "); connect( deleteButton, SIGNAL( signalClicked( int ) ), this, SLOT( removeEntry( int ) ) ); deleteButton->setDisabled( true ); PushButtonWithId* upButton = new PushButtonWithId( "^", i ); upButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } "); connect( upButton, SIGNAL( signalClicked( int ) ), this, SLOT( moveUp( int ) ) ); PushButtonWithId* downButton = new PushButtonWithId( "v", i ); downButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } "); downButton->setDisabled( true ); //connect( downButton, SIGNAL( signalClicked( int ) ), this, SLOT( moveDown( int ) ) ); SliderWithEdit* slider = new SliderWithEdit( tr(""), Fn::Position::EAST, i ); m_sliders.push_back( slider ); slider->setMin( m_colormap.get( i - 1 ).value ); slider->setMax( 1.0f ); slider->setValue( m_colormap.get( i ).value ); connect( slider, SIGNAL( valueChanged( float, int ) ), this, SLOT( sliderChanged( float, int ) ) ); ColorWidgetWithLabel* colorWidget = new ColorWidgetWithLabel( QString::number( i ), i ); colorWidget->setValue( m_colormap.get( i ).color ); connect( colorWidget, SIGNAL( colorChanged( QColor, int ) ), this, SLOT( colorChanged( QColor, int ) ) ); hLayout2->addWidget( insertButton ); hLayout2->addWidget( deleteButton ); hLayout2->addWidget( upButton ); hLayout2->addWidget( downButton ); hLayout2->addWidget( slider ); hLayout2->addWidget( colorWidget ); vLayout->addLayout( hLayout2 ); } vLayout->addStretch(); return vLayout; }
AudioInSettings::AudioInSettings(TaudioParams* params, Ttune* tune, QWidget* parent) : TtouchArea(parent), m_audioIn(0), m_glParams(params), m_listGenerated(false), m_tune(tune) { QString styleTxt = "background-color: palette(button); border: 1px solid palette(Text); border-radius: 5px;"; m_tmpParams = new TaudioParams(); *m_tmpParams = *m_glParams; #if defined (Q_OS_ANDROID) m_topList = new TlistMenu(QListWidget::LeftToRight, this); QStackedLayout *m_stackedLay = new QStackedLayout; m_stackedLay->setContentsMargins(0, 0, 0, 0); TtouchArea *m_1_device, *m_2_middleA, *m_3_advanced; // m_4_test is declared in header #else m_toolBox = new QToolBox(this); QWidget *m_1_device, *m_2_middleA, *m_3_advanced; // m_4_test is declared in header #endif //################### 1. Input device & pitch detection ################################# #if defined (Q_OS_ANDROID) m_1_device = new TtouchArea(this); m_topList->addItem("1. " + tr("Input device and pitch detection")); m_stackedLay->addWidget(m_1_device); #else m_1_device = new QWidget(); m_toolBox->addItem(m_1_device, "1. " + tr("Input device and pitch detection")); #endif QLabel *devLab = new QLabel(tr("input device"), m_1_device); m_inDeviceCombo = new QComboBox(m_1_device); m_inDeviceCombo->setStatusTip(tr("Be sure your input device (microphone, webcam, instrument, etc.) is plugged in, properly configured, and working.")); m_inDeviceCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); #if !defined (Q_OS_ANDROID) && (defined (Q_OS_LINUX) || defined (Q_OS_WIN)) m_JACK_ASIO_ChB = new QCheckBox(this); #if defined (Q_OS_WIN) m_JACK_ASIO_ChB->setText("ASIO"); #elif defined (Q_OS_LINUX) m_JACK_ASIO_ChB->setText("JACK"); #endif m_JACK_ASIO_ChB->setChecked(m_glParams->JACKorASIO); #endif durHeadLab = new QLabel(tr("minimum note duration"), m_1_device); durationSpin = new QSpinBox(m_1_device); durationSpin->setMinimum(10); durationSpin->setMaximum(1000); durationSpin->setSuffix(" " + tr("[milliseconds]")); durationSpin->setSingleStep(50); durationSpin->setValue(qRound(m_glParams->minDuration * 1000)); // minimum duration is stored in seconds but displayed in milliseconds durationSpin->setStatusTip(tr("Only sounds longer than the selected time will be pitch-detected.<br>Selecting a longer minimum note duration helps avoid capturing fret noise or other unexpected sounds but decreases responsiveness.")); QLabel *volLabel = new QLabel(tr("minimum volume"), m_1_device); volumeSlider = new TvolumeSlider(m_1_device); volumeSlider->setValue(m_glParams->minimalVol); volumeSlider->setStatusTip(tr("Minimum volume of a sound to be pitch-detected")); TintonationCombo *intoCombo = new TintonationCombo(m_1_device); m_intonationCombo = intoCombo->accuracyCombo; m_intonationCombo->setCurrentIndex(m_glParams->intonation); // 1. Layout QVBoxLayout *deviceLay = new QVBoxLayout; QHBoxLayout *rtDevLay = new QHBoxLayout; rtDevLay->addWidget(devLab); rtDevLay->addWidget(m_inDeviceCombo); #if !defined (Q_OS_ANDROID) && (defined (Q_OS_LINUX) || defined (Q_OS_WIN)) rtDevLay->addWidget(m_JACK_ASIO_ChB); #endif deviceLay->addLayout(rtDevLay); #if defined (Q_OS_ANDROID) deviceLay->addWidget(getLabelFromStatus(m_inDeviceCombo, false, true)); deviceLay->addStretch(2); #endif QHBoxLayout *durLay = new QHBoxLayout; // durLay->addStretch(); durLay->addWidget(durHeadLab); durLay->addWidget(durationSpin, 0, Qt::AlignLeft); // durLay->addStretch(); deviceLay->addLayout(durLay); #if defined (Q_OS_ANDROID) // durationSpin->setMinimumWidth(fontMetrics().width(durationSpin->suffix()) * 3); deviceLay->addWidget(getLabelFromStatus(durationSpin, true, true)); deviceLay->addStretch(1); #endif QHBoxLayout *volLay = new QHBoxLayout; volLay->addWidget(volLabel); volLay->addWidget(volumeSlider); deviceLay->addLayout(volLay); #if defined (Q_OS_ANDROID) deviceLay->addWidget(getLabelFromStatus(volumeSlider)); deviceLay->addStretch(1); #endif deviceLay->addWidget(intoCombo); deviceLay->addStretch(1); m_1_device->setLayout(deviceLay); //################### 2. Middle a & transposition ################################# #if defined (Q_OS_ANDROID) m_2_middleA = new TtouchArea(this); m_topList->addItem("2. " + tr("'Middle a' and transposition")); m_stackedLay->addWidget(m_2_middleA); #else m_2_middleA = new QWidget(); m_toolBox->addItem(m_2_middleA, "2. " + tr("'Middle a' and transposition")); #endif QLabel *headLab = new QLabel("<table><tr><td valign=\"middle\">" + tr("middle A") + QString(" %1</td></tr></table>").arg(wrapPixToHtml(Tnote(6, 1, 0), Tclef::e_treble_G, TkeySignature(0), 4.0)), m_2_middleA); QLabel *frLab = new QLabel(tr("frequency:"), m_2_middleA); freqSpin = new QSpinBox(m_2_middleA); freqSpin->setStatusTip(tr("The base frequency of <i>middle a</i>.<br>Detection of the proper pitch of notes is relative to this value. This also affects the pitch of played sounds.").replace(". ", ".<br>")); freqSpin->setMinimum(200); freqSpin->setMaximum(900); freqSpin->setSuffix(" Hz"); frLab->setStatusTip(freqSpin->statusTip()); QLabel *intervalLab = new QLabel(tr("interval:"), m_2_middleA); m_intervalSpin = new QSpinBox(m_2_middleA); m_intervalSpin->setRange(0, 12); m_intervalSpin->setSpecialValueText(tr("none")); m_intervalSpin->setMinimumWidth(fontMetrics().boundingRect("w").width() * 15); // width of ten letters 'w' m_intervalSpin->setStatusTip(tr("Shifts the frequency of <i>middle a</i>. It can be used as a transposition.").replace(". ", ".<br>")); m_upSemiToneRadio = new QRadioButton(tr("up"), m_2_middleA); m_upSemiToneRadio->setIcon(QIcon(style()->standardIcon(QStyle::SP_ArrowUp))); m_downsSemitoneRadio = new QRadioButton(tr("down"), m_2_middleA); m_downsSemitoneRadio->setIcon(QIcon(style()->standardIcon(QStyle::SP_ArrowDown))); intervalLab->setStatusTip(m_intervalSpin->statusTip()); QButtonGroup *upDownGroup = new QButtonGroup(m_2_middleA); upDownGroup->addButton(m_upSemiToneRadio); upDownGroup->addButton(m_downsSemitoneRadio); m_upSemiToneRadio->setChecked(true); tuneFreqlab = new TroundedLabel(m_2_middleA); tuneFreqlab->setAlignment(Qt::AlignCenter); QFont ff = tuneFreqlab->font(); ff.setPixelSize(fontMetrics().boundingRect("A").height() * 1.2); tuneFreqlab->setFont(ff); tuneFreqlab->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); // 2. Layout QGridLayout *midGrLay = new QGridLayout; midGrLay->addWidget(frLab, 0, 0); midGrLay->addWidget(freqSpin, 0, 1); midGrLay->addWidget(intervalLab, 1, 0); QVBoxLayout *upDownLay = new QVBoxLayout; upDownLay->addWidget(m_upSemiToneRadio); upDownLay->addWidget(m_downsSemitoneRadio); QHBoxLayout *intervalLay = new QHBoxLayout; intervalLay->addWidget(m_intervalSpin); intervalLay->addLayout(upDownLay); midGrLay->addLayout(intervalLay, 1, 1); #if defined (Q_OS_ANDROID) QVBoxLayout *aLay = new QVBoxLayout; #else QHBoxLayout *aLay = new QHBoxLayout; #endif aLay->addWidget(headLab, 0, Qt::AlignCenter); #if defined (Q_OS_ANDROID) aLay->addWidget(getLabelFromStatus(freqSpin, true, true)); #endif aLay->addLayout(midGrLay); #if defined (Q_OS_ANDROID) aLay->addWidget(getLabelFromStatus(m_intervalSpin, true, true)); #endif QVBoxLayout *middleAlay = new QVBoxLayout(); middleAlay->addLayout(aLay); middleAlay->addWidget(tuneFreqlab, 0, Qt::AlignCenter); m_2_middleA->setLayout(middleAlay); //################### 3. Advanced ################################# #if defined (Q_OS_ANDROID) m_3_advanced = new TtouchArea(this); m_topList->addItem("3. " + tr("Advanced")); m_stackedLay->addWidget(m_3_advanced); #else m_3_advanced = new QWidget(); m_toolBox->addItem(m_3_advanced, "3. " + tr("Advanced")); #endif QLabel *methodLab = new QLabel(tr("pitch detection mode"), m_3_advanced); m_methodCombo = new QComboBox(m_3_advanced); m_methodCombo->addItem("MPM"); m_methodCombo->addItem("autocorrelation"); m_methodCombo->addItem("MPM + modified cepstrum"); if (m_glParams->detectMethod == e_MPM) m_methodCombo->setCurrentIndex(0); else if (m_glParams->detectMethod == e_AUTOCORRELATION) m_methodCombo->setCurrentIndex(1); else m_methodCombo->setCurrentIndex(2); m_splitVolChB = new QCheckBox(tr("split when volume rise"), this); m_splitVolChB->setStatusTip(tr("Helps to properly detect the same notes repeated quickly on the guitar.")); m_splitVolSpin = new QSpinBox(this); m_splitVolSpin->setRange(5, 50); m_splitVolSpin->setSingleStep(5); m_splitVolSpin->setSuffix(" %"); m_splitVolSpin->setStatusTip(m_splitVolChB->statusTip()); if (m_glParams->minSplitVol > 0.0) { m_splitVolChB->setChecked(true); m_splitVolSpin->setValue(m_glParams->minSplitVol); } else { m_splitVolChB->setChecked(false); m_splitVolSpin->setDisabled(true); } m_skipStillerChB = new QCheckBox(tr("skip stiller than"), this); m_skipStillerChB->setStatusTip(tr("Skips stiller sounds, below given percent of average volume. It prevents detecting of harmonics on classical or acoustic guitar but requires playing with similar strength.").replace(". ", ".<br>")); m_skipStillerSpin = new QSpinBox(this); m_skipStillerSpin->setRange(10, 95); m_skipStillerSpin->setSingleStep(5); m_skipStillerSpin->setSuffix(" %"); m_skipStillerSpin->setStatusTip(m_skipStillerChB->statusTip()); m_skipStillerSpin->setValue(m_glParams->skipStillerVal); m_skipStillerChB->setChecked(m_glParams->skipStillerVal > 0.0); m_skipStillerSpin->setDisabled(m_glParams->skipStillerVal == 0.0); m_noiseFilterChB = new QCheckBox(tr("noise filter"), m_3_advanced); m_noiseFilterChB->setChecked(m_glParams->equalLoudness); m_noiseFilterChB->setStatusTip(tr("It is rather necessary for mic input but may be switched off for instrument line-in plugged with less noise.")); QLabel *adjustLab = new QLabel(tr("adjust to instrument"), m_3_advanced); m_adjustToInstrButt = new TselectInstrument(m_3_advanced, TselectInstrument::e_buttonsOnlyHorizontal); #if defined (Q_OS_ANDROID) m_adjustToInstrButt->setGlyphSize(Tmtr::fingerPixels() * 0.8); #else m_adjustToInstrButt->setGlyphSize(fontMetrics().height() * 2); #endif //3. Layout QVBoxLayout *advLay = new QVBoxLayout; QHBoxLayout *methodLay = new QHBoxLayout; methodLay->addStretch(); methodLay->addWidget(methodLab); methodLay->addWidget(m_methodCombo); methodLay->addStretch(); advLay->addLayout(methodLay); advLay->addStretch(); QHBoxLayout *splitLay = new QHBoxLayout; splitLay->addStretch(); splitLay->addWidget(m_splitVolChB); splitLay->addWidget(m_splitVolSpin); splitLay->addStretch(); advLay->addLayout(splitLay); #if defined (Q_OS_ANDROID) advLay->addWidget(getLabelFromStatus(m_splitVolChB, false, true)); #endif advLay->addStretch(); QHBoxLayout *skipLay = new QHBoxLayout; skipLay->addStretch(); skipLay->addWidget(m_skipStillerChB); skipLay->addWidget(m_skipStillerSpin); skipLay->addStretch(); advLay->addLayout(skipLay); #if defined (Q_OS_ANDROID) advLay->addWidget(getLabelFromStatus(m_skipStillerChB, false, true)); #endif advLay->addStretch(); advLay->addWidget(m_noiseFilterChB, 0, Qt::AlignCenter); #if defined (Q_OS_ANDROID) advLay->addWidget(getLabelFromStatus(m_noiseFilterChB, true, true)); #endif advLay->addStretch(1); QHBoxLayout *adjustLay = new QHBoxLayout; adjustLay->addStretch(); adjustLay->addWidget(adjustLab); adjustLay->addWidget(m_adjustToInstrButt); adjustLay->addStretch(); advLay->addLayout(adjustLay); advLay->addStretch(1); m_3_advanced->setLayout(advLay); //################### 4. Test the settings ################################# #if defined (Q_OS_ANDROID) m_4_test = new TtouchArea(this); m_topList->addItem("4. " + tr("Test the settings")); m_stackedLay->addWidget(m_4_test); #else m_4_test = new QWidget(); m_toolBox->addItem(m_4_test, "4. " + tr("Test the settings")); #endif m_4_test->setStatusTip(tr("Check, are your audio input settings appropriate?<br>And how well does pitch detection work for your selected settings?")); testTxt = tr("Test"); stopTxt = tr("Stop"); testButt = new QPushButton(testTxt, m_4_test); testButt->setIconSize(QSize(48, 48)); pitchView = new TpitchView(m_audioIn, m_4_test, false); pitchView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); pitchView->setFixedHeight(fontMetrics().boundingRect("A").height() * 5); pitchView->setPitchColor(Qt::darkGreen); pitchView->setMinimalVolume(m_glParams->minimalVol); // pitchView->enableAccuracyChange(false); QFont labFont = font(); labFont.setPixelSize(fontMetrics().boundingRect("A").height() * 2); pitchLab = new TroundedLabel("--", this); pitchLab->setFont(labFont); pitchLab->setFixedWidth(fontMetrics().boundingRect("w").width() * 10); pitchLab->setStatusTip(tr("Detected pitch")); pitchLab->setAlignment(Qt::AlignCenter); freqLab = new TroundedLabel("--", this); freqLab->setFixedWidth(pitchLab->width() * 2); freqLab->setFont(labFont); freqLab->setAlignment(Qt::AlignCenter); getFreqStatusTip(); // 4. Layout QHBoxLayout *labelsLay = new QHBoxLayout; labelsLay->addStretch(); labelsLay->addWidget(testButt); labelsLay->addStretch(); labelsLay->addWidget(pitchLab); labelsLay->addStretch(); labelsLay->addWidget(freqLab); labelsLay->addStretch(); QVBoxLayout *testLay = new QVBoxLayout; #if defined (Q_OS_ANDROID) testLay->addWidget(getLabelFromStatus(m_4_test, false, true)); #endif testLay->addStretch(); testLay->addLayout(labelsLay); testLay->addStretch(); testLay->addWidget(pitchView); testLay->addStretch(); m_4_test->setLayout(testLay); // Whole layout QVBoxLayout *inLay = new QVBoxLayout(); #if defined (Q_OS_ANDROID) inLay->addWidget(m_topList); inLay->addLayout(m_stackedLay); inLay->setContentsMargins(0, 0, 0, 0); m_stackedLay->setCurrentIndex(0); m_topList->setCurrentRow(0); connect(m_topList, &TlistMenu::currentRowChanged, m_stackedLay, &QStackedLayout::setCurrentIndex); m_topList->adjustItemsLayout(100); #else inLay->addWidget(m_toolBox); #endif enableInBox = new QGroupBox(tr("enable pitch detection"), this); enableInBox->setLayout(inLay); QVBoxLayout *lay = new QVBoxLayout(); lay->setContentsMargins(0, 0, 0, 0); lay->addWidget(enableInBox); setLayout(lay); m_testDisabled = false; setTestDisabled(true); enableInBox->setCheckable(true); enableInBox->setChecked(m_glParams->INenabled); freqSpin->setValue(getFreq(440.0)); intervalFromFreq(freqSpin->value()); connect(testButt, SIGNAL(clicked()), this, SLOT(testSlot())); connect(m_intervalSpin, SIGNAL(valueChanged(int)), this, SLOT(intervalChanged())); connect(m_upSemiToneRadio, SIGNAL(clicked(bool)), this, SLOT(upDownIntervalSlot())); connect(m_downsSemitoneRadio, SIGNAL(clicked(bool)), this, SLOT(upDownIntervalSlot())); connect(freqSpin, SIGNAL(valueChanged(int)), this, SLOT(baseFreqChanged(int))); connect(volumeSlider, SIGNAL(valueChanged(float)), this, SLOT(minimalVolChanged(float))); #if defined (Q_OS_ANDROID) connect(m_topList, &TlistMenu::currentRowChanged, this, &AudioInSettings::testSlot); #else connect(m_toolBox, SIGNAL(currentChanged(int)), this, SLOT(testSlot())); #if defined (Q_OS_LINUX) || defined (Q_OS_WIN) connect(m_JACK_ASIO_ChB, &QCheckBox::clicked, this, &AudioInSettings::JACKASIOSlot); #endif #endif connect(enableInBox, &QGroupBox::clicked, this, &AudioInSettings::testSlot); connect(m_splitVolChB, &QCheckBox::toggled, this, &AudioInSettings::splitByVolChanged); connect(m_skipStillerChB, &QCheckBox::toggled, this, &AudioInSettings::skipStillerChanged); connect(m_adjustToInstrButt, &TselectInstrument::instrumentChanged, this, &AudioInSettings::adjustInstrSlot); #if defined(Q_OS_WIN) connect(m_inDeviceCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(asioDriverChanged(int))); #endif }
//----------------------------------------------------------------------------- // Function: CodeEditorSettingsPage::setupLayout() //----------------------------------------------------------------------------- void CodeEditorSettingsPage::setupLayout() { // Create the indentation group and all of its widgets. QGroupBox* indentGroup = new QGroupBox(tr("Indentation"), this); QLabel* indentWidthLabel = new QLabel(tr("Indent width:"), indentGroup); indentWidthEdit_ = new QLineEdit(indentGroup); indentWidthEdit_->setFixedWidth(40); indentWidthEdit_->setValidator(new QRegExpValidator(QRegExp("^\\d+$"), this)); QHBoxLayout* widthLayout = new QHBoxLayout(); widthLayout->addWidget(indentWidthLabel); widthLayout->addWidget(indentWidthEdit_); widthLayout->addStretch(1); indentStyleRadioButtons_[INDENT_STYLE_TAB] = new QRadioButton(tr("Use tabs"), indentGroup); indentStyleRadioButtons_[INDENT_STYLE_SPACES] = new QRadioButton(tr("Use spaces"), indentGroup); QVBoxLayout* indentLayout = new QVBoxLayout(indentGroup); indentLayout->addLayout(widthLayout); indentLayout->addWidget(indentStyleRadioButtons_[INDENT_STYLE_TAB]); indentLayout->addWidget(indentStyleRadioButtons_[INDENT_STYLE_SPACES]); // Create the font & colors group and all of its widgets. QGroupBox* fontColorGroup = new QGroupBox(tr("Font and Colors"), this); QLabel* fontLabel = new QLabel(tr("Font:"), fontColorGroup); fontCombo_ = new QFontComboBox(fontColorGroup); fontCombo_->setWritingSystem(QFontDatabase::Latin); fontCombo_->setFixedWidth(320); QLabel* fontSizeLabel = new QLabel(tr("Size:"), fontColorGroup); fontSizeCombo_ = new QComboBox(fontColorGroup); fontSizeCombo_->setFixedWidth(80); fontSizeCombo_->setMaxVisibleItems(MAX_FONT_SIZE - MIN_FONT_SIZE + 1); for (int size = MIN_FONT_SIZE; size <= MAX_FONT_SIZE; ++size) { fontSizeCombo_->addItem(QString::number(size)); } QGridLayout* fontLayout = new QGridLayout(); fontLayout->addWidget(fontLabel, 0, 0, 1, 1, Qt::AlignLeft); fontLayout->addWidget(fontCombo_, 1, 0, 1, 1, Qt::AlignLeft); fontLayout->addWidget(fontSizeLabel, 0, 1, 1, 1, Qt::AlignLeft); fontLayout->addWidget(fontSizeCombo_, 1, 1, 1, 1, Qt::AlignLeft); fontLayout->setColumnStretch(1, 1); QLabel* highlightLabel = new QLabel(tr("Syntax highlight for:"), fontColorGroup); highlightTypeList_ = new QListWidget(fontColorGroup); highlightTypeList_->setFixedWidth(208); for (int i = 0; i < CSourceHighlighter::STYLE_COUNT; ++i) { highlightTypeList_->addItem(STYLE_NAMES[i]); } QLabel* colorLabel = new QLabel(tr("Color:"), fontColorGroup); colorBox_ = new ColorBox(QSize(56, 56), fontColorGroup); boldCheckBox_ = new QCheckBox(tr("Bold"), fontColorGroup); italicCheckBox_ = new QCheckBox(tr("Italic"), fontColorGroup); QVBoxLayout* checkLayout = new QVBoxLayout(); checkLayout->addWidget(boldCheckBox_); checkLayout->addWidget(italicCheckBox_); QLabel* sampleLabel = new QLabel(tr("Sample:"), fontColorGroup); sampleBox_ = new ColorBox(QSize(208, 44), fontColorGroup); sampleBox_->setColor(Qt::white); sampleBox_->setText("AaBbCcXxYyZz"); QVBoxLayout* sampleLayout = new QVBoxLayout(); sampleLayout->addWidget(sampleLabel); sampleLayout->addWidget(sampleBox_); QGridLayout* colorLayout = new QGridLayout(); colorLayout->addWidget(highlightLabel, 0, 0, 1, 1, Qt::AlignLeft); colorLayout->addWidget(highlightTypeList_, 1, 0, 2, 1, Qt::AlignLeft); colorLayout->addWidget(colorLabel, 0, 1, 1, 1, Qt::AlignLeft); colorLayout->addWidget(colorBox_, 1, 1, 1, 1, Qt::AlignLeft | Qt::AlignTop); colorLayout->addLayout(checkLayout, 1, 2, 1, 1, Qt::AlignLeft | Qt::AlignTop); colorLayout->addLayout(sampleLayout, 2, 1, 1, 2, Qt::AlignLeft | Qt::AlignTop); colorLayout->setColumnStretch(2, 1); QVBoxLayout* fontColorLayout = new QVBoxLayout(fontColorGroup); fontColorLayout->addLayout(fontLayout); fontColorLayout->addSpacing(12); fontColorLayout->addLayout(colorLayout); // Setup the layout. QVBoxLayout* layout = new QVBoxLayout(this); layout->addWidget(indentGroup); layout->addWidget(fontColorGroup); layout->addStretch(1); }
void mtsRobotIO1394QtWidget::setupUi(void) { QFont font; font.setBold(true); // Power commands QVBoxLayout * powerLayout = new QVBoxLayout; QFrame * powerFrame = new QFrame; QLabel * powerTitle = new QLabel("Power"); powerTitle->setFont(font); powerTitle->setAlignment(Qt::AlignCenter); powerLayout->addWidget(powerTitle); QCBEnableAll = new QCheckBox("Enable all"); powerLayout->addWidget(QCBEnableAll); QCBEnableAmps = new QCheckBox("Enable boards"); powerLayout->addWidget(QCBEnableAmps); powerLayout->addSpacing(5); QLAmpStatus = new QLabel("Actuators ON"); QLAmpStatus->setAlignment(Qt::AlignCenter); powerLayout->addWidget(QLAmpStatus); QLPowerStatus = new QLabel("Boards ON"); QLPowerStatus->setAlignment(Qt::AlignCenter); powerLayout->addWidget(QLPowerStatus); powerLayout->addStretch(); powerFrame->setLayout(powerLayout); powerFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); // watchdog commands QVBoxLayout * watchdogLayout = new QVBoxLayout; QFrame * watchdogFrame = new QFrame; QLabel * watchdogTitle = new QLabel("Watchdog"); watchdogTitle->setFont(font); watchdogTitle->setAlignment(Qt::AlignCenter); watchdogLayout->addWidget(watchdogTitle); QHBoxLayout * watchdogSetLayout = new QHBoxLayout; { QLabel * wdogLabel = new QLabel("Wdog period (ms)"); QSBWatchdogPeriod = new QDoubleSpinBox; QSBWatchdogPeriod->setMaximum(340.0); // max wdog_period = 340 ms QSBWatchdogPeriod->setMinimum(0.0); QSBWatchdogPeriod->setSingleStep(0.05); QSBWatchdogPeriod->setValue(cmnInternalTo_ms(WatchdogPeriodInSeconds)); watchdogSetLayout->addWidget(wdogLabel); watchdogSetLayout->addWidget(QSBWatchdogPeriod); } watchdogLayout->addLayout(watchdogSetLayout); watchdogLayout->addSpacing(5); QLSafetyRelay = new QLabel("Safety relay ON"); QLSafetyRelay->setAlignment(Qt::AlignCenter); watchdogLayout->addWidget(QLSafetyRelay); QLWatchdog = new QLabel("Watchdog Timeout FALSE"); QLWatchdog->setAlignment(Qt::AlignCenter); QLWatchdog->setStyleSheet("QLabel { background-color: green }"); watchdogLayout->addWidget(QLWatchdog); QLWatchdogLastTimeout = new QLabel("Last timeout: n/a"); QLWatchdogLastTimeout->setAlignment(Qt::AlignCenter); watchdogLayout->addWidget(QLWatchdogLastTimeout); watchdogLayout->addStretch(); watchdogFrame->setLayout(watchdogLayout); watchdogFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); // Encoder commands QVBoxLayout * encoderLayout = new QVBoxLayout; QFrame * encoderFrame = new QFrame; QLabel * encoderTitle = new QLabel("Encoders"); encoderTitle->setFont(font); encoderTitle->setAlignment(Qt::AlignCenter); encoderLayout->addWidget(encoderTitle); QPBResetEncAll = new QPushButton("Reset all"); encoderLayout->addWidget(QPBResetEncAll); QPBBiasEncAll = new QPushButton("Bias from potentiometers"); encoderLayout->addWidget(QPBBiasEncAll); encoderLayout->addStretch(); encoderFrame->setLayout(encoderLayout); encoderFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); // Current comands QVBoxLayout * currentLayout = new QVBoxLayout; QFrame * currentFrame = new QFrame; QLabel * currentTitle = new QLabel("Current"); currentTitle->setFont(font); currentTitle->setAlignment(Qt::AlignCenter); currentLayout->addWidget(currentTitle); QCBEnableDirectControl = new QCheckBox("Direct control"); currentLayout->addWidget(QCBEnableDirectControl); currentLayout->addStretch(); QLabel * serialTitle = new QLabel("Serial Number"); serialTitle->setFont(font); serialTitle->setAlignment(Qt::AlignCenter); currentLayout->addWidget(serialTitle); QLSerialNumber = new QLabel("-----"); QLSerialNumber->setAlignment(Qt::AlignCenter); currentLayout->addWidget(QLSerialNumber); currentLayout->addStretch(); currentFrame->setLayout(currentLayout); currentFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); // Timing QVBoxLayout * timingLayout = new QVBoxLayout; QFrame * timingFrame = new QFrame; QLabel * timingTitle = new QLabel("Timing"); timingTitle->setFont(font); timingTitle->setAlignment(Qt::AlignCenter); timingLayout->addWidget(timingTitle); QMIntervalStatistics = new mtsQtWidgetIntervalStatistics(); timingLayout->addWidget(QMIntervalStatistics); timingLayout->addStretch(); timingFrame->setLayout(timingLayout); timingFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); // Commands layout QHBoxLayout * commandLayout = new QHBoxLayout; commandLayout->addWidget(powerFrame); commandLayout->addWidget(watchdogFrame); commandLayout->addWidget(encoderFrame); commandLayout->addWidget(currentFrame); commandLayout->addWidget(timingFrame); // Feedbacks Label QGridLayout * gridLayout = new QGridLayout; gridLayout->setSpacing(1); int row = 0; if (NumberOfActuators != 0) { vctBoolVec defaultEnable(NumberOfActuators, false); vctDoubleVec defaultCurrent(NumberOfActuators, 0.0); gridLayout->addWidget(new QLabel("Actuator power"), row, 0); QVWActuatorCurrentEnableEachWidget = new vctQtWidgetDynamicVectorBoolWrite(); QVWActuatorCurrentEnableEachWidget->SetValue(defaultEnable); gridLayout->addWidget(QVWActuatorCurrentEnableEachWidget, row, 1); row++; gridLayout->addWidget(new QLabel("Desired current (mA)"), row, 0); QVWActuatorCurrentSpinBoxWidget = new vctQtWidgetDynamicVectorDoubleWrite(vctQtWidgetDynamicVectorDoubleWrite::SPINBOX_WIDGET); QVWActuatorCurrentSpinBoxWidget->SetValue(defaultCurrent); gridLayout->addWidget(QVWActuatorCurrentSpinBoxWidget, row, 1); row++; QPBResetCurrentAll = new QPushButton("Reset current"); gridLayout->addWidget(QPBResetCurrentAll, row, 0); QVWActuatorCurrentSliderWidget = new vctQtWidgetDynamicVectorDoubleWrite(vctQtWidgetDynamicVectorDoubleWrite::SLIDER_WIDGET); QVWActuatorCurrentSliderWidget->SetValue(defaultCurrent); gridLayout->addWidget(QVWActuatorCurrentSliderWidget, row, 1); row++; gridLayout->addWidget(new QLabel("Current feedback (mA)"), row, 0); QVRActuatorCurrentFeedbackWidget = new vctQtWidgetDynamicVectorDoubleRead(); gridLayout->addWidget(QVRActuatorCurrentFeedbackWidget, row, 1); row++; gridLayout->addWidget(new QLabel("Joint positions (deg)"), row, 0); QVRJointPositionWidget = new vctQtWidgetDynamicVectorDoubleRead(); gridLayout->addWidget(QVRJointPositionWidget, row, 1); row++; gridLayout->addWidget(new QLabel("Actuator positions (deg)"), row, 0); QVRActuatorPositionWidget = new vctQtWidgetDynamicVectorDoubleRead(); gridLayout->addWidget(QVRActuatorPositionWidget, row, 1); row++; gridLayout->addWidget(new QLabel("Velocities (deg/s)"), row, 0); QVRActuatorVelocityWidget = new vctQtWidgetDynamicVectorDoubleRead(); gridLayout->addWidget(QVRActuatorVelocityWidget, row, 1); row++; gridLayout->addWidget(new QLabel("Analog inputs (V)"), row, 0); QVRPotVoltsWidget = new vctQtWidgetDynamicVectorDoubleRead(); gridLayout->addWidget(QVRPotVoltsWidget, row, 1); row++; gridLayout->addWidget(new QLabel("Potentiometers (deg)"), row, 0); QVRPotPositionWidget = new vctQtWidgetDynamicVectorDoubleRead(); gridLayout->addWidget(QVRPotPositionWidget, row, 1); row++; gridLayout->addWidget(new QLabel("Amp temperature (C)"), row, 0); QVRActuatorAmpTemperature = new vctQtWidgetDynamicVectorDoubleRead(); gridLayout->addWidget(QVRActuatorAmpTemperature, row, 1); row++; } if (NumberOfBrakes != 0) { vctBoolVec defaultEnable(NumberOfBrakes, false); gridLayout->addWidget(new QLabel("Brakes"), row, 0); QHBoxLayout * brakeButtonsLayout = new QHBoxLayout(); QPBBrakeRelease = new QPushButton("Release"); brakeButtonsLayout->addWidget(QPBBrakeRelease); QPBBrakeEngage = new QPushButton("Engage"); brakeButtonsLayout->addWidget(QPBBrakeEngage); gridLayout->addLayout(brakeButtonsLayout, row, 1); row++; gridLayout->addWidget(new QLabel("Brake power"), row, 0); QVWBrakeCurrentEnableEachWidget = new vctQtWidgetDynamicVectorBoolWrite(); QVWBrakeCurrentEnableEachWidget->SetValue(defaultEnable); gridLayout->addWidget(QVWBrakeCurrentEnableEachWidget, row, 1); row++; gridLayout->addWidget(new QLabel("Current desired (mA)"), row, 0); QVRBrakeCurrentCommandWidget = new vctQtWidgetDynamicVectorDoubleRead(); gridLayout->addWidget(QVRBrakeCurrentCommandWidget, row, 1); row++; gridLayout->addWidget(new QLabel("Current feedback (mA)"), row, 0); QVRBrakeCurrentFeedbackWidget = new vctQtWidgetDynamicVectorDoubleRead(); gridLayout->addWidget(QVRBrakeCurrentFeedbackWidget, row, 1); row++; gridLayout->addWidget(new QLabel("Amp temperature (C)"), row, 0); QVRBrakeAmpTemperature = new vctQtWidgetDynamicVectorDoubleRead(); gridLayout->addWidget(QVRBrakeAmpTemperature, row, 1); row++; } // main layout QVBoxLayout * mainLayout = new QVBoxLayout; mainLayout->addLayout(commandLayout); mainLayout->addLayout(gridLayout); mainLayout->addStretch(); setLayout(mainLayout); setWindowTitle(QString(this->GetName().c_str())); resize(sizeHint()); // connect signals & slots connect(QCBEnableAmps, SIGNAL(toggled(bool)), this, SLOT(SlotEnableAmps(bool))); connect(QCBEnableAll, SIGNAL(toggled(bool)), this, SLOT(SlotEnableAll(bool))); connect(QCBEnableDirectControl, SIGNAL(toggled(bool)), this, SLOT(SlotEnableDirectControl(bool))); connect(QPBResetCurrentAll, SIGNAL(clicked()), this, SLOT(SlotResetCurrentAll())); connect(QPBResetEncAll, SIGNAL(clicked()), this, SLOT(SlotResetEncodersAll())); connect(QPBBiasEncAll, SIGNAL(clicked()), this, SLOT(SlotBiasEncodersAll())); connect(QSBWatchdogPeriod, SIGNAL(valueChanged(double)), this, SLOT(SlotWatchdogPeriod(double))); connect(QVWActuatorCurrentEnableEachWidget, SIGNAL(valueChanged()), this, SLOT(SlotActuatorAmpEnable())); connect(QVWActuatorCurrentSpinBoxWidget, SIGNAL(valueChanged()), this, SLOT(SlotActuatorCurrentValueChanged())); connect(QVWActuatorCurrentSliderWidget, SIGNAL(valueChanged()), this, SLOT(SlotSliderActuatorCurrentValueChanged())); if (NumberOfBrakes != 0) { connect(QPBBrakeRelease, SIGNAL(clicked()), this, SLOT(SlotBrakeRelease())); connect(QPBBrakeEngage, SIGNAL(clicked()), this, SLOT(SlotBrakeEngage())); connect(QVWBrakeCurrentEnableEachWidget, SIGNAL(valueChanged()), this, SLOT(SlotBrakeAmpEnable())); } // connect cisstMultiTask events connect(this, SIGNAL(SignalPowerStatus(bool)), this, SLOT(SlotPowerStatus(bool))); connect(this, SIGNAL(SignalWatchdogStatus(bool)), this, SLOT(SlotWatchdogStatus(bool))); // set initial value QCBEnableAmps->setChecked(false); QCBEnableAll->setChecked(false); QCBEnableDirectControl->setChecked(DirectControl); SlotEnableDirectControl(DirectControl); }
PolynomFitDialog::PolynomFitDialog( QWidget* parent, Qt::WFlags fl ) : QDialog( parent, fl ), graph(NULL) { setName( "PolynomFitDialog" ); setWindowTitle(tr("MantidPlot - Polynomial Fit Options")); setSizeGripEnabled( true ); QGroupBox *gb1 = new QGroupBox(); QGridLayout *gl1 = new QGridLayout(gb1); gl1->addWidget(new QLabel(tr("Polynomial Fit of")), 0, 0); boxName = new QComboBox(); gl1->addWidget(boxName, 0, 1); gl1->addWidget(new QLabel( tr("Order (1 - 9, 1 = linear)")), 1, 0); boxOrder = new QSpinBox(); boxOrder->setRange(1, 9); boxOrder->setValue(2); gl1->addWidget(boxOrder, 1, 1); gl1->addWidget(new QLabel( tr("Fit curve # pts")), 2, 0); boxPoints = new QSpinBox(); boxPoints->setRange(1, 1000); boxPoints->setSingleStep(50); boxPoints->setSpecialValueText(tr("Not enough points")); gl1->addWidget(boxPoints, 2, 1); gl1->addWidget(new QLabel( tr("Fit curve Xmin")), 3, 0); boxStart = new QLineEdit(tr("0")); gl1->addWidget(boxStart, 3, 1); gl1->addWidget(new QLabel( tr("Fit curve Xmax")), 4, 0); boxEnd = new QLineEdit(); gl1->addWidget(boxEnd, 4, 1); gl1->addWidget(new QLabel( tr("Color")), 5, 0); boxColor = new ColorBox(); boxColor->setColor(QColor(Qt::red)); gl1->addWidget(boxColor, 5, 1); boxShowFormula = new QCheckBox(tr( "Show Formula on Graph?" )); boxShowFormula->setChecked( false ); gl1->addWidget(boxShowFormula, 6, 1); gl1->setRowStretch(7, 1); buttonFit = new QPushButton(tr( "&Fit" )); buttonFit->setDefault( true ); buttonCancel = new QPushButton(tr( "&Close" )); QVBoxLayout* vl = new QVBoxLayout(); vl->addWidget(buttonFit); vl->addWidget(buttonCancel); vl->addStretch(); QHBoxLayout* hlayout = new QHBoxLayout(this); hlayout->addWidget(gb1); hlayout->addLayout(vl); connect( buttonFit, SIGNAL( clicked() ), this, SLOT( fit() ) ); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( boxName, SIGNAL( activated(const QString&) ), this, SLOT(activateCurve(const QString&))); }
QWidget *ConfigDialog::createMainWidget() { logMessage("ConfigDialog::createMainWidget()"); QWidget *mainWidget = new QWidget(this); // general cmbGUIStyle = new QComboBox(mainWidget); cmbGUIStyle->addItems(QStyleFactory::keys()); cmbGUIStyle->addItem("Manhattan"); cmbLanguage = new QComboBox(mainWidget); cmbLanguage->addItems(availableLanguages()); cmbDefaultPhysicField = new QComboBox(); fillComboBoxPhysicField(cmbDefaultPhysicField); QGridLayout *layoutGeneral = new QGridLayout(); layoutGeneral->addWidget(new QLabel(tr("UI:")), 0, 0); layoutGeneral->addWidget(cmbGUIStyle, 0, 1); layoutGeneral->addWidget(new QLabel(tr("Language:")), 1, 0); layoutGeneral->addWidget(cmbLanguage, 1, 1); layoutGeneral->addWidget(new QLabel(tr("Default physic field:")), 2, 0); layoutGeneral->addWidget(cmbDefaultPhysicField, 2, 1); QGroupBox *grpGeneral = new QGroupBox(tr("General")); grpGeneral->setLayout(layoutGeneral); // collaboration txtCollaborationServerURL = new SLineEditDouble(); QVBoxLayout *layoutCollaboration = new QVBoxLayout(); layoutCollaboration->addWidget(new QLabel(tr("Collaboration server URL:"))); layoutCollaboration->addWidget(txtCollaborationServerURL); QGroupBox *grpCollaboration = new QGroupBox(tr("Collaboration")); grpCollaboration->setLayout(layoutCollaboration); // logs chkEnabledApplicationLog = new QCheckBox(tr("Enabled application log")); chkEnabledProgressLog = new QCheckBox(tr("Enabled progress log")); cmdClearApplicationLog = new QPushButton(mainWidget); cmdClearApplicationLog->setText(tr("Clear application log")); connect(cmdClearApplicationLog, SIGNAL(clicked()), this, SLOT(doClearApplicationLog())); cmdClearCommandHistory = new QPushButton(mainWidget); cmdClearCommandHistory->setText(tr("Clear command history")); connect(cmdClearCommandHistory, SIGNAL(clicked()), this, SLOT(doClearCommandHistory())); QGridLayout *layoutClearButtons = new QGridLayout(); layoutClearButtons->addWidget(cmdClearApplicationLog, 0, 0); layoutClearButtons->addWidget(cmdClearCommandHistory, 0, 1); QVBoxLayout *layoutLogs = new QVBoxLayout(); layoutLogs->addWidget(chkEnabledProgressLog); layoutLogs->addWidget(chkEnabledApplicationLog); layoutLogs->addLayout(layoutClearButtons); QGroupBox *grpLogs = new QGroupBox(tr("Logs")); grpLogs->setLayout(layoutLogs); // other chkLineEditValueShowResult = new QCheckBox(tr("Show value result in line edit input")); chkCheckVersion = new QCheckBox(tr("Check new version during startup.")); chkExperimentalFeatures = new QCheckBox(tr("Enable experimental features")); chkExperimentalFeatures->setToolTip(tr("Warning: Agros2D should be unstable!")); QVBoxLayout *layoutOther = new QVBoxLayout(); layoutOther->addWidget(chkLineEditValueShowResult); layoutOther->addWidget(chkCheckVersion); layoutOther->addWidget(chkExperimentalFeatures); QGroupBox *grpOther = new QGroupBox(tr("Other")); grpOther->setLayout(layoutOther); // layout QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(grpGeneral); layout->addWidget(grpCollaboration); layout->addWidget(grpLogs); layout->addWidget(grpOther); layout->addStretch(); mainWidget->setLayout(layout); return mainWidget; }
KActionSelector::KActionSelector( QWidget *parent, const char *name ) : QWidget( parent, name ) { d = new KActionSelectorPrivate(); d->moveOnDoubleClick = true; d->keyboardEnabled = true; d->iconSize = SmallIcon; d->addIcon = QApplication::reverseLayout()? "back" : "forward"; d->removeIcon = QApplication::reverseLayout()? "forward" : "back"; d->upIcon = "up"; d->downIcon = "down"; d->availableInsertionPolicy = Sorted; d->selectedInsertionPolicy = BelowCurrent; d->showUpDownButtons = true; //int isz = IconSize( KIcon::Small ); QHBoxLayout *lo = new QHBoxLayout( this ); lo->setSpacing( KDialog::spacingHint() ); QVBoxLayout *loAv = new QVBoxLayout( lo ); d->lAvailable = new QLabel( i18n("&Available:"), this ); loAv->addWidget( d->lAvailable ); d->availableListBox = new QListBox( this ); loAv->addWidget( d->availableListBox ); d->lAvailable->setBuddy( d->availableListBox ); QVBoxLayout *loHBtns = new QVBoxLayout( lo ); loHBtns->addStretch( 1 ); d->btnAdd = new QToolButton( this ); loHBtns->addWidget( d->btnAdd ); d->btnRemove = new QToolButton( this ); loHBtns->addWidget( d->btnRemove ); loHBtns->addStretch( 1 ); QVBoxLayout *loS = new QVBoxLayout( lo ); d->lSelected = new QLabel( i18n("&Selected:"), this ); loS->addWidget( d->lSelected ); d->selectedListBox = new QListBox( this ); loS->addWidget( d->selectedListBox ); d->lSelected->setBuddy( d->selectedListBox ); QVBoxLayout *loVBtns = new QVBoxLayout( lo ); loVBtns->addStretch( 1 ); d->btnUp = new QToolButton( this ); d->btnUp->setAutoRepeat( true ); loVBtns->addWidget( d->btnUp ); d->btnDown = new QToolButton( this ); d->btnDown->setAutoRepeat( true ); loVBtns->addWidget( d->btnDown ); loVBtns->addStretch( 1 ); loadIcons(); connect( d->btnAdd, SIGNAL(clicked()), this, SLOT(buttonAddClicked()) ); connect( d->btnRemove, SIGNAL(clicked()), this, SLOT(buttonRemoveClicked()) ); connect( d->btnUp, SIGNAL(clicked()), this, SLOT(buttonUpClicked()) ); connect( d->btnDown, SIGNAL(clicked()), this, SLOT(buttonDownClicked()) ); connect( d->availableListBox, SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(itemDoubleClicked(QListBoxItem*)) ); connect( d->selectedListBox, SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(itemDoubleClicked(QListBoxItem*)) ); connect( d->availableListBox, SIGNAL(currentChanged(QListBoxItem*)), this, SLOT(slotCurrentChanged(QListBoxItem *)) ); connect( d->selectedListBox, SIGNAL(currentChanged(QListBoxItem*)), this, SLOT(slotCurrentChanged(QListBoxItem *)) ); d->availableListBox->installEventFilter( this ); d->selectedListBox->installEventFilter( this ); }
void SceneTransformDialog::createControls() { logMessage("SceneTransformDialog::createControls()"); // translate txtTranslateX = new ValueLineEdit(); txtTranslateY = new ValueLineEdit(); lstTranslateX = new QLabel(); lstTranslateY = new QLabel(); QGridLayout *layoutTranslate = new QGridLayout(); layoutTranslate->addWidget(lstTranslateX, 0, 0); layoutTranslate->addWidget(txtTranslateX, 0, 1); layoutTranslate->addWidget(lstTranslateY, 1, 0); layoutTranslate->addWidget(txtTranslateY, 1, 1); layoutTranslate->addWidget(new QLabel(""), 2, 0); widTranslate = new QWidget(); widTranslate->setLayout(layoutTranslate); // rotate txtRotateBasePointX = new ValueLineEdit(); txtRotateBasePointY = new ValueLineEdit(); txtRotateAngle = new ValueLineEdit(); lstRotateBasePointX = new QLabel(); lstRotateBasePointY = new QLabel(); QGridLayout *layoutRotate = new QGridLayout(); layoutRotate->addWidget(lstRotateBasePointX, 0, 0); layoutRotate->addWidget(txtRotateBasePointX, 0, 1); layoutRotate->addWidget(lstRotateBasePointY, 1, 0); layoutRotate->addWidget(txtRotateBasePointY, 1, 1); layoutRotate->addWidget(new QLabel(tr("Angle:")), 2, 0); layoutRotate->addWidget(txtRotateAngle, 2, 1); widRotate = new QWidget(); widRotate->setLayout(layoutRotate); // scale txtScaleBasePointX = new ValueLineEdit(); txtScaleBasePointY = new ValueLineEdit(); txtScaleFactor = new ValueLineEdit(); lstScaleBasePointX = new QLabel(); lstScaleBasePointY = new QLabel(); QGridLayout *layoutScale = new QGridLayout(); layoutScale->addWidget(lstScaleBasePointX, 0, 0); layoutScale->addWidget(txtScaleBasePointX, 0, 1); layoutScale->addWidget(lstScaleBasePointY, 1, 0); layoutScale->addWidget(txtScaleBasePointY, 1, 1); layoutScale->addWidget(new QLabel(tr("Scaling factor:")), 2, 0); layoutScale->addWidget(txtScaleFactor, 2, 1); widScale = new QWidget(); widScale->setLayout(layoutScale); // copy chkCopy = new QCheckBox(tr("Copy objects")); // dialog buttons QPushButton *btnApply = new QPushButton(tr("Apply")); btnApply->setDefault(true); connect(btnApply, SIGNAL(clicked()), this, SLOT(doTransform())); QPushButton *btnClose = new QPushButton(tr("Close")); connect(btnClose, SIGNAL(clicked()), this, SLOT(doClose())); QHBoxLayout *layoutButtonBox = new QHBoxLayout(); layoutButtonBox->addStretch(); layoutButtonBox->addWidget(btnApply); layoutButtonBox->addWidget(btnClose); // tab widget tabWidget = new QTabWidget(); tabWidget->addTab(widTranslate, icon(""), tr("Translate")); tabWidget->addTab(widRotate, icon(""), tr("Rotate")); tabWidget->addTab(widScale, icon(""), tr("Scale")); QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(tabWidget); layout->addWidget(chkCopy); layout->addStretch(); layout->addLayout(layoutButtonBox); setLayout(layout); }
GuitarChordSelectorDialog::GuitarChordSelectorDialog(QWidget *parent) : QDialog(parent) { QString localStyle = "QListView {background-color: #FFFFFF; alternate-background-color: #EEEEFF; color: #000000; selection-background-color: #80AFFF; selection-color: #FFFFFF;}"; // we'll use "localStyle" as a future search point, but switch over to a // more meaningful variable name for the actual style assignment // // Note that I'm just slapping another local stylesheet on these damn // QListView objects, because they're stubbornly refusing to be touched from // the external stylesheet, and I'm beyond losing patience with dicking // around to solve problems like this. Our stylesheet and style code are a // complete mess, and I will probably have to rewrite all of this one day, // but not before Thorn/Abraham Darby releases. QString listStyle = localStyle; setModal(true); setWindowTitle(tr("Guitar Chord Selector")); setWindowIcon(IconLoader().loadPixmap("window-guitar")); QGridLayout *metagrid = new QGridLayout; setLayout(metagrid); QGroupBox *page = new QGroupBox(this); QGridLayout *topLayout = new QGridLayout(page); metagrid->addWidget(page, 0, 0); topLayout->addWidget(new QLabel(tr("Root"), page), 0, 0); m_rootNotesList = new QListWidget(page); m_rootNotesList->setStyleSheet(listStyle); topLayout->addWidget(m_rootNotesList, 1, 0); topLayout->addWidget(new QLabel(tr("Extension"), page), 0, 1); m_chordExtList = new QListWidget(page); m_chordExtList->setStyleSheet(listStyle); topLayout->addWidget(m_chordExtList, 1, 1); m_newFingeringButton = new QPushButton(tr("New"), page); m_deleteFingeringButton = new QPushButton(tr("Delete"), page); m_editFingeringButton = new QPushButton(tr("Edit"), page); m_chordComplexityCombo = new QComboBox(page); m_chordComplexityCombo->addItem(tr("beginner")); m_chordComplexityCombo->addItem(tr("common")); m_chordComplexityCombo->addItem(tr("all")); //m_chordComplexityCombo->setMinimumContentsLength(20); connect(m_chordComplexityCombo, SIGNAL(activated(int)), this, SLOT(slotComplexityChanged(int))); page->setContentsMargins(5, 5, 5, 5); QVBoxLayout* vboxLayout = new QVBoxLayout(); //topLayout->addLayout(vboxLayout, 1, 2, 3, 1); topLayout->addLayout(vboxLayout, 2, 1); vboxLayout->addWidget(m_chordComplexityCombo); vboxLayout->addStretch(10); vboxLayout->addWidget(m_newFingeringButton); vboxLayout->addWidget(m_deleteFingeringButton); vboxLayout->addWidget(m_editFingeringButton); connect(m_newFingeringButton, SIGNAL(clicked()), this, SLOT(slotNewFingering())); connect(m_deleteFingeringButton, SIGNAL(clicked()), this, SLOT(slotDeleteFingering())); connect(m_editFingeringButton, SIGNAL(clicked()), this, SLOT(slotEditFingering())); topLayout->addWidget(new QLabel(tr("Fingerings"), page), 0, 3); m_fingeringsList = new QListWidget(page); m_fingeringsList->setStyleSheet(listStyle); // try setting size to something 200 can be divided into evenly, in the hope // of avoiding fuzzy half pixel scaling problems (50 was no good, but 100 // works well for grid lines here; dots still look awful, but who cares) m_fingeringsList->setIconSize(QSize(100, 100)); topLayout->addWidget(m_fingeringsList, 1, 3, 2, 1); m_fingeringBox = new FingeringBox(false, page, true); topLayout->addWidget(m_fingeringBox, 2, 0, 1, 2); connect(m_rootNotesList, SIGNAL(currentRowChanged(int)), this, SLOT(slotRootHighlighted(int))); connect(m_chordExtList, SIGNAL(currentRowChanged(int)), this, SLOT(slotChordExtHighlighted(int))); // connect itemClicked() so it will fire if a user clicks directly on the // fingering list doodad thingummy (and comments like "fingering list doodad // thingummy" are what you get when you abandon half-finished code the core // developers don't really understand, and expect them to keep it alive for // you in perpetuity) // connect(m_fingeringsList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotFingeringHighlighted(QListWidgetItem*))); // connect currentRowChanged() so this can be fired when other widgets are // manipulated, which will cause this one to pop back up to the top. This // slot triggers other updates in a leg bone connected to the thigh bone // fashion, so we have to wire it to some input to get those updates to // happen, and overloading this to fire two different ways was quick and // cheap // connect(m_fingeringsList, SIGNAL(currentRowChanged(int)), this, SLOT(slotFingeringHighlighted(int))); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); metagrid->addWidget(buttonBox, 1, 0); metagrid->setRowStretch(0, 10); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); }
AdjustLevelsPopup::AdjustLevelsPopup() : DVGui::Dialog(TApp::instance()->getMainWindow(), true, false, "AdjustLevels"), m_thresholdD(0.005) //0.5% of the image size { int i, j; setWindowTitle(tr("Adjust Levels")); setLabelWidth(0); setModal(false); setTopMargin(0); setTopSpacing(0); beginVLayout(); QSplitter *splitter = new QSplitter(Qt::Vertical); splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); addWidget(splitter); endVLayout(); //------------------------- Top Layout -------------------------- QScrollArea *scrollArea = new QScrollArea(splitter); scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); scrollArea->setWidgetResizable(true); scrollArea->setMinimumWidth(450); splitter->addWidget(scrollArea); splitter->setStretchFactor(0, 1); QFrame *topWidget = new QFrame(scrollArea); scrollArea->setWidget(topWidget); QVBoxLayout *topVLayout = new QVBoxLayout(topWidget); //Needed to justify at top topWidget->setLayout(topVLayout); QHBoxLayout *topLayout = new QHBoxLayout(topWidget); topVLayout->addLayout(topLayout); topVLayout->addStretch(1); //------------------------- Histogram --------------------------- m_histogram = new Histogram(topWidget); topLayout->addWidget(m_histogram); //------------------------- Mark Bars --------------------------- MarksBar *histogramMarksBar, *colorBarMarksBar; QVBoxLayout *histogramViewLayout; for (i = 0; i < 5; ++i) { HistogramView *view = m_histogram->getHistograms()->getHistogramView(i); histogramViewLayout = static_cast<QVBoxLayout *>(view->layout()); //Don't draw channel numbers view->channelBar()->setDrawNumbers(false); for (j = 0; j < 2; ++j) { EditableMarksBar *editableMarksBar = m_marksBar[j + (i << 1)] = new EditableMarksBar; MarksBar *marksBar = editableMarksBar->marksBar(); //Set margins up to cover the histogram editableMarksBar->layout()->setContentsMargins(6, 0, 5, 0); connect(editableMarksBar, SIGNAL(paramsChanged()), this, SLOT(onParamsChanged())); histogramViewLayout->insertWidget(1 + (j << 1), editableMarksBar); } } //------------------------- View Widget ------------------------- //NOTE: It's IMPORTANT that parent widget is supplied. It's somewhat //used by QSplitter to decide the initial widget sizes... m_viewer = new Swatch(splitter); m_viewer->setMinimumHeight(150); m_viewer->setFocusPolicy(Qt::WheelFocus); splitter->addWidget(m_viewer); //--------------------------- Buttons --------------------------- QVBoxLayout *buttonsLayout = new QVBoxLayout(topWidget); topLayout->addLayout(buttonsLayout); buttonsLayout->addSpacing(50); QPushButton *clampRange = new QPushButton(tr("Clamp"), topWidget); clampRange->setMinimumSize(65, 25); buttonsLayout->addWidget(clampRange); connect(clampRange, SIGNAL(clicked(bool)), this, SLOT(clampRange())); QPushButton *autoAdjust = new QPushButton(tr("Auto"), topWidget); autoAdjust->setMinimumSize(65, 25); buttonsLayout->addWidget(autoAdjust); connect(autoAdjust, SIGNAL(clicked(bool)), this, SLOT(autoAdjust())); QPushButton *resetBtn = new QPushButton(tr("Reset"), topWidget); resetBtn->setMinimumSize(65, 25); buttonsLayout->addWidget(resetBtn); connect(resetBtn, SIGNAL(clicked(bool)), this, SLOT(reset())); buttonsLayout->addStretch(1); m_okBtn = new QPushButton(tr("Apply")); addButtonBarWidget(m_okBtn); connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply())); //Finally, acquire current selection acquireRaster(); m_viewer->resize(0, 350); resize(600, 700); }
KAstTopLevel::KAstTopLevel( QWidget *parent) : QMainWindow(parent) { QWidget *border = new QWidget( this ); QPalette palette; palette.setColor(border->backgroundRole(), Qt::black); border->setPalette(palette); setCentralWidget( border ); QVBoxLayout *borderLayout = new QVBoxLayout( border ); borderLayout->addStretch( 1 ); QWidget *mainWin = new QWidget( border ); #if defined(Q_WS_MAEMO_5) mainWin->setFixedSize(800, 430); #elif defined(Q_OS_SYMBIAN) mainWin->setFixedSize(640, 340); #else mainWin->setFixedSize(640, 480); #endif borderLayout->addWidget( mainWin, 0, Qt::AlignHCenter ); borderLayout->addStretch( 1 ); view = new KAsteroidsView( mainWin ); view->setFocusPolicy( Qt::StrongFocus ); connect( view, SIGNAL(shipKilled()), SLOT(slotShipKilled()) ); connect( view, SIGNAL(rockHit(int)), SLOT(slotRockHit(int)) ); connect( view, SIGNAL(rocksRemoved()), SLOT(slotRocksRemoved()) ); connect( view, SIGNAL(updateVitals()), SLOT(slotUpdateVitals()) ); QVBoxLayout *vb = new QVBoxLayout( mainWin ); QHBoxLayout *hb = new QHBoxLayout; QHBoxLayout *hbd = new QHBoxLayout; vb->addLayout( hb ); #if defined(Q_OS_SYMBIAN) QFont labelFont( "helvetica", 8 ); #else QFont labelFont( "helvetica", 24 ); #endif QPalette pal(Qt::darkGreen, Qt::black, QColor( 128, 128, 128 ), QColor( 64, 64, 64 ), Qt::black, Qt::darkGreen, Qt::black); mainWin->setPalette( pal ); hb->addSpacing( 10 ); QLabel *label; label = new QLabel( tr("Score"), mainWin ); label->setFont( labelFont ); label->setPalette( pal ); label->setFixedWidth( label->sizeHint().width() ); hb->addWidget( label ); scoreLCD = new QLCDNumber( 6, mainWin ); scoreLCD->setFrameStyle( QFrame::NoFrame ); scoreLCD->setSegmentStyle( QLCDNumber::Flat ); scoreLCD->setFixedWidth( 150 ); scoreLCD->setPalette( pal ); hb->addWidget( scoreLCD ); hb->addStretch( 10 ); label = new QLabel( tr("Level"), mainWin ); label->setFont( labelFont ); label->setPalette( pal ); label->setFixedWidth( label->sizeHint().width() ); hb->addWidget( label ); levelLCD = new QLCDNumber( 2, mainWin ); levelLCD->setFrameStyle( QFrame::NoFrame ); levelLCD->setSegmentStyle( QLCDNumber::Flat ); levelLCD->setFixedWidth( 70 ); levelLCD->setPalette( pal ); hb->addWidget( levelLCD ); hb->addStretch( 10 ); label = new QLabel( tr("Ships"), mainWin ); label->setFont( labelFont ); label->setFixedWidth( label->sizeHint().width() ); label->setPalette( pal ); hb->addWidget( label ); shipsLCD = new QLCDNumber( 1, mainWin ); shipsLCD->setFrameStyle( QFrame::NoFrame ); shipsLCD->setSegmentStyle( QLCDNumber::Flat ); shipsLCD->setFixedWidth( 40 ); shipsLCD->setPalette( pal ); hb->addWidget( shipsLCD ); hb->addStrut( 30 ); vb->addWidget( view, 10 ); // -- bottom layout: vb->addLayout( hbd ); #if defined(Q_OS_SYMBIAN) QFont smallFont( "helvetica", 6 ); #else QFont smallFont( "helvetica", 14 ); #endif hbd->addSpacing( 10 ); QString sprites_prefix = ":/trolltech/examples/graphicsview/portedasteroids/sprites/"; /* label = new QLabel( tr( "T" ), mainWin ); label->setFont( smallFont ); label->setFixedWidth( label->sizeHint().width() ); label->setPalette( pal ); hbd->addWidget( label ); teleportsLCD = new QLCDNumber( 1, mainWin ); teleportsLCD->setFrameStyle( QFrame::NoFrame ); teleportsLCD->setSegmentStyle( QLCDNumber::Flat ); teleportsLCD->setPalette( pal ); teleportsLCD->setFixedHeight( 20 ); hbd->addWidget( teleportsLCD ); hbd->addSpacing( 10 ); */ QPixmap pm( sprites_prefix + "powerups/brake.png" ); label = new QLabel( mainWin ); label->setPixmap( pm ); label->setFixedWidth( label->sizeHint().width() ); label->setPalette( pal ); hbd->addWidget( label ); brakesLCD = new QLCDNumber( 1, mainWin ); brakesLCD->setFrameStyle( QFrame::NoFrame ); brakesLCD->setSegmentStyle( QLCDNumber::Flat ); brakesLCD->setPalette( pal ); brakesLCD->setFixedHeight( 20 ); hbd->addWidget( brakesLCD ); hbd->addSpacing( 10 ); pm.load( sprites_prefix + "powerups/shield.png" ); label = new QLabel( mainWin ); label->setPixmap( pm ); label->setFixedWidth( label->sizeHint().width() ); label->setPalette( pal ); hbd->addWidget( label ); shieldLCD = new QLCDNumber( 1, mainWin ); shieldLCD->setFrameStyle( QFrame::NoFrame ); shieldLCD->setSegmentStyle( QLCDNumber::Flat ); shieldLCD->setPalette( pal ); shieldLCD->setFixedHeight( 20 ); hbd->addWidget( shieldLCD ); hbd->addSpacing( 10 ); pm.load( sprites_prefix + "powerups/shoot.png" ); label = new QLabel( mainWin ); label->setPixmap( pm ); label->setFixedWidth( label->sizeHint().width() ); label->setPalette( pal ); hbd->addWidget( label ); shootLCD = new QLCDNumber( 1, mainWin ); shootLCD->setFrameStyle( QFrame::NoFrame ); shootLCD->setSegmentStyle( QLCDNumber::Flat ); shootLCD->setPalette( pal ); shootLCD->setFixedHeight( 20 ); hbd->addWidget( shootLCD ); hbd->addStretch( 1 ); label = new QLabel( tr( "Fuel" ), mainWin ); label->setFont( smallFont ); label->setFixedWidth( label->sizeHint().width() + 10 ); label->setPalette( pal ); hbd->addWidget( label ); powerMeter = new KALedMeter( mainWin ); powerMeter->setFrameStyle( QFrame::Box | QFrame::Plain ); powerMeter->setRange( MAX_POWER_LEVEL ); powerMeter->addColorRange( 10, Qt::darkRed ); powerMeter->addColorRange( 20, QColor(160, 96, 0) ); powerMeter->addColorRange( 70, Qt::darkGreen ); powerMeter->setCount( 40 ); powerMeter->setPalette( pal ); powerMeter->setFixedSize( 200, 12 ); hbd->addWidget( powerMeter ); shipsRemain = 3; showHiscores = FALSE; actions.insert( Qt::Key_Up, Thrust ); actions.insert( Qt::Key_Left, RotateLeft ); actions.insert( Qt::Key_Right, RotateRight ); actions.insert( Qt::Key_Space, Shoot ); actions.insert( Qt::Key_Z, Teleport ); actions.insert( Qt::Key_X, Brake ); actions.insert( Qt::Key_S, Shield ); actions.insert( Qt::Key_P, Pause ); actions.insert( Qt::Key_L, Launch ); actions.insert( Qt::Key_N, NewGame ); #if defined(Q_OS_SYMBIAN) actions.insert( 122, Teleport ); actions.insert( 120, Brake ); actions.insert( 115, Shield ); actions.insert( 112, Pause ); actions.insert( 108, Launch ); actions.insert( 110, NewGame ); #endif view->showText( tr( "Press N to start playing" ), Qt::yellow ); }
void GUI::initialize() { readFeatureList(); KeyWordSearch::getInstance().initialize(); QGroupBox * input = new QGroupBox("Input"); QHBoxLayout * inputArea = new QHBoxLayout(); int width = this->width(); int height = this->height(); auto inputTextEdit = createLineEdit("input", { 0.03f*width ,0.05f* height }, { 200,15 }); inputTextEdit->setParent(this); auto recommnedButton = createButton("RecommendButton", "Find", { 0.5f * width, 0.05* height }, { 50,20 }); recommnedButton->setParent(this); inputArea->addWidget(inputTextEdit); inputArea->addWidget(recommnedButton); inputArea->addStretch(1); input->setLayout(inputArea); QGroupBox * output = new QGroupBox("Output"); outputButtons = new QGroupBox("Output"); QHBoxLayout * outputArea = new QHBoxLayout(); //auto outputTextEdit = createLineEdit("output", { 0.03f*width ,0.05f* height }, { 500,500 }); auto outputTextEdit = createTextDisplay("OutputText", { 0,0 }, { 300,500 }, false); auto recommendeOutTextEdit = createTextDisplay("RecommendedOutputText", { 0,0 }, { 300,500 }, false); recommendeOutTextEdit->setParent(this); outputTextEdit->setParent(this); outputArea->addWidget(outputTextEdit); outputArea->addWidget(recommendeOutTextEdit); QVBoxLayout * outputButtonArea = new QVBoxLayout(); auto itr = featureList.begin(); auto itrEnd = featureList.end(); while (itr != itrEnd) { auto label = new QLabel((itr->first).c_str()); label->setParent(this); outputButtonArea->addWidget(label); auto itrVector = itr->second.begin(); auto itrVectorEnd = itr->second.end(); while (itrVector != itrVectorEnd) { auto button1 = createCheckBox(*itrVector, *itrVector, { 0,0 }, false); button1->setParent(this); outputButtonArea->addWidget(button1); ++itrVector; } ++itr; } auto button2 = createButton("FilterSearch", "Search"); outputButtonArea->addWidget(button2); outputButtonArea->addStretch(1); outputButtons->setLayout(outputButtonArea); outputArea->addWidget(outputButtons); outputButtons->setVisible(false); output->setLayout(outputArea); outputArea->addStretch(1); mainLayout->addWidget(input); mainLayout->addWidget(output); mainLayout->addStretch(1); connectToTask(); }
QWidget *ConfigDialog::createViewWidget() { logMessage("ConfigDialog::createViewWidget()"); // geometry txtGeometryNodeSize = new SLineEditDouble(); // txtGeometryNodeSize->setMaximumWidth(60); txtGeometryEdgeWidth = new SLineEditDouble(); // txtGeometryEdgeWidth->setMaximumWidth(60); txtGeometryLabelSize = new SLineEditDouble(); // txtGeometryLabelSize->setMaximumWidth(60); QGridLayout *layoutGeometry = new QGridLayout(); layoutGeometry->addWidget(new QLabel(tr("Node size:")), 0, 0); layoutGeometry->addWidget(txtGeometryNodeSize, 0, 1); layoutGeometry->addWidget(new QLabel(tr("Edge width:")), 1, 0); layoutGeometry->addWidget(txtGeometryEdgeWidth, 1, 1); layoutGeometry->addWidget(new QLabel(tr("Label size:")), 2, 0); layoutGeometry->addWidget(txtGeometryLabelSize, 2, 1); QGroupBox *grpGeometry = new QGroupBox(tr("Geometry")); grpGeometry->setLayout(layoutGeometry); // others; chkZoomToMouse = new QCheckBox(tr("Zoom to mouse pointer")); QVBoxLayout *layoutOther = new QVBoxLayout(); layoutOther->addWidget(chkZoomToMouse); QGroupBox *grpOther = new QGroupBox(tr("Other")); grpOther->setLayout(layoutOther); // layout general QVBoxLayout *layoutGeneral = new QVBoxLayout(); layoutGeneral->addWidget(grpGeometry); layoutGeneral->addWidget(grpOther); layoutGeneral->addStretch(); QWidget *widgetGeneral = new QWidget(this); widgetGeneral->setLayout(layoutGeneral); // scalar view log scale chkScalarFieldRangeLog = new QCheckBox(tr("Log. scale")); txtScalarFieldRangeBase = new QLineEdit("10"); connect(chkScalarFieldRangeLog, SIGNAL(stateChanged(int)), this, SLOT(doScalarFieldLog(int))); txtScalarDecimalPlace = new QSpinBox(this); txtScalarDecimalPlace->setMinimum(1); txtScalarDecimalPlace->setMaximum(10); QGridLayout *layoutScalarField = new QGridLayout(); layoutScalarField->addWidget(new QLabel(tr("Base:")), 0, 0); layoutScalarField->addWidget(txtScalarFieldRangeBase, 0, 1); layoutScalarField->addWidget(chkScalarFieldRangeLog, 0, 2); layoutScalarField->addWidget(new QLabel(tr("Decimal places:")), 1, 0); layoutScalarField->addWidget(txtScalarDecimalPlace, 1, 1); QGroupBox *grpScalarField = new QGroupBox(tr("Scalar view")); grpScalarField->setLayout(layoutScalarField); // layout 3d chkView3DLighting = new QCheckBox(tr("Ligthing"), this); txtView3DAngle = new QDoubleSpinBox(this); txtView3DAngle->setDecimals(1); txtView3DAngle->setSingleStep(1); txtView3DAngle->setMinimum(30); txtView3DAngle->setMaximum(360); chkView3DBackground = new QCheckBox(tr("Gradient background"), this); txtView3DHeight = new QDoubleSpinBox(this); txtView3DHeight->setDecimals(1); txtView3DHeight->setSingleStep(0.1); txtView3DHeight->setMinimum(0.2); txtView3DHeight->setMaximum(10.0); QGridLayout *layout3D = new QGridLayout(); layout3D->addWidget(new QLabel(tr("Angle:")), 0, 1); layout3D->addWidget(txtView3DAngle, 0, 2); layout3D->addWidget(chkView3DLighting, 0, 3); layout3D->addWidget(new QLabel(tr("Height:")), 1, 1); layout3D->addWidget(txtView3DHeight, 1, 2); layout3D->addWidget(chkView3DBackground, 1, 3); QGroupBox *grp3D = new QGroupBox(tr("3D")); grp3D->setLayout(layout3D); // layout deform shape chkDeformScalar = new QCheckBox(tr("Scalar field"), this); chkDeformContour = new QCheckBox(tr("Contours"), this); chkDeformVector = new QCheckBox(tr("Vector field"), this); QGridLayout *layoutDeformShape = new QGridLayout(); layoutDeformShape->addWidget(chkDeformScalar, 0, 0); layoutDeformShape->addWidget(chkDeformContour, 0, 1); layoutDeformShape->addWidget(chkDeformVector, 0, 2); QGroupBox *grpDeformShape = new QGroupBox(tr("Deform shape")); grpDeformShape->setLayout(layoutDeformShape); // layout postprocessor QVBoxLayout *layoutPostprocessor = new QVBoxLayout(); layoutPostprocessor->addWidget(grpScalarField); layoutPostprocessor->addWidget(grp3D); layoutPostprocessor->addWidget(grpDeformShape); layoutPostprocessor->addStretch(); QWidget *widgetPostprocessor = new QWidget(this); widgetPostprocessor->setLayout(layoutPostprocessor); QTabWidget *tabType = new QTabWidget(this); tabType->addTab(widgetGeneral, icon(""), tr("General")); tabType->addTab(widgetPostprocessor, icon(""), tr("Postprocessor")); return tabType; }
void GL3DScales::SetupLayout() { QSizePolicy szPolicyMinimum; szPolicyMinimum.setHorizontalPolicy(QSizePolicy::Minimum); szPolicyMinimum.setVerticalPolicy(QSizePolicy::Minimum); setSizePolicy(szPolicyMinimum); QSizePolicy szPolicyExpanding; szPolicyExpanding.setHorizontalPolicy(QSizePolicy::Expanding); szPolicyExpanding.setVerticalPolicy(QSizePolicy::Expanding); QGroupBox *CpScaleBox = new QGroupBox(tr("Cp Scale")); { QGridLayout *CpScaleLayout = new QGridLayout; m_pctrlAutoCpScale = new QCheckBox(tr("Auto Scales")); m_pctrlLegendMin = new FloatEdit(61.234); m_pctrlLegendMax = new FloatEdit(3.5555); m_pctrlLegendMin->SetPrecision(2); m_pctrlLegendMax->SetPrecision(2); QLabel *lab0 = new QLabel(tr("Min")); QLabel *lab1 = new QLabel(tr("Max")); lab0->setAlignment(Qt::AlignVCenter |Qt::AlignRight); lab1->setAlignment(Qt::AlignVCenter |Qt::AlignRight); CpScaleLayout->addWidget(m_pctrlAutoCpScale,1,2); CpScaleLayout->addWidget(lab0,2,1); CpScaleLayout->addWidget(m_pctrlLegendMin,2,2); CpScaleLayout->addWidget(lab1,3,1); CpScaleLayout->addWidget(m_pctrlLegendMax,3,2); CpScaleBox->setLayout(CpScaleLayout); } //_______________________3D Scales QGroupBox *ScaleBox = new QGroupBox(tr("Vector Scales")); { QVBoxLayout *SliderLayout = new QVBoxLayout; m_pctrlLiftScaleSlider = new QSlider(Qt::Horizontal); m_pctrlLiftScaleSlider->setMinimum(0); m_pctrlLiftScaleSlider->setMaximum(100); m_pctrlLiftScaleSlider->setSliderPosition(50); m_pctrlLiftScaleSlider->setTickInterval(5); m_pctrlLiftScaleSlider->setTickPosition(QSlider::TicksBelow); m_pctrlDragScaleSlider = new QSlider(Qt::Horizontal); m_pctrlDragScaleSlider->setMinimum(0); m_pctrlDragScaleSlider->setMaximum(100); m_pctrlDragScaleSlider->setSliderPosition(50); m_pctrlDragScaleSlider->setTickInterval(5); m_pctrlDragScaleSlider->setTickPosition(QSlider::TicksBelow); m_pctrlVelocityScaleSlider = new QSlider(Qt::Horizontal); m_pctrlVelocityScaleSlider->setMinimum(0); m_pctrlVelocityScaleSlider->setMaximum(100); m_pctrlVelocityScaleSlider->setSliderPosition(50); m_pctrlVelocityScaleSlider->setTickInterval(5); m_pctrlVelocityScaleSlider->setTickPosition(QSlider::TicksBelow); SliderLayout->addWidget(m_pctrlLiftScaleSlider); SliderLayout->addWidget(m_pctrlDragScaleSlider); SliderLayout->addWidget(m_pctrlVelocityScaleSlider); QVBoxLayout *LabelLayout = new QVBoxLayout; QLabel *lab2 = new QLabel(tr("Lift ")); QLabel *lab3 = new QLabel(tr("Drag ")); QLabel *lab4 = new QLabel(tr("Velocity ")); LabelLayout->addWidget(lab2); LabelLayout->addWidget(lab3); LabelLayout->addWidget(lab4); QHBoxLayout *ScaleLayout = new QHBoxLayout; ScaleLayout->addLayout(LabelLayout); ScaleLayout->addLayout(SliderLayout); ScaleBox->setLayout(ScaleLayout); } //__________________________________ Streamlines QGroupBox *LengthBox = new QGroupBox(tr("Streamline length")); { m_pctrlNXPoint = new FloatEdit(33,0); m_pctrlNXPoint->SetPrecision(0); m_pctrlDeltaL = new FloatEdit(12.34,2); m_pctrlXFactor = new FloatEdit(1.23,2); m_pctrlLengthUnit1 = new QLabel("miles"); QLabel *lab5 = new QLabel(tr("X-axis points")); QLabel *lab6 = new QLabel(tr("1st segment")); QLabel *lab7 = new QLabel(tr("X factor")); lab5->setAlignment(Qt::AlignVCenter |Qt::AlignRight); lab6->setAlignment(Qt::AlignVCenter |Qt::AlignRight); lab7->setAlignment(Qt::AlignVCenter |Qt::AlignRight); QGridLayout *LengthLayout = new QGridLayout; LengthLayout->addWidget(lab5, 1, 1); LengthLayout->addWidget(m_pctrlNXPoint , 1, 2); LengthLayout->addWidget(lab6, 2, 1); LengthLayout->addWidget(m_pctrlDeltaL, 2, 2); LengthLayout->addWidget(m_pctrlLengthUnit1, 2, 3); LengthLayout->addWidget(lab7, 3, 1); LengthLayout->addWidget(m_pctrlXFactor, 3, 2); LengthBox->setLayout(LengthLayout); } QGroupBox *StartBox = new QGroupBox(tr("Start Streamline at")); { QHBoxLayout *LineLayout = new QHBoxLayout; { m_pctrlLE = new QRadioButton(tr("L.E.")); m_pctrlTE = new QRadioButton(tr("T.E.")); m_pctrlYLine = new QRadioButton(tr("Y-Line")); m_pctrlZLine = new QRadioButton(tr("Z-Line")); LineLayout->addWidget(m_pctrlLE); LineLayout->addWidget(m_pctrlTE); LineLayout->addWidget(m_pctrlYLine); LineLayout->addWidget(m_pctrlZLine); } QGridLayout *OffsetLayout = new QGridLayout; { m_pctrlXOffset = new FloatEdit(3.21,3); m_pctrlYOffset = new FloatEdit(4.56,3); m_pctrlZOffset = new FloatEdit(7.89,3); m_pctrlLengthUnit2 = new QLabel("km"); m_pctrlLengthUnit3 = new QLabel("m"); m_pctrlLengthUnit4 = new QLabel("light-year"); m_pctrlLengthUnit5 = new QLabel("nanometer"); QLabel *lab8 = new QLabel(tr("X-Offset")); QLabel *lab9 = new QLabel(tr("Y-Offset")); QLabel *lab10 = new QLabel(tr("Z-Offset")); lab8->setAlignment(Qt::AlignVCenter |Qt::AlignRight); lab9->setAlignment(Qt::AlignVCenter |Qt::AlignRight); lab10->setAlignment(Qt::AlignVCenter |Qt::AlignRight); m_pctrlNStreamLines = new FloatEdit(29, 0); m_pctrlStreamLineSpacing = new FloatEdit(.3, 2); QLabel *lab11 = new QLabel(tr("N Streamlines =")); QLabel *lab12 = new QLabel(tr("Spacing =")); lab11->setAlignment(Qt::AlignVCenter |Qt::AlignRight); lab12->setAlignment(Qt::AlignVCenter |Qt::AlignRight); OffsetLayout->addWidget(lab8,1,1); OffsetLayout->addWidget(m_pctrlXOffset,1,2); OffsetLayout->addWidget(m_pctrlLengthUnit2,1,3); OffsetLayout->addWidget(lab9,2,1); OffsetLayout->addWidget(m_pctrlYOffset,2,2); OffsetLayout->addWidget(m_pctrlLengthUnit3,2,3); OffsetLayout->addWidget(lab10,3,1); OffsetLayout->addWidget(m_pctrlZOffset,3,2); OffsetLayout->addWidget(m_pctrlLengthUnit4,3,3); OffsetLayout->addWidget(lab11,4,1); OffsetLayout->addWidget(m_pctrlNStreamLines,4,2); OffsetLayout->addWidget(lab12,5,1); OffsetLayout->addWidget(m_pctrlStreamLineSpacing,5,2); OffsetLayout->addWidget(m_pctrlLengthUnit5,5,3); } QVBoxLayout *StartLayout = new QVBoxLayout; { StartLayout->addLayout(LineLayout); StartLayout->addLayout(OffsetLayout); StartBox->setLayout(StartLayout); } } QGroupBox *StreamBox = new QGroupBox(tr("Streamlines")); { ApplyButton = new QPushButton(tr("Apply")); QVBoxLayout *StreamLayout = new QVBoxLayout; StreamLayout->addWidget(LengthBox); StreamLayout->addWidget(StartBox); StreamLayout->addStretch(1); StreamLayout->addWidget(ApplyButton); StreamLayout->addStretch(1); StreamBox->setLayout(StreamLayout); } QVBoxLayout *MainLayout = new QVBoxLayout; MainLayout->addStretch(1); MainLayout->addWidget(ScaleBox); MainLayout->addSpacing(15); MainLayout->addStretch(1); MainLayout->addWidget(CpScaleBox); MainLayout->addSpacing(15); MainLayout->addStretch(1); MainLayout->addWidget(StreamBox); MainLayout->addStretch(1); setLayout(MainLayout); }
QWidget *ConfigDialog::createSolverWidget() { logMessage("ConfigDialog::createSolverWidget()"); // general chkDeleteTriangleMeshFiles = new QCheckBox(tr("Delete files with initial mesh (Triangle)")); chkDeleteHermes2DMeshFile = new QCheckBox(tr("Delete files with solution mesh (Hermes2D)")); if (Util::config()->showExperimentalFeatures) chkSaveWithSolution = new QCheckBox(tr("Save problem with solution")); chkShowConvergenceChart = new QCheckBox(tr("Show convergence chart after solving")); QVBoxLayout *layoutSolver = new QVBoxLayout(); layoutSolver->addWidget(chkDeleteTriangleMeshFiles); layoutSolver->addWidget(chkDeleteHermes2DMeshFile); if (Util::config()->showExperimentalFeatures) layoutSolver->addWidget(chkSaveWithSolution); layoutSolver->addWidget(chkShowConvergenceChart); QGroupBox *grpSolver = new QGroupBox(tr("Solver")); grpSolver->setLayout(layoutSolver); txtMeshAngleSegmentsCount = new QSpinBox(this); txtMeshAngleSegmentsCount->setMinimum(2); txtMeshAngleSegmentsCount->setMaximum(20); chkMeshCurvilinearElements = new QCheckBox(tr("Curvilinear elements")); QGridLayout *layoutMesh = new QGridLayout(); layoutMesh->addWidget(new QLabel(tr("Angle segments count:")), 0, 0); layoutMesh->addWidget(txtMeshAngleSegmentsCount, 0, 1); layoutMesh->addWidget(chkMeshCurvilinearElements, 1, 0, 1, 2); QGroupBox *grpMesh = new QGroupBox(tr("Mesh")); grpMesh->setLayout(layoutMesh); QVBoxLayout *layoutGeneral = new QVBoxLayout(); layoutGeneral->addWidget(grpSolver); layoutGeneral->addWidget(grpMesh); layoutGeneral->addStretch(); QWidget *solverGeneralWidget = new QWidget(this); solverGeneralWidget->setLayout(layoutGeneral); // adaptivity lblMaxDofs = new QLabel(tr("Maximum number of DOFs:")); txtMaxDOFs = new QSpinBox(this); txtMaxDOFs->setMinimum(1e2); txtMaxDOFs->setMaximum(1e9); txtMaxDOFs->setSingleStep(1e2); /* chkIsoOnly = new QCheckBox(tr("Isotropic refinement")); lblIsoOnly = new QLabel(tr("<table>" "<tr><td><b>true</b></td><td>isotropic refinement</td></tr>" "<tr><td><b>false</b></td><td>anisotropic refinement</td></tr>" "</table>")); */ txtConvExp = new SLineEditDouble(); lblConvExp = new QLabel(tr("<b></b>default value is 1.0, this parameter influences<br/>the selection of candidates in hp-adaptivity")); txtThreshold = new SLineEditDouble(); lblThreshold = new QLabel(tr("<b></b>quantitative parameter of the adapt(...) function<br/>with different meanings for various adaptive strategies")); cmbStrategy = new QComboBox(); cmbStrategy->addItem(tr("0"), 0); cmbStrategy->addItem(tr("1"), 1); cmbStrategy->addItem(tr("2"), 2); lblStrategy = new QLabel(tr("<table>" "<tr><td><b>0</b></td><td>refine elements until sqrt(<b>threshold</b>)<br/>times total error is processed.<br/>If more elements have similar errors,<br/>refine all to keep the mesh symmetric</td></tr>" "<tr><td><b>1</b></td><td>refine all elements<br/>whose error is larger than <b>threshold</b><br/>times maximum element error</td></tr>" "<tr><td><b>2</b></td><td>refine all elements<br/>whose error is larger than <b>threshold</b></td></tr>" "</table>")); cmbMeshRegularity = new QComboBox(); cmbMeshRegularity->addItem(tr("arbitrary level hang. nodes"), -1); cmbMeshRegularity->addItem(tr("at most one-level hang. nodes"), 1); cmbMeshRegularity->addItem(tr("at most two-level hang. nodes"), 2); cmbMeshRegularity->addItem(tr("at most three-level hang. nodes"), 3); cmbMeshRegularity->addItem(tr("at most four-level hang. nodes"), 4); cmbMeshRegularity->addItem(tr("at most five-level hang. nodes"), 5); cmbProjNormType = new QComboBox(); cmbProjNormType->addItem(errorNormString(HERMES_H1_NORM), HERMES_H1_NORM); cmbProjNormType->addItem(errorNormString(HERMES_L2_NORM), HERMES_L2_NORM); cmbProjNormType->addItem(errorNormString(HERMES_H1_SEMINORM), HERMES_H1_SEMINORM); // default QPushButton *btnAdaptivityDefault = new QPushButton(tr("Default")); connect(btnAdaptivityDefault, SIGNAL(clicked()), this, SLOT(doAdaptivityDefault())); QGridLayout *layoutAdaptivitySettings = new QGridLayout(); layoutAdaptivitySettings->addWidget(lblMaxDofs, 0, 0); layoutAdaptivitySettings->addWidget(txtMaxDOFs, 0, 1, 1, 2); layoutAdaptivitySettings->addWidget(new QLabel(tr("Conv. exp.:")), 2, 0); layoutAdaptivitySettings->addWidget(txtConvExp, 2, 1); layoutAdaptivitySettings->addWidget(lblConvExp, 3, 0, 1, 2); layoutAdaptivitySettings->addWidget(new QLabel(tr("Strategy:")), 4, 0); layoutAdaptivitySettings->addWidget(cmbStrategy, 4, 1); layoutAdaptivitySettings->addWidget(lblStrategy, 5, 0, 1, 2); layoutAdaptivitySettings->addWidget(new QLabel(tr("Threshold:")), 6, 0); layoutAdaptivitySettings->addWidget(txtThreshold, 6, 1); layoutAdaptivitySettings->addWidget(lblThreshold, 7, 0, 1, 2); layoutAdaptivitySettings->addWidget(new QLabel(tr("Mesh regularity:")), 8, 0); layoutAdaptivitySettings->addWidget(cmbMeshRegularity, 8, 1); layoutAdaptivitySettings->addWidget(new QLabel(tr("Norm:")), 9, 0); layoutAdaptivitySettings->addWidget(cmbProjNormType, 9, 1); QVBoxLayout *layoutAdaptivity = new QVBoxLayout(); layoutAdaptivity->addLayout(layoutAdaptivitySettings); layoutAdaptivity->addStretch(); layoutAdaptivity->addWidget(btnAdaptivityDefault, 0, Qt::AlignLeft); QWidget *solverAdaptivityWidget = new QWidget(this); solverAdaptivityWidget->setLayout(layoutAdaptivity); // commands txtArgumentTriangle = new QLineEdit(""); txtArgumentFFmpeg = new QLineEdit(""); // default QPushButton *btnCommandsDefault = new QPushButton(tr("Default")); connect(btnCommandsDefault, SIGNAL(clicked()), this, SLOT(doCommandsDefault())); QVBoxLayout *layoutCommands = new QVBoxLayout(); layoutCommands->addWidget(new QLabel(tr("Triangle"))); layoutCommands->addWidget(txtArgumentTriangle); layoutCommands->addWidget(new QLabel(tr("FFmpeg"))); layoutCommands->addWidget(txtArgumentFFmpeg); layoutCommands->addStretch(); layoutCommands->addWidget(btnCommandsDefault, 0, Qt::AlignLeft); QWidget *solverCommandsWidget = new QWidget(this); solverCommandsWidget->setLayout(layoutCommands); QTabWidget *solverWidget = new QTabWidget(this); solverWidget->addTab(solverGeneralWidget, icon(""), tr("General")); solverWidget->addTab(solverAdaptivityWidget, icon(""), tr("Adaptivity")); solverWidget->addTab(solverCommandsWidget, icon(""), tr("Commands")); return solverWidget; }
Transform3DWidget::Transform3DWidget(QWidget* parent) : BaseWidget(parent, "Transform3DWidget", "Transform 3D") { this->setToolTip("Display and manipulate an affine (rotation+translation) matrix"); recursive = false; mBlockChanges = false; //layout QVBoxLayout* toptopLayout = new QVBoxLayout(this); toptopLayout->setMargin(4); QHBoxLayout* mLayout = new QHBoxLayout; mLayout->setMargin(0); toptopLayout->addLayout(mLayout); mTextEdit = new MatrixTextEdit; mTextEdit->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum); mTextEdit->setLineWrapMode(QTextEdit::NoWrap); mTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); mTextEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); connect(mTextEdit, SIGNAL(textChanged()), this, SLOT(textEditChangedSlot())); mLayout->addWidget(mTextEdit, 1); QVBoxLayout* buttonLayout = new QVBoxLayout; mLayout->addLayout(buttonLayout); buttonLayout->setMargin(0); mEditAction = this->createAction(this, QIcon(":/icons/open_icon_library/system-run-5.png"), "Edit", "Toggle Edit Matrix", SLOT(toggleEditSlot()), buttonLayout); mEditAction->setCheckable(true); mInvertAction = this->createAction(this, QIcon(":/icons/matrix_inverse.png"), "Invert", "Toggle Invert Matrix", SLOT(toggleInvertSlot()), buttonLayout); mInvertAction->setCheckable(true); mInvertAction->setChecked(false); this->updateInvertAction(); // mLayout->addStretch(); aGroupBox = new QFrame(this); QVBoxLayout* aLayout = new QVBoxLayout; aGroupBox->setLayout(aLayout); aGroupBox->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); aGroupBox->setLineWidth(3); aLayout->setMargin(4); toptopLayout->addWidget(aGroupBox); this->addAngleControls("xAngle", "X Angle", 0, aLayout); this->addAngleControls("yAngle", "Y Angle", 1, aLayout); this->addAngleControls("zAngle", "Z Angle", 2, aLayout); tGroupBox = new QFrame(this); QVBoxLayout* tLayout = new QVBoxLayout; tGroupBox->setLayout(tLayout); tGroupBox->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); tGroupBox->setLineWidth(3); tLayout->setMargin(4); toptopLayout->addWidget(tGroupBox); this->addTranslationControls("xTranslation", "X", 0, tLayout); this->addTranslationControls("yTranslation", "Y", 1, tLayout); this->addTranslationControls("zTranslation", "Z", 2, tLayout); this->setMatrixInternal(Transform3D::Identity()); toptopLayout->addStretch(); this->setEditable(false); }
QWidget *ConfigDialog::createColorsWidget() { logMessage("ConfigDialog::createColorsWidget()"); QWidget *colorsWidget = new QWidget(this); // colors colorBackground = new ColorButton(this); colorGrid = new ColorButton(this); colorCross = new ColorButton(this); colorNodes = new ColorButton(this); colorEdges = new ColorButton(this); colorLabels = new ColorButton(this); colorContours = new ColorButton(this); colorVectors = new ColorButton(this); colorInitialMesh = new ColorButton(this); colorSolutionMesh = new ColorButton(this); colorHighlighted = new ColorButton(this); colorSelected = new ColorButton(this); QGridLayout *layoutColors = new QGridLayout(); layoutColors->addWidget(new QLabel(tr("Background:")), 0, 0); layoutColors->addWidget(new QLabel(tr("Grid:")), 1, 0); layoutColors->addWidget(new QLabel(tr("Cross:")), 2, 0); layoutColors->addWidget(new QLabel(tr("Nodes:")), 3, 0); layoutColors->addWidget(new QLabel(tr("Edges:")), 4, 0); layoutColors->addWidget(new QLabel(tr("Labels:")), 5, 0); layoutColors->addWidget(new QLabel(tr("Contours:")), 6, 0); layoutColors->addWidget(new QLabel(tr("Vectors:")), 7, 0); layoutColors->addWidget(new QLabel(tr("Initial mesh:")), 8, 0); layoutColors->addWidget(new QLabel(tr("Solution mesh:")), 9, 0); layoutColors->addWidget(new QLabel(tr("Highlighted elements:")), 10, 0); layoutColors->addWidget(new QLabel(tr("Selected elements:")), 11, 0); layoutColors->addWidget(colorBackground, 0, 1); layoutColors->addWidget(colorGrid, 1, 1); layoutColors->addWidget(colorCross, 2, 1); layoutColors->addWidget(colorNodes, 3, 1); layoutColors->addWidget(colorEdges, 4, 1); layoutColors->addWidget(colorLabels, 5, 1); layoutColors->addWidget(colorContours, 6, 1); layoutColors->addWidget(colorVectors, 7, 1); layoutColors->addWidget(colorInitialMesh, 8, 1); layoutColors->addWidget(colorSolutionMesh, 9, 1); layoutColors->addWidget(colorHighlighted, 10, 1); layoutColors->addWidget(colorSelected, 11, 1); // default QPushButton *btnDefault = new QPushButton(tr("Default")); connect(btnDefault, SIGNAL(clicked()), this, SLOT(doColorsDefault())); QGroupBox *grpColor = new QGroupBox(tr("Colors")); grpColor->setLayout(layoutColors); QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(grpColor); layout->addStretch(); layout->addWidget(btnDefault, 0, Qt::AlignLeft); colorsWidget->setLayout(layout); return colorsWidget; }
GradientWidget::GradientWidget(QWidget *parent) : QWidget(parent) { setWindowTitle(tr("Gradients")); m_renderer = new GradientRenderer(this); QGroupBox *mainGroup = new QGroupBox(this); mainGroup->setTitle(tr("Gradients")); QGroupBox *editorGroup = new QGroupBox(mainGroup); editorGroup->setTitle(tr("Color Editor")); m_editor = new GradientEditor(editorGroup); QGroupBox *typeGroup = new QGroupBox(mainGroup); typeGroup->setTitle(tr("Gradient Type")); m_linearButton = new QRadioButton(tr("Linear Gradient"), typeGroup); m_radialButton = new QRadioButton(tr("Radial Gradient"), typeGroup); m_conicalButton = new QRadioButton(tr("Conical Gradient"), typeGroup); QGroupBox *spreadGroup = new QGroupBox(mainGroup); spreadGroup->setTitle(tr("Spread Method")); m_padSpreadButton = new QRadioButton(tr("Pad Spread"), spreadGroup); m_reflectSpreadButton = new QRadioButton(tr("Reflect Spread"), spreadGroup); m_repeatSpreadButton = new QRadioButton(tr("Repeat Spread"), spreadGroup); QGroupBox *defaultsGroup = new QGroupBox(mainGroup); defaultsGroup->setTitle(tr("Defaults")); QPushButton *default1Button = new QPushButton(tr("1"), defaultsGroup); QPushButton *default2Button = new QPushButton(tr("2"), defaultsGroup); QPushButton *default3Button = new QPushButton(tr("3"), defaultsGroup); QPushButton *default4Button = new QPushButton(tr("Reset"), editorGroup); QPushButton *showSourceButton = new QPushButton(mainGroup); showSourceButton->setText(tr("Show Source")); #ifdef QT_OPENGL_SUPPORT QPushButton *enableOpenGLButton = new QPushButton(mainGroup); enableOpenGLButton->setText(tr("Use OpenGL")); enableOpenGLButton->setCheckable(true); enableOpenGLButton->setChecked(m_renderer->usesOpenGL()); if (!QGLFormat::hasOpenGL()) enableOpenGLButton->hide(); #endif QPushButton *whatsThisButton = new QPushButton(mainGroup); whatsThisButton->setText(tr("What's This?")); whatsThisButton->setCheckable(true); // Layouts QHBoxLayout *mainLayout = new QHBoxLayout(this); mainLayout->addWidget(m_renderer); mainLayout->addWidget(mainGroup); mainGroup->setFixedWidth(180); QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup); mainGroupLayout->addWidget(editorGroup); mainGroupLayout->addWidget(typeGroup); mainGroupLayout->addWidget(spreadGroup); mainGroupLayout->addWidget(defaultsGroup); mainGroupLayout->addStretch(1); mainGroupLayout->addWidget(showSourceButton); #ifdef QT_OPENGL_SUPPORT mainGroupLayout->addWidget(enableOpenGLButton); #endif mainGroupLayout->addWidget(whatsThisButton); QVBoxLayout *editorGroupLayout = new QVBoxLayout(editorGroup); editorGroupLayout->addWidget(m_editor); QVBoxLayout *typeGroupLayout = new QVBoxLayout(typeGroup); typeGroupLayout->addWidget(m_linearButton); typeGroupLayout->addWidget(m_radialButton); typeGroupLayout->addWidget(m_conicalButton); QVBoxLayout *spreadGroupLayout = new QVBoxLayout(spreadGroup); spreadGroupLayout->addWidget(m_padSpreadButton); spreadGroupLayout->addWidget(m_repeatSpreadButton); spreadGroupLayout->addWidget(m_reflectSpreadButton); QHBoxLayout *defaultsGroupLayout = new QHBoxLayout(defaultsGroup); defaultsGroupLayout->addWidget(default1Button); defaultsGroupLayout->addWidget(default2Button); defaultsGroupLayout->addWidget(default3Button); editorGroupLayout->addWidget(default4Button); connect(m_editor, SIGNAL(gradientStopsChanged(QGradientStops)), m_renderer, SLOT(setGradientStops(QGradientStops))); connect(m_linearButton, SIGNAL(clicked()), m_renderer, SLOT(setLinearGradient())); connect(m_radialButton, SIGNAL(clicked()), m_renderer, SLOT(setRadialGradient())); connect(m_conicalButton, SIGNAL(clicked()), m_renderer, SLOT(setConicalGradient())); connect(m_padSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setPadSpread())); connect(m_reflectSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setReflectSpread())); connect(m_repeatSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setRepeatSpread())); connect(default1Button, SIGNAL(clicked()), this, SLOT(setDefault1())); connect(default2Button, SIGNAL(clicked()), this, SLOT(setDefault2())); connect(default3Button, SIGNAL(clicked()), this, SLOT(setDefault3())); connect(default4Button, SIGNAL(clicked()), this, SLOT(setDefault4())); connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource())); #ifdef QT_OPENGL_SUPPORT connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool))); #endif connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool))); connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer->hoverPoints(), SLOT(setDisabled(bool))); connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)), whatsThisButton, SLOT(setChecked(bool))); connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)), m_renderer->hoverPoints(), SLOT(setDisabled(bool))); m_renderer->loadSourceFile(":res/gradients/gradients.cpp"); m_renderer->loadDescription(":res/gradients/gradients.html"); QTimer::singleShot(50, this, SLOT(setDefault1())); }
CriticalPowerWindow::CriticalPowerWindow(const QDir &home, MainWindow *parent, bool rangemode) : GcWindow(parent), _dateRange("{00000000-0000-0000-0000-000000000001}"), home(home), mainWindow(parent), currentRide(NULL), rangemode(rangemode), stale(true) { setInstanceName("Critical Power Window"); // main plot area QVBoxLayout *vlayout = new QVBoxLayout; cpintPlot = new CpintPlot(mainWindow, home.path(), mainWindow->zones()); vlayout->addWidget(cpintPlot); setLayout(vlayout); // controls QWidget *c = new QWidget; QVBoxLayout *cl = new QVBoxLayout(c); setControls(c); #ifdef GC_HAVE_LUCENE // searchbox searchBox = new SearchFilterBox(this, parent); connect(searchBox, SIGNAL(searchClear()), cpintPlot, SLOT(clearFilter())); connect(searchBox, SIGNAL(searchResults(QStringList)), cpintPlot, SLOT(setFilter(QStringList))); connect(searchBox, SIGNAL(searchClear()), this, SLOT(filterChanged())); connect(searchBox, SIGNAL(searchResults(QStringList)), this, SLOT(filterChanged())); cl->addWidget(searchBox); #endif // picker details QFormLayout *cpintPickerLayout = new QFormLayout; QLabel *cpintTimeLabel = new QLabel(tr("Duration:"), this); cpintTimeValue = new QLineEdit("0 s"); QLabel *cpintTodayLabel = new QLabel(tr("Today:"), this); cpintTodayValue = new QLabel(tr("no data")); QLabel *cpintAllLabel = new QLabel(tr("Best:"), this); cpintAllValue = new QLabel(tr("no data")); QLabel *cpintCPLabel = new QLabel(tr("CP Curve:"), this); cpintCPValue = new QLabel(tr("no data")); //QFontMetrics metrics(QApplication::font()); //int width = metrics.width("8888 watts (88/88/8888)") + 10; //cpintAllValue->setFixedWidth(width); //cpintCPValue->setFixedWidth(width); // so lines up nicely cpintTimeValue->setReadOnly(false); //cpintTodayValue->setReadOnly(true); //cpintAllValue->setReadOnly(true); //cpintCPValue->setReadOnly(true); QFont font = cpintTimeValue->font(); font.setPointSize(font.pointSize()); cpintTodayValue->setFont(font); cpintAllValue->setFont(font); cpintCPValue->setFont(font); cpintPickerLayout->addRow(cpintTimeLabel, cpintTimeValue); cpintPickerLayout->addRow(cpintTodayLabel, cpintTodayValue); cpintPickerLayout->addRow(cpintAllLabel, cpintAllValue); cpintPickerLayout->addRow(cpintCPLabel, cpintCPValue); cl->addLayout(cpintPickerLayout); // tools /properties seriesCombo = new QComboBox(this); addSeries(); cComboSeason = new QComboBox(this); seasons = parent->seasons; resetSeasons(); if (rangemode) cComboSeason->hide(); cpintSetCPButton = new QPushButton(tr("&Save CP value"), this); cpintSetCPButton->setEnabled(false); cl->addWidget(cpintSetCPButton); cl->addWidget(cComboSeason); cl->addWidget(seriesCombo); cl->addStretch(); picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, QwtPicker::VLineRubberBand, QwtPicker::AlwaysOff, cpintPlot->canvas()); picker->setStateMachine(new QwtPickerDragPointMachine); picker->setRubberBandPen(GColor(CPLOTTRACKER)); connect(picker, SIGNAL(moved(const QPoint &)), SLOT(pickerMoved(const QPoint &))); connect(cpintTimeValue, SIGNAL(editingFinished()), this, SLOT(cpintTimeValueEntered())); connect(cpintSetCPButton, SIGNAL(clicked()), this, SLOT(cpintSetCPButtonClicked())); if (rangemode) connect(this, SIGNAL(dateRangeChanged(DateRange)), SLOT(dateRangeChanged(DateRange))); else connect(cComboSeason, SIGNAL(currentIndexChanged(int)), this, SLOT(seasonSelected(int))); connect(seriesCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setSeries(int))); //connect(mainWindow, SIGNAL(rideSelected()), this, SLOT(rideSelected())); connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected())); connect(mainWindow, SIGNAL(configChanged()), cpintPlot, SLOT(configChanged())); // redraw on config change -- this seems the simplest approach connect(mainWindow, SIGNAL(configChanged()), this, SLOT(rideSelected())); connect(mainWindow, SIGNAL(rideAdded(RideItem*)), this, SLOT(newRideAdded(RideItem*))); connect(mainWindow, SIGNAL(rideDeleted(RideItem*)), this, SLOT(newRideAdded(RideItem*))); connect(seasons, SIGNAL(seasonsChanged()), this, SLOT(resetSeasons())); }
GliderEditorNumPad::GliderEditorNumPad(QWidget *parent, Glider *glider ) : QWidget(parent), m_gliderCreated(false) { setWindowFlags(Qt::Tool); setWindowModality( Qt::WindowModal ); setAttribute(Qt::WA_DeleteOnClose); // Resize the window to the same size as the main window has. That will // completely hide the parent window. resize( MainWindow::mainWindow()->size() ); // save current horizontal/vertical speed unit. This unit must be considered // during storage. m_currHSpeedUnit = Speed::getHorizontalUnit(); m_currVSpeedUnit = Speed::getVerticalUnit(); if (glider == 0) { setWindowTitle(tr("New Glider")); m_isNew = true; } else { setWindowTitle(tr("Edit Glider")); m_isNew = false; } m_glider = glider; QHBoxLayout* topLayout = new QHBoxLayout(this); QGridLayout* itemsLayout = new QGridLayout; itemsLayout->setHorizontalSpacing(10); itemsLayout->setVerticalSpacing(10); int row = 0; if( m_isNew ) { itemsLayout->addWidget(new QLabel(tr("Glider Pool:"), this), row, 0); m_openGliderList = new QPushButton( tr("Open") ); itemsLayout->addWidget(m_openGliderList, row, 1, 1, 3); connect( m_openGliderList, SIGNAL(clicked()), SLOT(slot_openGliderSelectionList()) ); row++; } Qt::InputMethodHints imh = Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText; itemsLayout->addWidget(new QLabel(tr("Glider Type:"), this), row, 0); m_edtGType = new QLineEdit(this); imh |= m_edtGType->inputMethodHints(); m_edtGType->setInputMethodHints(imh); connect( m_edtGType, SIGNAL(returnPressed()), MainWindow::mainWindow(), SLOT(slotCloseSip()) ); itemsLayout->addWidget(m_edtGType, row, 1, 1, 3); row++; itemsLayout->addWidget(new QLabel(tr("Registration:"), this), row, 0); m_edtGReg = new QLineEdit(this); m_edtGReg->setInputMethodHints(imh); connect( m_edtGReg, SIGNAL(returnPressed()), MainWindow::mainWindow(), SLOT(slotCloseSip()) ); itemsLayout->addWidget(m_edtGReg, row, 1); itemsLayout->addWidget(new QLabel(tr("Seats:"), this), row, 2); m_seats = new QPushButton( this ); itemsLayout->addWidget(m_seats, row, 3); connect( m_seats, SIGNAL(clicked()), SLOT(slot_changeSeats()) ); row++; itemsLayout->addWidget(new QLabel(tr("Call Sign:"), this), row, 0); m_edtGCall = new QLineEdit(this); m_edtGCall->setInputMethodHints(imh); connect( m_edtGCall, SIGNAL(returnPressed()), MainWindow::mainWindow(), SLOT(slotCloseSip()) ); itemsLayout->addWidget(m_edtGCall, row, 1); itemsLayout->addWidget(new QLabel(tr("Wing Area:"), this), row, 2); m_dneWingArea = new DoubleNumberEditor(this); m_dneWingArea->setDecimalVisible( true ); m_dneWingArea->setPmVisible( false ); m_dneWingArea->setMaxLength(7); m_dneWingArea->setDecimals( 2 ); QChar tsChar(Qt::Key_twosuperior); m_dneWingArea->setSuffix( QString(" m") + tsChar ); itemsLayout->addWidget(m_dneWingArea, row, 3); row++; itemsLayout->setRowMinimumHeight(row++, 10); QGridLayout* spinboxLayout = new QGridLayout; spinboxLayout->setHorizontalSpacing(10); spinboxLayout->setVerticalSpacing(10); int srow = 0; spinboxLayout->addWidget(new QLabel("v1:", this), srow, 0); m_dneV1 = new DoubleNumberEditor(this); m_dneV1->setDecimalVisible( true ); m_dneV1->setPmVisible( false ); m_dneV1->setMaxLength(5); m_dneV1->setRange(0.0, 250.0); m_dneV1->setDecimals( 1 ); m_dneV1->setSuffix( " " + Speed::getHorizontalUnitText() ); spinboxLayout->addWidget(m_dneV1, srow, 1); spinboxLayout->addWidget(new QLabel("w1:", this), srow, 2); m_dneW1 = new DoubleNumberEditor(this); m_dneW1->setDecimalVisible( true ); m_dneW1->setPmVisible( true ); m_dneW1->setMaxLength(7); m_dneW1->setDecimals( 2 ); m_dneW1->setSuffix( " " + Speed::getVerticalUnitText() ); QRegExpValidator *eValidator = new QRegExpValidator( QRegExp( "-[0-9]+\\.?[0-9]*" ), this ); m_dneW1->setValidator(eValidator); spinboxLayout->addWidget(m_dneW1, srow, 3); spinboxLayout->addWidget(new QLabel(tr("Ref. weight:"), this), srow, 4); m_grossWeight = new NumberEditor( this ); m_grossWeight->setDecimalVisible( false ); m_grossWeight->setPmVisible( false ); m_grossWeight->setMaxLength(4); m_grossWeight->setSuffix(" kg"); m_grossWeight->setRange( 0, 9999 ); spinboxLayout->addWidget(m_grossWeight, srow, 5); srow++; spinboxLayout->addWidget(new QLabel("v2", this), srow, 0); m_dneV2 = new DoubleNumberEditor(this); m_dneV2->setDecimalVisible( true ); m_dneV2->setPmVisible( false ); m_dneV2->setMaxLength(5); m_dneV2->setRange(0.0, 250.0); m_dneV2->setDecimals( 1 ); m_dneV2->setSuffix( " " + Speed::getHorizontalUnitText() ); spinboxLayout->addWidget(m_dneV2, srow, 1); spinboxLayout->addWidget(new QLabel("w2:", this), srow, 2); m_dneW2 = new DoubleNumberEditor(this); m_dneW2->setDecimalVisible( true ); m_dneW2->setPmVisible( true ); m_dneW2->setMaxLength(7); m_dneW2->setDecimals( 2 ); m_dneW2->setSuffix( " " + Speed::getVerticalUnitText() ); eValidator = new QRegExpValidator( QRegExp( "-[0-9]+\\.?[0-9]*" ), this ); m_dneW2->setValidator(eValidator); spinboxLayout->addWidget(m_dneW2, srow, 3); spinboxLayout->addWidget(new QLabel(tr("Load corr.:"), this), srow, 4); m_addedLoad = new NumberEditor( this ); m_addedLoad->setDecimalVisible( false ); m_addedLoad->setPmVisible( true ); m_addedLoad->setMaxLength(4); m_addedLoad->setSuffix(" kg"); m_addedLoad->setRange( -999, 999 ); spinboxLayout->addWidget(m_addedLoad, srow, 5); srow++; spinboxLayout->addWidget(new QLabel("v3:", this), srow, 0); m_dneV3 = new DoubleNumberEditor(this); m_dneV3->setDecimalVisible( true ); m_dneV3->setPmVisible( false ); m_dneV3->setMaxLength(5); m_dneV3->setRange(0.0, 250.0); m_dneV3->setDecimals( 1 ); m_dneV3->setSuffix( " " + Speed::getHorizontalUnitText() ); spinboxLayout->addWidget(m_dneV3, srow, 1); spinboxLayout->addWidget(new QLabel("w3:", this), srow, 2); m_dneW3 = new DoubleNumberEditor(this); m_dneW3->setDecimalVisible( true ); m_dneW3->setPmVisible( true ); m_dneW3->setMaxLength(7); m_dneW3->setDecimals( 2 ); m_dneW3->setSuffix( " " + Speed::getVerticalUnitText() ); eValidator = new QRegExpValidator( QRegExp( "-[0-9]+\\.?[0-9]*" ), this ); m_dneW3->setValidator(eValidator); spinboxLayout->addWidget(m_dneW3, srow, 3); spinboxLayout->addWidget(new QLabel(tr("Max. water:"), this), srow, 4); m_addedWater = new NumberEditor( this ); m_addedWater->setDecimalVisible( false ); m_addedWater->setPmVisible( false ); m_addedWater->setMaxLength(4); m_addedWater->setSuffix(" l"); m_addedWater->setRange( 0, 9999 ); spinboxLayout->addWidget(m_addedWater, srow++, 5); spinboxLayout->setColumnStretch(6, 10); spinboxLayout->setRowMinimumHeight(srow++, 20); m_buttonShow = new QPushButton(tr("Show Polar")); QHBoxLayout* buttonRow = new QHBoxLayout; buttonRow->setSpacing(0); buttonRow->addStretch( 10 ); buttonRow->addWidget( m_buttonShow ); spinboxLayout->addLayout(buttonRow, srow++, 0, 1, 6); spinboxLayout->setRowStretch( srow++, 10 ); itemsLayout->addLayout(spinboxLayout, row++, 0, 1, 4); itemsLayout->setColumnStretch( 1, 10 ); itemsLayout->setColumnStretch( 4, 20 ); connect(m_buttonShow, SIGNAL(pressed()), this, SLOT(slotButtonShow())); QPushButton *cancel = new QPushButton(this); cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png"))); cancel->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12))); cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred); QPushButton *ok = new QPushButton(this); ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png"))); ok->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12))); ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred); connect(ok, SIGNAL(pressed()), this, SLOT(accept())); connect(cancel, SIGNAL(pressed()), this, SLOT(reject())); QVBoxLayout *buttonBox = new QVBoxLayout; buttonBox->setSpacing(0); buttonBox->addStretch(2); buttonBox->addWidget(cancel, 1); buttonBox->addSpacing(30); buttonBox->addWidget(ok, 1); buttonBox->addStretch(2); topLayout->addLayout(itemsLayout); topLayout->addLayout(buttonBox); if( m_isNew ) { readLK8000PolarData(); } else { load(); } show(); }
void UIVMCloseDialog::prepare() { /* Prepare 'main' layout: */ QVBoxLayout *pMainLayout = new QVBoxLayout(this); { /* Prepare 'top' layout: */ QHBoxLayout *pTopLayout = new QHBoxLayout; { /* Prepare 'top-left' layout: */ QVBoxLayout *pTopLeftLayout = new QVBoxLayout; { /* Prepare 'icon': */ m_pIcon = new QLabel(this); { /* Configure icon: */ m_pIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_pIcon->setPixmap(QPixmap(":/os_unknown.png")); } /* Configure layout: */ pTopLeftLayout->setSpacing(0); pTopLeftLayout->setContentsMargins(0, 0, 0, 0); pTopLeftLayout->addWidget(m_pIcon); pTopLeftLayout->addStretch(); } /* Prepare 'top-right' layout: */ QVBoxLayout *pTopRightLayout = new QVBoxLayout; { /* Prepare 'text' label: */ m_pLabel = new QLabel(this); /* Prepare 'choice' layout: */ QGridLayout *pChoiceLayout = new QGridLayout; { /* Prepare 'detach' icon: */ m_pDetachIcon = new QLabel(this); { /* Configure icon: */ m_pDetachIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_pDetachIcon->setPixmap(QPixmap(":/vm_create_shortcut_16px.png")); } /* Prepare 'detach' radio-button: */ m_pDetachRadio = new QRadioButton(this); { /* Configure button: */ m_pDetachRadio->installEventFilter(this); connect(m_pDetachRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability())); } /* Prepare 'save' icon: */ m_pSaveIcon = new QLabel(this); { /* Configure icon: */ m_pSaveIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_pSaveIcon->setPixmap(QPixmap(":/vm_save_state_16px.png")); } /* Prepare 'save' radio-button: */ m_pSaveRadio = new QRadioButton(this); { /* Configure button: */ m_pSaveRadio->installEventFilter(this); connect(m_pSaveRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability())); } /* Prepare 'shutdown' icon: */ m_pShutdownIcon = new QLabel(this); { /* Configure icon: */ m_pShutdownIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_pShutdownIcon->setPixmap(QPixmap(":/vm_shutdown_16px.png")); } /* Prepare 'shutdown' radio-button: */ m_pShutdownRadio = new QRadioButton(this); { /* Configure button: */ m_pShutdownRadio->installEventFilter(this); connect(m_pShutdownRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability())); } /* Prepare 'power-off' icon: */ m_pPowerOffIcon = new QLabel(this); { /* Configure icon: */ m_pPowerOffIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_pPowerOffIcon->setPixmap(QPixmap(":/vm_poweroff_16px.png")); } /* Prepare 'shutdown' radio-button: */ m_pPowerOffRadio = new QRadioButton(this); { /* Configure button: */ m_pPowerOffRadio->installEventFilter(this); connect(m_pPowerOffRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability())); } /* Prepare 'discard' check-box: */ m_pDiscardCheckBox = new QCheckBox(this); /* Configure layout: */ #ifdef VBOX_WS_MAC pChoiceLayout->setSpacing(15); #else /* VBOX_WS_MAC */ pChoiceLayout->setSpacing(6); #endif /* !VBOX_WS_MAC */ pChoiceLayout->setContentsMargins(0, 0, 0, 0); pChoiceLayout->addWidget(m_pDetachIcon, 0, 0); pChoiceLayout->addWidget(m_pDetachRadio, 0, 1); pChoiceLayout->addWidget(m_pSaveIcon, 1, 0); pChoiceLayout->addWidget(m_pSaveRadio, 1, 1); pChoiceLayout->addWidget(m_pShutdownIcon, 2, 0); pChoiceLayout->addWidget(m_pShutdownRadio, 2, 1); pChoiceLayout->addWidget(m_pPowerOffIcon, 3, 0); pChoiceLayout->addWidget(m_pPowerOffRadio, 3, 1); pChoiceLayout->addWidget(m_pDiscardCheckBox, 4, 1); } /* Configure layout: */ #ifdef VBOX_WS_MAC pTopRightLayout->setSpacing(15); #else /* VBOX_WS_MAC */ pTopRightLayout->setSpacing(6); #endif /* !VBOX_WS_MAC */ pTopRightLayout->setContentsMargins(0, 0, 0, 0); pTopRightLayout->addWidget(m_pLabel); pTopRightLayout->addItem(pChoiceLayout); } /* Configure layout: */ pTopLayout->setSpacing(20); pTopLayout->setContentsMargins(0, 0, 0, 0); pTopLayout->addItem(pTopLeftLayout); pTopLayout->addItem(pTopRightLayout); } /* Prepare button-box: */ QIDialogButtonBox *pButtonBox = new QIDialogButtonBox(this); { /* Configure button-box: */ pButtonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::NoButton | QDialogButtonBox::Ok); connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(pButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog())); } /* Configure layout: */ pMainLayout->setSpacing(20); #ifdef VBOX_WS_MAC pMainLayout->setContentsMargins(40, 20, 40, 20); #endif /* VBOX_WS_MAC */ pMainLayout->addItem(pTopLayout); pMainLayout->addWidget(pButtonBox); } /* Prepare size-grip token: */ setSizeGripEnabled(false); }
WirelessPage::WirelessPage(WirelessDevice *dev, QWidget *parent) : ContentWidget(parent), m_device(dev), m_listGroup(new SettingsGroup), m_tipsGroup(new SettingsGroup), m_connectHideSSID(new AccessPointWidget(this)), m_closeHotspotBtn(new QPushButton), m_currentClickApw(nullptr), m_sortDelayTimer(new QTimer(this)), m_indicatorDelayTimer(new QTimer(this)) { m_sortDelayTimer->setInterval(100); m_sortDelayTimer->setSingleShot(true); m_indicatorDelayTimer->setInterval(300); m_indicatorDelayTimer->setSingleShot(true); m_connectHideSSID->setAPName(tr("Connect to hidden network")); m_connectHideSSID->setStrength(-1); m_closeHotspotBtn->setText(tr("Close Hotspot")); TipsItem *tips = new TipsItem; tips->setText(tr("Please disable hotspot sharing first if you want to connect to a wireless network")); m_tipsGroup->appendItem(tips); m_listGroup->appendItem(m_connectHideSSID); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setSpacing(0); mainLayout->setContentsMargins(0, 0, 0, 0); mainLayout->addSpacing(10); mainLayout->addWidget(m_listGroup); mainLayout->addWidget(m_tipsGroup); mainLayout->addSpacing(10); mainLayout->addWidget(m_closeHotspotBtn); mainLayout->addSpacing(10); mainLayout->addStretch(); QWidget *mainWidget = new TranslucentFrame; mainWidget->setLayout(mainLayout); setContent(mainWidget); #ifdef QT_DEBUG setTitle(m_device->path()); #else setTitle(tr("WLAN")); #endif connect(m_sortDelayTimer, &QTimer::timeout, this, &WirelessPage::sortAPList); connect(m_indicatorDelayTimer, &QTimer::timeout, this, &WirelessPage::refreshLoadingIndicator); connect(m_connectHideSSID, &AccessPointWidget::requestEdit, this, &WirelessPage::showConnectHidePage); connect(m_closeHotspotBtn, &QPushButton::clicked, this, &WirelessPage::onCloseHotspotClicked); connect(m_device, &WirelessDevice::apAdded, this, &WirelessPage::onAPAdded); connect(m_device, &WirelessDevice::apInfoChanged, this, &WirelessPage::onAPChanged); connect(m_device, &WirelessDevice::apRemoved, this, &WirelessPage::onAPRemoved); connect(m_device, &WirelessDevice::activeWirelessConnectionInfoChanged, this, &WirelessPage::updateActiveAp); connect(m_device, &WirelessDevice::hotspotEnabledChanged, this, &WirelessPage::onHotspotEnableChanged); connect(m_device, &WirelessDevice::removed, this, &WirelessPage::onDeviceRemoved); connect(m_device, &WirelessDevice::activateAccessPointFailed, this, &WirelessPage::onActivateApFailed); connect(m_device, &WirelessDevice::activeConnectionsChanged, m_indicatorDelayTimer, static_cast<void (QTimer::*) ()>(&QTimer::start)); // init data const QJsonArray mApList = m_device->apList(); if (!mApList.isEmpty()) { for (auto ap : mApList) { onAPAdded(ap.toObject()); } } QTimer::singleShot(100, this, [=] { Q_EMIT requestDeviceAPList(m_device->path()); Q_EMIT requestWirelessScan(); }); }
PlayerBox::PlayerBox(bool playerOne, QWidget* parent, const char* name) : QGroupBox(parent, name) { QHBoxLayout* l = new QHBoxLayout(this, PLAYERBOX_BORDERS, PLAYERBOX_HDISTANCEOFWIDGETS); // The card and "held" label arrays. m_cardWidgets = new CardWidget *[PokerHandSize]; m_heldLabels = new QLabel *[PokerHandSize]; QFont myFixedFont; myFixedFont.setPointSize(12); // Generate the 5 cards for (int i = 0; i < PokerHandSize; i++) { QVBoxLayout* vl = new QVBoxLayout(0); l->addLayout(vl, 0); QHBox* cardBox = new QHBox(this); vl->addWidget(cardBox, 0); cardBox->setFrameStyle(Box | Sunken); m_cardWidgets[i] = new CardWidget(cardBox); cardBox->setFixedSize(cardBox->sizeHint()); // Only add the "held" labels if this is the first player (the human one). if (playerOne) { QHBox* b = new QHBox(this); m_heldLabels[i] = new QLabel(b); m_heldLabels[i]->setText(i18n("Held")); b->setFrameStyle(Box | Sunken); b->setFixedSize(b->sizeHint()); m_cardWidgets[i]->heldLabel = m_heldLabels[i]; QHBoxLayout* heldLayout = new QHBoxLayout(0); heldLayout->addWidget(b, 0, AlignCenter); vl->insertLayout(0, heldLayout, 0); vl->insertStretch(0, 1); vl->addStretch(1); } } // Add the cash and bet labels. { QVBoxLayout* vl = new QVBoxLayout; l->addLayout(vl); vl->addStretch(); m_cashLabel = new QLabel(this); m_cashLabel->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); m_cashLabel->setFont(myFixedFont); vl->addWidget(m_cashLabel, 0, AlignHCenter); vl->addStretch(); m_betLabel = new QLabel(this); m_betLabel->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); m_betLabel->setFont(myFixedFont); vl->addWidget(m_betLabel, 0, AlignHCenter); vl->addStretch(); } QToolTip::add(m_cashLabel, i18n("Money of %1").arg("Player"));//change via showName() // Assume that we have a multiplayer game. m_singlePlayer = false; }
void PathDeformControls::layoutForDesktop() { QGroupBox* mainGroup = new QGroupBox(this); mainGroup->setTitle(tr("Controls")); QGroupBox *radiusGroup = new QGroupBox(mainGroup); radiusGroup->setTitle(tr("Lens Radius")); QSlider *radiusSlider = new QSlider(Qt::Horizontal, radiusGroup); radiusSlider->setRange(15, 150); radiusSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QGroupBox *deformGroup = new QGroupBox(mainGroup); deformGroup->setTitle(tr("Deformation")); QSlider *deformSlider = new QSlider(Qt::Horizontal, deformGroup); deformSlider->setRange(-100, 100); deformSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QGroupBox *fontSizeGroup = new QGroupBox(mainGroup); fontSizeGroup->setTitle(tr("Font Size")); QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, fontSizeGroup); fontSizeSlider->setRange(16, 200); fontSizeSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QGroupBox *textGroup = new QGroupBox(mainGroup); textGroup->setTitle(tr("Text")); QLineEdit *textInput = new QLineEdit(textGroup); QPushButton *animateButton = new QPushButton(mainGroup); animateButton->setText(tr("Animated")); animateButton->setCheckable(true); QPushButton *showSourceButton = new QPushButton(mainGroup); showSourceButton->setText(tr("Show Source")); #ifdef QT_OPENGL_SUPPORT QPushButton *enableOpenGLButton = new QPushButton(mainGroup); enableOpenGLButton->setText(tr("Use OpenGL")); enableOpenGLButton->setCheckable(true); enableOpenGLButton->setChecked(m_renderer->usesOpenGL()); if (!QGLFormat::hasOpenGL()) enableOpenGLButton->hide(); #endif QPushButton *whatsThisButton = new QPushButton(mainGroup); whatsThisButton->setText(tr("What's This?")); whatsThisButton->setCheckable(true); mainGroup->setFixedWidth(180); QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup); mainGroupLayout->addWidget(radiusGroup); mainGroupLayout->addWidget(deformGroup); mainGroupLayout->addWidget(fontSizeGroup); mainGroupLayout->addWidget(textGroup); mainGroupLayout->addWidget(animateButton); mainGroupLayout->addStretch(1); #ifdef QT_OPENGL_SUPPORT mainGroupLayout->addWidget(enableOpenGLButton); #endif mainGroupLayout->addWidget(showSourceButton); mainGroupLayout->addWidget(whatsThisButton); QVBoxLayout *radiusGroupLayout = new QVBoxLayout(radiusGroup); radiusGroupLayout->addWidget(radiusSlider); QVBoxLayout *deformGroupLayout = new QVBoxLayout(deformGroup); deformGroupLayout->addWidget(deformSlider); QVBoxLayout *fontSizeGroupLayout = new QVBoxLayout(fontSizeGroup); fontSizeGroupLayout->addWidget(fontSizeSlider); QVBoxLayout *textGroupLayout = new QVBoxLayout(textGroup); textGroupLayout->addWidget(textInput); QVBoxLayout * mainLayout = new QVBoxLayout(this); mainLayout->addWidget(mainGroup); mainLayout->setMargin(0); connect(radiusSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setRadius(int))); connect(deformSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setIntensity(int))); connect(fontSizeSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setFontSize(int))); connect(animateButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setAnimated(bool))); #ifdef QT_OPENGL_SUPPORT connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool))); #endif connect(textInput, SIGNAL(textChanged(QString)), m_renderer, SLOT(setText(QString))); connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)), whatsThisButton, SLOT(setChecked(bool))); connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool))); connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource())); animateButton->animateClick(); deformSlider->setValue(80); fontSizeSlider->setValue(120); radiusSlider->setValue(100); textInput->setText(tr("Qt")); }
Cube2d::Cube2d(const QVector<Video *> videos,QWidget * parent /* = 0 */) :QWidget(parent) { this->videos = videos; timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(refreshCude())); //cubeLabel->setGeometry(0, 0, 500, 500); faceColors.resize(54); margin = (FlatLenth - 3*SquareLenth) / 3; FBLRUD = new std::vector<QPoint>; FBLRUD->push_back(QPoint(2*FlatMargin + FlatLenth,2*FlatMargin+FlatLenth)); //f FBLRUD->push_back(QPoint(4 * FlatMargin + 3*FlatLenth, 2 * FlatMargin + FlatLenth)); //b FBLRUD->push_back(QPoint(1 * FlatMargin + 0*FlatLenth, 2 * FlatMargin + FlatLenth)); //l FBLRUD->push_back(QPoint(3 * FlatMargin + 2*FlatLenth, 2 * FlatMargin + FlatLenth)); //r FBLRUD->push_back(QPoint(2 * FlatMargin + FlatLenth, 1 * FlatMargin + 0 * FlatLenth)); //u FBLRUD->push_back(QPoint(2 * FlatMargin + FlatLenth, 3 * FlatMargin + 2*FlatLenth)); //d //初始化square 的矩形 for (int k = 0; k < 6; k++) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { int leftTopX = FBLRUD->operator[](k).x(); int leftTopY = FBLRUD->operator[](k).y(); squareRects.push_back(QRectF( leftTopX + (j + 1)*margin + j*SquareLenth, leftTopY + (i + 1)*margin + i*SquareLenth, SquareLenth, SquareLenth)); } } } cubeImage = new QImage(QSize(400,400),QImage::Format_ARGB32); cubeLabel = new QLabel(this); cubeLabel->setGeometry(0, 0, 400, 400); painter = new QPainter(this); // file = new QFile("color.txt"); // if (file->open(QIODevice::ReadWrite | QIODevice::Text) == false) // { // QMessageBox::warning(this, tr("can not open file"), tr("can not open file")); // } //cubeLabel->setGeometry(100, 100, 1500, 300); videoComboBox = new QComboBox(this); videoComboBox->addItem("Camera 1"); videoComboBox->addItem("Camera 2"); videoComboBox->addItem("Camera 3"); videoComboBox->addItem("Camera 4"); videosDetectAreaArray.resize(4); for (int i = 0; i < 6;i++) areaTable.push_back(QRect((*FBLRUD)[i],(*FBLRUD)[i]+QPoint(FlatLenth,FlatLenth))); model = cv::ml::SVM::StatModel::load<cv::ml::SVM>("svm.xml"); /*布局*/ QHBoxLayout * hLayout = new QHBoxLayout(this); hLayout->addWidget(cubeLabel); hLayout->addStretch(); QVBoxLayout * vLayout = new QVBoxLayout(this); videoLabel = new QLabel(tr("Camera:"),this); vLayout->addWidget(videoLabel); vLayout->addWidget(videoComboBox); vLayout->addStretch(); hLayout->addLayout(vLayout); setLayout(hLayout); resize(QSize(400, 400)); //cube2dThread = new Cube2dThread(cubeImage, // cubeLabel, (((MainWindow *)parentWidget())->getCubePosition()).rgbs, // faceColors, // FBLRUD, margin, this, painter); //cube2dThread->start(); timer->start(200); }
ClientWidget::ClientWidget() { item = NULL; photo = new PhotoWidget; photo->setFixedSize(200, 250); photo->setName(""); QGridLayout* grid = new QGridLayout; int row = 0; QLabel* label = new QLabel("Фамилия: "); surnameWidget = new QLineEdit; grid->addWidget(label, row, 0); grid->addWidget(surnameWidget, row++, 1); label = new QLabel("Имя: "); nameWidget = new QLineEdit; nameWidget->setMinimumWidth(300); grid->addWidget(label, row, 0); grid->addWidget(nameWidget, row++, 1); label = new QLabel("Отчество: "); patronymicWidget = new QLineEdit; grid->addWidget(label, row, 0); grid->addWidget(patronymicWidget, row++, 1); label = new QLabel("День рождения: "); birthdayWidget = new QDateEdit; birthdayWidgetEmpty = new QLineEdit; birthdayWidget->setCalendarPopup(true); birthdayWidget->setDate(MIN_DATE); birthdayWidget->setDisplayFormat("dd.MM.yyyy"); grid->addWidget(label, row, 0); grid->addWidget(birthdayWidgetEmpty, row, 1); grid->addWidget(birthdayWidget, row++, 1); label = new QLabel("Телефон: "); phoneWidget = new QLineEdit; grid->addWidget(label, row, 0); grid->addWidget(phoneWidget, row++, 1); cardType = new QComboBox; cardType->setModel(ModelFactory::getInstance()->getModel(CARD)); cardNumberWidget = new QSpinBox; cardNumberWidget->setMaximum(1000000); cardNumberWidget->setMaximumWidth(120); QHBoxLayout* cardBox = new QHBoxLayout; cardBox->addWidget(cardNumberWidget); cardBox->addWidget(cardType); label = new QLabel("Карта: "); grid->addWidget(label, row, 0); grid->addLayout(cardBox, row++, 1); label = new QLabel("email: "); emailWidget = new QLineEdit; grid->addWidget(label, row, 0); grid->addWidget(emailWidget, row++, 1); notifyWidget = new QCheckBox("Оповещать по email"); grid->addWidget(notifyWidget, row++, 1); QVBoxLayout* vbox = new QVBoxLayout; vbox->addLayout(grid); vbox->addStretch(1); QHBoxLayout* hbox = new QHBoxLayout; hbox->addWidget(photo); hbox->addLayout(vbox); hbox->addStretch(1); setLayout(hbox); birthdayWidgetEmpty->setVisible(false); }
QWidget *ServerDialog::createAdvancedTab(){ QVBoxLayout *layout = new QVBoxLayout; contest_mode_checkbox = new QCheckBox(tr("Contest mode")); contest_mode_checkbox->setChecked(Config.ContestMode); contest_mode_checkbox->setToolTip(tr("Requires password to login, hide screen name and disable kicking")); free_choose_checkbox = new QCheckBox(tr("Choose generals and cards freely")); free_choose_checkbox->setToolTip(tr("This option enables the cheat menu")); free_choose_checkbox->setChecked(Config.FreeChoose); free_assign_checkbox = new QCheckBox(tr("Assign role and seat freely")); free_assign_checkbox->setChecked(Config.value("FreeAssign").toBool()); free_assign_self_checkbox = new QCheckBox(tr("Assign only your own role")); free_assign_self_checkbox->setChecked(Config.FreeAssignSelf); free_assign_self_checkbox->setEnabled(free_assign_checkbox->isChecked()); connect(free_assign_checkbox,SIGNAL(toggled(bool)), free_assign_self_checkbox, SLOT(setEnabled(bool))); maxchoice_spinbox = new QSpinBox; maxchoice_spinbox->setRange(3, 10); maxchoice_spinbox->setValue(Config.value("MaxChoice", 5).toInt()); forbid_same_ip_checkbox = new QCheckBox(tr("Forbid same IP with multiple connection")); forbid_same_ip_checkbox->setChecked(Config.ForbidSIMC); disable_chat_checkbox = new QCheckBox(tr("Disable chat")); disable_chat_checkbox->setChecked(Config.DisableChat); second_general_checkbox = new QCheckBox(tr("Enable second general")); nolordskill_checkbox = new QCheckBox(tr("No lord skill")); nolordskill_checkbox->setChecked(Config.NoLordSkill); scene_checkbox = new QCheckBox(tr("Enable Scene")); scene_checkbox->setChecked(Config.EnableScene); //changjing same_checkbox = new QCheckBox(tr("Enable Same")); same_checkbox->setChecked(Config.EnableSame); max_hp_label = new QLabel(tr("Max HP scheme")); max_hp_scheme_combobox = new QComboBox; max_hp_scheme_combobox->addItem(tr("Sum - 3")); max_hp_scheme_combobox->addItem(tr("Minimum")); max_hp_scheme_combobox->addItem(tr("Average")); max_hp_scheme_combobox->setCurrentIndex(Config.MaxHpScheme); second_general_checkbox->setChecked(Config.Enable2ndGeneral); basara_checkbox = new QCheckBox(tr("Enable Basara")); basara_checkbox->setChecked(Config.EnableBasara); updateButtonEnablility(mode_group->checkedButton()); connect(mode_group,SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(updateButtonEnablility(QAbstractButton*))); hegemony_checkbox = new QCheckBox(tr("Enable Hegemony")); hegemony_checkbox->setChecked(Config.EnableHegemony); hegemony_checkbox->setEnabled(basara_checkbox->isChecked()); connect(basara_checkbox,SIGNAL(toggled(bool)),hegemony_checkbox, SLOT(setEnabled(bool))); connect(hegemony_checkbox,SIGNAL(toggled(bool)),second_general_checkbox, SLOT(setChecked(bool))); connect(hegemony_checkbox,SIGNAL(toggled(bool)),nolordskill_checkbox, SLOT(setChecked(bool))); connect(second_general_checkbox,SIGNAL(toggled(bool)), this, SLOT(updateCheckBoxState(bool))); announce_ip_checkbox = new QCheckBox(tr("Annouce my IP in WAN")); announce_ip_checkbox->setChecked(Config.AnnounceIP); announce_ip_checkbox->setEnabled(false); // not support now address_edit = new QLineEdit; address_edit->setText(Config.Address); #if QT_VERSION >= 0x040700 address_edit->setPlaceholderText(tr("Public IP or domain")); #endif QPushButton *detect_button = new QPushButton(tr("Detect my WAN IP")); connect(detect_button, SIGNAL(clicked()), this, SLOT(onDetectButtonClicked())); //address_edit->setEnabled(announce_ip_checkbox->isChecked()); // connect(announce_ip_checkbox, SIGNAL(toggled(bool)), address_edit, SLOT(setEnabled(bool))); port_edit = new QLineEdit; port_edit->setText(QString::number(Config.ServerPort)); port_edit->setValidator(new QIntValidator(1, 9999, port_edit)); layout->addWidget(contest_mode_checkbox); layout->addWidget(forbid_same_ip_checkbox); layout->addWidget(disable_chat_checkbox); layout->addLayout(HLay(free_choose_checkbox, free_assign_checkbox)); layout->addWidget(free_assign_self_checkbox); layout->addLayout(HLay(new QLabel(tr("Upperlimit for general")), maxchoice_spinbox)); layout->addLayout(HLay(second_general_checkbox, nolordskill_checkbox)); layout->addLayout(HLay(max_hp_label, max_hp_scheme_combobox)); layout->addLayout(HLay(basara_checkbox, hegemony_checkbox)); layout->addLayout(HLay(scene_checkbox, same_checkbox)); layout->addWidget(announce_ip_checkbox); layout->addLayout(HLay(new QLabel(tr("Address")), address_edit)); layout->addWidget(detect_button); layout->addLayout(HLay(new QLabel(tr("Port")), port_edit)); layout->addStretch(); QWidget *widget = new QWidget; widget->setLayout(layout); max_hp_label->setVisible(Config.Enable2ndGeneral); connect(second_general_checkbox, SIGNAL(toggled(bool)), max_hp_label, SLOT(setVisible(bool))); max_hp_scheme_combobox->setVisible(Config.Enable2ndGeneral); connect(second_general_checkbox, SIGNAL(toggled(bool)), max_hp_scheme_combobox, SLOT(setVisible(bool))); return widget; }