mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-10-11 21:10:53 -04:00
cleaned up dead code in notifyQt
This commit is contained in:
parent
17cbf5da30
commit
7621142c34
2 changed files with 2 additions and 698 deletions
|
@ -116,127 +116,8 @@ NotifyQt::NotifyQt() : cDialog(NULL)
|
|||
else
|
||||
RsQThreadUtils::postToObject([=](){ async_handleIncomingEvent(event); }, this );
|
||||
}, mEventHandlerId); // No event type means we expect to catch all possible events
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
// register to allow sending over Qt::QueuedConnection
|
||||
qRegisterMetaType<ChatId>("ChatId");
|
||||
qRegisterMetaType<ChatMessage>("ChatMessage");
|
||||
qRegisterMetaType<RsGxsChanges>("RsGxsChanges");
|
||||
qRegisterMetaType<RsGxsId>("RsGxsId");
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void NotifyQt::notifyErrorMsg(int list, int type, std::string msg)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
emit errorOccurred(list,type,QString::fromUtf8(msg.c_str())) ;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyChatMessage(const ChatMessage &msg)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "notifyQt: Received chat message " << std::endl ;
|
||||
#endif
|
||||
emit chatMessageReceived(msg);
|
||||
}
|
||||
|
||||
void NotifyQt::notifyOwnAvatarChanged()
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "Notifyqt:: notified that own avatar changed" << std::endl ;
|
||||
#endif
|
||||
emit ownAvatarChanged() ;
|
||||
}
|
||||
|
||||
class SignatureEventData
|
||||
{
|
||||
public:
|
||||
SignatureEventData(const void *_data,int32_t _len,unsigned int _signlen, std::string _reason)
|
||||
{
|
||||
// We need a new memory chnk because there's no guarranty _sign nor _signlen are not in the stack
|
||||
|
||||
sign = (unsigned char *)rs_malloc(_signlen) ;
|
||||
|
||||
if(!sign)
|
||||
{
|
||||
signlen = NULL ;
|
||||
signature_result = SELF_SIGNATURE_RESULT_FAILED ;
|
||||
return ;
|
||||
}
|
||||
|
||||
signlen = new unsigned int ;
|
||||
*signlen = _signlen ;
|
||||
signature_result = SELF_SIGNATURE_RESULT_PENDING ;
|
||||
data = rs_malloc(_len) ;
|
||||
|
||||
if(!data)
|
||||
{
|
||||
len = 0 ;
|
||||
return ;
|
||||
}
|
||||
len = _len ;
|
||||
memcpy(data,_data,len) ;
|
||||
reason = _reason ;
|
||||
}
|
||||
|
||||
~SignatureEventData()
|
||||
{
|
||||
free(sign) ;
|
||||
delete signlen ;
|
||||
free(data) ;
|
||||
}
|
||||
|
||||
void performSignature()
|
||||
{
|
||||
if(rsPeers->gpgSignData(data,len,sign,signlen,reason))
|
||||
signature_result = SELF_SIGNATURE_RESULT_SUCCESS ;
|
||||
else
|
||||
signature_result = SELF_SIGNATURE_RESULT_FAILED ;
|
||||
}
|
||||
|
||||
void *data ;
|
||||
uint32_t len ;
|
||||
unsigned char *sign ;
|
||||
unsigned int *signlen ;
|
||||
int signature_result ; // 0=pending, 1=done, 2=failed/cancelled.
|
||||
std::string reason ;
|
||||
};
|
||||
|
||||
void NotifyQt::handleSignatureEvent()
|
||||
{
|
||||
std::cerr << "NotifyQt:: performing a deferred signature in the main GUI thread." << std::endl;
|
||||
|
||||
static bool working = false ;
|
||||
|
||||
if(!working)
|
||||
{
|
||||
working = true ;
|
||||
|
||||
for(std::map<std::string,SignatureEventData*>::const_iterator it(_deferred_signature_queue.begin());it!=_deferred_signature_queue.end();++it)
|
||||
it->second->performSignature() ;
|
||||
|
||||
working = false ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool NotifyQt::GUI_askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad)
|
||||
{
|
||||
RsAutoUpdatePage::lockAllEvents() ;
|
||||
|
@ -326,363 +207,6 @@ bool NotifyQt::GUI_askForPluginConfirmation(const std::string& plugin_file_name,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void NotifyQt::notifyDiscInfoChanged()
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "Notifyqt:: notified that discoveryInfo changed" << std::endl ;
|
||||
#endif
|
||||
|
||||
emit discInfoChanged() ;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyDiskFull(uint32_t loc,uint32_t size_in_mb)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
std::cerr << "Notifyqt:: notified that disk is full" << std::endl ;
|
||||
|
||||
emit diskFull(loc,size_in_mb) ;
|
||||
}
|
||||
|
||||
/* peer has changed the state */
|
||||
void NotifyQt::notifyPeerStatusChanged(const std::string& peer_id, uint32_t state)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "Notifyqt:: notified that peer " << peer_id << " has changed the state to " << state << std::endl;
|
||||
#endif
|
||||
|
||||
emit peerStatusChanged(QString::fromStdString(peer_id), state);
|
||||
}
|
||||
|
||||
/* one or more peers has changed the states */
|
||||
void NotifyQt::notifyPeerStatusChangedSummary()
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "Notifyqt:: notified that one peer has changed the state" << std::endl;
|
||||
#endif
|
||||
|
||||
emit peerStatusChangedSummary();
|
||||
}
|
||||
|
||||
void NotifyQt::notifyOwnStatusMessageChanged()
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "Notifyqt:: notified that own avatar changed" << std::endl ;
|
||||
#endif
|
||||
emit ownStatusMessageChanged() ;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyPeerHasNewAvatar(std::string peer_id)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "notifyQt: notification of new avatar." << std::endl ;
|
||||
#endif
|
||||
emit peerHasNewAvatar(QString::fromStdString(peer_id)) ;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyCustomState(const std::string& peer_id, const std::string& status_string)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "notifyQt: Received custom status string notification" << std::endl ;
|
||||
#endif
|
||||
emit peerHasNewCustomStateString(QString::fromStdString(peer_id), QString::fromUtf8(status_string.c_str())) ;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyChatLobbyTimeShift(int shift)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "notifyQt: Received chat lobby time shift message: shift = " << shift << std::endl;
|
||||
#endif
|
||||
emit chatLobbyTimeShift(shift) ;
|
||||
}
|
||||
|
||||
void NotifyQt::handleChatLobbyTimeShift(int /*shift*/)
|
||||
{
|
||||
return ; // we say nothing. The help dialog of lobbies explains this already.
|
||||
static bool already = false ;
|
||||
|
||||
if(!already)
|
||||
{
|
||||
already = true ;
|
||||
|
||||
QString string = tr("For the chat lobbies to work properly, the time of your computer needs to be correct. Please check that this is the case (A possible time shift of several minutes was detected with your friends).") ;
|
||||
|
||||
QMessageBox::warning(NULL,tr("Please check your system clock."),string) ;
|
||||
}
|
||||
}
|
||||
|
||||
void NotifyQt::notifyChatLobbyEvent(uint64_t lobby_id,uint32_t event_type,const RsGxsId& nickname,const std::string& str)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "notifyQt: Received chat lobby event message: lobby #" << std::hex << lobby_id << std::dec << ", event=" << event_type << ", str=\"" << str << "\"" << std::endl ;
|
||||
#endif
|
||||
emit chatLobbyEvent(lobby_id,event_type,nickname,QString::fromUtf8(str.c_str())) ;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyChatStatus(const ChatId& chat_id,const std::string& status_string)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "notifyQt: Received chat status string: " << status_string << std::endl ;
|
||||
#endif
|
||||
emit chatStatusChanged(chat_id, QString::fromUtf8(status_string.c_str()));
|
||||
}
|
||||
|
||||
void NotifyQt::notifyChatCleared(const ChatId& chat_id)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "notifyQt: Received chat cleared." << std::endl ;
|
||||
#endif
|
||||
emit chatCleared(chat_id);
|
||||
}
|
||||
|
||||
//void NotifyQt::notifyTurtleSearchResult(uint32_t /*search_id*/,const std::list<TurtleGxsInfo>& /*found_groups*/)
|
||||
//{
|
||||
// std::cerr << "(EE) missing code to handle GXS turtle search result." << std::endl;
|
||||
//}
|
||||
|
||||
// Mai 2023: distant turtle search now uses RsEvents.
|
||||
void NotifyQt::notifyTurtleSearchResult(const RsPeerId& pid,uint32_t search_id,const std::list<TurtleFileInfo>& files)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "in notify search result..." << std::endl ;
|
||||
#endif
|
||||
|
||||
for(std::list<TurtleFileInfo>::const_iterator it(files.begin());it!=files.end();++it)
|
||||
{
|
||||
FileDetail det ;
|
||||
det.rank = 0 ;
|
||||
det.age = 0 ;
|
||||
det.name = (*it).name ;
|
||||
det.hash = (*it).hash ;
|
||||
det.size = (*it).size ;
|
||||
det.id = pid ;
|
||||
|
||||
emit gotTurtleSearchResult(search_id,det) ;
|
||||
}
|
||||
}
|
||||
|
||||
void NotifyQt::notifyHistoryChanged(uint32_t msgId, int type)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
emit historyChanged(msgId, type);
|
||||
}
|
||||
|
||||
void NotifyQt::notifyListChange(int list, int type)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "NotifyQt::notifyListChange()" << std::endl;
|
||||
#endif
|
||||
switch(list)
|
||||
{
|
||||
case NOTIFY_LIST_NEIGHBOURS:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received neighbours changed" << std::endl ;
|
||||
#endif
|
||||
emit neighboursChanged();
|
||||
break;
|
||||
case NOTIFY_LIST_FRIENDS:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received friends changed" << std::endl ;
|
||||
#endif
|
||||
emit friendsChanged() ;
|
||||
break;
|
||||
case NOTIFY_LIST_DIRLIST_LOCAL:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received files changed" << std::endl ;
|
||||
#endif
|
||||
emit filesPostModChanged(true) ; /* Local */
|
||||
break;
|
||||
case NOTIFY_LIST_DIRLIST_FRIENDS:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received files changed" << std::endl ;
|
||||
#endif
|
||||
emit filesPostModChanged(false) ; /* 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_CONFIG:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received config changed" << std::endl ;
|
||||
#endif
|
||||
emit configChanged() ;
|
||||
break ;
|
||||
|
||||
case NOTIFY_LIST_SEARCHLIST:
|
||||
break;
|
||||
case NOTIFY_LIST_CHANNELLIST:
|
||||
break;
|
||||
case NOTIFY_LIST_TRANSFERLIST:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received transfer changed" << std::endl ;
|
||||
#endif
|
||||
emit transfersChanged() ;
|
||||
break;
|
||||
|
||||
case NOTIFY_LIST_FORUMLIST_LOCKED:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received forum msg changed" << std::endl ;
|
||||
#endif
|
||||
emit forumsChanged(); // use connect with Qt::QueuedConnection
|
||||
break;
|
||||
case NOTIFY_LIST_CHANNELLIST_LOCKED:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received channel msg changed" << std::endl ;
|
||||
#endif
|
||||
emit channelsChanged(type); // use connect with Qt::QueuedConnection
|
||||
break;
|
||||
case NOTIFY_LIST_PUBLIC_CHAT:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received public chat changed" << std::endl ;
|
||||
#endif
|
||||
emit publicChatChanged(type);
|
||||
break;
|
||||
case NOTIFY_LIST_PRIVATE_INCOMING_CHAT:
|
||||
case NOTIFY_LIST_PRIVATE_OUTGOING_CHAT:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received private chat changed" << std::endl ;
|
||||
#endif
|
||||
emit privateChatChanged(list, type);
|
||||
break;
|
||||
|
||||
case NOTIFY_LIST_CHAT_LOBBY_LIST:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received notify chat lobby list" << std::endl;
|
||||
#endif
|
||||
emit lobbyListChanged();
|
||||
break;
|
||||
case NOTIFY_LIST_GROUPLIST:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received groups changed" << std::endl ;
|
||||
#endif
|
||||
emit groupsChanged(type);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyListPreChange(int list, int /*type*/)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "NotifyQt::notifyListPreChange()" << std::endl;
|
||||
#endif
|
||||
switch(list)
|
||||
{
|
||||
case NOTIFY_LIST_NEIGHBOURS:
|
||||
break;
|
||||
case NOTIFY_LIST_FRIENDS:
|
||||
emit friendsChanged() ;
|
||||
break;
|
||||
case NOTIFY_LIST_DIRLIST_FRIENDS:
|
||||
emit filesPreModChanged(false) ; /* remote */
|
||||
break ;
|
||||
case NOTIFY_LIST_DIRLIST_LOCAL:
|
||||
emit filesPreModChanged(true) ; /* local */
|
||||
break;
|
||||
case NOTIFY_LIST_SEARCHLIST:
|
||||
break;
|
||||
case NOTIFY_LIST_CHANNELLIST:
|
||||
break;
|
||||
case NOTIFY_LIST_TRANSFERLIST:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
void NotifyQt::enable()
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
|
@ -702,16 +226,6 @@ void NotifyQt::sync_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
|
|||
|
||||
void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
static bool already_updated = false ; // these only update once at start because they may already have been set before
|
||||
// the gui is running, then they get updated by callbacks.
|
||||
#warning Is this needed anymore??
|
||||
if(!already_updated)
|
||||
{
|
||||
emit configChanged();
|
||||
|
||||
already_updated = true ;
|
||||
}
|
||||
|
||||
/* Finally Check for PopupMessages / System Error Messages */
|
||||
|
||||
RsNotifyPopupFlags popupflags = (RsNotifyPopupFlags)Settings->getNotifyFlags();
|
||||
|
@ -791,16 +305,6 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
|
|||
return;
|
||||
}
|
||||
|
||||
// Probably an old thing. To be removed.
|
||||
// case RS_POPUP_ENCRYPTED_MSG:
|
||||
// SoundManager::play(SOUND_MESSAGE_ARRIVED);
|
||||
//
|
||||
// if ((popupflags & RS_POPUP_MSG) && !_disableAllToaster)
|
||||
// {
|
||||
// toaster = new ToasterItem(new MessageToaster("", tr("Encrypted message"), QString("[%1]").arg(tr("Encrypted message"))));
|
||||
// }
|
||||
// break;
|
||||
|
||||
auto ev5 = dynamic_cast<const RsChatServiceEvent*>(event.get());
|
||||
|
||||
if(ev5)
|
||||
|
@ -895,19 +399,6 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
|
|||
}
|
||||
}
|
||||
|
||||
// if (rsNotify->NotifyLogMessage(sysid, type, title, msg))
|
||||
// {
|
||||
// /* make a log message */
|
||||
// std::string logMesString = title + " " + msg;
|
||||
// switch(type)
|
||||
// {
|
||||
// case RS_SYS_ERROR:
|
||||
// case RS_SYS_WARNING:
|
||||
// case RS_SYS_INFO:
|
||||
// emit logInfoChanged(QString::fromUtf8(logMesString.c_str()));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
/* Now start the waiting toasters */
|
||||
startWaitingToasters();
|
||||
}
|
||||
|
@ -972,7 +463,7 @@ void NotifyQt::testToasters(RsNotifyPopupFlags notifyFlags, /*RshareSettings::en
|
|||
toaster->margin = margin;
|
||||
|
||||
/* add toaster to waiting list */
|
||||
//QMutexLocker lock(&waitingToasterMutex);
|
||||
|
||||
waitingToasterList.push_back(toaster);
|
||||
}
|
||||
}
|
||||
|
@ -1015,7 +506,7 @@ void NotifyQt::testToaster(QString tag, ToasterNotify *toasterNotify, /*RshareSe
|
|||
toaster->margin = margin;
|
||||
|
||||
/* add toaster to waiting list */
|
||||
//QMutexLocker lock(&waitingToasterMutex);
|
||||
|
||||
waitingToasterList.push_back(toaster);
|
||||
}
|
||||
}
|
||||
|
@ -1049,8 +540,6 @@ void NotifyQt::notifySettingsChanged()
|
|||
void NotifyQt::startWaitingToasters()
|
||||
{
|
||||
{
|
||||
//QMutexLocker lock(&waitingToasterMutex);
|
||||
|
||||
if (waitingToasterList.empty()) {
|
||||
/* No toasters are waiting */
|
||||
return;
|
||||
|
@ -1058,8 +547,6 @@ void NotifyQt::startWaitingToasters()
|
|||
}
|
||||
|
||||
{
|
||||
//QMutexLocker lock(&runningToasterMutex);
|
||||
|
||||
if (runningToasterList.size() >= 3) {
|
||||
/* Don't show more than 3 toasters at once */
|
||||
return;
|
||||
|
@ -1069,8 +556,6 @@ void NotifyQt::startWaitingToasters()
|
|||
ToasterItem *toaster = NULL;
|
||||
|
||||
{
|
||||
//QMutexLocker lock(&waitingToasterMutex);
|
||||
|
||||
if (waitingToasterList.size()) {
|
||||
/* Take one toaster of the waiting list */
|
||||
toaster = waitingToasterList.front();
|
||||
|
@ -1079,7 +564,6 @@ void NotifyQt::startWaitingToasters()
|
|||
}
|
||||
|
||||
if (toaster) {
|
||||
//QMutexLocker lock(&runningToasterMutex);
|
||||
|
||||
/* Calculate positions */
|
||||
QSize size = toaster->widget->size();
|
||||
|
@ -1208,130 +692,6 @@ void NotifyQt::runningTick()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void NotifyQt::addToaster(uint notifyFlags, const std::string& id, const std::string& title, const std::string& msg)
|
||||
{
|
||||
uint pos = 0;
|
||||
|
||||
while (notifyFlags) {
|
||||
uint type = notifyFlags & (1 << pos);
|
||||
notifyFlags &= ~(1 << pos);
|
||||
++pos;
|
||||
|
||||
ToasterItem *toaster = NULL;
|
||||
|
||||
uint popupflags = Settings->getNotifyFlags();
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case RS_POPUP_ENCRYPTED_MSG:
|
||||
SoundManager::play(SOUND_MESSAGE_ARRIVED);
|
||||
|
||||
if ((popupflags & RS_POPUP_MSG) && !_disableAllToaster)
|
||||
{
|
||||
toaster = new ToasterItem(new MessageToaster(std::string(), tr("Unknown title"), QString("[%1]").arg(tr("Encrypted message"))));
|
||||
}
|
||||
break;
|
||||
case RS_POPUP_MSG:
|
||||
SoundManager::play(SOUND_MESSAGE_ARRIVED);
|
||||
|
||||
if ((popupflags & RS_POPUP_MSG) && !_disableAllToaster)
|
||||
{
|
||||
toaster = new ToasterItem(new MessageToaster(id, QString::fromUtf8(title.c_str()), QString::fromUtf8(msg.c_str())));
|
||||
}
|
||||
break;
|
||||
case RS_POPUP_CONNECT:
|
||||
SoundManager::play(SOUND_USER_ONLINE);
|
||||
|
||||
if ((popupflags & RS_POPUP_CONNECT) && !_disableAllToaster)
|
||||
{
|
||||
toaster = new ToasterItem(new OnlineToaster(RsPeerId(id)));
|
||||
}
|
||||
break;
|
||||
case RS_POPUP_DOWNLOAD:
|
||||
SoundManager::play(SOUND_DOWNLOAD_COMPLETE);
|
||||
|
||||
if ((popupflags & RS_POPUP_DOWNLOAD) && !_disableAllToaster)
|
||||
{
|
||||
toaster = new ToasterItem(new DownloadToaster(RsFileHash(id)));
|
||||
}
|
||||
break;
|
||||
case RS_POPUP_CHAT:
|
||||
if ((popupflags & RS_POPUP_CHAT) && !_disableAllToaster)
|
||||
{
|
||||
// TODO: fix for distant chat, look up if dstant chat uses RS_POPUP_CHAT
|
||||
ChatDialog *chatDialog = ChatDialog::getChat(ChatId(RsPeerId(id)));
|
||||
ChatWidget *chatWidget;
|
||||
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) {
|
||||
// do not show when active
|
||||
break;
|
||||
}
|
||||
toaster = new ToasterItem(new ChatToaster(RsPeerId(id), QString::fromUtf8(msg.c_str())));
|
||||
}
|
||||
break;
|
||||
case RS_POPUP_GROUPCHAT:
|
||||
#ifdef RS_DIRECT_CHAT
|
||||
if ((popupflags & RS_POPUP_GROUPCHAT) && !_disableAllToaster)
|
||||
{
|
||||
MainWindow *mainWindow = MainWindow::getInstance();
|
||||
if (mainWindow && mainWindow->isActiveWindow() && !mainWindow->isMinimized()) {
|
||||
if (MainWindow::getActivatePage() == MainWindow::Friends) {
|
||||
if (FriendsDialog::isGroupChatActive()) {
|
||||
// do not show when active
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
toaster = new ToasterItem(new GroupChatToaster(RsPeerId(id), QString::fromUtf8(msg.c_str())));
|
||||
}
|
||||
#endif // RS_DIRECT_CHAT
|
||||
break;
|
||||
case RS_POPUP_CHATLOBBY:
|
||||
if ((popupflags & RS_POPUP_CHATLOBBY) && !_disableAllToaster)
|
||||
{
|
||||
ChatId chat_id(id);
|
||||
|
||||
ChatDialog *chatDialog = ChatDialog::getChat(chat_id);
|
||||
ChatWidget *chatWidget;
|
||||
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) {
|
||||
// do not show when active
|
||||
break;
|
||||
}
|
||||
|
||||
ChatLobbyDialog *chatLobbyDialog = dynamic_cast<ChatLobbyDialog*>(chatDialog);
|
||||
|
||||
RsGxsId sender(title);
|
||||
if (!chatLobbyDialog || chatLobbyDialog->isParticipantMuted(sender))
|
||||
break; // participant is muted
|
||||
|
||||
toaster = new ToasterItem(new ChatLobbyToaster(chat_id.toLobbyId(), sender, QString::fromUtf8(msg.c_str())));
|
||||
}
|
||||
break;
|
||||
case RS_POPUP_CONNECT_ATTEMPT:
|
||||
if ((popupflags & RS_POPUP_CONNECT_ATTEMPT) && !_disableAllToaster)
|
||||
{
|
||||
// id = gpgid
|
||||
// title = ssl name
|
||||
// msg = peer id
|
||||
toaster = new ToasterItem(new FriendRequestToaster(RsPgpId(id), QString::fromUtf8(title.c_str()), RsPeerId(msg)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (toaster) {
|
||||
/* init attributes */
|
||||
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
|
||||
|
||||
/* add toaster to waiting list */
|
||||
//QMutexLocker lock(&waitingToasterMutex);
|
||||
waitingToasterList.push_back(toaster);
|
||||
}
|
||||
}
|
||||
/* Now start the waiting toasters */
|
||||
startWaitingToasters();
|
||||
}
|
||||
#endif
|
||||
|
||||
void NotifyQt::displayErrorMessage(RsNotifySysFlags type,const QString& title,const QString& error_msg)
|
||||
{
|
||||
/* make a warning message */
|
||||
|
|
|
@ -59,35 +59,6 @@ class NotifyQt: public QObject
|
|||
|
||||
virtual ~NotifyQt() = default;
|
||||
|
||||
// void setNetworkDialog(NetworkDialog *c) { cDialog = c; }
|
||||
|
||||
// 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 notifyChatMessage(const ChatMessage& /* msg */);
|
||||
// virtual void notifyChatStatus(const ChatId &chat_id,const std::string& status_string);
|
||||
// virtual void notifyChatCleared(const ChatId &chat_id);
|
||||
// virtual void notifyCustomState(const std::string& peer_id, const std::string& status_string);
|
||||
//#ifdef TO_REMOVE
|
||||
// virtual void notifyTurtleSearchResult(const RsPeerId &pid, uint32_t search_id, const std::list<TurtleFileInfo>& found_files);
|
||||
//#endif
|
||||
// virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleGxsInfo>& found_groups);
|
||||
// virtual void notifyPeerHasNewAvatar(std::string peer_id) ;
|
||||
// virtual void notifyOwnAvatarChanged() ;
|
||||
// virtual void notifyChatLobbyEvent(uint64_t /* lobby id */, uint32_t /* event type */, const RsGxsId & /*nickname*/, const std::string& /* any string */) ;
|
||||
// virtual void notifyChatLobbyTimeShift(int time_shift) ;
|
||||
|
||||
// virtual void notifyOwnStatusMessageChanged() ;
|
||||
// virtual void notifyDiskFull(uint32_t loc,uint32_t size_in_mb) ;
|
||||
/* peer has changed the state */
|
||||
// virtual void notifyPeerStatusChanged(const std::string& peer_id, uint32_t state);
|
||||
/* one or more peers has changed the states */
|
||||
// virtual void notifyPeerStatusChangedSummary();
|
||||
|
||||
// virtual void notifyHistoryChanged(uint32_t msgId, int type);
|
||||
|
||||
// virtual void notifyDiscInfoChanged() ;
|
||||
|
||||
virtual bool GUI_askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad);
|
||||
virtual bool GUI_askForPluginConfirmation(const std::string& plugin_filename, const RsFileHash& plugin_file_hash,bool first_time);
|
||||
|
||||
|
@ -107,34 +78,10 @@ class NotifyQt: public QObject
|
|||
// It's beneficial to send info to the GUI using signals, because signals are thread-safe
|
||||
// as they get queued by Qt.
|
||||
//
|
||||
// void hashingInfoChanged(const QString&) const ;
|
||||
// void filesPreModChanged(bool) const ;
|
||||
// void filesPostModChanged(bool) const ;
|
||||
// void transfersChanged() const ;
|
||||
// void friendsChanged() const ;
|
||||
// void lobbyListChanged() const ;
|
||||
// void chatLobbyEvent(qulonglong,int,const RsGxsId&,const QString&) ;
|
||||
// void neighboursChanged() const ;
|
||||
void configChanged() const ;
|
||||
void logInfoChanged(const QString&) const ;
|
||||
// void chatStatusChanged(const ChatId&,const QString&) const ;
|
||||
void chatCleared(const ChatId&) const ;
|
||||
// void peerHasNewCustomStateString(const QString& /* peer_id */, const QString& /* status_string */) const ;
|
||||
// void peerHasNewAvatar(const QString& peer_id) const ;
|
||||
// void ownAvatarChanged() const ;
|
||||
// void ownStatusMessageChanged() const ;
|
||||
// void errorOccurred(int,int,const QString&) const ;
|
||||
// void diskFull(int,int) const ;
|
||||
// void peerStatusChanged(const QString& /* peer_id */, int /* status */);
|
||||
// void peerStatusChangedSummary() const;
|
||||
// void gxsChange(const RsGxsChanges& /* changes */);
|
||||
// void chatMessageReceived(ChatMessage msg);
|
||||
// void groupsChanged(int type) const ;
|
||||
// void discInfoChanged() const ;
|
||||
void historyChanged(uint msgId, int type);
|
||||
// void chatLobbyInviteReceived() ;
|
||||
// void deferredSignatureHandlingRequested() ;
|
||||
// void chatLobbyTimeShift(int time_shift) ;
|
||||
void connectionWithoutCert();
|
||||
|
||||
/* Notify from GUI */
|
||||
|
@ -148,8 +95,6 @@ class NotifyQt: public QObject
|
|||
|
||||
private slots:
|
||||
void runningTick();
|
||||
// void handleSignatureEvent() ;
|
||||
// void handleChatLobbyTimeShift(int) ;
|
||||
|
||||
private:
|
||||
NotifyQt();
|
||||
|
@ -164,7 +109,6 @@ class NotifyQt: public QObject
|
|||
|
||||
void startWaitingToasters();
|
||||
|
||||
// QMutex waitingToasterMutex; // for lock of the waiting toaster list
|
||||
QList<ToasterItem*> waitingToasterList;
|
||||
|
||||
QTimer *runningToasterTimer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue