diff options
Diffstat (limited to 'src/panels')
| -rw-r--r-- | src/panels/information/informationpanel.cpp | 60 | ||||
| -rw-r--r-- | src/panels/information/mediawidget.cpp | 14 | ||||
| -rw-r--r-- | src/panels/information/pixmapviewer.cpp | 7 | ||||
| -rw-r--r-- | src/panels/panel.cpp | 9 | ||||
| -rw-r--r-- | src/panels/panel.h | 6 | ||||
| -rw-r--r-- | src/panels/terminal/terminalpanel.cpp | 3 | ||||
| -rw-r--r-- | src/panels/terminal/terminalpanel.h | 1 |
7 files changed, 65 insertions, 35 deletions
diff --git a/src/panels/information/informationpanel.cpp b/src/panels/information/informationpanel.cpp index 03e048ae7..5f613c520 100644 --- a/src/panels/information/informationpanel.cpp +++ b/src/panels/information/informationpanel.cpp @@ -49,6 +49,7 @@ InformationPanel::~InformationPanel() void InformationPanel::setSelection(const KFileItemList &selection) { m_selection = selection; + m_hoveredItem = KFileItem(); // Selection supersedes any stale hover if (!isVisible()) { return; @@ -83,14 +84,12 @@ void InformationPanel::requestDelayedItemInfo(const KFileItem &item) return; } - if (item.isNull()) { - m_hoveredItem = KFileItem(); - return; - } - cancelRequest(); - - m_isSelectionActive = false; + if (!item.isNull()) { + m_isSelectionActive = false; + } else { + m_isSelectionActive = !m_selection.isEmpty(); + } m_hoveredItem = item; m_infoTimer->start(); @@ -229,35 +228,36 @@ void InformationPanel::showItemInfo() cancelRequest(); //qDebug() << "showItemInfo" << m_fileItem; - if (m_hoveredItem.isNull() && (m_selection.count() > 1)) { + bool canShowHoverItem = !m_isSelectionActive && !m_hoveredItem.isNull() && InformationPanelSettings::showHovered(); + if (m_selection.count() > 1 && !canShowHoverItem) { // The information for a selection of items should be shown m_content->showItems(m_selection); - } else { - // The information for exactly one item should be shown - KFileItem item; + return; + } - if (!m_isSelectionActive && !m_hoveredItem.isNull() && InformationPanelSettings::showHovered()) { - item = m_hoveredItem; - } else if (m_isSelectionActive && !m_selection.isEmpty()) { - Q_ASSERT(m_selection.count() == 1); - item = m_selection.first(); - } + // The information for exactly one item should be shown + KFileItem item; + if (canShowHoverItem) { + item = m_hoveredItem; + } else if (!m_selection.isEmpty()) { + Q_ASSERT(m_selection.count() == 1); + item = m_selection.first(); + } - if (!item.isNull()) { - m_shownUrl = item.url(); - m_content->showItem(item); - return; - } + if (!item.isNull()) { + m_shownUrl = item.url(); + m_content->showItem(item); + return; + } - // No item is hovered and no selection has been done: provide - // an item for the currently shown directory. - m_shownUrl = url(); - m_folderStatJob = KIO::stat(m_shownUrl, KIO::StatJob::SourceSide, KIO::StatDefaultDetails | KIO::StatRecursiveSize, KIO::HideProgressInfo); - if (m_folderStatJob->uiDelegate()) { - KJobWidgets::setWindow(m_folderStatJob, this); - } - connect(m_folderStatJob, &KIO::Job::result, this, &InformationPanel::slotFolderStatFinished); + // No item is hovered and no selection has been done: provide + // an item for the currently shown directory. + m_shownUrl = url(); + m_folderStatJob = KIO::stat(m_shownUrl, KIO::StatJob::SourceSide, KIO::StatDefaultDetails | KIO::StatRecursiveSize, KIO::HideProgressInfo); + if (m_folderStatJob->uiDelegate()) { + KJobWidgets::setWindow(m_folderStatJob, this); } + connect(m_folderStatJob, &KIO::Job::result, this, &InformationPanel::slotFolderStatFinished); } void InformationPanel::slotFolderStatFinished(KJob *job) diff --git a/src/panels/information/mediawidget.cpp b/src/panels/information/mediawidget.cpp index 20366445a..54a6d7fe7 100644 --- a/src/panels/information/mediawidget.cpp +++ b/src/panels/information/mediawidget.cpp @@ -50,6 +50,7 @@ public: SeekSlider(Qt::Orientation orientation, QWidget *parent = nullptr) : QSlider(orientation, parent) { + grabGesture(Qt::TapAndHoldGesture); } protected: @@ -132,6 +133,15 @@ protected: QSlider::keyPressEvent(event); } } + + bool event(QEvent *event) override + { + if (event->type() == QEvent::Gesture) { + event->ignore(); + return true; + } + return QSlider::event(event); + } }; MediaWidget::MediaWidget(QWidget *parent) @@ -292,8 +302,8 @@ void MediaWidget::initPlayer() { if (!m_player) { initLayout(); - m_player = new QMediaPlayer; - m_player->setAudioOutput(new QAudioOutput); + m_player = new QMediaPlayer(this); + m_player->setAudioOutput(new QAudioOutput(m_player)); m_videoWidget = new EmbeddedVideoPlayer(this); m_videoWidget->setCursor(Qt::PointingHandCursor); diff --git a/src/panels/information/pixmapviewer.cpp b/src/panels/information/pixmapviewer.cpp index 9ac9bd253..4f3f9e82f 100644 --- a/src/panels/information/pixmapviewer.cpp +++ b/src/panels/information/pixmapviewer.cpp @@ -54,6 +54,7 @@ void PixmapViewer::setPixmap(const QPixmap &pixmap) void PixmapViewer::setSizeHint(const QSize &size) { if (m_animatedImage && size != m_sizeHint) { + m_animatedImage->setScaledSize(QSize()); m_animatedImage->stop(); } @@ -104,10 +105,12 @@ void PixmapViewer::updateAnimatedImageFrame() Q_ASSERT(m_animatedImage); m_pixmap = m_animatedImage->currentPixmap(); - if (m_pixmap.width() > m_sizeHint.width() || m_pixmap.height() > m_sizeHint.height()) { - m_pixmap = m_pixmap.scaled(m_sizeHint, Qt::KeepAspectRatio); + const auto physicalSize = m_sizeHint * devicePixelRatio(); + if (m_pixmap.width() > physicalSize.width() || m_pixmap.height() > physicalSize.height()) { + m_pixmap = m_pixmap.scaled(physicalSize, Qt::KeepAspectRatio); m_animatedImage->setScaledSize(m_pixmap.size()); } + m_pixmap.setDevicePixelRatio(devicePixelRatio()); update(); } diff --git a/src/panels/panel.cpp b/src/panels/panel.cpp index e8250c62b..94f80f7e7 100644 --- a/src/panels/panel.cpp +++ b/src/panels/panel.cpp @@ -54,6 +54,15 @@ void Panel::setUrl(const QUrl &url) } } +void Panel::refreshUrl(const QUrl &url) +{ + const QUrl oldUrl = m_url; + m_url = url; + if (!urlChanged()) { + m_url = oldUrl; + } +} + void Panel::readSettings() { } diff --git a/src/panels/panel.h b/src/panels/panel.h index 5f1fabb4a..23136a4b9 100644 --- a/src/panels/panel.h +++ b/src/panels/panel.h @@ -46,6 +46,12 @@ public Q_SLOTS: void setUrl(const QUrl &url); /** + * This is invoked whenever the folder being displayed in the + * active Dolphin view is refreshed. + */ + void refreshUrl(const QUrl &url); + + /** * Refreshes the view to get synchronized with the settings. */ virtual void readSettings(); diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index a357b31ac..2ed6cd33e 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -145,9 +145,10 @@ bool TerminalPanel::urlChanged() return false; } - const bool sendInput = m_terminal && !hasProgramRunning() && isVisible() && m_syncUrl; + const bool sendInput = m_terminal && !hasProgramRunning() && isVisible() && m_syncUrl && url() != m_url; if (sendInput) { changeDir(url()); + m_url = url(); } return true; diff --git a/src/panels/terminal/terminalpanel.h b/src/panels/terminal/terminalpanel.h index 0aaf921c0..7f4e9e36c 100644 --- a/src/panels/terminal/terminalpanel.h +++ b/src/panels/terminal/terminalpanel.h @@ -86,6 +86,7 @@ private: private: bool m_clearTerminal; bool m_syncUrl; + QUrl m_url; KIO::StatJob *m_mostLocalUrlJob; QVBoxLayout *m_layout; |
