comparison main.cpp @ 53:8b94dc81cb8d draft

all builds are now with wxWidgets-2.9.0, we are now using UTF-8, added support for language translation file locale/<lang>/LC_MESSAGES/bitcoin.mo -- version 0.2.2 git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@66 1a98c847-1fd6-4fd8-948a-caf3550aa51b
author s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>
date Wed, 17 Feb 2010 17:22:01 +0000
parents b1893905ce3e
children a71b4cffb922
comparison
equal deleted inserted replaced
52:984ecf3ba0a6 53:8b94dc81cb8d
1458 } 1458 }
1459 } 1459 }
1460 1460
1461 bool CheckDiskSpace(int64 nAdditionalBytes) 1461 bool CheckDiskSpace(int64 nAdditionalBytes)
1462 { 1462 {
1463 #ifdef __WXMSW__
1464 uint64 nFreeBytesAvailable = 0; // bytes available to caller
1465 uint64 nTotalNumberOfBytes = 0; // bytes on disk
1466 uint64 nTotalNumberOfFreeBytes = 0; // free bytes on disk
1467 if (!GetDiskFreeSpaceEx(GetDataDir().c_str(),
1468 (PULARGE_INTEGER)&nFreeBytesAvailable,
1469 (PULARGE_INTEGER)&nTotalNumberOfBytes,
1470 (PULARGE_INTEGER)&nTotalNumberOfFreeBytes))
1471 {
1472 printf("ERROR: GetDiskFreeSpaceEx() failed\n");
1473 return true;
1474 }
1475 #else
1476 uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available; 1463 uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available;
1477 #endif
1478 1464
1479 // Check for 15MB because database could create another 10MB log file at any time 1465 // Check for 15MB because database could create another 10MB log file at any time
1480 if (nFreeBytesAvailable < (int64)15000000 + nAdditionalBytes) 1466 if (nFreeBytesAvailable < (int64)15000000 + nAdditionalBytes)
1481 { 1467 {
1482 fShutdown = true; 1468 fShutdown = true;
1483 ThreadSafeMessageBox("Warning: Your disk space is low ", "Bitcoin", wxOK | wxICON_EXCLAMATION); 1469 ThreadSafeMessageBox(_("Warning: Disk space is low "), "Bitcoin", wxOK | wxICON_EXCLAMATION);
1484 CreateThread(Shutdown, NULL); 1470 CreateThread(Shutdown, NULL);
1485 return false; 1471 return false;
1486 } 1472 }
1487 return true; 1473 return true;
1488 } 1474 }
2960 int64 nFeeRequired; 2946 int64 nFeeRequired;
2961 if (!CreateTransaction(scriptPubKey, nValue, wtxNew, key, nFeeRequired)) 2947 if (!CreateTransaction(scriptPubKey, nValue, wtxNew, key, nFeeRequired))
2962 { 2948 {
2963 string strError; 2949 string strError;
2964 if (nValue + nFeeRequired > GetBalance()) 2950 if (nValue + nFeeRequired > GetBalance())
2965 strError = strprintf("Error: This is an oversized transaction that requires a transaction fee of %s ", FormatMoney(nFeeRequired).c_str()); 2951 strError = strprintf(_("Error: This is an oversized transaction that requires a transaction fee of %s "), FormatMoney(nFeeRequired).c_str());
2966 else 2952 else
2967 strError = "Error: Transaction creation failed "; 2953 strError = _("Error: Transaction creation failed ");
2968 printf("SendMoney() : %s", strError.c_str()); 2954 printf("SendMoney() : %s", strError.c_str());
2969 return strError; 2955 return strError;
2970 } 2956 }
2971 if (!CommitTransactionSpent(wtxNew, key)) 2957 if (!CommitTransactionSpent(wtxNew, key))
2972 { 2958 {
2973 printf("SendMoney() : Error finalizing transaction"); 2959 printf("SendMoney() : Error finalizing transaction");
2974 return "Error finalizing transaction"; 2960 return _("Error finalizing transaction");
2975 } 2961 }
2976 2962
2977 // Track how many getdata requests our transaction gets 2963 // Track how many getdata requests our transaction gets
2978 CRITICAL_BLOCK(cs_mapRequestCount) 2964 CRITICAL_BLOCK(cs_mapRequestCount)
2979 mapRequestCount[wtxNew.GetHash()] = 0; 2965 mapRequestCount[wtxNew.GetHash()] = 0;
2983 // Broadcast 2969 // Broadcast
2984 if (!wtxNew.AcceptTransaction()) 2970 if (!wtxNew.AcceptTransaction())
2985 { 2971 {
2986 // This must not fail. The transaction has already been signed and recorded. 2972 // This must not fail. The transaction has already been signed and recorded.
2987 printf("SendMoney() : Error: Transaction not valid"); 2973 printf("SendMoney() : Error: Transaction not valid");
2988 return "Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."; 2974 return _("Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
2989 } 2975 }
2990 wtxNew.RelayWalletTransaction(); 2976 wtxNew.RelayWalletTransaction();
2991 } 2977 }
2992 MainFrameRepaint(); 2978 MainFrameRepaint();
2993 return ""; 2979 return "";
2997 2983
2998 string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtxNew) 2984 string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtxNew)
2999 { 2985 {
3000 // Check amount 2986 // Check amount
3001 if (nValue <= 0) 2987 if (nValue <= 0)
3002 return "Invalid amount"; 2988 return _("Invalid amount");
3003 if (nValue + nTransactionFee > GetBalance()) 2989 if (nValue + nTransactionFee > GetBalance())
3004 return "You don't have enough money"; 2990 return _("You don't have enough money");
3005 2991
3006 // Parse bitcoin address 2992 // Parse bitcoin address
3007 CScript scriptPubKey; 2993 CScript scriptPubKey;
3008 if (!scriptPubKey.SetBitcoinAddress(strAddress)) 2994 if (!scriptPubKey.SetBitcoinAddress(strAddress))
3009 return "Invalid bitcoin address"; 2995 return _("Invalid bitcoin address");
3010 2996
3011 return SendMoney(scriptPubKey, nValue, wtxNew); 2997 return SendMoney(scriptPubKey, nValue, wtxNew);
3012 } 2998 }