PIFile: applyFileInfo

PIPeer: fixed
pisd work progress ...

git-svn-id: svn://db.shs.com.ru/pip@20 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2015-03-12 13:28:27 +00:00
parent 3ed292a602
commit fdb48aba64
14 changed files with 346 additions and 148 deletions

View File

@@ -43,6 +43,7 @@ public:
cur_peer = -1;
TileSimple * tile = new TileSimple("title");
tile->content << TileSimple::Row("pisd (PI System Daemon, PIP version " + PIPVersion() + ")", CellFormat(Black, Transparent));
tile->content << TileSimple::Row("This daemon: \"" + daemon_.thisDaemonName() + "\"", CellFormat(Black, Transparent));
tile->back_format.color_back = Yellow;
tile->size_policy = Fixed;
screen.rootTile()->addTile(tile);
@@ -131,27 +132,28 @@ public:
, CellFormat());
piForeachC(PIPeer::PeerInfo &p , daemon_.allPeers())
peers_tl->content << TileList::Row(p.name + " | " + PIString::fromNumber(p.dist) +
" | " + PIString::fromNumber(p.ping()) +
" | " + PIString::fromNumber(p.addresses.size_s()) +
" | " + PIString::fromBool(p.isNeighbour())
, CellFormat());
" | " + PIString::fromNumber(p.ping()) +
" | " + PIString::fromNumber(p.addresses.size_s()) +
" | " + PIString::fromBool(p.isNeighbour())
, CellFormat());
PIPeer::PeerInfo pi = daemon_.selfInfo();
if (cur_peer >= 0 && cur_peer < daemon_.allPeers().size_s()) pi = daemon_.allPeers()[cur_peer];
peerinfo_tl->content << TileSimple::Row("Name: " + pi.name, CellFormat());
peerinfo_tl->content << TileSimple::Row("Addreses: " + PIString::fromNumber(pi.addresses.size()), CellFormat());
piForeachC(PIPeer::PeerInfo::Address &a , pi.addresses)
addrs_tl->content << TileList::Row(a.address + " | " + a.netmask +
" | " + PIString::fromNumber(a.ping) +
" | " + PIString::fromNumber(a.last_ping.toSeconds()) +
" | " + PIString::fromBool(a.isAvailable()), CellFormat());
typedef PIPair<PIString, PIVector <PIPeer::PeerInfo* > > PeerPair;
PIStringList peermap;
" | " + PIString::fromNumber(a.ping) +
" | " + PIString::fromNumber(a.last_ping.toSeconds()) +
" | " + PIString::fromBool(a.isAvailable()), CellFormat());
typedef PIPair<PIString, PIVector <PIPeer::PeerInfo* > > PeerPair;
PIStringList peermap;
piForeachC(PeerPair &p , daemon_._peerMap()) {
PIString s = p.first + " | ";
piForeachC(PIPeer::PeerInfo * pp, p.second) s += "->" + pp->name;
peermap << s;
}
piForeachC(PIString &s , peermap)
peers_tl->content << TileList::Row(s, CellFormat());
peermap_tl->content << TileList::Row(s, CellFormat());
screen.unlock();
}
void tick(void* data_, int delimiter) {
@@ -171,8 +173,8 @@ public:
switch (e.data.toInt()) {
case 0: tinfo->show(); break;
case 1: tfm->show(); break;
case 2: tdaemon->show(); break;
case 3: tpeer->show(); break;
case 2: daemon_.showMainList(); tdaemon->show(); break;
case 3: tpeer->show(); peers_tl->setFocus(); break;
case 4: PIKbdListener::exiting = true; break;
}
}
@@ -187,7 +189,8 @@ public:
}
}
EVENT_HANDLER1(void, keyEvent, PIKbdListener::KeyEvent, e) {
if (e.key == PIKbdListener::Esc) menuRequest();
if (tpeer->visible || tinfo->visible)
if (e.key == PIKbdListener::Esc) menuRequest();
//piCout << "key" << e.key;
}
PIScreenTile * tmenu, * tinfo, * tfm, * tdaemon, * tpeer;