aboutsummaryrefslogtreecommitdiff
path: root/src/qt/optionsmodel.cpp
AgeCommit message (Collapse)Author
2022-05-26Reset settings.json when GUI options are resetRyan Ofsky
Clear settings.json file and save settings.json.bak file when "Reset Options" GUI button is pressed or -resetguisettings command line option is used.
2022-05-26Migrate -lang setting from QSettings to settings.jsonRyan Ofsky
2022-05-26Migrate -prune setting from QSettings to settings.jsonRyan Ofsky
2022-05-26Migrate -proxy and -onion settings from QSettings to settings.jsonRyan Ofsky
2022-05-26Migrate -listen and -server settings from QSettings to settings.jsonRyan Ofsky
2022-05-26Migrate -upnp and -natpmp settings from QSettings to settings.jsonRyan Ofsky
This also effectively reverts 58e8364dcdc4e57b0caac09f8402e6535301de9b from #18077, applying upnp and natpmp settings from the optionsmodel class instead of the optionsdialog class. This makes sense because model code, not view code is responsible for applying all other settings, and because leaving these settings half-applied in optionsmodel seems error prone and could lead to bugs. (These things were discussed a little in https://github.com/bitcoin/bitcoin/pull/18077#discussion_r560381734)
2022-05-26Migrate -spendzeroconfchange and -signer settings from QSettings to ↵Ryan Ofsky
settings.json
2022-05-26Migrate -par setting from QSettings to settings.jsonRyan Ofsky
2022-05-26Migrate -dbcache setting from QSettings to settings.jsonRyan Ofsky
This is just the first of multiple settings that will be stored in the bitcoin persistent setting file and shared with bitcoind, instead of being stored as Qt settings backed by the windows registry or platform specific config files which are ignored by bitcoind. Co-Authored-By: furszy <matiasfurszyfer@protonmail.com>
2022-05-24Merge bitcoin-core/gui#601: refactor: Pass interfaces::Node references to ↵Hennadii Stepanov
OptionsModel constructor 31122aa979c4c9a40e276cfc44243420c367ba4f refactor: Pass interfaces::Node references to OptionsModel constructor (Ryan Ofsky) Pull request description: Giving OptionsModel access to the node interface is needed as part of #602 to get bitcoind and bitcoin-qt to use the same settings instead of different settings. It has been split off from #602 to simplify that PR. Previously these commits were part of bitcoin/bitcoin#15936 and also had some review discussion there. ACKs for top commit: promag: Code review ACK 31122aa979c4c9a40e276cfc44243420c367ba4f. furszy: Code ACK 31122aa9 jarolrod: ACK 31122aa979c4c9a40e276cfc44243420c367ba4f Tree-SHA512: b8529322fd7ba97e19864129e6cf5f9acc58c124f2e5a7c50aca15772c8549de3c24e8b0c27e8cf2c06fd26529e9cdb898b0788a1de3cbfdfbdd3f85c9f0fe69
2022-05-19refactor: Pass interfaces::Node references to OptionsModel constructorRyan Ofsky
Will allow OptionsModel to read/write settings to the node settings.json file and share settings with the node, instead of storing them externally in QSettings. Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2022-05-19refactor: Add OptionsModel getOption/setOption methodsRyan Ofsky
Easiest to review ignoring whitespace.
2022-04-15Merge bitcoin-core/gui#556: refactor: Make BitcoinUnits::Unit a scoped enumHennadii Stepanov
0e5dedbc9eb54105ab9b0c4ce1f57afa55bcb5b6 qt/wallettests: sort includes (William Casarin) 0554251d660caa1c3f5f44ae1d9fa3c23d2aac18 qt: Skip displayUnitChanged signal if unit is not actually changed (Hennadii Stepanov) ffbc2fe459034024cb2fce9fd94bff457b7a7d49 qt, refactor: Remove default cases for scoped enum (Hennadii Stepanov) 152d5bad50f145af922011f6ec1fd9afd9076ceb qt, refactor: Remove BitcoinUnits::valid function (Hennadii Stepanov) aa23960fdf1deff321ecea435026c87db78498fb qt, refactor: Make BitcoinUnits::Unit a scoped enum (Hennadii Stepanov) 75832fdc37ea3fe9cf515bd1946e220fe07a440b qt: Use QVariant instead of int for BitcoinUnit in QSettings (Hennadii Stepanov) Pull request description: This is a rebased version of #60 Since Qt 5.5 there are [means](https://doc.qt.io/qt-5/qobject.html#Q_ENUM) to register an enum type with the meta-object system (such enum still lacks an ability to interact with [QSettings::setValue()](https://doc.qt.io/qt-5/qsettings.html#setValue) and [QSettings::value()](https://doc.qt.io/qt-5/qsettings.html#value) without defined stream operators). In order to reduce global namespace polluting and to force strong type checking, this PR makes BitcoinUnits::Unit a scoped enum (typedef BitcoinUnits::Unit BitcoinUnit;). No behavior change. ACKs for top commit: jonatack: ACK 0e5dedbc9eb54105ab9b0c4ce1f57afa55bcb5b6, review and debug build of each commit after rebase on current master, lightly tested running the GUI, changing units a few times, and verifying persistence after restarting promag: Code review ACK 0e5dedbc9eb54105ab9b0c4ce1f57afa55bcb5b6 Tree-SHA512: 39ec0d7e4f0b9b25be287888121a8db6b282339674e37ec3a3554da63a9e22d6fe079e8310ca289b2a0356a19b3c7e55afa17d09dd34e0f222177f603bb053a3
2022-03-31options: add a comment for -listenonion and dedup a long expressionVasil Dimov
A followup to https://github.com/bitcoin-core/gui/pull/568 Co-authored-by: Jon Atack <jon@atack.com>
2022-03-23options: flip listenonion to false if not listeningVasil Dimov
If the user has unchecked "Allow incoming connections" in `Settings->Options...->Network` then `fListen=false` is saved in `~/.config/Bitcoin/Bitcoin-Qt.conf`. This flips `-listen` to `false` during startup, but leaves `-listenonion` to `true`. This flipping of `-listen` is done in `OptionsModel::Init()` after `InitParameterInteraction()` has been executed which would have flipped `-listenonion`, should it have seen `-listen` being `false` (this is a difference between `bitcoind` and `bitcoin-qt`). Fixes: https://github.com/bitcoin-core/gui/issues/567
2022-02-22qt: Skip displayUnitChanged signal if unit is not actually changedHennadii Stepanov
Co-authored-by: João Barbosa <joao.paulo.barbosa@gmail.com>
2022-02-22qt, refactor: Make BitcoinUnits::Unit a scoped enumHennadii Stepanov
2022-02-22qt: Use QVariant instead of int for BitcoinUnit in QSettingsHennadii Stepanov
This change improves type safety.
2022-01-11scripted-diff: Rename functions to drop mention of boostHennadii Stepanov
-BEGIN VERIFY SCRIPT- FILES=$(git ls-files src/qt) sed -i 's/boostPathToQString/PathToQString/g' -- $FILES sed -i 's/qstringToBoostPath/QStringToPath/g' -- $FILES -END VERIFY SCRIPT-
2022-01-09Merge bitcoin-core/gui#441: Add Create Unsigned button to SendConfirmationDialogHennadii Stepanov
742918c8ef353993a07c060f476a160e8272a9ef qt: hide Create Unsigned button behind an expert mode option (Andrew Chow) 5c3b800acd3ceb75ff6bbac8d0e2e1aaa95b0728 qt: Add Create Unsigned button to SendConfirmationDialog (Andrew Chow) Pull request description: Instead of having different buttons or changing button behavior for making a PSBT, just have SendConfirmationDialog return whether the user wants a PSBT or a broadcasted transaction. Since this dialog is used by both the bumpFeeAction and the SendCoinsDialog, changes to both to support the different behavior is needed. They will check the return value of the SendConfirmationDialog for whether a PSBT needs to be created instead of checking whether private keys are disabled. Strings used in this dialog are being slightly modified to work with both private keys enabled and disabled wallets. Moved from https://github.com/bitcoin/bitcoin/pull/18789 ACKs for top commit: jarolrod: ACK 742918c ryanofsky: Code review ACK 742918c8ef353993a07c060f476a160e8272a9ef. Just suggested changes since last review. Looks great! hebasto: ACK 742918c8ef353993a07c060f476a160e8272a9ef, tested on Linux Mint 20.2 (Qt 5.12.8). Tree-SHA512: dd29f4364c7b4f15befe8fe63257b26187918786b005e0f8336183270b1a162680b93f6ced60f0285c6e607c084cc0d24950fc68a8f9c056521ede614041be66
2021-12-30scripted-diff: Bump copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT- Commits of previous years: * 2020: fa0074e2d82928016a43ca408717154a1c70a4db * 2019: aaaaad6ac95b402fe18d019d67897ced6b316ee0
2021-10-08qt: hide Create Unsigned button behind an expert mode optionAndrew Chow
2021-09-16gui: add RPC settingSjors Provoost
2021-08-11qt: Add SubFeeFromAmount optionPrateek Sancheti
2021-05-27gui: add external signer path to options dialogSjors Provoost
2021-05-26Merge bitcoin-core/gui#313: qt: Optimize string concatenation by defaultW. J. van der Laan
a02c970eb001b456d74ddc30750fe8b55348ddac qt, refactor: Revert explicit including QStringBuilder (Hennadii Stepanov) 3fd3a0fc87a81d42755246830124833e9ca3f0a9 qt, build: Optimize string concatenation (Hennadii Stepanov) Pull request description: From [Qt docs](https://doc.qt.io/qt-5/qstring.html#more-efficient-string-construction): > ... multiple uses of the \[`QString`\] '+' operator usually means multiple memory allocations. When concatenating n substrings, where n > 2, there can be as many as n - 1 calls to the memory allocator. With this PR > ... the '+' will automatically be performed as the `QStringBuilder` '%' everywhere. The change in the `src/Makefile.qt.include` file does not justify submitting this PR into the main repo, IMHO. ACKs for top commit: laanwj: Code review ACK a02c970eb001b456d74ddc30750fe8b55348ddac Talkless: utACK a02c970eb001b456d74ddc30750fe8b55348ddac, built successfully on Debian Sid with Qt 5.15.2, but did not check if any displayed strings are "wrong" after refactoring. jarolrod: ACK a02c970eb001b456d74ddc30750fe8b55348ddac Tree-SHA512: cbb476ee96f27c3bd6e125efab74d8bf24bbdb4c30576b3feea45e203405f3bf5b497dd7d3e11361fc825fcbf4b893b152921a9efdeaf73b42d1865d85f0ae84
2021-05-24scripted-diff: Replace `GetDataDir(true)` calls with `gArgs.GetDataDirNet()` ↵Kiminuo
calls -BEGIN VERIFY SCRIPT- git ls-files -- 'src' ':(exclude)src/util/system.h' ':(exclude)src/util/system.cpp' | xargs sed -i 's/GetDataDir(true)/gArgs.GetDataDirNet()/g'; -END VERIFY SCRIPT-
2021-05-15qt, build: Optimize string concatenationHennadii Stepanov
The defined QT_USE_QSTRINGBUILDER macro means using the QStringBuilder for efficient string concatenation in all Qt code by default.
2021-02-21gui: Add monospaced font settingsHennadii Stepanov
2021-01-07net: Add -natpmp command line optionHennadii Stepanov
2021-01-07gui: Apply port mapping changes on dialog exitHennadii Stepanov
This commit does not change behavior. It is a prerequisite for NAT-PMP support adding.
2021-01-07refactor: Move port mapping code to its own moduleHennadii Stepanov
This commit does not change behavior.
2020-12-15Merge bitcoin-core/gui#115: Replace "Hide tray icon" option with positive ↵Jonas Schnelli
"Show tray icon" one 03edb52eee5a87af16161c23bdc6cde91a2e5b8b qt: Remove redundant BitcoinGUI::setTrayIconVisible (Hennadii Stepanov) 17174f8328c44ae84479e8365c122ad8502bd7da gui: Replace "Hide tray icon" option with positive "Show tray icon" one (Hennadii Stepanov) Pull request description: This change makes easier both (1) using this option, and (2) reasoning about the code. ACKs for top commit: jonasschnelli: utACK 03edb52eee5a87af16161c23bdc6cde91a2e5b8b Tree-SHA512: 38e317492210d4fb13302dea383bd1f4f0ae1219d7ff2fdcb78607f15ac61a51969acaadb59b72c3f075b6356ef54368eb46fb49e6e1bd42db6d5804b97e232b
2020-11-15gui: Replace "Hide tray icon" option with positive "Show tray icon" oneHennadii Stepanov
This change makes easier both (1) using this option, and (2) reasoning about the code.
2020-08-26qt, refactor: Fix 'split is deprecated' warningsHennadii Stepanov
2020-08-26gui: Replace interface::Node references with pointersRussell Yanofsky
No change in behavior. Replacing references with pointers allows Node interface creation to be delayed until later during gui startup next commit to support implementing -ipcconnect option
2020-08-26gui: Partially revert #10244 gArgs and Params changesRussell Yanofsky
Change gui code to use gArgs, Params() functions directly instead of going through interfaces::Node. Remotely accessing bitcoin-node ArgsManager from bitcoin-gui works fine in https://github.com/bitcoin/bitcoin/pull/10102, when bitcoin-gui spawns a new bitcoin-node process and controls its startup, but for bitcoin-gui to support -ipcconnect option in https://github.com/bitcoin/bitcoin/pull/19461 and connect to an existing bitcoin-node process, it needs ability to parse arguments itself before connecting out. This change also simplifies https://github.com/bitcoin/bitcoin/pull/10102 a bit, by making the bitcoin-gui -> bitcoin-node startup sequence more similar to the bitcoin-node -> bitcoin-wallet startup sequence where the parent process parses arguments and passes them to the child process instead of the parent process using the child process to parse arguments.
2020-03-14Replace std::to_string with locale-independent alternativeBen Woosley
2020-01-27Merge #17453: gui: Fix intro dialog labels when the prune button is toggledJonas Schnelli
4f7127d1e3a51f0f55d42a08439c516dcc8d1a26 gui: Make Intro consistent with prune checkbox (Hennadii Stepanov) 4824a7d36cf47e766865e0fefe952ec860eb82dd gui: Add Intro::UpdateFreeSpaceLabel() (Hennadii Stepanov) daa3f3fa9071a229275dd6a1b8445237ddc3fa97 refactor: Add Intro::UpdatePruneLabels() (Hennadii Stepanov) e4caa82a03df5c6a6d5d29f34ab006d732c6dac1 refactor: Replace static variable with data member (Hennadii Stepanov) 2bede28cd9ec638d8bb32c187ccf12d89345218e util: Add PruneGBtoMiB() function (Hennadii Stepanov) e35e4b2ba052c9a533626286026dbe0a2d546c5b util: Add PruneMiBtoGB() function (Hennadii Stepanov) Pull request description: On master (a6f6333ba253cda83221ee529810cacf930e413f) and on 0.19.0.1 the intro dialog with prune enabled (checkbox "Discard blocks..." is checked) provides a user with wrong info about the required disk space: ![DeepinScreenshot_bitcoin-qt_20191208112228](https://user-images.githubusercontent.com/32963518/70387510-8daab400-19ae-11ea-9338-29add9c31118.png) Also the paragraph "If you have chosen to limit..." is missed. --- With this PR when prune checkbox is toggled, the related text labels and the amount of required space shown are updated (previously they were only updated when the data directory was updated): ![Screenshot from 2019-12-08 11-34-53](https://user-images.githubusercontent.com/32963518/70387542-eed28780-19ae-11ea-9565-49d8a64b2f33.png) --- This PR is an alternative to #17035. **ryanofsky**'s [suggestion](https://github.com/bitcoin/bitcoin/pull/17035#discussion_r337594268) also has been implemented. ACKs for top commit: emilengler: ACK 4f7127d1e3a51f0f55d42a08439c516dcc8d1a26 Sjors: tACK 4f7127d1e3a51f0f55d42a08439c516dcc8d1a26 ryanofsky: Code review ACK 4f7127d1e3a51f0f55d42a08439c516dcc8d1a26. It seems like there are a few visible changes here: jonasschnelli: utACK 4f7127d1e3a51f0f55d42a08439c516dcc8d1a26 Tree-SHA512: fa0bbdcfafde97d7906cda066cbd4608b936a71cae1b4cda3ee3aa2eed3a9795f279f14c6b1b4997278e094db891c7d3bb695368ba0882347aa42165a86e5172
2020-01-15scripted-diff: Bump copyright of files changed in 2020MarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2020-01-08util: Add PruneGBtoMiB() functionHennadii Stepanov
This commit does not change behavior.
2020-01-08Merge #17696: qt: Force set nPruneSize in QSettings after the intro dialogfanquake
af112ab62895b145660f4cd7ff842e9cfea2a530 qt: Rename SetPrune() to InitializePruneSetting() (Hennadii Stepanov) b0bfbe50282877a1eee87118902901a280d6656d refactor: Drop `bool force' parameter (Hennadii Stepanov) 68c9bbe9bc91f882404556998666b1b5acea60e4 qt: Force set nPruneSize in QSettings after intro (Hennadii Stepanov) a82bd8fa5708c16d1db3edc4e82d70788eb5af19 util: Replace magics with DEFAULT_PRUNE_TARGET_GB (Hennadii Stepanov) Pull request description: On master (5622d8f3156a293e61d0964c33d4b21d8c9fd5e0), having `QSettings` set already ``` $ grep nPruneSize ~/.config/Bitcoin/Bitcoin-Qt-testnet.conf nPruneSize=6 ``` enabling prune option in the intro dialog ``` $ ./src/qt/bitcoin-qt -choosedatadir -testnet ``` ![DeepinScreenshot_select-area_20191208120425](https://user-images.githubusercontent.com/32963518/70388183-eed68580-19b6-11ea-9aa1-f9ad9aaa68a6.png) has no effect: ``` $ grep Prune ~/.bitcoin/testnet3/debug.log 2019-12-08T10:04:41Z Prune configured to target 5722 MiB on disk for block and undo files. ``` --- With this PR: ``` $ grep Prune ~/.bitcoin/testnet3/debug.log 2019-12-08T10:20:35Z Prune configured to target 1907 MiB on disk for block and undo files. ``` This PR has been split of #17453 (the first two commits) as it fixes an orthogonal bug. Refs: - https://github.com/bitcoin/bitcoin/pull/17453#discussion_r345424240 - https://github.com/bitcoin/bitcoin/pull/17453#discussion_r350960201 ACKs for top commit: Sjors: Code review re-ACK af112ab62895b145660f4cd7ff842e9cfea2a530 ryanofsky: Code review ACK af112ab62895b145660f4cd7ff842e9cfea2a530. Just suggested changes since last review (thanks!) promag: Tested ACK af112ab62895b145660f4cd7ff842e9cfea2a530. Latest suggestions and changes look good to me. Tree-SHA512: 8ddad34b30dcc2cdcad6678ba8a0b36fa176e4e3465862ef6eee9be0f98d8146705138c9c7995dd8c0990af41078ca743fef1a90ed9240081f052f32ddec72b9
2020-01-08qt: Force set nPruneSize in QSettings after introHennadii Stepanov
If QSettings is set already, it is required to force set nPruneSize after the intro dialog.
2019-12-30scripted-diff: Bump copyright of files changed in 2019MarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2019-12-08util: Replace magics with DEFAULT_PRUNE_TARGET_GBHennadii Stepanov
This commit does not change behavior.
2019-10-24Remove BIP70 Supportfanquake
2019-08-24[gui] add explicit prune setterSjors Provoost
This makes it possible to enable pruning after the OptionsModel has been initialized and reset.
2019-06-21Use qInfo() if no error occursHennadii Stepanov
qWarning() is used to report warnings and recoverable errors in your application. qInfo() is used for informational messages (since Qt 5.5).
2019-04-23Resolve the qt/guiutil <-> qt/optionsmodal CD251
This pull request attempts to resolve the `qt/guiutil` <-> `qt/optionsmodel` circular dependency. The circular dependency is resolved by moving the `Intro::getDefaultDataDirectory` member function to `GUIUtil::getDefaultDataDirectory`.
2019-01-30Correct units for "-dbcache" and "-prune"Hennadii Stepanov
All dbcache-related values in the code are measured in MiB (not in megabytes, MB) or in bytes. The GUI "-prune" values in GB are translated to the node values in MiB correctly. The maximum of the "-prune" QSpinBox is not limited by the default value of 99 (GB). Also, this improves log readability.