[Qt] honor current network when creating autostart link #5793

pull Diapolo wants to merge 2 commits into bitcoin:master from Diapolo:testnet-startup changing 1 files +35 −11
  1. Diapolo commented at 8:42 pm on February 14, 2015: none
    • creates a “Bitcoin (testnet).lnk” when on testnet or a “Bitcoin (regtest).lnk, when on regtest
    • fixes #5778
  2. Diapolo renamed this:
    [Qt] honor testnet when creating autostart link on Windows
    [Qt] honor testnet when creating autostart links
    on Feb 15, 2015
  3. Diapolo commented at 3:30 pm on February 15, 2015: none
    Hopefully fixed the Travis build and also added the change for Linux (needs testing).
  4. in src/qt/guiutil.cpp: in a1dd65899b outdated
    599@@ -597,20 +600,33 @@ bool SetStartOnSystemStartup(bool fAutoStart)
    600             TCHAR pszExePath[MAX_PATH];
    601             GetModuleFileName(NULL, pszExePath, sizeof(pszExePath));
    602 
    603-            TCHAR pszArgs[5] = TEXT("-min");
    604+            // Start client minimized
    605+            QString strArgs = "-min";
    606+            // Start testnet client, if we are currently running testnet
    607+            if (Params().NetworkIDString() == "test")
    


    laanwj commented at 5:39 am on February 17, 2015:

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

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

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


    laanwj commented at 9:58 am on February 19, 2015:
    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
  5. laanwj commented at 9:45 am on February 18, 2015: member

    Failing travis on windows

     0 CXX qt/qt_libbitcoinqt_a-guiutil.o
     1qt/guiutil.cpp: In function bool GUIUtil::SetStartOnSystemStartup(bool):
     2qt/guiutil.cpp:610:61: error: cannot convert WCHAR* {aka wchar_t*} to TCHAR* {aka char*} in initialization
     3qt/guiutil.cpp:611:42: error: no matching function for call to QString::toWCharArray(TCHAR*&)
     4qt/guiutil.cpp:611:42: note: candidate is:
     5/home/travis/build/bitcoin/bitcoin/depends/x86_64-w64-mingw32/include/QtCore/qstring.h:824:12: note: int QString::toWCharArray(wchar_t*) const
     6/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*
     7make[2]: *** [qt/qt_libbitcoinqt_a-guiutil.o] Error 1
     8make[2]: Leaving directory `/home/travis/build/bitcoin/bitcoin/bitcoin-x86_64-w64-mingw32/src'
     9make[1]: *** [check-recursive] Error 1
    10make[1]: Leaving directory `/home/travis/build/bitcoin/bitcoin/bitcoin-x86_64-w64-mingw32/src'
    11make: *** [check-recursive] Error 1
    
  6. laanwj added the label GUI on Feb 18, 2015
  7. Diapolo commented at 12:23 pm on February 18, 2015: none
    Yeah I already saw this… will need to rework :). Edit: Seems like some UNICODE and wchar_t problems…
  8. Diapolo commented at 1:58 pm on February 18, 2015: none
    Who is able to test this :)?
  9. in src/qt/guiutil.cpp: in 55c1eb1591 outdated
    607+            if (Params().NetworkIDString() == "test")
    608+                strArgs += " -testnet";
    609+
    610+#ifdef UNICODE
    611+            // Convert the QString to TCHAR*
    612+            TCHAR* args = new TCHAR[strArgs.length() + 1];
    


    laanwj commented at 10:10 am on February 19, 2015:

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

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

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

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

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

  10. Diapolo renamed this:
    [Qt] honor testnet when creating autostart links
    [Qt] honor current network when creating autostart link
    on Feb 19, 2015
  11. Diapolo commented at 11:04 am on February 19, 2015: none
    @laanwj I choose the scoped_array, because the other macro wasn’t available here. I also updated to your generic approach for testnet/tegtest.
  12. [Qt, Win] honor current network when creating autostart link
    - creates a "Bitcoin (testnet).lnk" when on testnet or a "Bitcoin
      (regtest).lnk, when on regtest
    - fixes #5778
    9673c35daf
  13. [Qt, Linux] honor current network when creating autostart link 6cb4a52535
  14. laanwj commented at 4:18 pm on February 26, 2015: member
    utACK
  15. laanwj commented at 3:29 pm on March 3, 2015: member
    @tykling can you test this?
  16. tykling commented at 3:57 pm on March 3, 2015: none
    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?
  17. jonasschnelli commented at 6:08 am on March 5, 2015: 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

  18. laanwj merged this on Mar 9, 2015
  19. laanwj closed this on Mar 9, 2015

  20. laanwj referenced this in commit d26f0b263c on Mar 9, 2015
  21. Diapolo deleted the branch on Mar 9, 2015
  22. random-zebra referenced this in commit f15a1674ce on Feb 6, 2021
  23. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-03 13:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me