HydrogenAudio

Hosted Forums => foobar2000 => Development - (fb2k) => Topic started by: $ergi0 on 2013-03-25 06:45:20

Title: modal preferences page
Post by: $ergi0 on 2013-03-25 06:45:20
hi
i'm developing a plugin with simple preferences page
i have implemented classes
PreferencesPageInstance : public CDialogImpl<PreferencesPageInstance>, public preferences_page_instance {
PreferencesPage : public preferences_page_impl<PreferencesPageInstance> {
so everything works as supposed to: user goes to foobar preferences and finds my page there

the problem is i want to add a context menu item "setup and use my plugin" to spare user some time on finding my preferences page. i can't use this code
static_api_ptr_t<ui_control> uic;
uic->show_preferences(PreferencesPage::pp_guid);

cause it's not-blocking.

is there a way to show my preferences page as a modal dialog or wait until foobar preferences window is closed?

thanks
Title: modal preferences page
Post by: foosion on 2013-03-25 10:17:06
No, that is not possible. You would need to create your own modal window for hosting your preferences page and use modal_dialog_scope (http://foosion.foobar2000.org/doxygen/latest/classmodal__dialog__scope.html).

However, the recommended way would be to keep everything modeless and display a message in your plugin, if it has not been configured yet. You could do this as a popup or embedded into the UI of your plugin. See for the example the album list plugin which displays a hint if the media library has not been configured yet.
Title: modal preferences page
Post by: $ergi0 on 2013-03-25 11:50:41
ok, i'll implement the dialog, just thought if there is a way to use the same code for the dialog and preferences page. i want functionality similar to converter plugin when user can set up configuration for the current run or to choose the last used

it seems there is no sense in keeping preferences page in this case
thanks