Signed-off-by: falkTX <falktx@falktx.com>tags/v2.2.0-RC1
@@ -232,11 +232,12 @@ protected: | |||||
fHasOptionalGui = std::strstr(features, ":optional-gui:") != nullptr; | fHasOptionalGui = std::strstr(features, ":optional-gui:") != nullptr; | ||||
fHasServerControl = std::strstr(features, ":server_control:") != nullptr; | fHasServerControl = std::strstr(features, ":server_control:") != nullptr; | ||||
#if 0 | |||||
// UI starts visible | |||||
// UI starts hidden | |||||
if (fHasOptionalGui) | if (fHasOptionalGui) | ||||
lo_send_from(fReplyAddress, fServer, LO_TT_IMMEDIATE, "/nsm/client/gui_is_shown", ""); | |||||
#endif | |||||
{ | |||||
// NOTE: lo_send_from is a macro that creates local variables | |||||
lo_send_from(fReplyAddress, fServer, LO_TT_IMMEDIATE, "/nsm/client/gui_is_hidden", ""); | |||||
} | |||||
carla_stdout("Carla started via '%s', message: %s", smName, message); | carla_stdout("Carla started via '%s', message: %s", smName, message); | ||||
@@ -298,6 +299,7 @@ protected: | |||||
if (carla_is_engine_running(handle)) | if (carla_is_engine_running(handle)) | ||||
carla_engine_close(handle); | carla_engine_close(handle); | ||||
// TODO send error if engine failed to initialize | |||||
carla_engine_init(handle, "JACK", clientNameId); | carla_engine_init(handle, "JACK", clientNameId); | ||||
fProjectPath = projectPath; | fProjectPath = projectPath; | ||||
@@ -54,7 +54,7 @@ if __name__ == '__main__': | |||||
# ------------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------------ | ||||
# Show GUI | # Show GUI | ||||
gui.show() | |||||
gui.showIfNeeded() | |||||
# ------------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------------ | ||||
# App-Loop | # App-Loop | ||||
@@ -60,7 +60,7 @@ if __name__ == '__main__': | |||||
# ------------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------------ | ||||
# Show GUI | # Show GUI | ||||
gui.show() | |||||
gui.showIfNeeded() | |||||
# ------------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------------ | ||||
# App-Loop | # App-Loop | ||||
@@ -60,7 +60,7 @@ if __name__ == '__main__': | |||||
# ------------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------------ | ||||
# Show GUI | # Show GUI | ||||
gui.show() | |||||
gui.showIfNeeded() | |||||
# ------------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------------ | ||||
# App-Loop | # App-Loop | ||||
@@ -58,7 +58,7 @@ if __name__ == '__main__': | |||||
# ------------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------------ | ||||
# Show GUI | # Show GUI | ||||
gui.show() | |||||
gui.showIfNeeded() | |||||
# ------------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------------ | ||||
# App-Loop | # App-Loop | ||||
@@ -610,6 +610,23 @@ class HostWindow(QMainWindow): | |||||
if not host.isControl: | if not host.isControl: | ||||
QTimer.singleShot(0, self.slot_engineStart) | QTimer.singleShot(0, self.slot_engineStart) | ||||
# -------------------------------------------------------------------------------------------------------- | |||||
# Manage visibility state, needed for NSM | |||||
def hideForNSM(self): | |||||
for pitem in reversed(self.fPluginList): | |||||
if pitem is None: | |||||
continue | |||||
widget = pitem.getWidget().hideCustomUI() | |||||
self.hide() | |||||
def showIfNeeded(self): | |||||
if self.host.nsmOK: | |||||
self.ui.act_file_quit.setText(self.tr("Hide")) | |||||
QApplication.instance().setQuitOnLastWindowClosed(False) | |||||
else: | |||||
self.show() | |||||
# -------------------------------------------------------------------------------------------------------- | # -------------------------------------------------------------------------------------------------------- | ||||
# Setup | # Setup | ||||
@@ -2404,11 +2421,7 @@ class HostWindow(QMainWindow): | |||||
# Hide Optional Gui | # Hide Optional Gui | ||||
elif opcode == NSM_CALLBACK_HIDE_OPTIONAL_GUI: | elif opcode == NSM_CALLBACK_HIDE_OPTIONAL_GUI: | ||||
for pitem in reversed(self.fPluginList): | |||||
if pitem is None: | |||||
continue | |||||
widget = pitem.getWidget().hideCustomUI() | |||||
self.hide() | |||||
self.hideForNSM() | |||||
self.host.nsm_ready(opcode) | self.host.nsm_ready(opcode) | ||||
@@ -2453,7 +2466,7 @@ class HostWindow(QMainWindow): | |||||
def slot_handleSIGTERM(self): | def slot_handleSIGTERM(self): | ||||
print("Got SIGTERM -> Closing now") | print("Got SIGTERM -> Closing now") | ||||
self.fCustomStopAction = self.CUSTOM_ACTION_APP_CLOSE | self.fCustomStopAction = self.CUSTOM_ACTION_APP_CLOSE | ||||
self.slot_engineStop(True) | |||||
self.close() | |||||
# -------------------------------------------------------------------------------------------------------- | # -------------------------------------------------------------------------------------------------------- | ||||
# Internal stuff | # Internal stuff | ||||
@@ -2749,6 +2762,11 @@ class HostWindow(QMainWindow): | |||||
event.ignore() | event.ignore() | ||||
return | return | ||||
if self.host.nsmOK and self.fCustomStopAction != self.CUSTOM_ACTION_APP_CLOSE: | |||||
self.hideForNSM() | |||||
self.host.nsm_ready(NSM_CALLBACK_HIDE_OPTIONAL_GUI) | |||||
return | |||||
patchcanvas.handleAllPluginsRemoved() | patchcanvas.handleAllPluginsRemoved() | ||||
if MACOS and self.fMacClosingHelper and not (self.host.isControl or self.host.isPlugin): | if MACOS and self.fMacClosingHelper and not (self.host.isControl or self.host.isPlugin): | ||||
@@ -2773,6 +2791,9 @@ class HostWindow(QMainWindow): | |||||
QMainWindow.closeEvent(self, event) | QMainWindow.closeEvent(self, event) | ||||
# if we reach this point, fully close ourselves | |||||
QApplication.instance().quit() | |||||
# ------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------ | ||||
# Canvas callback | # Canvas callback | ||||