Merge branch '0.5.0.x' into 0.5.x
authorLuke Dashjr <luke-jr+git@utopios.org>
Fri, 16 Mar 2012 20:45:32 +0000 (16:45 -0400)
committerLuke Dashjr <luke-jr+git@utopios.org>
Fri, 16 Mar 2012 20:45:32 +0000 (16:45 -0400)
Conflicts:
bitcoin-qt.pro
doc/README
doc/README_windows.txt
share/setup.nsi
src/serialize.h

1  2 
bitcoin-qt.pro
src/bitcoinrpc.cpp
src/qt/guiutil.h

diff --combined bitcoin-qt.pro
@@@ -1,6 -1,6 +1,6 @@@
  TEMPLATE = app
  TARGET =
 -VERSION = 0.5.0.5
 +VERSION = 0.5.4
  INCLUDEPATH += src src/json src/qt
  DEFINES += QT_GUI BOOST_THREAD_USE_LIB
  CONFIG += no_include_pwd
@@@ -251,8 -251,8 +251,8 @@@ isEmpty(BOOST_INCLUDE_PATH) 
      macx:BOOST_INCLUDE_PATH = /opt/local/include
  }
  
- windows:LIBS += -lws2_32
- windows:DEFINES += WIN32
+ windows:LIBS += -lmingwthrd -lws2_32
+ windows:DEFINES += _MT WIN32
  windows:RC_FILE = src/qt/res/bitcoin-qt.rc
  
  macx:HEADERS += src/qt/macdockiconhandler.h
diff --combined src/bitcoinrpc.cpp
@@@ -36,8 -36,6 +36,8 @@@ void ThreadRPCServer2(void* parg)
  typedef Value(*rpcfn_type)(const Array& params, bool fHelp);
  extern map<string, rpcfn_type> mapCallTable;
  
 +static std::string strRPCUserColonPass;
 +
  static int64 nWalletUnlockTime;
  static CCriticalSection cs_nWalletUnlockTime;
  
@@@ -128,7 -126,6 +128,7 @@@ Value help(const Array& params, bool fH
          // We already filter duplicates, but these deprecated screw up the sort order
          if (strMethod == "getamountreceived" ||
              strMethod == "getallreceived" ||
 +            strMethod == "getblocknumber" || // deprecated
              (strMethod.find("label") != string::npos))
              continue;
          if (strCommand != "" && strMethod != strCommand)
@@@ -184,13 -181,12 +184,13 @@@ Value getblockcount(const Array& params
  }
  
  
 +// deprecated
  Value getblocknumber(const Array& params, bool fHelp)
  {
      if (fHelp || params.size() != 0)
          throw runtime_error(
              "getblocknumber\n"
 -            "Returns the block number of the latest block in the longest block chain.");
 +            "Deprecated.  Use getblockcount.");
  
      return nBestHeight;
  }
@@@ -1658,7 -1654,7 +1658,7 @@@ Value getwork(const Array& params, boo
          }
  
          // Update nTime
-         pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
+         pblock->UpdateTime(pindexPrev);
          pblock->nNonce = 0;
  
          // Update nExtraNonce
@@@ -1755,7 -1751,7 +1755,7 @@@ Value getmemorypool(const Array& params
          }
  
          // Update nTime
-         pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
+         pblock->UpdateTime(pindexPrev);
          pblock->nNonce = 0;
  
          Array transactions;
@@@ -1860,7 -1856,7 +1860,7 @@@ string pAllowInSafeMode[] 
      "help",
      "stop",
      "getblockcount",
 -    "getblocknumber",
 +    "getblocknumber",  // deprecated
      "getconnectioncount",
      "getdifficulty",
      "getgenerate",
@@@ -2031,7 -2027,12 +2031,7 @@@ bool HTTPAuthorized(map<string, string>
          return false;
      string strUserPass64 = strAuth.substr(6); boost::trim(strUserPass64);
      string strUserPass = DecodeBase64(strUserPass64);
 -    string::size_type nColon = strUserPass.find(":");
 -    if (nColon == string::npos)
 -        return false;
 -    string strUser = strUserPass.substr(0, nColon);
 -    string strPassword = strUserPass.substr(nColon+1);
 -    return (strUser == mapArgs["-rpcuser"] && strPassword == mapArgs["-rpcpassword"]);
 +    return strUserPass == strRPCUserColonPass;
  }
  
  //
@@@ -2164,8 -2165,7 +2164,8 @@@ void ThreadRPCServer2(void* parg
  {
      printf("ThreadRPCServer started\n");
  
 -    if (mapArgs["-rpcuser"] == "" && mapArgs["-rpcpassword"] == "")
 +    strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"];
 +    if (strRPCUserColonPass == ":")
      {
          unsigned char rand_pwd[32];
          RAND_bytes(rand_pwd, 32);
diff --combined src/qt/guiutil.h
@@@ -12,8 -12,6 +12,8 @@@ class QUrl
  QT_END_NAMESPACE
  class SendCoinsRecipient;
  
 +/** Static utility functions used by the Bitcoin Qt UI.
 + */
  class GUIUtil
  {
  public:
      // See Bitcoin URL definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
      static bool parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out);
      static bool parseBitcoinURL(QString url, SendCoinsRecipient *out);
+     /** Get save file name, mimics QFileDialog::getSaveFileName, except that it appends a default suffix
+         when no suffix is provided by the user.
+       @param[in] parent  Parent window (or 0)
+       @param[in] caption Window caption (or empty, for default)
+       @param[in] dir     Starting directory (or empty, to default to documents directory)
+       @param[in] filter  Filter specification such as "Comma Separated Files (*.csv)"
+       @param[out] selectedSuffixOut  Pointer to return the suffix (file type) that was selected (or 0).
+                   Can be useful when choosing the save file format based on suffix.
+      */
+     static QString getSaveFileName(QWidget *parent=0, const QString &caption=QString(),
+                                    const QString &dir=QString(), const QString &filter=QString(),
+                                    QString *selectedSuffixOut=0);
  };
  
  #endif // GUIUTIL_H