Create and use new signal: PalettePresetsChange

This commit is contained in:
mezz 2021-01-04 09:38:43 -10:00
parent be48c40dc5
commit 3211831da3
No known key found for this signature in database
GPG Key ID: 7513C6CA2F0F7687
6 changed files with 8 additions and 4 deletions

View File

@ -124,6 +124,7 @@ namespace app {
obs::signal<void()> Exit; obs::signal<void()> Exit;
obs::signal<void()> PaletteChange; obs::signal<void()> PaletteChange;
obs::signal<void()> ColorSpaceChange; obs::signal<void()> ColorSpaceChange;
obs::signal<void()> PalettePresetsChange;
private: private:
class CoreModules; class CoreModules;

View File

@ -13,7 +13,6 @@
#include "app/commands/commands.h" #include "app/commands/commands.h"
#include "app/commands/params.h" #include "app/commands/params.h"
#include "app/context.h" #include "app/context.h"
#include "app/extensions.h"
#include "app/file/palette_file.h" #include "app/file/palette_file.h"
#include "app/file_selector.h" #include "app/file_selector.h"
#include "app/i18n/strings.h" #include "app/i18n/strings.h"
@ -80,7 +79,7 @@ void SavePaletteCommand::onExecute(Context* context)
set_current_palette(palette, false); set_current_palette(palette, false);
} }
if (m_save_as_preset) { if (m_save_as_preset) {
App::instance()->extensions().PalettesChange(); App::instance()->PalettePresetsChange();
} }
} }

View File

@ -1132,7 +1132,7 @@ void Extensions::generateExtensionSignals(Extension* extension)
{ {
if (extension->hasLanguages()) LanguagesChange(extension); if (extension->hasLanguages()) LanguagesChange(extension);
if (extension->hasThemes()) ThemesChange(extension); if (extension->hasThemes()) ThemesChange(extension);
if (extension->hasPalettes()) PalettesChange(); if (extension->hasPalettes()) PalettesChange(extension);
if (extension->hasDitheringMatrices()) DitheringMatricesChange(extension); if (extension->hasDitheringMatrices()) DitheringMatricesChange(extension);
#ifdef ENABLE_SCRIPTING #ifdef ENABLE_SCRIPTING
if (extension->hasScripts()) ScriptsChange(extension); if (extension->hasScripts()) ScriptsChange(extension);

View File

@ -182,7 +182,7 @@ namespace app {
obs::signal<void(Extension*)> NewExtension; obs::signal<void(Extension*)> NewExtension;
obs::signal<void(Extension*)> LanguagesChange; obs::signal<void(Extension*)> LanguagesChange;
obs::signal<void(Extension*)> ThemesChange; obs::signal<void(Extension*)> ThemesChange;
obs::signal<void()> PalettesChange; obs::signal<void(Extension*)> PalettesChange;
obs::signal<void(Extension*)> DitheringMatricesChange; obs::signal<void(Extension*)> DitheringMatricesChange;
obs::signal<void(Extension*)> ScriptsChange; obs::signal<void(Extension*)> ScriptsChange;

View File

@ -124,6 +124,9 @@ PalettesListBox::PalettesListBox()
m_extPaletteChanges = m_extPaletteChanges =
App::instance()->extensions().PalettesChange.connect( App::instance()->extensions().PalettesChange.connect(
base::Bind<void>(&PalettesListBox::reload, this)); base::Bind<void>(&PalettesListBox::reload, this));
m_extPresetsChanges =
App::instance()->PalettePresetsChange.connect(
base::Bind<void>(&PalettesListBox::reload, this));
} }
doc::Palette* PalettesListBox::selectedPalette() doc::Palette* PalettesListBox::selectedPalette()

View File

@ -34,6 +34,7 @@ namespace app {
ui::TooltipManager m_tooltips; ui::TooltipManager m_tooltips;
obs::scoped_connection m_extPaletteChanges; obs::scoped_connection m_extPaletteChanges;
obs::scoped_connection m_extPresetsChanges;
}; };
} // namespace app } // namespace app