Browse Source

- CommonJS => fromString(string _sn) fromString(string const& _sn).

- Wrapping string with QApplication::tr(), used for localization.
cl-refactor
yann300 10 years ago
committed by yann300
parent
commit
4da294f86d
  1. 7
      libdevcore/CommonJS.cpp
  2. 2
      libdevcore/CommonJS.h
  3. 5
      mix/AssemblyDebuggerCtrl.cpp
  4. 3
      mix/AssemblyDebuggerModel.cpp
  5. 6
      mix/ConstantCompilationCtrl.cpp
  6. 3
      mix/ConstantCompilationModel.cpp
  7. 2
      mix/KeyEventManager.cpp

7
libdevcore/CommonJS.cpp

@ -105,13 +105,8 @@ std::string fromRaw(h256 _n, unsigned* _inc)
return "";
}
Address fromString(std::string _sn)
Address fromString(std::string const& _sn)
{
if (_sn.size() > 32)
_sn.resize(32);
h256 n;
memcpy(n.data(), _sn.data(), _sn.size());
memset(n.data() + _sn.size(), 0, 32 - _sn.size());
if (_sn.size() == 40)
return Address(fromHex(_sn));
else

2
libdevcore/CommonJS.h

@ -51,7 +51,7 @@ bytes padded(bytes _b, unsigned _l);
bytes unpadded(bytes _s);
std::string prettyU256(u256 _n);
std::string fromRaw(h256 _n, unsigned* _inc = nullptr);
Address fromString(std::string _a);
Address fromString(std::string const& _a);
template <unsigned N> FixedHash<N> jsToFixed(std::string const& _s)
{

5
mix/AssemblyDebuggerCtrl.cpp

@ -47,7 +47,7 @@ QString AssemblyDebuggerCtrl::contentUrl() const
QString AssemblyDebuggerCtrl::title() const
{
return "debugger";
return QApplication::tr("debugger");
}
void AssemblyDebuggerCtrl::start() const
@ -63,7 +63,6 @@ void AssemblyDebuggerCtrl::keyPressed(int _key)
QString code = m_doc->toPlainText();
QtConcurrent::run([this, code]()
{
if (!m_modelDebugger->compile(m_doc->toPlainText()))
{
emit dataAvailable(false, DebuggingStatusResult::Compilationfailed);
@ -101,5 +100,5 @@ void AssemblyDebuggerCtrl::updateGUI(bool success, DebuggingStatusResult reason,
this->addContentOn(this);
}
else
m_ctx->displayMessageDialog("debugger","compilation failed");
m_ctx->displayMessageDialog(QApplication::tr("debugger"), QApplication::tr("compilation failed"));
}

3
mix/AssemblyDebuggerModel.cpp

@ -17,6 +17,7 @@
* used as a model to debug contract assembly code.
*/
#include <QApplication>
#include "libethereum/Executive.h"
#include "libethereum/Transaction.h"
#include "libethereum/ExtVM.h"
@ -90,7 +91,7 @@ DebuggingContent AssemblyDebuggerModel::getContractInitiationDebugStates(dev::u2
{
DebuggingContent r;
r.contentAvailable = false;
r.message = "compile failed";
r.message = QApplication::tr("compilation failed");
return r;
}

6
mix/ConstantCompilationCtrl.cpp

@ -43,7 +43,7 @@ QString ConstantCompilationCtrl::contentUrl() const
QString ConstantCompilationCtrl::title() const
{
return "compiler";
return QApplication::tr("compiler");
}
void ConstantCompilationCtrl::start() const
@ -80,13 +80,13 @@ void ConstantCompilationCtrl::writeOutPut(CompilerResult const& _res)
status->setProperty("text", "succeeded");
status->setProperty("color", "green");
content->setProperty("text", _res.hexCode);
qDebug() << QString("compile succeeded " + _res.hexCode);
qDebug() << QString(QApplication::tr("compile succeeded") + " " + _res.hexCode);
}
else
{
status->setProperty("text", "failure");
status->setProperty("color", "red");
content->setProperty("text", _res.comment);
qDebug() << QString("compile failed " + _res.comment);
qDebug() << QString(QApplication::tr("compile failed") + " " + _res.comment);
}
}

3
mix/ConstantCompilationModel.cpp

@ -20,6 +20,7 @@
* Ethereum IDE client.
*/
#include <QApplication>
#include <QObject>
#include <libevm/VM.h>
#include <libsolidity/Scanner.h>
@ -55,7 +56,7 @@ CompilerResult ConstantCompilationModel::compile(QString _code)
catch (...)
{
res.success = false;
res.comment = "Uncaught exception.";
res.comment = QApplication::tr("Uncaught exception.");
res.hexCode = "";
}
return res;

2
mix/KeyEventManager.cpp

@ -39,5 +39,3 @@ void KeyEventManager::keyPressed(QVariant _event)
{
emit onKeyPressed(_event.toInt());
}

Loading…
Cancel
Save