DlgPrefRecord::DlgPrefRecord(QWidget* parent, ConfigObject<ConfigValue>* pConfig) : DlgPreferencePage(parent), m_pConfig(pConfig), m_bConfirmOverwrite(false), m_pRadioOgg(NULL), m_pRadioMp3(NULL), m_pRadioAiff(NULL), m_pRadioFlac(NULL), m_pRadioWav(NULL) { setupUi(this); // See RECORD_* #defines in defs_recording.h m_pRecordControl = new ControlObjectThread( RECORDING_PREF_KEY, "status"); m_pRadioOgg = new QRadioButton("Ogg Vorbis"); m_pRadioMp3 = new QRadioButton(ENCODING_MP3); // Setting recordings path. QString recordingsPath = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "Directory")); if (recordingsPath == "") { // Initialize recordings path in config to old default path. // Do it here so we show current value in UI correctly. QString musicDir = QDesktopServices::storageLocation(QDesktopServices::MusicLocation); QDir recordDir(musicDir + "/Mixxx/Recordings"); recordingsPath = recordDir.absolutePath(); } LineEditRecordings->setText(recordingsPath); connect(PushButtonBrowseRecordings, SIGNAL(clicked()), this, SLOT(slotBrowseRecordingsDir())); connect(LineEditRecordings, SIGNAL(returnPressed()), this, SLOT(slotApply())); connect(m_pRadioOgg, SIGNAL(clicked()), this, SLOT(slotApply())); connect(m_pRadioMp3, SIGNAL(clicked()), this, SLOT(slotApply())); horizontalLayout->addWidget(m_pRadioOgg); horizontalLayout->addWidget(m_pRadioMp3); // AIFF and WAVE are supported by default. m_pRadioWav = new QRadioButton(ENCODING_WAVE); connect(m_pRadioWav, SIGNAL(clicked()), this, SLOT(slotApply())); horizontalLayout->addWidget(m_pRadioWav); m_pRadioAiff = new QRadioButton(ENCODING_AIFF); connect(m_pRadioAiff, SIGNAL(clicked()), this, SLOT(slotApply())); horizontalLayout->addWidget(m_pRadioAiff); #ifdef SF_FORMAT_FLAC m_pRadioFlac = new QRadioButton(ENCODING_FLAC); connect(m_pRadioFlac, SIGNAL(clicked()), this, SLOT(slotApply())); horizontalLayout->addWidget(m_pRadioFlac); #endif // Read config and check radio button. QString format = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "Encoding")); if (format == ENCODING_WAVE) { m_pRadioWav->setChecked(true); } else if (format == ENCODING_OGG) { m_pRadioOgg->setChecked(true); } else if (format == ENCODING_MP3) { m_pRadioMp3->setChecked(true); } else if (format == ENCODING_AIFF) { m_pRadioAiff->setChecked(true); #ifdef SF_FORMAT_FLAC } else if (format == ENCODING_FLAC) { m_pRadioFlac->setChecked(true); #endif } else { // Invalid, so set default and save. // If no config was available, set to WAVE as default. m_pRadioWav->setChecked(true); m_pConfig->set(ConfigKey(RECORDING_PREF_KEY, "Encoding"), ConfigValue(ENCODING_WAVE)); } loadMetaData(); connect(SliderQuality, SIGNAL(valueChanged(int)), this, SLOT(slotSliderQuality())); connect(SliderQuality, SIGNAL(sliderMoved(int)), this, SLOT(slotSliderQuality())); connect(SliderQuality, SIGNAL(sliderReleased()), this, SLOT(slotSliderQuality())); connect(CheckBoxRecordCueFile, SIGNAL(stateChanged(int)), this, SLOT(slotEnableCueFile(int))); connect(comboBoxSplitting, SIGNAL(activated(int)), this, SLOT(slotChangeSplitSize())); slotApply(); // Make sure a corrupt config file won't cause us to record constantly. m_pRecordControl->slotSet(RECORD_OFF); comboBoxSplitting->addItem(SPLIT_650MB); comboBoxSplitting->addItem(SPLIT_700MB); comboBoxSplitting->addItem(SPLIT_1024MB); comboBoxSplitting->addItem(SPLIT_2048MB); comboBoxSplitting->addItem(SPLIT_4096MB); QString fileSizeStr = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "FileSize")); int index = comboBoxSplitting->findText(fileSizeStr); if (index > 0) { // Set file split size comboBoxSplitting->setCurrentIndex(index); } // Otherwise 650 MB will be default file split size. // Read CUEfile info CheckBoxRecordCueFile->setChecked( (bool) m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "CueEnabled")).toInt()); }
void Knob::mouseReleaseEvent(QMouseEvent*) { emit sliderReleased(_id); }
LutDockerDock::LutDockerDock() : QDockWidget(i18n("LUT Management")) , m_canvas(0) , m_draggingSlider(false) { m_exposureCompressor.reset(new KisSignalCompressorWithParam<qreal>(40, boost::bind(&LutDockerDock::setCurrentExposureImpl, this, _1))); m_gammaCompressor.reset(new KisSignalCompressorWithParam<qreal>(40, boost::bind(&LutDockerDock::setCurrentGammaImpl, this, _1))); m_page = new QWidget(this); setupUi(m_page); setWidget(m_page); KisConfig cfg; m_chkUseOcio->setChecked(cfg.useOcio()); connect(m_chkUseOcio, SIGNAL(toggled(bool)), SLOT(updateDisplaySettings())); connect(m_colorManagement, SIGNAL(currentIndexChanged(int)), SLOT(slotColorManagementModeChanged())); m_txtConfigurationPath->setText(cfg.ocioConfigurationPath()); m_bnSelectConfigurationFile->setToolTip(i18n("Select custom configuration file.")); connect(m_bnSelectConfigurationFile,SIGNAL(clicked()), SLOT(selectOcioConfiguration())); m_txtLut->setText(cfg.ocioLutPath()); m_bnSelectLut->setToolTip(i18n("Select LUT file")); connect(m_bnSelectLut, SIGNAL(clicked()), SLOT(selectLut())); connect(m_bnClearLut, SIGNAL(clicked()), SLOT(clearLut())); // See http://groups.google.com/group/ocio-dev/browse_thread/thread/ec95c5f54a74af65 -- maybe need to be reinstated // when people ask for it. m_lblLut->hide(); m_txtLut->hide(); m_bnSelectLut->hide(); m_bnClearLut->hide(); connect(m_cmbDisplayDevice, SIGNAL(currentIndexChanged(int)), SLOT(refillViewCombobox())); m_exposureDoubleWidget->setToolTip(i18n("Select the exposure (stops) for HDR images.")); m_exposureDoubleWidget->setRange(-10, 10); m_exposureDoubleWidget->setPrecision(1); m_exposureDoubleWidget->setValue(0.0); m_exposureDoubleWidget->setSingleStep(0.25); m_exposureDoubleWidget->setPageStep(1); connect(m_exposureDoubleWidget, SIGNAL(valueChanged(double)), SLOT(exposureValueChanged(double))); connect(m_exposureDoubleWidget, SIGNAL(sliderPressed()), SLOT(exposureSliderPressed())); connect(m_exposureDoubleWidget, SIGNAL(sliderReleased()), SLOT(exposureSliderReleased())); // Gamma needs to be exponential (gamma *= 1.1f, gamma /= 1.1f as steps) m_gammaDoubleWidget->setToolTip(i18n("Select the amount of gamma modification for display. This does not affect the pixels of your image.")); m_gammaDoubleWidget->setRange(0.1, 5); m_gammaDoubleWidget->setPrecision(2); m_gammaDoubleWidget->setValue(1.0); m_gammaDoubleWidget->setSingleStep(0.1); m_gammaDoubleWidget->setPageStep(1); connect(m_gammaDoubleWidget, SIGNAL(valueChanged(double)), SLOT(gammaValueChanged(double))); connect(m_gammaDoubleWidget, SIGNAL(sliderPressed()), SLOT(gammaSliderPressed())); connect(m_gammaDoubleWidget, SIGNAL(sliderReleased()), SLOT(gammaSliderReleased())); m_bwPointChooser = new BlackWhitePointChooser(this); connect(m_bwPointChooser, SIGNAL(sigBlackPointChanged(qreal)), SLOT(updateDisplaySettings())); connect(m_bwPointChooser, SIGNAL(sigWhitePointChanged(qreal)), SLOT(updateDisplaySettings())); connect(m_btnConvertCurrentColor, SIGNAL(toggled(bool)), SLOT(updateDisplaySettings())); connect(m_btmShowBWConfiguration, SIGNAL(clicked()), SLOT(slotShowBWConfiguration())); slotUpdateIcons(); connect(m_cmbInputColorSpace, SIGNAL(currentIndexChanged(int)), SLOT(updateDisplaySettings())); connect(m_cmbDisplayDevice, SIGNAL(currentIndexChanged(int)), SLOT(updateDisplaySettings())); connect(m_cmbView, SIGNAL(currentIndexChanged(int)), SLOT(updateDisplaySettings())); connect(m_cmbComponents, SIGNAL(currentIndexChanged(int)), SLOT(updateDisplaySettings())); m_draggingSlider = false; connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), SLOT(resetOcioConfiguration())); m_displayFilter = 0; resetOcioConfiguration(); }
void DevEdit::setup() { // setup widgets e = new CoreEdit; l = new DevLineNumber(e); //setup layout QGridLayout *grid = new QGridLayout; grid->addWidget(l, 0, 0, 48, 1); grid->addWidget(e, 0, 1, 48, 63); //apply layout setLayout(grid); //setup editor properties setFont( QFont("Courier New", 10) ); hl = new CppHighlighter(e);//, true); //setup internal connections connect(l , SIGNAL( clicked(QTextCursor&) ), this, SLOT ( toggleBreakPoint(QTextCursor&) ) ); connect(e , SIGNAL( message(const QString&, int) ), this, SIGNAL( message(const QString&, int) ) ); connect(this, SIGNAL( needUndo() ), e , SLOT ( undo() ) ); connect(this, SIGNAL( needRedo() ), e , SLOT ( redo() ) ); //setup custom connections (external purpose but specific to DevEdit) //setup external purpose connections, i.e. signals wrappers connect(e , SIGNAL( copyAvailable(bool) ), this, SIGNAL( copyAvailable(bool) ) ); connect(e , SIGNAL( currentCharFormatChanged(const QTextCharFormat&) ), this, SIGNAL( currentCharFormatChanged(const QTextCharFormat&) ) ); connect(e , SIGNAL( cursorPositionChanged() ), this, SIGNAL( cursorPositionChanged() ) ); connect(e , SIGNAL( redoAvailable(bool) ), this, SIGNAL( redoAvailable(bool) ) ); connect(e , SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); connect(e , SIGNAL( textChanged() ), this, SIGNAL( textChanged() ) ); connect(e , SIGNAL( undoAvailable(bool) ), this, SIGNAL( undoAvailable(bool) ) ); connect(e->horizontalScrollBar(), SIGNAL( actionTriggered(int) ), this, SLOT( h_actionTriggered(int) ) ); connect(e->horizontalScrollBar(), SIGNAL( rangeChanged(int, int) ), this, SLOT( h_rangeChanged(int, int) ) ); connect(e->horizontalScrollBar(), SIGNAL( sliderMoved(int) ), this, SLOT( h_sliderMoved(int) ) ); connect(e->horizontalScrollBar(), SIGNAL( sliderPressed() ), this, SLOT( h_sliderPressed() ) ); connect(e->horizontalScrollBar(), SIGNAL( sliderReleased() ), this, SLOT( h_sliderReleased() ) ); connect(e->horizontalScrollBar(), SIGNAL( valueChanged(int) ), this, SLOT( h_valueChanged(int) ) ); connect(e->verticalScrollBar(), SIGNAL( actionTriggered(int) ), this, SLOT( v_actionTriggered(int) ) ); connect(e->verticalScrollBar(), SIGNAL( rangeChanged(int, int) ), this, SLOT( v_rangeChanged(int, int) ) ); connect(e->verticalScrollBar(), SIGNAL( sliderMoved(int) ), this, SLOT( v_sliderMoved(int) ) ); connect(e->verticalScrollBar(), SIGNAL( sliderPressed() ), this, SLOT( v_sliderPressed() ) ); connect(e->verticalScrollBar(), SIGNAL( sliderReleased() ), this, SLOT( v_sliderReleased() ) ); connect(e->verticalScrollBar(), SIGNAL( valueChanged(int) ), this, SLOT( v_valueChanged(int) ) ); connect(l , SIGNAL( clicked(int) ), this, SIGNAL( clicked(int) ) ); }
void Ui::openComponentDialog() { addComponentDialog = new QDialog(this); // set as child of Ui, to be sure that it will be deleted in the end. QVBoxLayout *dialogLayout = new QVBoxLayout; // create vertical layout QVTKWidget *dialogVisualizer = new QVTKWidget; // create qvtk widget dialogViewer = new pcl::visualization::PCLVisualizer("Dialog Viewer", false); dialogVisualizer->SetRenderWindow(dialogViewer->getRenderWindow()); // set as render window the render window of the dialog visualizer dialogViewer->setupInteractor(dialogVisualizer->GetInteractor(), dialogVisualizer->GetRenderWindow()); // tells the visualizer what interactor is using now and for what window dialogViewer->getInteractorStyle()->setKeyboardModifier(pcl::visualization::INTERACTOR_KB_MOD_SHIFT); // ripristina input system of original visualizer (shift+click for points) pcl::PointCloud<pcl::PointXYZRGB>::Ptr temp = motor->getTargetCloud(); pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(temp); dialogViewer->addPointCloud<pcl::PointXYZRGB>(temp, rgb, "cloud"); dialogViewer->setBackgroundColor(0.5, 0.5, 0.5); dialogViewer->initCameraParameters(); dialogViewer->resetCamera(); componentCallbackConnection = dialogViewer->registerPointPickingCallback(&pointPickCallback, this); // callback standard non segmenta nulla QLineEdit *addComponentDialogName = new QLineEdit("Insert Component Name"); addComponentDialogName->setObjectName("componentname"); QHBoxLayout *dialogControlsLayout = new QHBoxLayout; QVBoxLayout *buttonsBox = new QVBoxLayout; QPushButton *selectPointButton = new QPushButton("Select Component"); connect(selectPointButton, SIGNAL(clicked()), this, SLOT(setComponentDialogCallback())); QPushButton *resetButton = new QPushButton("Reset Selection"); connect(resetButton, SIGNAL(clicked()), this, SLOT(resetComponentDialogCallback())); buttonsBox->addWidget(selectPointButton); buttonsBox->addWidget(resetButton); QVBoxLayout *numbersBox = new QVBoxLayout; QColor *selectedColor = new QColor(0, 0, 0, 255); // initialize color at black QPushButton *colorBox = new QPushButton("+-100"); colorBox->setObjectName("colorbox"); colorBox->setStyleSheet(colorToStyleSheet(selectedColor)); colorBox->setMaximumWidth(50); QLineEdit *clusterBox = new QLineEdit("1"); clusterBox->setReadOnly(true); clusterBox->setObjectName("clusterbox"); clusterBox->setMaxLength(5); clusterBox->setMaximumWidth(50); numbersBox->addWidget(clusterBox); numbersBox->addWidget(colorBox); QVBoxLayout *slidersBox = new QVBoxLayout; QSlider *setCluThresholdBar = new QSlider(Qt::Horizontal); setCluThresholdBar->setRange(0,5000); setCluThresholdBar->setValue(1000); motor->setClusterSegThreshold(1000); setCluThresholdBar->setObjectName("sliderCluster"); connect(setCluThresholdBar, SIGNAL(sliderReleased()), this, SLOT(setClusterThreshold())); QSlider *setColThresholdBar = new QSlider(Qt::Horizontal); setColThresholdBar->setRange(0,255); setColThresholdBar->setValue(100); motor->setColorSegThreshold(100); setColThresholdBar->setObjectName("sliderColor"); connect(setColThresholdBar, SIGNAL(sliderReleased()), this, SLOT(setColorThreshold())); slidersBox->addWidget(setCluThresholdBar); slidersBox->addWidget(setColThresholdBar); QPushButton *showSegButton = new QPushButton("Segment!"); connect(showSegButton, SIGNAL(clicked()), this, SLOT(segmentComponent())); dialogControlsLayout->addLayout(buttonsBox); dialogControlsLayout->addLayout(numbersBox); dialogControlsLayout->addLayout(slidersBox); dialogControlsLayout->addWidget(showSegButton); QPushButton *saveComponent = new QPushButton("Save to component list"); saveComponent->setDefault(true); // default button, pressed if enter is pressed connect(saveComponent, SIGNAL(clicked()), this, SLOT(saveComponent())); dialogLayout->addWidget(dialogVisualizer); dialogLayout->addWidget(addComponentDialogName); dialogLayout->addLayout(dialogControlsLayout); dialogLayout->addWidget(saveComponent); addComponentDialog->setLayout(dialogLayout); // DIALOG EXECUTION // addComponentDialog->deleteLater(); // delete dialog when the control returns to the event loop from which deleteLater() was called (after exec i guess) // causa seg fault se viene attivata la callback dialogLayout->deleteLater(); // delete dialog layout when the control returns to the event loop from which deleteLater() was called (after exec i guess) addComponentDialog->resize(800,600); addComponentDialog->exec(); componentCallbackConnection.disconnect(); // disconnect the callback function from the viewer delete dialogViewer; // finita l'esecuzione, deallocare il viewer (deallocare altra eventuale memoria non indirizzata nel QObject tree). }
Window::Window() { this->timerDelay = 250; setWalls(); this->helper.b->initialize(); //setWalls(); setWindowTitle(QString("Mosquito Buzz Buzz: " + this->helper.b->player->playerName)); this->openGL = new GLWidget(&this->helper, this); QGridLayout *layout = new QGridLayout; layout->addWidget(openGL, 0, 1); //layout->addWidget(openGLLabel, 1, 1); setLayout(layout); this->mosquitoLabel = new QLabel(this); layout->addWidget(this->mosquitoLabel, 1, 1); mosquitoLabel->setText("Mosquitoes Eaten: 0"); mosquitoLabel->setAlignment(Qt::AlignLeft); this->roundLabel = new QLabel(this); layout->addWidget(this->roundLabel, 1, 1); roundLabel->setText("Round: 0"); roundLabel->setAlignment(Qt::AlignHCenter); this->timer = new QTimer(this); connect(this->timer, SIGNAL(timeout()), openGL, SLOT(animate())); connect(this->timer, SIGNAL (timeout()), this, SLOT(updateText())); this->timer->start(this->timerDelay); this->stepButton = new QPushButton("Step", this); layout->addWidget(stepButton, 3, 1); layout->setAlignment(stepButton, Qt::AlignTop); connect(stepButton, SIGNAL (released()), openGL, SLOT (step())); connect(stepButton, SIGNAL (released()), this, SLOT(updateText())); this->playButton = new QPushButton("Play", this); this->playButton->setMinimumWidth(250); layout->addWidget(playButton, 4, 1); layout->setAlignment(playButton, Qt::AlignLeft); connect(playButton, SIGNAL (released()), openGL, SLOT (play())); connect(playButton, SIGNAL (released()), this, SLOT(play())); this->pauseButton = new QPushButton("Pause", this); this->pauseButton->setMinimumWidth(250); layout->addWidget(pauseButton, 4, 1); layout->setAlignment(pauseButton, Qt::AlignRight); connect(pauseButton, SIGNAL (released()), this, SLOT (stop())); connect(pauseButton, SIGNAL (released()), openGL, SLOT (stop())); this->newGameButton = new QPushButton("Begin New Game", this); layout->addWidget(newGameButton, 1, 1); layout->setAlignment(newGameButton, Qt::AlignRight); connect(newGameButton, SIGNAL (released()), this, SLOT(startNewGame())); this->timeDelaySlider = new QSlider(Qt::Horizontal, this); this->timeDelaySlider->setFixedWidth(400); this->timeDelaySlider->setMinimum(0); this->timeDelaySlider->setSingleStep(10); this->timeDelaySlider->setValue(250); this->timeDelaySlider->setMaximum(800); this->timeDelaySlider->setSingleStep(10); connect(this->timeDelaySlider, SIGNAL (sliderReleased()), this, SLOT(changeTimerDelay())); layout->addWidget(this->timeDelaySlider, 5, 1); layout->setAlignment(this->timeDelaySlider, Qt::AlignRight); QLabel* timerLabel = new QLabel(this); layout->addWidget(timerLabel, 5, 1); layout->setAlignment(timerLabel, Qt::AlignLeft); timerLabel->setText("Timer Delay"); timerLabel->setIndent(10); timerLabel->setBuddy(this->timeDelaySlider); QLabel* captureTargetLabel = new QLabel(this); layout->addWidget(captureTargetLabel, 2, 1); captureTargetLabel->setIndent(65); captureTargetLabel->setText("Capture Target (%)"); this->captureTargetSpinBox = new QSpinBox; // set percentage for capture rate needed to win captureTargetSpinBox->setRange(1, 100); captureTargetSpinBox->setValue(100); layout->addWidget(captureTargetSpinBox, 2, 1); layout->setAlignment(captureTargetSpinBox, Qt::AlignLeft); connect(captureTargetSpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateCaptureTarget())); QLabel* roundsLabel = new QLabel(this); layout->addWidget(roundsLabel, 2, 1); layout->setAlignment(roundsLabel, Qt::AlignCenter); roundsLabel->setIndent(170); roundsLabel->setText("Rounds (max)"); this->maxRoundsSpinBox = new QSpinBox; // set max num of rounds before game over maxRoundsSpinBox->setRange(100, 10000); maxRoundsSpinBox->setValue(5000); layout->addWidget(maxRoundsSpinBox, 2, 1); layout->setAlignment(maxRoundsSpinBox, Qt::AlignCenter); connect(maxRoundsSpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateMaxRounds())); }
void DevEdit::h_sliderReleased() { emit sliderReleased(Qt::Horizontal); }
void VPiano::initToolBars() { QLabel *lbl; m_dialStyle = new ClassicStyle(); m_dialStyle->setParent(this); // Notes tool bar ui.toolBarNotes->addWidget(lbl = new QLabel(tr("Channel:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_sboxChannel = new QSpinBox(this); m_sboxChannel->setMinimum(1); m_sboxChannel->setMaximum(MIDICHANNELS); m_sboxChannel->setValue(m_channel + 1); m_sboxChannel->setFocusPolicy(Qt::NoFocus); ui.toolBarNotes->addWidget(m_sboxChannel); ui.toolBarNotes->addWidget(lbl = new QLabel(tr("Base Octave:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_sboxOctave = new QSpinBox(this); m_sboxOctave->setMinimum(0); m_sboxOctave->setMaximum(9); m_sboxOctave->setValue(m_baseOctave); m_sboxOctave->setFocusPolicy(Qt::NoFocus); ui.toolBarNotes->addWidget(m_sboxOctave); ui.toolBarNotes->addWidget(lbl = new QLabel(tr("Transpose:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_sboxTranspose = new QSpinBox(this); m_sboxTranspose->setMinimum(-11); m_sboxTranspose->setMaximum(11); m_sboxTranspose->setValue(m_transpose); m_sboxTranspose->setFocusPolicy(Qt::NoFocus); ui.toolBarNotes->addWidget(m_sboxTranspose); ui.toolBarNotes->addWidget(lbl = new QLabel(tr("Velocity:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_Velocity = new Knob(this); m_Velocity->setFixedSize(32, 32); m_Velocity->setStyle(dlgPreferences()->getStyledWidgets()? m_dialStyle : NULL); m_Velocity->setMinimum(0); m_Velocity->setMaximum(127); m_Velocity->setDefaultValue(100); m_Velocity->setDialMode(Knob::LinearMode); m_Velocity->setValue(m_velocity); m_Velocity->setToolTip(QString::number(m_velocity)); m_Velocity->setFocusPolicy(Qt::NoFocus); ui.toolBarNotes->addWidget(m_Velocity); connect( m_sboxChannel, SIGNAL(valueChanged(int)), this, SLOT(slotChannelChanged(int)) ); connect( m_sboxOctave, SIGNAL(valueChanged(int)), this, SLOT(slotBaseOctave(int)) ); connect( m_sboxTranspose, SIGNAL(valueChanged(int)), this, SLOT(slotTranspose(int)) ); connect( m_Velocity, SIGNAL(valueChanged(int)), this, SLOT(setVelocity(int)) ); // Controllers tool bar ui.toolBarControllers->addWidget(lbl = new QLabel(tr("Control:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_comboControl = new QComboBox(this); m_comboControl->setSizeAdjustPolicy(QComboBox::AdjustToContents); m_comboControl->setFocusPolicy(Qt::NoFocus); ui.toolBarControllers->addWidget(m_comboControl); ui.toolBarControllers->addWidget(lbl = new QLabel(tr("Value:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_Control= new Knob(this); m_Control->setFixedSize(32, 32); m_Control->setStyle(dlgPreferences()->getStyledWidgets()? m_dialStyle : NULL); m_Control->setMinimum(0); m_Control->setMaximum(127); m_Control->setValue(0); m_Control->setToolTip("0"); m_Control->setDefaultValue(0); m_Control->setDialMode(Knob::LinearMode); m_Control->setFocusPolicy(Qt::NoFocus); ui.toolBarControllers->addWidget(m_Control); connect( m_comboControl, SIGNAL(currentIndexChanged(int)), SLOT(slotCtlChanged(int)) ); connect( m_Control, SIGNAL(sliderMoved(int)), SLOT(slotController(int)) ); // Pitch bender tool bar ui.toolBarBender->addWidget(lbl = new QLabel(tr("Bender:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_bender = new QSlider(this); m_bender->setOrientation(Qt::Horizontal); m_bender->setMaximumWidth(200); m_bender->setMinimum(BENDER_MIN); m_bender->setMaximum(BENDER_MAX); m_bender->setValue(0); m_bender->setToolTip("0"); m_bender->setFocusPolicy(Qt::NoFocus); ui.toolBarBender->addWidget(m_bender); connect( m_bender, SIGNAL(sliderMoved(int)), SLOT(slotBender(int)) ); connect( m_bender, SIGNAL(sliderReleased()), SLOT(slotBenderReleased()) ); // Programs tool bar ui.toolBarPrograms->addWidget(lbl = new QLabel(tr("Bank:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_comboBank = new QComboBox(this); m_comboBank->setSizeAdjustPolicy(QComboBox::AdjustToContents); m_comboBank->setFocusPolicy(Qt::NoFocus); ui.toolBarPrograms->addWidget(m_comboBank); ui.toolBarPrograms->addWidget(lbl = new QLabel(tr("Program:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_comboProg = new QComboBox(this); m_comboProg->setSizeAdjustPolicy(QComboBox::AdjustToContents); m_comboProg->setFocusPolicy(Qt::NoFocus); ui.toolBarPrograms->addWidget(m_comboProg); connect( m_comboBank, SIGNAL(currentIndexChanged(int)), SLOT(slotBankChanged(int)) ); connect( m_comboProg, SIGNAL(currentIndexChanged(int)), SLOT(slotProgChanged(int)) ); // Toolbars actions: toggle view connect(ui.toolBarNotes->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionNotes, SLOT(setChecked(bool))); connect(ui.toolBarControllers->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionControllers, SLOT(setChecked(bool))); connect(ui.toolBarBender->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionBender, SLOT(setChecked(bool))); connect(ui.toolBarPrograms->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionPrograms, SLOT(setChecked(bool))); connect(ui.toolBarExtra->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionExtraControls, SLOT(setChecked(bool))); // Toolbars actions: buttons connect(ui.actionPanic, SIGNAL(triggered()), SLOT(slotPanic())); connect(ui.actionResetAll, SIGNAL(triggered()), SLOT(slotResetAllControllers())); connect(ui.actionReset, SIGNAL(triggered()), SLOT(slotResetBender())); connect(ui.actionEditExtra, SIGNAL(triggered()), SLOT(slotEditExtraControls())); //connect(ui.actionEditPrograms, SIGNAL(triggered()), SLOT(slotEditPrograms())); }
MarLpcWindow::MarLpcWindow() { frequencyPole_ = 0; amplitudePole_ = .85; QWidget *w = new QWidget; setCentralWidget(w); createActions(); createMenus(); QLabel *breathinessLabel = new QLabel("breathiness"); breathinessSlider_ = new QSlider(Qt::Horizontal); QLabel *cutOffLabel = new QLabel("cutOff"); QSlider *cutOffSlider = new QSlider(Qt::Horizontal); QLabel *frequencyPoleLabel1 = new QLabel("frequencyPole"); QLabel *frequencyPoleLabel2 = new QLabel("frequencyPole"); frequencyPoleSlider_ = new QSlider(Qt::Horizontal); QLabel *amplitudePoleLabel1 = new QLabel("amplitudePole"); QLabel *amplitudePoleLabel2 = new QLabel("amplitudePole"); amplitudePoleSlider_ = new QSlider(Qt::Horizontal); QLabel *tiltLabel = new QLabel("Tilt"); tiltSlider_ = new QSlider(Qt::Horizontal); QLabel *posLabel = new QLabel("Pos"); posSlider_ = new QSlider(Qt::Horizontal); breathinessLabel->setMinimumWidth(150); cutOffLabel->setMinimumWidth(150); frequencyPoleSlider_->setValue(50); amplitudePoleSlider_->setValue(50); tiltSlider_->setValue(50); createNetwork(); QGridLayout *gridLayout = new QGridLayout; gridLayout->addWidget(breathinessLabel, 0, 0); gridLayout->addWidget(breathinessSlider_, 1, 0); gridLayout->addWidget(tiltLabel, 0, 1); gridLayout->addWidget(tiltSlider_, 1, 1); gridLayout->addWidget(frequencyPoleLabel1, 2, 0); gridLayout->addWidget(frequencyPoleSlider_, 3, 0); gridLayout->addWidget(amplitudePoleLabel1, 2, 1); gridLayout->addWidget(amplitudePoleSlider_, 3, 1); gridLayout->addWidget(posLabel, 5, 0); gridLayout->addWidget(posSlider_, 6, 0); gridLayout->addWidget(posControl_, 6, 1); gridLayout->addWidget(frequencyPoleControl_, 4, 0); gridLayout->addWidget(amplitudePoleControl_, 4, 1); connect(breathinessSlider_, SIGNAL(valueChanged(int)), this, SLOT(breathinessChanged(int))); connect(cutOffSlider, SIGNAL(valueChanged(int)), this, SLOT(cutOffChanged(int))); connect(frequencyPoleSlider_, SIGNAL(valueChanged(int)), this, SLOT(frequencyPoleChanged(int))); connect(amplitudePoleSlider_, SIGNAL(valueChanged(int)), this, SLOT(amplitudePoleChanged(int))); connect(tiltSlider_, SIGNAL(valueChanged(int)), this, SLOT(tiltChanged(int))); connect(posSlider_, SIGNAL(sliderReleased()), this, SLOT(posChanged())); connect(mwr_, SIGNAL(ctrlChanged(MarControlPtr)), this, SLOT(ctrlChanged(MarControlPtr))); w->setLayout(gridLayout); startNetwork(); }
Slider::Slider(QWidget *parent,Tokeniser *t) : QWidget(NULL) { bool rangeGot = false; bool always = false; bool vertical = false; immediate = false; renderer = NULL; char outVar[64]; //!< name of the variable to write to title[0]=0; inverse = ConfigManager::inverse; ConfigRect pos = ConfigManager::parseRect(); bool done = false; t->getnextcheck(T_OCURLY); initSet=false; DataBuffer<float> *buf=NULL; outVar[0]=0; epsilon = 0.001f; isInteger=false; while(!done){ switch(t->getnext()){ case T_EXPR: // optional, provides a 'feedback' value case T_VAR: t->rewind(); buf = ConfigManager::parseFloatSource(); break; case T_EPSILON: epsilon = t->getnextfloat(); break; case T_INTEGER: isInteger=true; break; case T_OUT: t->getnextident(outVar); break; case T_INITIAL: initial = t->getnextfloat(); initSet=true; break; case T_HORIZONTAL: // dummy since it's the default break; case T_VERTICAL: vertical = true; break; case T_RANGE: minVal = t->getnextfloat(); t->getnextcheck(T_TO); maxVal = t->getnextfloat(); rangeGot=true; break; case T_TITLE: t->getnextstring(title); break; case T_ALWAYS: always=true; break; case T_IMMEDIATE: immediate=true; break; case T_CCURLY: done=true; break; default: throw Exception(t->getline()).set("Unexpected '%s'",t->getstring()); } } if(!outVar[0]) throw Exception("no output name given for slider",t->getline()); if(!rangeGot) throw Exception("no range given for slider",t->getline()); if(!initSet)initial=minVal; // create a new outvar out = new OutValue(outVar,0,always); out->listener=this; // so we know when our var was sent UDPClient::getInstance()->add(out); if(!title[0]) strcpy(title,outVar); renderer = buf ? new DataRenderer(this,buf) : NULL; connect(&timer,SIGNAL(timeout()),this,SLOT(timerTick())); try{ ConfigManager::registerNudgeable(outVar,this); }catch(Exception& e){ throw Exception(e,t->getline()); } QVBoxLayout *layout; layout = new QVBoxLayout(this); layout->setSpacing(0); slider = new InternalSlider(vertical?Qt::Vertical:Qt::Horizontal,this); slider->setMaximum(100); slider->setMinimum(0); layout->setAlignment(Qt::AlignCenter); label = new QLabel(title); label->setAlignment(Qt::AlignCenter); label->setMaximumSize(10000,30); layout->addWidget(slider); layout->addWidget(label); setLayout(layout); slider->setStyleSheet(defaultStyle); connect(slider,SIGNAL(sliderPressed()),this,SLOT(pressed())); connect(slider,SIGNAL(sliderReleased()),this,SLOT(released())); QGridLayout *l = (QGridLayout*)parent->layout(); l->addWidget(this,pos.y,pos.x,pos.h,pos.w); setMinimumSize(100,100); timer.start(200); machine.start(initState,this); setDrawProperties(); }
void SliderBase::mouseReleaseEvent(QMouseEvent *e) { int ms = 0; /*double inc = step(); */ // prevent compiler warning: unused variable _ignoreMouseMove = false; const Qt::MouseButton button = e->button(); switch (d_scrollMode) { case ScrMouse: if (button == Qt::RightButton) { d_scrollMode = ScrNone; break; } if (_cursorHoming && button == Qt::LeftButton) d_scrollMode = ScrNone; else { setPosition(e->pos()); d_direction = 0; d_mouseOffset = 0; if (d_mass > 0.0) { ms = d_time.elapsed(); if ((fabs(d_speed) > 0.0) && (ms < 50)) d_tmrID = startTimer(d_updTime); } else { d_scrollMode = ScrNone; buttonReleased(); } } emit sliderReleased(_id); break; case ScrDirect: setPosition(e->pos()); d_direction = 0; d_mouseOffset = 0; d_scrollMode = ScrNone; buttonReleased(); break; case ScrPage: stopMoving(); d_timerTick = 0; buttonReleased(); d_scrollMode = ScrNone; break; case ScrTimer: stopMoving(); d_timerTick = 0; buttonReleased(); d_scrollMode = ScrNone; break; default: d_scrollMode = ScrNone; buttonReleased(); } }
ReseterSlider::ReseterSlider(QWidget *parent) : QSlider(parent) { connect(this, SIGNAL(sliderReleased()), this, SLOT(resetValue())); }
void MusicWidget::setupGUI() { QVBoxLayout *layout = new QVBoxLayout(this); layout->addSpacing(10); m_playlistView = new QTableWidget(); RowDelegate *rowDelegate = new RowDelegate(this); m_playlistView->setItemDelegate(rowDelegate); m_playlistView->setStyleSheet(PLAYLIST_VIEW_STYLE); m_playlistView->setSelectionMode(QAbstractItemView::SingleSelection); m_playlistView->setSelectionBehavior(QAbstractItemView::SelectRows); m_playlistView->setVerticalScrollMode(QAbstractItemView::ScrollPerItem); m_playlistView->setEditTriggers(QAbstractItemView::NoEditTriggers); m_playlistView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_playlistView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_playlistView->setShowGrid(false); layout->addWidget(m_playlistView); connect(m_playlistView, SIGNAL(cellClicked(int,int)) , this, SLOT(onCellClicked(int,int))); layout->addSpacing(4); m_currentSongLabel = new QLabel(); m_currentSongLabel->setStyleSheet(CURRENT_LABEL_STYLE); layout->addWidget(m_currentSongLabel); QSize buttonSize(41, 33); m_playModeButton = new QPushButton(g_playmodeTexts[QMediaPlaylist::Loop], this); m_playModeButton->adjustSize(); #ifdef ANDROID QSize screenSize = qApp->primaryScreen()->size(); if(screenSize.width() > 960 || screenSize.height() > 960) { buttonSize *= (m_playModeButton->height() / 33); } #endif QHBoxLayout * controlLayout = new QHBoxLayout; controlLayout->setSpacing(4); layout->addLayout(controlLayout); controlLayout->addStretch(1); m_folderButton = new ImageButton(QPixmap(":/images/openfile.png") , QPixmap(":/images/openfile_down.png")); connect(m_folderButton, SIGNAL(clicked()), this, SIGNAL(selectSong())); m_folderButton->setFixedSize(buttonSize); controlLayout->addWidget(m_folderButton); m_prevButton = new ImageButton(QPixmap(":/images/preSong.png"), QPixmap(":/images/preSong_down.png")); m_prevButton->setFixedSize(buttonSize); connect(m_prevButton, SIGNAL(clicked()), m_playlist, SLOT(previous())); controlLayout->addWidget(m_prevButton); m_playpauseButton = new ImageButton(QPixmap(":/images/playpause.png") ,QPixmap(":/images/playpause_down.png")); m_playpauseButton->setFixedSize(buttonSize); connect(m_playpauseButton, SIGNAL(clicked()), this, SLOT(onPlayPauseButton())); controlLayout->addWidget(m_playpauseButton); m_stopButton = new ImageButton(QPixmap(":/images/stop.png") , QPixmap(":/images/stop_down.png")); m_stopButton->setFixedSize(buttonSize); connect(m_stopButton, SIGNAL(clicked()), this, SLOT(onStopButton())); controlLayout->addWidget(m_stopButton); m_nextButton = new ImageButton(QPixmap(":/images/nextSong.png") , QPixmap(":/images/nextSong_down.png")); m_nextButton->setFixedSize(buttonSize); connect(m_nextButton, SIGNAL(clicked()), m_playlist, SLOT(next())); controlLayout->addWidget(m_nextButton); QCheckBox *muteBox = new QCheckBox(); muteBox->setStyleSheet(MUTE_CHECKBOX_STYLE); connect(muteBox, SIGNAL(stateChanged(int)), this, SLOT(onMuteButtonStateChanged(int))); controlLayout->addWidget(muteBox); connect(m_playModeButton, SIGNAL(clicked()), this, SLOT(onPlayModeButton())); controlLayout->addWidget(m_playModeButton); controlLayout->addStretch(1); QGridLayout *progressLayout = new QGridLayout(); layout->addLayout(progressLayout); m_playProgress = new QSlider(Qt::Horizontal); //m_playProgress->setFixedWidth(280); m_playProgress->setStyleSheet(SLIDER_STYLE); progressLayout->addWidget(m_playProgress, 0, 0, 1, 2); connect(m_playProgress, SIGNAL(sliderPressed()), this, SLOT(onSliderPressed())); connect(m_playProgress, SIGNAL(sliderReleased()), this, SLOT(onSliderReleased())); m_positionLabel = new QLabel(); m_positionLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop); progressLayout->addWidget(m_positionLabel, 1, 0, Qt::AlignLeft | Qt::AlignTop); m_durationLabel = new QLabel(); m_durationLabel->setAlignment(Qt::AlignRight | Qt::AlignTop); progressLayout->addWidget(m_durationLabel, 1, 1, Qt::AlignRight | Qt::AlignTop); }
Player::Player(QWidget *parent) : QWidget(parent), ui(new Ui::Player) { std::cout << "Initialize player..." << std::endl; ui->setupUi(this); //Add MPlayer frame mplayer = new MPlayer; ui->playerLayout->setMargin(0); ui->playerLayout->addWidget(mplayer, 1); //enable autohiding toolbar mplayer->installEventFilter(this); mplayer->setMouseTracking(true); mplayer->getLayer()->installEventFilter(this); mplayer->getLayer()->setMouseTracking(true); ui->toolBar->installEventFilter(this); //move window ui->titleBar->installEventFilter(this); //Add Playlist playlist = new Playlist; ui->playerLayout->addWidget(playlist); playlist->installEventFilter(this); //Add Border topLeftBorder = new Border(this, Border::LEFT); topLeftBorder->setObjectName("topLeftBorder"); topRightBorder = new Border(this, Border::RIGHT); topRightBorder->setObjectName("topRightBorder"); ui->titleBarLayout->insertWidget(0, topLeftBorder); ui->titleBarLayout->addWidget(topRightBorder); leftBorder = new Border(this, Border::LEFT); leftBorder->setObjectName("leftBorder"); rightBorder = new Border(this, Border::RIGHT); rightBorder->setObjectName("rightBorder"); bottomBorder = new Border(this, Border::BOTTOM); bottomBorder->setObjectName("bottomBorder"); ui->playerLayout->insertWidget(0, leftBorder); ui->playerLayout->addWidget(rightBorder); ui->mainLayout->addWidget(bottomBorder); ui->pauseButton->hide(); ui->progressBar->hide(); playlist->hide(); //Add Cutterbar cutterbar = new CutterBar; int insertPos = ui->mainLayout->indexOf(ui->toolBar); ui->mainLayout->insertWidget(insertPos, cutterbar); cutterbar->hide(); mplayer->menu->addAction(tr("Cut video"), this, SLOT(showCutterbar()), QKeySequence("C")); //Add WebVideo webvideo = new WebVideo; reslibrary = new ResLibrary; webvideo->insertTab(0, reslibrary, tr("Resources")); webvideo->setCurrentIndex(0); //add downloader downloader = new Downloader; webvideo->addTab(downloader, tr("Downloader")); //add transformer transformer = new Transformer; //Settings Dialog settingsDialog = new SettingsDialog(this); //Add menu menu = new QMenu(tr("Player"), this); menu->addAction(tr("Online video"), webvideo, SLOT(show())); menu->addAction(tr("Transform video"), transformer, SLOT(show())); menu->addAction(tr("Settings"), this, SLOT(onSetButton())); menu->addSeparator(); menu->addAction(tr("Ext. for browser"), this, SLOT(openExtPage())); menu->addAction(tr("Homepage"), this, SLOT(openHomepage())); //Add time show timeShow = new QLabel(mplayer); timeShow->move(0, 0); timeShow->hide(); //Connect connect(ui->playButton, SIGNAL(clicked()), mplayer, SLOT(changeState())); connect(ui->pauseButton, SIGNAL(clicked()), mplayer, SLOT(changeState())); connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(onStopButton())); connect(ui->progressBar, SIGNAL(valueChanged(int)), this, SLOT(onPBarChanged(int))); connect(ui->progressBar, SIGNAL(sliderPressed()), this, SLOT(onPBarPressed())); connect(ui->progressBar, SIGNAL(sliderReleased()), this, SLOT(onPBarReleased())); connect(ui->volumeSlider, SIGNAL(valueChanged(int)), mplayer, SLOT(setVolume(int))); connect(ui->volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(onSaveVolume(int))); connect(ui->netButton, SIGNAL(clicked()), webvideo, SLOT(show())); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close())); connect(ui->minButton, SIGNAL(clicked()), this, SLOT(showMinimized())); connect(ui->maxButton, SIGNAL(clicked()), this, SLOT(setMaxNormal())); connect(ui->menuButton, SIGNAL(clicked()), this, SLOT(showMenu())); connect(mplayer, SIGNAL(played()), this, SLOT(setIconToPause())); connect(mplayer, SIGNAL(paused()), this, SLOT(setIconToPlay())); connect(mplayer, SIGNAL(stopped()), this, SLOT(onStopped())); connect(mplayer, SIGNAL(timeChanged(int)), this, SLOT(onProgressChanged(int))); connect(mplayer, SIGNAL(lengthChanged(int)), this, SLOT(onLengthChanged(int))); connect(mplayer, SIGNAL(fullScreen()), this, SLOT(setFullScreen())); connect(mplayer, SIGNAL(sizeChanged(QSize&)), this, SLOT(onSizeChanged(QSize&))); connect(playlist, &Playlist::fileSelected, mplayer, &MPlayer::openFile); connect(playlist, SIGNAL(needPause(bool)), this, SLOT(onNeedPause(bool))); connect(downloader, SIGNAL(newPlay(const QString&,const QString&)), playlist, SLOT(addFileAndPlay(const QString&,const QString&))); connect(downloader, SIGNAL(newFile(const QString&,const QString&)), playlist, SLOT(addFile(const QString&,const QString&))); connect(cutterbar, SIGNAL(newFrame(int)), mplayer, SLOT(jumpTo(int))); connect(cutterbar, SIGNAL(finished()), cutterbar, SLOT(hide())); connect(cutterbar, SIGNAL(finished()), ui->toolBar, SLOT(show())); //Set skin setSkin(Settings::skinList[Settings::currentSkin]); //Set default volume ui->volumeSlider->setValue(Settings::volume); no_play_next = false; is_fullscreen = false; toolbar_visible = true; mouse_in_toolbar = false; progressbar_pressed = false; }
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware): GenericPanel(parent, model, generalSettings, firmware), functions(model ? model->customFn : generalSettings.customFn) #if defined(PHONON) , phononCurrent(-1), clickObject(NULL), clickOutput(NULL) #endif { Stopwatch s1("CustomFunctionsPanel - populate"); lock = true; int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions); if (!firmware->getCapability(VoicesAsNumbers)) { tracksSet = getFilesSet(getSoundsPath(generalSettings), QStringList() << "*.wav" << "*.WAV", firmware->getCapability(VoicesMaxLength)); for (int i=0; i<num_fsw; i++) { if (functions[i].func==FuncPlayPrompt || functions[i].func==FuncBackgroundMusic) { QString temp = functions[i].paramarm; if (!temp.isEmpty()) { tracksSet.insert(temp); } } } } s1.report("get tracks"); if (IS_TARANIS(firmware->getBoard())) { scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/FUNCTIONS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength)); for (int i=0; i<num_fsw; i++) { if (functions[i].func==FuncPlayScript) { QString temp = functions[i].paramarm; if (!temp.isEmpty()) { scriptsSet.insert(temp); } } } } s1.report("get scripts"); CompanionIcon playIcon("play.png"); QStringList headerLabels; headerLabels << "#" << tr("Switch") << tr("Action") << tr("Parameters") << tr("Enable"); TableLayout * tableLayout = new TableLayout(this, num_fsw, headerLabels); for (int i=0; i<num_fsw; i++) { // The label QLabel * label = new QLabel(this); label->setContextMenuPolicy(Qt::CustomContextMenu); label->setMouseTracking(true); label->setProperty("index", i); if (model) label->setText(tr("SF%1").arg(i+1)); else label->setText(tr("GF%1").arg(i+1)); label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint))); tableLayout->addWidget(i, 0, label); // s1.report("label"); // The switch fswtchSwtch[i] = new QComboBox(this); fswtchSwtch[i]->setProperty("index", i); populateSwitchCB(fswtchSwtch[i], functions[i].swtch, generalSettings, model ? SpecialFunctionsContext : GlobalFunctionsContext); fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); fswtchSwtch[i]->setMaxVisibleItems(10); connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); tableLayout->addWidget(i, 1, fswtchSwtch[i]); // s1.report("switch"); // The function fswtchFunc[i] = new QComboBox(this); fswtchFunc[i]->setProperty("index", i); populateFuncCB(fswtchFunc[i], functions[i].func); connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited())); tableLayout->addWidget(i, 2, fswtchFunc[i]); // s1.report("func"); // The parameters QHBoxLayout * paramLayout = new QHBoxLayout(); tableLayout->addLayout(i, 3, paramLayout); fswtchGVmode[i] = new QComboBox(this); fswtchGVmode[i]->setProperty("index", i); populateGVmodeCB(fswtchGVmode[i], functions[i].adjustMode); fswtchGVmode[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); connect(fswtchGVmode[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchGVmode[i]); fswtchParamGV[i] = new QCheckBox(this); fswtchParamGV[i]->setProperty("index", i); fswtchParamGV[i]->setText("GV"); fswtchParamGV[i]->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); connect(fswtchParamGV[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchParamGV[i]); fswtchParam[i] = new QDoubleSpinBox(this); fswtchParam[i]->setProperty("index", i); fswtchParam[i]->setAccelerated(true); fswtchParam[i]->setDecimals(0); connect(fswtchParam[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchParam[i]); fswtchParamTime[i] = new QTimeEdit(this); fswtchParamTime[i]->setProperty("index", i); fswtchParamTime[i]->setAccelerated(true); fswtchParamTime[i]->setDisplayFormat("hh:mm:ss"); connect(fswtchParamTime[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchParamTime[i]); fswtchParamT[i] = new QComboBox(this); fswtchParamT[i]->setProperty("index", i); populateFuncParamCB(fswtchParamT[i], functions[i].func, functions[i].param, functions[i].adjustMode); paramLayout->addWidget(fswtchParamT[i]); fswtchParamT[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); connect(fswtchParamT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); fswtchParamArmT[i] = new QComboBox(this); fswtchParamArmT[i]->setProperty("index", i); fswtchParamArmT[i]->setEditable(true); fswtchParamArmT[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); paramLayout->addWidget(fswtchParamArmT[i]); connect(fswtchParamArmT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited())); fswtchBLcolor[i] = new QSlider(this); fswtchBLcolor[i]->setProperty("index", i); fswtchBLcolor[i]->setMinimum(0); fswtchBLcolor[i]->setMaximum(100); fswtchBLcolor[i]->setSingleStep(1); fswtchBLcolor[i]->setOrientation(Qt::Horizontal); paramLayout->addWidget(fswtchBLcolor[i]); connect(fswtchBLcolor[i], SIGNAL(sliderReleased()), this, SLOT(customFunctionEdited())); #ifdef PHONON playBT[i] = new QPushButton(this); playBT[i]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); playBT[i]->setProperty("index", i); playBT[i]->setIcon(playIcon); paramLayout->addWidget(playBT[i]); connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic())); #endif QHBoxLayout * repeatLayout = new QHBoxLayout(); tableLayout->addLayout(i, 4, repeatLayout); fswtchRepeat[i] = new RepeatComboBox(this, functions[i].repeatParam); repeatLayout->addWidget(fswtchRepeat[i], i+1); connect(fswtchRepeat[i], SIGNAL(modified()), this, SLOT(onChildModified())); fswtchEnable[i] = new QCheckBox(this); fswtchEnable[i]->setProperty("index", i); fswtchEnable[i]->setText(tr("ON")); fswtchEnable[i]->setFixedWidth(200); repeatLayout->addWidget(fswtchEnable[i], i+1); connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited())); } s1.report("add items"); disableMouseScrolling(); s1.report("disableMouseScrolling"); lock = false; update(); s1.report("update"); tableLayout->resizeColumnsToContents(); s1.report("resizeColumnsToContents"); tableLayout->setColumnWidth(3, 300); tableLayout->pushRowsUp(num_fsw+1); s1.report("end"); }
void KGrSLDialog::setupWidgets() { int margin = marginHint(); int spacing = spacingHint(); QWidget * dad = new QWidget (this); setMainWidget (dad); setCaption (i18n ("Select Game")); setButtons (KDialog::Ok | KDialog::Cancel | KDialog::Help); setDefaultButton (KDialog::Ok); QVBoxLayout * mainLayout = new QVBoxLayout (dad); mainLayout->setSpacing (spacing); mainLayout->setMargin (margin); gameL = new QLabel (i18n ("<html><b>Please select a game:</b></html>"), dad); mainLayout->addWidget (gameL, 5); games = new QTreeWidget (dad); mainLayout->addWidget (games, 50); games->setColumnCount (4); games->setHeaderLabels (QStringList() << i18n ("Name of Game") << i18n ("Rules") << i18n ("Levels") << i18n ("Skill")); games->setRootIsDecorated (false); QHBoxLayout * hboxLayout1 = new QHBoxLayout(); hboxLayout1->setSpacing (6); hboxLayout1->setMargin (0); gameN = new QLabel ("", dad); // Name of selected game. QFont f = gameN->font(); f.setBold (true); gameN->setFont (f); hboxLayout1->addWidget (gameN); QSpacerItem * spacerItem1 = new QSpacerItem (21, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); hboxLayout1->addItem (spacerItem1); gameD = new QLabel ("", dad); // Description of game. hboxLayout1->addWidget (gameD); mainLayout->addLayout (hboxLayout1, 5); gameAbout = new QTextEdit (dad); gameAbout->setReadOnly (true); mainLayout->addWidget (gameAbout, 25); QFrame * separator = new QFrame (dad); separator->setFrameShape (QFrame::HLine); mainLayout->addWidget (separator); if ((slAction == SL_START) || (slAction == SL_UPD_GAME)) { dad-> setWindowTitle (i18n ("Select Game")); QLabel * startMsg = new QLabel ("<b>" + i18n ("Level 1 of the selected game is:") + "</b>", dad); mainLayout->addWidget (startMsg, 5); } else { dad-> setWindowTitle (i18n ("Select Game/Level")); QLabel * selectLev = new QLabel ("<b>" + i18n ("Please select a level:") + "</b>", dad); mainLayout->addWidget (selectLev, 5); } QGridLayout * grid = new QGridLayout; mainLayout->addLayout (grid); number = new QScrollBar (Qt::Vertical, dad); number->setRange (1, 150); number->setSingleStep (1); number->setPageStep (10); number->setValue (1); grid->addWidget (number, 1, 5, 4, 1); QWidget * numberPair = new QWidget (dad); QHBoxLayout *hboxLayout2 = new QHBoxLayout (numberPair); hboxLayout2->setMargin (0); numberPair->setLayout (hboxLayout2); grid->addWidget (numberPair, 1, 1, 1, 3); numberL = new QLabel (i18n ("Level number:"), numberPair); display = new KIntSpinBox (numberPair); display->setRange (1, 150); hboxLayout2->addWidget (numberL); hboxLayout2->addWidget (display); levelNH = new QPushButton (i18n ("Edit Level Name && Hint"), dad); mainLayout->addWidget (levelNH); slName = new QLabel ("", dad); grid->addWidget (slName, 2, 1, 1, 4); thumbNail = new KGrThumbNail (dad); grid->addWidget (thumbNail, 1, 6, 4, 5); // Set thumbnail cell size to about 1/5 of game cell size. int cellSize = slParent->width() / (5 * (FIELDWIDTH + 4)); cellSize = (cellSize < 4) ? 4 : cellSize; thumbNail-> setFixedWidth ((FIELDWIDTH * cellSize) + 2); thumbNail-> setFixedHeight ((FIELDHEIGHT * cellSize) + 2); // Base the geometry of the dialog box on the playing area. int cell = slParent->width() / (FIELDWIDTH + 4); dad-> setMinimumSize ((FIELDWIDTH*cell/2), (FIELDHEIGHT-3)*cell); // Avoid spilling into the Taskbar or Apple Dock area if they get too close. // Otherwise allow the dialog to choose its size and then be resizeable. const QRect avail = QApplication::desktop()->availableGeometry(this); if ((avail.height() - slParent->height()) <= 120) { dad->setFixedHeight (slParent->height() - 120); // Keep 120 for buttons. } // Set the default for the level-number in the scrollbar. number-> setTracking (true); number->setValue (defaultLevel); slSetGames (defaultGame); // Vary the dialog according to the action. QString OKText = ""; switch (slAction) { case SL_START: // Must start at level 1, but can choose a game. OKText = i18n ("Start Game"); number->setValue (1); number->setEnabled (false); display->setEnabled (false); number->hide(); numberL->hide(); display->hide(); break; case SL_ANY: // Can start playing at any level in any game. OKText = i18n ("Play Level"); break; case SL_REPLAY: // Can ask to see a replay of any level in any game. OKText = i18n ("Replay Level"); break; case SL_SOLVE: // Can ask to see a solution of any level in any game. OKText = i18n ("Show Solution"); break; case SL_SAVE_SOLUTION: // Can ask to save a recording on a solution-file. OKText = i18n ("Save A Solution"); break; case SL_UPDATE: // Can use any level in any game as edit input. OKText = i18n ("Edit Level"); break; case SL_CREATE: // Can save a new level only in a USER game. OKText = i18n ("Save New"); break; case SL_SAVE: // Can save an edited level only in a USER game. OKText = i18n ("Save Change"); break; case SL_DELETE: // Can delete a level only in a USER game. OKText = i18n ("Delete Level"); break; case SL_MOVE: // Can move a level only into a USER game. OKText = i18n ("Move To..."); break; case SL_UPD_GAME: // Can only edit USER game details. OKText = i18n ("Edit Game Info"); number->setValue (1); number->setEnabled (false); display->setEnabled (false); number->hide(); numberL->hide(); display->hide(); break; default: break; // Keep the default settings. } if (!OKText.isEmpty()) { setButtonGuiItem (KDialog::Ok, KGuiItem (OKText)); } // Set value in the line-edit box. slShowLevel (number->value()); if (display->isEnabled()) { display->setFocus(); // Set the keyboard input on. display->selectAll(); } // Paint a thumbnail sketch of the level. thumbNail->setFrameStyle (QFrame::Box | QFrame::Plain); thumbNail->setLineWidth (1); slPaintLevel(); thumbNail->show(); connect (games, SIGNAL (itemSelectionChanged()), this, SLOT (slGame())); connect (display, SIGNAL (valueChanged(QString)), this, SLOT (slUpdate(QString))); connect (number, SIGNAL(valueChanged(int)), this, SLOT(slShowLevel(int))); // Only enable name and hint dialog here if saving a new or edited level. // At other times the name and hint have not been loaded or initialised yet. if ((slAction == SL_CREATE) || (slAction == SL_SAVE)) { // Signal editNameAndHint() relays the click to a KGrEditor connection. connect (levelNH, SIGNAL (clicked()), this, SIGNAL (editNameAndHint())); } else { levelNH->setEnabled (false); levelNH->hide(); } connect (games, SIGNAL(itemSelectionChanged()), this, SLOT(slPaintLevel())); connect (number, SIGNAL (sliderReleased()), this, SLOT (slPaintLevel())); connect (this, SIGNAL (helpClicked()), this, SLOT (slotHelp())); }
void VideoPlayerTool::initPlayer() { fprintf(stderr, "[VideoPlayerT] %s:%d : initializing video codecs... FFMPEG version '" LIBAVCODEC_IDENT "'\n", __func__, __LINE__); m_fileVA = NULL; m_editBookmarksForm = NULL; playTimer = NULL; playSpeed = 1.f; playContinuous = false; QFileInfo fi(VideoFile); pWin->setCaption(tr("Movie:") + fi.fileName()); // buttons chdir(":/images/pixmaps"); playerVBox = new Q3VBox(pWin); playerVBox->resize(320, 266); playHBox = new Q3HBox(playerVBox); playHBox->setSpacing(1); rewindMovie = new QPushButton( playHBox); { QPixmap pixIcon; if(pixIcon.load(":/images/pixmaps/VcrRewind.png")) rewindMovie->setPixmap(pixIcon); else rewindMovie->setText(tr("Rewind")); } rewindMovie->setFlat(true); rewindMovie->setToggleButton(false); connect(rewindMovie, SIGNAL(clicked()), this, SLOT(slotRewindMovie())); QPushButton * stepBackMovie = new QPushButton( playHBox); { QPixmap pixIcon; if(pixIcon.load(":/images/pixmaps/VcrStepBackward.png")) stepBackMovie->setPixmap(pixIcon); else stepBackMovie->setText(tr("Back")); } stepBackMovie->setFlat(true); stepBackMovie->setToggleButton(false); connect(stepBackMovie, SIGNAL(clicked()), this, SLOT(slotStepBackwardMovie())); playMovie = new QPushButton( playHBox); { QPixmap pixIcon; if(pixIcon.load(":/images/pixmaps/VcrPlay.png")) playMovie->setPixmap(pixIcon); else playMovie->setText(tr("Play")); } playMovie->setFlat(true); playMovie->setToggleButton(false); connect(playMovie, SIGNAL(clicked()), this, SLOT(slotPlayPauseMovie())); stepMovie = new QPushButton( playHBox); { QPixmap pixIcon; if(pixIcon.load(":/images/pixmaps/VcrStepForward.png")) stepMovie->setPixmap(pixIcon); else stepMovie->setText(tr("Step")); } stepMovie->setFlat(true); stepMovie->setToggleButton(false); connect(stepMovie, SIGNAL(clicked()), this, SLOT(slotStepMovie())); playCombo = new QComboBox(playHBox); playCombo->insertItem("x 1/4", -1); playCombo->insertItem("x 1/2", -1); playCombo->insertItem("x 1", -1); playCombo->insertItem("x 2", -1); playCombo->insertItem("x 4", -1); playCombo->setCurrentItem(2); connect( playCombo, SIGNAL( activated( const QString &) ), this, SLOT( slotSpeedMovie( const QString & ) ) ); // play as grayscale grayButton = new QPushButton( playHBox); { QPixmap pixIcon; if(pixIcon.load(":/images/pixmaps/:images/22x22/view-color.png")) grayButton->setPixmap(pixIcon); else grayButton->setText(tr("Rewind")); } grayButton->setFlat(true); grayButton->setToggleButton(true); QToolTip::add(grayButton, tr("Toggle grayscale/color")); playGrayscale = false; connect(grayButton, SIGNAL(toggled(bool)), this, SLOT(on_grayButton_toggled(bool))); // Scrollbar playScrollBar = new QSlider(Qt::Horizontal, playHBox); //playScrollBar->setOrientation( Qt::Horizontal ); playScrollBar->setMinimum(0); playScrollBar->setPageStep(1); //playScrollBar->setRange(0, 100); playScrollBar->setMaximum(100); playScrollBar->setValue( 0 ); playScrollBar->setTracking(false); connect(playScrollBar, SIGNAL(sliderReleased()), this, SLOT(slotReleaseScrollbar())); connect(playScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotChangedScrollbar(int))); // bookmarks button and menu buttonBookmarks = new QPushButton( playHBox); { QPixmap pixMap; if(pixMap.load(":/images/pixmaps/IconBookmark.png")) buttonBookmarks->setPixmap(pixMap); else buttonBookmarks->setText(tr("Bkmk")); } buttonBookmarks->setFlat(true); buttonBookmarks->setToggleButton(true); buttonBookmarks->setToolTip(tr("Bookmarks")); menuBookmarks = new QMenu(playHBox); buttonBookmarks->setPopup(menuBookmarks); // Append add and edit buttons QIcon pixIcon("IconBookmark.png"); actAddBookmark = menuBookmarks->addAction(pixIcon, tr("Add")); actAddBookmark->setToolTip(tr("Add a bookmark at this position in movie")); actAddBookmark->setIconVisibleInMenu(true); QIcon editIcon("IconBookmarkEdit.png"); actEditBookmark = menuBookmarks->addAction(editIcon, tr("Edit")); actEditBookmark->setIconVisibleInMenu(true); actEditBookmark->setToolTip(tr("Edit bookmarks list")); QIcon playIcon("IconBookmarkPlay.png"); actPlayToBookmark = menuBookmarks->addAction(playIcon, tr("Play until bmrk")); actPlayToBookmark->setIconVisibleInMenu(true); actPlayToBookmark->setToolTip(tr("Play video until next bookmark")); menuBookmarks->addSeparator(); connect(menuBookmarks, SIGNAL(triggered(QAction *)), this, SLOT(on_menuBookmarks_triggered(QAction *))); play_period_ms = 40; // 25 fps // image detailsImage = new WorkshopImage( "full size image" ); detailsImage->QImage::create(320, 240, 32); // detailsView = new WorkshopImageTool( detailsImage, containerWorkshopImageTool, detailsView = new WorkshopImageTool( detailsImage, playerVBox, true, // show snap button true, // show record button "FullsizeImageViewer", Qt::WA_DeleteOnClose //WDestructiveClose ); // This won't force the image to be on workspace because it already has a parent detailsView->setWorkspace((QWorkspace *)pWorkspace); detailsView->display()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); detailsView->display()->update(); connect(pWin, SIGNAL(signalResizeEvent(QResizeEvent *)), this, SLOT(slotResizeTool(QResizeEvent *))); pWin->resize(380,320); }
Player::Player(QWidget *parent) : QWidget(parent), ui(new Ui::Player) { std::cout << "Initialize player..." << std::endl; ui->setupUi(this); //Add MPlayer frame mplayer = new MPlayer; ui->playerLayout->setMargin(0); ui->playerLayout->addWidget(mplayer, 1); //enable autohiding toolbar mplayer->installEventFilter(this); mplayer->setMouseTracking(true); mplayer->getLayer()->installEventFilter(this); mplayer->getLayer()->setMouseTracking(true); ui->toolBar->installEventFilter(this); //move window ui->titleBar->installEventFilter(this); //Add Playlist playlist = new Playlist; ui->playerLayout->addWidget(playlist); //Add Border topLeftBorder = new Border(this, Border::LEFT); topLeftBorder->setObjectName("topLeftBorder"); topRightBorder = new Border(this, Border::RIGHT); topRightBorder->setObjectName("topRightBorder"); ui->titleBarLayout->insertWidget(0, topLeftBorder); ui->titleBarLayout->addWidget(topRightBorder); leftBorder = new Border(this, Border::LEFT); leftBorder->setObjectName("leftBorder"); rightBorder = new Border(this, Border::RIGHT); rightBorder->setObjectName("rightBorder"); bottomBorder = new Border(this, Border::BOTTOM); bottomBorder->setObjectName("bottomBorder"); ui->playerLayout->insertWidget(0, leftBorder); ui->playerLayout->addWidget(rightBorder); ui->mainLayout->addWidget(bottomBorder); //Add WebVideo webvideo = new WebVideo; //add downloader downloader = new Downloader; webvideo->addTab(downloader, tr("Downloader")); //add transformer transformer = new Transformer; //Add menu menubar = new QMenuBar; menu = menubar->addMenu(tr("Player")); menu->addAction(tr("Online video"), webvideo, SLOT(show())); menu->addAction(tr("Transform video"), transformer, SLOT(show())); menu->addAction(tr("Settings"), this, SLOT(onSetButton())); menu->addSeparator(); menu->addAction(tr("Homepage"), this, SLOT(openHomepage())); ui->mainLayout->insertWidget(0, menubar); //Add time show timeShow = new QLabel(mplayer); timeShow->move(0, 0); timeShow->hide(); //Connect connect(ui->playButton, SIGNAL(clicked()), mplayer, SLOT(changeState())); connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(onStopButton())); connect(ui->progressBar, SIGNAL(valueChanged(int)), this, SLOT(onPBarChanged(int))); connect(ui->progressBar, SIGNAL(sliderPressed()), this, SLOT(onPBarPressed())); connect(ui->progressBar, SIGNAL(sliderReleased()), this, SLOT(onPBarReleased())); connect(ui->volumeSlider, SIGNAL(valueChanged(int)), mplayer, SLOT(setVolume(int))); connect(ui->hideButton, SIGNAL(clicked()), this, SLOT(hidePlaylist())); connect(ui->netButton, SIGNAL(clicked()), webvideo, SLOT(show())); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close())); connect(ui->minButton, SIGNAL(clicked()), this, SLOT(showMinimized())); connect(ui->maxButton, SIGNAL(clicked()), this, SLOT(setMaxNormal())); connect(ui->menuButton, SIGNAL(clicked()), this, SLOT(showMenu())); connect(mplayer, SIGNAL(played()), this, SLOT(setIconToPause())); connect(mplayer, SIGNAL(paused()), this, SLOT(setIconToPlay())); connect(mplayer, SIGNAL(stopped()), this, SLOT(onStopped())); connect(mplayer, SIGNAL(timeChanged(int)), this, SLOT(onProgressChanged(int))); connect(mplayer, SIGNAL(lengthChanged(int)), this, SLOT(onLengthChanged(int))); connect(mplayer, SIGNAL(fullScreen()), this, SLOT(setFullScreen())); connect(mplayer, SIGNAL(sizeChanged(QSize&)), this, SLOT(onSizeChanged(QSize&))); connect(playlist, SIGNAL(fileSelected(const QString&)), mplayer, SLOT(openFile(const QString&))); connect(playlist, SIGNAL(needPause(bool)), this, SLOT(onNeedPause(bool))); connect(downloader, SIGNAL(newPlay(const QString&,const QString&)), playlist, SLOT(addFileAndPlay(const QString&,const QString&))); connect(downloader, SIGNAL(newFile(const QString&,const QString&)), playlist, SLOT(addFile(const QString&,const QString&))); //Set skin if (Settings::useSkin) setSkin(Settings::skinList[Settings::currentSkin]); else setNoSkin(); no_play_next = false; is_fullscreen = false; }
/*! Constructs a new QxtSpanSlider with \a orientation and \a parent. */ QxtSpanSlider::QxtSpanSlider(Qt::Orientation orientation, QWidget* parent) : QSlider(orientation, parent) { QXT_INIT_PRIVATE(QxtSpanSlider); connect(this, SIGNAL(rangeChanged(int, int)), &qxt_d(), SLOT(updateRange(int, int))); connect(this, SIGNAL(sliderReleased()), &qxt_d(), SLOT(movePressedHandle())); }
int QAbstractSlider::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: sliderPressed(); break; case 2: sliderMoved((*reinterpret_cast< int(*)>(_a[1]))); break; case 3: sliderReleased(); break; case 4: rangeChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 5: actionTriggered((*reinterpret_cast< int(*)>(_a[1]))); break; case 6: setValue((*reinterpret_cast< int(*)>(_a[1]))); break; case 7: setOrientation((*reinterpret_cast< Qt::Orientation(*)>(_a[1]))); break; } _id -= 8; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = minimum(); break; case 1: *reinterpret_cast< int*>(_v) = maximum(); break; case 2: *reinterpret_cast< int*>(_v) = singleStep(); break; case 3: *reinterpret_cast< int*>(_v) = pageStep(); break; case 4: *reinterpret_cast< int*>(_v) = value(); break; case 5: *reinterpret_cast< int*>(_v) = sliderPosition(); break; case 6: *reinterpret_cast< bool*>(_v) = hasTracking(); break; case 7: *reinterpret_cast< Qt::Orientation*>(_v) = orientation(); break; case 8: *reinterpret_cast< bool*>(_v) = invertedAppearance(); break; case 9: *reinterpret_cast< bool*>(_v) = invertedControls(); break; case 10: *reinterpret_cast< bool*>(_v) = isSliderDown(); break; } _id -= 11; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setMinimum(*reinterpret_cast< int*>(_v)); break; case 1: setMaximum(*reinterpret_cast< int*>(_v)); break; case 2: setSingleStep(*reinterpret_cast< int*>(_v)); break; case 3: setPageStep(*reinterpret_cast< int*>(_v)); break; case 4: setValue(*reinterpret_cast< int*>(_v)); break; case 5: setSliderPosition(*reinterpret_cast< int*>(_v)); break; case 6: setTracking(*reinterpret_cast< bool*>(_v)); break; case 7: setOrientation(*reinterpret_cast< Qt::Orientation*>(_v)); break; case 8: setInvertedAppearance(*reinterpret_cast< bool*>(_v)); break; case 9: setInvertedControls(*reinterpret_cast< bool*>(_v)); break; case 10: setSliderDown(*reinterpret_cast< bool*>(_v)); break; } _id -= 11; } else if (_c == QMetaObject::ResetProperty) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 11; } #endif // QT_NO_PROPERTIES return _id; }
void DevEdit::v_sliderReleased() { emit sliderReleased(Qt::Vertical); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { //Create central widget and set main layout //Centra ventana wgtMain_ = new QWidget(this);//Estam la ventana principal lytMain_ = new QGridLayout(wgtMain_);//Permite dividir el espacio y añadir elementos (ver matriz) wgtMain_->setLayout(lytMain_); setCentralWidget(wgtMain_); //Initialize widgets mediaPlayer_ = new QMediaPlayer(this); playerSlider_ = new QSlider(Qt::Horizontal, this);//Indicamos si es vertical u horizontal videoWidget_ = new QVideoWidget(this); volumeSlider_ = new QSlider(Qt::Horizontal, this); btnOpen_ = new QToolButton(this); btnPlay_ = new QToolButton(this); btnPause_ = new QToolButton(this); btnStop_ = new QToolButton(this); //Setup widwgets videoWidget_->setMinimumSize(400, 400);//Cuadro negro definimos el tamaño para verlo mediaPlayer_->setVideoOutput(videoWidget_);//Objeto de decodificacion del video mediaPlayer_->setVolume(100); videoWidget_->setAspectRatioMode(Qt::KeepAspectRatio);//Redimensionar se establezca volumeSlider_->setRange(0, 100);//El volumen volumeSlider_->setSliderPosition(100);//Colocacion del slider //Populate grid layout lytMain_->addWidget(videoWidget_, 0, 0, 1, 5);//Coordenadas (ultimo fila y columna te espandes) lytMain_->addWidget(playerSlider_, 1, 0, 1, 5); lytMain_->addWidget(btnOpen_, 2, 0, 1, 1); lytMain_->addWidget(btnPlay_, 2, 1, 1, 1); lytMain_->addWidget(btnPause_, 2, 2, 1, 1); lytMain_->addWidget(btnStop_, 2, 3, 1, 1); lytMain_->addWidget(volumeSlider_, 2, 4, 1, 1); //Buttons icons btnOpen_->setIcon(QIcon(QPixmap(":/icons/resources/eject.png"))); btnPause_->setIcon(QIcon(QPixmap(":/icons/resources/pause.png"))); btnPlay_->setIcon(QIcon(QPixmap(":/icons/resources/play.png"))); btnStop_->setIcon(QIcon(QPixmap(":/icons/resources/stop.png"))); //Menu mainMenu_= new QMenuBar(this); //Archivo mnuArchivo_ = new QMenu (tr("&Archivo"), this);//Especificamos el texto del menu mainMenu_-> addMenu(mnuArchivo_); mnuArchivoRecientes_ = new QMenu (tr("&Recientes"), this); mnuArchivo_-> addMenu(mnuArchivoRecientes_); //abrir actArchivoAbrir_ = new QAction(QIcon(":/icons/resources/eject.png"),tr("&Abrir"),this); actArchivoAbrir_-> setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A)); //Ver mnuVer_ = new QMenu(tr("&Ver"), this); mainMenu_-> addMenu(mnuVer_); //PantallaCompleta actVerCompleta_= new QAction (tr("&Pantalla Completa"),this); actVerCompleta_-> setShortcut(QKeySequence(Qt::ALT + Qt::Key_F)); //Metadatos actMetadatos_=new QAction(tr("&Metadados"),this); //Ayuda mnuAyuda_ = new QMenu(tr("&Ayuda"), this); mainMenu_->addMenu(mnuAyuda_); //Acercade actAyudaAcerca_=new QAction(tr("&Acerca de"), this); //add acciones mnuArchivo_->addAction(actArchivoAbrir_); mnuAyuda_->addAction(actAyudaAcerca_); mnuVer_->addAction(actVerCompleta_); mnuVer_->addAction(actMetadatos_); //Colocacion de elementos //le decimos donde colocarse la barra del menu y la de herramientas setMenuBar(mainMenu_); //Connections connect(btnOpen_, SIGNAL(pressed()), this, SLOT(onOpen())); connect(btnPlay_, SIGNAL(pressed()), mediaPlayer_, SLOT(play())); connect(btnPause_, SIGNAL(pressed()), mediaPlayer_, SLOT(pause())); connect(btnStop_, SIGNAL(pressed()), mediaPlayer_, SLOT(stop())); connect(playerSlider_, SIGNAL(sliderReleased()), this, SLOT(onSeek())); connect(mediaPlayer_, SIGNAL(durationChanged(qint64)), this, SLOT(onDurationChanged(qint64))); connect(mediaPlayer_, SIGNAL(positionChanged(qint64)), this, SLOT(onPositionChanged(qint64))); connect(volumeSlider_, SIGNAL(sliderMoved(int)), this, SLOT(onVolumeChanged(int))); connect(actArchivoAbrir_, SIGNAL(triggered()),this, SLOT (onOpen())); connect(actAyudaAcerca_, SIGNAL(triggered()), this, SLOT (acerca())); connect(actVerCompleta_,SIGNAL(triggered()),this,SLOT (pantallaCompleta())); connect(actMetadatos_,SIGNAL(triggered()),this,SLOT(metadatos())); }
void Ui::openDiffDialog() { diffDialog = new QDialog(this); // set as child of Ui, to be sure that it will be deleted in the end. QVBoxLayout *diffDialogLayout = new QVBoxLayout; // create vertical layout QVTKWidget *dialogVisualizer = new QVTKWidget; // create qvtk widget dialogViewer = new pcl::visualization::PCLVisualizer("Dialog Viewer", false); dialogVisualizer->SetRenderWindow(dialogViewer->getRenderWindow()); // set as render window the render window of the dialog visualizer dialogViewer->setupInteractor(dialogVisualizer->GetInteractor(), dialogVisualizer->GetRenderWindow()); // tells the visualizer what interactor is using now and for what window dialogViewer->getInteractorStyle()->setKeyboardModifier(pcl::visualization::INTERACTOR_KB_MOD_SHIFT); // ripristina input system of original visualizer (shift+click for points) pcl::PointCloud<pcl::PointXYZRGB>::Ptr regCloud = motor->getRegisteredCloud(); pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(regCloud); pcl::PointCloud<pcl::PointXYZRGB>::Ptr diffCloud = motor->getSourceDiffCloud(); pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZRGB> green(diffCloud, 0, 255, 0); pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZRGB> red(diffCloud, 255, 0, 0); int v1(0); int v2(0); dialogViewer->createViewPort(0.0, 0.0, 0.5, 1.0, v1); dialogViewer->setBackgroundColor(0.5, 0.5, 0.5, v1); dialogViewer->addText("TARGET CLOUD", 30, 20,"TARGET CLOUD",v1); dialogViewer->createViewPort(0.5, 0.0, 1.0, 1.0, v2); dialogViewer->setBackgroundColor(0.5, 0.5, 0.5, v2); dialogViewer->addText("SOURCE CLOUD", 30, 20,"SOURCE CLOUD",v2); dialogViewer->addPointCloud<pcl::PointXYZRGB>(motor->getTargetCloud(), rgb, "targetCloud", v1); dialogViewer->addPointCloud<pcl::PointXYZRGB>(diffCloud, red, "targetDiffCloud", v1); dialogViewer->addPointCloud<pcl::PointXYZRGB>(regCloud, rgb, "sourceCloud", v2); dialogViewer->addPointCloud<pcl::PointXYZRGB>(diffCloud, green, "sourceDiffCloud", v2); dialogViewer->initCameraParameters(); dialogViewer->resetCamera(); componentCallbackConnection = dialogViewer->registerPointPickingCallback(&pointPickCallback, this); // callback standard non segmenta nulla QHBoxLayout *dialogControlsLayout = new QHBoxLayout; QVBoxLayout *numbersBox = new QVBoxLayout; QLineEdit *segDiffBox = new QLineEdit("0.5"); segDiffBox->setReadOnly(true); segDiffBox->setObjectName("segdiffbox"); segDiffBox->setMaxLength(5); segDiffBox->setMaximumWidth(50); numbersBox->addWidget(segDiffBox); QVBoxLayout *slidersBox = new QVBoxLayout; QSlider *setSegDiffThresholdBar = new QSlider(Qt::Horizontal); setSegDiffThresholdBar->setRange(0, 5000); setSegDiffThresholdBar->setValue(500); motor->setSegDiffThreshold(500); setSegDiffThresholdBar->setObjectName("sliderSegDiff"); connect(setSegDiffThresholdBar, SIGNAL(sliderReleased()), this, SLOT(setSegDiffThreshold())); slidersBox->addWidget(setSegDiffThresholdBar); dialogControlsLayout->addLayout(numbersBox); dialogControlsLayout->addLayout(slidersBox); QPushButton *segmentDiffButton = new QPushButton("Segment differences"); segmentDiffButton->setDefault(true); // default button, pressed if enter is pressed connect(segmentDiffButton, SIGNAL(clicked()), this, SLOT(segmentDiff())); diffDialogLayout->addWidget(dialogVisualizer); diffDialogLayout->addLayout(dialogControlsLayout); diffDialogLayout->addWidget(segmentDiffButton); diffDialog->setLayout(diffDialogLayout); diffDialogLayout->deleteLater(); // delete dialog layout when the control returns to the event loop from which deleteLater() was called (after exec i guess) diffDialog->resize(800,600); diffDialog->exec(); componentCallbackConnection.disconnect(); // disconnect the callback function from the viewer delete dialogViewer; // finita l'esecuzione, deallocare il viewer (deallocare altra eventuale memoria non indirizzata nel QObject tree). }
CentralWindow::CentralWindow() { drawMutex = new QMutex(); centralwidget = new QWidget(this); centralwidget->setObjectName(QString::fromUtf8("centralwidget")); gridLayout = new QGridLayout(centralwidget); gridLayout->setObjectName(QString::fromUtf8("gridLayout")); Spielfeld = new QFrame(centralwidget); Spielfeld->setObjectName(QString::fromUtf8("Spielfeld")); QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(Spielfeld->sizePolicy().hasHeightForWidth()); Spielfeld->setSizePolicy(sizePolicy); Spielfeld->setFrameShape(QFrame::Panel); Spielfeld->setFrameShadow(QFrame::Raised); Spielfeld->setLineWidth(1); gridLayout_7 = new QGridLayout(Spielfeld); gridLayout_7->setSpacing(0); gridLayout_7->setMargin(0); gridLayout_7->setObjectName(QString::fromUtf8("gridLayout_7")); soccerView = new SoccerView(drawMutex); soccerView->setObjectName(QString::fromUtf8("soccerView")); soccerView->setEnabled(true); gridLayout_7->addWidget(soccerView, 1, 0, 1, 1); gridLayout->addWidget(Spielfeld, 0, 0, 1, 1); this->setCentralWidget(centralwidget); logControl = new QDockWidget(this); logControl->setObjectName(QString::fromUtf8("logControl")); logControl->setEnabled(true); logControl->setMinimumSize(QSize(79, 150)); logControl->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); logControl->setAllowedAreas(Qt::BottomDockWidgetArea); logControlWidget = new QWidget(); logControlWidget->setObjectName(QString::fromUtf8("logControlWidget")); horizontalSlider = new QSlider(logControlWidget); horizontalSlider->setObjectName(QString::fromUtf8("horizontalSlider")); horizontalSlider->setGeometry(QRect(0, 0, 631, 22)); horizontalSlider->setMaximum(1800); horizontalSlider->setPageStep(60); horizontalSlider->setOrientation(Qt::Horizontal); horizontalSlider->setTickPosition(QSlider::TicksAbove); horizontalSlider->setTickInterval(300); log_backward = new QPushButton(logControlWidget); log_backward->setObjectName(QString::fromUtf8("log_backward")); log_backward->setGeometry(QRect(0, 30, 150, 25)); log_pause = new QPushButton(logControlWidget); log_pause->setObjectName(QString::fromUtf8("log_pause")); log_pause->setGeometry(QRect(160, 30, 150, 25)); log_forward = new QPushButton(logControlWidget); log_forward->setObjectName(QString::fromUtf8("log_forward")); log_forward->setGeometry(QRect(320, 30, 150, 25)); log_play = new QPushButton(logControlWidget); log_play->setObjectName(QString::fromUtf8("log_play")); log_play->setGeometry(QRect(480, 30, 150, 25)); log_slower = new QPushButton(logControlWidget); log_slower->setObjectName(QString::fromUtf8("log_slower")); log_slower->setGeometry(QRect(0, 60, 150, 25)); log_speed = new QLabel(logControlWidget); log_speed->setObjectName(QString::fromUtf8("log_speed")); log_speed->setGeometry(QRect(160, 60, 150, 25)); log_speed->setAlignment(Qt::AlignCenter); log_faster = new QPushButton(logControlWidget); log_faster->setObjectName(QString::fromUtf8("log_faster")); log_faster->setGeometry(QRect(320, 60, 150, 25)); log_frame_back = new QPushButton(logControlWidget); log_frame_back->setObjectName(QString::fromUtf8("log_frame_back")); log_frame_back->setGeometry(QRect(0, 90, 150, 25)); log_frameNumber = new QLCDNumber(logControlWidget); log_frameNumber->setObjectName(QString::fromUtf8("log_frameNumber")); log_frameNumber->setGeometry(QRect(160, 90, 150, 25)); log_frameNumber->setNumDigits(7); log_frameNumber->setSegmentStyle(QLCDNumber::Flat); log_frameNumber->setProperty("intValue", QVariant(0)); log_frame_forward = new QPushButton(logControlWidget); log_frame_forward->setObjectName(QString::fromUtf8("log_frame_forward")); log_frame_forward->setGeometry(QRect(320, 90, 150, 25)); log_totalFrames = new QLCDNumber(logControlWidget); log_totalFrames->setObjectName(QString::fromUtf8("log_totalFrames")); log_totalFrames->setGeometry(QRect(480, 90, 150, 25)); log_totalFrames->setAutoFillBackground(false); log_totalFrames->setSmallDecimalPoint(false); log_totalFrames->setNumDigits(7); log_totalFrames->setSegmentStyle(QLCDNumber::Flat); logControl->setWidget(logControlWidget); this->addDockWidget(static_cast<Qt::DockWidgetArea>(8), logControl); logControl->setWindowTitle(QApplication::translate("GuiControls", "LogControl", 0, QApplication::UnicodeUTF8)); log_backward->setText(QApplication::translate("GuiControls", "backward", 0, QApplication::UnicodeUTF8)); log_pause->setText(QApplication::translate("GuiControls", "pause", 0, QApplication::UnicodeUTF8)); log_forward->setText(QApplication::translate("GuiControls", "forward", 0, QApplication::UnicodeUTF8)); log_play->setText(QApplication::translate("GuiControls", "play", 0, QApplication::UnicodeUTF8)); log_slower->setText(QApplication::translate("GuiControls", "slower", 0, QApplication::UnicodeUTF8)); log_speed->setText(QApplication::translate("GuiControls", "Speed", 0, QApplication::UnicodeUTF8)); log_faster->setText(QApplication::translate("GuiControls", "faster", 0, QApplication::UnicodeUTF8)); log_frame_back->setText(QApplication::translate("GuiControls", "frame--", 0, QApplication::UnicodeUTF8)); log_frame_forward->setText(QApplication::translate("GuiControls", "frame++", 0, QApplication::UnicodeUTF8)); logControl->hide(); thread = new ViewUpdateThread(soccerView, drawMutex); //connect all SLOTs and SIGNALs //Slider control connect(thread, SIGNAL(initializeSlider(int,int,int,int,int)), this, SLOT(initializeSlider(int, int, int, int, int))); connect(thread, SIGNAL(update_frame(int)), horizontalSlider, SLOT(setValue(int))); connect(horizontalSlider, SIGNAL(valueChanged(int)), thread->log_control, SLOT(goto_frame(int))); connect(horizontalSlider, SIGNAL(sliderPressed()), thread->log_control, SLOT(log_pause())); connect(horizontalSlider, SIGNAL(sliderReleased()), thread->log_control, SLOT(log_play())); //Buttons for logfile control connect(log_forward, SIGNAL(clicked()), thread->log_control, SLOT(log_forward())); connect(log_play, SIGNAL(clicked()), thread->log_control, SLOT(log_play())); connect(log_backward, SIGNAL(clicked()), thread->log_control, SLOT(log_backward())); connect(log_pause, SIGNAL(clicked()), thread->log_control, SLOT(log_pause())); connect(log_faster, SIGNAL(clicked()), thread->log_control, SLOT(log_faster())); connect(log_slower, SIGNAL(clicked()), thread->log_control, SLOT(log_slower())); connect(log_frame_back, SIGNAL(clicked()), thread->log_control, SLOT(log_frame_back())); connect(log_frame_forward, SIGNAL(clicked()), thread->log_control, SLOT(log_frame_forward())); //Log Control connect(thread, SIGNAL(showLogControl(bool)), logControl, SLOT(setVisible(bool))); //QLCDNumber control connect(thread, SIGNAL(update_frame(int)), log_frameNumber, SLOT(display(int))); connect(thread, SIGNAL(log_size(int)), log_totalFrames, SLOT(display(int))); connect(thread->log_control, SIGNAL(update_speed(QString)), log_speed, SLOT(setText(QString))); thread->start(QThread::NormalPriority); //initialisation for nice start for(int i = 0; i < 14; i++) { soccerView->initView(); soccerView->updateView(); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), absoluteAfterAxisAdj(false), checkLogWrite(false), sliderPressed(false), sliderTo(0.0), sliderZCount(0) { // Setup our application information to be used by QSettings QCoreApplication::setOrganizationName(COMPANY_NAME); QCoreApplication::setOrganizationDomain(DOMAIN_NAME); QCoreApplication::setApplicationName(APPLICATION_NAME); // required if passing the object by reference into signals/slots qRegisterMetaType<Coord3D>("Coord3D"); qRegisterMetaType<PosItem>("PosItem"); qRegisterMetaType<ControlParams>("ControlParams"); ui->setupUi(this); readSettings(); info("%s has started", GRBL_CONTROLLER_NAME_AND_VERSION); // see http://blog.qt.digia.com/2010/06/17/youre-doing-it-wrong/ // The thread points out that the documentation for QThread is wrong :) and // you should NOT subclass from QThread and override run(), rather, // attach your QOBJECT to a thread and use events (signals/slots) to communicate. gcode.moveToThread(&gcodeThread); timer.moveToThread(&timerThread); ui->lcdWorkNumberX->setDigitCount(8); ui->lcdMachNumberX->setDigitCount(8); ui->lcdWorkNumberY->setDigitCount(8); ui->lcdMachNumberY->setDigitCount(8); ui->lcdWorkNumberZ->setDigitCount(8); ui->lcdMachNumberZ->setDigitCount(8); //buttons connect(ui->btnOpenPort,SIGNAL(clicked()),this,SLOT(openPort())); connect(ui->btnGRBL,SIGNAL(clicked()),this,SLOT(setGRBL())); connect(ui->DecXBtn,SIGNAL(clicked()),this,SLOT(decX())); connect(ui->DecYBtn,SIGNAL(clicked()),this,SLOT(decY())); connect(ui->DecZBtn,SIGNAL(clicked()),this,SLOT(decZ())); connect(ui->IncXBtn,SIGNAL(clicked()),this,SLOT(incX())); connect(ui->IncYBtn,SIGNAL(clicked()),this,SLOT(incY())); connect(ui->IncZBtn,SIGNAL(clicked()),this,SLOT(incZ())); connect(ui->btnSetHome,SIGNAL(clicked()),this,SLOT(setHome())); connect(ui->Command,SIGNAL(editingFinished()),this,SLOT(gotoXYZ())); connect(ui->Begin,SIGNAL(clicked()),this,SLOT(begin())); connect(ui->openFile,SIGNAL(clicked()),this,SLOT(openFile())); connect(ui->Stop,SIGNAL(clicked()),this,SLOT(stop())); connect(ui->SpindleOn,SIGNAL(toggled(bool)),this,SLOT(toggleSpindle())); connect(ui->chkRestoreAbsolute,SIGNAL(toggled(bool)),this,SLOT(toggleRestoreAbsolute())); connect(ui->actionOptions,SIGNAL(triggered()),this,SLOT(getOptions())); connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close())); connect(ui->actionAbout,SIGNAL(triggered()),this,SLOT(showAbout())); connect(ui->btnResetGrbl,SIGNAL(clicked()),this,SLOT(grblReset())); connect(ui->btnUnlockGrbl,SIGNAL(clicked()),this,SLOT(grblUnlock())); connect(ui->btnGoHomeSafe,SIGNAL(clicked()),this,SLOT(goHomeSafe())); connect(ui->verticalSliderZJog,SIGNAL(valueChanged(int)),this,SLOT(zJogSliderDisplay(int))); connect(ui->verticalSliderZJog,SIGNAL(sliderPressed()),this,SLOT(zJogSliderPressed())); connect(ui->verticalSliderZJog,SIGNAL(sliderReleased()),this,SLOT(zJogSliderReleased())); connect(this, SIGNAL(sendFile(QString)), &gcode, SLOT(sendFile(QString))); connect(this, SIGNAL(openPort(QString,QString)), &gcode, SLOT(openPort(QString,QString))); connect(this, SIGNAL(closePort(bool)), &gcode, SLOT(closePort(bool))); connect(this, SIGNAL(sendGcode(QString)), &gcode, SLOT(sendGcode(QString))); connect(this, SIGNAL(gotoXYZ(QString)), &gcode, SLOT(gotoXYZ(QString))); connect(this, SIGNAL(axisAdj(char, float, bool, bool, int)), &gcode, SLOT(axisAdj(char, float, bool, bool, int))); connect(this, SIGNAL(setResponseWait(ControlParams)), &gcode, SLOT(setResponseWait(ControlParams))); connect(this, SIGNAL(shutdown()), &gcodeThread, SLOT(quit())); connect(this, SIGNAL(shutdown()), &timerThread, SLOT(quit())); connect(this, SIGNAL(setProgress(int)), ui->progressFileSend, SLOT(setValue(int))); connect(this, SIGNAL(setRuntime(QString)), ui->outputRuntime, SLOT(setText(QString))); connect(this, SIGNAL(sendSetHome()), &gcode, SLOT(grblSetHome())); connect(this, SIGNAL(sendGrblReset()), &gcode, SLOT(sendGrblReset())); connect(this, SIGNAL(sendGrblUnlock()), &gcode, SLOT(sendGrblUnlock())); connect(this, SIGNAL(goToHome()), &gcode, SLOT(goToHome())); connect(this, SIGNAL(setItems(QList<PosItem>)), ui->wgtVisualizer, SLOT(setItems(QList<PosItem>))); connect(&gcode, SIGNAL(sendMsg(QString)),this,SLOT(receiveMsg(QString))); connect(&gcode, SIGNAL(portIsClosed(bool)), this, SLOT(portIsClosed(bool))); connect(&gcode, SIGNAL(portIsOpen(bool)), this, SLOT(portIsOpen(bool))); connect(&gcode, SIGNAL(addList(QString)),this,SLOT(receiveList(QString))); connect(&gcode, SIGNAL(addListFull(QStringList)),this,SLOT(receiveListFull(QStringList))); connect(&gcode, SIGNAL(addListOut(QString)),this,SLOT(receiveListOut(QString))); connect(&gcode, SIGNAL(stopSending()), this, SLOT(stopSending())); connect(&gcode, SIGNAL(setCommandText(QString)), ui->Command, SLOT(setText(QString))); connect(&gcode, SIGNAL(setProgress(int)), ui->progressFileSend, SLOT(setValue(int))); connect(&gcode, SIGNAL(adjustedAxis()), this, SLOT(adjustedAxis())); connect(&gcode, SIGNAL(resetTimer(bool)), &timer, SLOT(resetTimer(bool))); connect(&gcode, SIGNAL(enableGrblDialogButton()), this, SLOT(enableGrblDialogButton())); connect(&gcode, SIGNAL(updateCoordinates(Coord3D,Coord3D)), this, SLOT(updateCoordinates(Coord3D,Coord3D))); connect(&gcode, SIGNAL(setLastState(QString)), ui->outputLastState, SLOT(setText(QString))); connect(&gcode, SIGNAL(setUnitsWork(QString)), ui->outputUnitsWork, SLOT(setText(QString))); connect(&gcode, SIGNAL(setUnitsMachine(QString)), ui->outputUnitsMachine, SLOT(setText(QString))); connect(&gcode, SIGNAL(setLivePoint(double, double, bool)), ui->wgtVisualizer, SLOT(setLivePoint(double, double, bool))); connect(&gcode, SIGNAL(setVisCurrLine(int)), ui->wgtVisualizer, SLOT(setVisCurrLine(int))); connect(&timer, SIGNAL(setRuntime(QString)), ui->outputRuntime, SLOT(setText(QString))); timerThread.start(); gcodeThread.start(); ui->comboStep->addItem("0.01"); ui->comboStep->addItem("0.1"); ui->comboStep->addItem("1"); ui->comboStep->addItem("10"); ui->comboStep->setCurrentIndex(2); ui->statusList->setUniformItemSizes(true); // Does not work correctly for horizontal scrollbar: //MyItemDelegate *scrollDelegate = new MyItemDelegate(ui->statusList); //scrollDelegate->setWidth(600); //ui->statusList->setItemDelegate(scrollDelegate); scrollStatusTimer.start(); // Cool utility class off Google code that enumerates COM ports in platform-independent manner QList<QextPortInfo> ports = QextSerialEnumerator::getPorts(); int portIndex = -1; for (int i = 0; i < ports.size(); i++) { ui->cmbPort->addItem(ports.at(i).portName.toLocal8Bit().constData()); if (ports.at(i).portName == lastOpenPort) portIndex = i; //diag("port name: %s\n", ports.at(i).portName.toLocal8Bit().constData()); //diag("friendly name: %s\n", ports.at(i).friendName.toLocal8Bit().constData()); //diag("physical name: %s\n", ports.at(i).physName.toLocal8Bit().constData()); //diag("enumerator name: %s\n", ports.at(i).enumName.toLocal8Bit().constData()); //diag("===================================\n\n"); } if (portIndex >= 0) { // found matching port ui->cmbPort->setCurrentIndex(portIndex); } else if (lastOpenPort.size() > 0) { // did not find matching port // This code block is used to restore a port to view that isn't visible to QextSerialEnumerator ui->cmbPort->addItem(lastOpenPort.toLocal8Bit().constData()); if (ports.size() > 0) ui->cmbPort->setCurrentIndex(ports.size()); else ui->cmbPort->setCurrentIndex(0); } int baudRates[] = { 9600, 19200, 38400, 57600, 115200 }; int baudRateCount = sizeof baudRates / sizeof baudRates[0]; int baudRateIndex = 0; for (int i = 0; i < baudRateCount; i++) { QString baudRate = QString::number(baudRates[i]); ui->comboBoxBaudRate->addItem(baudRate); if (baudRate == lastBaudRate) { baudRateIndex = i; } } ui->comboBoxBaudRate->setCurrentIndex(baudRateIndex); ui->tabAxisVisualizer->setEnabled(false); ui->groupBoxSendFile->setEnabled(true); ui->groupBoxManualGCode->setEnabled(false); ui->Begin->setEnabled(false); ui->Stop->setEnabled(false); ui->progressFileSend->setEnabled(false); ui->outputRuntime->setEnabled(false); ui->labelRuntime->setEnabled(false); ui->btnGRBL->setEnabled(false); ui->btnSetHome->setEnabled(false); ui->btnResetGrbl->setEnabled(false); ui->btnUnlockGrbl->setEnabled(false); ui->btnGoHomeSafe->setEnabled(false); styleSheet = ui->btnOpenPort->styleSheet(); ui->statusList->setEnabled(true); ui->openFile->setEnabled(true); this->setWindowTitle(GRBL_CONTROLLER_NAME_AND_VERSION); QSettings settings; QString useAggrPreload = settings.value(SETTINGS_USE_AGGRESSIVE_PRELOAD, "true").value<QString>(); controlParams.useAggressivePreload = useAggrPreload == "true"; if (!controlParams.useAggressivePreload && !promptedAggrPreload) { QMessageBox msgBox; msgBox.setText("You appear to have upgraded to the latest version of Grbl Controller. " "Please be aware that as of version 3.4 the default behavior of sending commands " "to Grbl has been changed to send them as fast as possible (Aggressive preload mode).\n\n" "Your settings have been changed to enable this mode. Why? Because it provides the most " "optimal use of Grbl and greatly reduces the time to finish a typical job.\n\n" "What does this mean to you? " "Arc commands will now run smoother and faster than before, which may " "cause your spindle to work slightly harder, so please run some tests first. " "Alternately, go to the Options dialog and manually disable Aggressive Preload"); msgBox.exec(); controlParams.useAggressivePreload = true; settings.setValue(SETTINGS_USE_AGGRESSIVE_PRELOAD, controlParams.useAggressivePreload); } promptedAggrPreload = true; emit setResponseWait(controlParams); }
void MediaControl::reparseConfig() { // kdDebug(90200) << "reparseConfig();" << endl; _configFrontend->reparseConfiguration(); if (_player != 0L) // make sure there is no player-object { _player->disconnect(); // disconnect from all things time_slider->disconnect(); prev_button->disconnect(); playpause_button->disconnect(); stop_button->disconnect(); next_button->disconnect(); delete slider_tooltip; // tooltip depends on _player : delete it before _player gets deleted slider_tooltip = 0L; delete _player; _player = 0L; } mLastLen = -1; mLastTime = -1; mLastStatus = -1; QString playerString = _configFrontend->player(); #ifdef HAVE_XMMS if (playerString == "XMMS") { _player = new XmmsInterface (); time_slider->setSteps((_configFrontend->mouseWheelSpeed()*1000), (_configFrontend->mouseWheelSpeed()*1000)); } else #endif if (playerString == "JuK") { _player = new JuKInterface(); time_slider->setSteps((_configFrontend->mouseWheelSpeed()), (_configFrontend->mouseWheelSpeed())); } else if (playerString == "Amarok") { _player = new AmarokInterface(); time_slider->setSteps((_configFrontend->mouseWheelSpeed()), (_configFrontend->mouseWheelSpeed())); } else if (playerString == "KsCD") { _player = new KsCDInterface(); time_slider->setSteps((_configFrontend->mouseWheelSpeed()), (_configFrontend->mouseWheelSpeed())); } else if (playerString == "mpd") { _player = new MpdInterface(); time_slider->setSteps((_configFrontend->mouseWheelSpeed()), (_configFrontend->mouseWheelSpeed())); } else // Fallback is Noatun { _player = new NoatunInterface(); time_slider->setSteps((_configFrontend->mouseWheelSpeed()), (_configFrontend->mouseWheelSpeed())); } // this signal gets emitted by a playerInterface when the player's playtime changed connect(_player, SIGNAL(newSliderPosition(int,int)), this, SLOT(setSliderPosition(int,int))); connect(_player, SIGNAL(playerStarted()), SLOT(enableAll())); connect(_player, SIGNAL(playerStopped()), SLOT(disableAll())); connect(_player, SIGNAL(playingStatusChanged(int)), SLOT(slotPlayingStatusChanged(int))); // do we use our icons or the default ones from KDE? if(_configFrontend->useCustomTheme()) { // load theme QString skindir = locate("data", "mediacontrol/"+_configFrontend->theme()+"/"); // the user has to take care if all pixmaps are there, we only check for one of them if (QFile(skindir+"play.png").exists()) { prev_button->setIconSet(SmallIconSet(locate("data",skindir+"prev.png"))); if (_player->playingStatus() == PlayerInterface::Playing) playpause_button->setIconSet(SmallIconSet(locate("data",skindir+"play.png"))); else playpause_button->setIconSet(SmallIconSet(locate("data",skindir+"pause.png"))); stop_button->setIconSet(SmallIconSet(locate("data",skindir+"stop.png"))); next_button->setIconSet(SmallIconSet(locate("data",skindir+"next.png"))); } else // icon-theme is invalid or not there { KNotifyClient::event(winId(), KNotifyClient::warning, i18n("There was trouble loading theme %1. Please choose" \ " a different theme.").arg(skindir)); // default to kde-icons, they have to be installed :) slotIconChanged(); // and open prefs-dialog preferences(); } } else // KDE default-icons, assuming that these icons exist! { // sets icons from kde slotIconChanged(); } slider_tooltip = new MediaControlToolTip(time_slider, _player); connect(prev_button, SIGNAL(clicked()), _player, SLOT(prev())); connect(playpause_button, SIGNAL(clicked()), _player, SLOT(playpause())); connect(stop_button, SIGNAL(clicked()), _player, SLOT(stop())); connect(next_button, SIGNAL(clicked()), _player, SLOT(next())); connect(time_slider, SIGNAL(sliderPressed()), _player, SLOT(sliderStartDrag())); connect(time_slider, SIGNAL(sliderReleased()), _player, SLOT(sliderStopDrag())); connect(time_slider, SIGNAL(valueChanged(int)), this, SLOT(adjustTime(int))); connect(time_slider, SIGNAL(volumeUp()), _player, SLOT(volumeUp())); connect(time_slider, SIGNAL(volumeDown()), _player, SLOT(volumeDown())); connect(this, SIGNAL(newJumpToTime(int)), _player, SLOT(jumpToTime(int))); }