Skip to content

Commit

Permalink
Hide logo settings on the GUI if the device does not have the logo fe…
Browse files Browse the repository at this point in the history
…ature
  • Loading branch information
JosuGZ committed Oct 31, 2024
1 parent d28adbb commit 63d2239
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 36 deletions.
68 changes: 34 additions & 34 deletions razer_control_gui/data/devices/laptops.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,140 +4,140 @@
"name": "Blade 15 2016",
"vid": "1532",
"pid": "0224",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade 2018 15 advanced",
"vid": "1532",
"pid": "0233",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade 2018 15 base",
"vid": "1532",
"pid": "023B",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade 2018 15 Mercury edition",
"vid": "1532",
"pid": "0240",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade 2019 15 base",
"vid": "1532",
"pid": "0246",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade 2019 15 advanced",
"vid": "1532",
"pid": "023A",
"features": ["creator_mode"],
"features": ["logo", "creator_mode"],
"fan": [3500, 5300]
},
{
"name": "Blade 2019 15 Mercury edition",
"vid": "1532",
"pid": "0245",
"features": ["creator_mode"],
"features": ["logo", "creator_mode"],
"fan": [3500, 5300]
},
{
"name": "Blade 2020 15 base",
"vid": "1532",
"pid": "0255",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade 2020 15 advanced",
"vid": "1532",
"pid": "0253",
"features": ["creator_mode", "boost"],
"features": ["logo", "creator_mode", "boost"],
"fan": [3500, 5300]
},
{
"name": "Blade 2017 stealth",
"vid": "1532",
"pid": "022D",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "late Blade 2017 stealth",
"vid": "1532",
"pid": "0232",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade 2019 stealth",
"vid": "1532",
"pid": "0239",
"features": [],
"features": ["logo"],
"fan": [3500, 5300]
},
{
"name": "Blade 2019 stealth (With GTX)",
"vid": "1532",
"pid": "024A",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade 2020 stealth",
"vid": "1532",
"pid": "0252",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade 2020 pro",
"vid": "1532",
"pid": "0256",
"features": [],
"features": ["logo"],
"fan": [3500, 5300]
},
{
"name": "Blade 2019 pro",
"vid": "1532",
"pid": "0234",
"features": [],
"features": ["logo"],
"fan": [3500, 5300]
},
{
"name": "Blade 2018 pro FHD",
"vid": "1532",
"pid": "022F",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade 2017 pro",
"vid": "1532",
"pid": "0225",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade 2017 pro",
"vid": "1532",
"pid": "0210",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade QHD",
"vid": "1532",
"pid": "020F",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
Expand All @@ -151,98 +151,98 @@
"name": "Blade 2021 15 base",
"vid": "1532",
"pid": "026F",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade 14 2021",
"vid": "1532",
"pid": "0270",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade 2021 15 advanced",
"vid": "1532",
"pid": "0276",
"features": ["boost"],
"features": ["logo", "boost"],
"fan": [3500, 5000]
},
{
"name": "Blade late 2021 15 advanced",
"vid": "1532",
"pid": "026D",
"features": ["boost"],
"features": ["logo", "boost"],
"fan": [3500, 5000]
},
{
"name": "Blade late 2021 15 base",
"vid": "1532",
"pid": "027A",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade early 2022 15 advanced",
"vid": "1532",
"pid": "028A",
"features": ["boost", "bho"],
"features": ["logo", "boost", "bho"],
"fan": [3500, 5000]
},
{
"name": "Blade 2022 17",
"vid": "1532",
"pid": "028B",
"features": ["boost"],
"features": ["logo", "boost"],
"fan": [3500, 5000]
},
{
"name": "Blade 2022 14",
"vid": "1532",
"pid": "028C",
"features": ["boost", "bho"],
"features": ["logo", "boost", "bho"],
"fan": [3500, 5000]
},
{
"name": "Blade late 2020 stealth",
"vid": "1532",
"pid": "0259",
"features": [],
"features": ["logo"],
"fan": [3500, 5000]
},
{
"name": "Blade late 16",
"vid": "1532",
"pid": "029F",
"features": ["boost", "bho"],
"features": ["logo", "boost", "bho"],
"fan": [2200, 5000]
},
{
"name": "Blade 2023 14",
"vid": "1532",
"pid": "029D",
"features": ["boost", "bho"],
"features": ["logo", "boost", "bho"],
"fan": [2200, 5000]
},
{
"name": "Blade Early 2021 17 pro",
"vid": "1532",
"pid": "026E",
"features": ["boost"],
"features": ["logo", "boost"],
"fan": [2300, 4300]
},
{
"name": "Blade 2024 14",
"vid": "1532",
"pid": "02b6",
"features": ["boost", "bho"],
"features": ["logo", "boost", "bho"],
"fan": [2200, 5000]
},
{
"name": "Blade Mid 2021 17 pro",
"vid": "1532",
"pid": "0279",
"features": ["boost"],
"features": ["logo", "boost"],
"fan": [2300, 4300]
}
]
4 changes: 4 additions & 0 deletions razer_control_gui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ impl SupportedDevice {
self.has_feature("boost")
}

pub fn has_logo(&self) -> bool {
self.has_feature("logo")
}

}
4 changes: 2 additions & 2 deletions razer_control_gui/src/razer-settings/razer-settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ fn main() {
}

fn make_page(ac: bool, device: SupportedDevice) -> SettingsPage {
let logo = get_logo(ac);
let fan_speed = get_fan_speed(ac).or_crash("Error reading fan speed");
let brightness = get_brightness(ac).or_crash("Error reading brightness");
let power = get_power(ac);
Expand All @@ -373,7 +372,8 @@ fn make_page(ac: bool, device: SupportedDevice) -> SettingsPage {
let settings_page = SettingsPage::new();

// Logo section
if let Some(logo) = logo {
if device.has_logo() {
let logo = get_logo(ac).or_crash("Error reading logo");
let settings_section = settings_page.add_section(Some("Logo"));
let label = Label::new(Some("Turn on logo"));
let logo_options = ComboBoxText::new();
Expand Down

0 comments on commit 63d2239

Please sign in to comment.