Commit fe2f5c0a authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Online resources: only show warning about loading time once.

CCBUG: 454470
parent 11fc3671
......@@ -1649,6 +1649,9 @@ void Monitor::slotOpenClip(const std::shared_ptr<ProjectClip> &controller, int i
disconnect(m_controller.get(), &ProjectClip::boundsChanged, m_glMonitor->getControllerProxy(), &MonitorProxy::updateClipBounds);
disconnect(m_controller.get(), &ProjectClip::registeredClipChanged, m_controller.get(), &ProjectClip::checkClipBounds);
}
} else if (controller == nullptr) {
// Nothing to do
return;
}
disconnect(this, &Monitor::seekPosition, this, &Monitor::seekRemap);
m_controller = controller;
......@@ -1821,11 +1824,13 @@ const QString Monitor::activeClipId()
void Monitor::slotPreviewResource(const QString &path, const QString &title)
{
if (!QUrl::fromUserInput(path).isLocalFile()) {
warningMessage(i18n("It maybe takes a while until the preview is loaded"), 15000);
if (isPlaying()) {
stop();
}
QApplication::processEvents();
slotOpenClip(nullptr);
m_streamAction->setVisible(false);
// TODO: direct loading of the producer blocks UI, we should use a task to load the producer
m_glMonitor->setProducer(path);
m_timePos->setRange(0, m_glMonitor->producer()->get_length() - 1);
m_glMonitor->getControllerProxy()->setClipProperties(-1, ClipType::Unknown, false, title);
......
......@@ -244,8 +244,6 @@ private slots:
void slotForceSize(QAction *a);
void buildBackgroundedProducer(int pos);
void slotSeekToKeyFrame();
/** @brief Display a non blocking error message to user **/
void warningMessage(const QString &text, int timeout = 5000, const QList<QAction *> &actions = QList<QAction *>());
void slotLockMonitor(bool lock);
void slotSwitchPlay();
void slotEditInlineMarker();
......@@ -290,6 +288,8 @@ public slots:
void slotRewind(double speed = 0) override;
void slotRewindOneFrame(int diff = 1);
void slotForwardOneFrame(int diff = 1);
/** @brief Display a non blocking error message to user **/
void warningMessage(const QString &text, int timeout = 5000, const QList<QAction *> &actions = QList<QAction *>());
void slotStart();
/** @brief Set position and information for the trimming preview
* @param pos Absolute position in frames
......
......@@ -28,6 +28,7 @@
ResourceWidget::ResourceWidget(QWidget *parent)
: QWidget(parent)
, m_showloadingWarning(true)
{
setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
setupUi(this);
......@@ -463,9 +464,18 @@ void ResourceWidget::slotPreviewItem()
if (!m_currentItem) {
return;
}
blockUI(true);
emit previewClip(m_currentItem->data(previewRole).toString(), i18n("Online Resources Preview"));
const QString path = m_currentItem->data(previewRole).toString();
if (m_showloadingWarning && !QUrl::fromUserInput(path).isLocalFile()) {
message_line->setText(i18n("It maybe takes a while until the preview is loaded"));
message_line->setMessageType(KMessageWidget::Warning);
message_line->show();
QTimer::singleShot(6000, message_line, &KMessageWidget::animatedHide);
repaint();
// Only show this warning once
m_showloadingWarning = false;
}
emit previewClip(path, i18n("Online Resources Preview"));
blockUI(false);
}
......
......@@ -65,6 +65,7 @@ private:
/** @brief Default icon size for the views. */
QSize m_iconSize;
int wheelAccumulatedDelta;
bool m_showloadingWarning;
ResourceItemInfo getItemById(const QString &id);
void loadConfig();
void saveConfig();
......
......@@ -6,11 +6,24 @@
<rect>
<x>0</x>
<y>0</y>
<width>507</width>
<height>457</height>
<width>313</width>
<height>335</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="4">
<spacer name="spacer_horiz">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>81</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="7">
<widget class="QSplitter" name="splitter">
<property name="orientation">
......@@ -191,42 +204,38 @@
</widget>
</widget>
</item>
<item row="1" column="0" colspan="7">
<widget class="KMessageWidget" name="message_line">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="4" column="3">
<widget class="QToolButton" name="button_zoomin">
<property name="text">
<string>...</string>
</property>
<property name="wordWrap">
<bool>false</bool>
<property name="icon">
<iconset theme="zoom-in">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="closeButtonVisible">
<bool>false</bool>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSlider" name="slider_zoom">
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
<item row="4" column="6">
<widget class="QPushButton" name="button_import">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
<property name="text">
<string>Import</string>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="icon">
<iconset theme="document-import">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
<item row="3" column="5">
<item row="4" column="5">
<widget class="QPushButton" name="button_preview">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
......@@ -243,51 +252,26 @@
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QToolButton" name="button_zoomin">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="zoom-in">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="4">
<spacer name="spacer_horiz">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<item row="4" column="2">
<widget class="QSlider" name="slider_zoom">
<property name="minimumSize">
<size>
<width>81</width>
<height>20</height>
<width>40</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="6">
<widget class="QPushButton" name="button_import">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Import</string>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="icon">
<iconset theme="document-import">
<normaloff>.</normaloff>.</iconset>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QToolButton" name="button_zoomout">
<property name="text">
<string>...</string>
......@@ -345,15 +329,31 @@
</layout>
</widget>
</item>
<item row="3" column="1" colspan="6">
<widget class="KMessageWidget" name="message_line">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="closeButtonVisible">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
<zorder>splitter</zorder>
<zorder>service_box_2</zorder>
<zorder>message_line</zorder>
<zorder>button_preview</zorder>
<zorder>button_import</zorder>
<zorder>button_zoomin</zorder>
<zorder>button_zoomout</zorder>
<zorder>slider_zoom</zorder>
<zorder>message_line</zorder>
</widget>
<customwidgets>
<customwidget>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment