<plugin id="tuto10_launch_basic_config">
    <requirement id="sight::module::ui" />
    <requirement id="sight::module::ui::qt" />
    <requirement id="sight::module::service" />

    <!-- Allows to include a xml file containing a sub-configuration -->
    <xi:include href="basic_frame_config.xml" xmlns:xi="http://www.w3.org/2003/XInclude" />

    <extension implements="sight::app::extension::config">
        <id>Tuto10LaunchBasicConfig_AppCfg</id>
        <config>
            <!-- ******************************* Objects declaration ****************************** -->

            <object uid="image" type="sight::data::image" />

            <!-- ******************************* UI declaration *********************************** -->

            <service uid="mainFrame" type="sight::module::ui::frame">
                <gui>
                    <frame>
                        <name>tuto10_launch_basic_config</name>
                        <icon>tuto10_launch_basic_config/tuto.ico</icon>
                        <minSize width="800" height="600" />
                    </frame>
                    <menubar />
                </gui>
                <registry>
                    <menubar sid="menuBarView" start="true" />
                    <view sid="imageRendereSrv" start="true" />
                </registry>
            </service>

            <service uid="menuBarView" type="sight::module::ui::menubar">
                <gui>
                    <layout>
                        <menu name="File" />
                    </layout>
                </gui>
                <registry>
                    <menu sid="menuFileView" start="true" />
                </registry>
            </service>

            <service uid="menuFileView" type="sight::module::ui::menu">
                <gui>
                    <layout>
                        <menuItem name="Open image" shortcut="Ctrl+O" />
                        <separator />
                        <menuItem name="Launch config" style="check" shortcut="Ctrl+L" />
                        <separator />
                        <menuItem name="Quit" specialAction="QUIT" shortcut="Ctrl+Q" />
                    </layout>
                </gui>
                <registry>
                    <menuItem sid="openImageAct" start="true" />
                    <menuItem sid="launchConfigAct" start="true" />
                    <menuItem sid="quitAct" start="true" />
                </registry>
            </service>

            <!-- ******************************* Actions ****************************************** -->

            <service uid="openImageAct" type="sight::module::ui::action" />

            <service uid="quitAct" type="sight::module::ui::quit" />

            <!-- ************************ Configuration launchers ********************************* -->

            <!--
                Configuration launcher:
                This service allows to launch a sub-configuration.
                The configuration is defined by its id.
            -->
            <service uid="launchConfigAct" type="sight::module::ui::config_launcher">
                <appConfig id="Tuto10LaunchBasicConfig_BasicFrameConfig_AppCfg" />
                <!--
                    replace ${image} in the sub-config by the uid of the object with the key
                    (ie. ${image} is replaced by "image")
                -->
                <inout group="data">
                    <key name="image" uid="image" />
                </inout>
            </service>

            <!-- ******************************* Services ***************************************** -->

            <service uid="imageReaderSrv" type="sight::module::ui::io::selector">
                <inout key="data" uid="image" />
            </service>

            <service uid="imageRendereSrv" type="sight::module::viz::sample::image">
                <in key="image" uid="image" />
            </service>

            <connect>
                <signal>openImageAct/clicked</signal>
                <slot>imageReaderSrv/update</slot>
            </connect>

            <!-- ******************************* Start services ***************************************** -->

            <start uid="mainFrame" />
            <start uid="imageReaderSrv" />
        </config>
    </extension>
</plugin>
