mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-28 08:54:13 -04:00
moved pre/post-ModDirectories to rsEvents
This commit is contained in:
parent
e6cacc4d34
commit
c70b84497a
5 changed files with 47 additions and 16 deletions
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include "rshare.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/RemoteDirModel.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include "gui/ShareManager.h"
|
||||
|
@ -35,6 +34,7 @@
|
|||
#include "gui/settings/rsharesettings.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "util/RsAction.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/rstime.h"
|
||||
#include "util/rsdir.h"
|
||||
|
@ -166,6 +166,7 @@ public:
|
|||
|
||||
SharedFilesDialog::~SharedFilesDialog()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
delete tree_model;
|
||||
delete flat_model;
|
||||
delete tree_proxyModel;
|
||||
|
@ -177,9 +178,36 @@ SharedFilesDialog::SharedFilesDialog(bool remote_mode, QWidget *parent)
|
|||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
NotifyQt *notify = NotifyQt::getInstance();
|
||||
connect(notify, SIGNAL(filesPreModChanged(bool)), this, SLOT(preModDirectories(bool)));
|
||||
connect(notify, SIGNAL(filesPostModChanged(bool)), this, SLOT(postModDirectories(bool)));
|
||||
//connect(notify, SIGNAL(filesPreModChanged(bool)), this, SLOT(preModDirectories(bool)));
|
||||
//connect(notify, SIGNAL(filesPostModChanged(bool)), this, SLOT(postModDirectories(bool)));
|
||||
|
||||
mEventHandlerId = 0;
|
||||
|
||||
rsEvents->registerEventsHandler([this](std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=](){
|
||||
|
||||
auto e = dynamic_cast<const RsSharedDirectoriesEvent*>(event.get());
|
||||
|
||||
switch(e->mEventCode)
|
||||
{
|
||||
case RsSharedDirectoriesEventCode::OWN_DIR_LIST_PROCESSING:
|
||||
preModDirectories(true);
|
||||
break;
|
||||
|
||||
case RsSharedDirectoriesEventCode::OWN_DIR_LIST_UPDATED:
|
||||
postModDirectories(true);
|
||||
break;
|
||||
|
||||
case RsSharedDirectoriesEventCode::FRIEND_DIR_LIST_UPDATED:
|
||||
preModDirectories(false);
|
||||
postModDirectories(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
};}, this);
|
||||
}, mEventHandlerId,RsEventType::SHARED_DIRECTORIES);
|
||||
|
||||
connect(ui.viewType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCurrentViewModel(int)));
|
||||
connect(ui.dirTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( spawnCustomPopupMenu( QPoint ) ) );
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#ifndef _SHAREDFILESDIALOG_H
|
||||
#define _SHAREDFILESDIALOG_H
|
||||
|
||||
#include <retroshare/rsevents.h>
|
||||
#include "ui_SharedFilesDialog.h"
|
||||
|
||||
#include <retroshare-gui/RsAutoUpdatePage.h>
|
||||
|
@ -145,6 +146,8 @@ protected:
|
|||
QString lastFilterString;
|
||||
QString mLastFilterText ;
|
||||
RsProtectedTimer* mFilterTimer;
|
||||
|
||||
RsEventsHandlerId_t mEventHandlerId ;
|
||||
};
|
||||
|
||||
class LocalSharedFilesDialog : public SharedFilesDialog
|
||||
|
|
|
@ -549,25 +549,25 @@ void NotifyQt::notifyListChange(int list, int type)
|
|||
#endif
|
||||
emit friendsChanged() ;
|
||||
break;
|
||||
#endif
|
||||
case NOTIFY_LIST_DIRLIST_LOCAL:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received files changed" << std::endl ;
|
||||
#endif
|
||||
emit filesPostModChanged(true) ; /* Local */
|
||||
break;
|
||||
case NOTIFY_LIST_CHAT_LOBBY_INVITATION:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received files changed" << std::endl ;
|
||||
#endif
|
||||
emit chatLobbyInviteReceived() ; /* Local */
|
||||
break;
|
||||
case NOTIFY_LIST_DIRLIST_FRIENDS:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received files changed" << std::endl ;
|
||||
#endif
|
||||
emit filesPostModChanged(false) ; /* Local */
|
||||
break;
|
||||
#endif
|
||||
case NOTIFY_LIST_CHAT_LOBBY_INVITATION:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received files changed" << std::endl ;
|
||||
#endif
|
||||
emit chatLobbyInviteReceived() ; /* Local */
|
||||
break;
|
||||
case NOTIFY_LIST_CONFIG:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received config changed" << std::endl ;
|
||||
|
@ -653,13 +653,13 @@ void NotifyQt::notifyListPreChange(int list, int /*type*/)
|
|||
case NOTIFY_LIST_FRIENDS:
|
||||
emit friendsChanged() ;
|
||||
break;
|
||||
#endif
|
||||
case NOTIFY_LIST_DIRLIST_FRIENDS:
|
||||
emit filesPreModChanged(false) ; /* remote */
|
||||
break ;
|
||||
case NOTIFY_LIST_DIRLIST_LOCAL:
|
||||
emit filesPreModChanged(true) ; /* local */
|
||||
break;
|
||||
#endif
|
||||
case NOTIFY_LIST_SEARCHLIST:
|
||||
break;
|
||||
case NOTIFY_LIST_CHANNELLIST:
|
||||
|
|
|
@ -105,7 +105,7 @@ class NotifyQt: public QObject, public NotifyClient
|
|||
// as they get queued by Qt.
|
||||
//
|
||||
void hashingInfoChanged(const QString&) const ;
|
||||
void filesPreModChanged(bool) const ;
|
||||
// void filesPreModChanged(bool) const ;
|
||||
void filesPostModChanged(bool) const ;
|
||||
// void transfersChanged() const ;
|
||||
// void friendsChanged() const ;
|
||||
|
|
|
@ -728,7 +728,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||
// QObject::connect(notify,SIGNAL(deferredSignatureHandlingRequested()),notify,SLOT(handleSignatureEvent()),Qt::QueuedConnection) ;
|
||||
QObject::connect(notify,SIGNAL(chatLobbyTimeShift(int)),notify,SLOT(handleChatLobbyTimeShift(int)),Qt::QueuedConnection) ;
|
||||
QObject::connect(notify,SIGNAL(diskFull(int,int)) ,w ,SLOT(displayDiskSpaceWarning(int,int))) ;
|
||||
QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w ,SLOT(postModDirectories(bool)) ,Qt::QueuedConnection ) ;
|
||||
// QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w ,SLOT(postModDirectories(bool)) ,Qt::QueuedConnection ) ;
|
||||
// QObject::connect(notify,SIGNAL(transfersChanged()) ,w->transfersDialog ,SLOT(insertTransfers() )) ;
|
||||
QObject::connect(notify,SIGNAL(publicChatChanged(int)) ,w->friendsDialog ,SLOT(publicChatChanged(int) ));
|
||||
QObject::connect(notify,SIGNAL(neighboursChanged()) ,w->friendsDialog->networkDialog ,SLOT(securedUpdateDisplay())) ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue