BIG deep clean
This commit is contained in:
@@ -3,7 +3,6 @@ file(GLOB CPPS "*.cpp")
|
||||
file(GLOB HDRS "*.h")
|
||||
add_executable(pisd ${CPPS} ${HDRS})
|
||||
target_link_libraries(pisd pip pip_crypt)
|
||||
# apple_rpath_patch(pisd)
|
||||
if (DEFINED LIB)
|
||||
install(TARGETS pisd DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
else()
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
const char self_name[] = "__self__";
|
||||
extern PIScreen * screen;
|
||||
extern PISystemMonitor sys_mon;
|
||||
//bool Daemon::inited__ = false;
|
||||
|
||||
Daemon::Remote::Remote(const PIString & n): PIThread() {
|
||||
setName(n);
|
||||
@@ -279,10 +278,6 @@ Daemon::Daemon(): PIPeer(pisd_prefix + PISystemInfo::instance()->hostname + "_"
|
||||
dtimer.addDelimiter(5);
|
||||
dtimer.start(200);
|
||||
|
||||
//CONNECTU(&console, keyPressed, this, keyEvent)
|
||||
//dir.setDir("/home/peri4/Documents");
|
||||
//TileSimple * tl;
|
||||
|
||||
tile_root = new PIScreenTile();
|
||||
tile_root->direction = Vertical;
|
||||
|
||||
@@ -406,13 +401,6 @@ void Daemon::showTile(PIScreenTile * t, const PIString & header) {
|
||||
lock();
|
||||
if (!conn_name.isEmpty())
|
||||
tile_header->content[0].first.insert(0, PIString("Daemon \"") + connectedDaemon() + "\": ");
|
||||
/*PIString s;
|
||||
if (!conn_name.isEmpty())
|
||||
s = "Daemon \"" + connectedDaemon() + "\": ";
|
||||
s += header;
|
||||
tile_header->content.resize(1);
|
||||
tile_header->content[0].first = s;
|
||||
tile_header->content[0].second.flags = Bold;*/
|
||||
unlock();
|
||||
}
|
||||
|
||||
@@ -481,7 +469,6 @@ void Daemon::keyEvent(PIKbdListener::KeyEvent key) {
|
||||
|
||||
void Daemon::fmKeyEvent(PIKbdListener::KeyEvent key) {
|
||||
PIMutexLocker ml(remote_mutex);
|
||||
//Remote * r = remotes.value(conn_name);
|
||||
// piCoutObj << key.key << key.modifiers;
|
||||
switch (key.key) {
|
||||
case PIKbdListener::Return:
|
||||
@@ -619,17 +606,11 @@ PIString Daemon::connectedDaemon() const {
|
||||
|
||||
void Daemon::peerConnected(const PIString & p_name) {
|
||||
while (!inited__) piMSleep(PIP_MIN_MSLEEP*5);
|
||||
// PIMutexLocker ml(peers_mutex);
|
||||
/*piCout << "connected" << name;
|
||||
mode = 2;
|
||||
conn_name = name;*/
|
||||
if (!p_name.startsWith(pisd_prefix)) return;
|
||||
Remote * r = new Remote(p_name);
|
||||
piCoutObj << "peer connected" << p_name;
|
||||
// piCout << r->methodsEH() << this->methodsEH();
|
||||
CONNECTU(r, sendRequest, this, sendRequest)
|
||||
CONNECTU(r, receiveFinished, this, filesReceived)
|
||||
//CONNECTU(r, receiveFinished, this, closeFileDialog)
|
||||
CONNECTU(r, sendFinished, this, filesSended)
|
||||
CONNECTU(r, changeDirFinished, this, dirChanged)
|
||||
PIMutexLocker ml2(remote_mutex);
|
||||
@@ -661,9 +642,6 @@ void Daemon::filesReceived(const PIString & p_name, bool ok) {
|
||||
} else {
|
||||
piCout << "warning, files not received fromsended" << p_name;
|
||||
}
|
||||
// piCout << "try lock in filesReceived, now mutex is" << remote_mutex.isLocked();
|
||||
// PIMutexLocker ml(remote_mutex);
|
||||
// piCout << "lock reached";
|
||||
closeFileDialog(p_name, ok);
|
||||
Remote * r = remotes.value(p_name, 0);
|
||||
if (!r) return;
|
||||
@@ -710,22 +688,19 @@ void Daemon::closeFileDialog(const PIString & p_name, bool ok) {
|
||||
//piCout << "file transfer with" << p_name << (ok ? "success" : "failure");
|
||||
if (tile_file_progress->conn_name != p_name) return;
|
||||
tile_file_progress->close(ok);
|
||||
// if (ok) {
|
||||
if (tile_file_progress->rec) {
|
||||
fm.remoteTile()->setFocus();
|
||||
fm.clearSelectionRemote();
|
||||
fm.updateLocalDir();
|
||||
} else {
|
||||
fm.localTile()->setFocus();
|
||||
fm.clearSelectionLocal();
|
||||
requestChDir(".");
|
||||
}
|
||||
// }
|
||||
if (tile_file_progress->rec) {
|
||||
fm.remoteTile()->setFocus();
|
||||
fm.clearSelectionRemote();
|
||||
fm.updateLocalDir();
|
||||
} else {
|
||||
fm.localTile()->setFocus();
|
||||
fm.clearSelectionLocal();
|
||||
requestChDir(".");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Daemon::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||
//if (conn_name != from) return;
|
||||
// piCout << "rec" << data.size();
|
||||
if (data.size() < 4) return;
|
||||
PIMutexLocker ml(remote_mutex);
|
||||
@@ -748,7 +723,6 @@ void Daemon::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||
//piCout << "store to" << r->dir_my.absolutePath();
|
||||
piCoutObj << "cd to" << r->dir_my.absolutePath();
|
||||
r->updateDir();
|
||||
// sendDirToRemote(r);
|
||||
break;
|
||||
case ReplyHostInfo:
|
||||
ba >> info_other;
|
||||
@@ -760,7 +734,6 @@ void Daemon::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||
{
|
||||
PIVector<PIFile::FileInfo> fil;
|
||||
ba >> dir >> fil;
|
||||
// r->dir_remote.setDir(dir);
|
||||
fm.setRemoteDir(dir);
|
||||
fm.setRemoteContent(fil);
|
||||
fm.remoteRestoreDir();
|
||||
@@ -784,7 +757,6 @@ void Daemon::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||
ba >> files;
|
||||
//piCout << "send" << files << "from" << r->dir_my.absolutePath();
|
||||
r->removeFiles(files);
|
||||
//answer_dirs = true;
|
||||
}
|
||||
break;
|
||||
case MkDir:
|
||||
@@ -910,6 +882,4 @@ void Daemon::requestChDir(const PIString & d) {
|
||||
PIByteArray ba;
|
||||
ba << int(RequestChangeDir) << d;
|
||||
send(conn_name, ba);
|
||||
// bool ok = send(conn_name, ba);
|
||||
// piCout << "request chdir" << d << conn_name << r << ok;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include "file_manager.h"
|
||||
#include "shared.h"
|
||||
|
||||
//extern PIScreen * screen;
|
||||
|
||||
|
||||
FileManager::TileDir::TileDir(): TileList() {
|
||||
label_path = 0;
|
||||
@@ -155,7 +153,6 @@ void FileManager::TileDir::setContent(const PIVector<PIFile::FileInfo> & l) {
|
||||
|
||||
|
||||
void FileManager::TileDir::updateDir() {
|
||||
//if (!enabled) return;
|
||||
lock();
|
||||
int pc = cur, po = offset;
|
||||
showReading();
|
||||
@@ -172,7 +169,6 @@ void FileManager::TileDir::updateDir() {
|
||||
|
||||
|
||||
void FileManager::TileDir::buildNames() {
|
||||
//if (!enabled) return;
|
||||
lock();
|
||||
PIMutexLocker ml(e_mutex);
|
||||
content.clear();
|
||||
@@ -227,8 +223,6 @@ void FileManager::TileDir::resizeEvent(int w, int h) {
|
||||
|
||||
FileManager::FileManager() {
|
||||
setName("FileManager");
|
||||
//CONNECTU(screen, keyPressed, this, keyEvent)
|
||||
//dir.setDir("/home/peri4/Documents");
|
||||
TileSimple * tl;
|
||||
|
||||
tile_root = new PIScreenTile();
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
PIp System Daemon
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
PIP - Platform Independent Primitives
|
||||
PIP System Daemon
|
||||
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "pisingleapplication.h"
|
||||
@@ -35,7 +35,6 @@ _Init _pisd_init;
|
||||
|
||||
PISystemMonitor sys_mon;
|
||||
PIScreen * screen = 0;
|
||||
//FileManager file_manager;
|
||||
|
||||
|
||||
class MainMenu: public PITimer {
|
||||
@@ -63,10 +62,6 @@ public:
|
||||
mt->hide(); mt->name() = "local info";
|
||||
center->addTile(mt); mtiles << mt;
|
||||
|
||||
//mt = tfm = daemon_.fm.tile();
|
||||
mt->hide(); mt->name() = "file manager";
|
||||
center->addTile(mt); mtiles << mt;
|
||||
|
||||
mt = tdaemon = daemon_.tile();
|
||||
mt->hide(); mt->name() = "daemon";
|
||||
center->addTile(mt); mtiles << mt;
|
||||
@@ -129,7 +124,6 @@ public:
|
||||
ret->addTile(diag);
|
||||
diag->addTile(peerdiagdata_tl);
|
||||
diag->addTile(peerdiagservice_tl);
|
||||
// updatePeerInfo();
|
||||
return ret;
|
||||
}
|
||||
PIScreenTile * peerTile() {
|
||||
@@ -148,7 +142,6 @@ public:
|
||||
ret->addTile(peerinfo_tl);
|
||||
ret->addTile(addrs_tl);
|
||||
ret->addTile(peermap_tl);
|
||||
// updatePeerInfo();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -379,8 +372,6 @@ int main(int argc, char * argv[]) {
|
||||
args << "-a" << sip;
|
||||
if (!name.isEmpty())
|
||||
args << "-n" << name;
|
||||
//PIProcess p;
|
||||
//p.exec("/bin/readlink", PIStringList() << "/proc/self/exe");
|
||||
PIString exe;
|
||||
#ifdef WINDOWS
|
||||
exe = PISystemInfo::instance()->execCommand;
|
||||
@@ -391,12 +382,10 @@ int main(int argc, char * argv[]) {
|
||||
PIProcess::execIndependent(exe, args);
|
||||
return 0;
|
||||
}
|
||||
//cli.addArgument("");
|
||||
screen = new PIScreen(false);
|
||||
screen->setMouseEnabled(true);
|
||||
Daemon * daemon = new Daemon();
|
||||
if (!sip.isEmpty()) daemon->setTcpServerIP(sip);
|
||||
//sys_mon.startOnProcess(12404);
|
||||
screen->enableExitCapture(PIKbdListener::F10);
|
||||
if (!name.isEmpty())
|
||||
daemon->changeName(pisd_prefix + name);
|
||||
|
||||
@@ -11,7 +11,6 @@ TileTerminal::TileTerminal(const PIString & n): PIScreenTile(n) {
|
||||
|
||||
void TileTerminal::drawEvent(PIScreenDrawer * d) {
|
||||
//piCout << "draw" << visible;
|
||||
//PIVector<PIVector<PIScreenTypes::Cell> > c = term->content();
|
||||
d->fillRect(x_, y_, x_ + width_, y_ + height_, cells);
|
||||
}
|
||||
|
||||
@@ -25,20 +24,11 @@ bool TileTerminal::keyEvent(PIKbdListener::KeyEvent key) {
|
||||
return true;
|
||||
}
|
||||
//piCout << "key";
|
||||
/*if (!term) return false;
|
||||
if (PITerminal::isSpecialKey(key.key)) term->write((PIKbdListener::SpecialKey)key.key, key.modifiers);
|
||||
else {
|
||||
PIByteArray ba;
|
||||
ba << PIChar(key.key).toConcole1Byte();
|
||||
term->write(ba);
|
||||
}*/
|
||||
keyPressed(key);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void TileTerminal::resizeEvent(int w, int h) {
|
||||
/*if (!term) return;
|
||||
term->resize(w, h);*/
|
||||
resizeRequest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user