|
|
@ -40,6 +40,7 @@ |
|
|
|
#if BOOST_FILESYSTEM_VERSION >= 3 |
|
|
|
#if BOOST_FILESYSTEM_VERSION >= 3 |
|
|
|
#include <boost/filesystem/detail/utf8_codecvt_facet.hpp> |
|
|
|
#include <boost/filesystem/detail/utf8_codecvt_facet.hpp> |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#include <boost/scoped_array.hpp> |
|
|
|
|
|
|
|
|
|
|
|
#include <QAbstractItemView> |
|
|
|
#include <QAbstractItemView> |
|
|
|
#include <QApplication> |
|
|
|
#include <QApplication> |
|
|
@ -567,12 +568,17 @@ TableViewLastColumnResizingFixer::TableViewLastColumnResizingFixer(QTableView* t |
|
|
|
#ifdef WIN32 |
|
|
|
#ifdef WIN32 |
|
|
|
boost::filesystem::path static StartupShortcutPath() |
|
|
|
boost::filesystem::path static StartupShortcutPath() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (GetBoolArg("-testnet", false)) |
|
|
|
|
|
|
|
return GetSpecialFolderPath(CSIDL_STARTUP) / "Bitcoin (testnet).lnk"; |
|
|
|
|
|
|
|
else if (GetBoolArg("-regtest", false)) |
|
|
|
|
|
|
|
return GetSpecialFolderPath(CSIDL_STARTUP) / "Bitcoin (regtest).lnk"; |
|
|
|
|
|
|
|
|
|
|
|
return GetSpecialFolderPath(CSIDL_STARTUP) / "Bitcoin.lnk"; |
|
|
|
return GetSpecialFolderPath(CSIDL_STARTUP) / "Bitcoin.lnk"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool GetStartOnSystemStartup() |
|
|
|
bool GetStartOnSystemStartup() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// check for Bitcoin.lnk
|
|
|
|
// check for Bitcoin*.lnk
|
|
|
|
return boost::filesystem::exists(StartupShortcutPath()); |
|
|
|
return boost::filesystem::exists(StartupShortcutPath()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -588,8 +594,8 @@ bool SetStartOnSystemStartup(bool fAutoStart) |
|
|
|
// Get a pointer to the IShellLink interface.
|
|
|
|
// Get a pointer to the IShellLink interface.
|
|
|
|
IShellLink* psl = NULL; |
|
|
|
IShellLink* psl = NULL; |
|
|
|
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, |
|
|
|
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, |
|
|
|
CLSCTX_INPROC_SERVER, IID_IShellLink, |
|
|
|
CLSCTX_INPROC_SERVER, IID_IShellLink, |
|
|
|
reinterpret_cast<void**>(&psl)); |
|
|
|
reinterpret_cast<void**>(&psl)); |
|
|
|
|
|
|
|
|
|
|
|
if (SUCCEEDED(hres)) |
|
|
|
if (SUCCEEDED(hres)) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -597,20 +603,34 @@ bool SetStartOnSystemStartup(bool fAutoStart) |
|
|
|
TCHAR pszExePath[MAX_PATH]; |
|
|
|
TCHAR pszExePath[MAX_PATH]; |
|
|
|
GetModuleFileName(NULL, pszExePath, sizeof(pszExePath)); |
|
|
|
GetModuleFileName(NULL, pszExePath, sizeof(pszExePath)); |
|
|
|
|
|
|
|
|
|
|
|
TCHAR pszArgs[5] = TEXT("-min"); |
|
|
|
// Start client minimized
|
|
|
|
|
|
|
|
QString strArgs = "-min"; |
|
|
|
|
|
|
|
// Set -testnet /-regtest options
|
|
|
|
|
|
|
|
strArgs += QString::fromStdString(strprintf(" -testnet=%d -regtest=%d", GetBoolArg("-testnet", false), GetBoolArg("-regtest", false))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef UNICODE |
|
|
|
|
|
|
|
boost::scoped_array<TCHAR> args(new TCHAR[strArgs.length() + 1]); |
|
|
|
|
|
|
|
// Convert the QString to TCHAR*
|
|
|
|
|
|
|
|
strArgs.toWCharArray(args.get()); |
|
|
|
|
|
|
|
// Add missing '\0'-termination to string
|
|
|
|
|
|
|
|
args[strArgs.length()] = '\0'; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// Set the path to the shortcut target
|
|
|
|
// Set the path to the shortcut target
|
|
|
|
psl->SetPath(pszExePath); |
|
|
|
psl->SetPath(pszExePath); |
|
|
|
PathRemoveFileSpec(pszExePath); |
|
|
|
PathRemoveFileSpec(pszExePath); |
|
|
|
psl->SetWorkingDirectory(pszExePath); |
|
|
|
psl->SetWorkingDirectory(pszExePath); |
|
|
|
psl->SetShowCmd(SW_SHOWMINNOACTIVE); |
|
|
|
psl->SetShowCmd(SW_SHOWMINNOACTIVE); |
|
|
|
psl->SetArguments(pszArgs); |
|
|
|
#ifndef UNICODE |
|
|
|
|
|
|
|
psl->SetArguments(strArgs.toStdString().c_str()); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
psl->SetArguments(args.get()); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// Query IShellLink for the IPersistFile interface for
|
|
|
|
// Query IShellLink for the IPersistFile interface for
|
|
|
|
// saving the shortcut in persistent storage.
|
|
|
|
// saving the shortcut in persistent storage.
|
|
|
|
IPersistFile* ppf = NULL; |
|
|
|
IPersistFile* ppf = NULL; |
|
|
|
hres = psl->QueryInterface(IID_IPersistFile, |
|
|
|
hres = psl->QueryInterface(IID_IPersistFile, reinterpret_cast<void**>(&ppf)); |
|
|
|
reinterpret_cast<void**>(&ppf)); |
|
|
|
|
|
|
|
if (SUCCEEDED(hres)) |
|
|
|
if (SUCCEEDED(hres)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
WCHAR pwsz[MAX_PATH]; |
|
|
|
WCHAR pwsz[MAX_PATH]; |
|
|
@ -630,7 +650,6 @@ bool SetStartOnSystemStartup(bool fAutoStart) |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#elif defined(Q_OS_LINUX) |
|
|
|
#elif defined(Q_OS_LINUX) |
|
|
|
|
|
|
|
|
|
|
|
// Follow the Desktop Application Autostart Spec:
|
|
|
|
// Follow the Desktop Application Autostart Spec:
|
|
|
|