void RealtimeArrangeDialog::setupSignals() { connect(arrangeButton, SIGNAL(clicked()), this, SLOT(onArrangeButton())); connect(stopButton, SIGNAL(clicked()), this, SLOT(onStopButton())); connect(deviceNameCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onDeviceIndexChanged(int))); connect(videoInputPinCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onInputPinIndexChanged(int))); connect(refreshButton, SIGNAL(clicked()), this, SLOT(onRefreshButton())); }
RealTimePlotWindow::RealTimePlotWindow(QWidget *parent) : QMainWindow(parent), keyCounter(0), wait(0), MPS(0), // dialogWindow(0), measurementState(false), triger(false), ui(new Ui::RealTimePlotWindow) { ui->setupUi(this); setWindowTitle("SkateboardAnalyzer v0.5 measuring"); setWindowIcon(QIcon(":/skate")); //--------------SETS VARIABLES--------------// dialogWindow = new DialogWindow(this); instValWindow = new instValuesWindow(this); saveGraphWindow = new SaveGraphWindow(this); timer = new QTimer(this); timer->start(200); instValues = new QVector<double> (10); //---------------------------------------------------// //-----------------CONNECTS--------------------------// //---------------------------------------------------// //buttons // connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close())); connect(ui->terminalButton, SIGNAL(clicked()), SLOT(onTerminalButton())); connect(ui->instantValuesButton, SIGNAL(clicked()), SLOT(onInstButton())); connect(ui->stopButton, SIGNAL(clicked()), SLOT(onStopButton())); connect(ui->startButton, SIGNAL(clicked()), SLOT(onStartButton())); connect(saveGraphWindow, SIGNAL(putGraphsAsPNG(QString)),this, SLOT(saveAsPNG(QString))); connect(saveGraphWindow, SIGNAL(putGraphsAsBMP(QString)),this, SLOT(saveAsBMP(QString))); connect(saveGraphWindow, SIGNAL(putGraphsAsPDF(QString)),this, SLOT(saveAsPDF(QString))); connect(saveGraphWindow, SIGNAL(putGraphsAsJPG(QString)),this, SLOT(saveAsJPG(QString))); connect(ui->saveGraphButton, SIGNAL(clicked()), SLOT(onSaveGraphButton())); //dialog window connect(dialogWindow, SIGNAL(dataAvaible(QByteArray)), this, SLOT(dataAvaible(QByteArray))); //timers connect(timer, SIGNAL(timeout()), this, SLOT(onTimer())); //--------------ON PLOTS-----------------// ui->accPlot->replot(); ui->gyroPlot->replot(); startGraph(ui->accPlot, ui->gyroPlot/*, ui->an_gyroPlot*/); }
void RealtimeArrangeDialog::closeEvent(QCloseEvent *event) { if(!arrangeButton->isEnabled()) { int clickedButton = QMessageBox::information(this, tr("警告"), tr("如果关闭此窗口,实时播放将会停止,确定继续?"), QMessageBox::Yes | QMessageBox::No); if(clickedButton == QMessageBox::Yes) { onStopButton(); event->accept(); } else { event->ignore(); } } }
void RealTimePlotWindow::stopDialog() { onStopButton(); delete dialogWindow; }
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->addTab(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 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())); menu->addAction(tr("About"), this, SLOT(onAboutClicked())); 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->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, 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&))); 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; }
medTimeLineToolBox::medTimeLineToolBox(QWidget *parent) : medToolBox(parent), d(new medTimeLineToolBoxPrivate) { QWidget *box = new QWidget (this); d->labelmin = new QLabel(this); d->labelmax = new QLabel(this); d->labelcurr = new QLabel(this); d->labelspeed = new QLabel(this); d->labelspeed->setText("Speed %: "); d->timeSlider = new QSlider (Qt::Horizontal, this); d->timeSlider->setRange (0, 100); d->timeSlider->setValue (0); d->timeSlider->setTracking( false ); d->timeSlider->setToolTip(tr("Follow The Sequence")); QStringList validDataTypes; validDataTypes << "itkDataImageChar4" << "itkDataImageUChar4" << "itkDataImageShort4" << "itkDataImageUShort4" << "itkDataImageInt4" << "itkDataImageUInt4" << "itkDataImageLong4" << "itkDataImageULong4" << "itkDataImageFloat4" << "itkDataImageDouble4" << "vtkDataMesh4D"; setValidDataTypes(validDataTypes); d->playIcon = QPixmap(":/icons/play.png"); d->playSequencesButton = new medButton(this,d->playIcon, tr("Play Sequence")); d->nextFrameButton = new medButton(this,":/icons/forward.png", tr("Next Frame")); d->previousFrameButton = new medButton(this,":/icons/backward.png", tr("Previous Frame")); d->stopButton = new medButton(this,":/icons/stop.png", tr("Stop Sequence")); d->timeLine = new QTimeLine(1000, this); d->timeLine->setLoopCount(0); d->timeLine->setCurveShape (QTimeLine::LinearCurve); d->spinBox = new QSpinBox(this); d->spinBox->setRange(1,5000); d->spinBox->setSingleStep(10); d->spinBox->setValue(100); d->spinBox->setToolTip(tr("Control the display speed")); connect(d->timeLine, SIGNAL(frameChanged(int)), d->timeSlider, SLOT(setValue(int))); QHBoxLayout *buttonLayout = new QHBoxLayout(); buttonLayout->addWidget( d->previousFrameButton,1,Qt::AlignHCenter); buttonLayout->addWidget (d->playSequencesButton,1,Qt::AlignHCenter); buttonLayout->addWidget( d->nextFrameButton,1,Qt::AlignHCenter); buttonLayout->addWidget( d->stopButton,1,Qt::AlignHCenter); QHBoxLayout *labelLayout = new QHBoxLayout(); labelLayout->addWidget( d->labelmin); labelLayout->addStretch(); labelLayout->addWidget( d->labelcurr); labelLayout->addStretch(); labelLayout->addWidget( d->labelmax); QHBoxLayout *topLayout = new QHBoxLayout(); topLayout->addStretch(); topLayout->addWidget(d->labelspeed); topLayout->addWidget(d->spinBox); QVBoxLayout* boxlayout = new QVBoxLayout (); boxlayout->addLayout(topLayout); boxlayout->addLayout( buttonLayout ); boxlayout->addWidget (d->timeSlider); boxlayout->addLayout(labelLayout); d->actionlist.insert(0,new QAction("1",this)); d->actionlist.insert(1,new QAction("5",this)); d->actionlist.insert(2,new QAction("10",this)); d->actionlist.insert(3,new QAction("25",this)); d->actionlist.insert(4,new QAction("50",this)); connect(d->timeSlider, SIGNAL(sliderMoved(int)), this, SLOT(onTimeChanged(int))); connect(d->timeSlider, SIGNAL(valueChanged(int)), this, SLOT(onTimeChanged(int))); connect(d->playSequencesButton, SIGNAL(triggered()), this, SLOT(onPlaySequences())); connect(d->nextFrameButton, SIGNAL(triggered()), this, SLOT(onNextFrame())); connect(d->previousFrameButton, SIGNAL(triggered()), this, SLOT(onPreviousFrame())); connect(d->spinBox, SIGNAL(valueChanged(int)),this, SLOT(onSpinBoxChanged(int))); connect(d->stopButton, SIGNAL(triggered()),this, SLOT(onStopButton())); this->setTitle(tr("Time Management")); box->setLayout (boxlayout); this->addWidget (box); d->minTime = 0.0; d->minTimeStep = 1.0; d->maxTime = 0.0; this->isViewAdded = false; this->hide(); }
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); }