TimerPool fixoutManipulator
git-svn-id: svn://db.shs.com.ru/pip@88 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -13,7 +13,7 @@ PIBaseTransfer::PIBaseTransfer(): crc(standardCRC_16()), diag(false) {
|
||||
replies_cnt = send_queue = 0;
|
||||
timeout_ = 10.;
|
||||
diag.setDisconnectTimeout(timeout_);
|
||||
CONNECTU(&diag, qualityChanged, this, diagChanged);
|
||||
//CONNECTU(&diag, qualityChanged, this, diagChanged);
|
||||
packets_count = 32;
|
||||
setPacketSize(4096);
|
||||
randomize();
|
||||
|
||||
@@ -17,6 +17,12 @@ Daemon::Remote::Remote(const PIString & n): PIThread() {
|
||||
}
|
||||
|
||||
|
||||
Daemon::Remote::~Remote() {
|
||||
ft.stop();
|
||||
waitForFinish(1000);
|
||||
}
|
||||
|
||||
|
||||
void Daemon::Remote::sendFiles(const PIString & dir, const PIStringList & fl) {
|
||||
_fl = fl;
|
||||
piForeach (PIString & s, _fl)
|
||||
@@ -35,6 +41,7 @@ void Daemon::Remote::run() {
|
||||
Daemon::TileFileProgress::TileFileProgress(): PIScreenTile() {
|
||||
size_policy = PIScreenTypes::Fixed;
|
||||
ft = 0;
|
||||
rec = false;
|
||||
setMargins(1, 1, 1, 1);
|
||||
spacing = 1;
|
||||
back_format.color_back = Yellow;
|
||||
@@ -73,7 +80,6 @@ void Daemon::TileFileProgress::sizeHint(int & w, int & h) const {
|
||||
|
||||
|
||||
void Daemon::TileFileProgress::drawEvent(PIScreenDrawer * d) {
|
||||
|
||||
if (ft) {
|
||||
label_file->content[0].first = ft->stateString() + " " + ft->curFile();
|
||||
if (!label_file->content[0].first.isEmpty())
|
||||
@@ -104,9 +110,10 @@ void Daemon::TileFileProgress::show(PIFileTransfer * f) {
|
||||
|
||||
void Daemon::TileFileProgress::close(bool ok) {
|
||||
ft = 0;
|
||||
::screen.setDialogTile(0);
|
||||
if (!ok)
|
||||
showInfo("Achtung! Alarm!! Error!!!");
|
||||
else
|
||||
::screen.setDialogTile(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -308,13 +315,21 @@ void Daemon::fmKeyEvent(PIKbdListener::KeyEvent key) {
|
||||
|
||||
|
||||
void Daemon::fmActionRequest(bool remote_tile, FileManager::Action type, PIVariant data) {
|
||||
Remote * r = 0;
|
||||
switch (type) {
|
||||
case FileManager::Copy:
|
||||
if (remote_tile) {
|
||||
} else {
|
||||
Remote * r = remotes.value(conn_name, 0);
|
||||
r = remotes.value(conn_name, 0);
|
||||
if (!r) return;
|
||||
if (remote_tile) {
|
||||
PIByteArray ba;
|
||||
ba << int(CopyFiles) << fm.selectedRemote();
|
||||
r->ft.setDirectory(fm.localDir());
|
||||
send(conn_name, ba);
|
||||
tile_file_progress->rec = true;
|
||||
tile_file_progress->show(&(r->ft));
|
||||
} else {
|
||||
r->sendFiles(fm.localDir() + PIDir::separator, data.toStringList());
|
||||
tile_file_progress->rec = false;
|
||||
tile_file_progress->show(&(r->ft));
|
||||
}
|
||||
break;
|
||||
@@ -408,7 +423,17 @@ void Daemon::closeFileDialog(const PIString & name, bool ok) {
|
||||
piCout << "CLOSE" << tile_file_progress->conn_name << name << ok;
|
||||
if (tile_file_progress->conn_name != name) return;
|
||||
tile_file_progress->close(ok);
|
||||
if (ok) requestChDir(".");
|
||||
if (ok) {
|
||||
if (tile_file_progress->rec) {
|
||||
fm.remoteTile()->setFocus();
|
||||
fm.clearSelectionRemote();
|
||||
fm.updateLocalDir();
|
||||
} else {
|
||||
fm.localTile()->setFocus();
|
||||
fm.clearSelectionLocal();
|
||||
requestChDir(".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -457,6 +482,16 @@ void Daemon::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||
fm.remoteRestoreDir();
|
||||
}
|
||||
break;
|
||||
case CopyFiles:
|
||||
r = remotes.value(from);
|
||||
if (!r) return;
|
||||
{
|
||||
PIStringList files;
|
||||
ba >> files;
|
||||
//piCout << "send" << files << "from" << r->dir_my.absolutePath();
|
||||
r->sendFiles(r->dir_my.absolutePath() + PIDir::separator, files);
|
||||
}
|
||||
break;
|
||||
case FileTransfer:
|
||||
r = remotes.value(from);
|
||||
if (r) r->received(ba);
|
||||
|
||||
@@ -69,6 +69,7 @@ private:
|
||||
PIOBJECT_SUBCLASS(Remote, PIThread)
|
||||
public:
|
||||
Remote(const PIString & n = PIString());
|
||||
~Remote();
|
||||
void sendFiles(const PIString & dir, const PIStringList & fl);
|
||||
EVENT_HANDLER1(void, ftSendRequest, PIByteArray &, data) {PIByteArray h; h << int(FileTransfer); data.insert(0, h); sendRequest(name(), data);}
|
||||
EVENT_HANDLER1(void, ftReceived, bool, ok) {receiveFinished(name(), ok);}
|
||||
@@ -98,6 +99,7 @@ private:
|
||||
void resizeEvent(int w, int h);
|
||||
void sizeHint(int & w, int & h) const;
|
||||
void drawEvent(PIScreenDrawer * d);
|
||||
bool rec;
|
||||
PIString conn_name;
|
||||
EVENT_HANDLER2(void, tileEvent, PIScreenTile *, t, PIScreenTypes::TileEvent, e);
|
||||
};
|
||||
|
||||
@@ -12,6 +12,7 @@ public:
|
||||
FileManager(Daemon * d = 0);
|
||||
|
||||
PIScreenTile * tile() const;
|
||||
PIScreenTile * localTile() const {return panels[0];}
|
||||
PIScreenTile * remoteTile() const {return panels[1];}
|
||||
|
||||
enum Action {MkDir, Remove, Copy, Move};
|
||||
@@ -27,6 +28,9 @@ public:
|
||||
void remoteSaveDir();
|
||||
void remoteRestoreDir();
|
||||
void readingRemote() const {panels[1]->showReading();}
|
||||
void updateLocalDir() {panels[0]->updateDir();}
|
||||
void clearSelectionLocal() {panels[0]->selected.clear();}
|
||||
void clearSelectionRemote() {panels[1]->selected.clear();}
|
||||
|
||||
EVENT(menuRequest)
|
||||
EVENT3(actionRequest, bool, remote_tile, FileManager::Action, type, PIVariant, data)
|
||||
|
||||
Reference in New Issue
Block a user