//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue); if (changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth) { applyDepthZoomFromVisibleDepth(); m_isAutoScaleDepthEnabled = false; } else if (changedField == &m_isAutoScaleDepthEnabled) { updateDepthZoom(); } else if (changedField == &m_userName) { updateMdiWindowTitle(); } if ( changedField == &m_depthType ) { RimWellAllocationPlot* wellAllocPlot; firstAncestorOrThisOfType(wellAllocPlot); if (wellAllocPlot) wellAllocPlot->loadDataAndUpdate(); else if (isRftPlotChild()) rftPlot()->loadDataAndUpdate(); else updateTracks(); } if ( changedField == &m_depthUnit) { updateTracks(); } if ( changedField == &m_showTrackLegends) { updateTracks(); if (m_viewer) m_viewer->updateChildrenLayout(); } RimWellRftPlot* rftPlot(nullptr); this->firstAncestorOrThisOfType(rftPlot); if (rftPlot) { rftPlot->updateConnectedEditors(); } RimWellPltPlot* pltPlot(nullptr); this->firstAncestorOrThisOfType(pltPlot); if (pltPlot) { pltPlot->updateConnectedEditors(); } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { if (changedField == &m_showWindow) { if (m_showWindow) { loadDataAndUpdate(); } else { updateViewerWidget(); } uiCapability()->updateUiIconFromToggleField(); } else if (changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth) { applyDepthZoomFromVisibleDepth(); m_isAutoScaleDepthEnabled = false; } else if (changedField == &m_isAutoScaleDepthEnabled) { updateDepthZoom(); } else if (changedField == &m_userName) { updateViewerWidgetWindowTitle(); } if (changedField == &m_depthType || changedField == &m_depthUnit) { updateTracks(); } }
void PlaylistItemDelegate::commitAndClose() { auto db = SqlDatabase::instance(); QStringList tracksToUpdate; QStringList tracksToUpdate2; // Multiple editors might have been opened by one, therefore it's required to commit and close all of them for (StarEditor *se : parent()->findChildren<StarEditor*>()) { QMediaContent mediaContent = _playlist->mediaPlaylist()->media(se->index().row()); QString fileName = QString(QFile::encodeName(mediaContent.canonicalUrl().toLocalFile())); FileHelper fh(fileName); fh.setRating(se->starRating.starCount()); commitData(se); closeEditor(se); tracksToUpdate << fileName; tracksToUpdate2 << QString(); } db->updateTracks(tracksToUpdate, tracksToUpdate2); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::setDepthUnit(RimDefines::DepthUnitType depthUnit) { m_depthUnit = depthUnit; updateTracks(); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::loadDataAndUpdate() { updateViewerWidget(); updateTracks(); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::onLoadDataAndUpdate() { updateMdiWindowVisibility(); updateTracks(); }
Player::Player(QWidget *parent): QMainWindow(parent), _ui(new Ui::Player), _player(new Phonon::MediaObject(this)), _audioOutput(new Phonon::AudioOutput(Phonon::MusicCategory, this)), _trayIcon(new QSystemTrayIcon(this)), _isStopped(false), _isPaused(false), _artistToPlaylistAction(new QAction(tr("Add to playlist"), this)), _artistsMenu(new QMenu(this)), _albumToPlaylistAction(new QAction(tr("Add to playlist"), this)), _albumsMenu(new QMenu(this)), _trackToPlaylistAction(new QAction(tr("Add to playlist"), this)), _tracksMenu(new QMenu(this)), _removeTrackAction(new QAction(tr("Remove track"), this)), _playlistMenu(new QMenu(this)), _playAction(new QAction(tr("Play"), this)), _pauseAction(new QAction(tr("Pause"), this)), _playNextAction(new QAction(tr("Play next"), this)), _playPrevAction(new QAction(tr("Play previous"), this)), _stopAction(new QAction(tr("Stop"), this)), _trayMenu(new QMenu(this)), _lastFMDialog(new LastFMAuthDialog(this)) { _ui->setupUi(this); this->setWindowIcon(QIcon(":/icon.png")); this->setWindowTitle(qApp->applicationName()); _ui->pauseButton->setHidden(true); fixHeader(_ui->tracks->horizontalHeader()); fixHeader(_ui->playlist->horizontalHeader()); _ui->tracks->verticalHeader()->setDefaultSectionSize(_ui->artists->sizeHintForRow(0) + 4); _ui->playlist->verticalHeader()->setDefaultSectionSize(_ui->artists->sizeHintForRow(0) + 4); _ui->previousButton->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaSkipBackward)); _ui->playButton->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaPlay)); _ui->pauseButton->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaPause)); _ui->stopButton->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaStop)); _ui->nextButton->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaSkipForward)); _playPrevAction->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaSkipBackward)); _playAction->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaPlay)); _pauseAction->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaPause)); _pauseAction->setVisible(false); _stopAction->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaStop)); _playNextAction->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaSkipForward)); _ui->actionQuit->setIcon(qApp->style()->standardIcon(QStyle::SP_DialogCloseButton)); _trayMenu->addAction(_playAction); _trayMenu->addAction(_pauseAction); _trayMenu->addAction(_playPrevAction); _trayMenu->addAction(_playNextAction); _trayMenu->addAction(_stopAction); _trayMenu->addAction(_ui->actionQuit); _trayIcon->setContextMenu(_trayMenu); _trayIcon->setIcon(QIcon(":/icon.png")); _trayIcon->show(); Phonon::createPath(_player, _audioOutput); _ui->seekSlider->setMediaObject(_player); _ui->volumeSlider->setAudioOutput(_audioOutput); _artistsMenu->addAction(_artistToPlaylistAction); _albumsMenu->addAction(_albumToPlaylistAction); _tracksMenu->addAction(_trackToPlaylistAction); _playlistMenu->addAction(_removeTrackAction); connect(_ui->actionQuit, SIGNAL(triggered()), qApp, SLOT(quit())); connect(_ui->actionAdd_directory, SIGNAL(triggered()), this, SLOT(addDirToLibrary())); connect(_ui->actionAdd_files, SIGNAL(triggered()), this, SLOT(addFilesToLibrary())); connect(_ui->actionClear_playlist, SIGNAL(triggered()), this, SLOT(clearPlaylist())); connect(_ui->actionLoad_playlist, SIGNAL(triggered()), this, SLOT(loadPlaylist())); connect(_ui->actionSave_playlist, SIGNAL(triggered()), this, SLOT(savePlaylist())); connect(_ui->nextButton, SIGNAL(clicked()), this, SLOT(playNext())); connect(_ui->playButton, SIGNAL(clicked()), this, SLOT(play())); connect(_ui->tracks, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(playSelected())); connect(_ui->playlist, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(playSelected())); connect(_ui->stopButton, SIGNAL(clicked()), this, SLOT(stop())); connect(_ui->pauseButton, SIGNAL(clicked()), this, SLOT(pause())); connect(_ui->stopButton, SIGNAL(clicked()), _player, SLOT(stop())); connect(_ui->previousButton, SIGNAL(clicked()), this, SLOT(playPrevious())); connect(_playAction, SIGNAL(triggered()), this, SLOT(play())); connect(_pauseAction, SIGNAL(triggered()), _player, SLOT(pause())); connect(_stopAction, SIGNAL(triggered()), _player, SLOT(stop())); connect(_playNextAction, SIGNAL(triggered()), this, SLOT(playNext())); connect(_playPrevAction, SIGNAL(triggered()), this, SLOT(playPrevious())); connect(_ui->artists, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showArtistsContextMenu(const QPoint &))); connect(_ui->albums, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showAlbumsContextMenu(const QPoint &))); connect(_ui->tracks, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showTracksContextMenu(const QPoint &))); connect(_ui->playlist, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showPlaylistContextMenu(const QPoint &))); connect(DataBase::instance(), SIGNAL(albumsUpdated()), this, SLOT(updateAlbums())); connect(DataBase::instance(), SIGNAL(artistsUpdated()), this, SLOT(updateArtists())); connect(DataBase::instance(), SIGNAL(tracksUpdated()), this, SLOT(updateTracks())); connect(_ui->artists, SIGNAL(currentRowChanged(int)), this, SLOT(updateAlbums())); connect(_ui->albums, SIGNAL(currentRowChanged(int)), this, SLOT(updateTracks())); connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason))); connect(_player, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(stateChanged(Phonon::State,Phonon::State))); connect(_player, SIGNAL(tick(qint64)), this, SLOT(tick(qint64))); connect(_player, SIGNAL(totalTimeChanged(qint64)), this, SLOT(totalTimeChanged(qint64))); connect(_player, SIGNAL(finished()), this, SLOT(trackFinished())); connect(_ui->actionSettings, SIGNAL(triggered()), _lastFMDialog, SLOT(show())); connect(_ui->actionScrobbling, SIGNAL(toggled(bool)), this, SLOT(scrobblingToggled(bool))); connect(Settings::instance(), SIGNAL(scrobblingChanged(bool)), _ui->actionScrobbling, SLOT(setChecked(bool))); _allArtists = _ui->artists->item(0); _allArtists->setText(ALL); _allAlbums = _ui->albums->item(0); _allAlbums->setText(ALL); loadPlaylist(RECENTPLAYLIST); _ui->actionScrobbling->setChecked(Settings::instance()->isScrobblingEnabled()); _ui->actionSettings->setEnabled(Settings::instance()->isScrobblingEnabled()); scrobblingToggled(Settings::instance()->isScrobblingEnabled()); }