-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initializes Slint gui #1084
base: main
Are you sure you want to change the base?
Initializes Slint gui #1084
Conversation
Require #1083 to merge first. |
You need to change |
#238 should be able to close by this PR. |
Seems like this PR is going too big. My idea is just pushing only the GUI without functionality first. |
gui/build.rs
Outdated
fn build_bin() { | ||
// Compile installer | ||
slint_build::compile_with_config( | ||
"slint/installer.slint", | ||
CompilerConfiguration::new().with_style(String::from("fluent-dark")), | ||
) | ||
.unwrap(); | ||
|
||
// Compile main | ||
slint_build::compile_with_config( | ||
"slint/main.slint", | ||
CompilerConfiguration::new().with_style(String::from("fluent-dark")), | ||
) | ||
.unwrap(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use a wildcard here? Also I think it is better to rename the folder to the other name (e.g. ui
) so we don't need to use ::slint
to reference the Slint crate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed the module, but wildcards don't seem possible based on the the code: Maybe with some compile time magic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case we can recursive list all files in the directory.
@@ -8,6 +9,30 @@ const LINUX_INCLUDE: &str = r#" | |||
"#; | |||
|
|||
fn main() { | |||
if std::env::var("CARGO_FEATURE_GUI_SLINT").is_ok() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a better way than this. Feature flag should be used to enable additional code instead of using like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, but AFAIK:
- there can be only one build script per crate.
- There is no way to tell if we are compiling the library or the binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you try CARGO_BIN_NAME
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh 😶
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried CARGO_BIN_PATH, but it's not set :(.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Slint support including those files in Rust instead of building it here? Something like `include_slint!("file.slint").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. The only other option is including slint source directly in Rust, there's a macro for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another idea is putting the FFI for Qt behind a feature flag and enabling it from CMake and treating both features as an addition here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did that, take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean we should not treat features flags as switches here. Feature flags should be used to enable additional code instead of turning it off.
No description provided.