@@ -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
@@ -247,6 +251,8 @@ void PluginSettingsView::refresh()
247251 QNetworkRequest rqst{
248252 QUrl (" https://raw.githubusercontent.com/ossia/score-addons/refs/heads/"
249253 " add-ai-models/addons.json" )};
254+ // QNetworkRequest rqst{
255+ // QUrl("https://raw.githubusercontent.com/ossia/score-addons/master/addons.json")};
250256 mgr.get (rqst);
251257}
252258
@@ -419,7 +425,7 @@ void PluginSettingsView::uninstall()
419425
420426 const auto & library{score::AppContext ().settings <Library::Settings::Model>()};
421427
422- if (addon.kind == " addon" || addon.kind == " nodes" || addon.kind == " media" )
428+ if (addon.kind == " addon" || addon.kind == " nodes" || addon.kind == " media" || addon. kind == " ai-model " )
423429 {
424430 success = QDir{library.getPackagesPath () + ' /' + addon.raw_name }.removeRecursively ();
425431 }
@@ -720,8 +726,8 @@ void PluginSettingsView::progress_from_bytes(qint64 bytesReceived, qint64 bytesT
720726
721727void PluginSettingsView::updateCategoryComboBox (int tabIndex)
722728{
723- categoryComboBox ->clear ();
724- categoryComboBox ->addItem (" All" );
729+ m_categoryComboBox ->clear ();
730+ m_categoryComboBox ->addItem (" All" );
725731
726732 PackagesModel* model = nullptr ;
727733 if (tabIndex == 0 ) // Local packages tab
@@ -748,8 +754,36 @@ void PluginSettingsView::updateCategoryComboBox(int tabIndex)
748754
749755 for (const QString& kind : uniqueKinds)
750756 {
751- categoryComboBox->addItem (kind);
757+ m_categoryComboBox->addItem (kind);
758+ }
759+ }
760+ }
761+
762+ void PluginSettingsView::onCategoryChanged (int index)
763+ {
764+ // Filter table view to show only packages of the selected kind
765+ QString selectedKind = m_categoryComboBox->itemText (index);
766+
767+ QTableView* activeView = m_install->isVisible () ? m_remoteAddons : m_addonsOnSystem;
768+ PackagesModel* model = static_cast <PackagesModel*>(activeView->model ());
769+
770+ if (!model)
771+ return ;
772+
773+ if (selectedKind == " All" )
774+ {
775+ for (int row = 0 ; row < model->addons ().size (); ++row)
776+ {
777+ activeView->setRowHidden (row, false );
752778 }
779+ return ;
780+ }
781+
782+ for (int row = 0 ; row < model->addons ().size (); ++row)
783+ {
784+ QString rowKind = model->addons ()[row].kind ;
785+ activeView->setRowHidden (row, rowKind != selectedKind);
753786 }
754787}
788+
755789}
0 commit comments