Decoupling UI and program
Reason
- To increase extensibility, users can import other player's gui files.
- To reduce code redundancy.
Result
Move all ui control code to res/ui/ directory, so that other player's gui files can be imported to extend the functionality.
Make the source code a code library, and modify the operation through the name component attribute.
Format
The .gui file is in json format, like:
{
"name": "layout",
"value": {
"direction": "h",
"content": [
{
"name": "button",
"value": {
"type": "QPushButton",
"args": ["hello"],
"style": "selected",
"init_steps": { "setFixedHeight": [30], "setFixedWidth": [100] }
}
},
{
"name": "label",
"value": {
"type": "QLabel",
"args": ["world"],
"style": "big_text_16",
"init_steps": { "setFixedHeight": [30], "setFixedWidth": [100] }
}
}
]
}
}
Note: We abandoned the
jsonformat and switched touiml
.gui files use uiml, a highly extensible Qt UI language we developed ourselves, similar to:
<layout name='central_layout' direction='v'>
<QLabel name='left_clicked' args=['!lang 0d'] />
<QLabel name='right_clicked' args=['!lang 0e'] />
<QLabel name='paused' args=['!lang 71'] />
<QLabel name='stopped' args=['!lang 73'] />
<QLabel name='click_delay' args=['!lang 78'] />
<QLabel name='click_times' args=['!lang 5c'] />
<QLabel name='total_run_time' args=['!lang 2c'] />
<layout name='bottom_layout' direction='h' stretch='true' stretch_place='start'>
<QPushButton name='ok_button' args=['!lang 1e'] style='selected' signals={'clicked': self.close} />
</layout>
</layout>Enable method
Minimum required clickmouse version
Clickmouse beta, >=3.3.0.23alpha5