From 2a758dd88079299cfd5a68ec68c5df37af8c921f Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 26 Nov 2016 19:19:15 +0100 Subject: [PATCH] changed shared files tree header when updating --- libretroshare/src/file_sharing/p3filelists.cc | 8 ++++---- retroshare-gui/src/gui/RemoteDirModel.cpp | 13 +++++++++++-- retroshare-gui/src/gui/RemoteDirModel.h | 2 ++ retroshare-gui/src/gui/SharedFilesDialog.cpp | 2 ++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index fe7f0c62d..534b5b19d 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -1458,7 +1458,7 @@ void p3FileDatabase::handleDirSyncResponse(RsFileListsSyncResponseItem *sitem) else if(item->flags & RsFileListsItem::FLAGS_SYNC_DIR_CONTENT) { #ifdef DEBUG_P3FILELISTS - std::cerr << " Item contains directory data. Deserialising/Updating." << std::endl; + P3FILELISTS_DEBUG() << " Item contains directory data. Deserialising/Updating." << std::endl; #endif RS_STACK_MUTEX(mFLSMtx) ; @@ -1467,12 +1467,12 @@ void p3FileDatabase::handleDirSyncResponse(RsFileListsSyncResponseItem *sitem) RsServer::notify()->notifyListPreChange(NOTIFY_LIST_DIRLIST_FRIENDS, 0); // notify the GUI if the hierarchy has changed mLastDataRecvTS = now; } - std::cerr << "Performing update of directory index " << std::hex << entry_index << std::dec << " from friend " << item->PeerId() << std::endl; +#ifdef DEBUG_P3FILELISTS + P3FILELISTS_DEBUG() << "Performing update of directory index " << std::hex << entry_index << std::dec << " from friend " << item->PeerId() << std::endl; +#endif if(mRemoteDirectories[fi]->deserialiseUpdateDirEntry(entry_index,item->directory_content_data)) - { mRemoteDirectories[fi]->lastSweepTime() = now - DELAY_BETWEEN_REMOTE_DIRECTORIES_SWEEP + 10 ; // force re-sweep in 10 secs, so as to fasten updated - } else P3FILELISTS_ERROR() << "(EE) Cannot deserialise dir entry. ERROR. "<< std::endl; diff --git a/retroshare-gui/src/gui/RemoteDirModel.cpp b/retroshare-gui/src/gui/RemoteDirModel.cpp index fe7a10fa5..8584d496a 100644 --- a/retroshare-gui/src/gui/RemoteDirModel.cpp +++ b/retroshare-gui/src/gui/RemoteDirModel.cpp @@ -62,6 +62,7 @@ RetroshareDirModel::RetroshareDirModel(bool mode, QObject *parent) mDirDetails.ref = (void*)intptr_t(0xffffffff) ; mLastRemote = false ; + mUpdating = false; } // QAbstractItemModel::setSupportedDragActions() was replaced by virtual QAbstractItemModel::supportedDragActions() @@ -758,9 +759,15 @@ QVariant TreeStyle_RDM::headerData(int section, Qt::Orientation orientation, int { case 0: if (RemoteMode) - return tr("Friends Directories"); + if(mUpdating) + return tr("Friends Directories [updating...]"); + else + return tr("Friends Directories"); else - return tr("My Directories"); + if(mUpdating) + return tr("My Directories [updating...]"); + else + return tr("My Directories"); case 1: return tr("Size"); case 2: @@ -981,6 +988,7 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const void RetroshareDirModel::preMods() { emit layoutAboutToBeChanged(); + mUpdating = true ; #if QT_VERSION < 0x050000 reset(); #else @@ -997,6 +1005,7 @@ void RetroshareDirModel::preMods() void RetroshareDirModel::postMods() { // emit layoutAboutToBeChanged(); + mUpdating = false ; #if QT_VERSION >= 0x040600 beginResetModel(); #endif diff --git a/retroshare-gui/src/gui/RemoteDirModel.h b/retroshare-gui/src/gui/RemoteDirModel.h index 7c40b1f07..2e8a9ef0d 100644 --- a/retroshare-gui/src/gui/RemoteDirModel.h +++ b/retroshare-gui/src/gui/RemoteDirModel.h @@ -156,6 +156,8 @@ class RetroshareDirModel : public QAbstractItemModel mutable DirDetails mDirDetails ; mutable bool mLastRemote ; mutable time_t mLastReq; + + bool mUpdating ; }; // This class shows the classical hierarchical directory view of shared files diff --git a/retroshare-gui/src/gui/SharedFilesDialog.cpp b/retroshare-gui/src/gui/SharedFilesDialog.cpp index bb2c97ad0..2914dce4b 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.cpp +++ b/retroshare-gui/src/gui/SharedFilesDialog.cpp @@ -883,7 +883,9 @@ void SharedFilesDialog::preModDirectories(bool local) if (isRemote() == local) return; +#ifdef DEBUG_SHARED_FILES_DIALOG std::cerr << "About to modify directories. Local=" << local << ". Temporarily disabling sorting" << std::endl; +#endif ui.dirTreeView->setSortingEnabled(false);