[vlc-commits] [Git][videolan/vlc][master] qt: persist album art changes immediately
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Fri Jun 26 15:43:10 UTC 2026
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
0ef41206 by Atul Singh at 2026-06-26T17:24:00+02:00
qt: persist album art changes immediately
- - - - -
5 changed files:
- modules/gui/qt/dialogs/mediainfo/info_panels.cpp
- modules/gui/qt/player/player_controller.cpp
- modules/gui/qt/player/player_controller.hpp
- modules/gui/qt/widgets/native/interface_widgets.cpp
- modules/gui/qt/widgets/native/interface_widgets.hpp
Changes:
=====================================
modules/gui/qt/dialogs/mediainfo/info_panels.cpp
=====================================
@@ -28,6 +28,7 @@
#include "qt.hpp"
#include "info_panels.hpp"
+#include "player/player_controller.hpp"
#include "widgets/native/interface_widgets.hpp"
#include "info_widgets.hpp"
#include "dialogs/fingerprint/fingerprintdialog.hpp"
@@ -143,6 +144,10 @@ MetaPanel::MetaPanel( QWidget *parent,
/* ART_URL */
art_cover = new CoverArtLabel( this, p_intf );
metaLayout->addWidget( art_cover, line, 7, 6, 3, Qt::AlignCenter );
+ connect( art_cover, &CoverArtLabel::editing, this, &MetaPanel::enterEditMode );
+ connect( art_cover, &CoverArtLabel::artSelected, this, [this]( const QString& url ) {
+ currentURL = url;
+ } );
ADD_META( VLC_META_COPYRIGHT, copyright_text, 0, 7 ); line++;
@@ -172,9 +177,6 @@ MetaPanel::MetaPanel( QWidget *parent,
connect( seqtot_text, &QLineEdit::textEdited, this, &MetaPanel::enterEditMode );
connect( date_text, &QLineEdit::textEdited, this, &MetaPanel::enterEditMode );
-// connect( THEMIM, QOverload<input_item_t *>::of(&PlayerController::artChanged),
-// this, &MetaPanel::enterEditMode );
-
/* We are not yet in Edit Mode */
b_inEditMode = false;
}
@@ -251,6 +253,9 @@ void MetaPanel::update( const SharedInputItem& p_item )
#undef UPDATE_META
art_cover->setItem( p_item );
+ char *psz_art = input_item_GetArtURL( inputItem );
+ currentURL = qfu( psz_art ? psz_art : "" );
+ free( psz_art );
}
/**
@@ -278,6 +283,8 @@ bool MetaPanel::saveMeta()
input_item_SetCopyright( input, qtu( copyright_text->text() ) );
input_item_SetPublisher( input, qtu( publisher_text->text() ) );
input_item_SetDescription( input, qtu( description_text->toPlainText() ) );
+ if( !currentURL.isEmpty() )
+ input_item_SetArtURL( input, qtu( currentURL ) );
/* Reset the status of the mode. No need to emit any signal because parent
is the only caller */
@@ -287,6 +294,10 @@ bool MetaPanel::saveMeta()
QMessageBox::warning( this, qtr("Metadata"), qtr("Failed to save metadata") );
return false;
}
+ art_cover->setItem( p_input );
+ /* Refresh the player controller caches for the currently playing item so
+ * the Qt UI sees the new artwork and metadata without reopening. */
+ THEMIM->refreshMediaMeta( input );
return true;
}
@@ -328,6 +339,7 @@ void MetaPanel::clear()
publisher_text->clear();
encodedby_text->clear();
art_cover->clear();
+ currentURL.clear();
fingerprintButton->setEnabled( false );
setEditMode( false );
=====================================
modules/gui/qt/player/player_controller.cpp
=====================================
@@ -2180,6 +2180,27 @@ void PlayerController::setArt( input_item_t *p_item, QString fileUrl )
}
}
+void PlayerController::refreshMediaMeta( input_item_t *p_item )
+{
+ if (p_item == nullptr)
+ return;
+
+ Q_D(PlayerController);
+
+ const bool isCurrentItem = [d, p_item]() {
+ vlc_player_locker lock{ d->m_player };
+ return p_item == vlc_player_GetCurrentMedia( d->m_player );
+ }();
+
+ if (!isCurrentItem)
+ return;
+
+ d->UpdateName( p_item );
+ d->UpdateArt( p_item );
+ d->UpdateMeta( p_item );
+ d->UpdateInfo( p_item );
+}
+
bool PlayerController::associateSubtitleFile(const QString &uri)
{
return AddAssociatedMedia(SPU_ES, uri, true, true, true) == VLC_SUCCESS;
=====================================
modules/gui/qt/player/player_controller.hpp
=====================================
@@ -302,6 +302,7 @@ public:
void requestArtUpdate( input_item_t *p_item );
void setArt( input_item_t *p_item, QString fileUrl );
+ void refreshMediaMeta( input_item_t *p_item );
static const QString decodeArtURL( input_item_t *p_item );
void updatePosition();
void updateTime(vlc_tick_t system_now, bool forceTimer);
=====================================
modules/gui/qt/widgets/native/interface_widgets.cpp
=====================================
@@ -77,7 +77,10 @@ CoverArtLabel::~CoverArtLabel()
void CoverArtLabel::setItem( const SharedInputItem& _p_item )
{
if( _p_item == p_item )
+ {
+ showArtUpdate();
return;
+ }
p_item = _p_item;
@@ -138,7 +141,9 @@ void CoverArtLabel::setArtFromFile()
if( fileUrl.isEmpty() )
return;
- THEMIM->setArt( p_item.get(), fileUrl.toString() );
+ showArtUpdate( fileUrl.toLocalFile() );
+ emit artSelected( fileUrl.toString() );
+ emit editing();
}
void CoverArtLabel::clear()
=====================================
modules/gui/qt/widgets/native/interface_widgets.hpp
=====================================
@@ -62,6 +62,10 @@ public slots:
void askForUpdate();
void setArtFromFile();
void clear();
+
+signals:
+ void editing();
+ void artSelected( const QString& );
};
#endif
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/0ef412067901da6ea64f4e91d1525d4847948e07
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/0ef412067901da6ea64f4e91d1525d4847948e07
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list