Skip to content

Commit

Permalink
Window title is now set from the configuration
Browse files Browse the repository at this point in the history
Update CHANGELOG
  • Loading branch information
L1nkZ committed May 7, 2021
1 parent 39eb0be commit 429a1fd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# Changelog

## [Unreleased]

## [0.3.0] - 2021-05-07
### Added
- Add a new `manual_patch` binding for allowing users to apply manual patches
- Add a `window.title` field in the configuration that sets the window's title

### Changed
- Serialize cache file as JSON
- Startup errors are displayed with native message boxes
- Use structopt instead of clap for CLI parsing
- Switch to tokio's single-threaded runtime
- Multiple patch servers can be specified in the configuration file.
A new `patch_servers` list field replace the `plist_url` and `patch_url`
fields in the configuration. A new optional `preferred_patch_server` has also
A new `web.patch_servers` list field replace the `web.plist_url` and `web.patch_url`
fields in the configuration. A new optional `web.preferred_patch_server` has also
been added.

### Fixed
Expand Down
1 change: 1 addition & 0 deletions examples/rpatchur.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Configure the patcher's window
window:
title: RPatchur # Title of the main window
width: 780 # Width of the main window (in pixels)
height: 580 # Height of the main window (in pixels)
resizable: false # Make the main window resizable
Expand Down
9 changes: 6 additions & 3 deletions rpatchur/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const PKG_NAME: &str = env!("CARGO_PKG_NAME");
const PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
const PKG_AUTHORS: &str = env!("CARGO_PKG_AUTHORS");
const PKG_DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION");
const WINDOW_TITLE: &str = "RPatchur";

#[derive(Debug, StructOpt)]
#[structopt(name = PKG_NAME, version = PKG_VERSION, author = PKG_AUTHORS, about = PKG_DESCRIPTION)]
Expand Down Expand Up @@ -62,8 +61,12 @@ fn main() -> Result<()> {

// Create a channel to allow the webview's thread to communicate with the patching thread
let (tx, rx) = flume::bounded(32);
let webview = ui::build_webview(WINDOW_TITLE, WebViewUserData::new(config.clone(), tx))
.with_context(|| "Failed to build a web view")?;
let window_title = config.window.title.clone();
let webview = ui::build_webview(
window_title.as_str(),
WebViewUserData::new(config.clone(), tx),
)
.with_context(|| "Failed to build a web view")?;

// Spawn a patching thread
let patching_thread = new_patching_thread(rx, UiController::new(&webview), config);
Expand Down
1 change: 1 addition & 0 deletions rpatchur/src/patcher/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct PatcherConfiguration {

#[derive(Deserialize, Clone)]
pub struct WindowConfiguration {
pub title: String,
pub width: i32,
pub height: i32,
pub resizable: bool,
Expand Down
8 changes: 4 additions & 4 deletions rpatchur/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ impl Drop for WebViewUserData {
}

/// Creates a `WebView` object with the appropriate settings for our needs.
pub fn build_webview(
window_title: &'_ str,
pub fn build_webview<'a>(
title: &'a str,
user_data: WebViewUserData,
) -> web_view::WVResult<WebView<'_, WebViewUserData>> {
) -> web_view::WVResult<WebView<'a, WebViewUserData>> {
web_view::builder()
.title(window_title)
.title(title)
.content(Content::Url(user_data.patcher_config.web.index_url.clone()))
.size(
user_data.patcher_config.window.width,
Expand Down

0 comments on commit 429a1fd

Please sign in to comment.