mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-18 12:24:22 -05:00
Changed PreMods() and postMods() functions into signals in notifyqt so that these functions do not cause a data race when called from a callback in libretroshare.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1038 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
516b1684f9
commit
543e27a1da
@ -359,27 +359,21 @@ void SharedFilesDialog::openfolder()
|
||||
|
||||
void SharedFilesDialog::preModDirectories(bool update_local)
|
||||
{
|
||||
std::cerr << "SharedFilesDialog::preModDirectories called with update_local = " << update_local << std::endl ;
|
||||
if (update_local)
|
||||
{
|
||||
localModel->preMods();
|
||||
}
|
||||
else
|
||||
{
|
||||
model->preMods();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SharedFilesDialog::ModDirectories(bool update_local)
|
||||
void SharedFilesDialog::postModDirectories(bool update_local)
|
||||
{
|
||||
std::cerr << "SharedFilesDialog::postModDirectories called with update_local = " << update_local << std::endl ;
|
||||
if (update_local)
|
||||
{
|
||||
localModel->postMods();
|
||||
}
|
||||
else
|
||||
{
|
||||
model->postMods();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,13 +41,14 @@ public:
|
||||
SharedFilesDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
/* For handling the model updates */
|
||||
void preModDirectories(bool update_local);
|
||||
void ModDirectories(bool update_local);
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
/* For handling the model updates */
|
||||
void preModDirectories(bool update_local);
|
||||
void postModDirectories(bool update_local);
|
||||
|
||||
void checkUpdate();
|
||||
void forceCheck();
|
||||
|
||||
|
@ -153,6 +153,8 @@ int main(int argc, char *argv[])
|
||||
// avoid clashes between infos from threads.
|
||||
//
|
||||
QObject::connect(notify,SIGNAL(hashingInfo(const QString&)),w,SLOT(updateHashingInfo(const QString&))) ;
|
||||
QObject::connect(notify,SIGNAL(filesPreMod( bool)),w->sharedfilesDialog,SLOT(preModDirectories(bool))) ;
|
||||
QObject::connect(notify,SIGNAL(filesPostMod( bool)),w->sharedfilesDialog,SLOT(postModDirectories(bool))) ;
|
||||
|
||||
/* only show window, if not startMinimized */
|
||||
if (!startMinimised)
|
||||
|
@ -62,7 +62,8 @@ void NotifyQt::notifyListChange(int list, int type)
|
||||
//displayFriends();
|
||||
break;
|
||||
case NOTIFY_LIST_DIRLIST:
|
||||
displayDirectories();
|
||||
emit filesPostMod(false) ; /* Remote */
|
||||
emit filesPostMod(true) ; /* Local */
|
||||
break;
|
||||
case NOTIFY_LIST_SEARCHLIST:
|
||||
//displaySearch();
|
||||
@ -97,7 +98,8 @@ void NotifyQt::notifyListPreChange(int list, int type)
|
||||
//preDisplayFriends();
|
||||
break;
|
||||
case NOTIFY_LIST_DIRLIST:
|
||||
preDisplayDirectories();
|
||||
emit filesPreMod(false) ; /* remote */
|
||||
emit filesPreMod(true) ; /* local */
|
||||
break;
|
||||
case NOTIFY_LIST_SEARCHLIST:
|
||||
//preDisplaySearch();
|
||||
@ -279,53 +281,6 @@ void NotifyQt::displayFriends()
|
||||
mWindow->insertPeers();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void NotifyQt::preDisplayDirectories()
|
||||
{
|
||||
//iface->lockData(); /* Lock Interface */
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::ostringstream out;
|
||||
out << "NotifyQt::preDisplayDirectories()" << std::endl;
|
||||
|
||||
std::cerr << out.str();
|
||||
#endif
|
||||
|
||||
//iface->unlockData(); /* UnLock Interface */
|
||||
|
||||
if (dDialog)
|
||||
{
|
||||
dDialog->preModDirectories(false); /* Remote */
|
||||
dDialog->preModDirectories(true); /* Local */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NotifyQt::displayDirectories()
|
||||
{
|
||||
//iface->lockData(); /* Lock Interface */
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::ostringstream out;
|
||||
out << "NotifyQt::displayDirectories()" << std::endl;
|
||||
|
||||
std::cerr << out.str();
|
||||
#endif
|
||||
|
||||
//iface->unlockData(); /* UnLock Interface */
|
||||
|
||||
|
||||
if (dDialog)
|
||||
{
|
||||
dDialog->ModDirectories(false); /* Remote */
|
||||
dDialog->ModDirectories(true); /* Local */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NotifyQt::displaySearch()
|
||||
{
|
||||
iface->lockData(); /* Lock Interface */
|
||||
|
@ -20,35 +20,40 @@ class MessengerWindow;
|
||||
//class NotifyQt: public NotifyBase, public QObject
|
||||
class NotifyQt: public QObject, public NotifyBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
NotifyQt() : cDialog(NULL), pDialog(NULL),
|
||||
dDialog(NULL), tDialog(NULL),
|
||||
hDialog(NULL), mDialog(NULL),
|
||||
sDialog(NULL), mWindow(NULL)
|
||||
Q_OBJECT
|
||||
public:
|
||||
NotifyQt() : cDialog(NULL), pDialog(NULL),
|
||||
dDialog(NULL), tDialog(NULL),
|
||||
hDialog(NULL), mDialog(NULL),
|
||||
sDialog(NULL), mWindow(NULL)
|
||||
{ return; }
|
||||
|
||||
virtual ~NotifyQt() { return; }
|
||||
virtual ~NotifyQt() { return; }
|
||||
|
||||
void setNetworkDialog(NetworkDialog *c) { cDialog = c; }
|
||||
void setPeersDialog(PeersDialog *p) { pDialog = p; }
|
||||
void setDirDialog(SharedFilesDialog *d) { dDialog = d; }
|
||||
void setTransfersDialog(TransfersDialog *t) { tDialog = t; }
|
||||
void setChatDialog(ChatDialog *m) { hDialog = m; }
|
||||
void setMessagesDialog(MessagesDialog *m) { mDialog = m; }
|
||||
void setChannelsDialog(ChannelsDialog *s) { sDialog = s; }
|
||||
void setMessengerWindow(MessengerWindow *mw) { mWindow = mw; }
|
||||
void setNetworkDialog(NetworkDialog *c) { cDialog = c; }
|
||||
void setPeersDialog(PeersDialog *p) { pDialog = p; }
|
||||
void setDirDialog(SharedFilesDialog *d) { dDialog = d; }
|
||||
void setTransfersDialog(TransfersDialog *t) { tDialog = t; }
|
||||
void setChatDialog(ChatDialog *m) { hDialog = m; }
|
||||
void setMessagesDialog(MessagesDialog *m) { mDialog = m; }
|
||||
void setChannelsDialog(ChannelsDialog *s) { sDialog = s; }
|
||||
void setMessengerWindow(MessengerWindow *mw) { mWindow = mw; }
|
||||
|
||||
void setRsIface(RsIface *i) { iface = i; }
|
||||
void setRsIface(RsIface *i) { iface = i; }
|
||||
|
||||
virtual void notifyListPreChange(int list, int type);
|
||||
virtual void notifyListChange(int list, int type);
|
||||
virtual void notifyErrorMsg(int list, int sev, std::string msg);
|
||||
virtual void notifyChat();
|
||||
virtual void notifyHashingInfo(std::string fileinfo);
|
||||
virtual void notifyListPreChange(int list, int type);
|
||||
virtual void notifyListChange(int list, int type);
|
||||
virtual void notifyErrorMsg(int list, int sev, std::string msg);
|
||||
virtual void notifyChat();
|
||||
virtual void notifyHashingInfo(std::string fileinfo);
|
||||
|
||||
signals:
|
||||
// It's beneficial to send info to the GUI using signals, because signals are thread-safe
|
||||
// as they get queued by Qt.
|
||||
//
|
||||
void hashingInfo(const QString&) const ;
|
||||
void filesPreMod(bool) const ;
|
||||
void filesPostMod(bool) const ;
|
||||
|
||||
public slots:
|
||||
|
||||
@ -56,34 +61,34 @@ virtual void notifyHashingInfo(std::string fileinfo);
|
||||
|
||||
private:
|
||||
|
||||
void displayNeighbours();
|
||||
void displayFriends();
|
||||
void displayDirectories();
|
||||
void displaySearch();
|
||||
void displayChat();
|
||||
void displayMessages();
|
||||
void displayChannels();
|
||||
void displayTransfers();
|
||||
void displayNeighbours();
|
||||
void displayFriends();
|
||||
// void displayDirectories();
|
||||
void displaySearch();
|
||||
void displayChat();
|
||||
void displayMessages();
|
||||
void displayChannels();
|
||||
void displayTransfers();
|
||||
|
||||
void preDisplayNeighbours();
|
||||
void preDisplayFriends();
|
||||
void preDisplayDirectories();
|
||||
void preDisplaySearch();
|
||||
void preDisplayMessages();
|
||||
void preDisplayChannels();
|
||||
void preDisplayTransfers();
|
||||
void preDisplayNeighbours();
|
||||
void preDisplayFriends();
|
||||
// void preDisplayDirectories();
|
||||
void preDisplaySearch();
|
||||
void preDisplayMessages();
|
||||
void preDisplayChannels();
|
||||
void preDisplayTransfers();
|
||||
|
||||
/* so we can update windows */
|
||||
NetworkDialog *cDialog;
|
||||
PeersDialog *pDialog;
|
||||
SharedFilesDialog *dDialog;
|
||||
TransfersDialog *tDialog;
|
||||
ChatDialog *hDialog;
|
||||
MessagesDialog *mDialog;
|
||||
ChannelsDialog *sDialog;
|
||||
MessengerWindow *mWindow;
|
||||
/* so we can update windows */
|
||||
NetworkDialog *cDialog;
|
||||
PeersDialog *pDialog;
|
||||
SharedFilesDialog *dDialog;
|
||||
TransfersDialog *tDialog;
|
||||
ChatDialog *hDialog;
|
||||
MessagesDialog *mDialog;
|
||||
ChannelsDialog *sDialog;
|
||||
MessengerWindow *mWindow;
|
||||
|
||||
RsIface *iface;
|
||||
RsIface *iface;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user