Skip to content

Conversation

@Diapolo
Copy link

@Diapolo Diapolo commented Jun 9, 2012

  • add the slot updateDisplayUnit() to overviewpage, sendcoinsdialog, sendcoinsentry and connect it to displayUnitChanged() - this ensures all fields in the GUI, who use a display unit are imediately updated, when the user changes this setting in the optionsdialog
  • ensure used fields init with the current set display unit

This addresses / fixes #781 and #927.

@Diapolo
Copy link
Author

Diapolo commented Jun 10, 2012

Updated - added updateDisplayUnit(); in OverviewPage::setModel(), to init the list of last transaction on the overview page with the current display unit.

@Diapolo
Copy link
Author

Diapolo commented Jun 11, 2012

@laanwj Can you take a look at the code, I think this is a rather "small" one, which could get in, if you don't want to add/change something.

Copy link
Member

Choose a reason for hiding this comment

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

I don't really like special-casing 0. Either;

  • Keep it as "txdelegate->unit = model->getOptionsModel()->getDisplayUnit();", and remove the parameter again

or

  • Pass a valid parameter everywhere you use this function, and use txdelegate->unit = nUnit.

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure if I understand you, nUnit is non-zero, when updateDisplayUnit() is called via the displayUnitChanged() SIGNAL and 0 when called to init. Do you want me to use updateDisplayUnit(0) and remove the default-init of 0?

Copy link
Member

Choose a reason for hiding this comment

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

I don't want to use 0 at all, the argument adds unneeded complexity. IMO I think it's best to remove the argument nUnit completely, and always use the unit from the optionsmodel (as it was before).

Copy link
Author

Choose a reason for hiding this comment

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

We have a SLOT and SIGNAL, which handles the unit, why should we not use this? It's used in the other 2 files, too. I really like the ?: operator and disagree here. Can we find a consensus which leads to similar solutions for all 3 files edited in this pull :)?

Copy link
Member

Choose a reason for hiding this comment

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

Well, the other alternative is to always pass in a valid unit value.

You may like it, but there is no real need to special-case 0, no need to use ?:. You only need one function signature for this, without special magic values which are bound to bite you some day.

If you look at how I've done it in the other files it's like this:

void MyClass::setModel(model) 
{
    if(model)
    {
        /* Set initial value */
        fooChanged(model->getFoo()); 
        /* Track changes */
        connect(model, SIGNAL(fooChanged(int)), self, SLOT(fooChanged(int)))
    }
}

void MyClass::fooChanged(value)
{
    // Do something with value
}

So everywhere you call updateDisplayUnit() use updateDisplayUnit(model->getOptionsModel->getDisplayUnit()). Either that or the previous suggestion,

void MyClass::setModel(model) 
{
    if(model)
    {
        /* Set initial value */
        blaChanged(); 
        /* Track changes */
        connect(model, SIGNAL(fooChanged(int)), self, SLOT(fooChanged()))
    }
}

void MyClass::fooChanged()
{
    if(model)
    {
        value = model->getFoo();
        // Do something with value
    }
}

which IMO in this particular case is most sensible as we're always taking the value from the options model anyway. Both are valid solutions, but don't try to do them both at once.

Copy link
Author

Choose a reason for hiding this comment

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

So simply not use the int passed from fooChanged() SIGNAL... it is cleaner yes, I just was sad we didn't use it.
I'm going to change it in all 3 files.

Copy link
Member

Choose a reason for hiding this comment

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

There's ton of places where the signal argument is not used, also in Qt itself, no need to be sad about it :)

@Diapolo
Copy link
Author

Diapolo commented Jun 12, 2012

Last commit implements 2 of your suggestions @laanwj , this will get squashed after we are "final" :).

@Diapolo
Copy link
Author

Diapolo commented Jun 12, 2012

Removed the ?: and int usage from the SIGNAL. Anything left?

@laanwj
Copy link
Member

laanwj commented Jun 12, 2012

ACK

@Diapolo
Copy link
Author

Diapolo commented Jun 12, 2012

Merged all commits, no further changes, final then.

@laanwj
Copy link
Member

laanwj commented Jun 12, 2012

BTW one unrelated comment regarding your commit messages. It's not very urgent, and there's no need to change it for current pulls. However, currently you try to trim everything into one line, this makes for very long "git log" lines when abbreviated. The general format that most people use for a commit message is:

<short description of ~50 chars>

<long description>

for example, see commit 1025440:

Added 'immature balance' for miners. Only displayed if the balance is greater than zero.

This introduces internal types:
* CKeyID: reference (hash160) of a key
* CScriptID: reference (hash160) of a script
* CTxDestination: a boost::variant of the former two

CBitcoinAddress is retrofitted to be a Base58 encoding of a
CTxDestination. This allows all internal code to only use the
internal types, and only have RPC and GUI depend on the base58 code.
(... continued ...)

…ndcoinsentry and connect it to displayUnitChanged() - this ensures all fields in the GUI, who use a display unit are imediately updated, when the user changes this setting in the optionsdialog / ensure used fields init with the current set display unit
@Diapolo
Copy link
Author

Diapolo commented Jun 17, 2012

@laanwj Can you merge this now, I'm working on further changes in some of the files and would like to avoid merge-conflicts :).

laanwj added a commit that referenced this pull request Jun 17, 2012
GUI: init with correct display unit and update it, when user changes it via options dialog
@laanwj laanwj merged commit a54d211 into bitcoin:master Jun 17, 2012
coblee pushed a commit to litecoin-project/litecoin that referenced this pull request Jul 17, 2012
GUI: init with correct display unit and update it, when user changes it via options dialog
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request May 6, 2020
…e-HD wallets

28d051f [QA] Add Travis job to run functional tests with --legacywallet (random-zebra)
9b94070 [Tests] Skip unrelated tests when --legacywallet (random-zebra)

Pull request description:

  Follows the discussion in bitcoin#1410 .
  Defines a list of tests to be skipped by the `test_runner` when running with the `--legacywallet` flag (not directly related to the wallet / key management).
  Also adds a specific Travis job, to run the functional test suite on pre-HD wallets.

  Note: currently based on top of
  - [x] bitcoin#1411

  to make legacy tests pass.

ACKs for top commit:
  Fuzzbawls:
    ACK 28d051f

Tree-SHA512: 4a8c896a3b8232221b8f86480d4b3e730297e1efb103cd61ac26fd104d6d90577a2fdab2a9002932c4d61d5a7404f7ef588e92958cdfb28249b018f58e74dd2a
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overview/Recent transactions always shows BTC on startup

2 participants