@@ -115,8 +115,8 @@ PluginSettingsView::PluginSettingsView()
115115 auto categoryLabel = new QLabel (" Select Kind:" );
116116 vlay->addWidget (categoryLabel);
117117
118- categoryComboBox = new QComboBox (m_widget);
119- vlay->addWidget (categoryComboBox );
118+ m_categoryComboBox = new QComboBox (m_widget);
119+ vlay->addWidget (m_categoryComboBox );
120120 vlay->addSpacing (20 );
121121
122122 m_link->setToolTip (tr (" Open external package link in default browser." ));
@@ -193,6 +193,10 @@ PluginSettingsView::PluginSettingsView()
193193
194194 connect (&mgr, &QNetworkAccessManager::finished, this , &PluginSettingsView::on_message);
195195
196+ connect (m_categoryComboBox, &QComboBox::currentIndexChanged, this , [this ](int index) {
197+ onCategoryChanged (index);
198+ });
199+
196200 refresh ();
197201}
198202
@@ -418,7 +422,7 @@ void PluginSettingsView::uninstall()
418422
419423 const auto & library{score::AppContext ().settings <Library::Settings::Model>()};
420424
421- if (addon.kind == " addon" || addon.kind == " nodes" || addon.kind == " media" )
425+ if (addon.kind == " addon" || addon.kind == " nodes" || addon.kind == " media" || addon. kind == " ai-model " )
422426 {
423427 success = QDir{library.getPackagesPath () + ' /' + addon.raw_name }.removeRecursively ();
424428 }
@@ -711,8 +715,8 @@ void PluginSettingsView::progress_from_bytes(qint64 bytesReceived, qint64 bytesT
711715
712716void PluginSettingsView::updateCategoryComboBox (int tabIndex)
713717{
714- categoryComboBox ->clear ();
715- categoryComboBox ->addItem (" All" );
718+ m_categoryComboBox ->clear ();
719+ m_categoryComboBox ->addItem (" All" );
716720
717721 PackagesModel* model = nullptr ;
718722 if (tabIndex == 0 ) // Local packages tab
@@ -739,8 +743,36 @@ void PluginSettingsView::updateCategoryComboBox(int tabIndex)
739743
740744 for (const QString& kind : uniqueKinds)
741745 {
742- categoryComboBox->addItem (kind);
746+ m_categoryComboBox->addItem (kind);
747+ }
748+ }
749+ }
750+
751+ void PluginSettingsView::onCategoryChanged (int index)
752+ {
753+ // Filter table view to show only packages of the selected kind
754+ QString selectedKind = m_categoryComboBox->itemText (index);
755+
756+ QTableView* activeView = m_install->isVisible () ? m_remoteAddons : m_addonsOnSystem;
757+ PackagesModel* model = static_cast <PackagesModel*>(activeView->model ());
758+
759+ if (!model)
760+ return ;
761+
762+ if (selectedKind == " All" )
763+ {
764+ for (int row = 0 ; row < model->addons ().size (); ++row)
765+ {
766+ activeView->setRowHidden (row, false );
743767 }
768+ return ;
769+ }
770+
771+ for (int row = 0 ; row < model->addons ().size (); ++row)
772+ {
773+ QString rowKind = model->addons ()[row].kind ;
774+ activeView->setRowHidden (row, rowKind != selectedKind);
744775 }
745776}
777+
746778}
0 commit comments