Skip to content

fix: dash-qt path autodetection fails#409

Merged
pauldelucia merged 3 commits into
v1.0-devfrom
fix/which-dash-qt
Jul 17, 2025
Merged

fix: dash-qt path autodetection fails#409
pauldelucia merged 3 commits into
v1.0-devfrom
fix/which-dash-qt

Conversation

@lklimek
Copy link
Copy Markdown
Contributor

@lklimek lklimek commented Jul 16, 2025

Issue

dash-qt path is not correctly autodetected

Solution

Refactored settings handling to make it easier to manage dash-qt path (and others).

Details

This pull request refactors the handling of application settings by introducing a new Settings struct and centralizing its usage across the codebase. The changes simplify the code, improve readability, and enhance maintainability by replacing complex tuple-based settings with a structured approach. Additionally, redundant code for detecting the Dash-Qt binary path has been consolidated into the Settings struct.

Refactoring and centralization of settings:

  • Introduced a new Settings struct in src/model/settings.rs to encapsulate application settings, replacing tuple-based settings. Includes methods for creating, converting, and defaulting settings, along with logic for Dash-Qt path detection.
  • Updated AppContext::get_settings in src/context.rs to return the new Settings struct instead of a tuple, simplifying database operations.
  • Replaced tuple-based settings logic with structured Settings usage in AppState initialization in src/app.rs. This includes extracting individual settings like password_info, theme_mode, and dash_qt_path directly from the Settings struct. [1] [2]

Removal of redundant code:

  • Removed the standalone detect_dash_qt_path function from src/app.rs and integrated its functionality into the Settings struct. This consolidates Dash-Qt path detection logic and eliminates duplication.

Updates to UI components:

  • Refactored the logic in various UI components (dpns_subscreen_chooser_panel, tokens_subscreen_chooser_panel, tools_subscreen_chooser_panel) to use Settings::root_screen_type instead of accessing tuple indices. [1] [2] [3]
  • Enhanced NetworkChooserScreen in src/ui/network_chooser_screen.rs to utilize Settings for theme preference and Dash-Qt path, and added validation for Dash-Qt binary path before enabling the "Start" button. [1] [2] [3] [4]

These changes improve the codebase's clarity and modularity, making it easier to maintain and extend in the future.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 16, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@lklimek lklimek requested a review from Copilot July 16, 2025 10:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR centralizes application settings by introducing a Settings struct, consolidates Dash-Qt path autodetection into that struct, and updates UI components to use the new structured settings API.

  • Introduced Settings in src/model/settings.rs with built-in Dash-Qt path detection.
  • Changed AppContext::get_settings and application initialization to return and consume Settings instead of raw tuples.
  • Updated UI modules (network_chooser_screen, subscreen chooser panels) to reference Settings properties and added validation for the Start button.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/model/settings.rs Added Settings struct, removed standalone detect_dash_qt_path.
src/context.rs Changed get_settings to return Option<Settings>.
src/app.rs Refactored AppState initialization to use Settings, removed dead code.
src/ui/network_chooser_screen.rs Loaded theme and Dash-Qt path from Settings, replaced tuple logic, added Start button validation.
src/ui/components/tools_subscreen_chooser_panel.rs Switched from tuple index to settings.root_screen_type.
src/ui/components/tokens_subscreen_chooser_panel.rs Switched from tuple index to settings.root_screen_type.
src/ui/components/dpns_subscreen_chooser_panel.rs Switched from tuple index to settings.root_screen_type.
src/model/mod.rs Registered the new settings module.
Comments suppressed due to low confidence (5)

src/model/settings.rs:13

  • The comment refers to an "Empty string," but the field is Option<PathBuf>. Update it to explain that Some(PathBuf::new()) (an empty PathBuf) disables autodetection.
    /// Path to the Dash-Qt binary, if set. None means autodetect. Empty string means no path set and no autodetect.

src/context.rs:487

  • The tuple element is destructured into developer_mode but represents overwrite_dash_conf from the database. Rename this variable to overwrite_dash_conf for clarity.
            dash_qt_path,

src/ui/network_chooser_screen.rs:585

  • [nitpick] Consider rephrasing and capitalizing consistently, e.g., "Please configure the Dash-Qt binary path in Advanced Settings." for clarity.
                        "Please select path to dash-qt binary in Advanced Settings",

src/ui/network_chooser_screen.rs:574

  • Add unit tests to cover the start_enabled logic (empty path vs valid file) to ensure the button enabling behaves as expected.
        let start_enabled = if let Some(path) = self.custom_dash_qt_path.as_ref() {

src/ui/network_chooser_screen.rs:16

  • The imported NixPath isn't used anywhere in this file. Consider removing this import to keep the code clean.
use nix::NixPath;

Comment thread src/model/settings.rs
@pauldelucia pauldelucia merged commit 3265227 into v1.0-dev Jul 17, 2025
3 checks passed
@pauldelucia pauldelucia deleted the fix/which-dash-qt branch July 17, 2025 04:10
pauldelucia added a commit that referenced this pull request Oct 27, 2025
* fix: top up with qr code wasnt working (#410)

* fix: top up with qr code wasnt working

* fmt and clippy

* coderabbit

* fix: dash-qt path autodetection fails (#409)

* fix: dash-qt path not detected correctly

* fix: correct handling of dash-qt path clear button

* chore: copilot review

* fix: change of wallet on top up does not update the address (#414)

* build(deps): upgrade build dependencies (egui 0.32.0, rusqlite 0.37, and others) (#406)

* build(deps): update all rust dependencies

* chore: replace depreacated ui.close_menu()

* chore: upgrade Popup in identities screen

* fix: actions menu items width too low

* chore: all warnings fixed

* chore: close identity actions on click outside

---------

Co-authored-by: pauldelucia <pauldelucia2@gmail.com>

* refactor: unified identity selector (#408)

* refactor: unified identity selection

* feat: identity selector implementation on multiple screens

* feat: add label to IdentitySelector

* chore: I think final

* Update src/ui/components/identity_selector.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: settings are read from db 20 times a second (#420)

* feat: wallet unlock on wallet screen (#415)

* refactor: Amount type and AmountInput component (#417)

* feat: amount input, first building version

* test(amount): fixed tests

* chore: I think final

* chore: my_tokens display correct amount

* chore: transfer tokens update

* chore: hide unit on rewards estimate column

* chore: two new helper methods

* chore: I think finals

* cargo fmt

* feat: component trait

* impl Component for AmountInput

* chore: updated component trait

* chore: update for egui enabled state mgmt

* doc: component design pattern doc

* chore: component design pattern continued

* chore: amount improvements

* chore: copilot review

* chore: amount improvements

* backport: amount component from

* chore: fix imports

* chore: refactor

* chore: futher refactor

* chore: further refactor based on feedback

* doc: simplified component design pattern description

* chore: peer review

* doc: update docs

* chore: amount input

* test: run tests using github actions and fix failing tests (#422)

* fix: failing tests

* gha: run tests

* fix: tests fail due to lack of .env file

* fix: incorrect decimals handling on token create, mint and burn screens (#419)

* feat: amount input, first building version

* test(amount): fixed tests

* chore: I think final

* chore: my_tokens display correct amount

* chore: transfer tokens update

* chore: hide unit on rewards estimate column

* chore: two new helper methods

* chore: I think finals

* cargo fmt

* feat: component trait

* impl Component for AmountInput

* chore: updated component trait

* chore: update for egui enabled state mgmt

* doc: component design pattern doc

* chore: component design pattern continued

* chore: amount improvements

* chore: copilot review

* chore: amount improvements

* refactor: mint and burn token screens use AmountInput

* chore: use AmountInput on token creator screen

* fix: burn error handling

* feat: errors displayed in the AmountInput component

* fix: vertical align of amount input

* backport: amount component from

* chore: fix imports

* chore: refactor

* chore: futher refactor

* chore: further refactor based on feedback

* doc: simplified component design pattern description

* chore: peer review

* doc: update docs

* chore: amount input

* chore: fixes after merge

* chore: self-review

* feat: amout set decimal places + rename label => with_label

* refactor: amount input init on token screen

* chore: fix token creator layout

* chore: format base amount with leading zeros in confirmation

* chore: base supply 0 by default

* feat: add network field to identity structures (#423)

* feat: add network field to identity structures

* fix

* feat: add display for private key in both WIF and Hex formats (#424)

* feat: add display for private key in both WIF and Hex formats

* fix: display private keys as normal text and depend on color theme

---------

Co-authored-by: pauldelucia <pauldelucia2@gmail.com>

* feat: allow setting zmq uri in .env (#425)

* feat: allow setting ZMQ URI

* chore: rename zmq_endpoint to core_zmq_endpoint

* fix: failing test in token screen needed update

* fix: update CI to use rust version 1.88 to match rust-toolchain

* feat: better display in key selector (#429)

* refactor: unified confirmation dialog (#413)

* refactor: unified alert window

* chore: update CLAUDE to create reusable components whenever appropriate

* feat: correct confirm dialog on set token price screen

* chore: remove callbacks which are overkill

* chore: cargo fmt

* chore: doctest fix

* chore: impl Component for ConfirmationDialog

* chore: use WidgetText

* feat: Add Escape key handling for confirmation dialog

* chore: button inactive when in progress

* chore: fixes after merge

* chore: some theme improvements

* fmt and visual appeal

---------

Co-authored-by: pauldelucia <pauldelucia2@gmail.com>

* feat: nicer contract chooser panel (#426)

* feat: nicer contract chooser panel

* fmt

* clippy

* fix: token purchasability was not refreshing unless app restart (#432)

* fix: token action buttons alignment

* feat: nicer expanding tabs in token creator (#431)

* feat: nicer expanding tabs in token creator

* fix

* feat: implement new ConfirmationDialog component throughout app (#430)

* feat: implement new ConfirmationDialog component throughout app

* fix: remove backup files

* fix: confirmation dialog on withdrawal screen always showing "loading"

* feat: Dash Masternode List and Quorum Viewer (#428)

* a lot of work on DML viewer

* more work

* more work

* more work

* more work

* more work

* more work

* more work

* more work

* ui improvements

* ui improvements

* optimizations

* fast start

* more work

* more work

* more work

* fmt

* much more work

* fixes

* updates

* fix

* fmt

* revert

* update for dashcore 40

* params for testnet

* added testnet diff

* fixes

* clippy

* more clippy

* fixes

* clean UI

* use backend tasks

* backend messages

* coderabbit suggestions to add timeouts and prevent infinite loops

* transient and fatal errors

* update dash core configs for testnet

* fmt

* fix timeout

* fix h-3 error

* clear state when switching networks

---------

Co-authored-by: pauldelucia <pauldelucia2@gmail.com>

* chore: bump version to 1.0.0-dev (#439)

The 1.0-dev branch builds were still reporting as 0.9.0

* feat: add left panel button labels and create contract subscreen chooser panel (#441)

* feat: add left panel button labels and create contract subscreen chooser panel

* fmt

* feat: clarify identity index description for identity creation

* fix: screen button labels display hard to see in dark mode

* feat: left panel scroll (#443)

* feat: left panel scroll

* clippy

* feat: add existing identity by wallet + identity index (#444)

* feat: add existing identity by wallet + identity index

* fmt

* remove logging

* update derivation index label

* add robustness

* fix: screen button labels display hard to see in dark mode

* feat: left panel scroll (#443)

* feat: left panel scroll

* clippy

* feat: load all identities up to an index

* clippy

* fix

* feat: remove wallet (#445)

* feat: remove wallet

* clippy

* Clarify wallet removal warning message

Updated warning message for wallet removal to clarify that keys will no longer work unless the wallet is re-imported.

* fix: identity creation and top-up via QR code handling (#447)

* fix: identity creation handling

* cleanup

* cleanup

* fix identity topup too

* remove note

* fix: keyword search required new platform version plus error handling and UI updates (#449)

* fix: keyword search not displaying errors

* update platform version and keyword search cleanup

* fix

* fix: handle decimals and fix schedules on price and purchase screens (#412)

* fix: inactive button on set price group action

* chore: apply review feedback

* refactor: use token amount input

* chore: update AmountInput

* chore: tiered pricing

* chore: direct purchase

* chore: remove total agreed price

* chore: max amount input defaults to max_credits

* fmt

* fix

* clippy

---------

Co-authored-by: pauldelucia <pauldelucia2@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>

* fix: showing used asset locks as unused (#448)

* chore: remove unused task sender

* chore: update to Platform V10

* feat: GroveSTARK ZK proofs (#450)

* works

* works

* fix

* ok

* ok

* ok

* ok

* ok

* fix verification message showing in generation screen

* remove advanced settings. set default 16 grinding bits and 128 bit security

* ok

* lock

* ok

* clippy

* fmt

* clippy and fmt

* pin grovestark dep

* fix

* ok

* clippy

* rename file

* remove ProofData

* cleanup

* fix

* rename GroveStark to GroveSTARK

* rename zk_proofs_screen to grovestark_screen

* rename ZKProofs tool subscreen to GroveSTARK

* move grovestark prover to model

* rename ContractsDashpayComingSoon to ContractsDashpay

* rename ContractsDashpay to Dashpay

* rename dashpay stuff

* fixes

* ok

* update grovestark rev

* update

* chore: update grovestark rev

* chore: bump version

* update platform rev

* clippy

* fix

* fix

* fix release

* fix release

* fix release

---------

Co-authored-by: lklimek <842586+lklimek@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: QuantumExplorer <quantum@dash.org>
Co-authored-by: thephez <thephez@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants