mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-21 05:39:11 -04:00
Merge 9b881a6214
into ddb4300a60
This commit is contained in:
commit
f5c55516a6
52 changed files with 728 additions and 564 deletions
|
@ -35,6 +35,7 @@
|
|||
#include "settings/rsharesettings.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "util/QtVersion.h"
|
||||
|
||||
#include "retroshare/rsmsgs.h"
|
||||
|
@ -105,9 +106,39 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
|
|||
myInviteYesButton = NULL;
|
||||
myInviteIdChooser = NULL;
|
||||
|
||||
QObject::connect( NotifyQt::getInstance(), SIGNAL(lobbyListChanged()), SLOT(lobbyChanged()));
|
||||
QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,RsGxsId,QString)), this, SLOT(displayChatLobbyEvent(qulonglong,int,RsGxsId,QString)));
|
||||
QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyInviteReceived()), this, SLOT(readChatLobbyInvites()));
|
||||
//QObject::connect( NotifyQt::getInstance(), SIGNAL(lobbyListChanged()), SLOT(lobbyChanged()));
|
||||
//QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,RsGxsId,QString)), this, SLOT(displayChatLobbyEvent(qulonglong,int,RsGxsId,QString)));
|
||||
//QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyInviteReceived()), this, SLOT(readChatLobbyInvites()));
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=](){
|
||||
auto ev = dynamic_cast<const RsChatStatusEvent *>(event.get());
|
||||
|
||||
switch(ev->mEventCode)
|
||||
{
|
||||
case RsChatStatusEventCode::CHAT_LOBBY_INVITE_RECEIVED:
|
||||
readChatLobbyInvites();
|
||||
break;
|
||||
|
||||
case RsChatStatusEventCode::CHAT_LOBBY_LIST_CHANGED:
|
||||
lobbyChanged();
|
||||
break;
|
||||
|
||||
case RsChatStatusEventCode::CHAT_LOBBY_EVENT_PEER_LEFT:
|
||||
case RsChatStatusEventCode::CHAT_LOBBY_EVENT_PEER_STATUS:
|
||||
case RsChatStatusEventCode::CHAT_LOBBY_EVENT_PEER_JOINED:
|
||||
case RsChatStatusEventCode::CHAT_LOBBY_EVENT_PEER_CHANGE_NICKNAME:
|
||||
case RsChatStatusEventCode::CHAT_LOBBY_EVENT_KEEP_ALIVE:
|
||||
|
||||
handleChatLobbyEvent(ev->mLobbyId,ev->mEventCode,ev->mGxsId,QString::fromUtf8(ev->str.c_str()));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}, this );
|
||||
}, mEventHandlerId, RsEventType::CHAT_SERVICE );
|
||||
|
||||
QObject::connect( ui.lobbyTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(lobbyTreeWidgetCustomPopupMenu(QPoint)));
|
||||
QObject::connect( ui.lobbyTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
|
||||
|
@ -236,6 +267,7 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
|
|||
|
||||
ChatLobbyWidget::~ChatLobbyWidget()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
// save settings
|
||||
processSettings(false);
|
||||
|
||||
|
@ -1158,10 +1190,10 @@ void ChatLobbyWidget::itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)
|
|||
subscribeChatLobbyAtItem(item);
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::displayChatLobbyEvent(qulonglong lobby_id, int event_type, const RsGxsId &gxs_id, const QString& str)
|
||||
void ChatLobbyWidget::handleChatLobbyEvent(uint64_t lobby_id, RsChatStatusEventCode event_type, const RsGxsId &gxs_id, const QString& str)
|
||||
{
|
||||
if (ChatLobbyDialog *cld = dynamic_cast<ChatLobbyDialog*>(ChatDialog::getExistingChat(ChatId(lobby_id)))) {
|
||||
cld->displayLobbyEvent(event_type, gxs_id, str);
|
||||
cld->handleLobbyEvent(event_type, gxs_id, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ protected slots:
|
|||
void unsubscribeItem();
|
||||
void itemDoubleClicked(QTreeWidgetItem *item, int column);
|
||||
void updateCurrentLobby() ;
|
||||
void displayChatLobbyEvent(qulonglong lobby_id, int event_type, const RsGxsId& gxs_id, const QString& str);
|
||||
void handleChatLobbyEvent(uint64_t lobby_id, RsChatStatusEventCode event_type, const RsGxsId &gxs_id, const QString& str);
|
||||
void readChatLobbyInvites();
|
||||
void showLobby(QTreeWidgetItem *lobby_item) ;
|
||||
void showBlankPage(ChatLobbyId id, bool subscribed = false) ;
|
||||
|
@ -151,5 +151,7 @@ private:
|
|||
|
||||
/* UI - from Designer */
|
||||
Ui::ChatLobbyWidget ui;
|
||||
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -118,7 +118,7 @@ FriendServerControl::FriendServerControl(QWidget *parent)
|
|||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this );
|
||||
}, mEventHandlerId_peer, RsEventType::PEER_CONNECTION );
|
||||
}, mEventHandlerId_peer, RsEventType::PEER_STATE );
|
||||
}
|
||||
|
||||
void FriendServerControl::onAutoAddFriends(bool b)
|
||||
|
|
|
@ -168,7 +168,7 @@ public:
|
|||
|
||||
/* Color definitions (for standard see default.qss) */
|
||||
QColor mTextColorGroup;
|
||||
QColor mTextColorStatus[RS_STATUS_COUNT];
|
||||
QColor mTextColorStatus[(int)RsStatusValue::RS_STATUS_COUNT];
|
||||
|
||||
void setIdentities(const std::list<RsGroupMetaData>& identities_meta);
|
||||
|
||||
|
|
|
@ -30,9 +30,11 @@
|
|||
#include <QtDebug>
|
||||
#include <QMenuBar>
|
||||
|
||||
#include <retroshare/rsplugin.h>
|
||||
#include <retroshare/rsconfig.h>
|
||||
#include <util/argstream.h>
|
||||
#include "retroshare/rsplugin.h"
|
||||
#include "retroshare/rsconfig.h"
|
||||
#include "retroshare/rsevents.h"
|
||||
#include "util/argstream.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
#include "gui/common/MacDockIconHandler.h"
|
||||
|
@ -340,10 +342,27 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
|
|||
|
||||
createNotifyIcons();
|
||||
|
||||
/* calculate friend count */
|
||||
/* intialize friend count */
|
||||
updateFriends();
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateFriends()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateFriends()));
|
||||
|
||||
// connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateFriends()));
|
||||
// connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateFriends()));
|
||||
|
||||
mEventHandlerId = 0;
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=]()
|
||||
{
|
||||
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||
|
||||
if(!fe)
|
||||
return;
|
||||
|
||||
updateFriends();
|
||||
}
|
||||
, this );
|
||||
}, mEventHandlerId, RsEventType::FRIEND_LIST );
|
||||
|
||||
loadOwnStatus();
|
||||
|
||||
|
@ -362,6 +381,29 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
|
|||
settingsChanged();
|
||||
|
||||
mFontSizeHandler.registerFontSize(ui->listWidget, 1.5f);
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=](){
|
||||
auto ev = dynamic_cast<const RsSystemErrorEvent *>(event.get());
|
||||
|
||||
switch(ev->mEventCode)
|
||||
{
|
||||
case RsSystemErrorEventCode::TIME_SHIFT_PROBLEM:
|
||||
std::cerr << "Time shift problem notification. Ignored." << std::endl;
|
||||
break;
|
||||
|
||||
case RsSystemErrorEventCode::DISK_SPACE_ERROR:
|
||||
displayDiskSpaceWarning(ev->mDiskErrorLocation,ev->mDiskErrorSizeLimit);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}, this );
|
||||
}, mEventHandlerId, RsEventType::SYSTEM_ERROR );
|
||||
|
||||
}
|
||||
|
||||
/** Destructor. */
|
||||
|
@ -372,6 +414,8 @@ MainWindow::~MainWindow()
|
|||
Settings->setValueToGroup("MainWindow", "SplitterState", ui->splitter->saveState());
|
||||
Settings->setValueToGroup("MainWindow", "State", saveState());
|
||||
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
|
||||
delete statusComboBox;
|
||||
delete peerstatus;
|
||||
delete natstatus;
|
||||
|
@ -1451,7 +1495,7 @@ MainWindow::retranslateUi()
|
|||
}
|
||||
|
||||
/* set status object to status value */
|
||||
static void setStatusObject(QObject *pObject, int nStatus)
|
||||
static void setStatusObject(QObject *pObject, RsStatusValue nStatus)
|
||||
{
|
||||
QMenu *pMenu = dynamic_cast<QMenu*>(pObject);
|
||||
if (pMenu) {
|
||||
|
@ -1462,7 +1506,7 @@ static void setStatusObject(QObject *pObject, int nStatus)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (pAction->data().toInt() == nStatus) {
|
||||
if (pAction->data().toInt() == (int)nStatus) {
|
||||
pAction->setChecked(true);
|
||||
break;
|
||||
}
|
||||
|
@ -1472,7 +1516,7 @@ static void setStatusObject(QObject *pObject, int nStatus)
|
|||
RSComboBox *pComboBox = dynamic_cast<RSComboBox*>(pObject);
|
||||
if (pComboBox) {
|
||||
/* set index of combobox */
|
||||
int nIndex = pComboBox->findData(nStatus, Qt::UserRole);
|
||||
int nIndex = pComboBox->findData((int)nStatus, Qt::UserRole);
|
||||
if (nIndex != -1) {
|
||||
pComboBox->setCurrentIndex(nIndex);
|
||||
}
|
||||
|
@ -1535,20 +1579,20 @@ void MainWindow::initializeStatusObject(QObject *pObject, bool bConnect)
|
|||
/* initialize menu */
|
||||
QActionGroup *pGroup = new QActionGroup(pMenu);
|
||||
|
||||
QAction *pAction = new QAction(QIcon(StatusDefs::imageStatus(RS_STATUS_ONLINE)), StatusDefs::name(RS_STATUS_ONLINE), pMenu);
|
||||
pAction->setData(RS_STATUS_ONLINE);
|
||||
QAction *pAction = new QAction(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_ONLINE)), StatusDefs::name(RsStatusValue::RS_STATUS_ONLINE), pMenu);
|
||||
pAction->setData((int)RsStatusValue::RS_STATUS_ONLINE);
|
||||
pAction->setCheckable(true);
|
||||
pMenu->addAction(pAction);
|
||||
pGroup->addAction(pAction);
|
||||
|
||||
pAction = new QAction(QIcon(StatusDefs::imageStatus(RS_STATUS_BUSY)), StatusDefs::name(RS_STATUS_BUSY), pMenu);
|
||||
pAction->setData(RS_STATUS_BUSY);
|
||||
pAction = new QAction(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_BUSY)), StatusDefs::name(RsStatusValue::RS_STATUS_BUSY), pMenu);
|
||||
pAction->setData((int)RsStatusValue::RS_STATUS_BUSY);
|
||||
pAction->setCheckable(true);
|
||||
pMenu->addAction(pAction);
|
||||
pGroup->addAction(pAction);
|
||||
|
||||
pAction = new QAction(QIcon(StatusDefs::imageStatus(RS_STATUS_AWAY)), StatusDefs::name(RS_STATUS_AWAY), pMenu);
|
||||
pAction->setData(RS_STATUS_AWAY);
|
||||
pAction = new QAction(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_AWAY)), StatusDefs::name(RsStatusValue::RS_STATUS_AWAY), pMenu);
|
||||
pAction->setData((int)RsStatusValue::RS_STATUS_AWAY);
|
||||
pAction->setCheckable(true);
|
||||
pMenu->addAction(pAction);
|
||||
pGroup->addAction(pAction);
|
||||
|
@ -1560,9 +1604,9 @@ void MainWindow::initializeStatusObject(QObject *pObject, bool bConnect)
|
|||
/* initialize combobox */
|
||||
RSComboBox *pComboBox = dynamic_cast<RSComboBox*>(pObject);
|
||||
if (pComboBox) {
|
||||
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RS_STATUS_ONLINE)), StatusDefs::name(RS_STATUS_ONLINE), RS_STATUS_ONLINE);
|
||||
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RS_STATUS_BUSY)), StatusDefs::name(RS_STATUS_BUSY), RS_STATUS_BUSY);
|
||||
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RS_STATUS_AWAY)), StatusDefs::name(RS_STATUS_AWAY), RS_STATUS_AWAY);
|
||||
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_ONLINE)), StatusDefs::name(RsStatusValue::RS_STATUS_ONLINE), (int)RsStatusValue::RS_STATUS_ONLINE);
|
||||
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_BUSY)), StatusDefs::name(RsStatusValue::RS_STATUS_BUSY), (int)RsStatusValue::RS_STATUS_BUSY);
|
||||
pComboBox->addItem(QIcon(StatusDefs::imageStatus(RsStatusValue::RS_STATUS_AWAY)), StatusDefs::name(RsStatusValue::RS_STATUS_AWAY), (int)RsStatusValue::RS_STATUS_AWAY);
|
||||
|
||||
if (bConnect) {
|
||||
connect(pComboBox, SIGNAL(activated(int)), this, SLOT(statusChangedComboBox(int)));
|
||||
|
@ -1590,11 +1634,11 @@ void MainWindow::removeStatusObject(QObject *pObject)
|
|||
}
|
||||
|
||||
/** Save own status Online,Away,Busy **/
|
||||
void MainWindow::setStatus(QObject *pObject, int nStatus)
|
||||
void MainWindow::setStatus(QObject *pObject, RsStatusValue nStatus)
|
||||
{
|
||||
if (isIdle && nStatus == (int) RS_STATUS_ONLINE) {
|
||||
if (isIdle && nStatus == RsStatusValue::RS_STATUS_ONLINE) {
|
||||
/* set idle only when I am online */
|
||||
nStatus = RS_STATUS_INACTIVE;
|
||||
nStatus = RsStatusValue::RS_STATUS_INACTIVE;
|
||||
}
|
||||
|
||||
rsStatus->sendStatus(RsPeerId(), nStatus);
|
||||
|
@ -1614,7 +1658,7 @@ void MainWindow::statusChangedMenu(QAction *pAction)
|
|||
return;
|
||||
}
|
||||
|
||||
setStatus(pAction->parent(), pAction->data().toInt());
|
||||
setStatus(pAction->parent(), RsStatusValue(pAction->data().toInt()));
|
||||
}
|
||||
|
||||
/* new status from combobox in statusbar */
|
||||
|
@ -1625,7 +1669,7 @@ void MainWindow::statusChangedComboBox(int index)
|
|||
}
|
||||
|
||||
/* no object known */
|
||||
setStatus(NULL, statusComboBox->itemData(index, Qt::UserRole).toInt());
|
||||
setStatus(NULL, RsStatusValue(statusComboBox->itemData(index, Qt::UserRole).toInt()));
|
||||
}
|
||||
|
||||
/*new setting*/
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
#include <QSystemTrayIcon>
|
||||
#include <set>
|
||||
|
||||
#include "retroshare/rsevents.h"
|
||||
#include "retroshare/rsstatus.h"
|
||||
|
||||
#include "gui/common/rwindow.h"
|
||||
#include "gui/common/RSComboBox.h"
|
||||
#include "util/FontSizeHandler.h"
|
||||
|
@ -183,7 +186,7 @@ public:
|
|||
/* initialize widget with status informations, status constant stored in data or in Qt::UserRole */
|
||||
void initializeStatusObject(QObject *pObject, bool bConnect);
|
||||
void removeStatusObject(QObject *pObject);
|
||||
void setStatus(QObject *pObject, int nStatus);
|
||||
void setStatus(QObject *pObject, RsStatusValue nStatus);
|
||||
|
||||
RSComboBox *statusComboBoxInstance();
|
||||
PeerStatus *peerstatusInstance();
|
||||
|
@ -375,6 +378,8 @@ private:
|
|||
FontSizeHandler mFontSizeHandler;
|
||||
|
||||
Ui::MainWindow *ui ;
|
||||
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "notifyqt.h"
|
||||
#include "connect/ConnectFriendWizard.h"
|
||||
#include "util/PixmapMerging.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "LogoBar.h"
|
||||
#include "util/Widget.h"
|
||||
#include "util/misc.h"
|
||||
|
@ -95,8 +96,29 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WindowFlags flags)
|
|||
|
||||
connect(ui.messagelineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(savestatusmessage()));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(ownStatusMessageChanged()), this, SLOT(loadmystatusmessage()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateOwnStatus(QString,int)));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(ownStatusMessageChanged()), this, SLOT(loadmystatusmessage()));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateOwnStatus(QString,int)));
|
||||
|
||||
mEventHandlerId = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=](){
|
||||
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||
|
||||
if(!fe) return;
|
||||
|
||||
switch(fe->mEventCode)
|
||||
{
|
||||
case RsFriendListEventCode::NODE_STATUS_CHANGED: updateOwnStatus(QString::fromStdString(fe->mSslId.toStdString()),fe->mStatus);
|
||||
break;
|
||||
case RsFriendListEventCode::OWN_STATUS_CHANGED: loadmystatusmessage();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}, this );
|
||||
},mEventHandlerId,RsEventType::FRIEND_LIST);
|
||||
|
||||
for (std::set<RsPgpId>::iterator peerIt = expandedPeers.begin(); peerIt != expandedPeers.end(); ++peerIt) {
|
||||
ui.friendList->addPeerToExpand(*peerIt);
|
||||
|
@ -159,6 +181,7 @@ MessengerWindow::~MessengerWindow ()
|
|||
{
|
||||
// save settings
|
||||
processSettings(false);
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
|
||||
MainWindow *pMainWindow = MainWindow::getInstance();
|
||||
if (pMainWindow) {
|
||||
|
@ -214,7 +237,7 @@ void MessengerWindow::savestatusmessage()
|
|||
rsMsgs->setCustomStateString(ui.messagelineEdit->currentText().toUtf8().constData());
|
||||
}
|
||||
|
||||
void MessengerWindow::updateOwnStatus(const QString &peer_id, int status)
|
||||
void MessengerWindow::updateOwnStatus(const QString &peer_id, RsStatusValue status)
|
||||
{
|
||||
// add self nick + own status
|
||||
if (peer_id == QString::fromStdString(rsPeers->getOwnId().toStdString()))
|
||||
|
|
|
@ -52,7 +52,7 @@ private slots:
|
|||
/** Open Shared Manager **/
|
||||
void openShareManager();
|
||||
|
||||
void updateOwnStatus(const QString &peer_id, int status);
|
||||
void updateOwnStatus(const QString &peer_id, RsStatusValue status);
|
||||
|
||||
void savestatusmessage();
|
||||
|
||||
|
@ -68,6 +68,7 @@ private:
|
|||
|
||||
static std::set<RsPgpId> expandedPeers ;
|
||||
static std::set<RsNodeGroupId> expandedGroups ;
|
||||
RsEventsHandlerId_t mEventHandlerId ;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -76,7 +76,7 @@ static NewsFeed* instance = nullptr;
|
|||
NewsFeed::NewsFeed(QWidget *parent) : MainPage(parent), ui(new Ui::NewsFeed),
|
||||
mEventTypes({
|
||||
RsEventType::AUTHSSL_CONNECTION_AUTENTICATION,
|
||||
RsEventType::PEER_CONNECTION ,
|
||||
RsEventType::FRIEND_LIST ,
|
||||
RsEventType::GXS_CIRCLES ,
|
||||
RsEventType::GXS_CHANNELS ,
|
||||
RsEventType::GXS_FORUMS ,
|
||||
|
@ -197,7 +197,7 @@ void NewsFeed::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
|||
if(event->mType == RsEventType::AUTHSSL_CONNECTION_AUTENTICATION && (flags & RS_FEED_TYPE_SECURITY))
|
||||
handleSecurityEvent(event);
|
||||
|
||||
if(event->mType == RsEventType::PEER_CONNECTION && (flags & RS_FEED_TYPE_PEER))
|
||||
if(event->mType == RsEventType::FRIEND_LIST && (flags & RS_FEED_TYPE_PEER))
|
||||
handleConnectionEvent(event);
|
||||
|
||||
if(event->mType == RsEventType::GXS_CIRCLES && (flags & RS_FEED_TYPE_CIRCLE))
|
||||
|
@ -428,7 +428,7 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
|
|||
|
||||
void NewsFeed::handleConnectionEvent(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
const RsConnectionEvent *pe = dynamic_cast<const RsConnectionEvent*>(event.get());
|
||||
const RsFriendListEvent *pe = dynamic_cast<const RsFriendListEvent*>(event.get());
|
||||
if(!pe) return;
|
||||
|
||||
auto& e(*pe);
|
||||
|
@ -437,18 +437,18 @@ void NewsFeed::handleConnectionEvent(std::shared_ptr<const RsEvent> event)
|
|||
std::cerr << "NotifyQt: handling connection event from peer " << e.mSslId << std::endl;
|
||||
#endif
|
||||
|
||||
switch(e.mConnectionInfoCode)
|
||||
switch(e.mEventCode)
|
||||
{
|
||||
case RsConnectionEventCode::PEER_CONNECTED:
|
||||
case RsFriendListEventCode::NODE_CONNECTED:
|
||||
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_CONNECT, false), true);
|
||||
NotifyQt::getInstance()->addToaster(RS_POPUP_CONNECT, e.mSslId.toStdString().c_str(), "", "");
|
||||
break;
|
||||
case RsConnectionEventCode::PEER_DISCONNECTED: // not handled yet
|
||||
case RsFriendListEventCode::NODE_DISCONNECTED: // not handled yet
|
||||
break;
|
||||
case RsConnectionEventCode::PEER_TIME_SHIFT:
|
||||
case RsFriendListEventCode::NODE_TIME_SHIFT:
|
||||
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_OFFSET, false),false);
|
||||
break;
|
||||
case RsConnectionEventCode::PEER_REPORTS_WRONG_IP:
|
||||
case RsFriendListEventCode::NODE_REPORTS_WRONG_IP:
|
||||
addFeedItemIfUnique(new SecurityIpItem(
|
||||
this, e.mSslId, e.mOwnLocator.toString(),
|
||||
e.mReportedLocator.toString(),
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "gui/notifyqt.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
|
||||
/* Images for context menu icons */
|
||||
|
@ -73,7 +74,23 @@ ShareManager::ShareManager()
|
|||
connect(ui.shareddirList, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(doubleClickedCell(int,int)));
|
||||
connect(ui.shareddirList, SIGNAL(cellChanged(int,int)), this, SLOT(handleCellChange(int,int)));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(reload()));
|
||||
// connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(reload()));
|
||||
|
||||
mEventHandlerId = 0;
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=]()
|
||||
{
|
||||
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||
|
||||
if(!fe)
|
||||
return;
|
||||
|
||||
reload();
|
||||
}
|
||||
, this );
|
||||
}, mEventHandlerId, RsEventType::FRIEND_LIST );
|
||||
|
||||
QHeaderView* header = ui.shareddirList->horizontalHeader();
|
||||
QHeaderView_setSectionResizeModeColumn(header, COLUMN_PATH, QHeaderView::Stretch);
|
||||
|
@ -152,6 +169,7 @@ ShareManager::~ShareManager()
|
|||
{
|
||||
_instance = NULL;
|
||||
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
Settings->saveWidgetInformation(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ private:
|
|||
Ui::ShareManager ui;
|
||||
|
||||
std::vector<SharedDirInfo> mDirInfos ;
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -330,7 +330,7 @@ QString ChatDialog::getOwnName() const
|
|||
return "ChatDialog::getOwnName(): invalid id type passed (RsPeerId is required). This is a bug.";
|
||||
}
|
||||
|
||||
void ChatDialog::setPeerStatus(uint32_t status)
|
||||
void ChatDialog::setPeerStatus(RsStatusValue status)
|
||||
{
|
||||
ChatWidget *cw = getChatWidget();
|
||||
if (cw)
|
||||
|
@ -346,14 +346,14 @@ void ChatDialog::setPeerStatus(uint32_t status)
|
|||
cw->updateStatus(QString::fromStdString(vpid.toStdString()), status);
|
||||
}
|
||||
}
|
||||
int ChatDialog::getPeerStatus()
|
||||
RsStatusValue ChatDialog::getPeerStatus()
|
||||
{
|
||||
ChatWidget *cw = getChatWidget();
|
||||
if (cw) {
|
||||
return cw->getPeerStatus();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return RsStatusValue::RS_STATUS_UNKNOWN;
|
||||
}
|
||||
|
||||
QString ChatDialog::getTitle()
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#ifndef CHATDIALOG_H
|
||||
#define CHATDIALOG_H
|
||||
|
||||
#include "retroshare/rsstatus.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
|
||||
|
@ -58,8 +60,8 @@ public:
|
|||
bool setStyle();
|
||||
const RSStyle *getStyle();
|
||||
|
||||
int getPeerStatus();
|
||||
void setPeerStatus(uint32_t state);
|
||||
RsStatusValue getPeerStatus();
|
||||
void setPeerStatus(RsStatusValue state);
|
||||
|
||||
void focusDialog();
|
||||
|
||||
|
|
|
@ -846,7 +846,7 @@ QString ChatLobbyDialog::getParticipantName(const RsGxsId& gxs_id) const
|
|||
}
|
||||
|
||||
|
||||
void ChatLobbyDialog::displayLobbyEvent(int event_type, const RsGxsId& gxs_id, const QString& str)
|
||||
void ChatLobbyDialog::handleLobbyEvent(RsChatStatusEventCode event_type, const RsGxsId& gxs_id, const QString& str)
|
||||
{
|
||||
RsGxsId qsParticipant;
|
||||
|
||||
|
@ -854,17 +854,17 @@ void ChatLobbyDialog::displayLobbyEvent(int event_type, const RsGxsId& gxs_id, c
|
|||
|
||||
switch (event_type)
|
||||
{
|
||||
case RS_CHAT_LOBBY_EVENT_PEER_LEFT:
|
||||
case RsChatStatusEventCode::CHAT_LOBBY_EVENT_PEER_LEFT:
|
||||
qsParticipant=gxs_id;
|
||||
ui.chatWidget->addChatMsg(true, tr("Chat room management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("%1 has left the room.").arg(RsHtml::plainText(name)), ChatWidget::MSGTYPE_SYSTEM);
|
||||
emit peerLeft(id()) ;
|
||||
break;
|
||||
case RS_CHAT_LOBBY_EVENT_PEER_JOINED:
|
||||
case RsChatStatusEventCode::CHAT_LOBBY_EVENT_PEER_JOINED:
|
||||
qsParticipant=gxs_id;
|
||||
ui.chatWidget->addChatMsg(true, tr("Chat room management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("%1 joined the room.").arg(RsHtml::plainText(name)), ChatWidget::MSGTYPE_SYSTEM);
|
||||
emit peerJoined(id()) ;
|
||||
break;
|
||||
case RS_CHAT_LOBBY_EVENT_PEER_STATUS:
|
||||
case RsChatStatusEventCode::CHAT_LOBBY_EVENT_PEER_STATUS:
|
||||
{
|
||||
|
||||
qsParticipant=gxs_id;
|
||||
|
@ -876,7 +876,7 @@ void ChatLobbyDialog::displayLobbyEvent(int event_type, const RsGxsId& gxs_id, c
|
|||
|
||||
}
|
||||
break;
|
||||
case RS_CHAT_LOBBY_EVENT_PEER_CHANGE_NICKNAME:
|
||||
case RsChatStatusEventCode::CHAT_LOBBY_EVENT_PEER_CHANGE_NICKNAME:
|
||||
{
|
||||
qsParticipant=gxs_id;
|
||||
|
||||
|
@ -892,11 +892,11 @@ void ChatLobbyDialog::displayLobbyEvent(int event_type, const RsGxsId& gxs_id, c
|
|||
muteParticipant(RsGxsId(str.toStdString())) ;
|
||||
}
|
||||
break;
|
||||
case RS_CHAT_LOBBY_EVENT_KEEP_ALIVE:
|
||||
case RsChatStatusEventCode::CHAT_LOBBY_EVENT_KEEP_ALIVE:
|
||||
//std::cerr << "Received keep alive packet from " << nickname.toStdString() << " in chat room " << getPeerId() << std::endl;
|
||||
break;
|
||||
default:
|
||||
std::cerr << "ChatLobbyDialog::displayLobbyEvent() Unhandled chat room event type " << event_type << std::endl;
|
||||
std::cerr << "ChatLobbyDialog::handledLobbyEvent() Unhandled chat room event type " << (int)event_type << std::endl;
|
||||
}
|
||||
|
||||
if (!qsParticipant.isNull())
|
||||
|
|
|
@ -42,7 +42,7 @@ class ChatLobbyDialog: public ChatDialog
|
|||
friend class ChatDialog;
|
||||
|
||||
public:
|
||||
void displayLobbyEvent(int event_type, const RsGxsId &gxs_id, const QString& str);
|
||||
void handleLobbyEvent(RsChatStatusEventCode event_type, const RsGxsId& gxs_id, const QString& str);
|
||||
|
||||
virtual void showDialog(uint chatflags);
|
||||
virtual ChatWidget *getChatWidget();
|
||||
|
|
|
@ -113,7 +113,7 @@ void ChatTabWidget::tabInfoChanged(ChatDialog *dialog)
|
|||
}
|
||||
} else if (dialog->hasPeerStatus()) {
|
||||
setBlinking(tab, false);
|
||||
setTabIcon(tab, QIcon(StatusDefs::imageIM(dialog->getPeerStatus())));
|
||||
setTabIcon(tab, QIcon(StatusDefs::imageIM((RsStatusValue)dialog->getPeerStatus())));
|
||||
} else {
|
||||
setBlinking(tab, false);
|
||||
setTabIcon(tab, QIcon());
|
||||
|
@ -155,7 +155,7 @@ void ChatTabWidget::getInfo(bool &isTyping, bool &hasNewMessage, QIcon *icon)
|
|||
} else {
|
||||
cd = dynamic_cast<ChatDialog*>(currentWidget());
|
||||
if (cd && cd->hasPeerStatus()) {
|
||||
*icon = QIcon(StatusDefs::imageIM(cd->getPeerStatus()));
|
||||
*icon = QIcon(StatusDefs::imageIM((RsStatusValue)cd->getPeerStatus()));
|
||||
} else {
|
||||
*icon = QIcon();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "gui/chat/ChatUserNotify.h"//For BradCast
|
||||
#include "util/DateTime.h"
|
||||
#include "util/imageutil.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "gui/im_history/ImHistoryBrowser.h"
|
||||
|
||||
#include <retroshare/rsstatus.h>
|
||||
|
@ -74,7 +75,7 @@
|
|||
|
||||
ChatWidget::ChatWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, completionPosition(0), newMessages(false), typing(false), peerStatus(0)
|
||||
, completionPosition(0), newMessages(false), typing(false), peerStatus(RsStatusValue::RS_STATUS_UNKNOWN)
|
||||
, sendingBlocked(false), useCMark(false)
|
||||
, lastStatusSendTime(0)
|
||||
, firstShow(true), inChatCharFormatChanged(false), firstSearch(true)
|
||||
|
@ -171,7 +172,22 @@ ChatWidget::ChatWidget(QWidget *parent)
|
|||
|
||||
connect(ui->hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int)));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int)));
|
||||
|
||||
mEventHandlerId = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=](){
|
||||
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||
|
||||
if(!fe || fe->mEventCode != RsFriendListEventCode::NODE_STATUS_CHANGED)
|
||||
return;
|
||||
|
||||
updateStatus(QString::fromStdString(fe->mSslId.toStdString()),fe->mStatus);
|
||||
|
||||
}, this );
|
||||
},mEventHandlerId,RsEventType::FRIEND_LIST);
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&)));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(chatFontChanged()), this, SLOT(resetFonts()));
|
||||
|
||||
|
@ -254,6 +270,7 @@ ChatWidget::ChatWidget(QWidget *parent)
|
|||
ChatWidget::~ChatWidget()
|
||||
{
|
||||
processSettings(false);
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
|
||||
/* Cleanup plugin functions */
|
||||
foreach (ChatWidgetHolder *chatWidgetHolder, mChatWidgetHolder) {
|
||||
|
@ -1788,7 +1805,7 @@ void ChatWidget::setCurrentFileName(const QString &fileName)
|
|||
setWindowModified(false);
|
||||
}
|
||||
|
||||
void ChatWidget::updateStatus(const QString &peer_id, int status)
|
||||
void ChatWidget::updateStatus(const QString &peer_id, RsStatusValue status)
|
||||
{
|
||||
if (! (chatType() == CHATTYPE_PRIVATE || chatType() == CHATTYPE_DISTANT))
|
||||
{
|
||||
|
@ -1842,26 +1859,27 @@ void ChatWidget::updateStatus(const QString &peer_id, int status)
|
|||
bool atEnd = (scrollbar->value() == scrollbar->maximum());
|
||||
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
default:
|
||||
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||
ui->info_Frame->setVisible(true);
|
||||
ui->infoLabel->setText(peerName + " " + tr("appears to be Offline.") +"\n" + tr("Messages you send will be delivered after Friend is again Online."));
|
||||
break;
|
||||
|
||||
case RS_STATUS_INACTIVE:
|
||||
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||
ui->info_Frame->setVisible(true);
|
||||
ui->infoLabel->setText(peerName + " " + tr("is Idle and may not reply"));
|
||||
break;
|
||||
|
||||
case RS_STATUS_ONLINE:
|
||||
case RsStatusValue::RS_STATUS_ONLINE:
|
||||
ui->info_Frame->setVisible(false);
|
||||
break;
|
||||
|
||||
case RS_STATUS_AWAY:
|
||||
case RsStatusValue::RS_STATUS_AWAY:
|
||||
ui->infoLabel->setText(peerName + " " + tr("is Away and may not reply"));
|
||||
ui->info_Frame->setVisible(true);
|
||||
break;
|
||||
|
||||
case RS_STATUS_BUSY:
|
||||
case RsStatusValue::RS_STATUS_BUSY:
|
||||
ui->infoLabel->setText(peerName + " " + tr("is Busy and may not reply"));
|
||||
ui->info_Frame->setVisible(true);
|
||||
break;
|
||||
|
@ -1869,7 +1887,8 @@ void ChatWidget::updateStatus(const QString &peer_id, int status)
|
|||
|
||||
ui->titleLabel->setText(peerName);
|
||||
ui->titleLabel->setToolTip(tooltip_info);
|
||||
ui->statusLabel->setText(QString("(%1)").arg(StatusDefs::name(status)));
|
||||
#warning inconsistent conversion here
|
||||
ui->statusLabel->setText(QString("(%1)").arg(StatusDefs::name((RsStatusValue)status)));
|
||||
|
||||
peerStatus = status;
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include <retroshare/rsfiles.h>
|
||||
#include <retroshare/rsstatus.h>
|
||||
|
||||
#include <QCompleter>
|
||||
#include <QTextCharFormat>
|
||||
|
@ -62,7 +63,7 @@ public:
|
|||
|
||||
// status comes from notifyPeerStatusChanged
|
||||
// see rststaus.h for possible values
|
||||
virtual void updateStatus(int /*status*/) {}
|
||||
virtual void updateStatus(RsStatusValue /*status*/) {}
|
||||
|
||||
protected:
|
||||
ChatWidget *mChatWidget;
|
||||
|
@ -105,7 +106,7 @@ public:
|
|||
void addToolsAction(QAction *action);
|
||||
|
||||
QString getTitle() { return title; }
|
||||
int getPeerStatus() { return peerStatus; }
|
||||
RsStatusValue getPeerStatus() { return peerStatus; }
|
||||
void setName(const QString &name);
|
||||
|
||||
bool setStyle();
|
||||
|
@ -130,7 +131,7 @@ public:
|
|||
const QList<ChatWidgetHolder*> &chatWidgetHolderList() { return mChatWidgetHolder; }
|
||||
|
||||
public slots:
|
||||
void updateStatus(const QString &peer_id, int status);
|
||||
void updateStatus(const QString &peer_id, RsStatusValue status);
|
||||
void setUseCMark(const bool bUseCMark);
|
||||
void updateCMPreview();
|
||||
|
||||
|
@ -144,7 +145,7 @@ private slots:
|
|||
signals:
|
||||
void infoChanged(ChatWidget*);
|
||||
void newMessage(ChatWidget*);
|
||||
void statusChanged(int);
|
||||
void statusChanged(RsStatusValue);
|
||||
void textBrowserAskContextMenu(QMenu* contextMnu, QString anchorForPosition, const QPoint point);
|
||||
|
||||
protected:
|
||||
|
@ -229,7 +230,7 @@ private:
|
|||
|
||||
bool newMessages;
|
||||
bool typing;
|
||||
int peerStatus;
|
||||
RsStatusValue peerStatus;
|
||||
|
||||
bool sendingBlocked;
|
||||
bool useCMark;
|
||||
|
@ -272,6 +273,8 @@ private:
|
|||
ChatLobbyUserNotify* notify;
|
||||
|
||||
Ui::ChatWidget *ui;
|
||||
|
||||
RsEventsHandlerId_t mEventHandlerId ;
|
||||
};
|
||||
|
||||
#endif // CHATWIDGET_H
|
||||
|
|
|
@ -350,7 +350,7 @@ void PopupChatWindow::calculateTitle(ChatDialog *dialog)
|
|||
} else {
|
||||
mBlinkIcon = QIcon();
|
||||
if (cd && cd->hasPeerStatus()) {
|
||||
icon = QIcon(StatusDefs::imageIM(cd->getPeerStatus()));
|
||||
icon = QIcon(StatusDefs::imageIM((RsStatusValue)cd->getPeerStatus()));
|
||||
} else {
|
||||
icon = qApp->windowIcon();
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ void PopupChatWindow::calculateTitle(ChatDialog *dialog)
|
|||
if (cd) {
|
||||
QString title = cd->getTitle();
|
||||
if (cd->hasPeerStatus()) {
|
||||
title += " (" + StatusDefs::name(cd->getPeerStatus()) + ")";
|
||||
title += " (" + StatusDefs::name((RsStatusValue)cd->getPeerStatus()) + ")";
|
||||
}
|
||||
setWindowTitle(title);
|
||||
} else {
|
||||
|
|
|
@ -121,7 +121,7 @@ void PopupDistantChatDialog::updateDisplay()
|
|||
getChatWidget()->blockSending(tr( "Can't send message immediately, "
|
||||
"because there is no tunnel "
|
||||
"available." ));
|
||||
setPeerStatus(RS_STATUS_OFFLINE);
|
||||
setPeerStatus(RsStatusValue::RS_STATUS_OFFLINE);
|
||||
break ;
|
||||
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED:
|
||||
std::cerr << "Chat remotely closed. " << std::endl;
|
||||
|
@ -131,7 +131,7 @@ void PopupDistantChatDialog::updateDisplay()
|
|||
getChatWidget()->updateStatusString("%1", tr( "Your partner closed the conversation." ), true );
|
||||
getChatWidget()->blockSending(tr( "Your partner closed the conversation."));
|
||||
|
||||
setPeerStatus(RS_STATUS_OFFLINE) ;
|
||||
setPeerStatus(RsStatusValue::RS_STATUS_OFFLINE) ;
|
||||
break ;
|
||||
|
||||
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN:
|
||||
|
@ -145,7 +145,7 @@ void PopupDistantChatDialog::updateDisplay()
|
|||
_status_label->setToolTip(msg);
|
||||
getChatWidget()->updateStatusString("%1", msg, true);
|
||||
getChatWidget()->blockSending(msg);
|
||||
setPeerStatus(RS_STATUS_OFFLINE);
|
||||
setPeerStatus(RsStatusValue::RS_STATUS_OFFLINE);
|
||||
break;
|
||||
case RS_DISTANT_CHAT_STATUS_CAN_TALK:
|
||||
|
||||
|
@ -153,7 +153,7 @@ void PopupDistantChatDialog::updateDisplay()
|
|||
msg = QObject::tr( "End-to-end encrypted conversation established");
|
||||
_status_label->setToolTip(msg);
|
||||
getChatWidget()->unblockSending();
|
||||
setPeerStatus(RS_STATUS_ONLINE);
|
||||
setPeerStatus(RsStatusValue::RS_STATUS_ONLINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "gui/notifyqt.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "gui/common/AvatarDialog.h"
|
||||
|
||||
|
@ -43,17 +44,44 @@ AvatarWidget::AvatarWidget(QWidget *parent) : QLabel(parent), ui(new Ui::AvatarW
|
|||
|
||||
mFlag.isOwnId = false;
|
||||
defaultAvatar = ":/images/no_avatar_background.png";
|
||||
mPeerState = RS_STATUS_OFFLINE ;
|
||||
mPeerState = RsStatusValue::RS_STATUS_OFFLINE ;
|
||||
|
||||
setFrameType(NO_FRAME);
|
||||
|
||||
/* connect signals */
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(ownAvatarChanged()), this, SLOT(updateOwnAvatar()));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(ownAvatarChanged()), this, SLOT(updateOwnAvatar()));
|
||||
|
||||
mEventHandlerId = 0;
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=](){
|
||||
|
||||
const RsFriendListEvent *e = dynamic_cast<const RsFriendListEvent*>(event.get());
|
||||
if(!e)
|
||||
return;
|
||||
|
||||
switch(e->mEventCode)
|
||||
{
|
||||
case RsFriendListEventCode::OWN_AVATAR_CHANGED:
|
||||
case RsFriendListEventCode::NODE_AVATAR_CHANGED: updateAvatar(QString::fromStdString(e->mSslId.toStdString()));
|
||||
break;
|
||||
case RsFriendListEventCode::OWN_STATUS_CHANGED:
|
||||
case RsFriendListEventCode::NODE_STATUS_CHANGED: updateStatus(QString::fromStdString(e->mSslId.toStdString()),e->mStatus);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}, this );
|
||||
}, mEventHandlerId, RsEventType::FRIEND_LIST );
|
||||
|
||||
}
|
||||
|
||||
AvatarWidget::~AvatarWidget()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -68,15 +96,15 @@ QString AvatarWidget::frameState()
|
|||
case STATUS_FRAME:
|
||||
switch (mPeerState)
|
||||
{
|
||||
case RS_STATUS_OFFLINE:
|
||||
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||
return "OFFLINE";
|
||||
case RS_STATUS_INACTIVE:
|
||||
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||
return "INACTIVE";
|
||||
case RS_STATUS_ONLINE:
|
||||
case RsStatusValue::RS_STATUS_ONLINE:
|
||||
return "ONLINE";
|
||||
case RS_STATUS_AWAY:
|
||||
case RsStatusValue::RS_STATUS_AWAY:
|
||||
return "AWAY";
|
||||
case RS_STATUS_BUSY:
|
||||
case RsStatusValue::RS_STATUS_BUSY:
|
||||
return "BUSY";
|
||||
}
|
||||
}
|
||||
|
@ -107,6 +135,7 @@ void AvatarWidget::setFrameType(FrameType type)
|
|||
{
|
||||
mFrameType = type;
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
switch (mFrameType) {
|
||||
case NO_FRAME:
|
||||
disconnect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateStatus(const QString&, int)));
|
||||
|
@ -118,6 +147,9 @@ void AvatarWidget::setFrameType(FrameType type)
|
|||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateStatus(const QString&, int)));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//refreshAvatarImage();
|
||||
refreshStatus();
|
||||
|
@ -179,7 +211,7 @@ void AvatarWidget::refreshStatus()
|
|||
}
|
||||
case STATUS_FRAME:
|
||||
{
|
||||
uint32_t status = 0;
|
||||
RsStatusValue status = RsStatusValue::RS_STATUS_UNKNOWN;
|
||||
|
||||
if (mId.isNotSet())
|
||||
return;
|
||||
|
@ -193,7 +225,7 @@ void AvatarWidget::refreshStatus()
|
|||
status = statusInfo.status ;
|
||||
}
|
||||
else if(mId.isDistantChatId())
|
||||
status = RS_STATUS_ONLINE ;
|
||||
status = RsStatusValue::RS_STATUS_ONLINE ;
|
||||
else
|
||||
{
|
||||
std::cerr << "Unhandled chat id type in AvatarWidget::refreshStatus()" << std::endl;
|
||||
|
@ -217,10 +249,10 @@ void AvatarWidget::refreshStatus()
|
|||
{
|
||||
switch (dcpinfo.status)
|
||||
{
|
||||
case RS_DISTANT_CHAT_STATUS_CAN_TALK : status = RS_STATUS_ONLINE ; break;
|
||||
case RS_DISTANT_CHAT_STATUS_CAN_TALK : status = RsStatusValue::RS_STATUS_ONLINE ; break;
|
||||
case RS_DISTANT_CHAT_STATUS_UNKNOWN : // Fall-through
|
||||
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN : // Fall-through
|
||||
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED : status = RS_STATUS_OFFLINE;
|
||||
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED : status = RsStatusValue::RS_STATUS_OFFLINE;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -238,20 +270,20 @@ void AvatarWidget::refreshStatus()
|
|||
}
|
||||
}
|
||||
|
||||
void AvatarWidget::updateStatus(const QString& peerId, int status)
|
||||
void AvatarWidget::updateStatus(const QString& peerId, RsStatusValue status)
|
||||
{
|
||||
if (mId.isPeerId() && mId.toPeerId() == RsPeerId(peerId.toStdString()))
|
||||
updateStatus(status) ;
|
||||
}
|
||||
|
||||
void AvatarWidget::updateStatus(int status)
|
||||
void AvatarWidget::updateStatus(RsStatusValue status)
|
||||
{
|
||||
if (mFrameType != STATUS_FRAME)
|
||||
return;
|
||||
|
||||
mPeerState = status;
|
||||
|
||||
setEnabled(((uint32_t) status == RS_STATUS_OFFLINE) ? false : true);
|
||||
setEnabled((status == RsStatusValue::RS_STATUS_OFFLINE) ? false : true);
|
||||
RsApplication::refreshStyleSheet(this, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
#include <QLabel>
|
||||
#include <stdint.h>
|
||||
#include <retroshare/rstypes.h>
|
||||
#include <retroshare/rsevents.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include <retroshare/rsstatus.h>
|
||||
|
||||
namespace Ui {
|
||||
class AvatarWidget;
|
||||
|
@ -57,14 +59,14 @@ protected:
|
|||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
|
||||
private slots:
|
||||
void updateStatus(const QString& peerId, int status);
|
||||
void updateStatus(const QString& peerId, RsStatusValue status);
|
||||
void updateAvatar(const QString& peerId);
|
||||
void updateOwnAvatar();
|
||||
|
||||
private:
|
||||
void refreshAvatarImage() ;
|
||||
void refreshStatus();
|
||||
void updateStatus(int status);
|
||||
void updateStatus(RsStatusValue status);
|
||||
|
||||
QString defaultAvatar;
|
||||
Ui::AvatarWidget *ui;
|
||||
|
@ -77,7 +79,9 @@ private:
|
|||
// bool isGpg : 1;
|
||||
} mFlag;
|
||||
FrameType mFrameType;
|
||||
uint32_t mPeerState;
|
||||
RsStatusValue mPeerState;
|
||||
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
};
|
||||
|
||||
#endif // AVATARWIDGET_H
|
||||
|
|
|
@ -458,7 +458,7 @@ QVariant RsFriendListModel::statusRole(const EntryIndex& fmpe,int /*column*/) co
|
|||
StatusInfo status;
|
||||
rsStatus->getStatus(node->node_info.id, status);
|
||||
|
||||
return QVariant(status.status);
|
||||
return QVariant((int)status.status);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -603,7 +603,7 @@ QVariant RsFriendListModel::onlineRole(const EntryIndex& e, int /*col*/) const
|
|||
|
||||
for(uint32_t i=0;i<prof.child_node_indices.size();++i)
|
||||
if(mLocations[prof.child_node_indices[i]].node_info.state & RS_PEER_STATE_CONNECTED)
|
||||
return QVariant(RS_STATUS_ONLINE);
|
||||
return QVariant((int)RsStatusValue::RS_STATUS_ONLINE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ QVariant RsFriendListModel::onlineRole(const EntryIndex& e, int /*col*/) const
|
|||
{
|
||||
for(uint32_t i=0;i<prof->child_node_indices.size();++i)
|
||||
if(mLocations[prof->child_node_indices[i]].node_info.state & RS_PEER_STATE_CONNECTED)
|
||||
return QVariant(RS_STATUS_ONLINE);
|
||||
return QVariant((int)RsStatusValue::RS_STATUS_ONLINE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -626,12 +626,12 @@ QVariant RsFriendListModel::onlineRole(const EntryIndex& e, int /*col*/) const
|
|||
const HierarchicalNodeInformation *node = getNodeInfo(e);
|
||||
|
||||
if(node && bool(node->node_info.state & RS_PEER_STATE_CONNECTED))
|
||||
return QVariant(RS_STATUS_ONLINE);
|
||||
return QVariant((int)RsStatusValue::RS_STATUS_ONLINE);
|
||||
else
|
||||
return QVariant(RS_STATUS_OFFLINE);
|
||||
return QVariant((int)RsStatusValue::RS_STATUS_OFFLINE);
|
||||
}
|
||||
}
|
||||
return QVariant(RS_STATUS_OFFLINE);
|
||||
return QVariant((int)RsStatusValue::RS_STATUS_OFFLINE);
|
||||
}
|
||||
|
||||
QVariant RsFriendListModel::fontRole(const EntryIndex& e, int col) const
|
||||
|
@ -640,14 +640,14 @@ QVariant RsFriendListModel::fontRole(const EntryIndex& e, int col) const
|
|||
std::cerr << " font role " << e.type << ", (" << (int)e.group_index << ","<< (int)e.profile_index << ","<< (int)e.node_index << ") col="<< col<<": " << std::endl;
|
||||
#endif
|
||||
|
||||
int status = onlineRole(e,col).toInt();
|
||||
auto status = RsStatusValue(onlineRole(e,col).toInt());
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case RS_STATUS_AWAY:
|
||||
case RS_STATUS_BUSY:
|
||||
case RS_STATUS_ONLINE:
|
||||
case RS_STATUS_INACTIVE:
|
||||
case RsStatusValue::RS_STATUS_AWAY:
|
||||
case RsStatusValue::RS_STATUS_BUSY:
|
||||
case RsStatusValue::RS_STATUS_ONLINE:
|
||||
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||
{
|
||||
QFont font ;
|
||||
QTreeView* myParent = dynamic_cast<QTreeView*>(QAbstractItemModel::parent());
|
||||
|
@ -781,7 +781,7 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const
|
|||
else
|
||||
{
|
||||
return QVariant(QString::fromUtf8(node->node_info.location.c_str())+"\n"
|
||||
+ "(" + StatusDefs::name(statusRole(e,col).toInt()) + ")");
|
||||
+ "(" + StatusDefs::name(RsStatusValue(statusRole(e,col).toInt())) + ")");
|
||||
}
|
||||
else
|
||||
return QVariant(QString::fromUtf8(node->node_info.location.c_str()));
|
||||
|
@ -900,10 +900,10 @@ bool RsFriendListModel::getPeerOnlineStatus(const EntryIndex& e) const
|
|||
return (noded && (noded->node_info.state & RS_PEER_STATE_CONNECTED));
|
||||
}
|
||||
|
||||
const RsFriendListModel::HierarchicalNodeInformation *RsFriendListModel::getBestNodeInformation(const HierarchicalProfileInformation *profileInfo, uint32_t *status) const
|
||||
const RsFriendListModel::HierarchicalNodeInformation *RsFriendListModel::getBestNodeInformation(const HierarchicalProfileInformation *profileInfo, RsStatusValue *status) const
|
||||
{
|
||||
if (status) {
|
||||
*status = RS_STATUS_OFFLINE;
|
||||
*status = RsStatusValue::RS_STATUS_OFFLINE;
|
||||
}
|
||||
|
||||
if (!profileInfo) {
|
||||
|
@ -921,28 +921,28 @@ const RsFriendListModel::HierarchicalNodeInformation *RsFriendListModel::getBest
|
|||
|
||||
int statusIndex = 0;
|
||||
switch (statusInfo.status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||
statusIndex = 1;
|
||||
break;
|
||||
|
||||
case RS_STATUS_INACTIVE:
|
||||
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||
statusIndex = 2;
|
||||
break;
|
||||
|
||||
case RS_STATUS_AWAY:
|
||||
case RsStatusValue::RS_STATUS_AWAY:
|
||||
statusIndex = 3;
|
||||
break;
|
||||
|
||||
case RS_STATUS_BUSY:
|
||||
case RsStatusValue::RS_STATUS_BUSY:
|
||||
statusIndex = 4;
|
||||
break;
|
||||
|
||||
case RS_STATUS_ONLINE:
|
||||
case RsStatusValue::RS_STATUS_ONLINE:
|
||||
statusIndex = 5;
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cerr << "FriendListModel: Unknown status " << statusInfo.status << std::endl;
|
||||
std::cerr << "FriendListModel: Unknown status " << (int)statusInfo.status << std::endl;
|
||||
}
|
||||
|
||||
if (bestStatusIndex == 0 || statusIndex > bestStatusIndex) {
|
||||
|
@ -999,7 +999,7 @@ QVariant RsFriendListModel::decorationRole(const EntryIndex& entry,int col) cons
|
|||
QPixmap sslAvatar;
|
||||
bool foundAvatar = false;
|
||||
const HierarchicalProfileInformation *hn = getProfileInfo(entry);
|
||||
uint32_t status = RS_STATUS_OFFLINE;
|
||||
RsStatusValue status = RsStatusValue::RS_STATUS_OFFLINE;
|
||||
const HierarchicalNodeInformation *bestNodeInformation = NULL;
|
||||
|
||||
if (mDisplayStatusIcon) {
|
||||
|
@ -1049,7 +1049,7 @@ QVariant RsFriendListModel::decorationRole(const EntryIndex& entry,int col) cons
|
|||
QPixmap sslAvatar;
|
||||
AvatarDefs::getAvatarFromSslId(RsPeerId(hn->node_info.id.toStdString()), sslAvatar);
|
||||
if (mDisplayStatusIcon) {
|
||||
QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(statusRole(entry, col).toInt()));
|
||||
QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(RsStatusValue(statusRole(entry, col).toInt())));
|
||||
return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon)));
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
|
||||
/* Color definitions (for standard see default.qss) */
|
||||
QColor mTextColorGroup;
|
||||
QColor mTextColorStatus[RS_STATUS_COUNT];
|
||||
QColor mTextColorStatus[(int)RsStatusValue::RS_STATUS_COUNT];
|
||||
|
||||
private:
|
||||
const HierarchicalGroupInformation *getGroupInfo (const EntryIndex&) const;
|
||||
|
@ -223,7 +223,7 @@ private:
|
|||
|
||||
uint32_t updateFilterStatus(ForumModelIndex i,int column,const QStringList& strings);
|
||||
|
||||
const HierarchicalNodeInformation *getBestNodeInformation(const HierarchicalProfileInformation *profileInfo, uint32_t *status = NULL) const;
|
||||
const HierarchicalNodeInformation *getBestNodeInformation(const HierarchicalProfileInformation *profileInfo, RsStatusValue *status = NULL) const;
|
||||
|
||||
QStringList mFilterStrings;
|
||||
FilterType mFilterType;
|
||||
|
|
|
@ -101,8 +101,8 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent)
|
|||
connect(ui->friendList, SIGNAL(itemSelectionChanged()), this, SIGNAL(itemSelectionChanged()));
|
||||
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(groupsChanged(int)));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&,int)), this, SLOT(peerStatusChanged(const QString&,int)));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(groupsChanged(int)));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&,int)), this, SLOT(peerStatusChanged(const QString&,int)));
|
||||
|
||||
mCompareRole = new RSTreeWidgetItemCompareRole;
|
||||
mActionSortByState = new QAction(tr("Sort by state"), this);
|
||||
|
@ -134,7 +134,7 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent)
|
|||
RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId_identities, RsEventType::GXS_IDENTITY );
|
||||
mEventHandlerId_peers = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) {
|
||||
RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId_peers, RsEventType::PEER_CONNECTION );
|
||||
RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId_peers, RsEventType::FRIEND_LIST );
|
||||
|
||||
mFontSizeHandler.registerFontSize(ui->friendList);
|
||||
}
|
||||
|
@ -149,17 +149,31 @@ void FriendSelectionWidget::handleEvent_main_thread(std::shared_ptr<const RsEven
|
|||
update(); // Qt flush
|
||||
return;
|
||||
}
|
||||
const RsConnectionEvent *fp = dynamic_cast<const RsConnectionEvent*>(event.get());
|
||||
const RsFriendListEvent *fp = dynamic_cast<const RsFriendListEvent*>(event.get());
|
||||
|
||||
if(fp)
|
||||
switch(fp->mConnectionInfoCode)
|
||||
switch(fp->mEventCode)
|
||||
{
|
||||
case RsConnectionEventCode::PEER_REMOVED:
|
||||
case RsConnectionEventCode::PEER_ADDED:
|
||||
case RsFriendListEventCode::NODE_REMOVED:
|
||||
case RsFriendListEventCode::NODE_ADDED:
|
||||
updateDisplay(true);
|
||||
update(); // Qt flush
|
||||
break;
|
||||
default: break ;
|
||||
case RsFriendListEventCode::GROUP_ADDED:
|
||||
case RsFriendListEventCode::GROUP_REMOVED:
|
||||
case RsFriendListEventCode::GROUP_CHANGED:
|
||||
groupsChanged();
|
||||
break;
|
||||
|
||||
case RsFriendListEventCode::NODE_STATUS_CHANGED:
|
||||
{
|
||||
StatusInfo i;
|
||||
rsStatus->getStatus(fp->mSslId,i);
|
||||
|
||||
peerStatusChanged(fp->mSslId,i.status);
|
||||
}
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,7 +255,7 @@ static void initSslItem(QTreeWidgetItem *item, const RsPeerDetails &detail, cons
|
|||
QString name = PeerDefs::nameWithLocation(detail);
|
||||
item->setText(COLUMN_NAME, name);
|
||||
|
||||
int state = RS_STATUS_OFFLINE;
|
||||
RsStatusValue state = RsStatusValue::RS_STATUS_OFFLINE;
|
||||
if (detail.state & RS_PEER_STATE_CONNECTED) {
|
||||
std::list<StatusInfo>::const_iterator it;
|
||||
for (it = statusInfo.begin(); it != statusInfo.end() ; ++it) {
|
||||
|
@ -252,7 +266,7 @@ static void initSslItem(QTreeWidgetItem *item, const RsPeerDetails &detail, cons
|
|||
}
|
||||
}
|
||||
|
||||
if (state != (int) RS_STATUS_OFFLINE) {
|
||||
if (state != RsStatusValue::RS_STATUS_OFFLINE) {
|
||||
item->setData(COLUMN_NAME, Qt::ForegroundRole, textColorOnline);
|
||||
}
|
||||
|
||||
|
@ -262,7 +276,7 @@ static void initSslItem(QTreeWidgetItem *item, const RsPeerDetails &detail, cons
|
|||
item->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
|
||||
item->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
|
||||
item->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
|
||||
item->setData(COLUMN_NAME, ROLE_SORT_STATE, state);
|
||||
item->setData(COLUMN_NAME, ROLE_SORT_STATE, (int)state);
|
||||
}
|
||||
|
||||
void FriendSelectionWidget::fillList()
|
||||
|
@ -501,17 +515,17 @@ void FriendSelectionWidget::secured_fillList()
|
|||
sslIds.clear();
|
||||
rsPeers->getAssociatedSSLIds(*gpgIt, sslIds);
|
||||
|
||||
int state = RS_STATUS_OFFLINE;
|
||||
RsStatusValue state = RsStatusValue::RS_STATUS_OFFLINE;
|
||||
for (statusIt = statusInfo.begin(); statusIt != statusInfo.end() ; ++statusIt) {
|
||||
if (std::find(sslIds.begin(), sslIds.end(), statusIt->id) != sslIds.end()) {
|
||||
if (statusIt->status != RS_STATUS_OFFLINE) {
|
||||
state = RS_STATUS_ONLINE;
|
||||
if (statusIt->status != RsStatusValue::RS_STATUS_OFFLINE) {
|
||||
state = RsStatusValue::RS_STATUS_ONLINE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state != (int) RS_STATUS_OFFLINE) {
|
||||
if (state != RsStatusValue::RS_STATUS_OFFLINE) {
|
||||
gpgItem->setData(COLUMN_NAME, Qt::ForegroundRole, textColorOnline());
|
||||
}
|
||||
|
||||
|
@ -522,7 +536,7 @@ void FriendSelectionWidget::secured_fillList()
|
|||
gpgItem->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
|
||||
gpgItem->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
|
||||
gpgItem->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
|
||||
gpgItem->setData(COLUMN_NAME, ROLE_SORT_STATE, state);
|
||||
gpgItem->setData(COLUMN_NAME, ROLE_SORT_STATE, (int)state);
|
||||
|
||||
if (mListModus == MODUS_CHECK) {
|
||||
gpgItem->setCheckState(0, Qt::Unchecked);
|
||||
|
@ -770,23 +784,20 @@ template<> inline void FriendSelectionWidget::setSelectedIds<RsGxsId,FriendSelec
|
|||
loadIdentities();
|
||||
}
|
||||
|
||||
void FriendSelectionWidget::groupsChanged(int /*type*/)
|
||||
void FriendSelectionWidget::groupsChanged()
|
||||
{
|
||||
if (mShowTypes & SHOW_GROUP) {
|
||||
fillList();
|
||||
}
|
||||
}
|
||||
|
||||
void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
||||
void FriendSelectionWidget::peerStatusChanged(const RsPeerId& peerid, RsStatusValue status)
|
||||
{
|
||||
if(!isVisible())
|
||||
return ;
|
||||
if(RsAutoUpdatePage::eventsLocked())
|
||||
return ;
|
||||
|
||||
RsPeerId peerid(peerId.toStdString()) ;
|
||||
QString gpgId;
|
||||
int gpgStatus = RS_STATUS_OFFLINE;
|
||||
RsStatusValue gpgStatus = RsStatusValue::RS_STATUS_OFFLINE;
|
||||
|
||||
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
|
||||
/* need gpg id and online state */
|
||||
|
@ -795,7 +806,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
|||
{
|
||||
gpgId = QString::fromStdString(detail.gpg_id.toStdString());
|
||||
|
||||
if (status == (int) RS_STATUS_OFFLINE) {
|
||||
if (status == RsStatusValue::RS_STATUS_OFFLINE) {
|
||||
/* try other nodes */
|
||||
std::list<RsPeerId> sslIds;
|
||||
rsPeers->getAssociatedSSLIds(detail.gpg_id, sslIds);
|
||||
|
@ -806,15 +817,15 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
|||
|
||||
for (statusIt = statusInfo.begin(); statusIt != statusInfo.end() ; ++statusIt) {
|
||||
if (std::find(sslIds.begin(), sslIds.end(), statusIt->id) != sslIds.end()) {
|
||||
if (statusIt->status != RS_STATUS_OFFLINE) {
|
||||
gpgStatus = RS_STATUS_ONLINE;
|
||||
if (statusIt->status != RsStatusValue::RS_STATUS_OFFLINE) {
|
||||
gpgStatus = RsStatusValue::RS_STATUS_ONLINE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* one node is online */
|
||||
gpgStatus = RS_STATUS_ONLINE;
|
||||
gpgStatus = RsStatusValue::RS_STATUS_ONLINE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -834,7 +845,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
|||
case IDTYPE_GPG:
|
||||
{
|
||||
if (item->data(COLUMN_DATA, ROLE_ID).toString() == gpgId) {
|
||||
if (status != (int) RS_STATUS_OFFLINE) {
|
||||
if (status != RsStatusValue::RS_STATUS_OFFLINE) {
|
||||
item->setData(COLUMN_NAME, Qt::ForegroundRole, textColorOnline());
|
||||
} else {
|
||||
item->setData(COLUMN_NAME, Qt::ForegroundRole, QVariant());
|
||||
|
@ -842,7 +853,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
|||
|
||||
item->setIcon(COLUMN_NAME, FilesDefs::getIconFromQtResourcePath(StatusDefs::imageUser(gpgStatus)));
|
||||
|
||||
item->setData(COLUMN_NAME, ROLE_SORT_STATE, gpgStatus);
|
||||
item->setData(COLUMN_NAME, ROLE_SORT_STATE, (int)gpgStatus);
|
||||
|
||||
bFoundGPG = true;
|
||||
}
|
||||
|
@ -850,8 +861,9 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
|||
break;
|
||||
case IDTYPE_SSL:
|
||||
{
|
||||
if (item->data(COLUMN_DATA, ROLE_ID).toString() == peerId) {
|
||||
if (status != (int) RS_STATUS_OFFLINE) {
|
||||
if (RsPeerId(item->data(COLUMN_DATA, ROLE_ID).toString().toStdString()) == peerid)
|
||||
{
|
||||
if (status != RsStatusValue::RS_STATUS_OFFLINE) {
|
||||
item->setData(COLUMN_NAME, Qt::ForegroundRole, textColorOnline());
|
||||
} else {
|
||||
item->setData(COLUMN_NAME, Qt::ForegroundRole, QVariant());
|
||||
|
@ -859,7 +871,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
|||
|
||||
item->setIcon(COLUMN_NAME, FilesDefs::getIconFromQtResourcePath(StatusDefs::imageUser(status)));
|
||||
|
||||
item->setData(COLUMN_NAME, ROLE_SORT_STATE, status);
|
||||
item->setData(COLUMN_NAME, ROLE_SORT_STATE, (int)status);
|
||||
|
||||
bFoundSSL = true;
|
||||
}
|
||||
|
@ -1262,7 +1274,7 @@ bool FriendSelectionWidget::isSortByState()
|
|||
|
||||
void FriendSelectionWidget::filterConnected(bool filter)
|
||||
{
|
||||
ui->friendList->filterMinValItems(COLUMN_NAME, filter ? RS_STATUS_AWAY : RS_STATUS_OFFLINE, ROLE_SORT_STATE);
|
||||
ui->friendList->filterMinValItems(COLUMN_NAME, filter ? double(RsStatusValue::RS_STATUS_AWAY) : double(RsStatusValue::RS_STATUS_OFFLINE), ROLE_SORT_STATE);
|
||||
|
||||
mActionFilterConnected->setChecked(filter);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <QDialog>
|
||||
|
||||
#include "retroshare/rsevents.h"
|
||||
#include "retroshare/rsstatus.h"
|
||||
#include <gui/gxs/RsGxsUpdateBroadcastPage.h>
|
||||
#include "util/FontSizeHandler.h"
|
||||
|
||||
|
@ -137,8 +138,7 @@ public slots:
|
|||
void filterConnected(bool filter);
|
||||
|
||||
private slots:
|
||||
void groupsChanged(int type);
|
||||
void peerStatusChanged(const QString& peerId, int status);
|
||||
void peerStatusChanged(const RsPeerId &peerid, RsStatusValue status);
|
||||
void filterItems(const QString &text);
|
||||
void contextMenuRequested(const QPoint &pos);
|
||||
void itemDoubleClicked(QTreeWidgetItem *item, int column);
|
||||
|
@ -147,6 +147,7 @@ private slots:
|
|||
void deselectAll() ;
|
||||
|
||||
private:
|
||||
void groupsChanged();
|
||||
void fillList();
|
||||
void secured_fillList();
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "GroupSelectionBox.h"
|
||||
#include "GroupDefs.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -34,11 +35,40 @@ GroupSelectionBox::GroupSelectionBox(QWidget *parent)
|
|||
{
|
||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(fillGroups()));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(fillGroups()));
|
||||
|
||||
mEventHandlerId = 0;
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=]()
|
||||
{
|
||||
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||
|
||||
if(!fe)
|
||||
return;
|
||||
|
||||
switch(fe->mEventCode)
|
||||
{
|
||||
case RsFriendListEventCode::GROUP_ADDED:
|
||||
case RsFriendListEventCode::GROUP_REMOVED:
|
||||
case RsFriendListEventCode::GROUP_CHANGED: fillGroups();
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
, this );
|
||||
}, mEventHandlerId, RsEventType::FRIEND_LIST );
|
||||
|
||||
// Fill with available groups
|
||||
fillGroups();
|
||||
}
|
||||
|
||||
GroupSelectionBox::~GroupSelectionBox()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
void GroupSelectionBox::fillGroups()
|
||||
{
|
||||
std::list<RsNodeGroupId> selectedIds;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <QListWidget>
|
||||
#include <QDialog>
|
||||
#include <retroshare/rsids.h>
|
||||
#include <retroshare/rsevents.h>
|
||||
|
||||
class GroupSelectionBox: public QListWidget
|
||||
{
|
||||
|
@ -28,6 +29,7 @@ class GroupSelectionBox: public QListWidget
|
|||
|
||||
public:
|
||||
GroupSelectionBox(QWidget *parent);
|
||||
virtual ~GroupSelectionBox();
|
||||
|
||||
static void selectGroups(const std::list<RsNodeGroupId>& default_groups) ;
|
||||
|
||||
|
@ -38,6 +40,9 @@ public:
|
|||
|
||||
private slots:
|
||||
void fillGroups();
|
||||
|
||||
private:
|
||||
RsEventsHandlerId_t mEventHandlerId ;
|
||||
};
|
||||
|
||||
class GroupSelectionDialog: public QDialog
|
||||
|
|
|
@ -259,7 +259,7 @@ void HashBox::checkAttachmentReady()
|
|||
emit fileHashingFinished(hashedFiles);
|
||||
|
||||
auto ev = std::make_shared<RsSharedDirectoriesEvent>();
|
||||
ev->mEventCode = RsSharedDirectoriesEventCode::DIRECTORY_SWEEP_ENDED;
|
||||
ev->mEventCode = RsSharedDirectoriesEventCode::HASHING_PROCESS_FINISHED;
|
||||
if(rsEvents)
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
|
|
|
@ -132,8 +132,8 @@ public:
|
|||
if(is_group_1 ^ is_group_2) // if the two are different, put the group first.
|
||||
return is_group_1 ;
|
||||
|
||||
bool online1 = (left .data(RsFriendListModel::OnlineRole).toInt() != RS_STATUS_OFFLINE);
|
||||
bool online2 = (right.data(RsFriendListModel::OnlineRole).toInt() != RS_STATUS_OFFLINE);
|
||||
bool online1 = (left .data(RsFriendListModel::OnlineRole).toInt() != (int)RsStatusValue::RS_STATUS_OFFLINE);
|
||||
bool online2 = (right.data(RsFriendListModel::OnlineRole).toInt() != (int)RsStatusValue::RS_STATUS_OFFLINE);
|
||||
|
||||
if((online1 != online2) && m_sortByState)
|
||||
return (m_header->sortIndicatorOrder()==Qt::AscendingOrder)?online1:online2 ; // always put online nodes first
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
|
||||
// Filter offline friends
|
||||
|
||||
if(!m_showOfflineNodes && (index.data(RsFriendListModel::OnlineRole).toInt() == RS_STATUS_OFFLINE))
|
||||
if(!m_showOfflineNodes && (RsStatusValue(index.data(RsFriendListModel::OnlineRole).toInt()) == RsStatusValue::RS_STATUS_OFFLINE))
|
||||
return false;
|
||||
|
||||
return index.data(RsFriendListModel::FilterRole).toString() == RsFriendListModel::FilterString ;
|
||||
|
@ -195,16 +195,16 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par
|
|||
ui->filterLineEdit->setPlaceholderText(tr("Search")) ;
|
||||
ui->filterLineEdit->showFilterIcon();
|
||||
|
||||
// mEventHandlerId_pssc=0; // forces initialization
|
||||
mEventHandlerId_peer=0; // forces initialization
|
||||
mEventHandlerId_gssp=0; // forces initialization
|
||||
mEventHandlerId_pssc=0; // forces initialization
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_pssc, RsEventType::PEER_STATE_CHANGED );
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_peer, RsEventType::PEER_CONNECTION );
|
||||
// rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_pssc, RsEventType::PEER_STATE_CHANGED );
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_peer, RsEventType::FRIEND_LIST );
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_gssp, RsEventType::GOSSIP_DISCOVERY );
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(QString)), this, SLOT(forceUpdateDisplay()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(forceUpdateDisplay()));
|
||||
// connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(QString)), this, SLOT(forceUpdateDisplay()));
|
||||
// connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(forceUpdateDisplay()));
|
||||
|
||||
mModel = new RsFriendListModel(ui->peerTreeWidget);
|
||||
mProxyModel = new FriendListSortFilterProxyModel(ui->peerTreeWidget->header(),this);
|
||||
|
@ -293,7 +293,7 @@ NewFriendList::~NewFriendList()
|
|||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId_peer);
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId_gssp);
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId_pssc);
|
||||
// rsEvents->unregisterEventsHandler(mEventHandlerId_pssc);
|
||||
|
||||
delete mModel;
|
||||
delete mProxyModel;
|
||||
|
|
|
@ -66,18 +66,18 @@ public:
|
|||
//void updateDisplay() override;
|
||||
|
||||
QColor textColorGroup() const { return mModel->mTextColorGroup; }
|
||||
QColor textColorStatusOffline() const { return mModel->mTextColorStatus[RS_STATUS_OFFLINE ]; }
|
||||
QColor textColorStatusAway() const { return mModel->mTextColorStatus[RS_STATUS_AWAY ]; }
|
||||
QColor textColorStatusBusy() const { return mModel->mTextColorStatus[RS_STATUS_BUSY ]; }
|
||||
QColor textColorStatusOnline() const { return mModel->mTextColorStatus[RS_STATUS_ONLINE ]; }
|
||||
QColor textColorStatusInactive() const { return mModel->mTextColorStatus[RS_STATUS_INACTIVE]; }
|
||||
QColor textColorStatusOffline() const { return mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_OFFLINE ]; }
|
||||
QColor textColorStatusAway() const { return mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_AWAY ]; }
|
||||
QColor textColorStatusBusy() const { return mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_BUSY ]; }
|
||||
QColor textColorStatusOnline() const { return mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_ONLINE ]; }
|
||||
QColor textColorStatusInactive() const { return mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_INACTIVE]; }
|
||||
|
||||
void setTextColorGroup(QColor color) { mModel->mTextColorGroup = color; }
|
||||
void setTextColorStatusOffline(QColor color) { mModel->mTextColorStatus[RS_STATUS_OFFLINE ] = color; }
|
||||
void setTextColorStatusAway(QColor color) { mModel->mTextColorStatus[RS_STATUS_AWAY ] = color; }
|
||||
void setTextColorStatusBusy(QColor color) { mModel->mTextColorStatus[RS_STATUS_BUSY ] = color; }
|
||||
void setTextColorStatusOnline(QColor color) { mModel->mTextColorStatus[RS_STATUS_ONLINE ] = color; }
|
||||
void setTextColorStatusInactive(QColor color) { mModel->mTextColorStatus[RS_STATUS_INACTIVE] = color; }
|
||||
void setTextColorStatusOffline(QColor color) { mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_OFFLINE ] = color; }
|
||||
void setTextColorStatusAway(QColor color) { mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_AWAY ] = color; }
|
||||
void setTextColorStatusBusy(QColor color) { mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_BUSY ] = color; }
|
||||
void setTextColorStatusOnline(QColor color) { mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_ONLINE ] = color; }
|
||||
void setTextColorStatusInactive(QColor color) { mModel->mTextColorStatus[(uint8_t)RsStatusValue::RS_STATUS_INACTIVE] = color; }
|
||||
|
||||
public slots:
|
||||
void filterItems(const QString &text);
|
||||
|
@ -127,7 +127,7 @@ private:
|
|||
bool mShowState;
|
||||
RsEventsHandlerId_t mEventHandlerId_peer;
|
||||
RsEventsHandlerId_t mEventHandlerId_gssp;
|
||||
RsEventsHandlerId_t mEventHandlerId_pssc;
|
||||
// RsEventsHandlerId_t mEventHandlerId_pssc;
|
||||
|
||||
std::set<RsNodeGroupId> openGroups;
|
||||
std::set<RsPgpId> openPeers;
|
||||
|
|
|
@ -24,118 +24,124 @@
|
|||
|
||||
#include "StatusDefs.h"
|
||||
|
||||
QString StatusDefs::name(unsigned int status)
|
||||
QString StatusDefs::name(RsStatusValue status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
default:
|
||||
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||
return qApp->translate("StatusDefs", "Offline");
|
||||
case RS_STATUS_AWAY:
|
||||
case RsStatusValue::RS_STATUS_AWAY:
|
||||
return qApp->translate("StatusDefs", "Away");
|
||||
case RS_STATUS_BUSY:
|
||||
case RsStatusValue::RS_STATUS_BUSY:
|
||||
return qApp->translate("StatusDefs", "Busy");
|
||||
case RS_STATUS_ONLINE:
|
||||
case RsStatusValue::RS_STATUS_ONLINE:
|
||||
return qApp->translate("StatusDefs", "Online");
|
||||
case RS_STATUS_INACTIVE:
|
||||
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||
return qApp->translate("StatusDefs", "Idle");
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::name: Unknown status requested " << status;
|
||||
RsErr() << "StatusDefs::name: Unknown status requested " << (int)status;
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *StatusDefs::imageIM(unsigned int status)
|
||||
const char *StatusDefs::imageIM(RsStatusValue status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
default:
|
||||
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||
return ":/images/im-user-offline.png";
|
||||
case RS_STATUS_AWAY:
|
||||
case RsStatusValue::RS_STATUS_AWAY:
|
||||
return ":/images/im-user-away.png";
|
||||
case RS_STATUS_BUSY:
|
||||
case RsStatusValue::RS_STATUS_BUSY:
|
||||
return ":/images/im-user-busy.png";
|
||||
case RS_STATUS_ONLINE:
|
||||
case RsStatusValue::RS_STATUS_ONLINE:
|
||||
return ":/images/im-user.png";
|
||||
case RS_STATUS_INACTIVE:
|
||||
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||
return ":/images/im-user-inactive.png";
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::imageIM: Unknown status requested " << status;
|
||||
RsErr() << "StatusDefs::imageIM: Unknown status requested " << (int)status;
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *StatusDefs::imageUser(unsigned int status)
|
||||
const char *StatusDefs::imageUser(RsStatusValue status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
default:
|
||||
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||
return ":/images/user/identityoffline24.png";
|
||||
case RS_STATUS_AWAY:
|
||||
case RsStatusValue::RS_STATUS_AWAY:
|
||||
return ":/images/user/identity24away.png";
|
||||
case RS_STATUS_BUSY:
|
||||
case RsStatusValue::RS_STATUS_BUSY:
|
||||
return ":/images/user/identity24busy.png";
|
||||
case RS_STATUS_ONLINE:
|
||||
case RsStatusValue::RS_STATUS_ONLINE:
|
||||
return ":/images/user/identity24.png";
|
||||
case RS_STATUS_INACTIVE:
|
||||
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||
return ":/images/user/identity24idle.png";
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::imageUser: Unknown status requested " << status;
|
||||
RsErr() << "StatusDefs::imageUser: Unknown status requested " << (int)status;
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *StatusDefs::imageStatus(unsigned int status)
|
||||
const char *StatusDefs::imageStatus(RsStatusValue status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
default:
|
||||
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||
return ":/icons/user-offline_64.png";
|
||||
case RS_STATUS_AWAY:
|
||||
case RsStatusValue::RS_STATUS_AWAY:
|
||||
return ":/icons/user-away_64.png";
|
||||
case RS_STATUS_BUSY:
|
||||
case RsStatusValue::RS_STATUS_BUSY:
|
||||
return ":/icons/user-busy_64.png";
|
||||
case RS_STATUS_ONLINE:
|
||||
case RsStatusValue::RS_STATUS_ONLINE:
|
||||
return ":/icons/user-online_64.png";
|
||||
case RS_STATUS_INACTIVE:
|
||||
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||
return ":/icons/user-away-extended_64.png";
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::imageUser: Unknown status requested " << status;
|
||||
RsErr() << "StatusDefs::imageUser: Unknown status requested " << (int)status;
|
||||
return "";
|
||||
}
|
||||
|
||||
QString StatusDefs::tooltip(unsigned int status)
|
||||
QString StatusDefs::tooltip(RsStatusValue status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
default:
|
||||
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||
return qApp->translate("StatusDefs", "Friend is offline");
|
||||
case RS_STATUS_AWAY:
|
||||
case RsStatusValue::RS_STATUS_AWAY:
|
||||
return qApp->translate("StatusDefs", "Friend is away");
|
||||
case RS_STATUS_BUSY:
|
||||
case RsStatusValue::RS_STATUS_BUSY:
|
||||
return qApp->translate("StatusDefs", "Friend is busy");
|
||||
case RS_STATUS_ONLINE:
|
||||
case RsStatusValue::RS_STATUS_ONLINE:
|
||||
return qApp->translate("StatusDefs", "Friend is online");
|
||||
case RS_STATUS_INACTIVE:
|
||||
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||
return qApp->translate("StatusDefs", "Friend is idle");
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::tooltip: Unknown status requested " << status;
|
||||
RsErr() << "StatusDefs::tooltip: Unknown status requested " << (int)status;
|
||||
return "";
|
||||
}
|
||||
|
||||
QFont StatusDefs::font(unsigned int status)
|
||||
QFont StatusDefs::font(RsStatusValue status)
|
||||
{
|
||||
QFont font;
|
||||
|
||||
switch (status) {
|
||||
case RS_STATUS_AWAY:
|
||||
case RS_STATUS_BUSY:
|
||||
case RS_STATUS_ONLINE:
|
||||
case RS_STATUS_INACTIVE:
|
||||
default:
|
||||
case RsStatusValue::RS_STATUS_AWAY:
|
||||
case RsStatusValue::RS_STATUS_BUSY:
|
||||
case RsStatusValue::RS_STATUS_ONLINE:
|
||||
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||
font.setBold(true);
|
||||
return font;
|
||||
case RS_STATUS_OFFLINE:
|
||||
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||
font.setBold(false);
|
||||
return font;
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::font: Unknown status requested " << status;
|
||||
RsErr() << "StatusDefs::font: Unknown status requested " << (int)status;
|
||||
return font;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,18 +24,20 @@
|
|||
#include <QColor>
|
||||
#include <QFont>
|
||||
|
||||
#include "retroshare/rsstatus.h"
|
||||
|
||||
struct RsPeerDetails;
|
||||
|
||||
class StatusDefs
|
||||
{
|
||||
public:
|
||||
static QString name(unsigned int status);
|
||||
static const char* imageIM(unsigned int status);
|
||||
static const char* imageUser(unsigned int status);
|
||||
static const char* imageStatus(unsigned int status);
|
||||
static QString tooltip(unsigned int status);
|
||||
static QString name(RsStatusValue status);
|
||||
static const char* imageIM(RsStatusValue status);
|
||||
static const char* imageUser(RsStatusValue status);
|
||||
static const char* imageStatus(RsStatusValue status);
|
||||
static QString tooltip(RsStatusValue status);
|
||||
|
||||
static QFont font(unsigned int status);
|
||||
static QFont font(RsStatusValue status);
|
||||
|
||||
static QString peerStateString(int peerState);
|
||||
static QString connectStateString(RsPeerDetails &details);
|
||||
|
|
|
@ -968,190 +968,6 @@ void ConnectFriendWizard::openCert()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef TO_BE_REMOVED
|
||||
//========================== CertificatePage =================================
|
||||
|
||||
void ConnectFriendWizard::loadFriendCert()
|
||||
{
|
||||
QString fileName ;
|
||||
if(!misc::getOpenFileName(this, RshareSettings::LASTDIR_CERT, tr("Select Certificate"), tr("RetroShare Certificate (*.rsc );;All Files (*)"),fileName))
|
||||
return ;
|
||||
|
||||
if (!fileName.isNull()) {
|
||||
ui->friendFileNameEdit->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectFriendWizard::generateCertificateCalled()
|
||||
{
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << " generateCertificateCalled" << std::endl;
|
||||
#endif
|
||||
|
||||
std::string cert = rsPeers->GetRetroshareInvite();
|
||||
if (cert.empty()) {
|
||||
QMessageBox::information(this, "RetroShare", tr("Sorry, create certificate failed"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
QString qdir = QFileDialog::getSaveFileName(this, tr("Please choose a filename"), QDir::homePath(), tr("RetroShare Certificate (*.rsc );;All Files (*)"));
|
||||
|
||||
//Todo: move save to file to p3Peers::SaveCertificateToFile
|
||||
|
||||
if (qdir.isEmpty() == false) {
|
||||
QFile CertFile(qdir);
|
||||
if (CertFile.open(QIODevice::WriteOnly/* | QIODevice::Text*/)) {
|
||||
if (CertFile.write(QByteArray(cert.c_str())) > 0) {
|
||||
QMessageBox::information(this, "RetroShare", tr("Certificate file successfully created"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
} else {
|
||||
QMessageBox::information(this, "RetroShare", tr("Sorry, certificate file creation failed"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
}
|
||||
CertFile.close();
|
||||
} else {
|
||||
QMessageBox::information(this, "RetroShare", tr("Sorry, certificate file creation failed"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//============================= FofPage ======================================
|
||||
|
||||
void ConnectFriendWizard::updatePeersList(int index)
|
||||
{
|
||||
|
||||
ui->selectedPeersTW->clearContents();
|
||||
ui->selectedPeersTW->setRowCount(0);
|
||||
|
||||
RsPgpId ownId = rsPeers->getGPGOwnId();
|
||||
|
||||
int row = 0;
|
||||
|
||||
_id_boxes.clear();
|
||||
|
||||
// We have to use this trick because signers are given by their names instead of their ids. That's a cause
|
||||
// for some confusion when two peers have the same name.
|
||||
//
|
||||
std::list<RsPgpId> gpg_ids;
|
||||
rsPeers->getGPGAllList(gpg_ids);
|
||||
for (std::list<RsPgpId>::const_iterator it(gpg_ids.begin()); it != gpg_ids.end(); ++it) {
|
||||
if (*it == ownId) {
|
||||
// its me
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << "examining peer " << *it << " (name=" << rsPeers->getPeerName(*it);
|
||||
#endif
|
||||
|
||||
RsPeerDetails details ;
|
||||
if (!rsPeers->getGPGDetails(*it,details)) {
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << " no details." << std::endl ;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
// determine common friends
|
||||
|
||||
std::list<RsPgpId> common_friends;
|
||||
|
||||
for (std::list<RsPgpId>::const_iterator it2(details.gpgSigners.begin()); it2 != details.gpgSigners.end(); ++it2) {
|
||||
if(rsPeers->isGPGAccepted(*it2)) {
|
||||
common_friends.push_back(*it2);
|
||||
}
|
||||
}
|
||||
bool show = false;
|
||||
|
||||
switch(index) {
|
||||
case 0: // "All unsigned friends of my friends"
|
||||
show = !details.ownsign;
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << "case 0: ownsign=" << details.ownsign << ", show=" << show << std::endl;
|
||||
#endif
|
||||
break ;
|
||||
case 1: // "Unsigned peers who already signed my certificate"
|
||||
show = details.hasSignedMe && !(details.state & RS_PEER_STATE_FRIEND);
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << "case 1, ownsign=" << details.ownsign << ", is_authed_me=" << details.hasSignedMe << ", show=" << show << std::endl;
|
||||
#endif
|
||||
break ;
|
||||
case 2: // "Peers shown as denied"
|
||||
show = details.ownsign && !(details.state & RS_PEER_STATE_FRIEND);
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << "case 2, ownsign=" << details.ownsign << ", state_friend=" << (details.state & RS_PEER_STATE_FRIEND) << ", show=" << show << std::endl;
|
||||
#endif
|
||||
break ;
|
||||
}
|
||||
|
||||
if (show) {
|
||||
ui->selectedPeersTW->insertRow(row);
|
||||
|
||||
QCheckBox *cb = new QCheckBox;
|
||||
cb->setChecked(true);
|
||||
_id_boxes[cb] = details.id;
|
||||
_gpg_id_boxes[cb] = details.gpg_id;
|
||||
|
||||
ui->selectedPeersTW->setCellWidget(row, 0, cb);
|
||||
ui->selectedPeersTW->setItem(row, 1, new QTableWidgetItem(QString::fromUtf8(details.name.c_str())));
|
||||
|
||||
QComboBox *qcb = new QComboBox;
|
||||
|
||||
if (common_friends.empty()) {
|
||||
qcb->addItem(tr("*** None ***"));
|
||||
} else {
|
||||
for (std::list<RsPgpId>::const_iterator it2(common_friends.begin()); it2 != common_friends.end(); ++it2) {
|
||||
qcb->addItem(QString::fromStdString( (*it2).toStdString()));
|
||||
}
|
||||
}
|
||||
|
||||
ui->selectedPeersTW->setCellWidget(row, 2, qcb);
|
||||
ui->selectedPeersTW->setItem(row, 3, new QTableWidgetItem(QString::fromStdString(details.id.toStdString())));
|
||||
++row;
|
||||
}
|
||||
}
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << "FofPage::updatePeersList() finished iterating over peers" << std::endl;
|
||||
#endif
|
||||
|
||||
if (row>0) {
|
||||
ui->selectedPeersTW->resizeColumnsToContents();
|
||||
ui->makeFriendButton->setEnabled(true);
|
||||
} else {
|
||||
ui->makeFriendButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectFriendWizard::signAllSelectedUsers()
|
||||
{
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << "making lots of friends !!" << std::endl;
|
||||
#endif
|
||||
|
||||
for (std::map<QCheckBox*, RsPeerId>::const_iterator it(_id_boxes.begin()); it != _id_boxes.end(); ++it) {
|
||||
if (it->first->isChecked()) {
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << "Making friend with " << it->second << std::endl ;
|
||||
#endif
|
||||
//rsPeers->AuthCertificate(it->second, "");
|
||||
rsPeers->addFriend(it->second, _gpg_id_boxes[it->first]);
|
||||
}
|
||||
}
|
||||
|
||||
ui->FofPage->setComplete(true);
|
||||
|
||||
ui->userSelectionCB->setEnabled(false);
|
||||
ui->selectedPeersTW->setEnabled(false);
|
||||
ui->makeFriendButton->setEnabled(false);
|
||||
|
||||
NotifyQt::getInstance()->notifyListChange(NOTIFY_LIST_NEIGHBOURS,0);
|
||||
NotifyQt::getInstance()->notifyListChange(NOTIFY_LIST_FRIENDS,0);
|
||||
}
|
||||
|
||||
//============================= RsidPage =====================================
|
||||
|
||||
|
||||
//============================ Emailpage =====================================
|
||||
#endif
|
||||
|
||||
//========================= ErrorMessagePage =================================
|
||||
|
||||
//========================== ConclusionPage ==================================
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "gui/common/StatusDefs.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
|
@ -58,7 +59,23 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId,
|
|||
connect( chatButton, SIGNAL( clicked() ), this, SLOT( openChat() ) );
|
||||
connect( sendmsgButton, SIGNAL( clicked() ), this, SLOT( sendMsg() ) );
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));
|
||||
|
||||
mEventHandlerId = 0;
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=]()
|
||||
{
|
||||
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||
|
||||
if(!fe)
|
||||
return;
|
||||
|
||||
updateItem();
|
||||
}
|
||||
, this );
|
||||
}, mEventHandlerId, RsEventType::FRIEND_LIST );
|
||||
|
||||
avatar->setId(ChatId(mPeerId));// TODO: remove unnecesary converstation
|
||||
|
||||
|
@ -68,6 +85,10 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId,
|
|||
updateItem();
|
||||
}
|
||||
|
||||
PeerItem::~PeerItem()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
uint64_t PeerItem::uniqueIdentifier() const
|
||||
{
|
||||
return hash_64bits("PeerItem " + mPeerId.toStdString() + " " + QString::number(mType).toStdString()) ;
|
||||
|
|
|
@ -40,6 +40,7 @@ class PeerItem : public FeedItem, private Ui::PeerItem
|
|||
public:
|
||||
/** Default Constructor */
|
||||
PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, uint32_t type, bool isHome);
|
||||
virtual ~PeerItem();
|
||||
|
||||
void updateItemStatic();
|
||||
|
||||
|
@ -66,6 +67,7 @@ private:
|
|||
RsPeerId mPeerId;
|
||||
uint32_t mType;
|
||||
bool mIsHome;
|
||||
RsEventsHandlerId_t mEventHandlerId ;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "gui/connect/ConnectFriendWizard.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "util/DateTime.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
|
||||
|
@ -72,7 +73,23 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &g
|
|||
connect( peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails()));
|
||||
connect( friendRequesttoolButton, SIGNAL(clicked()), this, SLOT(friendRequest()));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));
|
||||
|
||||
mEventHandlerId = 0;
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=]()
|
||||
{
|
||||
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||
|
||||
if(!fe)
|
||||
return;
|
||||
|
||||
updateItem();
|
||||
}
|
||||
, this );
|
||||
}, mEventHandlerId, RsEventType::FRIEND_LIST );
|
||||
|
||||
avatar->setId(ChatId(mSslId));
|
||||
|
||||
|
@ -82,6 +99,10 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &g
|
|||
updateItem();
|
||||
}
|
||||
|
||||
SecurityItem::~SecurityItem()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
uint64_t SecurityItem::uniqueIdentifier() const
|
||||
{
|
||||
return hash_64bits("SecurityItem " + QString::number(mType).toStdString() + " " + mSslId.toStdString());
|
||||
|
|
|
@ -39,6 +39,7 @@ class SecurityItem : public FeedItem, private Ui::SecurityItem
|
|||
public:
|
||||
/** Default Constructor */
|
||||
SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_addr,uint32_t type, bool isHome);
|
||||
~SecurityItem();
|
||||
|
||||
void updateItemStatic();
|
||||
|
||||
|
@ -67,6 +68,8 @@ private:
|
|||
std::string mIP;
|
||||
uint32_t mType;
|
||||
bool mIsHome;
|
||||
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -53,7 +53,7 @@ RsGxsChannelPostsModel::RsGxsChannelPostsModel(QObject *parent)
|
|||
|
||||
RsGxsChannelPostsModel::~RsGxsChannelPostsModel()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
// rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
|
||||
void RsGxsChannelPostsModel::setMode(TreeMode mode)
|
||||
|
|
|
@ -256,6 +256,6 @@ private:
|
|||
QColor mTextColorNotSubscribed ;
|
||||
QColor mTextColorMissing ;
|
||||
|
||||
RsEventsHandlerId_t mEventHandlerId ;
|
||||
//RsEventsHandlerId_t mEventHandlerId ;
|
||||
friend class const_iterator;
|
||||
};
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include "util/misc.h"
|
||||
#include "util/DateTime.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "textformat.h"
|
||||
#include "TagsMenu.h"
|
||||
|
@ -214,7 +215,21 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
|
|||
connect(ui.addBccButton, SIGNAL(clicked()), this, SLOT(addBcc()));
|
||||
connect(ui.addRecommendButton, SIGNAL(clicked()), this, SLOT(addRecommend()));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(peerStatusChanged(QString,int)));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(peerStatusChanged(QString,int)));
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=](){
|
||||
auto fe = dynamic_cast<const RsFriendListEvent*>(e.get());
|
||||
|
||||
if(!fe || fe->mEventCode != RsFriendListEventCode::NODE_STATUS_CHANGED)
|
||||
return;
|
||||
|
||||
peerStatusChanged(QString::fromStdString(fe->mSslId.toStdString()),fe->mStatus);
|
||||
|
||||
}, this );
|
||||
},mEventHandlerId,RsEventType::FRIEND_LIST);
|
||||
|
||||
connect(ui.friendSelectionWidget, SIGNAL(contentChanged()), this, SLOT(buildCompleter()));
|
||||
connect(ui.friendSelectionWidget, SIGNAL(doubleClicked(int,QString)), this, SLOT(addTo()));
|
||||
connect(ui.friendSelectionWidget, SIGNAL(itemSelectionChanged()), this, SLOT(friendSelectionChanged()));
|
||||
|
@ -420,6 +435,7 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
|
|||
|
||||
MessageComposer::~MessageComposer()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
delete(m_compareRole);
|
||||
}
|
||||
|
||||
|
@ -811,7 +827,7 @@ void MessageComposer::buildCompleter()
|
|||
setNewCompleter(ui.recipientWidget, m_completer);
|
||||
}
|
||||
|
||||
void MessageComposer::peerStatusChanged(const QString& peer_id, int status)
|
||||
void MessageComposer::peerStatusChanged(const QString& peer_id, RsStatusValue status)
|
||||
{
|
||||
int rowCount = ui.recipientWidget->rowCount();
|
||||
int row;
|
||||
|
|
|
@ -157,7 +157,7 @@ private slots:
|
|||
void editingRecipientFinished();
|
||||
void contactDetails();
|
||||
|
||||
void peerStatusChanged(const QString& peer_id, int status);
|
||||
void peerStatusChanged(const QString& peer_id, RsStatusValue status);
|
||||
void friendSelectionChanged();
|
||||
|
||||
void tagAboutToShow();
|
||||
|
@ -274,6 +274,7 @@ private:
|
|||
Ui::MessageComposer ui;
|
||||
|
||||
std::list<FileInfo> _recList ;
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -109,15 +109,15 @@ NotifyQt::NotifyQt() : cDialog(NULL)
|
|||
qRegisterMetaType<RsGxsId>("RsGxsId");
|
||||
}
|
||||
|
||||
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::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)
|
||||
{
|
||||
|
@ -133,6 +133,7 @@ void NotifyQt::notifyChatMessage(const ChatMessage &msg)
|
|||
emit chatMessageReceived(msg);
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void NotifyQt::notifyOwnAvatarChanged()
|
||||
{
|
||||
{
|
||||
|
@ -146,6 +147,7 @@ void NotifyQt::notifyOwnAvatarChanged()
|
|||
#endif
|
||||
emit ownAvatarChanged() ;
|
||||
}
|
||||
#endif
|
||||
|
||||
class SignatureEventData
|
||||
{
|
||||
|
@ -320,6 +322,7 @@ void NotifyQt::notifyDiscInfoChanged()
|
|||
emit discInfoChanged() ;
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void NotifyQt::notifyDiskFull(uint32_t loc,uint32_t size_in_mb)
|
||||
{
|
||||
{
|
||||
|
@ -391,6 +394,7 @@ void NotifyQt::notifyPeerHasNewAvatar(std::string peer_id)
|
|||
#endif
|
||||
emit peerHasNewAvatar(QString::fromStdString(peer_id)) ;
|
||||
}
|
||||
#endif
|
||||
|
||||
void NotifyQt::notifyCustomState(const std::string& peer_id, const std::string& status_string)
|
||||
{
|
||||
|
@ -406,6 +410,7 @@ void NotifyQt::notifyCustomState(const std::string& peer_id, const std::string&
|
|||
emit peerHasNewCustomStateString(QString::fromStdString(peer_id), QString::fromUtf8(status_string.c_str())) ;
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void NotifyQt::notifyChatLobbyTimeShift(int shift)
|
||||
{
|
||||
{
|
||||
|
@ -448,6 +453,7 @@ void NotifyQt::notifyChatLobbyEvent(uint64_t lobby_id,uint32_t event_type,const
|
|||
#endif
|
||||
emit chatLobbyEvent(lobby_id,event_type,nickname,QString::fromUtf8(str.c_str())) ;
|
||||
}
|
||||
#endif
|
||||
|
||||
void NotifyQt::notifyChatStatus(const ChatId& chat_id,const std::string& status_string)
|
||||
{
|
||||
|
@ -477,10 +483,10 @@ void NotifyQt::notifyChatCleared(const ChatId& chat_id)
|
|||
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;
|
||||
}
|
||||
//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;
|
||||
//}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
// Mai 2023: distant turtle search now uses RsEvents.
|
||||
|
@ -534,6 +540,7 @@ void NotifyQt::notifyListChange(int list, int type)
|
|||
#endif
|
||||
switch(list)
|
||||
{
|
||||
#ifdef TO_REMOVE
|
||||
case NOTIFY_LIST_NEIGHBOURS:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received neighbours changed" << std::endl ;
|
||||
|
@ -552,18 +559,25 @@ void NotifyQt::notifyListChange(int list, int type)
|
|||
#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;
|
||||
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:
|
||||
|
@ -574,14 +588,7 @@ void NotifyQt::notifyListChange(int list, int type)
|
|||
#endif
|
||||
emit transfersChanged() ;
|
||||
break;
|
||||
case NOTIFY_LIST_CONFIG:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received config changed" << std::endl ;
|
||||
#endif
|
||||
emit configChanged() ;
|
||||
break ;
|
||||
|
||||
#ifdef REMOVE
|
||||
case NOTIFY_LIST_FORUMLIST_LOCKED:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received forum msg changed" << std::endl ;
|
||||
|
@ -615,19 +622,21 @@ void NotifyQt::notifyListChange(int list, int type)
|
|||
#endif
|
||||
emit lobbyListChanged();
|
||||
break;
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
case NOTIFY_LIST_GROUPLIST:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "received groups changed" << std::endl ;
|
||||
#endif
|
||||
emit groupsChanged(type);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void NotifyQt::notifyListPreChange(int list, int /*type*/)
|
||||
{
|
||||
{
|
||||
|
@ -663,6 +672,7 @@ void NotifyQt::notifyListPreChange(int list, int /*type*/)
|
|||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
void NotifyQt::enable()
|
||||
{
|
||||
|
@ -686,7 +696,7 @@ void NotifyQt::UpdateGUI()
|
|||
// the gui is running, then they get updated by callbacks.
|
||||
if(!already_updated)
|
||||
{
|
||||
emit neighboursChanged();
|
||||
// emit neighboursChanged();
|
||||
emit configChanged();
|
||||
|
||||
already_updated = true ;
|
||||
|
|
|
@ -60,28 +60,28 @@ class NotifyQt: public QObject, public NotifyClient
|
|||
|
||||
void setNetworkDialog(NetworkDialog *c) { cDialog = c; }
|
||||
|
||||
virtual void notifyListPreChange(int list, int type);
|
||||
// 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 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) ;
|
||||
//#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) ;
|
||||
// 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);
|
||||
// virtual void notifyPeerStatusChanged(const std::string& peer_id, uint32_t state);
|
||||
/* one or more peers has changed the states */
|
||||
virtual void notifyPeerStatusChangedSummary();
|
||||
// virtual void notifyPeerStatusChangedSummary();
|
||||
|
||||
virtual void notifyHistoryChanged(uint32_t msgId, int type);
|
||||
|
||||
|
@ -104,34 +104,34 @@ class NotifyQt: public QObject, public NotifyClient
|
|||
// 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 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 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 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 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 groupsChanged(int type) const ;
|
||||
void discInfoChanged() const ;
|
||||
void historyChanged(uint msgId, int type);
|
||||
void chatLobbyInviteReceived() ;
|
||||
void deferredSignatureHandlingRequested() ;
|
||||
void chatLobbyTimeShift(int time_shift) ;
|
||||
// void chatLobbyInviteReceived() ;
|
||||
// void deferredSignatureHandlingRequested() ;
|
||||
// void chatLobbyTimeShift(int time_shift) ;
|
||||
void connectionWithoutCert();
|
||||
|
||||
/* Notify from GUI */
|
||||
|
@ -147,7 +147,7 @@ class NotifyQt: public QObject, public NotifyClient
|
|||
private slots:
|
||||
void runningTick();
|
||||
void handleSignatureEvent() ;
|
||||
void handleChatLobbyTimeShift(int) ;
|
||||
// void handleChatLobbyTimeShift(int) ;
|
||||
|
||||
private:
|
||||
NotifyQt();
|
||||
|
|
|
@ -85,7 +85,6 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
|
|||
, manager(NULL), mOngoingConnectivityCheck(-1)
|
||||
, mIsHiddenNode(false), mHiddenType(RS_HIDDEN_TYPE_NONE)
|
||||
, mSamAccessible(false)
|
||||
, mEventHandlerId(0)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
@ -262,10 +261,15 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
|
|||
if (ui.tabWidget->currentIndex() == TAB_HIDDEN_SERVICE)
|
||||
updateOutProxyIndicator();
|
||||
|
||||
mEventHandlerId = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::NETWORK );
|
||||
|
||||
}
|
||||
|
||||
ServerPage::~ServerPage()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
void ServerPage::handleEvent(std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
if(e->mType != RsEventType::NETWORK)
|
||||
|
|
|
@ -53,7 +53,7 @@ class ServerPage: public ConfigPage, public autoProxyCallback
|
|||
|
||||
public:
|
||||
ServerPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||
~ServerPage() {}
|
||||
~ServerPage() ;
|
||||
|
||||
/** Loads the settings for this page */
|
||||
virtual void load();
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "hashingstatus.h"
|
||||
#include "gui/common/ElidedLabel.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "util/misc.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
|
||||
|
@ -69,64 +70,25 @@ void HashingStatus::handleEvent_main_thread(std::shared_ptr<const RsEvent> event
|
|||
if(!fe)
|
||||
return;
|
||||
|
||||
QString info;
|
||||
std::cerr << "HashStatusEventHandler: received event " << (void*)fe->mEventCode << std::endl;
|
||||
|
||||
switch (fe->mEventCode)
|
||||
{
|
||||
default:
|
||||
case RsSharedDirectoriesEventCode::STARTING_DIRECTORY_SWEEP:
|
||||
info = tr("Examining shared files...");
|
||||
break;
|
||||
case RsSharedDirectoriesEventCode::DIRECTORY_SWEEP_ENDED:
|
||||
break;
|
||||
case RsSharedDirectoriesEventCode::HASHING_FILE:
|
||||
info = tr("Hashing file") + " " + QString::fromUtf8(fe->mMessage.c_str());
|
||||
break;
|
||||
case RsSharedDirectoriesEventCode::SAVING_FILE_INDEX:
|
||||
info = tr("Saving file index...");
|
||||
break;
|
||||
}
|
||||
|
||||
// GUI calls should only happen in the GUI thread, which is achieved by postToObject().
|
||||
|
||||
updateHashingInfo(info);
|
||||
}
|
||||
|
||||
HashingStatus::~HashingStatus()
|
||||
case RsSharedDirectoriesEventCode::HASHING_PROCESS_RESUMED:
|
||||
statusHashing->setText(mLastText); // fallthrough
|
||||
case RsSharedDirectoriesEventCode::HASHING_PROCESS_STARTED:
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
delete(movie);
|
||||
}
|
||||
|
||||
void HashingStatus::updateHashingInfo(const QString& s)
|
||||
{
|
||||
if (s.isEmpty())
|
||||
{
|
||||
statusHashing->hide() ;
|
||||
hashloader->hide() ;
|
||||
setToolTip(QString());
|
||||
|
||||
movie->stop() ;
|
||||
} else {
|
||||
setToolTip(s + "\n"+QObject::tr("Click to pause the hashing process"));
|
||||
|
||||
if (_compactMode) {
|
||||
statusHashing->hide() ;
|
||||
} else {
|
||||
statusHashing->setText(s) ;
|
||||
statusHashing->show() ;
|
||||
}
|
||||
hashloader->show() ;
|
||||
|
||||
hashloader->setMovie(movie) ;
|
||||
movie->start() ;
|
||||
}
|
||||
}
|
||||
|
||||
void HashingStatus::mousePressEvent(QMouseEvent *)
|
||||
{
|
||||
rsFiles->togglePauseHashingProcess() ;
|
||||
statusHashing->setVisible(!_compactMode) ;
|
||||
}
|
||||
break;
|
||||
|
||||
if(rsFiles->hashingProcessPaused())
|
||||
case RsSharedDirectoriesEventCode::HASHING_PROCESS_PAUSED:
|
||||
{
|
||||
movie->stop() ;
|
||||
hashloader->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/resume.png")) ;
|
||||
|
@ -135,10 +97,49 @@ void HashingStatus::mousePressEvent(QMouseEvent *)
|
|||
statusHashing->setText(QObject::tr("[Hashing is paused]"));
|
||||
setToolTip(QObject::tr("Click to resume the hashing process"));
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
case RsSharedDirectoriesEventCode::HASHING_PROCESS_FINISHED:
|
||||
{
|
||||
hashloader->setMovie(movie) ;
|
||||
statusHashing->setText(mLastText);
|
||||
movie->start() ;
|
||||
movie->stop() ;
|
||||
statusHashing->setText(QString());
|
||||
statusHashing->hide() ;
|
||||
setToolTip(QString());
|
||||
hashloader->hide() ;
|
||||
}
|
||||
break;
|
||||
|
||||
case RsSharedDirectoriesEventCode::HASHING_FILE:
|
||||
{
|
||||
QString msg = QString::number((unsigned long int)fe->mHashCounter+1) + "/" + QString::number((unsigned long int)fe->mTotalFilesToHash);
|
||||
|
||||
msg += " (" + misc::friendlyUnit(fe->mTotalHashedSize) + " - "
|
||||
+ QString::number(int(fe->mTotalHashedSize/double(fe->mTotalSizeToHash)*100.0)) + "%"
|
||||
+ ((fe->mHashingSpeed>0)?("," + QString::number((double)fe->mHashingSpeed,'f',2) + " MB/s)"):(QString()))
|
||||
+ " : " + QString::fromUtf8(fe->mFilePath.c_str()) ;
|
||||
|
||||
statusHashing->setText(tr("Hashing file") + " " + msg);
|
||||
setToolTip(msg + "\n"+QObject::tr("Click to pause the hashing process"));
|
||||
}
|
||||
break;
|
||||
|
||||
case RsSharedDirectoriesEventCode::SAVING_FILE_INDEX:
|
||||
{
|
||||
statusHashing->setText(tr("Saving file index..."));
|
||||
}
|
||||
break;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
HashingStatus::~HashingStatus()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
delete(movie);
|
||||
}
|
||||
|
||||
void HashingStatus::mousePressEvent(QMouseEvent *)
|
||||
{
|
||||
rsFiles->togglePauseHashingProcess() ;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ public:
|
|||
void mousePressEvent(QMouseEvent *);
|
||||
|
||||
private:
|
||||
void updateHashingInfo(const QString& s);
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
ElidedLabel *statusHashing;
|
||||
|
|
|
@ -725,16 +725,16 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||
#ifdef DEBUG
|
||||
std::cerr << "connecting signals and slots" << std::endl ;
|
||||
#endif
|
||||
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(transfersChanged()) ,w->transfersDialog ,SLOT(insertTransfers() )) ;
|
||||
// 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(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())) ;
|
||||
// QObject::connect(notify,SIGNAL(neighboursChanged()) ,w->friendsDialog->networkDialog ,SLOT(securedUpdateDisplay())) ;
|
||||
|
||||
QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&,bool)),w->friendsDialog,SLOT(updatePeerStatusString(const QString&,const QString&,bool)));
|
||||
QObject::connect(notify,SIGNAL(ownStatusMessageChanged()),w->friendsDialog,SLOT(loadmypersonalstatus()));
|
||||
// QObject::connect(notify,SIGNAL(ownStatusMessageChanged()),w->friendsDialog,SLOT(loadmypersonalstatus()));
|
||||
|
||||
// QObject::connect(notify,SIGNAL(logInfoChanged(const QString&)) ,w->friendsDialog->networkDialog,SLOT(setLogInfo(QString))) ;
|
||||
QObject::connect(notify,SIGNAL(discInfoChanged()) ,w->friendsDialog->networkView,SLOT(update()),Qt::QueuedConnection) ;
|
||||
|
|
|
@ -1045,12 +1045,9 @@ unfinishedtranslations {
|
|||
}
|
||||
|
||||
messenger {
|
||||
SOURCES += gui/MessengerWindow.cpp \
|
||||
gui/common/FriendList.cpp
|
||||
HEADERS += gui/MessengerWindow.h \
|
||||
gui/common/FriendList.h
|
||||
FORMS += gui/MessengerWindow.ui \
|
||||
gui/common/FriendList.ui
|
||||
SOURCES += gui/MessengerWindow.cpp
|
||||
HEADERS += gui/MessengerWindow.h
|
||||
FORMS += gui/MessengerWindow.ui
|
||||
|
||||
DEFiNES += MESSENGER_WINDOW
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue