jamulussoftware / jamulussoftware/jamulus
Manage settings with structs
- Ngôn ngữ chính
- C
- Star
- 1.1k
- Fork
- 248
- Merge trung bình
- 2 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 9
Mô tả
(Yes, I'm still trying to sort this out...)
My mind's eye view is that the server has a set of settings: SServerSettings. This is _everything_ the server needs to know.
On start up, the structure is created (in main.cpp, defined in server.h).
Then, if GUI-enabled, CSettings populates it with values from the inifile - hence CSettings doesn't get passed a server instance any more - the server doesn't yet exist.
Next, all the values collected from the command line overwrite the appropriate entry in the settings structure.
And then finally, CServer gets instantiated with the SServerSettings instance reference.
To change a server setting, you call the server as you do now and it records that value in SServerSettings&.
When the server terminates, if GUI-enabled, CSettings is passed the SServerSettings reference to store to the inifile.
----
It's actually a fairly straight forward change in the server. The only concern I have when it comes to the client code... it isn't anywhere near as simple a model. Much of what's in the inifile isn't even for the client. So I'd keep the SClientSettings struct "unpolluted", free of GUI settings, perhaps having a separate SClientGUISettings for those.
----
One benefit is dropping all that code I added checking for command line options to prevent the inifile being used. The logic above handles that without any effort.
It could also help make it clear on what will persist to the inifile -- if it's not in one of the structs, it's not getting saved.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách lần theo luồng khởi động trong main.cpp và định nghĩa thiết lập máy chủ trong server.h, sau đó kiểm tra cách CSettings, CServer và các thiết lập của client hiện đang trao đổi giá trị. Việc triển khai các cấu trúc thiết lập được đề xuất sẽ giúp các giá trị dòng lệnh ghi đè các giá trị cấu hình và giữ nguyên các thiết lập dự kiến khi tắt, đồng thời giữ riêng các thiết lập GUI của client.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- cpp
- Lĩnh vực
- backend, desktop
- Loại issue
- Tái cấu trúc
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100