# Proposals [TOC] ## Application Architecture Ideally in a QML application there should be no dependencies between files, that said, a single QML file should be runnable with qmlscene. Also it should be possible to switch backends, enabling this way for example to run the application with both a simulation backend and the real one. As most UI changes do not need the backend or to be built in order to see a change in QML it would be faster and more productive to be able to work with multiple backends speeding up the development. #### The Neptune 3 UI [Neptune 3 UI](https://doc-snapshots.qt.io/neptune3ui/neptune3ui-overview.html) is the reference UI of the [Qt Automotive Suite](https://doc-snapshots.qt.io/qtautomotivesuite/) and implements the [Core UI Architecture](https://doc-snapshots.qt.io/neptune3ui/neptune3ui-application-architecture.html) which could be adapted in order to have a clean, scalable and maintainable code base and structure in Status Desktop app. The idea is to separate the logic from the visual components having it in seperate QML files and then seperate the visual components to the ones that can have access to the logic and the ones that are only suppose to display the data or take care of a user interaction (e.g. a Button) so they do not really need to access the backend. #### UI Structure The Core UI Architecture is based on the MVC pattern, meaning that we have the **Model** that contains the application logic and accesses the backend, the **View** that contains visual parts of our app and are the only ones that can access the data for reading and writting consisting of a combination of panels, and the **Panels** that are smaller parts of the UI, have no access to the data and are mainly components like Buttons or a series of Buttons that create a controls panel for example. #### Proposal All logic should be separated from the UI and isolated and maintained in model files. UI components should be separated in views and panels. Duplicated code should be removed, either by creating re-usable components or by moving it, if it's logic, in model files. For example Chat section could be structured as follows: ``` Chat/ views/ ChatMessagesView.qml Emtpyview.qml ClosedEmtpyview.qml ... panels/ AcceptRejectOptionsButtonsPanel.qml ContactPanel.qml ... models/ EmojiReactions.qml channelList.js ... popups/ ContactRequestsPopup.qml CommunitiesPopup.qml ... controls/ CommunityPopupButton.qml ... MainLayout.qml ``` In views will reside all components that will make use of the backend (importing models). In panels would be just visual components consisting of various controls and in models we'll have all data together with all files that will store the logic. #### QtQuickControls 2 (tbd)