Initial support for system-installed plugins in Linux

This commit is contained in:
Adam Honse 2024-05-14 20:06:01 -05:00
parent 806ababa05
commit d03701c58d
5 changed files with 56 additions and 20 deletions

View file

@ -96,6 +96,8 @@ void Ui::OpenRGBPluginsPage::RefreshList()
entry->RegisterEnableClickCallback(EnableClickCallbackFunction, this);
entry->is_system = plugin.is_system;
/*---------------------------------------------------------*\
| Add the entry to the plugin list |
\*---------------------------------------------------------*/
@ -171,7 +173,7 @@ bool Ui::OpenRGBPluginsPage::InstallPlugin(std::string install_file)
LOG_TRACE("[OpenRGBPluginsPage] Copying from %s to %s", from_path.c_str(), to_path.c_str());
filesystem::copy(from_path, to_path, filesystem::copy_options::overwrite_existing);
plugin_manager->AddPlugin(to_path);
plugin_manager->AddPlugin(to_path, false);
return true;
}
@ -207,6 +209,14 @@ void Ui::OpenRGBPluginsPage::on_RemovePluginButton_clicked()
return;
}
/*-----------------------------------------------------*\
| Don't allow removing system plugins |
\*-----------------------------------------------------*/
if(entries[cur_row]->is_system)
{
return;
}
/*-----------------------------------------------------*\
| Open plugin settings |
\*-----------------------------------------------------*/
@ -336,9 +346,18 @@ void Ui::OpenRGBPluginsPage::on_EnableButton_clicked(OpenRGBPluginsEntry* entry)
void Ui::OpenRGBPluginsPage::on_PluginsList_itemSelectionChanged()
{
/*-----------------------------------------------------*\
| Enable the remove button when there's a selected item |
| Get index of selected plugin entry |
\*-----------------------------------------------------*/
ui->RemovePluginButton->setEnabled(!ui->PluginsList->selectedItems().empty());
int cur_row = ui->PluginsList->currentRow();
/*-----------------------------------------------------*\
| Enable the remove button when there's a selected item |
| and the selected item is not a system plugin |
\*-----------------------------------------------------*/
if(!entries[cur_row]->is_system)
{
ui->RemovePluginButton->setEnabled(!ui->PluginsList->selectedItems().empty());
}
}
void Ui::OpenRGBPluginsPage::on_PluginsList_PluginsDropped(std::vector<std::string> path_list)