Browse Source

Better version strings.

cl-refactor
Gav Wood 11 years ago
parent
commit
4fde0bd991
  1. 21
      CMakeLists.txt
  2. 12
      alethzero/Main.ui
  3. 12
      alethzero/MainWin.cpp
  4. 1
      alethzero/MainWin.h
  5. 2
      eth/main.cpp
  6. 4
      libethereum/Client.cpp
  7. 3
      libethereum/PeerNetwork.cpp
  8. 2
      test/peer.cpp

21
CMakeLists.txt

@ -6,14 +6,31 @@ set(CMAKE_AUTOMOC ON)
cmake_policy(SET CMP0015 NEW) cmake_policy(SET CMP0015 NEW)
set(ETH_VERSION 0.1.1) set(ETH_VERSION 0.1.1)
set(ETH_BUILD_TYPE ${CMAKE_BUILD_TYPE})
set(ETH_BUILD_PLATFORM ${CMAKE_SYSTEM_NAME})
if (CMAKE_COMPILER_IS_MINGW)
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/mingw")
elseif (CMAKE_COMPILER_IS_MSYS)
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/msys")
elseif (CMAKE_COMPILER_IS_GNUCXX)
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/g++")
elseif (CMAKE_COMPILER_IS_MSVC)
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/msvc")
else ()
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/unknown")
endif ()
# Initialize CXXFLAGS. # Initialize CXXFLAGS.
set(CMAKE_CXX_FLAGS "-Wall -std=c++11 -DETH_VERSION=${ETH_VERSION}") set(CMAKE_CXX_FLAGS "-Wall -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
add_definitions("-DETH_VERSION=${ETH_VERSION}")
add_definitions("-DETH_BUILD_TYPE=${ETH_BUILD_TYPE}")
add_definitions("-DETH_BUILD_PLATFORM=${ETH_BUILD_PLATFORM}")
#set(CMAKE_CXX_FLAGS, "${CMAKE_CXX_FLAGS} -DETH_VERSION=${ETH_VERSION} -DETH_BUILD_TYPE=${ETH_BUILD_TYPE} -DETH_BUILD_PLATFORM=${ETH_BUILD_PLATFORM}")
# Compiler-specific C++11 activation. # Compiler-specific C++11 activation.
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
execute_process( execute_process(

12
alethzero/Main.ui

@ -91,9 +91,16 @@
<addaction name="mine"/> <addaction name="mine"/>
<addaction name="create"/> <addaction name="create"/>
</widget> </widget>
<widget class="QMenu" name="menu_Help">
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="about"/>
</widget>
<addaction name="menu_File"/> <addaction name="menu_File"/>
<addaction name="menu_Network"/> <addaction name="menu_Network"/>
<addaction name="menu_Tools"/> <addaction name="menu_Tools"/>
<addaction name="menu_Help"/>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/> <widget class="QStatusBar" name="statusbar"/>
<widget class="QDockWidget" name="dockWidget_2"> <widget class="QDockWidget" name="dockWidget_2">
@ -459,6 +466,11 @@
<string>&amp;New Address</string> <string>&amp;New Address</string>
</property> </property>
</action> </action>
<action name="about">
<property name="text">
<string>&amp;About...</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources/> <resources/>

12
alethzero/MainWin.cpp

@ -15,7 +15,8 @@ static void initUnits(QComboBox* _b)
_b->setCurrentIndex(6); _b->setCurrentIndex(6);
} }
#define ETH_QUOTED(A) #A #define ADD_QUOTES_HELPER(s) #s
#define ADD_QUOTES(s) ADD_QUOTES_HELPER(s)
Main::Main(QWidget *parent) : Main::Main(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
@ -26,7 +27,7 @@ Main::Main(QWidget *parent) :
initUnits(ui->valueUnits); initUnits(ui->valueUnits);
initUnits(ui->feeUnits); initUnits(ui->feeUnits);
g_logPost = [=](std::string const& s, char const*) { ui->log->addItem(QString::fromStdString(s)); }; g_logPost = [=](std::string const& s, char const*) { ui->log->addItem(QString::fromStdString(s)); };
m_client = new Client("AlethZero/v" ETH_QUOTED(ETH_VERSION)); m_client = new Client("AlethZero/v" ADD_QUOTES(ETH_VERSION) "/" ADD_QUOTES(ETH_BUILD_TYPE) "/" ADD_QUOTES(ETH_BUILD_PLATFORM));
readSettings(); readSettings();
refresh(); refresh();
@ -42,7 +43,7 @@ Main::Main(QWidget *parent) :
{ {
m_servers = QString::fromUtf8(_r->readAll()).split("\n", QString::SkipEmptyParts); m_servers = QString::fromUtf8(_r->readAll()).split("\n", QString::SkipEmptyParts);
}); });
QNetworkRequest r(QUrl("http://www.ethereum.org/servers.txt")); QNetworkRequest r(QUrl("http://www.ethereum.org/servers.poc2.txt"));
r.setHeader(QNetworkRequest::UserAgentHeader, "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1712.0 Safari/537.36"); r.setHeader(QNetworkRequest::UserAgentHeader, "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1712.0 Safari/537.36");
m_webCtrl.get(r); m_webCtrl.get(r);
srand(time(0)); srand(time(0));
@ -62,6 +63,11 @@ Main::~Main()
delete ui; delete ui;
} }
void Main::on_about_triggered()
{
QMessageBox::about(this, "About AlethZero", "AlethZero/v" ADD_QUOTES(ETH_VERSION) "/" ADD_QUOTES(ETH_BUILD_TYPE) "/" ADD_QUOTES(ETH_BUILD_PLATFORM) "\nBy Gav Wood, 2014.\nBased on a design by Vitalik Buterin.\n\nTeam Ethereum++ includes: Eric Lombrozo, Marko Simovic, Subtly and several others.");
}
void Main::writeSettings() void Main::writeSettings()
{ {
QSettings s("ethereum", "alethzero"); QSettings s("ethereum", "alethzero");

1
alethzero/MainWin.h

@ -33,6 +33,7 @@ private slots:
void on_ourAccounts_doubleClicked(); void on_ourAccounts_doubleClicked();
void on_accounts_doubleClicked(); void on_accounts_doubleClicked();
void on_log_doubleClicked(); void on_log_doubleClicked();
void on_about_triggered();
void on_quit_triggered() { close(); } void on_quit_triggered() { close(); }
void refresh(); void refresh();

2
eth/main.cpp

@ -238,7 +238,7 @@ int main(int argc, char** argv)
c.stopMining(); c.stopMining();
else else
c.startMining(); c.startMining();
this_thread::sleep_for(chrono::milliseconds(100000)); this_thread::sleep_for(chrono::milliseconds(100));
} }
} }

4
libethereum/Client.cpp

@ -66,7 +66,7 @@ Client::~Client()
if (m_workState == Active) if (m_workState == Active)
m_workState = Deleting; m_workState = Deleting;
while (m_workState != Deleted) while (m_workState != Deleted)
this_thread::sleep_for(chrono::milliseconds(10000)); this_thread::sleep_for(chrono::milliseconds(10));
} }
void Client::startNetwork(short _listenPort, std::string const& _seedHost, short _port, NodeMode _mode, unsigned _peers, string const& _publicIP, bool _upnp) void Client::startNetwork(short _listenPort, std::string const& _seedHost, short _port, NodeMode _mode, unsigned _peers, string const& _publicIP, bool _upnp)
@ -160,7 +160,7 @@ void Client::work()
} }
} }
else else
this_thread::sleep_for(chrono::milliseconds(100000)); this_thread::sleep_for(chrono::milliseconds(100));
} }
void Client::lock() void Client::lock()

3
libethereum/PeerNetwork.cpp

@ -366,6 +366,7 @@ void PeerServer::seal(bytes& _b)
_b[5] = (len >> 16) & 0xff; _b[5] = (len >> 16) & 0xff;
_b[6] = (len >> 8) & 0xff; _b[6] = (len >> 8) & 0xff;
_b[7] = len & 0xff; _b[7] = len & 0xff;
cerr << "Sealed " << _b.size() << ": " << asHex(_b) << endl;
} }
void PeerSession::sealAndSend(RLPStream& _s) void PeerSession::sealAndSend(RLPStream& _s)
@ -920,7 +921,7 @@ bool PeerServer::process(BlockChain& _bc, TransactionQueue& _tq, Overlay& _o)
std::vector<PeerInfo> PeerServer::peers() const std::vector<PeerInfo> PeerServer::peers() const
{ {
const_cast<PeerServer*>(this)->pingAll(); const_cast<PeerServer*>(this)->pingAll();
this_thread::sleep_for(chrono::milliseconds(200000)); this_thread::sleep_for(chrono::milliseconds(200));
std::vector<PeerInfo> ret; std::vector<PeerInfo> ret;
for (auto& i: m_peers) for (auto& i: m_peers)
if (auto j = i.lock()) if (auto j = i.lock())

2
test/peer.cpp

@ -55,7 +55,7 @@ int peerTest(int argc, char** argv)
for (int i = 0; ; ++i) for (int i = 0; ; ++i)
{ {
this_thread::sleep_for(chrono::milliseconds(100000)); this_thread::sleep_for(chrono::milliseconds(100));
pn.process(ch); pn.process(ch);
if (!(i % 10)) if (!(i % 10))
pn.pingAll(); pn.pingAll();

Loading…
Cancel
Save