Skip to content

Conversation

Diapolo
Copy link

@Diapolo Diapolo commented Feb 14, 2015

@Diapolo Diapolo changed the title [Qt] honor testnet when creating autostart link on Windows [Qt] honor testnet when creating autostart links Feb 15, 2015
@Diapolo
Copy link
Author

Diapolo commented Feb 15, 2015

Hopefully fixed the Travis build and also added the change for Linux (needs testing).

// Start client minimized
QString strArgs = "-min";
// Start testnet client, if we are currently running testnet
if (Params().NetworkIDString() == "test")
Copy link
Member

Choose a reason for hiding this comment

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

You could generalize this by passing the current value of testnet, or even regtest to the link,

strprintf("-testnet=%d -regtest=%d", GetBoolArg("-testnet"), GetBoolArg("-regtest"))

Not that I think there is much use in an autostarting regtest instance.

Copy link
Member

Choose a reason for hiding this comment

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

If you do keep it like this based on special-casing the network name, make sure that you avoid doing anything if the net is not main or test

@laanwj
Copy link
Member

laanwj commented Feb 18, 2015

Failing travis on windows

 CXX qt/qt_libbitcoinqt_a-guiutil.o
qt/guiutil.cpp: In function ‘bool GUIUtil::SetStartOnSystemStartup(bool)’:
qt/guiutil.cpp:610:61: error: cannot convert ‘WCHAR* {aka wchar_t*}’ to ‘TCHAR* {aka char*}’ in initialization
qt/guiutil.cpp:611:42: error: no matching function for call to ‘QString::toWCharArray(TCHAR*&)’
qt/guiutil.cpp:611:42: note: candidate is:
/home/travis/build/bitcoin/bitcoin/depends/x86_64-w64-mingw32/include/QtCore/qstring.h:824:12: note: int QString::toWCharArray(wchar_t*) const
/home/travis/build/bitcoin/bitcoin/depends/x86_64-w64-mingw32/include/QtCore/qstring.h:824:12: note: no known conversion for argument 1 from ‘TCHAR* {aka char*}’ to ‘wchar_t*’
make[2]: *** [qt/qt_libbitcoinqt_a-guiutil.o] Error 1
make[2]: Leaving directory `/home/travis/build/bitcoin/bitcoin/bitcoin-x86_64-w64-mingw32/src'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/home/travis/build/bitcoin/bitcoin/bitcoin-x86_64-w64-mingw32/src'
make: *** [check-recursive] Error 1

@laanwj laanwj added the GUI label Feb 18, 2015
@Diapolo
Copy link
Author

Diapolo commented Feb 18, 2015

Yeah I already saw this... will need to rework :).
Edit: Seems like some UNICODE and wchar_t problems...

@Diapolo
Copy link
Author

Diapolo commented Feb 18, 2015

Who is able to test this :)?


#ifdef UNICODE
// Convert the QString to TCHAR*
TCHAR* args = new TCHAR[strArgs.length() + 1];
Copy link
Member

Choose a reason for hiding this comment

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

We should use RAII here, could be done in various ways. Most obvious is boost::scoped_array, e.g.

scoped_array<TCHAR> args (new TCHAR[strArgs.length() + 1]);

Another option would be going through std::wstring, e.g.

std::wstring wstrArgs = strArgs.toStdWString();
TCHAR *args = W2T(wstrArgs.c_str());

In this case the manual appending of a NULL byte can be avoided, and the code can be shorter.

@Diapolo Diapolo changed the title [Qt] honor testnet when creating autostart links [Qt] honor current network when creating autostart link Feb 19, 2015
@Diapolo
Copy link
Author

Diapolo commented Feb 19, 2015

@laanwj I choose the scoped_array, because the other macro wasn't available here. I also updated to your generic approach for testnet/tegtest.

Philip Kaufmann added 2 commits February 19, 2015 12:06
- creates a "Bitcoin (testnet).lnk" when on testnet or a "Bitcoin
  (regtest).lnk, when on regtest
- fixes #5778
@laanwj
Copy link
Member

laanwj commented Feb 26, 2015

utACK

@laanwj
Copy link
Member

laanwj commented Mar 3, 2015

@tykling can you test this?

@tykling
Copy link

tykling commented Mar 3, 2015

I have no means of building this, sorry, but from reviewing the code it appears to do exactly what is should :) Is there somewhere I can download the executable travis built and try that?

@jonasschnelli
Copy link
Contributor

Tested ACK.
Tested regtest and testnet (parallel).
Checkbox also reacts correct if testnet/regtest link is already there.

Binaries to test: https://builds.jonasschnelli.ch/pulls/5793/

bildschirmfoto 2015-03-05 um 07 01 39

After restart:
bildschirmfoto 2015-03-05 um 07 07 52

@laanwj laanwj merged commit 6cb4a52 into bitcoin:master Mar 9, 2015
laanwj added a commit that referenced this pull request Mar 9, 2015
6cb4a52 [Qt, Linux] honor current network when creating autostart link (Philip Kaufmann)
9673c35 [Qt, Win] honor current network when creating autostart link (Philip Kaufmann)
@Diapolo Diapolo deleted the testnet-startup branch March 9, 2015 09:50
random-zebra added a commit to random-zebra/PIVX that referenced this pull request Feb 6, 2021
e2fee5c [GUI] Use wchar_t API explicitly on Windows (Fuzzbawls)

Pull request description:

  backport of bitcoin#13734 to use the wchar API for windows startup function. This is the first in a long list of upstream PRs that aim to bring full Unicode support to Windows clients as detailed in bitcoin#13869

  Also included here is the relevant parts of bitcoin#5793, to use per-network auto startup shortcuts.

ACKs for top commit:
  furszy:
    utACK e2fee5c .
  random-zebra:
    utACK e2fee5c and merging...

Tree-SHA512: dc4ea84ee10199bdf293977f00c09caf65cbdd1ee2ae14b1adb34fd75c05b847d5971abd17732a77be88bed9e06092b670b09c5760a686b29d64ba8f02d2e4b2
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

autostart shortcut should honor -testnet
4 participants