Implement singleton pattern for CIToolRepository #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement Singleton Pattern for CIToolRepository
This PR implements a singleton pattern for
CIToolRepositoryin the Qt5 MIDI-CI tool application, following the same pattern used in ktmidi-ci-tool'sAppModel, and ensures proper initialization of MIDI and CI device managers like the CLI tool does.Changes Made
1. Created Singleton Accessor Pattern
AppModel.hpp: Defines singleton interface withinitializeAppModel(),shutdownAppModel(), andgetAppModel()functionsAppModel.cpp: Implements singleton pattern with global static instance, matching ktmidi-ci-tool's approach2. Moved Initialization to Application Startup
main.cpp:initializeAppModel()before creating MainWindowshutdownAppModel()on application exit3. Updated MainWindow and Widgets
CIToolRepositorymember fromMainWindowclassgetAppModel()4. Proper Manager Initialization
initialize()calls for MIDI and CI device managersshutdown()calls for cleanupci-tool/src/main.cppImplementation Details
The singleton pattern exactly matches ktmidi-ci-tool's
AppModel:Model/View Separation
This change achieves proper model/view separation:
CIToolRepositoryinstance accessible globallyTesting Notes
Local Testing Requirements:
sudo apt install qtbase5-devorsudo apt install qt6-base-devVerification Completed:
Link to Devin run
https://app.devin.ai/sessions/9bbf661e3f7b426cac063e3bf71c9e4c
Requested by: Atsushi Eno (atsushieno@gmail.com)