mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-20 05:11:02 -04:00
Merge branch 'master' into tunnel-names
This commit is contained in:
commit
c47e6f620d
1552 changed files with 110144 additions and 105662 deletions
|
@ -13,9 +13,9 @@
|
|||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>RetroShare06</string>
|
||||
<string>retroshare</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.RetroShare06</string>
|
||||
<string>com.retroshare</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
|
|
|
@ -60,8 +60,8 @@ AboutWidget::AboutWidget(QWidget* parent)
|
|||
|
||||
updateTitle();
|
||||
|
||||
QObject::connect(help_button,SIGNAL(clicked()),this,SLOT(on_help_button_clicked()));
|
||||
QObject::connect(copy_button,SIGNAL(clicked()),this,SLOT(on_copy_button_clicked()));
|
||||
//QObject::connect(help_button,SIGNAL(clicked()),this,SLOT(on_help_button_clicked()));
|
||||
//QObject::connect(copy_button,SIGNAL(clicked()),this,SLOT(on_copy_button_clicked()));
|
||||
}
|
||||
|
||||
void AboutWidget::installAWidget() {
|
||||
|
@ -226,6 +226,9 @@ void AWidget::initImages()
|
|||
|
||||
/* Draw RetroShare version */
|
||||
p.drawText(QPointF(10, 50), QString("%1 : %2").arg(tr("Retroshare version"), Rshare::retroshareVersion(true)));
|
||||
#ifdef RS_ONLYHIDDENNODE
|
||||
p.drawText(QPointF(10, 70), QString("Only Hidden Node"));
|
||||
#endif
|
||||
|
||||
/* Draw Qt's version number */
|
||||
p.drawText(QPointF(10, 90), QString("Qt %1 : %2").arg(tr("version"), QT_VERSION_STR));
|
||||
|
@ -938,6 +941,9 @@ void AboutWidget::on_copy_button_clicked()
|
|||
QString rsVerString = "RetroShare Version: ";
|
||||
rsVerString+=Rshare::retroshareVersion(true);
|
||||
verInfo+=rsVerString;
|
||||
#ifdef RS_ONLYHIDDENNODE
|
||||
verInfo+=" " + tr("Only Hidden Node");
|
||||
#endif
|
||||
verInfo+="\n";
|
||||
|
||||
|
||||
|
|
|
@ -378,8 +378,12 @@ static void updateItem(QTreeWidget *treeWidget, QTreeWidgetItem *item, ChatLobby
|
|||
+QObject::tr("Id:")+" "+QString::number(id,16) ;
|
||||
|
||||
if(lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED)
|
||||
{
|
||||
tooltipstr += QObject::tr("\nSecurity: no anonymous IDs") ;
|
||||
|
||||
QColor foreground = QColor(0, 128, 0); // green
|
||||
for (int column = 0; column < COLUMN_COUNT; ++column)
|
||||
item->setTextColor(column, foreground);
|
||||
}
|
||||
item->setToolTip(0,tooltipstr) ;
|
||||
}
|
||||
|
||||
|
@ -653,7 +657,9 @@ void ChatLobbyWidget::updateDisplay()
|
|||
updateItem(ui.lobbyTreeWidget, item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.gxs_ids.size(), true, autoSubscribe,lobby_flags);
|
||||
}
|
||||
publicSubLobbyItem->setHidden(publicSubLobbyItem->childCount()==0);
|
||||
publicSubLobbyItem->setText(COLUMN_NAME, tr("Public Subscribed chat rooms")+ QString(" (") + QString::number(publicSubLobbyItem->childCount())+QString(")"));
|
||||
privateSubLobbyItem->setHidden(privateSubLobbyItem->childCount()==0);
|
||||
publicLobbyItem->setText(COLUMN_NAME, tr("Public chat rooms")+ " (" + QString::number(publicLobbyItem->childCount())+QString(")"));
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::createChatLobby()
|
||||
|
@ -814,7 +820,8 @@ void ChatLobbyWidget::autoSubscribeLobby(QTreeWidgetItem *item)
|
|||
ChatLobbyId id = item->data(COLUMN_DATA, ROLE_ID).toULongLong();
|
||||
bool isAutoSubscribe = rsMsgs->getLobbyAutoSubscribe(id);
|
||||
rsMsgs->setLobbyAutoSubscribe(id, !isAutoSubscribe);
|
||||
if (!isAutoSubscribe) subscribeChatLobbyAtItem(item);
|
||||
if (!isAutoSubscribe && !item->data(COLUMN_DATA, ROLE_SUBSCRIBED).toBool())
|
||||
subscribeChatLobbyAtItem(item);
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::showBlankPage(ChatLobbyId id)
|
||||
|
|
|
@ -161,7 +161,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
case COLUMN_PROGRESS:
|
||||
{
|
||||
// create a xProgressBar
|
||||
FileProgressInfo pinfo = index.data().value<FileProgressInfo>() ;
|
||||
FileProgressInfo pinfo = index.data(Qt::UserRole).value<FileProgressInfo>() ;
|
||||
|
||||
// std::cerr << "drawing progress info: nb_chunks = " << pinfo.nb_chunks ;
|
||||
// for(uint i=0;i<pinfo.cmap._map.size();++i)
|
||||
|
@ -215,20 +215,38 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
temp = "" ;
|
||||
painter->drawText(option.rect, Qt::AlignCenter, temp);
|
||||
break;
|
||||
case COLUMN_NAME:
|
||||
// decoration
|
||||
value = index.data(Qt::DecorationRole);
|
||||
temp = index.data().toString();
|
||||
pixmap = qvariant_cast<QIcon>(value).pixmap(option.decorationSize, option.state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled, option.state & QStyle::State_Open ? QIcon::On : QIcon::Off);
|
||||
pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize));
|
||||
if (pixmapRect.isValid()){
|
||||
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft, pixmap.size(), option.rect).topLeft();
|
||||
painter->drawPixmap(p, pixmap);
|
||||
temp = " " + temp;
|
||||
}
|
||||
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft, temp);
|
||||
break;
|
||||
case COLUMN_NAME:
|
||||
{
|
||||
// decoration
|
||||
int pixOffset = 0;
|
||||
value = index.data(Qt::StatusTipRole);
|
||||
temp = index.data().toString();
|
||||
pixmap = qvariant_cast<QIcon>(value).pixmap(option.decorationSize, option.state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled, option.state & QStyle::State_Open ? QIcon::On : QIcon::Off);
|
||||
pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize));
|
||||
if (pixmapRect.isValid()){
|
||||
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft, pixmap.size(), option.rect).topLeft();
|
||||
p.setX( p.x() + pixOffset);
|
||||
painter->drawPixmap(p, pixmap);
|
||||
temp = " " + temp;
|
||||
pixOffset += pixmap.size().width();
|
||||
}
|
||||
value = index.data(Qt::DecorationRole);
|
||||
temp = index.data().toString();
|
||||
pixmap = qvariant_cast<QIcon>(value).pixmap(option.decorationSize, option.state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled, option.state & QStyle::State_Open ? QIcon::On : QIcon::Off);
|
||||
pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize));
|
||||
if (pixmapRect.isValid()){
|
||||
QPoint p = QStyle::alignedRect(option.direction, Qt::AlignLeft, pixmap.size(), option.rect).topLeft();
|
||||
p.setX( p.x() + pixOffset);
|
||||
painter->drawPixmap(p, pixmap);
|
||||
temp = " " + temp;
|
||||
pixOffset += pixmap.size().width();
|
||||
}
|
||||
painter->drawText(option.rect.translated(pixOffset, 0), Qt::AlignLeft, temp);
|
||||
}
|
||||
break;
|
||||
case COLUMN_LASTDL:
|
||||
if (index.data().value<QString>().isEmpty())
|
||||
break;
|
||||
qi64Value = index.data().value<qint64>();
|
||||
if (qi64Value < std::numeric_limits<qint64>::max()){
|
||||
QDateTime qdtLastDL = QDateTime::fromTime_t(qi64Value);
|
||||
|
|
|
@ -110,9 +110,7 @@ void DetailsDialog::setFileHash(const RsFileHash & hash)
|
|||
if(!rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, nfo))
|
||||
return ;
|
||||
|
||||
RetroShareLink link ;
|
||||
link.createFile(QString::fromUtf8(nfo.fname.c_str()),nfo.size,QString::fromStdString(nfo.hash.toStdString())) ;
|
||||
|
||||
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(nfo.fname.c_str()),nfo.size,QString::fromStdString(nfo.hash.toStdString()));
|
||||
ui.Linktext->setText(link.toString()) ;
|
||||
}
|
||||
|
||||
|
|
|
@ -407,6 +407,13 @@ void SearchDialog::download()
|
|||
for(std::list<RsPeerId>::const_iterator it(srcIds.begin()); it!=srcIds.end(); ++it) {
|
||||
std::cout << *it << "-" << std::endl;
|
||||
}//for(std::list<RsPeerId>::const_iterator
|
||||
//QColor foreground = QColor(0, 128, 0); // green
|
||||
QColor foreground = textColorDownloading();
|
||||
QBrush brush(foreground);
|
||||
for (int i = 0; i < item->columnCount(); ++i)
|
||||
{
|
||||
item->setForeground(i, brush);
|
||||
}
|
||||
}//if(!rsFiles -> FileRequest(
|
||||
}//if (item->text(SR_HASH_COL).isEmpty())
|
||||
}//for (int i = 0
|
||||
|
@ -705,8 +712,8 @@ void SearchDialog::copySearchLink()
|
|||
std::cerr << "SearchDialog::copySearchLink(): keywords: " << keywords.toStdString();
|
||||
std::cerr << std::endl;
|
||||
|
||||
RetroShareLink link;
|
||||
if (link.createSearch(keywords)) {
|
||||
RetroShareLink link = RetroShareLink::createSearch(keywords);
|
||||
if (link.valid()) {
|
||||
QList<RetroShareLink> urls;
|
||||
urls.push_back(link);
|
||||
RSLinkClipboard::copyLinks(urls);
|
||||
|
@ -1189,6 +1196,11 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
|
|||
found = true ;
|
||||
|
||||
if (!item->data(SR_DATA_COL, SR_ROLE_LOCAL).toBool()) {
|
||||
|
||||
FileInfo fi;
|
||||
if (rsFiles->FileDetails(file.hash, RS_FILE_HINTS_DOWNLOAD, fi))
|
||||
break;
|
||||
|
||||
QColor foreground;
|
||||
|
||||
int sources = friendSource + anonymousSource ;
|
||||
|
@ -1281,6 +1293,12 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
|
|||
setForeground = true;
|
||||
}
|
||||
}
|
||||
if (rsFiles->FileDetails(file.hash, RS_FILE_HINTS_DOWNLOAD, fi))
|
||||
{
|
||||
//foreground = QColor(0, 128, 0); // green
|
||||
foreground = textColorDownloading();
|
||||
setForeground = true;
|
||||
}
|
||||
|
||||
if (setForeground) {
|
||||
QBrush brush(foreground);
|
||||
|
@ -1425,11 +1443,11 @@ void SearchDialog::copyResultLink()
|
|||
qulonglong fsize = item->text(SR_SIZE_COL).toULongLong();
|
||||
QString fname = item->text(SR_NAME_COL);
|
||||
|
||||
RetroShareLink link;
|
||||
if (link.createFile(fname, fsize, fhash)) {
|
||||
std::cerr << "new link added to clipboard: " << link.toString().toStdString() << std::endl ;
|
||||
urls.push_back(link) ;
|
||||
}
|
||||
RetroShareLink link = RetroShareLink::createFile(fname, fsize, fhash);
|
||||
if (link.valid()) {
|
||||
std::cerr << "new link added to clipboard: " << link.toString().toStdString() << std::endl ;
|
||||
urls.push_back(link) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
RSLinkClipboard::copyLinks(urls) ;
|
||||
|
|
|
@ -38,6 +38,7 @@ class SearchDialog : public MainPage
|
|||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor textColorLocal READ textColorLocal WRITE setTextColorLocal)
|
||||
Q_PROPERTY(QColor textColorDownloading READ textColorDownloading WRITE setTextColorDownloading)
|
||||
Q_PROPERTY(QColor textColorNoSources READ textColorNoSources WRITE setTextColorNoSources)
|
||||
Q_PROPERTY(QColor textColorLowSources READ textColorLowSources WRITE setTextColorLowSources)
|
||||
Q_PROPERTY(QColor textColorHighSources READ textColorHighSources WRITE setTextColorHighSources)
|
||||
|
@ -51,11 +52,13 @@ public:
|
|||
void searchKeywords(const QString& keywords);
|
||||
|
||||
QColor textColorLocal() const { return mTextColorLocal; }
|
||||
QColor textColorDownloading() const { return mTextColorDownloading; }
|
||||
QColor textColorNoSources() const { return mTextColorNoSources; }
|
||||
QColor textColorLowSources() const { return mTextColorLowSources; }
|
||||
QColor textColorHighSources() const { return mTextColorHighSources; }
|
||||
|
||||
void setTextColorLocal(QColor color) { mTextColorLocal = color; }
|
||||
void setTextColorDownloading(QColor color) { mTextColorDownloading = color; }
|
||||
void setTextColorNoSources(QColor color) { mTextColorNoSources = color; }
|
||||
void setTextColorLowSources(QColor color) { mTextColorLowSources = color; }
|
||||
void setTextColorHighSources(QColor color) { mTextColorHighSources = color; }
|
||||
|
@ -154,6 +157,7 @@ private:
|
|||
|
||||
/* Color definitions (for standard see qss.default) */
|
||||
QColor mTextColorLocal;
|
||||
QColor mTextColorDownloading;
|
||||
QColor mTextColorNoSources;
|
||||
QColor mTextColorLowSources;
|
||||
QColor mTextColorHighSources;
|
||||
|
|
|
@ -32,20 +32,17 @@
|
|||
#include <QStyledItemDelegate>
|
||||
|
||||
#include "SharedFilesDialog.h"
|
||||
#include "settings/AddFileAssociationDialog.h"
|
||||
#include "util/RsAction.h"
|
||||
#include "msgs/MessageComposer.h"
|
||||
#include "settings/rsharesettings.h"
|
||||
#ifdef RS_USE_LINKS
|
||||
#include "AddLinksDialog.h"
|
||||
#endif
|
||||
#include "RetroShareLink.h"
|
||||
#include "ShareManager.h"
|
||||
#include "RemoteDirModel.h"
|
||||
#include "common/PeerDefs.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/RemoteDirModel.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include "gui/ShareManager.h"
|
||||
#include "gui/common/PeerDefs.h"
|
||||
#include "gui/common/RsCollectionFile.h"
|
||||
#include "notifyqt.h"
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
#include "gui/settings/AddFileAssociationDialog.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "util/RsAction.h"
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsfiles.h>
|
||||
|
@ -213,12 +210,6 @@ SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareD
|
|||
connect( copylinkhtmlAct , SIGNAL( triggered() ), this, SLOT( copyLinkhtml() ) );
|
||||
sendlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links" ), this );
|
||||
connect( sendlinkAct , SIGNAL( triggered() ), this, SLOT( sendLinkTo( ) ) );
|
||||
#ifdef RS_USE_LINKS
|
||||
sendlinkCloudAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links to Cloud" ), this );
|
||||
connect( sendlinkCloudAct , SIGNAL( triggered() ), this, SLOT( sendLinkToCloud( ) ) );
|
||||
addlinkCloudAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Add Links to Cloud" ), this );
|
||||
connect( addlinkCloudAct , SIGNAL( triggered() ), this, SLOT( addLinkToCloud( ) ) );
|
||||
#endif
|
||||
|
||||
collCreateAct= new QAction(QIcon(IMAGE_COLLCREATE), tr("Create Collection..."), this) ;
|
||||
connect(collCreateAct,SIGNAL(triggered()),this,SLOT(collCreate())) ;
|
||||
|
@ -609,8 +600,8 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
|
|||
continue;
|
||||
}
|
||||
|
||||
RetroShareLink link;
|
||||
if (link.createFile(QString::fromUtf8(details.name.c_str()), details.count, details.hash.toStdString().c_str())) {
|
||||
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(details.name.c_str()), details.count, details.hash.toStdString().c_str());
|
||||
if (link.valid()) {
|
||||
urls.push_back(link) ;
|
||||
}
|
||||
}
|
||||
|
@ -622,8 +613,8 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
|
|||
has_unhashed_files = true;
|
||||
continue;
|
||||
}
|
||||
RetroShareLink link;
|
||||
if (link.createFile(QString::fromUtf8(details.name.c_str()), details.count, details.hash.toStdString().c_str())) {
|
||||
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(details.name.c_str()), details.count, details.hash.toStdString().c_str());
|
||||
if (link.valid()) {
|
||||
urls.push_back(link) ;
|
||||
}
|
||||
}
|
||||
|
@ -631,7 +622,7 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
|
|||
RSLinkClipboard::copyLinks(urls) ;
|
||||
|
||||
if(has_unhashed_files)
|
||||
QMessageBox::warning(NULL,tr("Some files have been omitted"),tr("Some files have been ommitted because their hash is not available yet.")) ;
|
||||
QMessageBox::warning(NULL,tr("Some files have been omitted"),tr("Some files have been omitted because their hash is not available yet.")) ;
|
||||
}
|
||||
|
||||
void SharedFilesDialog::copyLink()
|
||||
|
@ -672,31 +663,6 @@ void SharedFilesDialog::sendLinkTo()
|
|||
/* window will destroy itself! */
|
||||
}
|
||||
|
||||
#ifdef RS_USE_LINKS
|
||||
void SharedFilesDialog::sendLinkToCloud()
|
||||
{
|
||||
copyLink();
|
||||
|
||||
AddLinksDialog *nAddLinksDialog = new AddLinksDialog(QApplication::clipboard()->text());
|
||||
|
||||
nAddLinksDialog->addLinkComment();
|
||||
nAddLinksDialog->close();
|
||||
|
||||
/* window will destroy itself! */
|
||||
}
|
||||
|
||||
void SharedFilesDialog::addLinkToCloud()
|
||||
{
|
||||
copyLink();
|
||||
|
||||
AddLinksDialog *nAddLinksDialog = new AddLinksDialog(QApplication::clipboard()->text());
|
||||
|
||||
nAddLinksDialog->show();
|
||||
|
||||
/* window will destroy itself! */
|
||||
}
|
||||
#endif
|
||||
|
||||
void SharedFilesDialog::collCreate()
|
||||
{
|
||||
QModelIndexList lst = getSelected();
|
||||
|
@ -1057,11 +1023,6 @@ void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
|
|||
contextMnu.addSeparator() ;//------------------------------------
|
||||
contextMnu.addMenu(&collectionMenu) ;
|
||||
contextMnu.addSeparator() ;//------------------------------------
|
||||
#ifdef RS_USE_LINKS
|
||||
contextMnu.addAction(sendlinkCloudAct) ;
|
||||
contextMnu.addAction(addlinkCloudAct) ;
|
||||
contextMnu.addSeparator() ;//------------------------------------
|
||||
#endif
|
||||
contextMnu.addAction(QIcon(IMAGE_MSG), tr("Recommend in a message to"), this, SLOT(recommendFilesToMsg())) ;
|
||||
break ;
|
||||
|
|
@ -62,10 +62,6 @@ private slots:
|
|||
void copyLink();
|
||||
void copyLinkhtml();
|
||||
void sendLinkTo();
|
||||
#ifdef RS_USE_LINKS
|
||||
void sendLinkToCloud();
|
||||
void addLinkToCloud();
|
||||
#endif
|
||||
|
||||
void collCreate();
|
||||
void collModif();
|
||||
|
@ -118,10 +114,6 @@ protected:
|
|||
/** Defines the actions for the context menu for QTreeWidget */
|
||||
QAction* copylinkAct;
|
||||
QAction* sendlinkAct;
|
||||
#ifdef RS_USE_LINKS
|
||||
QAction* sendlinkCloudAct;
|
||||
QAction* addlinkCloudAct;
|
||||
#endif
|
||||
QAction* sendchatlinkAct;
|
||||
QAction* copylinkhtmlAct;
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -29,6 +29,9 @@
|
|||
|
||||
#include "ui_TransfersDialog.h"
|
||||
|
||||
#include <QItemSelectionModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#define IMAGE_TRANSFERS ":/icons/ktorrent_128.png"
|
||||
|
||||
class QShortcut;
|
||||
|
@ -92,23 +95,25 @@ private slots:
|
|||
/** removes finished Downloads**/
|
||||
void clearcompleted();
|
||||
|
||||
void copyLink();
|
||||
void dlCopyLink();
|
||||
void pasteLink();
|
||||
void renameFile();
|
||||
void setDestinationDirectory();
|
||||
void chooseDestinationDirectory();
|
||||
|
||||
void expandAll();
|
||||
void collapseAll();
|
||||
void expandAllDL();
|
||||
void collapseAllDL();
|
||||
void expandAllUL();
|
||||
void collapseAllUL();
|
||||
|
||||
// void rootdecorated();
|
||||
// void rootisnotdecorated();
|
||||
|
||||
void pauseFileTransfer();
|
||||
void resumeFileTransfer();
|
||||
void openFolderTransfer();
|
||||
void openTransfer();
|
||||
void previewTransfer();
|
||||
void dlOpenFolder();
|
||||
void dlOpenFile();
|
||||
void dlPreviewFile();
|
||||
|
||||
void ulOpenFolder();
|
||||
void ulCopyLink();
|
||||
|
@ -153,13 +158,16 @@ private slots:
|
|||
void setShowDLLastDLColumn(bool show);
|
||||
void setShowDLPath(bool show);
|
||||
|
||||
void filterChanged(const QString &text);
|
||||
|
||||
signals:
|
||||
void playFiles(QStringList files);
|
||||
|
||||
private:
|
||||
QString getPeerName(const RsPeerId &peer_id) const ;
|
||||
QString getPeerName(const RsPeerId &peer_id, QString &iconName, QString &tooltip) const ;
|
||||
|
||||
QStandardItemModel *DLListModel;
|
||||
QSortFilterProxyModel *DLLFilterModel;
|
||||
QStandardItemModel *ULListModel;
|
||||
QItemSelectionModel *selection;
|
||||
QItemSelectionModel *selectionUp;
|
||||
|
@ -201,8 +209,10 @@ private:
|
|||
QAction *detailsFileAct;
|
||||
QAction *renameFileAct;
|
||||
QAction *specifyDestinationDirectoryAct;
|
||||
QAction *expandAllAct;
|
||||
QAction *collapseAllAct;
|
||||
QAction *expandAllDLAct;
|
||||
QAction *collapseAllDLAct;
|
||||
QAction *expandAllULAct;
|
||||
QAction *collapseAllULAct;
|
||||
QAction *collCreateAct;
|
||||
QAction *collModifAct;
|
||||
QAction *collViewAct;
|
||||
|
@ -229,7 +239,7 @@ private:
|
|||
bool m_bProcessSettings;
|
||||
void processSettings(bool bLoad);
|
||||
|
||||
void getSelectedItems(std::set<RsFileHash> *ids, std::set<int> *rows);
|
||||
void getDLSelectedItems(std::set<RsFileHash> *ids, std::set<int> *rows);
|
||||
void getULSelectedItems(std::set<RsFileHash> *ids, std::set<int> *rows);
|
||||
bool controlTransferFile(uint32_t flags);
|
||||
void changePriority(int priority);
|
||||
|
@ -249,12 +259,11 @@ private:
|
|||
Ui::TransfersDialog ui;
|
||||
|
||||
public slots:
|
||||
// these two functions add entries to the transfers dialog, and return the row id of the entry modified/added
|
||||
//
|
||||
int addItem(int row, const FileInfo &fileInfo);
|
||||
int addPeerToItem(QStandardItem *dlItem, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo);
|
||||
|
||||
int addUploadItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources,const QString& source_id, const QString& status, qlonglong completed, qlonglong remaining);
|
||||
// these four functions add entries to the transfers dialog, and return the row id of the entry modified/added
|
||||
int addDLItem(int row, const FileInfo &fileInfo);
|
||||
int addPeerToDLItem(QStandardItem* dlItem, const RsPeerId &peer_ID, const QString &coreID, double dlspeed, uint32_t status, const FileProgressInfo &peerInfo);
|
||||
int addULItem(int row, const FileInfo &fileInfo);
|
||||
int addPeerToULItem(QStandardItem* ulItem, const RsPeerId &peer_ID, const QString &coreID, qlonglong completed, double ulspeed, const FileProgressInfo &peerInfo);
|
||||
|
||||
void showFileDetails() ;
|
||||
|
||||
|
@ -263,6 +272,7 @@ public slots:
|
|||
QString getFileName(int row, QStandardItemModel *model);
|
||||
QString getStatus(int row, QStandardItemModel *model);
|
||||
QString getID(int row, QStandardItemModel *model);
|
||||
QString getID(int row, QSortFilterProxyModel *filter);
|
||||
QString getPriority(int row, QStandardItemModel *model);
|
||||
qlonglong getFileSize(int row, QStandardItemModel *model);
|
||||
qlonglong getTransfered(int row, QStandardItemModel *model);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<height>353</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="TransfersDialogVLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -37,7 +37,7 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="titleBarFrameHLayout">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
|
@ -77,7 +77,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<spacer name="titleBarHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -137,7 +137,7 @@
|
|||
<attribute name="title">
|
||||
<string>Downloads</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<layout class="QGridLayout" name="tabGLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -173,51 +173,60 @@
|
|||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QTreeView" name="downloadList">
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
|
||||
</property>
|
||||
<property name="tabKeyNavigation">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dragEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::NoDragDrop</enum>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="uniformRowHeights">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dwloadsTab">
|
||||
<layout class="QGridLayout" name="dwloadsTabGLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="LineEditClear" name="filterLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTreeView" name="downloadList">
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
|
||||
</property>
|
||||
<property name="tabKeyNavigation">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dragEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::NoDragDrop</enum>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="uniformRowHeights">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tabWidget_2">
|
||||
<widget class="QTabWidget" name="tabWidget_UL">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -250,7 +259,7 @@
|
|||
<attribute name="title">
|
||||
<string>Uploads</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="uploadsTabGLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -290,6 +299,11 @@
|
|||
<extends>QLabel</extends>
|
||||
<header>gui/common/StyledLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LineEditClear</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header location="global">gui/common/LineEditClear.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
|
|
|
@ -45,7 +45,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
QPixmap pixmap;
|
||||
qlonglong fileSize;
|
||||
double ulspeed, multi;
|
||||
QString temp , status;
|
||||
QString temp;
|
||||
qlonglong transferred;
|
||||
|
||||
// prepare
|
||||
|
@ -65,7 +65,12 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
}
|
||||
|
||||
// draw the background color
|
||||
if(index.column() != COLUMN_UPROGRESS) {
|
||||
bool bDrawBackground = true;
|
||||
if(index.column() == COLUMN_UPROGRESS) {
|
||||
FileProgressInfo pinfo = index.data().value<FileProgressInfo>() ;
|
||||
bDrawBackground = (pinfo.type == FileProgressInfo::UNINIT);
|
||||
}
|
||||
if( bDrawBackground ) {
|
||||
if(option.showDecorationSelected && (option.state & QStyle::State_Selected)) {
|
||||
if(cg == QPalette::Normal && !(option.state & QStyle::State_Active)) {
|
||||
cg = QPalette::Inactive;
|
||||
|
@ -78,6 +83,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch(index.column()) {
|
||||
case COLUMN_USIZE:
|
||||
fileSize = index.data().toLongLong();
|
||||
|
@ -128,15 +134,17 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
}
|
||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
break;
|
||||
case COLUMN_UPROGRESS:
|
||||
case COLUMN_UPROGRESS:
|
||||
{
|
||||
FileProgressInfo pinfo = index.data().value<FileProgressInfo>() ;
|
||||
if (pinfo.type == FileProgressInfo::UNINIT)
|
||||
break;
|
||||
|
||||
// create a xProgressBar
|
||||
painter->save() ;
|
||||
xProgressBar progressBar(pinfo,option.rect,painter,0);// the 3rd param is the color schema (0 is the default value)
|
||||
|
||||
QString ext = QFileInfo(QString::fromStdString(index.sibling(index.row(), COLUMN_UNAME).data().toString().toStdString())).suffix();;
|
||||
QString ext = QFileInfo(QString::fromStdString(index.sibling(index.row(), COLUMN_UNAME).data().toString().toStdString())).suffix();;
|
||||
if (ext == "rsfc" || ext == "rsrl" || ext == "dist" || ext == "rsfb")
|
||||
progressBar.setColorSchema( 9);
|
||||
else
|
||||
|
@ -150,8 +158,9 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
}
|
||||
painter->drawText(option.rect, Qt::AlignCenter, newopt.text);
|
||||
break;
|
||||
case COLUMN_UNAME:
|
||||
// decoration
|
||||
case COLUMN_UNAME:
|
||||
case COLUMN_UPEER:
|
||||
// decoration
|
||||
value = index.data(Qt::DecorationRole);
|
||||
pixmap = qvariant_cast<QIcon>(value).pixmap(option.decorationSize, option.state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled, option.state & QStyle::State_Open ? QIcon::On : QIcon::Off);
|
||||
pixmapRect = (pixmap.isNull() ? QRect(0, 0, 0, 0): QRect(QPoint(0, 0), option.decorationSize));
|
||||
|
@ -161,9 +170,6 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
}
|
||||
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft, index.data().toString());
|
||||
break;
|
||||
case COLUMN_USTATUS:
|
||||
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignCenter, index.data().toString());
|
||||
break;
|
||||
default:
|
||||
painter->drawText(option.rect, Qt::AlignCenter, index.data().toString());
|
||||
}
|
||||
|
|
|
@ -26,15 +26,13 @@
|
|||
|
||||
// Defines for upload list list columns
|
||||
#define COLUMN_UNAME 0
|
||||
#define COLUMN_USIZE 1
|
||||
#define COLUMN_UTRANSFERRED 2
|
||||
#define COLUMN_ULSPEED 3
|
||||
#define COLUMN_UPROGRESS 4
|
||||
#define COLUMN_USTATUS 5
|
||||
#define COLUMN_USERNAME 6
|
||||
#define COLUMN_UHASH 7
|
||||
#define COLUMN_UUSERID 8
|
||||
#define COLUMN_UCOUNT 9
|
||||
#define COLUMN_UPEER 1
|
||||
#define COLUMN_USIZE 2
|
||||
#define COLUMN_UTRANSFERRED 3
|
||||
#define COLUMN_ULSPEED 4
|
||||
#define COLUMN_UPROGRESS 5
|
||||
#define COLUMN_UHASH 6
|
||||
#define COLUMN_UCOUNT 7
|
||||
|
||||
|
||||
#define MAX_CHAR_TMP 128
|
||||
|
|
|
@ -39,7 +39,9 @@
|
|||
class FileProgressInfo
|
||||
{
|
||||
public:
|
||||
typedef enum { DOWNLOAD_LINE,UPLOAD_LINE,DOWNLOAD_SOURCE } LineType ;
|
||||
typedef enum { UNINIT, DOWNLOAD_LINE, UPLOAD_LINE, DOWNLOAD_SOURCE } LineType ;
|
||||
|
||||
FileProgressInfo() : type(UNINIT), progress(0.0) {}
|
||||
|
||||
LineType type ;
|
||||
CompressedChunkMap cmap ;
|
||||
|
|
|
@ -22,9 +22,11 @@
|
|||
#include "GenCertDialog.h"
|
||||
|
||||
#include <QAbstractEventDispatcher>
|
||||
#include <QLineEdit>
|
||||
#include <QFileDialog>
|
||||
#include <QGraphicsOpacityEffect>
|
||||
#include <QMessageBox>
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QTextBrowser>
|
||||
#include <QTimer>
|
||||
|
@ -45,7 +47,7 @@
|
|||
#include <iostream>
|
||||
|
||||
#define IMAGE_GOOD ":/images/accepted16.png"
|
||||
#define IMAGE_BAD ":/images/deletemail24.png"
|
||||
#define IMAGE_BAD ":/images/cancel.png"
|
||||
|
||||
class EntropyCollectorWidget: public QTextBrowser
|
||||
{
|
||||
|
@ -133,8 +135,8 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
|
|||
//ui.headerFrame->setHeaderImage(QPixmap(":/icons/svg/profile.svg"));
|
||||
//ui.headerFrame->setHeaderText(tr("Create a new profile"));
|
||||
|
||||
connect(ui.reuse_existing_node_CB, SIGNAL(clicked()), this, SLOT(switchReuseExistingNode()));
|
||||
connect(ui.adv_checkbox, SIGNAL(clicked()), this, SLOT(setupState()));
|
||||
connect(ui.reuse_existing_node_CB, SIGNAL(triggered()), this, SLOT(switchReuseExistingNode()));
|
||||
connect(ui.adv_checkbox, SIGNAL(triggered()), this, SLOT(setupState()));
|
||||
connect(ui.nodeType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(setupState()));
|
||||
|
||||
connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson()));
|
||||
|
@ -142,11 +144,13 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
|
|||
connect(ui.exportIdentity_PB, SIGNAL(clicked()), this, SLOT(exportIdentity()));
|
||||
|
||||
connect(ui.password_input, SIGNAL(textChanged(QString)), this, SLOT(updateCheckLabels()));
|
||||
connect(ui.password_input_2, SIGNAL(textChanged(QString)), this, SLOT(updateCheckLabels()));
|
||||
connect(ui.password2_input, SIGNAL(textChanged(QString)), this, SLOT(updateCheckLabels()));
|
||||
connect(ui.name_input, SIGNAL(textChanged(QString)), this, SLOT(updateCheckLabels()));
|
||||
connect(ui.node_input, SIGNAL(textChanged(QString)), this, SLOT(updateCheckLabels()));
|
||||
connect(ui.reuse_existing_node_CB, SIGNAL(toggled(bool)), this, SLOT(updateCheckLabels()));
|
||||
|
||||
connect(ui.cbUseBob, SIGNAL(clicked(bool)), this, SLOT(useBobChecked(bool)));;
|
||||
|
||||
entropy_timer = new QTimer ;
|
||||
entropy_timer->start(20) ;
|
||||
QObject::connect(entropy_timer,SIGNAL(timeout()),this,SLOT(grabMouse())) ;
|
||||
|
@ -158,13 +162,17 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
|
|||
ui.keylength_comboBox->addItem("High (3072 bits)", QVariant(3072));
|
||||
ui.keylength_comboBox->addItem("Very high (4096 bits)", QVariant(4096));
|
||||
|
||||
// Default value.
|
||||
|
||||
ui.node_input->setText("My computer") ;
|
||||
|
||||
#if QT_VERSION >= 0x040700
|
||||
ui.node_input->setPlaceholderText(tr("[Required] Examples: Home, Laptop,...(Visible to friends).")) ;
|
||||
ui.hiddenaddr_input->setPlaceholderText(tr("[Optional] Tor/I2P address (Example: xa76giaf6ifda7ri63i263.onion)")) ;
|
||||
ui.name_input->setPlaceholderText(tr("[Required] Visible to friends, and friends of friends."));
|
||||
ui.nickname_input->setPlaceholderText(tr("[Optional] Used to write in chat rooms and forums. Can be set later."));
|
||||
ui.password_input->setPlaceholderText(tr("[Required] This password protects your data. Dont forget it!"));
|
||||
ui.password_input_2->setPlaceholderText(tr("[Required] Type the same password again here."));
|
||||
ui.node_input->setPlaceholderText(tr("Node name")) ;
|
||||
ui.hiddenaddr_input->setPlaceholderText(tr("Tor/I2P address")) ;
|
||||
ui.name_input->setPlaceholderText(tr("Username"));
|
||||
ui.nickname_input->setPlaceholderText(tr("Chat name"));
|
||||
ui.password_input->setPlaceholderText(tr("Password"));
|
||||
ui.password2_input->setPlaceholderText(tr("Password again"));
|
||||
#endif
|
||||
|
||||
ui.nickname_input->setMaxLength(RSID_MAXIMUM_NICKNAME_SIZE);
|
||||
|
@ -172,10 +180,22 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
|
|||
/* get all available pgp private certificates....
|
||||
* mark last one as default.
|
||||
*/
|
||||
|
||||
QMenu *menu = new QMenu(tr("Advanced options"));
|
||||
menu->addAction(ui.adv_checkbox);
|
||||
menu->addAction(ui.reuse_existing_node_CB);
|
||||
ui.optionsButton->setMenu(menu);
|
||||
|
||||
mAllFieldsOk = false ;
|
||||
mEntropyOk = false ;
|
||||
|
||||
#ifdef RS_ONLYHIDDENNODE
|
||||
ui.adv_checkbox->setChecked(true);
|
||||
ui.adv_checkbox->setVisible(false);
|
||||
ui.nodeType_CB->setCurrentIndex(1);
|
||||
ui.nodeType_CB->setEnabled(false);
|
||||
#endif
|
||||
|
||||
initKeyList();
|
||||
setupState();
|
||||
updateCheckLabels();
|
||||
|
@ -233,7 +253,7 @@ void GenCertDialog::mouseMoveEvent(QMouseEvent *e)
|
|||
|
||||
void GenCertDialog::setupState()
|
||||
{
|
||||
bool adv_state = ui.adv_checkbox->isChecked();
|
||||
bool adv_state = ui.adv_checkbox->isChecked();
|
||||
|
||||
if(!adv_state)
|
||||
{
|
||||
|
@ -246,69 +266,83 @@ void GenCertDialog::setupState()
|
|||
|
||||
genNewGPGKey = generate_new;
|
||||
|
||||
ui.no_node_label->setVisible(false);
|
||||
//ui.no_node_label->setVisible(false);
|
||||
|
||||
setWindowTitle(generate_new?tr("Create new profile and new Retroshare node"):tr("Create new Retroshare node"));
|
||||
//ui.headerFrame->setHeaderText(generate_new?tr("Create a new profile and node"):tr("Create a new node"));
|
||||
|
||||
ui.label_nodeType->setVisible(adv_state) ;
|
||||
ui.nodeType_CB->setVisible(adv_state) ;
|
||||
ui.reuse_existing_node_CB->setVisible(adv_state) ;
|
||||
ui.reuse_existing_node_CB->setEnabled(adv_state) ;
|
||||
ui.importIdentity_PB->setVisible(adv_state && !generate_new) ;
|
||||
ui.exportIdentity_PB->setVisible(adv_state && !generate_new) ;
|
||||
|
||||
ui.genPGPuser->setVisible(adv_state && haveGPGKeys && !generate_new) ;
|
||||
|
||||
ui.genprofileinfo_label->setVisible(false);
|
||||
ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to create a profile and associate a node with it. To do so please fill out this form.\nAlternatively you can import a (previously exported) profile. Just uncheck \"Create a new profile\""));
|
||||
ui.no_gpg_key_label->setVisible(false);
|
||||
|
||||
ui.nickname_label->setVisible(adv_state) ;
|
||||
ui.nickname_input->setVisible(adv_state) ;
|
||||
//ui.genprofileinfo_label->setVisible(false);
|
||||
//ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to create a profile and associate a node with it. To do so please fill out this form.\nAlternatively you can import a (previously exported) profile. Just uncheck \"Create a new profile\""));
|
||||
//no_gpg_key_label->setVisible(false);
|
||||
|
||||
ui.name_label->setVisible(true);
|
||||
ui.name_input->setVisible(generate_new);
|
||||
|
||||
ui.header_label->setVisible(false) ;
|
||||
//ui.header_label->setVisible(false) ;
|
||||
|
||||
ui.nickname_label->setVisible(adv_state && !mOnlyGenerateIdentity);
|
||||
ui.nickname_input->setVisible(adv_state && !mOnlyGenerateIdentity);
|
||||
|
||||
ui.node_label->setVisible(true);
|
||||
ui.node_input->setVisible(true);
|
||||
ui.node_name_check_LB->setVisible(adv_state);
|
||||
ui.node_label->setVisible(adv_state);
|
||||
ui.node_input->setVisible(adv_state);
|
||||
|
||||
ui.password_input->setVisible(true);
|
||||
ui.password_label->setVisible(true);
|
||||
|
||||
ui.password2_check_LB->setVisible(generate_new);
|
||||
ui.password_input_2->setVisible(generate_new);
|
||||
ui.password_label_2->setVisible(generate_new);
|
||||
ui.password2_input->setVisible(generate_new);
|
||||
ui.password2_label->setVisible(generate_new);
|
||||
|
||||
ui.keylength_label->setVisible(adv_state);
|
||||
ui.keylength_comboBox->setVisible(adv_state);
|
||||
|
||||
ui.entropy_bar->setVisible(true);
|
||||
|
||||
ui.genButton->setVisible(true);
|
||||
ui.genButton->setText(generate_new?tr("Generate new profile and node"):tr("Generate new node"));
|
||||
|
||||
ui.hiddenaddr_input->setVisible(hidden_state);
|
||||
ui.hiddenaddr_label->setVisible(hidden_state);
|
||||
|
||||
ui.hiddenport_label->setVisible(hidden_state);
|
||||
ui.hiddenport_spinBox->setVisible(hidden_state);
|
||||
|
||||
if(mEntropyOk && mAllFieldsOk)
|
||||
ui.cbUseBob->setVisible(hidden_state);
|
||||
|
||||
if(!mAllFieldsOk)
|
||||
{
|
||||
ui.genButton->setToolTip(tr("<p>Node creation is disabled until all fields correctly set.</p>")) ;
|
||||
|
||||
ui.genButton->setVisible(false) ;
|
||||
ui.generate_label->setVisible(false) ;
|
||||
ui.info_label->setText("Please fill your profile name and password...") ;
|
||||
ui.info_label->setVisible(true) ;
|
||||
}
|
||||
else if(!mEntropyOk)
|
||||
{
|
||||
ui.genButton->setToolTip(tr("<p>Node creation is disabled until enough randomness is collected. Please mouve your mouse around until you reach at least 20%.</p>")) ;
|
||||
|
||||
ui.genButton->setVisible(false) ;
|
||||
ui.generate_label->setVisible(false) ;
|
||||
ui.info_label->setText("Please move your mouse randomly to generate enough random data to create your profile.") ;
|
||||
ui.info_label->setVisible(true) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.genButton->setEnabled(true) ;
|
||||
ui.genButton->setIcon(QIcon(IMAGE_GOOD)) ;
|
||||
//ui.genButton->setIcon(QIcon(IMAGE_GOOD)) ;
|
||||
ui.genButton->setToolTip(tr("Click to create your node and/or profile")) ;
|
||||
ui.genButton->setVisible(true) ;
|
||||
ui.generate_label->setVisible(false) ;
|
||||
ui.info_label->setVisible(false) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.genButton->setEnabled(false) ;
|
||||
ui.genButton->setIcon(QIcon(IMAGE_BAD)) ;
|
||||
ui.genButton->setToolTip(tr("Disabled until all fields correctly set and enough randomness collected.")) ;
|
||||
}
|
||||
}
|
||||
|
||||
void GenCertDialog::exportIdentity()
|
||||
|
@ -358,7 +392,7 @@ void GenCertDialog::updateCheckLabels()
|
|||
mAllFieldsOk = false ;
|
||||
ui.password_check_LB ->setPixmap(bad) ;
|
||||
}
|
||||
if(ui.password_input->text().length() >= 3 && ui.password_input->text() == ui.password_input_2->text())
|
||||
if(ui.password_input->text().length() >= 3 && ui.password_input->text() == ui.password2_input->text())
|
||||
ui.password2_check_LB ->setPixmap(good) ;
|
||||
else
|
||||
{
|
||||
|
@ -373,7 +407,22 @@ void GenCertDialog::updateCheckLabels()
|
|||
else
|
||||
ui.randomness_check_LB->setPixmap(QPixmap(IMAGE_BAD)) ;
|
||||
|
||||
setupState();
|
||||
setupState();
|
||||
}
|
||||
|
||||
void GenCertDialog::useBobChecked(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
ui.hiddenaddr_input->setPlaceholderText(tr("I2P instance address with BOB enabled"));
|
||||
ui.hiddenaddr_label->setText(tr("I2P instance address"));
|
||||
|
||||
ui.hiddenport_spinBox->setEnabled(false);
|
||||
} else {
|
||||
ui.hiddenaddr_input->setPlaceholderText(tr("hidden service address"));
|
||||
ui.hiddenaddr_label->setText(tr("hidden address"));
|
||||
|
||||
ui.hiddenport_spinBox->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
bool GenCertDialog::importIdentity()
|
||||
|
@ -413,7 +462,15 @@ void GenCertDialog::genPerson()
|
|||
RsPgpId PGPId;
|
||||
bool isHiddenLoc = false;
|
||||
|
||||
mGXSNickname = ui.nickname_input->text();
|
||||
if(ui.nickname_input->isVisible())
|
||||
{
|
||||
mGXSNickname = ui.nickname_input->text();
|
||||
}
|
||||
else
|
||||
{
|
||||
mGXSNickname = ui.name_input->text();
|
||||
}
|
||||
|
||||
if (!mGXSNickname.isEmpty())
|
||||
{
|
||||
if (mGXSNickname.size() < RSID_MINIMUM_NICKNAME_SIZE)
|
||||
|
@ -440,15 +497,13 @@ void GenCertDialog::genPerson()
|
|||
{
|
||||
std::string hl = ui.hiddenaddr_input->text().toStdString();
|
||||
uint16_t port = ui.hiddenport_spinBox->value();
|
||||
if (!RsInit::SetHiddenLocation(hl, port)) /* parses it */
|
||||
{
|
||||
/* Message Dialog */
|
||||
QMessageBox::warning(this,
|
||||
tr("Invalid hidden node"),
|
||||
tr("Please enter a valid address of the form: 31769173498.onion:7800 or [52 characters].b32.i2p"),
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
bool useBob = ui.cbUseBob->isChecked();
|
||||
|
||||
if (useBob && hl.empty())
|
||||
hl = "127.0.0.1";
|
||||
|
||||
RsInit::SetHiddenLocation(hl, port, useBob); /* parses it */
|
||||
|
||||
isHiddenLoc = true;
|
||||
}
|
||||
|
||||
|
@ -485,7 +540,7 @@ void GenCertDialog::genPerson()
|
|||
return;
|
||||
}
|
||||
|
||||
if(ui.password_input->text() != ui.password_input_2->text())
|
||||
if(ui.password_input->text() != ui.password2_input->text())
|
||||
{
|
||||
QMessageBox::warning(this,
|
||||
tr("PGP key pair generation failure"),
|
||||
|
@ -495,15 +550,15 @@ void GenCertDialog::genPerson()
|
|||
}
|
||||
//generate a new gpg key
|
||||
std::string err_string;
|
||||
ui.no_gpg_key_label->setText(tr("Generating new node key, please be patient: this process needs generating large prime numbers, and can take some minutes on slow computers. \n\nFill in your password when asked, to sign your new key."));
|
||||
ui.no_gpg_key_label->show();
|
||||
ui.reuse_existing_node_CB->hide();
|
||||
//_key_label->setText(tr("Generating new node key, please be patient: this process needs generating large prime numbers, and can take some minutes on slow computers. \n\nFill in your password when asked, to sign your new key."));
|
||||
//ui.no_gpg_key_label->show();
|
||||
//ui.reuse_existing_node_CB->hide();
|
||||
ui.name_label->hide();
|
||||
ui.name_input->hide();
|
||||
ui.nickname_label->hide();
|
||||
ui.nickname_input->hide();
|
||||
ui.password_label_2->hide();
|
||||
ui.password_input_2->hide();
|
||||
ui.password2_label->hide();
|
||||
ui.password2_input->hide();
|
||||
ui.password2_check_LB->hide();
|
||||
ui.password_check_LB->hide();
|
||||
ui.password_label->hide();
|
||||
|
@ -514,9 +569,9 @@ void GenCertDialog::genPerson()
|
|||
ui.node_input->hide();
|
||||
ui.genButton->hide();
|
||||
ui.importIdentity_PB->hide();
|
||||
ui.genprofileinfo_label->hide();
|
||||
//ui.genprofileinfo_label->hide();
|
||||
ui.nodeType_CB->hide();
|
||||
ui.adv_checkbox->hide();
|
||||
//ui.adv_checkbox->hide();
|
||||
ui.keylength_label->hide();
|
||||
ui.keylength_comboBox->hide();
|
||||
|
||||
|
@ -557,8 +612,6 @@ void GenCertDialog::genPerson()
|
|||
std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl;
|
||||
bool okGen = RsAccounts::GenerateSSLCertificate(PGPId, "", genLoc, "", isHiddenLoc, sslPasswd, sslId, err);
|
||||
|
||||
rsNotify->clearPgpPassphrase() ;
|
||||
|
||||
if (okGen)
|
||||
{
|
||||
/* complete the process */
|
||||
|
|
|
@ -45,6 +45,7 @@ private slots:
|
|||
void switchReuseExistingNode();
|
||||
void grabMouse();
|
||||
void updateCheckLabels();
|
||||
void useBobChecked(bool checked);
|
||||
|
||||
private:
|
||||
void initKeyList();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -120,10 +120,10 @@ void GetStartedDialog::updateFromUserLevel()
|
|||
case RSCONFIG_USER_LEVEL_POWER:
|
||||
case RSCONFIG_USER_LEVEL_OVERRIDE:
|
||||
ui.firewallCheckBox->setChecked(true);
|
||||
|
||||
/* fallthrough */
|
||||
case RSCONFIG_USER_LEVEL_CASUAL:
|
||||
ui.connectCheckBox->setChecked(true);
|
||||
|
||||
/* fallthrough */
|
||||
case RSCONFIG_USER_LEVEL_BASIC:
|
||||
ui.addCheckBox->setChecked(true);
|
||||
ui.inviteCheckBox->setChecked(true);
|
||||
|
|
|
@ -87,15 +87,15 @@ HomePage::HomePage(QWidget *parent) :
|
|||
int S = QFontMetricsF(font()).height();
|
||||
QString help_str = tr(
|
||||
" <h1><img width=\"%1\" src=\":/icons/help_64.png\"> Welcome to Retroshare!</h1>\
|
||||
<p>The first thing you have to do is to <b>make friends</b>. Once you create a network of Retroshare nodes, or join an existing network,\
|
||||
<p>You need to <b>make friends</b>! After you create a network of friends or join an existing network,\
|
||||
you'll be able to exchange files, chat, talk in forums, etc. </p>\
|
||||
<div align=center>\
|
||||
<IMG align=\"center\" width=\"%2\" src=\":/images/network_map.png\"/> \
|
||||
</div>\
|
||||
<p>To do so, use the current page to exchange certificates with other persons you want your Retroshare node to connect to.</p> \
|
||||
<p>To do so, copy your certificate on this page and send it to friends, and add your friends' certificate.</p> \
|
||||
<p>Another option is to search the internet for \"Retroshare chat servers\" (independently administrated). These servers allow you to exchange \
|
||||
certificates with a dedicated Retroshare node, through which\
|
||||
you will be able to meet other people anonymously.</p> ").arg(QString::number(2*S)).arg(width()*0.5);
|
||||
you will be able to anonymously meet other people.</p> ").arg(QString::number(2*S)).arg(width()*0.5);
|
||||
registerHelpButton(ui->helpButton,help_str,"HomePage") ;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,103 +6,15 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1558</width>
|
||||
<height>703</height>
|
||||
<width>1334</width>
|
||||
<height>867</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QFrame" name="addframe">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Did you receive a certificate from a friend?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="addButton">
|
||||
<property name="text">
|
||||
<string>Add friends certificate</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/png/invite.png</normaloff>:/icons/png/invite.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="LoadCertFileButton">
|
||||
<property name="text">
|
||||
<string>Add certificate file</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/svg/folders1.svg</normaloff>:/icons/svg/folders1.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QFrame" name="addFrame">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<item row="4" column="1" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
|
@ -238,14 +150,14 @@ private and secure decentralized communication platform.
|
|||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="images.qrc">:/images/logo/logo_splash.png</pixmap>
|
||||
<pixmap resource="images.qrc">:/images/logo/logo_web_nobackground.png</pixmap>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QPushButton" name="runStartWizard_PB">
|
||||
<property name="text">
|
||||
<string>Launch startup wizard</string>
|
||||
|
@ -256,15 +168,149 @@ private and secure decentralized communication platform.
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QPushButton" name="openwebhelp">
|
||||
<property name="text">
|
||||
<string>Open Web Help</string>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QFrame" name="addframe">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/settings/webinterface.svg</normaloff>:/icons/settings/webinterface.svg</iconset>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Did you receive a certificate from a friend?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="addButton">
|
||||
<property name="text">
|
||||
<string>Add friends certificate</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/png/invite.png</normaloff>:/icons/png/invite.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="LoadCertFileButton">
|
||||
<property name="text">
|
||||
<string>Add certificate file</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/svg/folders1.svg</normaloff>:/icons/svg/folders1.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QFrame" name="addFrame">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2">
|
||||
<widget class="QFrame" name="helpframe">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Do you need help with RetroShare?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="openwebhelp">
|
||||
<property name="text">
|
||||
<string>Open Web Help</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/settings/webinterface.svg</normaloff>:/icons/settings/webinterface.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -273,7 +319,8 @@ private and secure decentralized communication platform.
|
|||
<zorder>label_2</zorder>
|
||||
<zorder>addframe</zorder>
|
||||
<zorder>runStartWizard_PB</zorder>
|
||||
<zorder>openwebhelp</zorder>
|
||||
<zorder>frame</zorder>
|
||||
<zorder>helpframe</zorder>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="icons.qrc"/>
|
||||
|
|
|
@ -467,8 +467,7 @@ void IdDetailsDialog::sendInvite()
|
|||
composer->setTitleText(tr("You have a friend invite"));
|
||||
|
||||
RsPeerId ownId = rsPeers->getOwnId();
|
||||
RetroShareLink link;
|
||||
link.createCertificate(ownId);
|
||||
RetroShareLink link = RetroShareLink::createCertificate(ownId);
|
||||
|
||||
RsGxsId keyId(ui->lineEdit_KeyId->text().toStdString());
|
||||
|
||||
|
|
|
@ -55,10 +55,11 @@
|
|||
*****/
|
||||
|
||||
// Data Requests.
|
||||
#define IDDIALOG_IDLIST 1
|
||||
#define IDDIALOG_IDDETAILS 2
|
||||
#define IDDIALOG_REPLIST 3
|
||||
#define IDDIALOG_REFRESH 4
|
||||
#define IDDIALOG_IDLIST 1
|
||||
#define IDDIALOG_IDDETAILS 2
|
||||
#define IDDIALOG_REPLIST 3
|
||||
#define IDDIALOG_REFRESH 4
|
||||
#define IDDIALOG_SERIALIZED_GROUP 5
|
||||
|
||||
#define CIRCLEGROUP_CIRCLE_COL_GROUPNAME 0
|
||||
#define CIRCLEGROUP_CIRCLE_COL_GROUPID 1
|
||||
|
@ -814,7 +815,7 @@ void IdDialog::loadCircleGroupData(const uint32_t& token)
|
|||
#ifdef ID_DEBUG
|
||||
std::cerr << "Loading circle info" << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
std::vector<RsGxsCircleGroup> circle_grp_v ;
|
||||
rsGxsCircles->getGroupData(token, circle_grp_v);
|
||||
|
||||
|
@ -1059,7 +1060,9 @@ void IdDialog::CircleListCustomPopupMenu( QPoint )
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << " Item is a circle item. Adding Edit/Details menu entry." << std::endl;
|
||||
#endif
|
||||
is_circle = true ;
|
||||
|
||||
contextMnu.addSeparator() ;
|
||||
|
@ -1075,7 +1078,9 @@ void IdDialog::CircleListCustomPopupMenu( QPoint )
|
|||
am_I_circle_admin = bool(group_flags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) ;
|
||||
}
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << " Item is a GxsId item. Requesting flags/group id from parent: " << circle_id << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
RsGxsCircleDetails details ;
|
||||
|
@ -1207,6 +1212,7 @@ void IdDialog::CircleListCustomPopupMenu( QPoint )
|
|||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
#ifdef SUSPENDED
|
||||
static void set_item_background(QTreeWidgetItem *item, uint32_t type)
|
||||
{
|
||||
QBrush brush;
|
||||
|
@ -1247,7 +1253,6 @@ static void update_children_background(QTreeWidgetItem *item, uint32_t type)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SUSPENDED
|
||||
static void set_tree_background(QTreeWidget *tree, uint32_t type)
|
||||
{
|
||||
std::cerr << "CirclesDialog set_tree_background()";
|
||||
|
@ -1385,6 +1390,8 @@ void IdDialog::updateSelection()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void IdDialog::requestIdList()
|
||||
{
|
||||
//Disable by default, will be enable by insertIdDetails()
|
||||
|
@ -1562,6 +1569,15 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
|||
|
||||
void IdDialog::insertIdList(uint32_t token)
|
||||
{
|
||||
//First: Get current item to restore after
|
||||
RsGxsGroupId oldCurrentId = mIdToNavigate;
|
||||
{
|
||||
QTreeWidgetItem *oldCurrent = ui->idTreeWidget->currentItem();
|
||||
if (oldCurrent) {
|
||||
oldCurrentId = RsGxsGroupId(oldCurrent->text(RSID_COL_KEYID).toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
mStateHelper->setLoading(IDDIALOG_IDLIST, false);
|
||||
|
||||
int accept = filter;
|
||||
|
@ -1660,6 +1676,7 @@ void IdDialog::insertIdList(uint32_t token)
|
|||
int itemCount = contactsItem->childCount() + allItem->childCount() + ownItem->childCount();
|
||||
ui->label_count->setText( "(" + QString::number( itemCount ) + ")" );
|
||||
|
||||
navigate(RsGxsId(oldCurrentId));
|
||||
filterIds();
|
||||
updateSelection();
|
||||
}
|
||||
|
@ -1940,8 +1957,7 @@ QString IdDialog::createUsageString(const RsIdentityUsage& u) const
|
|||
case RsIdentityUsage::MESSAGE_AUTHOR_SIGNATURE_VALIDATION:
|
||||
case RsIdentityUsage::MESSAGE_AUTHOR_KEEP_ALIVE: // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
|
||||
{
|
||||
RetroShareLink l;
|
||||
l.createGxsMessageLink(service_type,u.mGrpId,u.mMsgId,tr("Message/vote/comment"));
|
||||
RetroShareLink l = RetroShareLink::createGxsMessageLink(service_type,u.mGrpId,u.mMsgId,tr("Message/vote/comment"));
|
||||
return tr("%1 in %2 tab").arg(l.toHtml()).arg(service_name) ;
|
||||
}
|
||||
case RsIdentityUsage::CHAT_LOBBY_MSG_VALIDATION: // Chat lobby msgs are signed, so each time one comes, or a chat lobby event comes, a signature verificaiton happens.
|
||||
|
@ -1990,7 +2006,7 @@ QString IdDialog::createUsageString(const RsIdentityUsage& u) const
|
|||
return tr("Membership verification in circle %1.").arg(QString::fromStdString(u.mGrpId.toStdString()));
|
||||
}
|
||||
|
||||
#warning TODO! Add the different strings and translations here.
|
||||
#warning TODO! csoler 2017-01-03: Add the different strings and translations here.
|
||||
default:
|
||||
return QString("Undone yet");
|
||||
}
|
||||
|
@ -2048,20 +2064,27 @@ void IdDialog::modifyReputation()
|
|||
|
||||
void IdDialog::navigate(const RsGxsId& gxs_id)
|
||||
{
|
||||
std::cerr << "IdDialog::navigate to " << gxs_id.toStdString() << std::endl;
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << "IdDialog::navigate to " << gxs_id.toStdString() << std::endl;
|
||||
#endif
|
||||
|
||||
// in order to do this, we just select the correct ID in the ID list
|
||||
// in order to do this, we just select the correct ID in the ID list
|
||||
if (!gxs_id.isNull())
|
||||
{
|
||||
QList<QTreeWidgetItem*> select = ui->idTreeWidget->findItems(QString::fromStdString(gxs_id.toStdString()),Qt::MatchExactly | Qt::MatchRecursive | Qt::MatchWrap,RSID_COL_KEYID) ;
|
||||
|
||||
QList<QTreeWidgetItem*> select = ui->idTreeWidget->findItems(QString::fromStdString(gxs_id.toStdString()),Qt::MatchExactly | Qt::MatchRecursive | Qt::MatchWrap,RSID_COL_KEYID) ;
|
||||
|
||||
if(select.empty())
|
||||
{
|
||||
std::cerr << "Cannot find item with ID " << gxs_id << " in ID list." << std::endl;
|
||||
return ;
|
||||
}
|
||||
ui->idTreeWidget->setCurrentItem(*select.begin(),true);
|
||||
if(select.empty())
|
||||
{
|
||||
mIdToNavigate = RsGxsGroupId(gxs_id);
|
||||
std::cerr << "Cannot find item with ID " << gxs_id << " in ID list." << std::endl;
|
||||
return;
|
||||
}
|
||||
ui->idTreeWidget->setCurrentItem(*select.begin(),true);
|
||||
}
|
||||
|
||||
mIdToNavigate = RsGxsGroupId();
|
||||
}
|
||||
|
||||
void IdDialog::updateDisplay(bool complete)
|
||||
{
|
||||
/* Update identity list */
|
||||
|
@ -2174,6 +2197,44 @@ void IdDialog::insertRepList(uint32_t token)
|
|||
mStateHelper->setActive(IDDIALOG_REPLIST, true);
|
||||
}
|
||||
|
||||
void IdDialog::handleSerializedGroupData(uint32_t token)
|
||||
{
|
||||
std::map<RsGxsId,std::string> serialized_group_map ;
|
||||
|
||||
rsIdentity->getGroupSerializedData(token, serialized_group_map);
|
||||
|
||||
if(serialized_group_map.size() < 1)
|
||||
{
|
||||
std::cerr << "(EE) Cannot get radix data " << std::endl;
|
||||
return;
|
||||
}
|
||||
if(serialized_group_map.size() > 1)
|
||||
{
|
||||
std::cerr << "(EE) Too many results for serialized data" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
RsGxsId gxs_id = serialized_group_map.begin()->first ;
|
||||
std::string radix = serialized_group_map.begin()->second ;
|
||||
|
||||
RsIdentityDetails details ;
|
||||
|
||||
if(!rsIdentity->getIdDetails(gxs_id,details))
|
||||
{
|
||||
std::cerr << "(EE) Cannot get id details for key " << gxs_id << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
QList<RetroShareLink> urls ;
|
||||
|
||||
RetroShareLink link = RetroShareLink::createIdentity(gxs_id,QString::fromUtf8(details.mNickname.c_str()),QString::fromStdString(radix)) ;
|
||||
urls.push_back(link);
|
||||
|
||||
RSLinkClipboard::copyLinks(urls) ;
|
||||
|
||||
QMessageBox::information(NULL,tr("information"),tr("This identity link was copied to your clipboard. Paste it in a mail, or a message to transmit the identity to someone.")) ;
|
||||
}
|
||||
|
||||
void IdDialog::loadRequest(const TokenQueue * queue, const TokenRequest &req)
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
|
@ -2197,6 +2258,10 @@ void IdDialog::loadRequest(const TokenQueue * queue, const TokenRequest &req)
|
|||
insertRepList(req.mToken);
|
||||
break;
|
||||
|
||||
case IDDIALOG_SERIALIZED_GROUP:
|
||||
handleSerializedGroupData(req.mToken);
|
||||
break;
|
||||
|
||||
case IDDIALOG_REFRESH:
|
||||
// replaced by RsGxsUpdateBroadcastPage
|
||||
// updateDisplay(true);
|
||||
|
@ -2240,165 +2305,211 @@ void IdDialog::loadRequest(const TokenQueue * queue, const TokenRequest &req)
|
|||
|
||||
void IdDialog::IdListCustomPopupMenu( QPoint )
|
||||
{
|
||||
QMenu *contextMenu = new QMenu(this);
|
||||
QMenu *contextMenu = new QMenu(this);
|
||||
|
||||
|
||||
std::list<RsGxsId> own_identities ;
|
||||
rsIdentity->getOwnIds(own_identities) ;
|
||||
std::list<RsGxsId> own_identities ;
|
||||
rsIdentity->getOwnIds(own_identities) ;
|
||||
|
||||
// make some stats about what's selected. If the same value is used for all selected items, it can be switched.
|
||||
// make some stats about what's selected. If the same value is used for all selected items, it can be switched.
|
||||
|
||||
QList<QTreeWidgetItem *> selected_items = ui->idTreeWidget->selectedItems();
|
||||
QList<QTreeWidgetItem *> selected_items = ui->idTreeWidget->selectedItems();
|
||||
|
||||
bool root_node_present = false ;
|
||||
bool one_item_owned_by_you = false ;
|
||||
uint32_t n_positive_reputations = 0 ;
|
||||
uint32_t n_negative_reputations = 0 ;
|
||||
uint32_t n_neutral_reputations = 0 ;
|
||||
uint32_t n_is_a_contact = 0 ;
|
||||
uint32_t n_is_not_a_contact = 0 ;
|
||||
uint32_t n_selected_items =0 ;
|
||||
bool root_node_present = false ;
|
||||
bool one_item_owned_by_you = false ;
|
||||
uint32_t n_positive_reputations = 0 ;
|
||||
uint32_t n_negative_reputations = 0 ;
|
||||
uint32_t n_neutral_reputations = 0 ;
|
||||
uint32_t n_is_a_contact = 0 ;
|
||||
uint32_t n_is_not_a_contact = 0 ;
|
||||
uint32_t n_selected_items =0 ;
|
||||
|
||||
for(QList<QTreeWidgetItem*>::const_iterator it(selected_items.begin());it!=selected_items.end();++it)
|
||||
{
|
||||
if(*it == allItem || *it == contactsItem || *it == ownItem)
|
||||
{
|
||||
root_node_present = true ;
|
||||
continue ;
|
||||
}
|
||||
|
||||
uint32_t item_flags = (*it)->data(RSID_COL_KEYID,Qt::UserRole).toUInt() ;
|
||||
|
||||
if(item_flags & RSID_FILTER_OWNED_BY_YOU)
|
||||
one_item_owned_by_you = true ;
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << " item flags = " << item_flags << std::endl;
|
||||
#endif
|
||||
RsGxsId keyId((*it)->text(RSID_COL_KEYID).toStdString());
|
||||
|
||||
RsIdentityDetails det ;
|
||||
rsIdentity->getIdDetails(keyId,det) ;
|
||||
|
||||
switch(det.mReputation.mOwnOpinion)
|
||||
{
|
||||
case RsReputations::OPINION_NEGATIVE: ++n_negative_reputations ;
|
||||
break ;
|
||||
|
||||
case RsReputations::OPINION_POSITIVE: ++n_positive_reputations ;
|
||||
break ;
|
||||
|
||||
case RsReputations::OPINION_NEUTRAL: ++n_neutral_reputations ;
|
||||
break ;
|
||||
}
|
||||
|
||||
++n_selected_items ;
|
||||
|
||||
if(rsIdentity->isARegularContact(keyId))
|
||||
++n_is_a_contact ;
|
||||
else
|
||||
++n_is_not_a_contact ;
|
||||
}
|
||||
|
||||
if(!root_node_present) // don't show menu if some of the root nodes are present
|
||||
for(QList<QTreeWidgetItem*>::const_iterator it(selected_items.begin());it!=selected_items.end();++it)
|
||||
{
|
||||
if(*it == allItem || *it == contactsItem || *it == ownItem)
|
||||
{
|
||||
|
||||
if(!one_item_owned_by_you)
|
||||
{
|
||||
QWidget *widget = new QWidget(contextMenu);
|
||||
widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
||||
|
||||
// create menu header
|
||||
QHBoxLayout *hbox = new QHBoxLayout(widget);
|
||||
hbox->setMargin(0);
|
||||
hbox->setSpacing(6);
|
||||
|
||||
QLabel *iconLabel = new QLabel(widget);
|
||||
QPixmap pix = QPixmap(":/images/user/friends24.png").scaledToHeight(QFontMetricsF(iconLabel->font()).height()*1.5);
|
||||
iconLabel->setPixmap(pix);
|
||||
iconLabel->setMaximumSize(iconLabel->frameSize().height() + pix.height(), pix.width());
|
||||
hbox->addWidget(iconLabel);
|
||||
|
||||
QLabel *textLabel = new QLabel("<strong>" + ui->titleBarLabel->text() + "</strong>", widget);
|
||||
hbox->addWidget(textLabel);
|
||||
|
||||
QSpacerItem *spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
hbox->addItem(spacerItem);
|
||||
|
||||
widget->setLayout(hbox);
|
||||
|
||||
QWidgetAction *widgetAction = new QWidgetAction(this);
|
||||
widgetAction->setDefaultWidget(widget);
|
||||
contextMenu->addAction(widgetAction);
|
||||
|
||||
if(n_selected_items == 1) // if only one item is selected, allow to chat with this item
|
||||
{
|
||||
if(own_identities.size() <= 1)
|
||||
{
|
||||
QAction *action = contextMenu->addAction(QIcon(":/images/chat_24.png"), tr("Chat with this person"), this, SLOT(chatIdentity()));
|
||||
|
||||
if(own_identities.empty())
|
||||
action->setEnabled(false) ;
|
||||
else
|
||||
action->setData(QString::fromStdString((own_identities.front()).toStdString())) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
QMenu *mnu = contextMenu->addMenu(QIcon(":/images/chat_24.png"),tr("Chat with this person as...")) ;
|
||||
|
||||
for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
|
||||
{
|
||||
RsIdentityDetails idd ;
|
||||
rsIdentity->getIdDetails(*it,idd) ;
|
||||
|
||||
QPixmap pixmap ;
|
||||
|
||||
if(idd.mAvatar.mSize == 0 || !pixmap.loadFromData(idd.mAvatar.mData, idd.mAvatar.mSize, "PNG"))
|
||||
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(*it)) ;
|
||||
|
||||
QAction *action = mnu->addAction(QIcon(pixmap), QString("%1 (%2)").arg(QString::fromUtf8(idd.mNickname.c_str()), QString::fromStdString((*it).toStdString())), this, SLOT(chatIdentity()));
|
||||
action->setData(QString::fromStdString((*it).toStdString())) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// always allow to send messages
|
||||
contextMenu->addAction(QIcon(":/images/mail_new.png"), tr("Send message"), this, SLOT(sendMsg()));
|
||||
|
||||
contextMenu->addSeparator();
|
||||
|
||||
if(n_is_a_contact == 0)
|
||||
contextMenu->addAction(QIcon(), tr("Add to Contacts"), this, SLOT(addtoContacts()));
|
||||
|
||||
if(n_is_not_a_contact == 0)
|
||||
contextMenu->addAction(QIcon(":/images/cancel.png"), tr("Remove from Contacts"), this, SLOT(removefromContacts()));
|
||||
|
||||
contextMenu->addSeparator();
|
||||
|
||||
if(n_positive_reputations == 0) // only unban when all items are banned
|
||||
contextMenu->addAction(QIcon(":/icons/png/thumbs-up.png"), tr("Set positive opinion"), this, SLOT(positivePerson()));
|
||||
|
||||
if(n_neutral_reputations == 0) // only unban when all items are banned
|
||||
contextMenu->addAction(QIcon(":/icons/png/thumbs-neutral.png"), tr("Set neutral opinion"), this, SLOT(neutralPerson()));
|
||||
|
||||
if(n_negative_reputations == 0)
|
||||
contextMenu->addAction(QIcon(":/icons/png/thumbs-down.png"), tr("Set negative opinion"), this, SLOT(negativePerson()));
|
||||
}
|
||||
|
||||
if(one_item_owned_by_you && n_selected_items==1)
|
||||
{
|
||||
contextMenu->addSeparator();
|
||||
|
||||
contextMenu->addAction(ui->editIdentity);
|
||||
contextMenu->addAction(ui->removeIdentity);
|
||||
}
|
||||
|
||||
root_node_present = true ;
|
||||
continue ;
|
||||
}
|
||||
|
||||
contextMenu = ui->idTreeWidget->createStandardContextMenu(contextMenu);
|
||||
uint32_t item_flags = (*it)->data(RSID_COL_KEYID,Qt::UserRole).toUInt() ;
|
||||
|
||||
contextMenu->exec(QCursor::pos());
|
||||
delete contextMenu;
|
||||
if(item_flags & RSID_FILTER_OWNED_BY_YOU)
|
||||
one_item_owned_by_you = true ;
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << " item flags = " << item_flags << std::endl;
|
||||
#endif
|
||||
RsGxsId keyId((*it)->text(RSID_COL_KEYID).toStdString());
|
||||
|
||||
RsIdentityDetails det ;
|
||||
rsIdentity->getIdDetails(keyId,det) ;
|
||||
|
||||
switch(det.mReputation.mOwnOpinion)
|
||||
{
|
||||
case RsReputations::OPINION_NEGATIVE: ++n_negative_reputations ;
|
||||
break ;
|
||||
|
||||
case RsReputations::OPINION_POSITIVE: ++n_positive_reputations ;
|
||||
break ;
|
||||
|
||||
case RsReputations::OPINION_NEUTRAL: ++n_neutral_reputations ;
|
||||
break ;
|
||||
}
|
||||
|
||||
++n_selected_items ;
|
||||
|
||||
if(rsIdentity->isARegularContact(keyId))
|
||||
++n_is_a_contact ;
|
||||
else
|
||||
++n_is_not_a_contact ;
|
||||
}
|
||||
|
||||
if(!root_node_present) // don't show menu if some of the root nodes are present
|
||||
{
|
||||
|
||||
if(!one_item_owned_by_you)
|
||||
{
|
||||
QWidget *widget = new QWidget(contextMenu);
|
||||
widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
||||
|
||||
// create menu header
|
||||
QHBoxLayout *hbox = new QHBoxLayout(widget);
|
||||
hbox->setMargin(0);
|
||||
hbox->setSpacing(6);
|
||||
|
||||
QLabel *iconLabel = new QLabel(widget);
|
||||
QPixmap pix = QPixmap(":/images/user/friends24.png").scaledToHeight(QFontMetricsF(iconLabel->font()).height()*1.5);
|
||||
iconLabel->setPixmap(pix);
|
||||
iconLabel->setMaximumSize(iconLabel->frameSize().height() + pix.height(), pix.width());
|
||||
hbox->addWidget(iconLabel);
|
||||
|
||||
QLabel *textLabel = new QLabel("<strong>" + ui->titleBarLabel->text() + "</strong>", widget);
|
||||
hbox->addWidget(textLabel);
|
||||
|
||||
QSpacerItem *spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
hbox->addItem(spacerItem);
|
||||
|
||||
widget->setLayout(hbox);
|
||||
|
||||
QWidgetAction *widgetAction = new QWidgetAction(this);
|
||||
widgetAction->setDefaultWidget(widget);
|
||||
contextMenu->addAction(widgetAction);
|
||||
|
||||
if(n_selected_items == 1) // if only one item is selected, allow to chat with this item
|
||||
{
|
||||
if(own_identities.size() <= 1)
|
||||
{
|
||||
QAction *action = contextMenu->addAction(QIcon(":/images/chat_24.png"), tr("Chat with this person"), this, SLOT(chatIdentity()));
|
||||
|
||||
if(own_identities.empty())
|
||||
action->setEnabled(false) ;
|
||||
else
|
||||
action->setData(QString::fromStdString((own_identities.front()).toStdString())) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
QMenu *mnu = contextMenu->addMenu(QIcon(":/images/chat_24.png"),tr("Chat with this person as...")) ;
|
||||
|
||||
for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
|
||||
{
|
||||
RsIdentityDetails idd ;
|
||||
rsIdentity->getIdDetails(*it,idd) ;
|
||||
|
||||
QPixmap pixmap ;
|
||||
|
||||
if(idd.mAvatar.mSize == 0 || !pixmap.loadFromData(idd.mAvatar.mData, idd.mAvatar.mSize, "PNG"))
|
||||
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(*it)) ;
|
||||
|
||||
QAction *action = mnu->addAction(QIcon(pixmap), QString("%1 (%2)").arg(QString::fromUtf8(idd.mNickname.c_str()), QString::fromStdString((*it).toStdString())), this, SLOT(chatIdentity()));
|
||||
action->setData(QString::fromStdString((*it).toStdString())) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (n_selected_items==1)
|
||||
contextMenu->addAction(QIcon(":/images/chat_24.png"),tr("Copy identity to clipboard"),this,SLOT(copyRetroshareLink())) ;
|
||||
|
||||
// always allow to send messages
|
||||
contextMenu->addAction(QIcon(":/images/mail_new.png"), tr("Send message"), this, SLOT(sendMsg()));
|
||||
|
||||
contextMenu->addSeparator();
|
||||
|
||||
if(n_is_a_contact == 0)
|
||||
contextMenu->addAction(QIcon(), tr("Add to Contacts"), this, SLOT(addtoContacts()));
|
||||
|
||||
if(n_is_not_a_contact == 0)
|
||||
contextMenu->addAction(QIcon(":/images/cancel.png"), tr("Remove from Contacts"), this, SLOT(removefromContacts()));
|
||||
|
||||
contextMenu->addSeparator();
|
||||
|
||||
if(n_positive_reputations == 0) // only unban when all items are banned
|
||||
contextMenu->addAction(QIcon(":/icons/png/thumbs-up.png"), tr("Set positive opinion"), this, SLOT(positivePerson()));
|
||||
|
||||
if(n_neutral_reputations == 0) // only unban when all items are banned
|
||||
contextMenu->addAction(QIcon(":/icons/png/thumbs-neutral.png"), tr("Set neutral opinion"), this, SLOT(neutralPerson()));
|
||||
|
||||
if(n_negative_reputations == 0)
|
||||
contextMenu->addAction(QIcon(":/icons/png/thumbs-down.png"), tr("Set negative opinion"), this, SLOT(negativePerson()));
|
||||
}
|
||||
|
||||
if(one_item_owned_by_you && n_selected_items==1)
|
||||
{
|
||||
contextMenu->addSeparator();
|
||||
|
||||
contextMenu->addAction(QIcon(":/images/chat_24.png"),tr("Copy identity to clipboard"),this,SLOT(copyRetroshareLink())) ;
|
||||
contextMenu->addAction(ui->editIdentity);
|
||||
contextMenu->addAction(ui->removeIdentity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
contextMenu = ui->idTreeWidget->createStandardContextMenu(contextMenu);
|
||||
|
||||
contextMenu->exec(QCursor::pos());
|
||||
delete contextMenu;
|
||||
}
|
||||
|
||||
void IdDialog::copyRetroshareLink()
|
||||
{
|
||||
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
|
||||
|
||||
if (!item)
|
||||
{
|
||||
std::cerr << "IdDialog::editIdentity() Invalid item";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
RsGxsId gxs_id(item->text(RSID_COL_KEYID).toStdString());
|
||||
|
||||
if(gxs_id.isNull())
|
||||
{
|
||||
std::cerr << "Null GXS id. Something went wrong." << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
RsIdentityDetails details ;
|
||||
|
||||
if(! rsIdentity->getIdDetails(gxs_id,details))
|
||||
return ;
|
||||
|
||||
if (!mIdQueue)
|
||||
return;
|
||||
|
||||
mStateHelper->setLoading(IDDIALOG_SERIALIZED_GROUP, true);
|
||||
|
||||
mIdQueue->cancelActiveRequestTokens(IDDIALOG_SERIALIZED_GROUP);
|
||||
|
||||
std::list<RsGxsGroupId> ids ;
|
||||
ids.push_back(RsGxsGroupId(gxs_id)) ;
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_SERIALIZED_DATA;
|
||||
|
||||
uint32_t token;
|
||||
|
||||
mIdQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, IDDIALOG_SERIALIZED_GROUP);
|
||||
}
|
||||
|
||||
void IdDialog::chatIdentity()
|
||||
|
|
|
@ -93,6 +93,7 @@ private slots:
|
|||
void editIdentity();
|
||||
void chatIdentity();
|
||||
void sendMsg();
|
||||
void copyRetroshareLink();
|
||||
void on_closeInfoFrameButton_clicked();
|
||||
|
||||
void updateSelection();
|
||||
|
@ -132,6 +133,7 @@ private:
|
|||
|
||||
void requestRepList();
|
||||
void insertRepList(uint32_t token);
|
||||
void handleSerializedGroupData(uint32_t token);
|
||||
|
||||
void requestIdEdit(std::string &id);
|
||||
void showIdEdit(uint32_t token);
|
||||
|
@ -152,6 +154,7 @@ private:
|
|||
std::map<uint32_t, CircleUpdateOrder> mCircleUpdates ;
|
||||
|
||||
RsGxsGroupId mId;
|
||||
RsGxsGroupId mIdToNavigate;
|
||||
int filter;
|
||||
|
||||
/* UI - Designer */
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1048</width>
|
||||
<height>779</height>
|
||||
<width>1573</width>
|
||||
<height>1177</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -283,11 +283,11 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>717</width>
|
||||
<height>692</height>
|
||||
<width>1372</width>
|
||||
<height>1000</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="scrollAreaWidgetContentsVLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="headerFramePerson">
|
||||
<property name="frameShape">
|
||||
|
@ -296,12 +296,12 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<layout class="QGridLayout" name="headerFramePersonGLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item row="0" column="3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="headerFramePersonVLayout">
|
||||
<item>
|
||||
<widget class="StyledElidedLabel" name="headerTextLabel_Person">
|
||||
<property name="text">
|
||||
|
@ -397,7 +397,7 @@
|
|||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="distantFrameHLayout">
|
||||
<layout class="QHBoxLayout" name="inviteFrameHLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
|
@ -514,7 +514,7 @@ border-image: url(:/images/closepressed.png)
|
|||
<property name="title">
|
||||
<string>Identity info</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<layout class="QGridLayout" name="detailsGroupBoxGLayout">
|
||||
<item row="10" column="1">
|
||||
<widget class="QLineEdit" name="neighborNodesOpinion_TF">
|
||||
<property name="toolTip">
|
||||
|
@ -526,7 +526,7 @@ border-image: url(:/images/closepressed.png)
|
|||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="label_YourOpinion">
|
||||
<property name="text">
|
||||
<string>Your opinion:</string>
|
||||
</property>
|
||||
|
@ -540,7 +540,7 @@ border-image: url(:/images/closepressed.png)
|
|||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<widget class="Line" name="line_IdInfo">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -569,8 +569,9 @@ border-image: url(:/images/closepressed.png)
|
|||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Your own opinion about an identity rules the visibility of that identity for yourself and your friend nodes. Your own opinion is shared among friends and used to compute a reputation score: If your opinion about an identity is neutral, the reputation score is the average of your friend's opinions. If not, your own opinion gives the score.</p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The overall score is used in chat lobbies, forums and channels to decide on the actions to take for each specific identity. When the overall score is lower than -0.6, the identity is banned, which prevents all messages and forums/channels authored by this identity to be forwarded, both ways. Some forums also have special anti-spam flags that require a higher reputation level, making them more sensitive to bad opinions. Banned identities gradually lose their activity and eventually disappear (after 30 days). </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Your own opinion about an identity rules the visibility of that identity for yourself and your friend nodes. Your own opinion is shared among friends and used to compute a reputation score: If your opinion about an identity is neutral, the reputation score is the difference between friend's positive and negative opinions. If not, your own opinion gives the score.</p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The overall score is used in chat lobbies, forums and channels to decide on the actions to take for each specific identity. When the overall score is lower than -1, the identity is banned, which prevents all messages and forums/channels authored by this identity to be forwarded, both ways. Some forums also have special anti-spam flags that require a non negative reputation level, making them more sensitive to bad opinions. Banned identities gradually lose their activity and eventually disappear (after 5 days).</p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You can change the thresholds and the time of inactivity to delete identities in preferences -&gt; people. </p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
|
@ -728,7 +729,7 @@ p, li { white-space: pre-wrap; }
|
|||
<widget class="QLineEdit" name="lineEdit_LastUsed"/>
|
||||
</item>
|
||||
<item row="1" column="2" rowspan="11">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="avatarGLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="avatarLabel">
|
||||
<property name="sizePolicy">
|
||||
|
@ -774,12 +775,12 @@ p, li { white-space: pre-wrap; }
|
|||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<layout class="QHBoxLayout" name="avatarOpinionHLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<widget class="QLabel" name="label_PosIcon">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>34</width>
|
||||
|
@ -813,14 +814,14 @@ p, li { white-space: pre-wrap; }
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<widget class="Line" name="line_Opinion">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<widget class="QLabel" name="label_NegIcon">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>34</width>
|
||||
|
@ -856,7 +857,7 @@ p, li { white-space: pre-wrap; }
|
|||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="avatarVSpacer_2">
|
||||
<spacer name="avatarVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -874,11 +875,11 @@ p, li { white-space: pre-wrap; }
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<widget class="QGroupBox" name="usageStatisticsGBox">
|
||||
<property name="title">
|
||||
<string>Usage statistics</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="usageStatisticsGBoxHLayout">
|
||||
<item>
|
||||
<widget class="RSTextBrowser" name="usageStatistics_TB"/>
|
||||
</item>
|
||||
|
@ -886,7 +887,7 @@ p, li { white-space: pre-wrap; }
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<spacer name="scrollAreaWidgetContentsVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -900,10 +901,8 @@ p, li { white-space: pre-wrap; }
|
|||
</item>
|
||||
</layout>
|
||||
<zorder>detailsGroupBox</zorder>
|
||||
<zorder>detailsGroupBox</zorder>
|
||||
<zorder>groupBox</zorder>
|
||||
<zorder>usageStatisticsGBox</zorder>
|
||||
<zorder>headerFramePerson</zorder>
|
||||
<zorder>verticalSpacer_2</zorder>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -29,10 +29,6 @@
|
|||
#include <QUrl>
|
||||
#include <QtDebug>
|
||||
|
||||
#ifdef BLOGS
|
||||
#include "gui/unfinished/blogs/BlogsDialog.h"
|
||||
#endif
|
||||
|
||||
#include <retroshare/rsplugin.h>
|
||||
#include <retroshare/rsconfig.h>
|
||||
|
||||
|
@ -43,9 +39,9 @@
|
|||
#include "HomePage.h"
|
||||
#include "NetworkDialog.h"
|
||||
#include "gui/FileTransfer/SearchDialog.h"
|
||||
#include "gui/FileTransfer/SharedFilesDialog.h"
|
||||
#include "gui/FileTransfer/TransfersDialog.h"
|
||||
#include "MessagesDialog.h"
|
||||
#include "SharedFilesDialog.h"
|
||||
#include "PluginsPage.h"
|
||||
#include "NewsFeed.h"
|
||||
#include "ShareManager.h"
|
||||
|
@ -265,7 +261,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
|
|||
statusBar()->addPermanentWidget(ratesstatus);
|
||||
|
||||
opModeStatus = new OpModeStatus();
|
||||
opModeStatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowOpMode", QVariant(true)).toBool());
|
||||
opModeStatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowOpMode", QVariant(false)).toBool());
|
||||
statusBar()->addPermanentWidget(opModeStatus);
|
||||
|
||||
soundStatus = new SoundStatus();
|
||||
|
@ -379,10 +375,6 @@ void MainWindow::initStackedPage()
|
|||
addPage(wikiDialog = new WikiDialog(ui->stackPages), grp, ¬ify);
|
||||
#endif
|
||||
|
||||
#ifdef BLOGS
|
||||
addPage(blogsFeed = new BlogsDialog(ui->stackPages), grp, NULL);
|
||||
#endif
|
||||
|
||||
std::cerr << "Looking for interfaces in existing plugins:" << std::endl;
|
||||
for(int i = 0;i<rsPlugins->nbPlugins();++i)
|
||||
{
|
||||
|
@ -676,7 +668,8 @@ void MainWindow::updateTrayCombine()
|
|||
|
||||
}
|
||||
}
|
||||
notifyMenu->menuAction()->setVisible(visible);
|
||||
if (notifyMenu)
|
||||
notifyMenu->menuAction()->setVisible(visible);
|
||||
|
||||
// update tray icon
|
||||
updateFriends();
|
||||
|
@ -914,11 +907,6 @@ void SetForegroundWindowInternal(HWND hWnd)
|
|||
case Forums:
|
||||
_instance->ui->stackPages->setCurrentPage( _instance->gxsforumDialog );
|
||||
return true ;
|
||||
#ifdef BLOGS
|
||||
case Blogs:
|
||||
Page = _instance->blogsFeed;
|
||||
return true ;
|
||||
#endif
|
||||
case Posted:
|
||||
_instance->ui->stackPages->setCurrentPage( _instance->postedDialog );
|
||||
return true ;
|
||||
|
@ -959,11 +947,6 @@ void SetForegroundWindowInternal(HWND hWnd)
|
|||
if (page == _instance->messagesDialog) {
|
||||
return Messages;
|
||||
}
|
||||
#ifdef RS_USE_LINKS
|
||||
if (page == _instance->linksDialog) {
|
||||
return Links;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
if (page == _instance->channelFeed) {
|
||||
return Channels;
|
||||
|
@ -972,11 +955,6 @@ void SetForegroundWindowInternal(HWND hWnd)
|
|||
return Forums;
|
||||
}
|
||||
#endif
|
||||
#ifdef BLOGS
|
||||
if (page == _instance->blogsFeed) {
|
||||
return Blogs;
|
||||
}
|
||||
#endif
|
||||
|
||||
return Network;
|
||||
}
|
||||
|
@ -1008,20 +986,12 @@ void SetForegroundWindowInternal(HWND hWnd)
|
|||
return _instance->transfersDialog->searchDialog;
|
||||
case Messages:
|
||||
return _instance->messagesDialog;
|
||||
#ifdef RS_USE_LINKS
|
||||
case Links:
|
||||
return _instance->linksDialog;
|
||||
#endif
|
||||
case Channels:
|
||||
return _instance->gxschannelDialog;
|
||||
case Forums:
|
||||
return _instance->gxsforumDialog;
|
||||
case Posted:
|
||||
return _instance->postedDialog;
|
||||
#ifdef BLOGS
|
||||
case Blogs:
|
||||
return _instance->blogsFeed;
|
||||
#endif
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -1207,7 +1177,7 @@ void MainWindow::showHelpDialog(const QString &topic)
|
|||
void
|
||||
MainWindow::retranslateUi()
|
||||
{
|
||||
retranslateUi();
|
||||
//retranslateUi();
|
||||
foreach (MainPage *page, ui->stackPages->pages()) {
|
||||
page->retranslateUi();
|
||||
}
|
||||
|
@ -1491,6 +1461,23 @@ void MainWindow::processLastArgs()
|
|||
/* Now use files from the command line, because no RetroShare was running */
|
||||
openRsCollection(Rshare::files()->takeFirst());
|
||||
}
|
||||
/* Handle the -opmode options. */
|
||||
if (opModeStatus) {
|
||||
QString opmode = Rshare::opmode().toLower();
|
||||
if (opmode == "noturtle") {
|
||||
opModeStatus->setCurrentIndex(RS_OPMODE_NOTURTLE - 1);
|
||||
} else if (opmode == "gaming") {
|
||||
opModeStatus->setCurrentIndex(RS_OPMODE_GAMING - 1);
|
||||
} else if (opmode == "minimal") {
|
||||
opModeStatus->setCurrentIndex(RS_OPMODE_MINIMAL - 1);
|
||||
} else {
|
||||
opModeStatus->setCurrentIndex(RS_OPMODE_FULL - 1);
|
||||
}
|
||||
opModeStatus->setOpMode();
|
||||
} else {
|
||||
std::cerr << "ERR: MainWindow::processLastArgs opModeStatus is not initialized.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::switchVisibilityStatus(StatusElement e,bool b)
|
||||
|
|
|
@ -59,7 +59,6 @@ class NetworkDialog;
|
|||
class SearchDialog;
|
||||
class TransfersDialog;
|
||||
class MessagesDialog;
|
||||
class SharedFilesDialog;
|
||||
class MessengerWindow;
|
||||
class PluginsPage;
|
||||
class HomePage;
|
||||
|
@ -69,14 +68,6 @@ class MainPage;
|
|||
class NewsFeed;
|
||||
class UserNotify;
|
||||
|
||||
#ifdef RS_USE_LINKS
|
||||
class LinksDialog;
|
||||
#endif
|
||||
|
||||
#ifdef BLOGS
|
||||
class BlogsDialog;
|
||||
#endif
|
||||
|
||||
#ifdef UNFINISHED
|
||||
class ApplicationWindow;
|
||||
#endif
|
||||
|
@ -98,12 +89,6 @@ public:
|
|||
Channels = 6, /** Channels page. */
|
||||
Forums = 7, /** Forums page. */
|
||||
Search = 8, /** Search page. */
|
||||
#ifdef BLOGS
|
||||
Blogs = 9, /** Blogs page. */
|
||||
#endif
|
||||
#ifdef RS_USE_LINKS
|
||||
Links = 10, /** Links page. */
|
||||
#endif
|
||||
Posted = 11, /** Posted links */
|
||||
People = 12, /** People page. */
|
||||
Options = 13 /** People page. */
|
||||
|
@ -163,7 +148,6 @@ public:
|
|||
ChatLobbyWidget *chatLobbyDialog;
|
||||
MessagesDialog *messagesDialog;
|
||||
SettingsPage *settingsDialog;
|
||||
SharedFilesDialog *sharedfilesDialog;
|
||||
GxsChannelDialog *gxschannelDialog ;
|
||||
GxsForumsDialog *gxsforumDialog ;
|
||||
PostedDialog *postedDialog;
|
||||
|
@ -172,14 +156,6 @@ public:
|
|||
// ChannelFeed *channelFeed;
|
||||
Idle *idle;
|
||||
|
||||
#ifdef RS_USE_LINKS
|
||||
LinksDialog *linksDialog;
|
||||
#endif
|
||||
|
||||
#ifdef BLOGS
|
||||
BlogsDialog *blogsFeed;
|
||||
#endif
|
||||
|
||||
#ifdef UNFINISHED
|
||||
ApplicationWindow *applicationWindow;
|
||||
#endif
|
||||
|
|
|
@ -227,7 +227,7 @@ void NetworkDialog::removeUnusedKeys()
|
|||
std::cerr << "Skipping public/secret key pair " << *it << std::endl;
|
||||
continue ;
|
||||
}
|
||||
if(now > (time_t) (THREE_MONTHS + details.lastUsed))
|
||||
if(now > (time_t) (THREE_MONTHS + details.lastUsed) && !details.accept_connection)
|
||||
{
|
||||
std::cerr << "Adding " << *it << " to pre-selection." << std::endl;
|
||||
pre_selected.insert(*it) ;
|
||||
|
@ -323,8 +323,8 @@ void NetworkDialog::copyLink()
|
|||
RsPgpId peer_id ( wi->text(COLUMN_PEERID).toStdString() ) ;
|
||||
|
||||
QList<RetroShareLink> urls;
|
||||
RetroShareLink link;
|
||||
if (link.createPerson(peer_id)) {
|
||||
RetroShareLink link = RetroShareLink::createPerson(peer_id);
|
||||
if (link.valid()) {
|
||||
urls.push_back(link);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,51 +25,45 @@
|
|||
#include "NewsFeed.h"
|
||||
#include "ui_NewsFeed.h"
|
||||
|
||||
#include <retroshare/rsnotify.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsbanlist.h>
|
||||
#include <retroshare/rsgxschannels.h>
|
||||
#include <retroshare/rsgxsforums.h>
|
||||
#include <retroshare/rsposted.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include <retroshare/rsnotify.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsplugin.h>
|
||||
#include <retroshare/rsbanlist.h>
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
#include "feeds/ChatMsgItem.h"
|
||||
#include "feeds/GxsCircleItem.h"
|
||||
#include "feeds/GxsChannelGroupItem.h"
|
||||
#include "feeds/GxsChannelPostItem.h"
|
||||
#include "feeds/GxsForumGroupItem.h"
|
||||
#include "feeds/GxsForumMsgItem.h"
|
||||
#include "feeds/PostedGroupItem.h"
|
||||
#include "Posted/PostedItem.h"
|
||||
#include "feeds/GxsForumMsgItem.h"
|
||||
|
||||
#include "settings/rsettingswin.h"
|
||||
|
||||
#ifdef BLOGS
|
||||
#include "feeds/BlogNewItem.h"
|
||||
#include "feeds/BlogMsgItem.h"
|
||||
#endif
|
||||
|
||||
#include "feeds/MsgItem.h"
|
||||
#include "feeds/NewsFeedUserNotify.h"
|
||||
#include "feeds/PeerItem.h"
|
||||
#include "feeds/ChatMsgItem.h"
|
||||
#include "feeds/PostedGroupItem.h"
|
||||
#include "feeds/SecurityItem.h"
|
||||
#include "feeds/SecurityIpItem.h"
|
||||
#include "feeds/NewsFeedUserNotify.h"
|
||||
|
||||
#include "settings/rsettingswin.h"
|
||||
#include "settings/rsharesettings.h"
|
||||
|
||||
#include "chat/ChatDialog.h"
|
||||
#include "Posted/PostedItem.h"
|
||||
#include "msgs/MessageComposer.h"
|
||||
#include "msgs/MessageInterface.h"
|
||||
|
||||
#include "common/FeedNotify.h"
|
||||
#include "notifyqt.h"
|
||||
|
||||
#include "gui/msgs/MessageInterface.h"
|
||||
|
||||
const uint32_t NEWSFEED_PEERLIST = 0x0001;
|
||||
|
||||
const uint32_t NEWSFEED_FORUMNEWLIST = 0x0002;
|
||||
const uint32_t NEWSFEED_FORUMMSGLIST = 0x0003;
|
||||
const uint32_t NEWSFEED_CHANNELNEWLIST = 0x0004;
|
||||
const uint32_t NEWSFEED_CHANNELMSGLIST = 0x0005;
|
||||
//const uint32_t NEWSFEED_CHANNELMSGLIST = 0x0005;
|
||||
#if 0
|
||||
const uint32_t NEWSFEED_BLOGNEWLIST = 0x0006;
|
||||
const uint32_t NEWSFEED_BLOGMSGLIST = 0x0007;
|
||||
|
@ -80,6 +74,7 @@ const uint32_t NEWSFEED_CHATMSGLIST = 0x0009;
|
|||
const uint32_t NEWSFEED_SECLIST = 0x000a;
|
||||
const uint32_t NEWSFEED_POSTEDNEWLIST = 0x000b;
|
||||
const uint32_t NEWSFEED_POSTEDMSGLIST = 0x000c;
|
||||
const uint32_t NEWSFEED_CIRCLELIST = 0x000d;
|
||||
|
||||
#define ROLE_RECEIVED FEED_TREEWIDGET_SORTROLE
|
||||
|
||||
|
@ -102,6 +97,7 @@ NewsFeed::NewsFeed(QWidget *parent) :
|
|||
ui->setupUi(this);
|
||||
|
||||
mTokenQueueChannel = NULL;
|
||||
mTokenQueueCircle = NULL;
|
||||
mTokenQueueForum = NULL;
|
||||
mTokenQueuePosted = NULL;
|
||||
|
||||
|
@ -156,6 +152,9 @@ NewsFeed::~NewsFeed()
|
|||
if (mTokenQueueChannel) {
|
||||
delete(mTokenQueueChannel);
|
||||
}
|
||||
if (mTokenQueueCircle) {
|
||||
delete(mTokenQueueCircle);
|
||||
}
|
||||
if (mTokenQueueForum) {
|
||||
delete(mTokenQueueForum);
|
||||
}
|
||||
|
@ -217,13 +216,17 @@ void NewsFeed::updateDisplay()
|
|||
if (flags & RS_FEED_TYPE_PEER)
|
||||
addFeedItemPeerDisconnect(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_PEER_HELLO:
|
||||
if (flags & RS_FEED_TYPE_PEER)
|
||||
addFeedItemPeerHello(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_PEER_NEW:
|
||||
if (flags & RS_FEED_TYPE_PEER)
|
||||
addFeedItemPeerNew(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_PEER_HELLO:
|
||||
if (flags & RS_FEED_TYPE_PEER)
|
||||
addFeedItemPeerHello(fi);
|
||||
case RS_FEED_ITEM_PEER_OFFSET:
|
||||
//if (flags & RS_FEED_TYPE_PEER) //Always allow this feed even if Friend notify is disabled.
|
||||
addFeedItemPeerOffset(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_ITEM_SEC_CONNECT_ATTEMPT:
|
||||
|
@ -366,6 +369,52 @@ void NewsFeed::updateDisplay()
|
|||
if (flags & RS_FEED_TYPE_FILES)
|
||||
addFeedItemFilesNew(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_ITEM_CIRCLE_MEMB_REQ:
|
||||
if (flags & RS_FEED_TYPE_CIRCLE)
|
||||
{
|
||||
if (!mTokenQueueCircle) {
|
||||
mTokenQueueCircle = new TokenQueue(rsGxsCircles->getTokenService(), instance);
|
||||
}
|
||||
|
||||
RsGxsGroupId grpId(fi.mId1);
|
||||
RsGxsMessageId msgId(fi.mId2);
|
||||
if (!grpId.isNull() && !msgId.isNull()) {
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect_msgIds = msgIds[grpId];
|
||||
vect_msgIds.push_back(msgId);
|
||||
|
||||
uint32_t token;
|
||||
mTokenQueueCircle->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, TOKEN_TYPE_MESSAGE);
|
||||
}
|
||||
}
|
||||
// addFeedItemCircleMembReq(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_CIRCLE_INVIT_REC:
|
||||
if (flags & RS_FEED_TYPE_CIRCLE)
|
||||
{
|
||||
if (!mTokenQueueCircle) {
|
||||
mTokenQueueCircle = new TokenQueue(rsGxsCircles->getTokenService(), instance);
|
||||
}
|
||||
|
||||
RsGxsGroupId grpId(fi.mId1);
|
||||
if (!grpId.isNull()) {
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
grpIds.push_back(grpId);
|
||||
|
||||
uint32_t token;
|
||||
mTokenQueueCircle->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grpIds, TOKEN_TYPE_GROUP);
|
||||
}
|
||||
}
|
||||
// addFeedItemCircleInvitRec(fi);
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cerr << "(EE) Unknown type " << std::hex << fi.mType << std::dec << " in news feed." << std::endl;
|
||||
break;
|
||||
|
@ -412,8 +461,9 @@ void NewsFeed::testFeeds(uint notifyFlags)
|
|||
|
||||
instance->addFeedItemPeerConnect(fi);
|
||||
instance->addFeedItemPeerDisconnect(fi);
|
||||
instance->addFeedItemPeerNew(fi);
|
||||
instance->addFeedItemPeerHello(fi);
|
||||
instance->addFeedItemPeerNew(fi);
|
||||
instance->addFeedItemPeerOffset(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_TYPE_SECURITY:
|
||||
|
@ -529,6 +579,24 @@ void NewsFeed::testFeeds(uint notifyFlags)
|
|||
// not used
|
||||
// instance->addFeedItemFilesNew(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_TYPE_CIRCLE:
|
||||
{
|
||||
if (!instance->mTokenQueueCircle) {
|
||||
instance->mTokenQueueCircle = new TokenQueue(rsGxsCircles->getTokenService(), instance);
|
||||
}
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
uint32_t token;
|
||||
instance->mTokenQueueCircle->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_TYPE_GROUP);
|
||||
|
||||
break;
|
||||
}
|
||||
// instance->addFeedItemCircleMembReq(fi);
|
||||
// instance->addFeedItemCircleInvitRec(fi);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,6 +605,78 @@ void NewsFeed::testFeeds(uint notifyFlags)
|
|||
instance->sendNewsFeedChanged();
|
||||
}
|
||||
|
||||
void NewsFeed::loadCircleGroup(const uint32_t &token)
|
||||
{
|
||||
std::vector<RsGxsCircleGroup> groups;
|
||||
if (!rsGxsCircles->getGroupData(token, groups)) {
|
||||
std::cerr << "NewsFeed::loadCircleGroup() ERROR getting data";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<RsGxsId> own_identities;
|
||||
rsIdentity->getOwnIds(own_identities);
|
||||
|
||||
std::vector<RsGxsCircleGroup>::const_iterator circleIt;
|
||||
for (circleIt = groups.begin(); circleIt != groups.end(); ++circleIt) {
|
||||
RsGxsCircleGroup group = *(circleIt);
|
||||
RsGxsCircleDetails details;
|
||||
if(rsGxsCircles->getCircleDetails(group.mMeta.mCircleId,details))
|
||||
{
|
||||
for(std::list<RsGxsId>::const_iterator it(own_identities.begin());it!=own_identities.end();++it) {
|
||||
std::map<RsGxsId,uint32_t>::const_iterator vit = details.mSubscriptionFlags.find(*it);
|
||||
uint32_t subscribe_flags = (vit == details.mSubscriptionFlags.end())?0:(vit->second);
|
||||
|
||||
if( !(subscribe_flags & GXS_EXTERNAL_CIRCLE_FLAGS_SUBSCRIBED)
|
||||
&& (subscribe_flags & GXS_EXTERNAL_CIRCLE_FLAGS_IN_ADMIN_LIST) ) {
|
||||
|
||||
RsFeedItem fi;
|
||||
fi.mId1 = group.mMeta.mGroupId.toStdString();
|
||||
fi.mId2 = it->toStdString();
|
||||
|
||||
instance->addFeedItemCircleInvitRec(fi);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NewsFeed::loadCircleMessage(const uint32_t &token)
|
||||
{
|
||||
std::vector<RsGxsCircleMsg> msgs;
|
||||
if (!rsGxsCircles->getMsgData(token, msgs)) {
|
||||
std::cerr << "NewsFeed::loadCircleMessage() ERROR getting data";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<RsGxsId> own_identities;
|
||||
rsIdentity->getOwnIds(own_identities);
|
||||
|
||||
std::vector<RsGxsCircleMsg>::iterator msgIt;
|
||||
for (msgIt = msgs.begin(); msgIt != msgs.end(); ++msgIt) {
|
||||
RsGxsCircleMsg msg = *(msgIt);
|
||||
RsGxsCircleDetails details;
|
||||
if(rsGxsCircles->getCircleDetails(RsGxsCircleId(msg.mMeta.mGroupId),details)) {
|
||||
//for(std::list<RsGxsId>::const_iterator it(own_identities.begin());it!=own_identities.end();++it) {
|
||||
// std::map<RsGxsId,uint32_t>::const_iterator vit = details.mSubscriptionFlags.find(*it);
|
||||
// if (vit != details.mSubscriptionFlags.end()) {
|
||||
RsFeedItem fi;
|
||||
fi.mId1 = msgIt->mMeta.mGroupId.toStdString();
|
||||
fi.mId2 = msgIt->mMeta.mAuthorId.toStdString();
|
||||
|
||||
if (msgIt->stuff == "SUBSCRIPTION_REQUEST_UNSUBSCRIBE")
|
||||
instance->remFeedItemCircleMembReq(fi);
|
||||
else
|
||||
instance->addFeedItemCircleMembReq(fi);
|
||||
|
||||
//}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NewsFeed::loadChannelGroup(const uint32_t &token)
|
||||
{
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
|
@ -816,7 +956,24 @@ void NewsFeed::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
|||
break;
|
||||
|
||||
default:
|
||||
std::cerr << "NewsFeed::loadRequest() ERROR: INVALID TYPE";
|
||||
std::cerr << "NewsFeed::loadRequest() ERROR: INVALID CHANNEL TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (queue == mTokenQueueCircle) {
|
||||
switch (req.mUserType) {
|
||||
case TOKEN_TYPE_GROUP:
|
||||
loadCircleGroup(req.mToken);
|
||||
break;
|
||||
|
||||
case TOKEN_TYPE_MESSAGE:
|
||||
loadCircleMessage(req.mToken);
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cerr << "NewsFeed::loadRequest() ERROR: INVALID CIRCLE TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
|
@ -837,7 +994,7 @@ void NewsFeed::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
|||
break;
|
||||
|
||||
default:
|
||||
std::cerr << "NewsFeed::loadRequest() ERROR: INVALID TYPE";
|
||||
std::cerr << "NewsFeed::loadRequest() ERROR: INVALID FORUM TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
|
@ -854,7 +1011,7 @@ void NewsFeed::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
|||
break;
|
||||
|
||||
default:
|
||||
std::cerr << "NewsFeed::loadRequest() ERROR: INVALID TYPE";
|
||||
std::cerr << "NewsFeed::loadRequest() ERROR: INVALID POSTED TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
|
@ -903,17 +1060,25 @@ void NewsFeed::addFeedItem(FeedItem *item)
|
|||
|
||||
struct AddFeedItemIfUniqueData
|
||||
{
|
||||
AddFeedItemIfUniqueData(FeedItem *feedItem, int type, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported)
|
||||
: mType(type), mSslId(sslId), mIpAddr(ipAddr), mIpAddrReported(ipAddrReported)
|
||||
AddFeedItemIfUniqueData(FeedItem *feedItem, int type
|
||||
, const std::string& id1, const std::string& id2
|
||||
, const std::string& id3, const std::string& id4)
|
||||
: mType(type), mId1(id1), mId2(id2), mId3(id3), mId4(id4)
|
||||
{
|
||||
mGxsCircleItem = dynamic_cast<GxsCircleItem*>(feedItem);
|
||||
mPeerItem = dynamic_cast<PeerItem*>(feedItem);
|
||||
mSecItem = dynamic_cast<SecurityItem*>(feedItem);
|
||||
mSecurityIpItem = dynamic_cast<SecurityIpItem*>(feedItem);
|
||||
}
|
||||
|
||||
int mType;
|
||||
const RsPeerId &mSslId;
|
||||
const std::string& mIpAddr;
|
||||
const std::string& mIpAddrReported;
|
||||
const std::string& mId1;
|
||||
const std::string& mId2;
|
||||
const std::string& mId3;
|
||||
const std::string& mId4;
|
||||
|
||||
GxsCircleItem *mGxsCircleItem;
|
||||
PeerItem *mPeerItem;
|
||||
SecurityItem *mSecItem;
|
||||
SecurityIpItem *mSecurityIpItem;
|
||||
};
|
||||
|
@ -921,13 +1086,29 @@ struct AddFeedItemIfUniqueData
|
|||
static bool addFeedItemIfUniqueCallback(FeedItem *feedItem, void *data)
|
||||
{
|
||||
AddFeedItemIfUniqueData *findData = (AddFeedItemIfUniqueData*) data;
|
||||
if (!findData || findData->mSslId.isNull()) {
|
||||
if (!findData || findData->mId1.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (findData->mGxsCircleItem) {
|
||||
GxsCircleItem *gxsCircleItem = dynamic_cast<GxsCircleItem*>(feedItem);
|
||||
if (gxsCircleItem && gxsCircleItem->isSame(RsGxsCircleId(findData->mId1), RsGxsId(findData->mId2), findData->mType)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (findData->mPeerItem) {
|
||||
PeerItem *peerItem = dynamic_cast<PeerItem*>(feedItem);
|
||||
if (peerItem && peerItem->isSame(RsPeerId(findData->mId1), findData->mType)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (findData->mSecItem) {
|
||||
SecurityItem *secitem = dynamic_cast<SecurityItem*>(feedItem);
|
||||
if (secitem && secitem->isSame(findData->mSslId, findData->mType)) {
|
||||
if (secitem && secitem->isSame(RsPeerId(findData->mId1), findData->mType)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -935,7 +1116,7 @@ static bool addFeedItemIfUniqueCallback(FeedItem *feedItem, void *data)
|
|||
|
||||
if (findData->mSecurityIpItem) {
|
||||
SecurityIpItem *securityIpItem = dynamic_cast<SecurityIpItem*>(feedItem);
|
||||
if (securityIpItem && securityIpItem->isSame(findData->mIpAddr, findData->mIpAddrReported, findData->mType)) {
|
||||
if (securityIpItem && securityIpItem->isSame(findData->mId1, findData->mId2, findData->mType)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -944,9 +1125,9 @@ static bool addFeedItemIfUniqueCallback(FeedItem *feedItem, void *data)
|
|||
return false;
|
||||
}
|
||||
|
||||
void NewsFeed::addFeedItemIfUnique(FeedItem *item, int itemType, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported, bool replace)
|
||||
void NewsFeed::addFeedItemIfUnique(FeedItem *item, int itemType, const std::string& id1, const std::string& id2, const std::string& id3, const std::string& id4, bool replace)
|
||||
{
|
||||
AddFeedItemIfUniqueData data(item, itemType, sslId, ipAddr, ipAddrReported);
|
||||
AddFeedItemIfUniqueData data(item, itemType, id1, id2, id3, id4);
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(addFeedItemIfUniqueCallback, &data);
|
||||
|
||||
if (feedItem) {
|
||||
|
@ -955,12 +1136,24 @@ void NewsFeed::addFeedItemIfUnique(FeedItem *item, int itemType, const RsPeerId
|
|||
return;
|
||||
}
|
||||
|
||||
ui->feedWidget->removeFeedItem(item);
|
||||
ui->feedWidget->removeFeedItem(feedItem);
|
||||
}
|
||||
|
||||
addFeedItem(item);
|
||||
}
|
||||
|
||||
void NewsFeed::remUniqueFeedItem(FeedItem *item, int itemType, const std::string &id1, const std::string &id2, const std::string &id3, const std::string &id4)
|
||||
{
|
||||
AddFeedItemIfUniqueData data(item, itemType, id1, id2, id3, id4);
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(addFeedItemIfUniqueCallback, &data);
|
||||
|
||||
if (feedItem) {
|
||||
delete item;
|
||||
|
||||
ui->feedWidget->removeFeedItem(feedItem);
|
||||
}
|
||||
}
|
||||
|
||||
void NewsFeed::addFeedItemPeerConnect(const RsFeedItem &fi)
|
||||
{
|
||||
/* make new widget */
|
||||
|
@ -1017,13 +1210,27 @@ void NewsFeed::addFeedItemPeerNew(const RsFeedItem &fi)
|
|||
#endif
|
||||
}
|
||||
|
||||
void NewsFeed::addFeedItemPeerOffset(const RsFeedItem &fi)
|
||||
{
|
||||
/* make new widget */
|
||||
PeerItem *pi = new PeerItem(this, NEWSFEED_PEERLIST, RsPeerId(fi.mId1), PEER_TYPE_OFFSET, false);
|
||||
|
||||
/* add to layout */
|
||||
addFeedItemIfUnique(pi, PEER_TYPE_OFFSET, fi.mId1, fi.mId2, fi.mId3, fi.mId4, false);
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemPeerOffset()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void NewsFeed::addFeedItemSecurityConnectAttempt(const RsFeedItem &fi)
|
||||
{
|
||||
/* make new widget */
|
||||
SecurityItem *pi = new SecurityItem(this, NEWSFEED_SECLIST, RsPgpId(fi.mId1), RsPeerId(fi.mId2), fi.mId3, fi.mId4, fi.mType, false);
|
||||
|
||||
/* add to layout */
|
||||
addFeedItemIfUnique(pi, fi.mType, RsPeerId(fi.mId2), "", "", false);
|
||||
addFeedItemIfUnique(pi, fi.mType, fi.mId2, "", "", "", false);
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemSecurityConnectAttempt()";
|
||||
|
@ -1037,7 +1244,7 @@ void NewsFeed::addFeedItemSecurityAuthDenied(const RsFeedItem &fi)
|
|||
SecurityItem *pi = new SecurityItem(this, NEWSFEED_SECLIST, RsPgpId(fi.mId1), RsPeerId(fi.mId2), fi.mId3, fi.mId4, fi.mType, false);
|
||||
|
||||
/* add to layout */
|
||||
addFeedItemIfUnique(pi, RS_FEED_ITEM_SEC_AUTH_DENIED, RsPeerId(fi.mId2), "", "", false);
|
||||
addFeedItemIfUnique(pi, RS_FEED_ITEM_SEC_AUTH_DENIED, fi.mId2, "", "", "", false);
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemSecurityAuthDenied()";
|
||||
|
@ -1051,7 +1258,7 @@ void NewsFeed::addFeedItemSecurityUnknownIn(const RsFeedItem &fi)
|
|||
SecurityItem *pi = new SecurityItem(this, NEWSFEED_SECLIST, RsPgpId(fi.mId1), RsPeerId(fi.mId2), fi.mId3, fi.mId4, RS_FEED_ITEM_SEC_UNKNOWN_IN, false);
|
||||
|
||||
/* add to layout */
|
||||
addFeedItemIfUnique(pi, RS_FEED_ITEM_SEC_UNKNOWN_IN, RsPeerId(fi.mId2), "", "", false);
|
||||
addFeedItemIfUnique(pi, RS_FEED_ITEM_SEC_UNKNOWN_IN, fi.mId2, "", "", "", false);
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemSecurityUnknownIn()";
|
||||
|
@ -1065,7 +1272,7 @@ void NewsFeed::addFeedItemSecurityUnknownOut(const RsFeedItem &fi)
|
|||
SecurityItem *pi = new SecurityItem(this, NEWSFEED_SECLIST, RsPgpId(fi.mId1), RsPeerId(fi.mId2), fi.mId3, fi.mId4, RS_FEED_ITEM_SEC_UNKNOWN_OUT, false);
|
||||
|
||||
/* add to layout */
|
||||
addFeedItemIfUnique(pi, RS_FEED_ITEM_SEC_UNKNOWN_OUT, RsPeerId(fi.mId2), "", "", false);
|
||||
addFeedItemIfUnique(pi, RS_FEED_ITEM_SEC_UNKNOWN_OUT, fi.mId2, "", "", "", false);
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemSecurityUnknownOut()";
|
||||
|
@ -1079,7 +1286,7 @@ void NewsFeed::addFeedItemSecurityIpBlacklisted(const RsFeedItem &fi, bool isTes
|
|||
SecurityIpItem *pi = new SecurityIpItem(this, RsPeerId(fi.mId1), fi.mId2, fi.mResult1, RS_FEED_ITEM_SEC_IP_BLACKLISTED, isTest);
|
||||
|
||||
/* add to layout */
|
||||
addFeedItemIfUnique(pi, RS_FEED_ITEM_SEC_IP_BLACKLISTED, RsPeerId(fi.mId1), fi.mId2, "", false);
|
||||
addFeedItemIfUnique(pi, RS_FEED_ITEM_SEC_IP_BLACKLISTED, fi.mId1, fi.mId2, fi.mId3, fi.mId4, false);
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemSecurityIpBlacklisted()";
|
||||
|
@ -1093,7 +1300,7 @@ void NewsFeed::addFeedItemSecurityWrongExternalIpReported(const RsFeedItem &fi,
|
|||
SecurityIpItem *pi = new SecurityIpItem(this, RsPeerId(fi.mId1), fi.mId2, fi.mId3, RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED, isTest);
|
||||
|
||||
/* add to layout */
|
||||
addFeedItemIfUnique(pi, RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED, RsPeerId(fi.mId1), fi.mId2, fi.mId3, false);
|
||||
addFeedItemIfUnique(pi, RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED, fi.mId1, fi.mId2, fi.mId3, fi.mId4, false);
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemSecurityWrongExternalIpReported()";
|
||||
|
@ -1269,15 +1476,7 @@ void NewsFeed::addFeedItemPostedMsg(const RsFeedItem &fi)
|
|||
#if 0
|
||||
void NewsFeed::addFeedItemBlogNew(const RsFeedItem &fi)
|
||||
{
|
||||
#ifdef BLOGS
|
||||
/* make new widget */
|
||||
BlogNewItem *bni = new BlogNewItem(this, NEWSFEED_BLOGNEWLIST, fi.mId1, false, true);
|
||||
|
||||
/* add to layout */
|
||||
addFeedItem(bni);
|
||||
#else
|
||||
Q_UNUSED(fi);
|
||||
#endif
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemBlogNew()";
|
||||
|
@ -1287,15 +1486,7 @@ void NewsFeed::addFeedItemBlogNew(const RsFeedItem &fi)
|
|||
|
||||
void NewsFeed::addFeedItemBlogMsg(const RsFeedItem &fi)
|
||||
{
|
||||
#ifdef BLOGS
|
||||
/* make new widget */
|
||||
BlogMsgItem *bm = new BlogMsgItem(this, NEWSFEED_BLOGMSGLIST, fi.mId1, fi.mId2, false);
|
||||
|
||||
/* add to layout */
|
||||
addFeedItem(bm);
|
||||
#else
|
||||
Q_UNUSED(fi);
|
||||
#endif
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemBlogMsg()";
|
||||
|
@ -1346,6 +1537,66 @@ void NewsFeed::addFeedItemFilesNew(const RsFeedItem &/*fi*/)
|
|||
#endif
|
||||
}
|
||||
|
||||
void NewsFeed::addFeedItemCircleMembReq(const RsFeedItem &fi)
|
||||
{
|
||||
RsGxsCircleId circleId(fi.mId1);
|
||||
RsGxsId gxsId(fi.mId2);
|
||||
|
||||
if (circleId.isNull() || gxsId.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* make new widget */
|
||||
GxsCircleItem *item = new GxsCircleItem(this, NEWSFEED_CIRCLELIST, circleId, gxsId, RS_FEED_ITEM_CIRCLE_MEMB_REQ);
|
||||
|
||||
/* add to layout */
|
||||
addFeedItemIfUnique(item, RS_FEED_ITEM_CIRCLE_MEMB_REQ, fi.mId1, fi.mId2, fi.mId3, fi.mId4, false);
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemCircleMembReq()" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void NewsFeed::remFeedItemCircleMembReq(const RsFeedItem &fi)
|
||||
{
|
||||
RsGxsCircleId circleId(fi.mId1);
|
||||
RsGxsId gxsId(fi.mId2);
|
||||
|
||||
if (circleId.isNull() || gxsId.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* make new widget */
|
||||
GxsCircleItem *item = new GxsCircleItem(this, NEWSFEED_CIRCLELIST, circleId, gxsId, RS_FEED_ITEM_CIRCLE_MEMB_REQ);
|
||||
|
||||
/* add to layout */
|
||||
remUniqueFeedItem(item, RS_FEED_ITEM_CIRCLE_MEMB_REQ, fi.mId1, fi.mId2, fi.mId3, fi.mId4);
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::remFeedItemCircleMembReq()" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void NewsFeed::addFeedItemCircleInvitRec(const RsFeedItem &fi)
|
||||
{
|
||||
RsGxsCircleId circleId(fi.mId1);
|
||||
RsGxsId gxsId(fi.mId2);
|
||||
|
||||
if (circleId.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* make new widget */
|
||||
GxsCircleItem *item = new GxsCircleItem(this, NEWSFEED_CIRCLELIST, circleId, gxsId, RS_FEED_ITEM_CIRCLE_INVIT_REC);
|
||||
|
||||
/* add to layout */
|
||||
addFeedItem(item);
|
||||
|
||||
#ifdef NEWS_DEBUG
|
||||
std::cerr << "NewsFeed::addFeedItemCircleInvitRec()" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* FeedHolder Functions (for FeedItem functionality) */
|
||||
QScrollArea *NewsFeed::getScrollArea()
|
||||
{
|
||||
|
@ -1374,7 +1625,7 @@ void NewsFeed::openChat(const RsPeerId &peerId)
|
|||
ChatDialog::chatFriend(ChatId(peerId));
|
||||
}
|
||||
|
||||
void NewsFeed::openComments(uint32_t /*type*/, const RsGxsGroupId &/*groupId*/, const RsGxsMessageId &/*msgId*/, const QString &/*title*/)
|
||||
void NewsFeed::openComments(uint32_t /*type*/, const RsGxsGroupId &/*groupId*/, const QVector<RsGxsMessageId> &/*versions*/,const RsGxsMessageId &/*msgId*/, const QString &/*title*/)
|
||||
{
|
||||
std::cerr << "NewsFeed::openComments() Not Handled Yet";
|
||||
std::cerr << std::endl;
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
virtual QScrollArea *getScrollArea();
|
||||
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
||||
virtual void openChat(const RsPeerId& peerId);
|
||||
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title);
|
||||
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title);
|
||||
|
||||
static void testFeeds(uint notifyFlags);
|
||||
static void testFeed(FeedNotify *feedNotify);
|
||||
|
@ -83,12 +83,14 @@ private slots:
|
|||
|
||||
private:
|
||||
void addFeedItem(FeedItem *item);
|
||||
void addFeedItemIfUnique(FeedItem *item, int itemType, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported, bool replace);
|
||||
void addFeedItemIfUnique(FeedItem *item, int itemType, const std::string& id1, const std::string& id2, const std::string& id3, const std::string& id4, bool replace);
|
||||
void remUniqueFeedItem(FeedItem *item, int itemType, const std::string& id1, const std::string& id2, const std::string& id3, const std::string& id4);
|
||||
|
||||
void addFeedItemPeerConnect(const RsFeedItem &fi);
|
||||
void addFeedItemPeerDisconnect(const RsFeedItem &fi);
|
||||
void addFeedItemPeerNew(const RsFeedItem &fi);
|
||||
void addFeedItemPeerHello(const RsFeedItem &fi);
|
||||
void addFeedItemPeerNew(const RsFeedItem &fi);
|
||||
void addFeedItemPeerOffset(const RsFeedItem &fi);
|
||||
|
||||
void addFeedItemSecurityConnectAttempt(const RsFeedItem &fi);
|
||||
void addFeedItemSecurityAuthDenied(const RsFeedItem &fi);
|
||||
|
@ -118,6 +120,10 @@ private:
|
|||
void addFeedItemMessage(const RsFeedItem &fi);
|
||||
void addFeedItemFilesNew(const RsFeedItem &fi);
|
||||
|
||||
void addFeedItemCircleMembReq(const RsFeedItem &fi);
|
||||
void remFeedItemCircleMembReq(const RsFeedItem &fi);
|
||||
void addFeedItemCircleInvitRec(const RsFeedItem &fi);
|
||||
|
||||
virtual void loadChannelGroup(const uint32_t &token);
|
||||
virtual void loadChannelPost(const uint32_t &token);
|
||||
virtual void loadChannelPublishKey(const uint32_t &token);
|
||||
|
@ -129,8 +135,12 @@ private:
|
|||
virtual void loadPostedGroup(const uint32_t &token);
|
||||
virtual void loadPostedMessage(const uint32_t &token);
|
||||
|
||||
virtual void loadCircleGroup(const uint32_t &token);
|
||||
virtual void loadCircleMessage(const uint32_t &token);
|
||||
|
||||
private:
|
||||
TokenQueue *mTokenQueueChannel;
|
||||
TokenQueue *mTokenQueueCircle;
|
||||
TokenQueue *mTokenQueueForum;
|
||||
TokenQueue *mTokenQueuePosted;
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ void CircleWidget::updateData(const RsGroupMetaData& gxs_group_info
|
|||
}
|
||||
}
|
||||
|
||||
QSize CircleWidget::sizeHint()
|
||||
QSize CircleWidget::sizeHint() const
|
||||
{
|
||||
QSize size;
|
||||
size.setHeight(ui->graphicsView->size().height() + ui->label->size().height());
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
, const RsGxsCircleDetails& details);
|
||||
|
||||
//Start QWidget Properties
|
||||
QSize sizeHint();
|
||||
QSize sizeHint() const;
|
||||
//Start FlowLayoutItem Properties
|
||||
virtual const QPixmap getImage();
|
||||
virtual const QPixmap getDragImage();
|
||||
|
|
|
@ -148,7 +148,7 @@ void IdentityWidget::updateData(const RsGxsIdGroup &gxs_group_info, const RsPeer
|
|||
updateData(pgp_details);
|
||||
}
|
||||
|
||||
QSize IdentityWidget::sizeHint()
|
||||
QSize IdentityWidget::sizeHint() const
|
||||
{
|
||||
QSize size;
|
||||
size.setHeight(ui->graphicsView->size().height() + ui->labelName->size().height());
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
, const RsPeerDetails& pgp_details);
|
||||
|
||||
//Start QWidget Properties
|
||||
QSize sizeHint();
|
||||
QSize sizeHint() const;
|
||||
//Start FlowLayoutItem Properties
|
||||
virtual const QPixmap getImage();
|
||||
virtual const QPixmap getDragImage();
|
||||
|
|
|
@ -901,7 +901,7 @@ void PeopleDialog::pf_dropEventOccursExt(QDropEvent *event)
|
|||
|
||||
QWidget *wid =
|
||||
qobject_cast<QWidget *>(event->source());//QT5 return QObject
|
||||
FlowLayout *layout;
|
||||
FlowLayout *layout = NULL;
|
||||
if (wid) layout =
|
||||
qobject_cast<FlowLayout *>(wid->layout());
|
||||
if (layout) {
|
||||
|
@ -991,7 +991,7 @@ void PeopleDialog::pf_dropEventOccursInt(QDropEvent *event)
|
|||
|
||||
QWidget *wid =
|
||||
qobject_cast<QWidget *>(event->source());//QT5 return QObject
|
||||
FlowLayout *layout;
|
||||
FlowLayout *layout = NULL;
|
||||
if (wid) layout =
|
||||
qobject_cast<FlowLayout *>(wid->layout());
|
||||
if (layout) {
|
||||
|
|
|
@ -411,7 +411,13 @@ void PostedItem::loadComments()
|
|||
if (mFeedHolder)
|
||||
{
|
||||
QString title = QString::fromUtf8(mPost.mMeta.mMsgName.c_str());
|
||||
mFeedHolder->openComments(0, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, title);
|
||||
|
||||
#warning (csoler) Posted item versions not handled yet. When it is the case, start here.
|
||||
|
||||
QVector<RsGxsMessageId> post_versions ;
|
||||
post_versions.push_back(mPost.mMeta.mMsgId) ;
|
||||
|
||||
mFeedHolder->openComments(0, mPost.mMeta.mGroupId, post_versions,mPost.mMeta.mMsgId, title);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,9 +139,9 @@ void PostedListWidget::openChat(const RsPeerId & /*peerId*/)
|
|||
return;
|
||||
}
|
||||
|
||||
void PostedListWidget::openComments(uint32_t /*feed_type*/, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title)
|
||||
void PostedListWidget::openComments(uint32_t /*feed_type*/, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title)
|
||||
{
|
||||
emit loadComment(groupId, msgId, title);
|
||||
emit loadComment(groupId, versions,msgId, title);
|
||||
}
|
||||
|
||||
void PostedListWidget::newPost()
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
virtual QScrollArea *getScrollArea();
|
||||
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
||||
virtual void openChat(const RsPeerId& peerId);
|
||||
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title);
|
||||
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title);
|
||||
|
||||
/* GXS functions */
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
|
|
@ -87,7 +87,11 @@ void RetroshareDirModel::treeStyle()
|
|||
QIcon::Normal, QIcon::On);
|
||||
peerIcon = QIcon(":/images/user/identity16.png");
|
||||
}
|
||||
|
||||
void TreeStyle_RDM::update()
|
||||
{
|
||||
preMods() ;
|
||||
postMods() ;
|
||||
}
|
||||
void TreeStyle_RDM::updateRef(const QModelIndex& indx) const
|
||||
{
|
||||
rsFiles->requestDirUpdate(indx.internalPointer()) ;
|
||||
|
|
|
@ -177,6 +177,7 @@ class TreeStyle_RDM: public RetroshareDirModel
|
|||
|
||||
protected:
|
||||
virtual void updateRef(const QModelIndex&) const ;
|
||||
virtual void update() ;
|
||||
|
||||
/* These are all overloaded Virtual Functions */
|
||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
|
|
|
@ -67,7 +67,8 @@
|
|||
#define HOST_SEARCH "search"
|
||||
#define HOST_CERTIFICATE "certificate"
|
||||
#define HOST_PUBLIC_MSG "public_msg"
|
||||
#define HOST_REGEXP "file|extra|person|forum|channel|posted|search|message|certificate|private_chat|public_msg"
|
||||
#define HOST_IDENTITY "identity"
|
||||
#define HOST_REGEXP "file|extra|person|forum|channel|posted|search|message|certificate|private_chat|public_msg|identity"
|
||||
|
||||
#define FILE_NAME "name"
|
||||
#define FILE_SIZE "size"
|
||||
|
@ -89,6 +90,9 @@
|
|||
#define POSTED_ID "id"
|
||||
#define POSTED_MSGID "msgid"
|
||||
|
||||
#define IDENTITY_NAME "name"
|
||||
#define IDENTITY_ID "gxsid"
|
||||
#define IDENTITY_GROUP "groupdata"
|
||||
|
||||
#define MESSAGE_ID "id"
|
||||
#define MESSAGE_SUBJECT "subject"
|
||||
|
@ -303,16 +307,30 @@ void RetroShareLink::fromUrl(const QUrl& url)
|
|||
return;
|
||||
}
|
||||
|
||||
if(url.host() == HOST_IDENTITY) {
|
||||
_type = TYPE_IDENTITY ;
|
||||
QString name = decodedQueryItemValue(urlQuery, IDENTITY_NAME) ;
|
||||
QString radix= decodedQueryItemValue(urlQuery, IDENTITY_GROUP) ;
|
||||
QString gxsid= urlQuery.queryItemValue(IDENTITY_ID) ;
|
||||
|
||||
RsGxsId id(gxsid.toStdString()) ;
|
||||
|
||||
if(!id.isNull())
|
||||
*this = createIdentity(id,name,radix) ;
|
||||
else
|
||||
std::cerr << "(EE) identity link is not valid." << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
if (url.host() == HOST_MESSAGE) {
|
||||
_type = TYPE_MESSAGE;
|
||||
std::string id = urlQuery.queryItemValue(MESSAGE_ID).toStdString();
|
||||
createMessage(RsPeerId(id), urlQuery.queryItemValue(MESSAGE_SUBJECT));
|
||||
*this = createMessage(RsPeerId(id), urlQuery.queryItemValue(MESSAGE_SUBJECT));
|
||||
return;
|
||||
}
|
||||
|
||||
if (url.host() == HOST_CERTIFICATE) {
|
||||
_type = TYPE_CERTIFICATE;
|
||||
_radix = urlQuery.queryItemValue(CERTIFICATE_RADIX);
|
||||
_radix = decodedQueryItemValue(urlQuery, CERTIFICATE_RADIX);
|
||||
|
||||
#ifdef DEBUG_RSLINK
|
||||
std::cerr << "Got a certificate link!!" << std::endl;
|
||||
|
@ -333,196 +351,235 @@ RetroShareLink::RetroShareLink()
|
|||
clear();
|
||||
}
|
||||
|
||||
bool RetroShareLink::createExtraFile(const QString& name, uint64_t size, const QString& hash,const QString& ssl_id)
|
||||
RetroShareLink RetroShareLink::createIdentity(const RsGxsId& id, const QString& name, const QString& radix_data)
|
||||
{
|
||||
clear();
|
||||
RetroShareLink link;
|
||||
link.clear();
|
||||
|
||||
_name = name;
|
||||
_size = size;
|
||||
_hash = hash;
|
||||
_SSLid = ssl_id;
|
||||
link._name = name;
|
||||
link._hash = QString::fromStdString(id.toStdString());
|
||||
link._radix_group_data = radix_data ;
|
||||
|
||||
_type = TYPE_EXTRAFILE;
|
||||
link._type = TYPE_IDENTITY;
|
||||
|
||||
check();
|
||||
link.check();
|
||||
|
||||
return valid();
|
||||
}
|
||||
bool RetroShareLink::createFile(const QString& name, uint64_t size, const QString& hash)
|
||||
{
|
||||
clear();
|
||||
|
||||
_name = name;
|
||||
_size = size;
|
||||
_hash = hash;
|
||||
|
||||
_type = TYPE_FILE;
|
||||
|
||||
check();
|
||||
|
||||
return valid();
|
||||
return link;
|
||||
}
|
||||
|
||||
bool RetroShareLink::createPublicMsgInvite(time_t time_stamp,const QString& issuer_pgp_id,const QString& hash)
|
||||
RetroShareLink RetroShareLink::createExtraFile(const QString& name, uint64_t size, const QString& hash,const QString& ssl_id)
|
||||
{
|
||||
clear() ;
|
||||
RetroShareLink link;
|
||||
link.clear();
|
||||
|
||||
_type = TYPE_PUBLIC_MSG ;
|
||||
_time_stamp = time_stamp ;
|
||||
_hash = hash ;
|
||||
_GPGid = issuer_pgp_id ;
|
||||
link._name = name;
|
||||
link._size = size;
|
||||
link._hash = hash;
|
||||
link._SSLid = ssl_id;
|
||||
|
||||
check() ;
|
||||
link._type = TYPE_EXTRAFILE;
|
||||
|
||||
return valid() ;
|
||||
link.check();
|
||||
|
||||
return link;
|
||||
}
|
||||
|
||||
bool RetroShareLink::createPerson(const RsPgpId& id)
|
||||
RetroShareLink RetroShareLink::createFile(const QString& name, uint64_t size, const QString& hash)
|
||||
{
|
||||
clear();
|
||||
RetroShareLink link;
|
||||
link.clear();
|
||||
|
||||
link._name = name;
|
||||
link._size = size;
|
||||
link._hash = hash;
|
||||
|
||||
link._type = TYPE_FILE;
|
||||
|
||||
link.check();
|
||||
|
||||
return link;
|
||||
}
|
||||
|
||||
RetroShareLink RetroShareLink::createPublicMsgInvite(time_t time_stamp,const QString& issuer_pgp_id,const QString& hash)
|
||||
{
|
||||
RetroShareLink link;
|
||||
link.clear() ;
|
||||
|
||||
link._type = TYPE_PUBLIC_MSG ;
|
||||
link._time_stamp = time_stamp ;
|
||||
link._hash = hash ;
|
||||
link._GPGid = issuer_pgp_id ;
|
||||
|
||||
link.check() ;
|
||||
|
||||
return link;
|
||||
}
|
||||
|
||||
RetroShareLink RetroShareLink::createPerson(const RsPgpId& id)
|
||||
{
|
||||
RetroShareLink link;
|
||||
link.clear();
|
||||
|
||||
RsPeerDetails detail;
|
||||
if (rsPeers->getGPGDetails(id, detail) == false) {
|
||||
std::cerr << "RetroShareLink::createPerson() Couldn't find peer id " << id << std::endl;
|
||||
return false;
|
||||
} else {
|
||||
|
||||
link._hash = QString::fromStdString(id.toStdString());
|
||||
link._name = QString::fromUtf8(detail.name.c_str());
|
||||
|
||||
link._type = TYPE_PERSON;
|
||||
}
|
||||
|
||||
_hash = QString::fromStdString(id.toStdString());
|
||||
_name = QString::fromUtf8(detail.name.c_str());
|
||||
link.check();
|
||||
|
||||
_type = TYPE_PERSON;
|
||||
|
||||
check();
|
||||
|
||||
return valid();
|
||||
return link;
|
||||
}
|
||||
|
||||
bool RetroShareLink::createCertificate(const RsPeerId& ssl_id)
|
||||
RetroShareLink RetroShareLink::createCertificate(const RsPeerId& ssl_id)
|
||||
{
|
||||
// This is baaaaaad code:
|
||||
RetroShareLink link;
|
||||
link.clear();
|
||||
|
||||
#warning csoler 2012-08-14: This is baaaaaad code:
|
||||
// - we should not need to parse and re-read a cert in old format.
|
||||
//
|
||||
RsPeerDetails detail;
|
||||
if (rsPeers->getPeerDetails(ssl_id, detail) == false) {
|
||||
std::cerr << "RetroShareLink::createPerson() Couldn't find peer id " << ssl_id << std::endl;
|
||||
return false;
|
||||
} else {
|
||||
|
||||
link._type = TYPE_CERTIFICATE;
|
||||
link._radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id,false).c_str());
|
||||
link._name = QString::fromUtf8(detail.name.c_str());
|
||||
link._location = QString::fromUtf8(detail.location.c_str());
|
||||
link._radix.replace("\n","");
|
||||
|
||||
std::cerr << "Found radix = " << link._radix.toStdString() << std::endl;
|
||||
}
|
||||
|
||||
_type = TYPE_CERTIFICATE;
|
||||
_radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id,false).c_str());
|
||||
_name = QString::fromUtf8(detail.name.c_str());
|
||||
_location = QString::fromUtf8(detail.location.c_str());
|
||||
_radix.replace("\n","");
|
||||
link.check();
|
||||
|
||||
std::cerr << "Found radix = " << _radix.toStdString() << std::endl;
|
||||
|
||||
return true;
|
||||
return link;
|
||||
}
|
||||
|
||||
bool RetroShareLink::createUnknwonSslCertificate(const RsPeerId& sslId, const RsPgpId& gpgId)
|
||||
RetroShareLink RetroShareLink::createUnknwonSslCertificate(const RsPeerId& sslId, const RsPgpId& gpgId)
|
||||
{
|
||||
RetroShareLink link;
|
||||
link.clear();
|
||||
|
||||
// first try ssl id
|
||||
if (createCertificate(sslId)) {
|
||||
if (gpgId.isNull() || _GPGid.toStdString() == gpgId.toStdString()) {
|
||||
return true;
|
||||
link = createCertificate(sslId);
|
||||
if (link.valid()) {
|
||||
if (gpgId.isNull() || link._GPGid.toStdString() == gpgId.toStdString()) {
|
||||
return link;
|
||||
}
|
||||
// wrong gpg id
|
||||
return false;
|
||||
link.clear();
|
||||
return link;
|
||||
}
|
||||
|
||||
// then gpg id
|
||||
if (createPerson(gpgId)) {
|
||||
if (!_SSLid.isEmpty()) {
|
||||
return false;
|
||||
link = createPerson(gpgId);
|
||||
if (link.valid()) {
|
||||
if (!link._SSLid.isEmpty()) {
|
||||
link.clear();
|
||||
return link;
|
||||
}
|
||||
if (sslId.isNull()) {
|
||||
return true;
|
||||
link.check();
|
||||
return link;
|
||||
}
|
||||
_SSLid = QString::fromStdString(sslId.toStdString());
|
||||
if (_location.isEmpty()) {
|
||||
_location = _name;
|
||||
link._SSLid = QString::fromStdString(sslId.toStdString());
|
||||
if (link._location.isEmpty()) {
|
||||
link._location = link._name;
|
||||
}
|
||||
return true;
|
||||
link.check();
|
||||
return link;
|
||||
}
|
||||
|
||||
return false;
|
||||
link.clear();
|
||||
return link;
|
||||
}
|
||||
|
||||
bool RetroShareLink::createGxsGroupLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const QString &groupName)
|
||||
RetroShareLink RetroShareLink::createGxsGroupLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const QString &groupName)
|
||||
{
|
||||
clear();
|
||||
RetroShareLink link;
|
||||
link.clear();
|
||||
|
||||
if (!groupId.isNull()) {
|
||||
_hash = QString::fromStdString(groupId.toStdString());
|
||||
_type = linkType;
|
||||
_name = groupName;
|
||||
link._hash = QString::fromStdString(groupId.toStdString());
|
||||
link._type = linkType;
|
||||
link._name = groupName;
|
||||
}
|
||||
|
||||
check();
|
||||
link.check();
|
||||
|
||||
return valid();
|
||||
return link;
|
||||
}
|
||||
|
||||
bool RetroShareLink::createGxsMessageLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &msgName)
|
||||
RetroShareLink RetroShareLink::createGxsMessageLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &msgName)
|
||||
{
|
||||
clear();
|
||||
RetroShareLink link;
|
||||
link.clear();
|
||||
|
||||
if (!groupId.isNull() && !msgId.isNull()) {
|
||||
_hash = QString::fromStdString(groupId.toStdString());
|
||||
_msgId = QString::fromStdString(msgId.toStdString());
|
||||
_type = linkType;
|
||||
_name = msgName;
|
||||
link._hash = QString::fromStdString(groupId.toStdString());
|
||||
link._msgId = QString::fromStdString(msgId.toStdString());
|
||||
link._type = linkType;
|
||||
link._name = msgName;
|
||||
}
|
||||
|
||||
check();
|
||||
link.check();
|
||||
|
||||
return valid();
|
||||
return link;
|
||||
}
|
||||
|
||||
bool RetroShareLink::createSearch(const QString& keywords)
|
||||
RetroShareLink RetroShareLink::createSearch(const QString& keywords)
|
||||
{
|
||||
clear();
|
||||
RetroShareLink link;
|
||||
link.clear();
|
||||
|
||||
_name = keywords;
|
||||
link._name = keywords;
|
||||
|
||||
_type = TYPE_SEARCH;
|
||||
link._type = TYPE_SEARCH;
|
||||
|
||||
check();
|
||||
link.check();
|
||||
|
||||
return valid();
|
||||
return link;
|
||||
}
|
||||
|
||||
bool RetroShareLink::createMessage(const RsPeerId& peerId, const QString& subject)
|
||||
RetroShareLink RetroShareLink::createMessage(const RsPeerId& peerId, const QString& subject)
|
||||
{
|
||||
clear();
|
||||
RetroShareLink link;
|
||||
link.clear();
|
||||
|
||||
_hash = QString::fromStdString(peerId.toStdString());
|
||||
PeerDefs::rsidFromId(peerId, &_name);
|
||||
_subject = subject;
|
||||
link._hash = QString::fromStdString(peerId.toStdString());
|
||||
PeerDefs::rsidFromId(peerId, &link._name);
|
||||
link._subject = subject;
|
||||
|
||||
_type = TYPE_MESSAGE;
|
||||
link._type = TYPE_MESSAGE;
|
||||
|
||||
check();
|
||||
link.check();
|
||||
|
||||
return valid();
|
||||
return link;
|
||||
}
|
||||
bool RetroShareLink::createMessage(const RsGxsId& peerId, const QString& subject)
|
||||
RetroShareLink RetroShareLink::createMessage(const RsGxsId& peerId, const QString& subject)
|
||||
{
|
||||
clear();
|
||||
RetroShareLink link;
|
||||
link.clear();
|
||||
|
||||
_hash = QString::fromStdString(peerId.toStdString());
|
||||
link._hash = QString::fromStdString(peerId.toStdString());
|
||||
PeerDefs::rsidFromId(peerId, &link._name);
|
||||
link._subject = subject;
|
||||
|
||||
PeerDefs::rsidFromId(peerId, &_name);
|
||||
//_name = QString::fromStdString("GXS_id("+peerId.toStdString()+")") ;
|
||||
// do something better here!!
|
||||
_subject = subject;
|
||||
link._type = TYPE_MESSAGE;
|
||||
|
||||
_type = TYPE_MESSAGE;
|
||||
link.check();
|
||||
|
||||
check();
|
||||
|
||||
return valid();
|
||||
return link;
|
||||
}
|
||||
|
||||
void RetroShareLink::clear()
|
||||
{
|
||||
_valid = false;
|
||||
|
@ -534,6 +591,7 @@ void RetroShareLink::clear()
|
|||
_GPGid = "" ;
|
||||
_time_stamp = 0 ;
|
||||
_encrypted_chat_info = "" ;
|
||||
_radix_group_data = "" ;
|
||||
}
|
||||
|
||||
void RetroShareLink::check()
|
||||
|
@ -549,6 +607,7 @@ void RetroShareLink::check()
|
|||
case TYPE_EXTRAFILE:
|
||||
if(!checkSSLId(_SSLid))
|
||||
_valid = false; // no break! We also test file stuff below.
|
||||
/* fallthrough */
|
||||
case TYPE_FILE:
|
||||
if(_size > (((uint64_t)1)<<40)) // 1TB. Who has such large files?
|
||||
_valid = false;
|
||||
|
@ -565,6 +624,17 @@ void RetroShareLink::check()
|
|||
if(!checkPGPId(_GPGid)) _valid = false ;
|
||||
break ;
|
||||
|
||||
case TYPE_IDENTITY:
|
||||
if(_name.isNull())
|
||||
_valid = false ;
|
||||
|
||||
if(_radix_group_data.isNull())
|
||||
_valid = false ;
|
||||
|
||||
if(_hash.isNull())
|
||||
_valid = false ;
|
||||
break ;
|
||||
|
||||
case TYPE_PERSON:
|
||||
if(_size != 0)
|
||||
_valid = false;
|
||||
|
@ -651,6 +721,9 @@ QString RetroShareLink::title() const
|
|||
return QObject::tr("%1 (%2, Extra - Source included)").arg(hash()).arg(misc::friendlyUnit(size()));
|
||||
case TYPE_FILE:
|
||||
return QString("%1 (%2)").arg(hash()).arg(misc::friendlyUnit(size()));
|
||||
case TYPE_IDENTITY:
|
||||
return _name ;
|
||||
|
||||
case TYPE_PERSON:
|
||||
return PeerDefs::rsidFromId(RsPgpId(hash().toStdString()));
|
||||
case TYPE_FORUM:
|
||||
|
@ -711,6 +784,14 @@ QString RetroShareLink::toString() const
|
|||
|
||||
break;
|
||||
|
||||
case TYPE_IDENTITY:
|
||||
url.setScheme(RSLINK_SCHEME) ;
|
||||
url.setHost(HOST_IDENTITY) ;
|
||||
urlQuery.addQueryItem(IDENTITY_ID,_hash) ;
|
||||
urlQuery.addQueryItem(IDENTITY_NAME,encodeItem(_name)) ;
|
||||
urlQuery.addQueryItem(IDENTITY_GROUP,encodeItem(_radix_group_data)) ;
|
||||
break ;
|
||||
|
||||
case TYPE_EXTRAFILE:
|
||||
url.setScheme(RSLINK_SCHEME);
|
||||
url.setHost(HOST_EXTRAFILE);
|
||||
|
@ -782,9 +863,9 @@ QString RetroShareLink::toString() const
|
|||
case TYPE_CERTIFICATE:
|
||||
url.setScheme(RSLINK_SCHEME);
|
||||
url.setHost(HOST_CERTIFICATE) ;
|
||||
urlQuery.addQueryItem(CERTIFICATE_RADIX, _radix);
|
||||
urlQuery.addQueryItem(CERTIFICATE_NAME, _name);
|
||||
urlQuery.addQueryItem(CERTIFICATE_LOCATION, _location);
|
||||
urlQuery.addQueryItem(CERTIFICATE_RADIX, encodeItem(_radix));
|
||||
urlQuery.addQueryItem(CERTIFICATE_NAME, encodeItem(_name));
|
||||
urlQuery.addQueryItem(CERTIFICATE_LOCATION, encodeItem(_location));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -798,9 +879,11 @@ QString RetroShareLink::toString() const
|
|||
|
||||
QString RetroShareLink::niceName() const
|
||||
{
|
||||
if (type() == TYPE_PERSON) {
|
||||
if (type() == TYPE_PERSON)
|
||||
return PeerDefs::rsid(name().toUtf8().constData(), RsPgpId(hash().toStdString()));
|
||||
}
|
||||
|
||||
if(type() == TYPE_IDENTITY)
|
||||
return QObject::tr("Identity link (name=%1, ID=%2)").arg(_name).arg(_hash) ;
|
||||
|
||||
if(type() == TYPE_PUBLIC_MSG) {
|
||||
RsPeerDetails detail;
|
||||
|
@ -1011,6 +1094,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
case TYPE_POSTED:
|
||||
case TYPE_SEARCH:
|
||||
case TYPE_MESSAGE:
|
||||
case TYPE_IDENTITY:
|
||||
case TYPE_CERTIFICATE:
|
||||
case TYPE_PUBLIC_MSG:
|
||||
case TYPE_PRIVATE_CHAT:
|
||||
|
@ -1057,6 +1141,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
int countUnknown = 0;
|
||||
int countFileOpened = 0;
|
||||
bool needNotifySuccess = false;
|
||||
bool dontOpenNextFile = false;
|
||||
|
||||
// file
|
||||
QStringList fileAdded;
|
||||
|
@ -1156,6 +1241,15 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
}
|
||||
break ;
|
||||
|
||||
case TYPE_IDENTITY:
|
||||
{
|
||||
if(rsIdentity->deserialiseIdentityFromMemory(link.radixGroupData().toStdString()))
|
||||
QMessageBox::information(NULL,QObject::tr("Identity added to People"),QObject::tr("The identity was added to people. You can now chat with it, send messages to it, etc.")) ;
|
||||
else
|
||||
QMessageBox::warning(NULL,QObject::tr("Identity cannot be added to People"),QObject::tr("The identity was not added to people. Some error occured. The link is probably corrupted.")) ;
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_FILE:
|
||||
case TYPE_EXTRAFILE:
|
||||
{
|
||||
|
@ -1206,25 +1300,30 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
/* make path for downloaded file */
|
||||
std::string path;
|
||||
path = fi.path;//Shared files has path with filename included
|
||||
if (fi.downloadStatus == FT_STATE_COMPLETE)
|
||||
path = fi.path + "/" + fi.fname;
|
||||
|
||||
//Seems that all FileInfo get .path==filepath+filename
|
||||
//if (fi.downloadStatus == FT_STATE_COMPLETE)
|
||||
// path = fi.path + "/" + fi.fname;
|
||||
|
||||
QFileInfo qinfo;
|
||||
qinfo.setFile(QString::fromUtf8(path.c_str()));
|
||||
if (qinfo.exists() && qinfo.isFile()) {
|
||||
if (qinfo.exists() && qinfo.isFile() && !dontOpenNextFile) {
|
||||
QString question = "<html><body>";
|
||||
question += QObject::tr("Warning: Retroshare is about to ask your system to open this file. ");
|
||||
question += QObject::tr("Before you do so, please make sure that this file does not contain malicious executable code.");
|
||||
question += "<br><br>" + cleanname + "</body></html>";
|
||||
|
||||
QMessageBox mb(QObject::tr("Confirmation"), question, QMessageBox::Warning, QMessageBox::Yes,QMessageBox::No, 0);
|
||||
if (mb.exec() == QMessageBox::Yes) {
|
||||
QMessageBox mb(QObject::tr("Confirmation"), question, QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No, links.size()>1 ? QMessageBox::NoToAll : 0, 0);
|
||||
int ret = mb.exec();
|
||||
if(ret == QMessageBox::Yes) {
|
||||
++countFileOpened;
|
||||
bFileOpened = true;
|
||||
/* open file with a suitable application */
|
||||
if (!RsUrlHandler::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()))) {
|
||||
std::cerr << "RetroShareLink::process(): can't open file " << path << std::endl;
|
||||
}
|
||||
} else if (ret == QMessageBox::NoToAll) {
|
||||
dontOpenNextFile = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1569,6 +1668,8 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
return process(links, flag);
|
||||
}
|
||||
|
||||
/**** RSLinkClipboard ********************************************/
|
||||
|
||||
void RSLinkClipboard::copyLinks(const QList<RetroShareLink>& links)
|
||||
{
|
||||
QString res ;
|
||||
|
|
|
@ -68,7 +68,8 @@ class RetroShareLink
|
|||
TYPE_EXTRAFILE = 0x08,
|
||||
TYPE_PRIVATE_CHAT = 0x09,
|
||||
TYPE_PUBLIC_MSG = 0x0a,
|
||||
TYPE_POSTED = 0x0b
|
||||
TYPE_POSTED = 0x0b,
|
||||
TYPE_IDENTITY = 0x0c
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -76,18 +77,18 @@ class RetroShareLink
|
|||
RetroShareLink(const QUrl& url);
|
||||
RetroShareLink(const QString& url);
|
||||
|
||||
#warning these methods should be static and return a created link
|
||||
bool createFile(const QString& name, uint64_t size, const QString& hash);
|
||||
bool createExtraFile(const QString& name, uint64_t size, const QString& hash, const QString& ssl_id);
|
||||
bool createPerson(const RsPgpId &id);
|
||||
bool createGxsGroupLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const QString &groupName);
|
||||
bool createGxsMessageLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &msgName);
|
||||
bool createSearch(const QString& keywords);
|
||||
bool createMessage(const RsPeerId &peerId, const QString& subject);
|
||||
bool createMessage(const RsGxsId &peerId, const QString& subject);
|
||||
bool createCertificate(const RsPeerId &ssl_id) ;
|
||||
bool createPublicMsgInvite(time_t time_stamp,const QString& pgp_id,const QString& hash) ;
|
||||
bool createUnknwonSslCertificate(const RsPeerId &sslId, const RsPgpId &gpgId = RsPgpId()) ;
|
||||
static RetroShareLink createIdentity(const RsGxsId& gxs_id,const QString& name,const QString& radix_data) ;
|
||||
static RetroShareLink createExtraFile(const QString& name, uint64_t size, const QString& hash, const QString& ssl_id);
|
||||
static RetroShareLink createFile(const QString& name, uint64_t size, const QString& hash);
|
||||
static RetroShareLink createPublicMsgInvite(time_t time_stamp,const QString& pgp_id,const QString& hash) ;
|
||||
static RetroShareLink createPerson(const RsPgpId &id);
|
||||
static RetroShareLink createCertificate(const RsPeerId &ssl_id) ;
|
||||
static RetroShareLink createUnknwonSslCertificate(const RsPeerId &sslId, const RsPgpId &gpgId = RsPgpId()) ;
|
||||
static RetroShareLink createGxsGroupLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const QString &groupName);
|
||||
static RetroShareLink createGxsMessageLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &msgName);
|
||||
static RetroShareLink createSearch(const QString& keywords);
|
||||
static RetroShareLink createMessage(const RsPeerId &peerId, const QString& subject);
|
||||
static RetroShareLink createMessage(const RsGxsId &peerId, const QString& subject);
|
||||
|
||||
enumType type() const {return _type; }
|
||||
uint64_t size() const { return _size ; }
|
||||
|
@ -101,12 +102,13 @@ class RetroShareLink
|
|||
const QString& SSLId() const { return _SSLid ; }
|
||||
const QString& GPGId() const { return _GPGid ; }
|
||||
const QString& localIPAndPort() const { return _loc_ip_port ; }
|
||||
const QString& externalIPAndPort() const { return _ext_ip_port ; }
|
||||
const QString& dyndns() const { return _dyndns_name ; }
|
||||
const QString& location() const { return _location ; }
|
||||
const QString& radix() const { return _radix ; }
|
||||
time_t timeStamp() const { return _time_stamp ; }
|
||||
QString title() const;
|
||||
const QString& externalIPAndPort() const { return _ext_ip_port ; }
|
||||
const QString& dyndns() const { return _dyndns_name ; }
|
||||
const QString& location() const { return _location ; }
|
||||
const QString& radix() const { return _radix ; }
|
||||
time_t timeStamp() const { return _time_stamp ; }
|
||||
QString title() const;
|
||||
QString radixGroupData() const { return _radix_group_data ;}
|
||||
|
||||
unsigned int subType() const { return _subType; }
|
||||
void setSubType(unsigned int subType) { _subType = subType; }
|
||||
|
@ -158,12 +160,13 @@ class RetroShareLink
|
|||
QString _GPGBase64String ; // GPG Cert
|
||||
QString _GPGBase64CheckSum ; // GPG Cert
|
||||
QString _location ; // location
|
||||
QString _ext_ip_port ;
|
||||
QString _loc_ip_port ;
|
||||
QString _dyndns_name ;
|
||||
QString _ext_ip_port ;
|
||||
QString _loc_ip_port ;
|
||||
QString _dyndns_name ;
|
||||
QString _radix ;
|
||||
QString _encrypted_chat_info ; // encrypted data string for the recipient of a chat invite
|
||||
time_t _time_stamp ; // time stamp at which the link will expire.
|
||||
QString _encrypted_chat_info ; // encrypted data string for the recipient of a chat invite
|
||||
time_t _time_stamp ; // time stamp at which the link will expire.
|
||||
QString _radix_group_data;
|
||||
|
||||
unsigned int _subType; // for general use as sub type for _type (RSLINK_SUBTYPE_...)
|
||||
};
|
||||
|
|
|
@ -19,13 +19,18 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include <rshare.h>
|
||||
#include <retroshare/rsinit.h>
|
||||
#include "StartDialog.h"
|
||||
|
||||
#include "LogoBar.h"
|
||||
#include <QMessageBox>
|
||||
#include "rshare.h"
|
||||
#include "settings/rsharesettings.h"
|
||||
|
||||
#include "retroshare/rsinit.h"
|
||||
#include "retroshare/rsnotify.h"
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
/** Default constructor */
|
||||
|
@ -43,10 +48,6 @@ StartDialog::StartDialog(QWidget *parent)
|
|||
|
||||
Settings->loadWidgetInformation(this);
|
||||
|
||||
ui.loadButton->setFocus();
|
||||
|
||||
connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(loadPerson()));
|
||||
|
||||
/* get all available pgp private certificates....
|
||||
* mark last one as default.
|
||||
*/
|
||||
|
@ -75,10 +76,23 @@ StartDialog::StartDialog(QWidget *parent)
|
|||
}
|
||||
}
|
||||
|
||||
QObject::connect(ui.loadName,SIGNAL(currentIndexChanged(int)),this,SLOT(updateSelectedProfile(int))) ;
|
||||
//QObject::connect(ui.password_input,SIGNAL(returnPressed()),this,SLOT(loadPerson())) ;//Already called by StartDialog.returnPressed->loadButton.clicked
|
||||
QObject::connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(loadPerson()));
|
||||
|
||||
if (pidx > 0)
|
||||
{
|
||||
ui.loadName->setCurrentIndex(pidx);
|
||||
}
|
||||
|
||||
ui.password_input->setFocus();
|
||||
}
|
||||
|
||||
void StartDialog::updateSelectedProfile(int)
|
||||
{
|
||||
ui.password_input->clear();
|
||||
ui.password_input->setPlaceholderText(tr("Password"));
|
||||
ui.password_input->setFocus();
|
||||
}
|
||||
|
||||
void StartDialog::closeEvent (QCloseEvent * event)
|
||||
|
@ -101,18 +115,28 @@ void StartDialog::loadPerson()
|
|||
QVariant data = ui.loadName->itemData(pgpidx);
|
||||
RsPeerId accountId = RsPeerId((data.toString()).toStdString());
|
||||
|
||||
if (Rshare::loadCertificate(accountId, ui.autologin_checkbox->isChecked())) {
|
||||
// Cache the passphrase, so that it is not asked again.
|
||||
rsNotify->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ;
|
||||
rsNotify->setDisableAskPassword(true);
|
||||
|
||||
bool res = Rshare::loadCertificate(accountId, ui.autologin_checkbox->isChecked()) ;
|
||||
|
||||
rsNotify->setDisableAskPassword(false);
|
||||
|
||||
if(res)
|
||||
accept();
|
||||
else
|
||||
{
|
||||
ui.password_input->setPlaceholderText(tr("Wrong password"));
|
||||
ui.password_input->setText("");
|
||||
ui.password_input->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void StartDialog::on_labelProfile_linkActivated(QString /*link*/)
|
||||
{
|
||||
// if ((QMessageBox::question(this, tr("Create a New Profile"),tr("This will generate a new Profile\n Are you sure you want to continue?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes))== QMessageBox::Yes)
|
||||
// {
|
||||
reqNewCert = true;
|
||||
accept();
|
||||
// }
|
||||
}
|
||||
|
||||
bool StartDialog::requestedNewCert()
|
||||
|
|
|
@ -39,6 +39,7 @@ protected:
|
|||
|
||||
private slots:
|
||||
void loadPerson();
|
||||
void updateSelectedProfile(int);
|
||||
|
||||
#ifdef RS_AUTOLOGIN
|
||||
/**
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>430</width>
|
||||
<height>552</height>
|
||||
<width>440</width>
|
||||
<height>350</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -17,7 +17,10 @@
|
|||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/logo/logo_32.png</normaloff>:/images/logo/logo_32.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="StartDialogVLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -31,314 +34,337 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
<widget class="QFrame" name="loginframe">
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<layout class="QGridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton {
|
||||
border-image: url(:/images/avatar_background.png);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/user/personal64.png</normaloff>:/images/user/personal64.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>96</width>
|
||||
<height>96</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="4">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>85</red>
|
||||
<green>170</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>85</red>
|
||||
<green>170</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>118</red>
|
||||
<green>116</green>
|
||||
<blue>108</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>18</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Login</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1" rowspan="2" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<layout class="QGridLayout" name="loginframeGLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<layout class="QGridLayout" name="topGLayout">
|
||||
<property name="leftMargin">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<spacer name="topLHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="rsTopLogo">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>85</red>
|
||||
<green>170</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>85</red>
|
||||
<green>170</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>118</red>
|
||||
<green>116</green>
|
||||
<blue>108</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>18</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Profile - Location</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="images.qrc">:/images/logo/logo_web_nobackground.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="topRHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="2" rowspan="2">
|
||||
<spacer name="profileRHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<spacer name="mainVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" rowspan="2">
|
||||
<spacer name="profileLHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QGroupBox" name="profilGBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="profilGBoxGLayout">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="loadName_label">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="icons.qrc">:/icons/svg/person.svg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="loadName"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="password_label">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="icons.qrc">:/icons/svg/password.svg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="LineEditClear" name="password_input">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="autologin_checkbox">
|
||||
<property name="text">
|
||||
<string>Remember Password</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QPushButton" name="loadButton">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Log In</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="newHLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="loadName"/>
|
||||
<spacer name="newHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autologin_checkbox">
|
||||
<property name="text">
|
||||
<string>Remember Password</string>
|
||||
<widget class="QLabel" name="labelProfile">
|
||||
<property name="toolTip">
|
||||
<string>Opens a dialog for creating a new profile or
|
||||
adding locations to an existing profile.
|
||||
The current identities/locations will not be affected.</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>false</bool>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="Create new Profile..."><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;">New Profile/Node</span></a></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="4">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="loadButton">
|
||||
<property name="text">
|
||||
<string>Log In</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>71</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="2">
|
||||
<widget class="QLabel" name="labelProfile">
|
||||
<property name="toolTip">
|
||||
<string>Opens a dialog for creating a new profile or
|
||||
adding locations to an existing profile.
|
||||
The current identities/locations will not be affected.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="Create new Profile..."><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;">Manage profiles and nodes...</span></a></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="4">
|
||||
<widget class="LogoBar" name="callBarFrame">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>65</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LogoBar</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>gui/LogoBar.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>loadButton</tabstop>
|
||||
<tabstop>toolButton</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="images.qrc"/>
|
||||
<include location="icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LineEditClear</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>gui/common/LineEditClear.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
</ui>
|
||||
|
|
|
@ -128,6 +128,8 @@ RsRegularExpression::Expression * AdvancedSearchDialog::getRsExpr()
|
|||
|
||||
|
||||
// iterate through the items in elements and
|
||||
#warning Phenom (2017-07-21): I don t know if it is a real memLeak for wholeExpression. If not remove this warning and add a comment how it is deleted.
|
||||
// cppcheck-suppress memleak
|
||||
for (int i = 1; i < expressions->size(); ++i) {
|
||||
// extract the expression information and compound it with the
|
||||
// first expression
|
||||
|
|
|
@ -63,7 +63,7 @@ void ChatDialog::closeEvent(QCloseEvent *event)
|
|||
emit dialogClose(this);
|
||||
}
|
||||
|
||||
void ChatDialog::init(ChatId id, const QString &title)
|
||||
void ChatDialog::init(const ChatId &id, const QString &title)
|
||||
{
|
||||
mChatId = id;
|
||||
ChatWidget *cw = getChatWidget();
|
||||
|
@ -102,14 +102,14 @@ void ChatDialog::init(ChatId id, const QString &title)
|
|||
if (chatflags & RS_CHAT_OPEN) {
|
||||
if (id.isLobbyId()) {
|
||||
ChatLobbyDialog* cld = new ChatLobbyDialog(id.toLobbyId());
|
||||
cld->init();
|
||||
cld->init(ChatId(), "");
|
||||
cd = cld;
|
||||
}
|
||||
else if(id.isDistantChatId())
|
||||
{
|
||||
PopupDistantChatDialog* pdcd = new PopupDistantChatDialog(id.toDistantChatId());
|
||||
|
||||
pdcd->init(id.toDistantChatId());
|
||||
pdcd->init(id, "");
|
||||
cd = pdcd;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -84,7 +84,7 @@ protected:
|
|||
virtual QString getPeerName(const ChatId &sslid) const ; // can be overloaded for chat dialogs that have specific peers
|
||||
virtual QString getOwnName() const;
|
||||
|
||||
virtual void init(ChatId id, const QString &title);
|
||||
virtual void init(const ChatId &id, const QString &title);
|
||||
virtual void addChatMsg(const ChatMessage& msg) = 0;
|
||||
|
||||
ChatId mChatId;
|
||||
|
|
|
@ -19,45 +19,42 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* ccr . 2016 Jan 26
|
||||
*
|
||||
* Play sound on incoming messages.
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QWidgetAction>
|
||||
|
||||
#include "ChatLobbyDialog.h"
|
||||
#include "gui/ChatLobbyWidget.h"
|
||||
|
||||
#include "ChatTabWidget.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/settings/RsharePeerSettings.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/ChatLobbyWidget.h"
|
||||
#include "gui/FriendsDialog.h"
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
#include <gui/common/html.h>
|
||||
#include "gui/common/RSTreeWidgetItem.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/common/html.h"
|
||||
#include "gui/common/FriendSelectionDialog.h"
|
||||
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
||||
#include "gui/common/RSTreeWidgetItem.h"
|
||||
#include "gui/gxs/GxsIdChooser.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "gui/SoundManager.h"
|
||||
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
||||
#include "gui/Identity/IdDialog.h"
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
#include "gui/settings/RsharePeerSettings.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "util/QtVersion.h"
|
||||
|
||||
#include <retroshare/rsnotify.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define COLUMN_ICON 0
|
||||
#define COLUMN_NAME 1
|
||||
#define COLUMN_ACTIVITY 2
|
||||
#define COLUMN_ID 3
|
||||
#define COLUMN_NAME 0
|
||||
#define COLUMN_ACTIVITY 1
|
||||
#define COLUMN_ID 2
|
||||
#define COLUMN_ICON 3
|
||||
#define COLUMN_COUNT 4
|
||||
|
||||
#define ROLE_SORT Qt::UserRole + 1
|
||||
|
@ -80,12 +77,16 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
|
|||
connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
||||
|
||||
int S = QFontMetricsF(font()).height() ;
|
||||
ui.participantsList->setIconSize(QSize(1.3*S,1.3*S));
|
||||
ui.participantsList->setIconSize(QSize(1.4*S,1.4*S));
|
||||
|
||||
ui.participantsList->setColumnCount(COLUMN_COUNT);
|
||||
ui.participantsList->setColumnWidth(COLUMN_ICON, 1.4*S);
|
||||
ui.participantsList->setColumnWidth(COLUMN_ICON, 1.7*S);
|
||||
ui.participantsList->setColumnHidden(COLUMN_ACTIVITY,true);
|
||||
ui.participantsList->setColumnHidden(COLUMN_ID,true);
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * header = ui.participantsList->header();
|
||||
QHeaderView_setSectionResizeModeColumn(header, COLUMN_NAME, QHeaderView::Stretch);
|
||||
|
||||
muteAct = new QAction(QIcon(), tr("Mute participant"), this);
|
||||
voteNegativeAct = new QAction(QIcon(":/icons/png/thumbs-down.png"), tr("Ban this person (Sets negative opinion)"), this);
|
||||
|
@ -304,7 +305,7 @@ void ChatLobbyDialog::showInPeopleTab()
|
|||
idDialog->navigate(nickname);
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::init()
|
||||
void ChatLobbyDialog::init(const ChatId &/*id*/, const QString &/*title*/)
|
||||
{
|
||||
ChatLobbyInfo linfo ;
|
||||
|
||||
|
@ -472,7 +473,6 @@ void ChatLobbyDialog::addChatMsg(const ChatMessage& msg)
|
|||
|
||||
ui.chatWidget->addChatMsg(msg.incoming, name, gxs_id, sendTime, recvTime, message, ChatWidget::MSGTYPE_NORMAL);
|
||||
emit messageReceived(msg.incoming, id(), sendTime, name, message) ;
|
||||
SoundManager::play(SOUND_NEW_LOBBY_MESSAGE);
|
||||
|
||||
// This is a trick to translate HTML into text.
|
||||
QTextEdit editor;
|
||||
|
|
|
@ -71,7 +71,7 @@ protected:
|
|||
virtual ~ChatLobbyDialog();
|
||||
|
||||
void processSettings(bool load);
|
||||
virtual void init();
|
||||
virtual void init(const ChatId &id, const QString &title);
|
||||
virtual bool canClose();
|
||||
virtual void addChatMsg(const ChatMessage &msg);
|
||||
|
||||
|
|
|
@ -145,11 +145,9 @@
|
|||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Participants</string>
|
||||
</property>
|
||||
</column>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
|
|
|
@ -21,15 +21,19 @@
|
|||
|
||||
#include <QTime>
|
||||
#include <QMenu>
|
||||
|
||||
#include "ChatLobbyUserNotify.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/MainWindow.h"
|
||||
|
||||
#include "gui/ChatLobbyWidget.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/SoundManager.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "util/DateTime.h"
|
||||
#include <retroshare/rsidentity.h>
|
||||
#include <util/HandleRichText.h>
|
||||
|
||||
#include <retroshare/rsidentity.h>
|
||||
|
||||
ChatLobbyUserNotify::ChatLobbyUserNotify(QObject *parent) :
|
||||
UserNotify(parent)
|
||||
{
|
||||
|
@ -273,8 +277,9 @@ void ChatLobbyUserNotify::chatLobbyNewMessage(ChatLobbyId lobby_id, QDateTime ti
|
|||
|
||||
_listMsg[lobby_id][strAnchor]=msgData;
|
||||
emit countChanged(lobby_id, _listMsg[lobby_id].size());
|
||||
updateIcon();
|
||||
}
|
||||
updateIcon();
|
||||
SoundManager::play(SOUND_NEW_LOBBY_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
bool ChatLobbyUserNotify::checkWord(QString message, QString word)
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "gui/common/FilesDefs.h"
|
||||
#include "gui/common/Emoticons.h"
|
||||
#include "gui/chat/ChatLobbyDialog.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "gui/chat/ChatUserNotify.h"//For BradCast
|
||||
|
@ -65,6 +66,8 @@
|
|||
|
||||
#define FMM 2.5//fontMetricsMultiplicator
|
||||
|
||||
#define PERSONID "PersonId:"
|
||||
|
||||
/*****
|
||||
* #define CHAT_DEBUG 1
|
||||
*****/
|
||||
|
@ -76,7 +79,7 @@ ChatWidget::ChatWidget(QWidget *parent) :
|
|||
|
||||
int iconHeight = FMM*QFontMetricsF(font()).height() ;
|
||||
QSize iconSize = QSize(iconHeight,iconHeight);
|
||||
QSize buttonSize = QSize(iconSize + QSize(FMM,FMM));
|
||||
QSize buttonSize = QSize(iconSize + QSize((int)FMM,(int)FMM));
|
||||
|
||||
newMessages = false;
|
||||
typing = false;
|
||||
|
@ -198,6 +201,8 @@ ChatWidget::ChatWidget(QWidget *parent) :
|
|||
menu->addMenu(fontmenu);
|
||||
|
||||
ui->actionSendAsPlainText->setChecked(Settings->getChatSendAsPlainTextByDef());
|
||||
ui->chatTextEdit->setOnlyPlainText(ui->actionSendAsPlainText->isChecked());
|
||||
connect(ui->actionSendAsPlainText, SIGNAL(toggled(bool)), ui->chatTextEdit, SLOT(setOnlyPlainText(bool)) );
|
||||
|
||||
ui->textBrowser->resetImagesStatus(Settings->getChatLoadEmbeddedImages());
|
||||
ui->textBrowser->installEventFilter(this);
|
||||
|
@ -258,7 +263,7 @@ void ChatWidget::addChatBarWidget(QWidget *w)
|
|||
{
|
||||
int iconHeight = FMM*QFontMetricsF(font()).height() ;
|
||||
QSize iconSize = QSize(iconHeight,iconHeight);
|
||||
QSize buttonSize = QSize(iconSize + QSize(FMM,FMM));
|
||||
QSize buttonSize = QSize(iconSize + QSize((int)FMM,(int)FMM));
|
||||
w->setFixedSize(buttonSize);
|
||||
ui->pluginButtonFrame->layout()->addWidget(w) ;
|
||||
}
|
||||
|
@ -415,9 +420,11 @@ ChatWidget::ChatType ChatWidget::chatType()
|
|||
|
||||
void ChatWidget::blockSending(QString msg)
|
||||
{
|
||||
sendingBlocked = true;
|
||||
ui->sendButton->setEnabled(false);
|
||||
ui->sendButton->setToolTip(msg);
|
||||
#ifndef RS_ASYNC_CHAT
|
||||
sendingBlocked = true;
|
||||
ui->sendButton->setEnabled(false);
|
||||
#endif
|
||||
ui->sendButton->setToolTip(msg);
|
||||
}
|
||||
|
||||
void ChatWidget::unblockSending()
|
||||
|
@ -587,6 +594,9 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
|
|||
if (ui->textBrowser->checkImage(helpEvent->pos(), imageStr)) {
|
||||
toolTipText = imageStr;
|
||||
}
|
||||
} else if (toolTipText.startsWith(PERSONID)){
|
||||
toolTipText = toolTipText.replace(PERSONID, tr("Person id: ") );
|
||||
toolTipText = toolTipText.append(tr("\nDouble click on it to add his name on text writer.") );
|
||||
}
|
||||
}
|
||||
if (!toolTipText.isEmpty()){
|
||||
|
@ -664,6 +674,43 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (obj == ui->textBrowser->viewport()) {
|
||||
if (event->type() == QEvent::MouseButtonDblClick) {
|
||||
|
||||
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
|
||||
QTextCursor cursor = ui->textBrowser->cursorForPosition(mouseEvent->pos());
|
||||
cursor.select(QTextCursor::WordUnderCursor);
|
||||
if (!cursor.selectedText().isEmpty()){
|
||||
QRegExp rx("<a name=\"(.*)\"",Qt::CaseSensitive, QRegExp::RegExp2);
|
||||
rx.setMinimal(true);
|
||||
QString sel=cursor.selection().toHtml();
|
||||
QStringList anchors;
|
||||
int pos=0;
|
||||
while ((pos = rx.indexIn(sel,pos)) != -1) {
|
||||
anchors << rx.cap(1);
|
||||
pos += rx.matchedLength();
|
||||
}
|
||||
|
||||
if (!anchors.isEmpty()){
|
||||
if (anchors.at(0).startsWith(PERSONID)){
|
||||
QString strId = QString(anchors.at(0)).replace(PERSONID,"");
|
||||
if (strId.contains(" "))
|
||||
strId.truncate(strId.indexOf(" "));
|
||||
|
||||
RsGxsId mId = RsGxsId(strId.toStdString());
|
||||
if(!mId.isNull()) {
|
||||
RsIdentityDetails details;
|
||||
if (rsIdentity->getIdDetails(mId, details)){
|
||||
QString text = QString("@").append(GxsIdDetails::getName(details)).append(" ");
|
||||
ui->chatTextEdit->textCursor().insertText(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if (event->type() == QEvent::WindowActivate) {
|
||||
if (isVisible() && (window() == NULL || window()->isActiveWindow())) {
|
||||
|
@ -962,10 +1009,29 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const RsGxsId gx
|
|||
formatMsg.replace(QString("<a name=\"date\">"),QString("<a name=\"%1\">").arg(timeStamp));
|
||||
formatMsg.replace(QString("<a name=\"time\">"),QString("<a name=\"%1\">").arg(timeStamp));
|
||||
//replace Name anchors with GXS Id
|
||||
QString strGxsId = "";
|
||||
if (!gxsId.isNull())
|
||||
strGxsId = QString::fromStdString(gxsId.toStdString());
|
||||
formatMsg.replace(QString("<a name=\"name\">"),QString("<a name=\"Person Id: %1\">").arg(strGxsId));
|
||||
if (!gxsId.isNull()) {
|
||||
RsIdentityDetails details;
|
||||
QString strPreName = "";
|
||||
|
||||
QString strGxsId = QString::fromStdString(gxsId.toStdString());
|
||||
rsIdentity->getIdDetails(gxsId, details);
|
||||
bool isUnsigned = !(details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED);
|
||||
if(isUnsigned && ui->textBrowser->getShowImages()) {
|
||||
QIcon icon = QIcon(":/icons/anonymous_blue_128.png");
|
||||
int height = ui->textBrowser->fontMetrics().height()*0.8;
|
||||
QImage image(icon.pixmap(height,height).toImage());
|
||||
QByteArray byteArray;
|
||||
QBuffer buffer(&byteArray);
|
||||
image.save(&buffer, "PNG"); // writes the image in PNG format inside the buffer
|
||||
QString iconBase64 = QString::fromLatin1(byteArray.toBase64().data());
|
||||
strPreName = QString("<img src=\"data:image/png;base64,%1\" alt=\"[unsigned]\" />").arg(iconBase64);
|
||||
}
|
||||
|
||||
formatMsg.replace(QString("<a name=\"name\">")
|
||||
,QString(strPreName).append("<a name=\"").append(PERSONID).append("%1 %2\">").arg(strGxsId, isUnsigned ? tr(" Unsigned"):""));
|
||||
} else {
|
||||
formatMsg.replace(QString("<a name=\"name\">"),"");
|
||||
}
|
||||
|
||||
QTextCursor textCursor = QTextCursor(ui->textBrowser->textCursor());
|
||||
textCursor.movePosition(QTextCursor::End);
|
||||
|
@ -1397,7 +1463,8 @@ void ChatWidget::colorChanged()
|
|||
void ChatWidget::chooseFont()
|
||||
{
|
||||
bool ok;
|
||||
QFont font = QFontDialog::getFont(&ok, currentFont, this);
|
||||
//Use NULL as parent as with this QFontDialog don't take care of title nether options.
|
||||
QFont font = QFontDialog::getFont(&ok, currentFont, NULL, tr("Choose your font."),QFontDialog::DontUseNativeDialog);
|
||||
if (ok) {
|
||||
currentFont = font;
|
||||
setFont();
|
||||
|
@ -1510,14 +1577,14 @@ void ChatWidget::fileHashingFinished(QList<HashedFile> hashedFiles)
|
|||
QList<HashedFile>::iterator it;
|
||||
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
|
||||
HashedFile& hashedFile = *it;
|
||||
QString ext = QFileInfo(hashedFile.filename).suffix();
|
||||
//QString ext = QFileInfo(hashedFile.filename).suffix();
|
||||
|
||||
RetroShareLink link;
|
||||
|
||||
if(mDefaultExtraFileFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
||||
link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()));
|
||||
link = RetroShareLink::createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()));
|
||||
else
|
||||
link.createExtraFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()),QString::fromStdString(rsPeers->getOwnId().toStdString()));
|
||||
link = RetroShareLink::createExtraFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()),QString::fromStdString(rsPeers->getOwnId().toStdString()));
|
||||
|
||||
if (hashedFile.flag & HashedFile::Picture) {
|
||||
message += QString("<img src=\"file:///%1\" width=\"100\" height=\"100\">").arg(hashedFile.filepath);
|
||||
|
@ -1529,6 +1596,7 @@ void ChatWidget::fileHashingFinished(QList<HashedFile> hashedFiles)
|
|||
}
|
||||
}
|
||||
message += link.toHtmlSize();
|
||||
|
||||
if (it != hashedFiles.end()) {
|
||||
message += "<BR>";
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ protected:
|
|||
/** Default destructor */
|
||||
virtual ~PopupChatDialog();
|
||||
|
||||
virtual void init(const ChatId &chat_id, const QString &title);
|
||||
virtual void init(const ChatId &chat_id, const QString &title);
|
||||
virtual void showDialog(uint chatflags);
|
||||
virtual ChatWidget *getChatWidget();
|
||||
virtual bool hasPeerStatus() { return true; }
|
||||
|
|
|
@ -63,9 +63,12 @@ PopupDistantChatDialog::PopupDistantChatDialog(const DistantChatPeerId& tunnel_i
|
|||
updateDisplay() ;
|
||||
}
|
||||
|
||||
void PopupDistantChatDialog::init(const DistantChatPeerId &peer_id)
|
||||
void PopupDistantChatDialog::init(const ChatId &chat_id, const QString &/*title*/)
|
||||
{
|
||||
_tunnel_id = peer_id;
|
||||
if (!chat_id.isDistantChatId())
|
||||
return;
|
||||
|
||||
_tunnel_id = chat_id.toDistantChatId();
|
||||
DistantChatPeerInfo tinfo;
|
||||
|
||||
if(!rsMsgs->getDistantChatStatus(_tunnel_id,tinfo))
|
||||
|
@ -74,15 +77,15 @@ void PopupDistantChatDialog::init(const DistantChatPeerId &peer_id)
|
|||
RsIdentityDetails iddetails ;
|
||||
|
||||
if(rsIdentity->getIdDetails(tinfo.to_id,iddetails))
|
||||
PopupChatDialog::init(ChatId(peer_id), QString::fromUtf8(iddetails.mNickname.c_str())) ;
|
||||
PopupChatDialog::init(chat_id, QString::fromUtf8(iddetails.mNickname.c_str())) ;
|
||||
else
|
||||
PopupChatDialog::init(ChatId(peer_id), QString::fromStdString(tinfo.to_id.toStdString())) ;
|
||||
PopupChatDialog::init(chat_id, QString::fromStdString(tinfo.to_id.toStdString())) ;
|
||||
|
||||
// Do not use setOwnId, because we don't want the user to change the GXS avatar from the chat window
|
||||
// it will not be transmitted.
|
||||
|
||||
ui.ownAvatarWidget->setOwnId() ; // sets the flag
|
||||
ui.ownAvatarWidget->setId(ChatId(peer_id)) ; // sets the actual Id
|
||||
ui.ownAvatarWidget->setId(chat_id) ; // sets the actual Id
|
||||
}
|
||||
|
||||
void PopupDistantChatDialog::updateDisplay()
|
||||
|
@ -104,41 +107,52 @@ void PopupDistantChatDialog::updateDisplay()
|
|||
|
||||
QString msg;
|
||||
|
||||
switch(tinfo.status)
|
||||
{
|
||||
case RS_DISTANT_CHAT_STATUS_UNKNOWN: //std::cerr << "Unknown hash. Error!" << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_GRY_LED)) ;
|
||||
msg = tr("Chat remotely closed. Please close this window.");
|
||||
_status_label->setToolTip(msg) ;
|
||||
getChatWidget()->updateStatusString("%1", msg, true);
|
||||
getChatWidget()->blockSending(tr("Can't send message, because there is no tunnel."));
|
||||
setPeerStatus(RS_STATUS_OFFLINE) ;
|
||||
break ;
|
||||
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED: std::cerr << "Chat remotely closed. " << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_RED_LED)) ;
|
||||
_status_label->setToolTip(QObject::tr("Distant peer has closed the chat")) ;
|
||||
|
||||
getChatWidget()->updateStatusString("%1", tr("The person you're talking to has deleted the secured chat tunnel. You may remove the chat window now."), true);
|
||||
getChatWidget()->blockSending(tr("Can't send message, because the chat partner deleted the secure tunnel."));
|
||||
setPeerStatus(RS_STATUS_OFFLINE) ;
|
||||
|
||||
break ;
|
||||
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN: //std::cerr << "Tunnel asked. Waiting for reponse. " << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_RED_LED)) ;
|
||||
msg = QObject::tr("Tunnel is pending...");
|
||||
_status_label->setToolTip(msg) ;
|
||||
getChatWidget()->updateStatusString("%1", msg, true);
|
||||
getChatWidget()->blockSending(msg);
|
||||
setPeerStatus(RS_STATUS_OFFLINE) ;
|
||||
break ;
|
||||
case RS_DISTANT_CHAT_STATUS_CAN_TALK: //std::cerr << "Tunnel is ok and data is transmitted." << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_GRN_LED)) ;
|
||||
msg = QObject::tr("Secured tunnel is working. You can talk!");
|
||||
_status_label->setToolTip(msg) ;
|
||||
getChatWidget()->unblockSending();
|
||||
setPeerStatus(RS_STATUS_ONLINE) ;
|
||||
break ;
|
||||
}
|
||||
switch(tinfo.status)
|
||||
{
|
||||
case RS_DISTANT_CHAT_STATUS_UNKNOWN:
|
||||
//std::cerr << "Unknown hash. Error!" << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_GRY_LED));
|
||||
msg = tr("Remote status unknown.");
|
||||
_status_label->setToolTip(msg);
|
||||
getChatWidget()->updateStatusString("%1", msg, true);
|
||||
getChatWidget()->blockSending(tr( "Can't send message immediately, "
|
||||
"because there is no tunnel "
|
||||
"available." ));
|
||||
setPeerStatus(RS_STATUS_OFFLINE);
|
||||
break ;
|
||||
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED:
|
||||
std::cerr << "Chat remotely closed. " << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_RED_LED));
|
||||
_status_label->setToolTip(
|
||||
QObject::tr("Distant peer has closed the chat") );
|
||||
getChatWidget()->updateStatusString(
|
||||
"%1", tr( "The person you are talking to has deleted the"
|
||||
" secured chat tunnel." ), true );
|
||||
getChatWidget()->blockSending(tr( "The chat partner deleted the secure"
|
||||
" tunnel, messages will be delivered"
|
||||
" as soon as possible"));
|
||||
setPeerStatus(RS_STATUS_OFFLINE) ;
|
||||
break ;
|
||||
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN:
|
||||
//std::cerr << "Tunnel asked. Waiting for reponse. " << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_RED_LED));
|
||||
msg = QObject::tr( "Tunnel is pending... Messages will be delivered as"
|
||||
" soon as possible" );
|
||||
_status_label->setToolTip(msg);
|
||||
getChatWidget()->updateStatusString("%1", msg, true);
|
||||
getChatWidget()->blockSending(msg);
|
||||
setPeerStatus(RS_STATUS_OFFLINE);
|
||||
break;
|
||||
case RS_DISTANT_CHAT_STATUS_CAN_TALK:
|
||||
//std::cerr << "Tunnel is ok and data is transmitted." << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_GRN_LED));
|
||||
msg = QObject::tr( "Secured tunnel is working. "
|
||||
"Messages are delivered immediately!" );
|
||||
_status_label->setToolTip(msg);
|
||||
getChatWidget()->unblockSending();
|
||||
setPeerStatus(RS_STATUS_ONLINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
|
||||
|
|
|
@ -38,7 +38,7 @@ class PopupDistantChatDialog: public PopupChatDialog
|
|||
/** Default destructor */
|
||||
virtual ~PopupDistantChatDialog();
|
||||
|
||||
virtual void init(const DistantChatPeerId& peer_id);
|
||||
virtual void init(const ChatId& chat_id, const QString &title);
|
||||
virtual void closeEvent(QCloseEvent *e) ;
|
||||
|
||||
virtual QString getPeerName(const ChatId &id) const ;
|
||||
|
|
|
@ -44,7 +44,7 @@ void AvatarDefs::getOwnAvatar(QPixmap &avatar, const QString& defaultImage)
|
|||
/* load image */
|
||||
avatar.loadFromData(data, size, "PNG") ;
|
||||
|
||||
delete[] data;
|
||||
free(data);
|
||||
}
|
||||
void AvatarDefs::getAvatarFromSslId(const RsPeerId& sslId, QPixmap &avatar, const QString& defaultImage)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ void AvatarDefs::getAvatarFromSslId(const RsPeerId& sslId, QPixmap &avatar, cons
|
|||
/* load image */
|
||||
avatar.loadFromData(data, size, "PNG") ;
|
||||
|
||||
delete[] data;
|
||||
free(data);
|
||||
}
|
||||
void AvatarDefs::getAvatarFromGxsId(const RsGxsId& gxsId, QPixmap &avatar, const QString& defaultImage)
|
||||
{
|
||||
|
@ -112,5 +112,5 @@ void AvatarDefs::getAvatarFromGpgId(const RsPgpId& gpgId, QPixmap &avatar, const
|
|||
/* load image */
|
||||
avatar.loadFromData(data, size, "PNG") ;
|
||||
|
||||
delete[] data;
|
||||
free(data);
|
||||
}
|
||||
|
|
|
@ -139,6 +139,12 @@ FriendList::FriendList(QWidget *parent) :
|
|||
ui->filterLineEdit->setPlaceholderText(tr("Search")) ;
|
||||
ui->filterLineEdit->showFilterIcon();
|
||||
|
||||
/* Add filter actions */
|
||||
QTreeWidgetItem *headerItem = ui->peerTreeWidget->headerItem();
|
||||
QString headerText = headerItem->text(COLUMN_NAME);
|
||||
ui->filterLineEdit->addFilter(QIcon(), headerText, COLUMN_NAME, QString("%1 %2").arg(tr("Search"), headerText));
|
||||
ui->filterLineEdit->addFilter(QIcon(), tr("ID"), COLUMN_ID, tr("Search ID"));
|
||||
|
||||
mActionSortByState = new QAction(tr("Sort by state"), this);
|
||||
mActionSortByState->setCheckable(true);
|
||||
connect(mActionSortByState, SIGNAL(toggled(bool)), this, SLOT(sortByState(bool)));
|
||||
|
@ -167,6 +173,7 @@ FriendList::FriendList(QWidget *parent) :
|
|||
ui->peerTreeWidget->setColumnWidth(COLUMN_NAME, 22 * fontWidth);
|
||||
ui->peerTreeWidget->setColumnWidth(COLUMN_LAST_CONTACT, 12 * fontWidth);
|
||||
ui->peerTreeWidget->setColumnWidth(COLUMN_IP, 15 * fontWidth);
|
||||
ui->peerTreeWidget->setColumnWidth(COLUMN_ID, 32 * fontWidth);
|
||||
|
||||
int avatarHeight = fontMetrics.height() * 3;
|
||||
ui->peerTreeWidget->setIconSize(QSize(avatarHeight, avatarHeight));
|
||||
|
@ -706,7 +713,12 @@ void FriendList::insertPeers()
|
|||
groupItem->setForeground(COLUMN_NAME, QBrush(textColorGroup()));
|
||||
|
||||
/* used to find back the item */
|
||||
groupItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(groupInfo->id.toStdString()));
|
||||
QString strID = QString::fromStdString(groupInfo->id.toStdString());
|
||||
groupItem->setData(COLUMN_DATA, ROLE_ID, strID);
|
||||
//No needs for group ???
|
||||
//groupItem->setText(COLUMN_ID, strID);
|
||||
//groupItem->setData(COLUMN_ID, ROLE_SORT_NAME, strID);
|
||||
//groupItem->setData(COLUMN_ID, ROLE_FILTER, strID);
|
||||
groupItem->setData(COLUMN_DATA, ROLE_STANDARD, (groupInfo->flag & RS_GROUP_FLAG_STANDARD) ? true : false);
|
||||
|
||||
/* Sort data */
|
||||
|
@ -808,7 +820,11 @@ void FriendList::insertPeers()
|
|||
gpgItem->setTextAlignment(COLUMN_NAME, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
/* not displayed, used to find back the item */
|
||||
gpgItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.gpg_id.toStdString()));
|
||||
QString strID = QString::fromStdString(detail.gpg_id.toStdString());
|
||||
gpgItem->setData(COLUMN_DATA, ROLE_ID, strID);
|
||||
gpgItem->setText(COLUMN_ID, strID);
|
||||
gpgItem->setData(COLUMN_ID, ROLE_SORT_NAME, strID);
|
||||
gpgItem->setData(COLUMN_ID, ROLE_FILTER, strID);
|
||||
|
||||
/* Sort data */
|
||||
for (int i = 0; i < columnCount; ++i) {
|
||||
|
@ -893,7 +909,11 @@ void FriendList::insertPeers()
|
|||
}
|
||||
|
||||
/* not displayed, used to find back the item */
|
||||
sslItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(sslDetail.id.toStdString()));
|
||||
QString strID = QString::fromStdString(sslDetail.id.toStdString());
|
||||
sslItem->setData(COLUMN_DATA, ROLE_ID, strID);
|
||||
sslItem->setText(COLUMN_ID, strID);
|
||||
sslItem->setData(COLUMN_ID, ROLE_SORT_NAME, strID);
|
||||
sslItem->setData(COLUMN_ID, ROLE_FILTER, strID);
|
||||
|
||||
/* Custom state string */
|
||||
QString customStateString;
|
||||
|
@ -1394,14 +1414,12 @@ void FriendList::copyFullCertificate()
|
|||
{
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
QList<RetroShareLink> urls;
|
||||
RetroShareLink link ;
|
||||
|
||||
link.createCertificate(RsPeerId(getRsId(c))) ;
|
||||
RetroShareLink link = RetroShareLink::createCertificate(RsPeerId(getRsId(c)));
|
||||
urls.push_back(link);
|
||||
|
||||
std::cerr << "link: " << std::endl;
|
||||
|
||||
std::cerr<< link.toString().toStdString() << std::endl;
|
||||
|
||||
RSLinkClipboard::copyLinks(urls);
|
||||
}
|
||||
|
||||
|
@ -1816,25 +1834,26 @@ void FriendList::importFriendlistClicked()
|
|||
*/
|
||||
bool FriendList::importExportFriendlistFileDialog(QString &fileName, bool import)
|
||||
{
|
||||
if(!misc::getSaveFileName(this,
|
||||
RshareSettings::LASTDIR_CERT,
|
||||
(import ? tr("Select file for importing your friendlist from") :
|
||||
tr("Select a file for exporting your friendlist to")),
|
||||
tr("XML File (*.xml);;All Files (*)"),
|
||||
fileName,
|
||||
NULL,
|
||||
(import ? QFileDialog::DontConfirmOverwrite : (QFileDialog::Options)0)
|
||||
)) {
|
||||
// show error to user
|
||||
QMessageBox mbox;
|
||||
mbox.setIcon(QMessageBox::Warning);
|
||||
mbox.setText(tr("Error"));
|
||||
mbox.setInformativeText(tr("Failed to get a file!"));
|
||||
mbox.setStandardButtons(QMessageBox::Ok);
|
||||
mbox.exec();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
bool res = true;
|
||||
if (import) {
|
||||
res = misc::getOpenFileName(this, RshareSettings::LASTDIR_CERT
|
||||
, tr("Select file for importing your friendlist from")
|
||||
, tr("XML File (*.xml);;All Files (*)")
|
||||
, fileName
|
||||
, QFileDialog::DontConfirmOverwrite
|
||||
);
|
||||
} else {
|
||||
res = misc::getSaveFileName(this, RshareSettings::LASTDIR_CERT
|
||||
, tr("Select a file for exporting your friendlist to")
|
||||
, tr("XML File (*.xml);;All Files (*)")
|
||||
, fileName, NULL
|
||||
, (QFileDialog::Options)0
|
||||
);
|
||||
}
|
||||
if ( res && !fileName.endsWith(".xml",Qt::CaseInsensitive) )
|
||||
fileName = fileName.append(".xml");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2263,8 +2282,9 @@ void FriendList::setShowGroups(bool show)
|
|||
*/
|
||||
void FriendList::filterItems(const QString &text)
|
||||
{
|
||||
mFilterText = text;
|
||||
ui->peerTreeWidget->filterItems(COLUMN_NAME, mFilterText, ROLE_FILTER);
|
||||
int filterColumn = ui->filterLineEdit->currentFilter();
|
||||
mFilterText = text;
|
||||
ui->peerTreeWidget->filterItems(filterColumn, mFilterText, ROLE_FILTER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,8 @@ public:
|
|||
{
|
||||
COLUMN_NAME = 0,
|
||||
COLUMN_LAST_CONTACT = 1,
|
||||
COLUMN_IP = 2
|
||||
COLUMN_IP = 2,
|
||||
COLUMN_ID = 3
|
||||
};
|
||||
|
||||
public:
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>3</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<attribute name="headerDefaultSectionSize">
|
||||
<number>120</number>
|
||||
|
@ -97,6 +97,11 @@
|
|||
<string>IP</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>ID</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <iostream>
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <gui/common/GroupDefs.h>
|
||||
|
||||
/** Constructor */
|
||||
GroupChooser::GroupChooser(QWidget *parent)
|
||||
|
@ -51,7 +52,7 @@ bool GroupChooser::makeNodeGroupDesc(const RsGroupInfo& info, QString &desc)
|
|||
if(info.name.empty())
|
||||
desc = tr("[Unknown]") ;
|
||||
else
|
||||
desc = "\"" + QString::fromUtf8(info.name.c_str()) + "\"";
|
||||
desc = "\"" + GroupDefs::name(info) + "\"";
|
||||
|
||||
desc += " [" ;
|
||||
desc += QString::fromStdString(info.id.toStdString().substr(0,3));
|
||||
|
@ -88,7 +89,7 @@ void GroupChooser::loadGroups()
|
|||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
QString id = QString::fromStdString(it->id.toStdString());
|
||||
QString id = QString::fromStdString((*it).id.toStdString()) ;
|
||||
|
||||
addItem(str, id);
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
#include <QToolButton>
|
||||
#include <QStyle>
|
||||
#include <QMenu>
|
||||
#if QT_VERSION < 0x040700
|
||||
//#if QT_VERSION < 0x040700
|
||||
#if QT_VERSION < 0x050000//PlaceHolder text only shown when not have focus in Qt4
|
||||
#include <QLabel>
|
||||
#endif
|
||||
|
||||
|
@ -52,7 +53,8 @@ LineEditClear::LineEditClear(QWidget *parent)
|
|||
connect(mClearButton, SIGNAL(clicked()), this, SLOT(clear()));
|
||||
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateClearButton(const QString&)));
|
||||
|
||||
#if QT_VERSION < 0x040700
|
||||
//#if QT_VERSION < 0x040700
|
||||
#if QT_VERSION < 0x050000//PlaceHolder text only shown when not have focus in Qt4
|
||||
mFilterLabel = new QLabel("", this);
|
||||
mFilterLabel->setStyleSheet("QLabel { color: gray; }");
|
||||
#endif
|
||||
|
@ -72,15 +74,17 @@ void LineEditClear::resizeEvent(QResizeEvent *)
|
|||
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
mClearButton->move(rect().right() - frameWidth - sz.width() + 2, (rect().bottom() - sz.height()) / 2 + 2);
|
||||
|
||||
#if QT_VERSION < 0x040700
|
||||
//#if QT_VERSION < 0x040700
|
||||
#if QT_VERSION < 0x050000//PlaceHolder text only shown when not have focus in Qt4
|
||||
sz = mFilterLabel->sizeHint();
|
||||
mFilterLabel->move(frameWidth + (mFilterButton ? mFilterButton->sizeHint().width() + 5 : 0), (rect().bottom() + 1 - sz.height())/2);
|
||||
mFilterLabel->move(frameWidth + (mFilterButton ? mFilterButton->sizeHint().width() + 5 : 5), (rect().bottom() + 1 - sz.height())/2);
|
||||
#endif
|
||||
}
|
||||
|
||||
void LineEditClear::setPlaceholderText(const QString &text)
|
||||
{
|
||||
#if QT_VERSION < 0x040700
|
||||
//#if QT_VERSION < 0x040700
|
||||
#if QT_VERSION < 0x050000//PlaceHolder text only shown when not have focus in Qt4
|
||||
mFilterLabel->setText(text);
|
||||
#else
|
||||
QLineEdit::setPlaceholderText(text);
|
||||
|
@ -89,7 +93,8 @@ void LineEditClear::setPlaceholderText(const QString &text)
|
|||
setToolTip(text);
|
||||
}
|
||||
|
||||
#if QT_VERSION < 0x040700
|
||||
//#if QT_VERSION < 0x040700
|
||||
#if 0//PlaceHolder text only shown when not have focus in Qt4
|
||||
void LineEditClear::focusInEvent(QFocusEvent *event)
|
||||
{
|
||||
mFilterLabel->setVisible(false);
|
||||
|
@ -137,6 +142,9 @@ void LineEditClear::showFilterIcon()
|
|||
void LineEditClear::updateClearButton(const QString& text)
|
||||
{
|
||||
mClearButton->setVisible(!text.isEmpty());
|
||||
#if QT_VERSION < 0x050000//PlaceHolder text only shown when not have focus in Qt4
|
||||
mFilterLabel->setVisible(text.isEmpty());
|
||||
#endif
|
||||
}
|
||||
|
||||
void LineEditClear::addFilter(const QIcon &icon, const QString &text, int id, const QString &description)
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
|
||||
class QToolButton;
|
||||
class QActionGroup;
|
||||
#if QT_VERSION < 0x040700
|
||||
//#if QT_VERSION < 0x040700
|
||||
#if QT_VERSION < 0x050000//PlaceHolder text only shown when not have focus in Qt4
|
||||
class QLabel;
|
||||
#endif
|
||||
|
||||
|
@ -55,7 +56,8 @@ signals:
|
|||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *);
|
||||
#if QT_VERSION < 0x040700
|
||||
//#if QT_VERSION < 0x040700
|
||||
#if 0//PlaceHolder text only shown when not have focus in Qt4
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
#endif
|
||||
|
@ -72,7 +74,8 @@ private:
|
|||
QActionGroup *mActionGroup;
|
||||
QMap<int, QString> mDescription;
|
||||
|
||||
#if QT_VERSION < 0x040700
|
||||
//#if QT_VERSION < 0x040700
|
||||
#if QT_VERSION < 0x050000//PlaceHolder text only shown when not have focus in Qt4
|
||||
QLabel *mFilterLabel;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -42,6 +42,7 @@ MimeTextEdit::MimeTextEdit(QWidget *parent)
|
|||
mCompleterKey = Qt::Key_Space;
|
||||
mForceCompleterShowNextKeyEvent = false;
|
||||
highliter = new RsSyntaxHighlighter(this);
|
||||
mOnlyPlainText = false;
|
||||
}
|
||||
|
||||
bool MimeTextEdit::canInsertFromMimeData(const QMimeData* source) const
|
||||
|
@ -77,6 +78,7 @@ void MimeTextEdit::insertFromMimeData(const QMimeData* source)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
if (source == NULL) return;
|
||||
|
||||
//insert retroshare links
|
||||
QList<RetroShareLink> links;
|
||||
|
@ -84,7 +86,10 @@ void MimeTextEdit::insertFromMimeData(const QMimeData* source)
|
|||
if(links.size() > 0)
|
||||
{
|
||||
for(int i = 0; i < links.size(); ++i)
|
||||
insertHtml(links[i].toHtml() + "<br>");
|
||||
if (mOnlyPlainText)
|
||||
insertPlainText(links[i].toString());
|
||||
else
|
||||
insertHtml(links[i].toHtml() + "<br>");
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -270,10 +275,10 @@ void MimeTextEdit::pasteLink()
|
|||
|
||||
void MimeTextEdit::pasteOwnCertificateLink()
|
||||
{
|
||||
RetroShareLink link;
|
||||
RsPeerId ownId = rsPeers->getOwnId();
|
||||
RetroShareLink link = RetroShareLink::createCertificate(ownId);
|
||||
|
||||
if (link.createCertificate(ownId)) {
|
||||
if (link.valid()) {
|
||||
insertHtml(link.toHtml() + " ");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,9 +48,11 @@ public:
|
|||
void addContextMenuAction(QAction *action);
|
||||
|
||||
QColor textColorQuote() const { return highliter->textColorQuote();}
|
||||
bool onlyPlainText() const {return mOnlyPlainText;}
|
||||
|
||||
public slots:
|
||||
void setTextColorQuote(QColor textColorQuote) { highliter->setTextColorQuote(textColorQuote);}
|
||||
void setOnlyPlainText(bool bOnlyPlainText) {mOnlyPlainText = bOnlyPlainText;}
|
||||
|
||||
signals:
|
||||
void calculateContextMenuActions();
|
||||
|
@ -80,6 +82,7 @@ private:
|
|||
QString mCompleterStartString;
|
||||
QList<QAction*> mContextMenuActions;
|
||||
RsSyntaxHighlighter *highliter;
|
||||
bool mOnlyPlainText;
|
||||
};
|
||||
|
||||
#endif // MIMETEXTEDIT_H
|
||||
|
|
|
@ -59,6 +59,7 @@ RSGraphSource::RSGraphSource()
|
|||
#endif
|
||||
_timer = new QTimer ;
|
||||
_digits = 2 ;
|
||||
_filtering_enabled = true;
|
||||
|
||||
QObject::connect(_timer,SIGNAL(timeout()),this,SLOT(updateIfPossible())) ;
|
||||
}
|
||||
|
@ -99,6 +100,11 @@ QString RSGraphSource::displayValue(float v) const
|
|||
return QString::number(v,'f',_digits) + " " + unitName() ;
|
||||
}
|
||||
|
||||
void RSGraphSource::getCumulatedValues(std::vector<float>& vals) const
|
||||
{
|
||||
for(std::map<std::string,float>::const_iterator it = _totals.begin();it!=_totals.end();++it)
|
||||
vals.push_back(it->second) ;
|
||||
}
|
||||
void RSGraphSource::getCurrentValues(std::vector<QPointF>& vals) const
|
||||
{
|
||||
std::map<std::string,std::list<std::pair<qint64,float> > >::const_iterator it = _points.begin();
|
||||
|
@ -108,9 +114,9 @@ void RSGraphSource::getCurrentValues(std::vector<QPointF>& vals) const
|
|||
vals.push_back(QPointF( (now - it->second.back().first)/1000.0f,it->second.back().second)) ;
|
||||
}
|
||||
|
||||
QString RSGraphSource::legend(int i,float v) const
|
||||
QString RSGraphSource::legend(int i,float v,bool show_value) const
|
||||
{
|
||||
return displayName(i) + " (" + displayValue(v) + " )";
|
||||
return displayName(i) + (show_value?(" (" + displayValue(v) + ")"):"");
|
||||
}
|
||||
|
||||
void RSGraphSource::getDataPoints(int index,std::vector<QPointF>& pts,float filter_factor) const
|
||||
|
@ -118,6 +124,9 @@ void RSGraphSource::getDataPoints(int index,std::vector<QPointF>& pts,float filt
|
|||
pts.clear() ;
|
||||
qint64 now = getTime() ;
|
||||
|
||||
if(!_filtering_enabled)
|
||||
filter_factor = 0 ;
|
||||
|
||||
std::map<std::string,std::list<std::pair<qint64,float> > >::const_iterator it = _points.begin();
|
||||
|
||||
int n=0;
|
||||
|
@ -209,11 +218,30 @@ void RSGraphSource::update()
|
|||
}
|
||||
else
|
||||
++it ;
|
||||
|
||||
updateTotals();
|
||||
}
|
||||
|
||||
void RSGraphSource::updateTotals()
|
||||
{
|
||||
// now compute totals
|
||||
|
||||
_totals.clear();
|
||||
|
||||
for(std::map<std::string,std::list<std::pair<qint64,float> > >::const_iterator it(_points.begin());it!=_points.end();++it)
|
||||
{
|
||||
float& f = _totals[it->first] ;
|
||||
|
||||
f = 0.0f ;
|
||||
for(std::list<std::pair<qint64,float> >::const_iterator it2=it->second.begin();it2!=it->second.end();++it2)
|
||||
f += (*it2).second ;
|
||||
}
|
||||
}
|
||||
|
||||
void RSGraphSource::reset()
|
||||
{
|
||||
_points.clear() ;
|
||||
_points.clear();
|
||||
_totals.clear();
|
||||
}
|
||||
|
||||
void RSGraphSource::setCollectionTimeLimit(qint64 s) { _time_limit_msecs = s ; }
|
||||
|
@ -235,6 +263,7 @@ RSGraphWidget::RSGraphWidget(QWidget *parent)
|
|||
_maxPoints = getNumPoints();
|
||||
_maxValue = MINUSER_SCALE;
|
||||
|
||||
_linewidthscale = 1.0f;
|
||||
_opacity = 0.6 ;
|
||||
_flags = 0;
|
||||
_time_scale = 5.0f ; // in pixels per second.
|
||||
|
@ -242,11 +271,13 @@ RSGraphWidget::RSGraphWidget(QWidget *parent)
|
|||
_timer = new QTimer ;
|
||||
QObject::connect(_timer,SIGNAL(timeout()),this,SLOT(updateIfPossible())) ;
|
||||
|
||||
|
||||
_y_scale = 1.0f ;
|
||||
_timer->start(1000);
|
||||
|
||||
float FS = QFontMetricsF(font()).height();
|
||||
setMinimumHeight(12*FS);
|
||||
_graph_base = FS*GRAPH_BASE;
|
||||
}
|
||||
|
||||
void RSGraphWidget::updateIfPossible()
|
||||
|
@ -267,7 +298,13 @@ RSGraphWidget::~RSGraphWidget()
|
|||
delete _source ;
|
||||
}
|
||||
|
||||
/** Gets the width of the desktop, which is the maximum number of points
|
||||
void RSGraphWidget::setFiltering(bool b)
|
||||
{
|
||||
if(_source != NULL)
|
||||
_source->setFiltering(b) ;
|
||||
}
|
||||
|
||||
/** Gets the width of the desktop, which is the maximum number of points
|
||||
* we can plot in the graph. */
|
||||
int
|
||||
RSGraphWidget::getNumPoints()
|
||||
|
@ -286,15 +323,6 @@ RSGraphWidget::resetGraph()
|
|||
updateIfPossible();
|
||||
}
|
||||
|
||||
/** Toggles display of respective graph lines and counters. */
|
||||
//void
|
||||
//DhtGraph::setShowCounters(bool showRSDHT, bool showALLDHT)
|
||||
//{
|
||||
// _showRSDHT = showRSDHT;
|
||||
// _showALLDHT = showALLDHT;
|
||||
// this->update();
|
||||
//}
|
||||
|
||||
/** Overloads default QWidget::paintEvent. Draws the actual
|
||||
* bandwidth graph. */
|
||||
void RSGraphWidget::paintEvent(QPaintEvent *)
|
||||
|
@ -317,9 +345,11 @@ void RSGraphWidget::paintEvent(QPaintEvent *)
|
|||
|
||||
/* Paint the scale */
|
||||
paintScale1();
|
||||
/* Plot the rsDHT/allDHT data */
|
||||
|
||||
/* Plot the data */
|
||||
paintData();
|
||||
/* Paint the rsDHT/allDHT totals */
|
||||
|
||||
/* Paint the totals */
|
||||
paintTotals();
|
||||
|
||||
// part of the scale that needs to write over the data curves.
|
||||
|
@ -332,28 +362,32 @@ void RSGraphWidget::paintEvent(QPaintEvent *)
|
|||
_painter->end();
|
||||
}
|
||||
|
||||
QSizeF RSGraphWidget::sizeHint(Qt::SizeHint which, const QSizeF& /* constraint */) const
|
||||
{
|
||||
float FS = QFontMetricsF(font()).height();
|
||||
//float fact = FS/14.0 ;
|
||||
//QSizeF RSGraphWidget::sizeHint(Qt::SizeHint which, const QSizeF& /* constraint */) const
|
||||
//{
|
||||
// float FS = QFontMetricsF(font()).height();
|
||||
// //float fact = FS/14.0 ;
|
||||
//
|
||||
// switch(which)
|
||||
// {
|
||||
//default:
|
||||
// case Qt::MinimumSize:
|
||||
// case Qt::PreferredSize:
|
||||
// return QSizeF(70*FS,12*FS);
|
||||
// case Qt::MaximumSize:
|
||||
// return QSizeF(700*FS,120*FS);
|
||||
// }
|
||||
//}
|
||||
|
||||
switch(which)
|
||||
{
|
||||
default:
|
||||
case Qt::MinimumSize:
|
||||
case Qt::PreferredSize:
|
||||
return QSizeF(70*FS,12*FS);
|
||||
case Qt::MaximumSize:
|
||||
return QSizeF(700*FS,120*FS);
|
||||
}
|
||||
}
|
||||
|
||||
QColor RSGraphWidget::getColor(int i)
|
||||
QColor RSGraphWidget::getColor(const std::string& name)
|
||||
{
|
||||
uint32_t r = 57 ;
|
||||
for(uint32_t i=0;i<name.length();++i)
|
||||
r = (113*name[i] + r)^0x93859aeb;
|
||||
|
||||
// shuffle the colors a little bit
|
||||
int h = (i*86243)%359 ;
|
||||
int h = (r*86243)%359 ;
|
||||
|
||||
return QColor::fromHsv(h,128+127*(i&1),255) ;
|
||||
return QColor::fromHsv(h,255,255) ;
|
||||
}
|
||||
|
||||
void RSGraphWidget::setCurvesOpacity(float f)
|
||||
|
@ -384,18 +418,26 @@ void RSGraphWidget::paintData()
|
|||
QVector<QPointF> points ;
|
||||
pointsFromData(values,points) ;
|
||||
|
||||
/* Plot the bandwidth data as area graphs */
|
||||
if (_flags & RSGRAPH_FLAGS_PAINT_STYLE_PLAIN)
|
||||
paintIntegral(points, getColor(i), _opacity);
|
||||
QColor pcolor = getColor(source.displayName(i).toStdString()) ;
|
||||
|
||||
/* Plot the bandwidth as solid lines. If the graph style is currently an
|
||||
* area graph, we end up outlining the integrals. */
|
||||
paintLine(points, getColor(i));
|
||||
/* Plot the bandwidth as solid lines. If the graph style is currently an area graph, we end up outlining the integrals. */
|
||||
|
||||
if(_flags & RSGRAPH_FLAGS_PAINT_STYLE_DOTS)
|
||||
paintDots(points, pcolor);
|
||||
else
|
||||
paintLine(points, pcolor);
|
||||
|
||||
/* Plot the data as area graphs */
|
||||
|
||||
points.push_front(QPointF( _rec.width(), _rec.height() - _graph_base)) ; // add a point in the lower right corner, to close the path.
|
||||
|
||||
if (_flags & RSGRAPH_FLAGS_PAINT_STYLE_PLAIN)
|
||||
paintIntegral(points, pcolor, _opacity);
|
||||
}
|
||||
if(_maxValue > 0.0f)
|
||||
{
|
||||
if(_flags & RSGRAPH_FLAGS_LOG_SCALE_Y)
|
||||
_y_scale = _rec.height()*0.8 / log(_maxValue) ;
|
||||
_y_scale = _rec.height()*0.8 / log(std::max((qreal)2.0,(qreal)_maxValue)) ;
|
||||
else
|
||||
_y_scale = _rec.height()*0.8/_maxValue ;
|
||||
}
|
||||
|
@ -436,43 +478,44 @@ void RSGraphWidget::pointsFromData(const std::vector<QPointF>& values,QVector<QP
|
|||
qreal px = x - (values[i].x()-last)*_time_scale ;
|
||||
qreal py = y - valueToPixels(values[i].y()) ;
|
||||
|
||||
if(px >= SCALE_WIDTH*fact && last_px < SCALE_WIDTH*fact)
|
||||
if(!(_flags & RSGRAPH_FLAGS_PAINT_STYLE_DOTS))
|
||||
{
|
||||
float alpha = (SCALE_WIDTH*fact - last_px)/(px - last_px) ;
|
||||
float ipx = SCALE_WIDTH*fact ;
|
||||
float ipy = (1-alpha)*last_py + alpha*py ;
|
||||
if(px >= SCALE_WIDTH*fact && last_px < SCALE_WIDTH*fact)
|
||||
{
|
||||
float alpha = (SCALE_WIDTH*fact - last_px)/(px - last_px) ;
|
||||
float ipx = SCALE_WIDTH*fact ;
|
||||
float ipy = (1-alpha)*last_py + alpha*py ;
|
||||
|
||||
points << QPointF(ipx,y) ;
|
||||
points << QPointF(ipx,ipy) ;
|
||||
}
|
||||
else if(i==0)
|
||||
{
|
||||
if(px < SCALE_WIDTH*fact)
|
||||
points << QPointF(SCALE_WIDTH*fact,py) ;
|
||||
else
|
||||
points << QPointF(px,y) ;
|
||||
points << QPointF(ipx,y - _graph_base) ;
|
||||
points << QPointF(ipx,ipy) ;
|
||||
}
|
||||
else if(i==0)
|
||||
{
|
||||
if(px < SCALE_WIDTH*fact)
|
||||
points << QPointF(SCALE_WIDTH*fact,py) ;
|
||||
else
|
||||
points << QPointF(px,y - _graph_base) ;
|
||||
}
|
||||
}
|
||||
|
||||
if(px < SCALE_WIDTH*fact)
|
||||
continue ;
|
||||
|
||||
if((_flags & RSGRAPH_FLAGS_PAINT_STYLE_DOTS) && values[i].y() == 0)
|
||||
continue ;
|
||||
|
||||
_maxValue = std::max(_maxValue,values[i].y()) ;
|
||||
|
||||
// remove midle point when 3 consecutive points have the same value.
|
||||
|
||||
if(points.size() > 1 && points[points.size()-2].y() == points.back().y() && points.back().y() == py)
|
||||
points.pop_back() ;
|
||||
|
||||
// if(fabs(px - last_px)/_time_scale > min_x_no_data_threshold)
|
||||
// {
|
||||
// points << QPointF(last_px,y) ;
|
||||
// points << QPointF(px,y) ;
|
||||
// }
|
||||
if(!(_flags & RSGRAPH_FLAGS_PAINT_STYLE_DOTS))
|
||||
if(points.size() > 1 && points[points.size()-2].y() == points.back().y() && points.back().y() == py)
|
||||
points.pop_back() ;
|
||||
|
||||
points << QPointF(px,py) ;
|
||||
|
||||
if(i==values.size()-1)
|
||||
points << QPointF(px,y) ;
|
||||
if(!(_flags & RSGRAPH_FLAGS_PAINT_STYLE_DOTS) && (i==values.size()-1))
|
||||
points << QPointF(px,py) ;
|
||||
|
||||
last_px = px ;
|
||||
last_py = py ;
|
||||
|
@ -483,17 +526,17 @@ void RSGraphWidget::pointsFromData(const std::vector<QPointF>& values,QVector<QP
|
|||
qreal RSGraphWidget::valueToPixels(qreal val)
|
||||
{
|
||||
if(_flags & RSGRAPH_FLAGS_LOG_SCALE_Y)
|
||||
return log(std::max((qreal)1.0,val))*_y_scale ;
|
||||
return _graph_base + log(std::max((qreal)1.0,val))*_y_scale ;
|
||||
else
|
||||
return val*_y_scale ;
|
||||
return _graph_base + val*_y_scale ;
|
||||
}
|
||||
|
||||
qreal RSGraphWidget::pixelsToValue(qreal val)
|
||||
{
|
||||
if(_flags & RSGRAPH_FLAGS_LOG_SCALE_Y)
|
||||
return exp(val / _y_scale) ;
|
||||
return exp( (val - _graph_base) / _y_scale) ;
|
||||
else
|
||||
return val/_y_scale ;
|
||||
return (val - _graph_base)/_y_scale ;
|
||||
}
|
||||
|
||||
/** Plots an integral using the data points in <b>points</b>. The area will be
|
||||
|
@ -515,11 +558,27 @@ void RSGraphWidget::paintLine(const QVector<QPointF>& points, QColor color, Qt::
|
|||
{
|
||||
/* Save the current brush, plot the line, and restore the old brush */
|
||||
QPen oldPen = _painter->pen();
|
||||
_painter->setPen(QPen(color, lineStyle));
|
||||
|
||||
QPen newPen(color, lineStyle);
|
||||
newPen.setWidth(2.0f*_linewidthscale);
|
||||
_painter->setPen(newPen);
|
||||
_painter->drawPolyline(points.data(), points.size());
|
||||
_painter->setPen(oldPen);
|
||||
}
|
||||
void RSGraphWidget::paintDots(const QVector<QPointF>& points, QColor color)
|
||||
{
|
||||
/* Save the current brush, plot the line, and restore the old brush */
|
||||
QPen oldPen = _painter->pen();
|
||||
_painter->setPen(QPen(color, oldPen.style()));
|
||||
QBrush oldBrush = _painter->brush();
|
||||
_painter->setBrush(QBrush(color));
|
||||
|
||||
for(int i=0;i<points.size();++i)
|
||||
_painter->drawEllipse(QRect(points[i].x()-2.5*_linewidthscale,points[i].y()-2.5*_linewidthscale,5*_linewidthscale,5*_linewidthscale)) ;
|
||||
|
||||
_painter->setPen(oldPen);
|
||||
_painter->setBrush(oldBrush);
|
||||
}
|
||||
/** Paints selected total indicators on the graph. */
|
||||
void RSGraphWidget::paintTotals()
|
||||
{
|
||||
|
@ -558,8 +617,8 @@ void RSGraphWidget::paintScale1()
|
|||
float fact = FS/14.0 ;
|
||||
|
||||
int top = _rec.y();
|
||||
int bottom = _rec.height();
|
||||
qreal paintStep = (bottom - (bottom/10)) / 4;
|
||||
int bottom = _rec.height() - _graph_base;
|
||||
qreal paintStep = (bottom - top) / 5;
|
||||
|
||||
/* Draw the other marks in their correctly scaled locations */
|
||||
qreal scale;
|
||||
|
@ -570,16 +629,23 @@ void RSGraphWidget::paintScale1()
|
|||
|
||||
QString unit_name = _source->unitName() ;
|
||||
|
||||
for (int i = 1; i < 5; i++)
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
pos = bottom - (i * paintStep);
|
||||
pos = bottom - (i * paintStep) ;
|
||||
|
||||
scale = pixelsToValue(i * paintStep);
|
||||
scale = pixelsToValue(_graph_base + i * paintStep);
|
||||
|
||||
// If legend contains integers only the value should be rounded to the nearest integer
|
||||
if(_flags & RSGRAPH_FLAGS_LEGEND_INTEGER)
|
||||
{
|
||||
scale = (int)scale ;
|
||||
pos = bottom - (valueToPixels(scale) - _graph_base) ;
|
||||
}
|
||||
|
||||
QString text = _source->displayValue(scale) ;
|
||||
|
||||
_painter->setPen(SCALE_COLOR);
|
||||
_painter->drawText(QPointF(5*fact, pos+0.5*FS), text);
|
||||
_painter->drawText(QPointF(SCALE_WIDTH*fact - QFontMetricsF(font()).width(text) - 4*fact, pos+0.4*FS), text);
|
||||
_painter->setPen(GRID_COLOR);
|
||||
_painter->drawLine(QPointF(SCALE_WIDTH*fact, pos), QPointF(_rec.width(), pos));
|
||||
}
|
||||
|
@ -617,6 +683,11 @@ void RSGraphWidget::wheelEvent(QWheelEvent *e)
|
|||
_time_filter *= 1.1 ;
|
||||
else
|
||||
_time_filter /= 1.1 ;
|
||||
else if(e->modifiers() & Qt::ControlModifier)
|
||||
if(e->delta() > 0)
|
||||
_linewidthscale *= 1.2 ;
|
||||
else
|
||||
_linewidthscale /= 1.2 ;
|
||||
else
|
||||
if(e->delta() > 0)
|
||||
_time_scale *= 1.1 ;
|
||||
|
@ -630,8 +701,19 @@ void RSGraphWidget::paintLegend()
|
|||
{
|
||||
//int bottom = _rec.height();
|
||||
|
||||
std::vector<QPointF> vals ;
|
||||
_source->getCurrentValues(vals) ;
|
||||
std::vector<float> vals ;
|
||||
|
||||
if(_flags & RSGRAPH_FLAGS_LEGEND_CUMULATED)
|
||||
_source->getCumulatedValues(vals) ;
|
||||
else
|
||||
{
|
||||
std::vector<QPointF> cvals ;
|
||||
_source->getCurrentValues(cvals) ;
|
||||
|
||||
for(uint32_t i=0;i<cvals.size();++i)
|
||||
vals.push_back(cvals[i].y()) ;
|
||||
}
|
||||
|
||||
int j=0;
|
||||
|
||||
float FS = QFontMetricsF(font()).height();
|
||||
|
@ -640,15 +722,20 @@ void RSGraphWidget::paintLegend()
|
|||
for(uint i=0;i<vals.size();++i)
|
||||
if( _masked_entries.find(_source->displayName(i).toStdString()) == _masked_entries.end() )
|
||||
{
|
||||
if( _rec.width() - (vals[i].x()-0)*_time_scale < SCALE_WIDTH*fact )
|
||||
continue ;
|
||||
// if( _rec.width() - (vals[i].x()-0)*_time_scale < SCALE_WIDTH*fact )
|
||||
// continue ;
|
||||
|
||||
qreal paintStep = 4*fact+FS;
|
||||
qreal pos = 15*fact+j*paintStep;
|
||||
QString text = _source->legend(i,vals[i].y()) ;
|
||||
|
||||
QString text = _source->legend(i,vals[i]) ;
|
||||
|
||||
QPen oldPen = _painter->pen();
|
||||
_painter->setPen(QPen(getColor(i), Qt::SolidLine));
|
||||
|
||||
QPen pen(getColor(_source->displayName(i).toStdString()), Qt::SolidLine) ;
|
||||
pen.setWidth(_linewidthscale);
|
||||
|
||||
_painter->setPen(pen);
|
||||
_painter->drawLine(QPointF(SCALE_WIDTH*fact+10.0*fact, pos+FS/3), QPointF(SCALE_WIDTH*fact+30.0*fact, pos+FS/3));
|
||||
_painter->setPen(oldPen);
|
||||
|
||||
|
|
|
@ -32,8 +32,9 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#define GRAPH_BASE 2 /** Position of the 0 of the scale, in count of the text height */
|
||||
#define SCALE_WIDTH 75 /** Width of the scale */
|
||||
#define MINUSER_SCALE 2000 /** 2000 users is the minimum scale */
|
||||
#define MINUSER_SCALE 2000 /** 2000 users is the minimum scale */
|
||||
#define SCROLL_STEP 4 /** Horizontal change on graph update */
|
||||
|
||||
#define BACK_COLOR Qt::white
|
||||
|
@ -69,8 +70,11 @@ public:
|
|||
// return the vector of last values up to date
|
||||
virtual void getCurrentValues(std::vector<QPointF>& vals) const ;
|
||||
|
||||
// return the vector of cumulated values up to date
|
||||
virtual void getCumulatedValues(std::vector<float>& vals) const;
|
||||
|
||||
// returns what to display in the legend. Derive this to show additional info.
|
||||
virtual QString legend(int i,float v) const ;
|
||||
virtual QString legend(int i, float v, bool show_value=true) const ;
|
||||
|
||||
// Returns the n^th interpolated value at the given time in floating point seconds backward.
|
||||
virtual void getDataPoints(int index, std::vector<QPointF>& pts, float filter_factor=0.0f) const ;
|
||||
|
@ -84,6 +88,9 @@ public:
|
|||
// Sets the time period for collecting new values. Units=milliseconds.
|
||||
void setCollectionTimePeriod(qint64 msecs) ;
|
||||
|
||||
// Enables/disables time filtering of the data
|
||||
void setFiltering(bool b) { _filtering_enabled = b; }
|
||||
|
||||
void setDigits(int d) { _digits = d ;}
|
||||
|
||||
protected slots:
|
||||
|
@ -95,11 +102,13 @@ protected slots:
|
|||
protected:
|
||||
virtual void getValues(std::map<std::string,float>& values) const = 0 ;// overload this in your own class to fill in the values you want to display.
|
||||
|
||||
void updateTotals();
|
||||
qint64 getTime() const ; // returns time in ms since RS has started
|
||||
|
||||
// Storage of collected events. The string is any string used to represent the collected data.
|
||||
|
||||
std::map<std::string, std::list<std::pair<qint64,float> > > _points ;
|
||||
std::map<std::string, float> _totals ;
|
||||
|
||||
QTimer *_timer ;
|
||||
|
||||
|
@ -107,6 +116,7 @@ protected:
|
|||
qint64 _update_period_msecs ;
|
||||
qint64 _time_orig_msecs ;
|
||||
int _digits ;
|
||||
bool _filtering_enabled ;
|
||||
};
|
||||
|
||||
class RSGraphWidget: public QFrame
|
||||
|
@ -118,8 +128,11 @@ public:
|
|||
static const uint32_t RSGRAPH_FLAGS_LOG_SCALE_Y = 0x0002 ;// log scale in Y
|
||||
static const uint32_t RSGRAPH_FLAGS_ALWAYS_COLLECT = 0x0004 ;// keep collecting while not displayed
|
||||
static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_PLAIN = 0x0008 ;// use plain / line drawing style
|
||||
static const uint32_t RSGRAPH_FLAGS_SHOW_LEGEND = 0x0010 ;// show legend in the graph
|
||||
static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_FLAT = 0x0020 ;// do not interpolate, and draw flat colored boxes
|
||||
static const uint32_t RSGRAPH_FLAGS_SHOW_LEGEND = 0x0010 ;// show legend in the graph
|
||||
static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_FLAT = 0x0020 ;// do not interpolate, and draw flat colored boxes
|
||||
static const uint32_t RSGRAPH_FLAGS_LEGEND_CUMULATED = 0x0040 ;// show the total in the legend rather than current values
|
||||
static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_DOTS = 0x0080 ;// use dots
|
||||
static const uint32_t RSGRAPH_FLAGS_LEGEND_INTEGER = 0x0100 ;// use integer number in the legend, and move the lines to match integers
|
||||
|
||||
/** Bandwidth graph style. */
|
||||
enum GraphStyle
|
||||
|
@ -149,13 +162,16 @@ public:
|
|||
void setShowEntry(uint32_t entry, bool show) ;
|
||||
void setCurvesOpacity(float f) ;
|
||||
|
||||
void setFiltering(bool b) ;
|
||||
|
||||
void setFlags(uint32_t flag) { _flags |= flag ; }
|
||||
void resetFlags(uint32_t flag) { _flags &= ~flag ; }
|
||||
protected:
|
||||
/** Overloaded QWidget::paintEvent() */
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
virtual QSizeF sizeHint( Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const;
|
||||
//QSize QFrame::sizeHint() const;
|
||||
// virtual QSizeF sizeHint( Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const;
|
||||
|
||||
protected slots:
|
||||
void updateIfPossible() ;
|
||||
|
@ -176,7 +192,7 @@ private:
|
|||
void paintScale1();
|
||||
void paintScale2();
|
||||
|
||||
QColor getColor(int i) ;
|
||||
QColor getColor(const std::string &name) ;
|
||||
|
||||
/** Returns a formatted string representation of total. */
|
||||
QString totalToStr(qreal total);
|
||||
|
@ -185,8 +201,11 @@ private:
|
|||
void pointsFromData(const std::vector<QPointF>& values, QVector<QPointF> &points ) ;
|
||||
|
||||
/** Paints a line with the data in <b>points</b>. */
|
||||
void paintLine(const QVector<QPointF>& points, QColor color,
|
||||
Qt::PenStyle lineStyle = Qt::SolidLine);
|
||||
void paintLine(const QVector<QPointF>& points, QColor color, Qt::PenStyle lineStyle = Qt::SolidLine);
|
||||
|
||||
/** Paint a series of large dots **/
|
||||
void paintDots(const QVector<QPointF>& points, QColor color);
|
||||
|
||||
/** Paints an integral using the supplied data. */
|
||||
void paintIntegral(const QVector<QPointF>& points, QColor color, qreal alpha = 1.0);
|
||||
|
||||
|
@ -199,6 +218,7 @@ private:
|
|||
/** The maximum number of points to store. */
|
||||
qreal _y_scale ;
|
||||
qreal _opacity ;
|
||||
qreal _graph_base;
|
||||
|
||||
qreal pixelsToValue(qreal) ;
|
||||
qreal valueToPixels(qreal) ;
|
||||
|
@ -208,6 +228,7 @@ private:
|
|||
|
||||
qreal _time_scale ; // horizontal scale in pixels per sec.
|
||||
qreal _time_filter ; // time filter. Goes from 0 to infinity. Will be converted into 1-1/(1+f)
|
||||
float _linewidthscale ;
|
||||
|
||||
/** Show the respective lines and counters. */
|
||||
//bool _showRSDHT;
|
||||
|
|
|
@ -144,11 +144,12 @@ void RsBanListToolButton::applyIp()
|
|||
|
||||
uint32_t list_type;
|
||||
switch (mList) {
|
||||
case LIST_WHITELIST:
|
||||
list_type = RSBANLIST_TYPE_WHITELIST;
|
||||
case LIST_BLACKLIST:
|
||||
list_type = RSBANLIST_TYPE_BLACKLIST;
|
||||
break;
|
||||
case LIST_BLACKLIST:
|
||||
list_type = RSBANLIST_TYPE_BLACKLIST;
|
||||
case LIST_WHITELIST:
|
||||
default:
|
||||
list_type = RSBANLIST_TYPE_WHITELIST;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -156,11 +157,12 @@ void RsBanListToolButton::applyIp()
|
|||
bool changed = false;
|
||||
|
||||
switch (mMode) {
|
||||
case MODE_ADD:
|
||||
changed = rsBanList->addIpRange(addr, masked_bytes, list_type, "");
|
||||
case MODE_REMOVE:
|
||||
changed = rsBanList->removeIpRange(addr, masked_bytes, list_type);
|
||||
break;
|
||||
case MODE_REMOVE:
|
||||
changed = rsBanList->removeIpRange(addr, masked_bytes, list_type);
|
||||
case MODE_ADD:
|
||||
default:
|
||||
changed = rsBanList->addIpRange(addr, masked_bytes, list_type, "");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ void UserNotify::initialize(QToolBar *mainToolBar, QAction *mainAction, QListWid
|
|||
}
|
||||
}
|
||||
mListItem = listItem;
|
||||
if (mListItem && !mMainAction) {
|
||||
if (mListItem && mMainAction) {
|
||||
mButtonText = mMainAction->text();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,11 +76,20 @@ RWindow::restoreWindowState()
|
|||
m_bSaveStateOnClose = true; // now we save the window state on close
|
||||
|
||||
#if QT_VERSION >= 0x040200
|
||||
QByteArray geometry = getSetting("Geometry", QByteArray()).toByteArray();
|
||||
if (geometry.isEmpty())
|
||||
QByteArray geo = getSetting("Geometry", QByteArray()).toByteArray();
|
||||
if (geo.isEmpty())
|
||||
{
|
||||
adjustSize();
|
||||
QRect rect = geometry();
|
||||
int h = fontMetrics().height()*40;
|
||||
if (rect.height()<h)
|
||||
{
|
||||
rect.setHeight(h);
|
||||
setGeometry(rect);
|
||||
}
|
||||
}
|
||||
else
|
||||
restoreGeometry(geometry);
|
||||
restoreGeometry(geo);
|
||||
#else
|
||||
QRect screen = QDesktopWidget().availableGeometry();
|
||||
|
||||
|
|
|
@ -142,11 +142,9 @@ void ConfCertDialog::load()
|
|||
ui.headerFrame->setHeaderText(nameAndLocation);
|
||||
|
||||
|
||||
RetroShareLink link;
|
||||
link.createPerson(detail.gpg_id);
|
||||
|
||||
ui.pgpfingerprint->setText(link.toHtml());
|
||||
ui.pgpfingerprint->setToolTip(link.title());
|
||||
RetroShareLink link = RetroShareLink::createPerson(detail.gpg_id);
|
||||
ui.pgpfingerprint->setText(link.toHtml());
|
||||
ui.pgpfingerprint->setToolTip(link.title());
|
||||
|
||||
ui.avatar->setId(ChatId(peerId));
|
||||
|
||||
|
@ -239,9 +237,9 @@ void ConfCertDialog::load()
|
|||
ui.version->show();
|
||||
ui.label_version->show();
|
||||
|
||||
ui.groupBox->show();
|
||||
//ui.groupBox->show();
|
||||
ui.groupBox_4->show();
|
||||
ui.tabWidget->show();
|
||||
//ui.tabWidget->show();
|
||||
//ui.rsid->hide();
|
||||
//ui.label_rsid->hide();
|
||||
ui.pgpfingerprint->show();
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>722</width>
|
||||
<height>651</height>
|
||||
<width>1104</width>
|
||||
<height>1086</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -69,7 +69,7 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="stabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="icon">
|
||||
|
@ -85,7 +85,7 @@
|
|||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Friend info</string>
|
||||
<string>Node info:</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="3" column="1">
|
||||
|
@ -249,6 +249,114 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Current address:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_12">
|
||||
<item row="1" column="3">
|
||||
<widget class="QSpinBox" name="localPort">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>7812</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="dynDNS"/>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QSpinBox" name="extPort">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>7812</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="l_dynDNS">
|
||||
<property name="text">
|
||||
<string>Dynamic DNS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="localAddress"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="l_extAddress">
|
||||
<property name="text">
|
||||
<string>External Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="extAddress"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="l_portExternal">
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="l_portLocal">
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="l_localAddress">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Local Address</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>List of known addresses:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QListWidget" name="ipAddressList">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::DefaultContextMenu</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -264,170 +372,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/kcmsystem24.png</normaloff>:/images/kcmsystem24.png</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Connectivity</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_15">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<attribute name="title">
|
||||
<string>Peer Addresses</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Peer Address</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>47</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>47</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="l_localAddress">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Local Address</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="localAddress"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="l_extAddress">
|
||||
<property name="text">
|
||||
<string>External Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="extAddress"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="l_dynDNS">
|
||||
<property name="text">
|
||||
<string>Dynamic DNS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="dynDNS"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="l_portLocal">
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="l_portExternal">
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QSpinBox" name="localPort">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>7812</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QSpinBox" name="extPort">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>7812</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_6">
|
||||
<attribute name="title">
|
||||
<string>Addresses list</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_9">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Addresses list</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QListWidget" name="ipAddressList">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::DefaultContextMenu</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Retroshare Certificate</string>
|
||||
|
|
|
@ -19,13 +19,15 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include <QUrl>
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QCheckBox>
|
||||
#include <QClipboard>
|
||||
#include <QDesktopServices>
|
||||
#include <QFileDialog>
|
||||
#include <QTextStream>
|
||||
#include <QLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QTextCodec>
|
||||
#include <QTextStream>
|
||||
#include <QUrl>
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
#include <QUrlQuery>
|
||||
|
@ -107,7 +109,7 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
|
|||
ui->foffRadioButton->hide();
|
||||
ui->rsidRadioButton->hide();
|
||||
|
||||
ui->fr_label->hide();
|
||||
ui->cp_Label->hide();
|
||||
ui->requestinfolabel->hide();
|
||||
|
||||
connect(ui->acceptNoSignGPGCheckBox,SIGNAL(toggled(bool)), ui->_options_GB,SLOT(setEnabled(bool))) ;
|
||||
|
@ -135,7 +137,7 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
|
|||
else
|
||||
{
|
||||
ui->userFrame->hide(); // certificates page - top half with own cert and it's functions
|
||||
ui->horizontalLayout_13->hide(); // Advanced options - key sign, whitelist, direct source ...
|
||||
ui->cp_Frame->hide(); // Advanced options - key sign, whitelist, direct source ...
|
||||
AdvancedVisible=false;
|
||||
ui->trustLabel->hide();
|
||||
ui->trustEdit->hide();
|
||||
|
@ -145,7 +147,25 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
|
|||
rsPeers->getPeerCount (&friendCount, &onlineCount, false);
|
||||
if(friendCount<30)
|
||||
ui->makefriend_infolabel->hide();
|
||||
|
||||
|
||||
//Add warning to direct source checkbox depends general setting.
|
||||
switch (rsFiles->filePermDirectDL())
|
||||
{
|
||||
case RS_FILE_PERM_DIRECT_DL_YES:
|
||||
ui->_direct_transfer_CB->setIcon(QIcon(":/icons/warning_yellow_128.png"));
|
||||
ui->_direct_transfer_CB->setToolTip(ui->_direct_transfer_CB->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to Yes.")));
|
||||
ui->_direct_transfer_CB_2->setIcon(QIcon(":/icons/warning_yellow_128.png"));
|
||||
ui->_direct_transfer_CB_2->setToolTip(ui->_direct_transfer_CB_2->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to Yes.")));
|
||||
break ;
|
||||
case RS_FILE_PERM_DIRECT_DL_NO:
|
||||
ui->_direct_transfer_CB->setIcon(QIcon(":/icons/warning_yellow_128.png"));
|
||||
ui->_direct_transfer_CB->setToolTip(ui->_direct_transfer_CB->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to No.")));
|
||||
ui->_direct_transfer_CB_2->setIcon(QIcon(":/icons/warning_yellow_128.png"));
|
||||
ui->_direct_transfer_CB_2->setToolTip(ui->_direct_transfer_CB_2->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to No.")));
|
||||
break ;
|
||||
|
||||
default: break ;
|
||||
}
|
||||
updateStylesheet();
|
||||
}
|
||||
|
||||
|
@ -279,7 +299,7 @@ void ConnectFriendWizard::setCertificate(const QString &certificate, bool friend
|
|||
//setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion);
|
||||
setStartId(Page_Conclusion);
|
||||
if (friendRequest){
|
||||
ui->fr_label->show();
|
||||
ui->cp_Label->show();
|
||||
ui->requestinfolabel->show();
|
||||
setTitleText(ui->ConclusionPage, tr("Friend request"));
|
||||
ui->ConclusionPage->setSubTitle(tr("Details about the request"));
|
||||
|
@ -305,7 +325,7 @@ void ConnectFriendWizard::setGpgId(const RsPgpId &gpgId, const RsPeerId &sslId,
|
|||
//setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion);
|
||||
setStartId(Page_Conclusion);
|
||||
if (friendRequest){
|
||||
ui->fr_label->show();
|
||||
ui->cp_Label->show();
|
||||
ui->requestinfolabel->show();
|
||||
setTitleText(ui->ConclusionPage,tr("Friend request"));
|
||||
ui->ConclusionPage->setSubTitle(tr("Details about the request"));
|
||||
|
@ -345,6 +365,7 @@ void ConnectFriendWizard::initializePage(int id)
|
|||
connect(ui->userCertOldFormatButton, SIGNAL(clicked()), this, SLOT(toggleFormatState()));
|
||||
connect(ui->userCertCopyButton, SIGNAL(clicked()), this, SLOT(copyCert()));
|
||||
connect(ui->userCertPasteButton, SIGNAL(clicked()), this, SLOT(pasteCert()));
|
||||
connect(ui->userCertOpenButton, SIGNAL(clicked()), this, SLOT(openCert()));
|
||||
connect(ui->userCertSaveButton, SIGNAL(clicked()), this, SLOT(saveCert()));
|
||||
connect(ui->userCertMailButton, SIGNAL(clicked()), this, SLOT(runEmailClient()));
|
||||
connect(ui->friendCertEdit, SIGNAL(textChanged()), this, SLOT(friendCertChanged()));
|
||||
|
@ -519,7 +540,7 @@ void ConnectFriendWizard::initializePage(int id)
|
|||
}
|
||||
}
|
||||
|
||||
ui->fr_label->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str()));
|
||||
ui->cp_Label->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str()));
|
||||
ui->nameEdit->setText(QString::fromUtf8(peerDetails.name.c_str()));
|
||||
ui->trustEdit->setText(trustString);
|
||||
ui->emailEdit->setText(QString::fromUtf8(peerDetails.email.c_str()));
|
||||
|
@ -618,7 +639,7 @@ void ConnectFriendWizard::initializePage(int id)
|
|||
|
||||
ui->fr_nodeEdit->setText(loc);
|
||||
|
||||
ui->fr_label_3->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str()));
|
||||
ui->fr_InfoTopLabel->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str()));
|
||||
|
||||
fillGroups(this, ui->fr_groupComboBox, groupId);
|
||||
}
|
||||
|
@ -1077,6 +1098,22 @@ void ConnectFriendWizard::pasteCert()
|
|||
ui->friendCertEdit->setPlainText(clipboard->text());
|
||||
}
|
||||
|
||||
void ConnectFriendWizard::openCert()
|
||||
{
|
||||
QString fileName ;
|
||||
if(!misc::getOpenFileName(this, RshareSettings::LASTDIR_CERT, tr("Select Certificate"), tr("RetroShare Certificate (*.rsc );;All Files (*)"),fileName))
|
||||
return ;
|
||||
|
||||
if (!fileName.isNull()) {
|
||||
QFile fileCert(fileName);
|
||||
if (fileCert.open(QIODevice::ReadOnly )) {
|
||||
QByteArray arrayCert(fileCert.readAll());
|
||||
ui->friendCertEdit->setPlainText(QString::fromUtf8(arrayCert));
|
||||
fileCert.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectFriendWizard::saveCert()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as..."), "", tr("RetroShare Certificate (*.rsc );;All Files (*)"));
|
||||
|
@ -1328,13 +1365,13 @@ void ConnectFriendWizard::toggleAdvanced()
|
|||
{
|
||||
if(AdvancedVisible)
|
||||
{
|
||||
ui->horizontalLayout_13->hide();
|
||||
ui->cp_Frame->hide();
|
||||
ui->toggleadvancedButton->setText("Show advanced options");
|
||||
AdvancedVisible=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->horizontalLayout_13->show();
|
||||
ui->cp_Frame->show();
|
||||
ui->toggleadvancedButton->setText("Hide advanced options");
|
||||
AdvancedVisible=true;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ private slots:
|
|||
void showHelpUserCert();
|
||||
void copyCert();
|
||||
void pasteCert();
|
||||
void openCert();
|
||||
void saveCert();
|
||||
void friendCertChanged();
|
||||
void cleanFriendCert();
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<attribute name="pageId">
|
||||
<string notr="true">ConnectFriendWizard::Page_Intro</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="IntroPageVLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="textRadioButton">
|
||||
<property name="text">
|
||||
|
@ -90,12 +90,12 @@
|
|||
<attribute name="pageId">
|
||||
<string notr="true">ConnectFriendWizard::Page_Text</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<layout class="QVBoxLayout" name="TextPageVLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="userFrame">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<layout class="QGridLayout" name="userFrameGLayout">
|
||||
<item row="1" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="userCertButtonVLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="userCertHelpButton">
|
||||
<property name="sizePolicy">
|
||||
|
@ -235,7 +235,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<spacer name="userCertButtonVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -279,7 +279,7 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="friendFrame">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<layout class="QGridLayout" name="friendFrameGLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QToolButton" name="userCertPasteButton">
|
||||
<property name="sizePolicy">
|
||||
|
@ -316,6 +316,41 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QToolButton" name="userCertOpenButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>20</horstretch>
|
||||
<verstretch>20</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open Cert of your friend from File</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open certificate</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/svg/filesharing.svg</normaloff>:/icons/svg/filesharing.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="friendCertCleanLabel">
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/accepted16.png</pixmap>
|
||||
|
@ -325,7 +360,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="RSPlainTextEdit" name="friendCertEdit">
|
||||
<property name="font">
|
||||
<font>
|
||||
|
@ -361,7 +396,7 @@
|
|||
<attribute name="pageId">
|
||||
<string notr="true">ConnectFriendWizard::Page_Cert</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<layout class="QVBoxLayout" name="CertificatePageVLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="userFileFrame">
|
||||
<property name="title">
|
||||
|
@ -370,7 +405,7 @@
|
|||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<layout class="QHBoxLayout" name="userFileFrameHLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="userFileLabel">
|
||||
<property name="text">
|
||||
|
@ -399,7 +434,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<layout class="QHBoxLayout" name="friendFileNameHLayout">
|
||||
<item>
|
||||
<widget class="DropLineEdit" name="friendFileNameEdit"/>
|
||||
</item>
|
||||
|
@ -424,9 +459,9 @@
|
|||
<attribute name="pageId">
|
||||
<string notr="true">ConnectFriendWizard::Page_Foff</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<layout class="QVBoxLayout" name="FofPageVLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="userFileLabel_2">
|
||||
<widget class="QLabel" name="userSelectionLabel">
|
||||
<property name="text">
|
||||
<string>Show me:</string>
|
||||
</property>
|
||||
|
@ -471,7 +506,7 @@
|
|||
<attribute name="pageId">
|
||||
<string notr="true">ConnectFriendWizard::Page_Rsid</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<layout class="QVBoxLayout" name="RsidPageVLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="userRsidFrame">
|
||||
<property name="title">
|
||||
|
@ -480,7 +515,7 @@
|
|||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8"/>
|
||||
<layout class="QVBoxLayout" name="userRsidFrameVLayout"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -499,7 +534,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWizardPage" name="WebmalPage">
|
||||
<widget class="QWizardPage" name="WebmailPage">
|
||||
<property name="title">
|
||||
<string>RetroShare is better with Friends </string>
|
||||
</property>
|
||||
|
@ -509,9 +544,9 @@
|
|||
<attribute name="pageId">
|
||||
<string notr="true">ConnectFriendWizard::Page_WebMail</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="WebmalPageGLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<layout class="QHBoxLayout" name="webMailButtonHLayout">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
|
@ -525,7 +560,7 @@
|
|||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<spacer name="webMailButtonLHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -658,7 +693,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="webMailButtonRHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -676,37 +711,7 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_6">
|
||||
<spacer name="WebmailPageVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -730,9 +735,9 @@
|
|||
<attribute name="pageId">
|
||||
<string notr="true">ConnectFriendWizard::Page_Email</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<layout class="QVBoxLayout" name="EmailPageVLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<layout class="QHBoxLayout" name="addressHLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="addressLabel">
|
||||
<property name="text">
|
||||
|
@ -750,7 +755,7 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<layout class="QHBoxLayout" name="subjectHLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="subjectLabel">
|
||||
<property name="text">
|
||||
|
@ -782,7 +787,7 @@
|
|||
<attribute name="pageId">
|
||||
<string notr="true">ConnectFriendWizard::Page_FriendRequest</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||
<layout class="QVBoxLayout" name="FriendRequestPageVLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
|
@ -790,10 +795,10 @@
|
|||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<widget class="QFrame" name="fr_Frame">
|
||||
<layout class="QVBoxLayout" name="fr_FrameVLayout">
|
||||
<item>
|
||||
<widget class="StyledLabel" name="fr_label_3">
|
||||
<widget class="StyledLabel" name="fr_InfoTopLabel">
|
||||
<property name="text">
|
||||
<string notr="true">You have a friend request from</string>
|
||||
</property>
|
||||
|
@ -822,7 +827,7 @@
|
|||
<property name="title">
|
||||
<string>Peer details</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<layout class="QFormLayout" name="fr_peerDetailsFrameGLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
|
@ -874,15 +879,15 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="fr_optionslLayout">
|
||||
<layout class="QHBoxLayout" name="fr_optionsHLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="fr_optionsFrame">
|
||||
<property name="title">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||
<layout class="QVBoxLayout" name="fr_optionsFrameVLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="fr_groupLayout">
|
||||
<layout class="QHBoxLayout" name="fr_groupHLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="fr_groupLabel">
|
||||
<property name="sizePolicy">
|
||||
|
@ -926,11 +931,11 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<widget class="QGroupBox" name="fr_RVBox">
|
||||
<property name="title">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
<layout class="QVBoxLayout" name="fr_RVBoxVLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_direct_transfer_CB">
|
||||
<property name="text">
|
||||
|
@ -953,7 +958,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<spacer name="fr_RVBoxVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -974,14 +979,14 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="StyledLabel" name="requestinfolabel_3">
|
||||
<widget class="StyledLabel" name="fr_InfoBottomLabel">
|
||||
<property name="text">
|
||||
<string>To accept the Friend Request, click the Finish button.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="fr_verticalSpacer">
|
||||
<spacer name="fr_VSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -1005,7 +1010,7 @@
|
|||
<attribute name="pageId">
|
||||
<string notr="true">ConnectFriendWizard::Page_ErrorMessage</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<layout class="QVBoxLayout" name="ErrorMessagePageVLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="messageLabel">
|
||||
<property name="text">
|
||||
|
@ -1025,7 +1030,7 @@
|
|||
<attribute name="pageId">
|
||||
<string notr="true">ConnectFriendWizard::Page_Conclusion</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_17">
|
||||
<layout class="QVBoxLayout" name="ConclusionPageVLayout">
|
||||
<item>
|
||||
<widget class="StyledLabel" name="makefriend_infolabel">
|
||||
<property name="palette">
|
||||
|
@ -1108,7 +1113,7 @@ resources.</string>
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="StyledLabel" name="fr_label">
|
||||
<widget class="StyledLabel" name="cp_Label">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
|
@ -1195,7 +1200,7 @@ resources.</string>
|
|||
<property name="title">
|
||||
<string>Peer details</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<layout class="QFormLayout" name="peerDetailsFrameGLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
|
@ -1307,13 +1312,13 @@ resources.</string>
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="horizontalLayout_13">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<widget class="QFrame" name="cp_Frame">
|
||||
<layout class="QHBoxLayout" name="cp_FrameHLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_18">
|
||||
<layout class="QVBoxLayout" name="cp_KeyVLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="addKeyToKeyring_CB">
|
||||
<property name="text">
|
||||
|
@ -1339,7 +1344,7 @@ resources.</string>
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<layout class="QHBoxLayout" name="cp_AddIPHLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_addIPToWhiteList_CB_2">
|
||||
<property name="text">
|
||||
|
@ -1353,7 +1358,7 @@ resources.</string>
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<layout class="QHBoxLayout" name="cp_GroupHLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="groupLabel">
|
||||
<property name="text">
|
||||
|
@ -1369,7 +1374,7 @@ resources.</string>
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_19">
|
||||
<layout class="QVBoxLayout" name="cp_OptionVLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="_options_GB">
|
||||
<property name="title">
|
||||
|
@ -1410,7 +1415,7 @@ resources.</string>
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<spacer name="cp_OptionVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -1508,7 +1513,7 @@ resources.</string>
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<spacer name="ConclusionPageVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -1532,9 +1537,9 @@ resources.</string>
|
|||
<attribute name="pageId">
|
||||
<string notr="true">ConnectFriendWizard::Page_FriendRecommendations</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||
<layout class="QVBoxLayout" name="FriendRecommendationsPageVLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<layout class="QHBoxLayout" name="frec_HLayout">
|
||||
<item>
|
||||
<widget class="FriendSelectionWidget" name="frec_recommendList" native="true">
|
||||
<property name="sizePolicy">
|
||||
|
|
|
@ -152,6 +152,20 @@ void PGPKeyDialog::load()
|
|||
ui.pgpfingerprint_label->show();
|
||||
|
||||
ui._direct_transfer_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_DIRECT_DL ) ;
|
||||
//Add warning to direct source checkbox depends general setting.
|
||||
switch (rsFiles->filePermDirectDL())
|
||||
{
|
||||
case RS_FILE_PERM_DIRECT_DL_YES:
|
||||
ui._direct_transfer_CB->setIcon(QIcon(":/icons/warning_yellow_128.png"));
|
||||
ui._direct_transfer_CB->setToolTip(ui._direct_transfer_CB->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to Yes.")));
|
||||
break ;
|
||||
case RS_FILE_PERM_DIRECT_DL_NO:
|
||||
ui._direct_transfer_CB->setIcon(QIcon(":/icons/warning_yellow_128.png"));
|
||||
ui._direct_transfer_CB->setToolTip(ui._direct_transfer_CB->toolTip().append(tr("\nWarning: In your File-Transfer option, you select allow direct download to No.")));
|
||||
break ;
|
||||
|
||||
default: break ;
|
||||
}
|
||||
ui._allow_push_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_ALLOW_PUSH) ;
|
||||
ui._require_WL_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_REQUIRE_WL) ;
|
||||
|
||||
|
@ -253,7 +267,7 @@ void PGPKeyDialog::load()
|
|||
RetroShareLink link ;
|
||||
|
||||
for(std::list<RsPgpId>::const_iterator it(detail.gpgSigners.begin());it!=detail.gpgSigners.end();++it) {
|
||||
link.createPerson(*it);
|
||||
link = RetroShareLink::createPerson(*it);
|
||||
if (link.valid()) {
|
||||
text += link.toHtml() + "<BR>";
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
static const double Pi = 3.14159265358979323846264338327950288419717;
|
||||
//static const double Pi = 3.14159265358979323846264338327950288419717;
|
||||
|
||||
Edge::Edge(Node *sourceNode, Node *destNode)
|
||||
: arrowSize(10)
|
||||
|
|
831
retroshare-gui/src/gui/elastic/fft.h
Normal file
831
retroshare-gui/src/gui/elastic/fft.h
Normal file
|
@ -0,0 +1,831 @@
|
|||
/******************************************************************
|
||||
|
||||
Original FFT code Credits:
|
||||
Copyright Takuya OOURA, 1996-2001
|
||||
http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html
|
||||
|
||||
******************************************************************/
|
||||
|
||||
/*
|
||||
Fast Fourier/Cosine/Sine Transform
|
||||
dimension :two
|
||||
data length :power of 2
|
||||
decimation :frequency
|
||||
radix :4, 2, row-column
|
||||
data :inplace
|
||||
table :use
|
||||
functions
|
||||
cdft2d: Complex Discrete Fourier Transform
|
||||
rdft2d: Real Discrete Fourier Transform
|
||||
ddct2d: Discrete Cosine Transform
|
||||
ddst2d: Discrete Sine Transform
|
||||
function prototypes
|
||||
void cdft2d(int, int, int, double **, int *, double *);
|
||||
void rdft2d(int, int, int, double **, int *, double *);
|
||||
void ddct2d(int, int, int, double **, double **, int *, double *);
|
||||
void ddst2d(int, int, int, double **, double **, int *, double *);
|
||||
|
||||
|
||||
-------- Complex DFT (Discrete Fourier Transform) --------
|
||||
[definition]
|
||||
<case1>
|
||||
X[k1][k2] = sum_j1=0^n1-1 sum_j2=0^n2-1 x[j1][j2] *
|
||||
exp(2*pi*i*j1*k1/n1) *
|
||||
exp(2*pi*i*j2*k2/n2), 0<=k1<n1, 0<=k2<n2
|
||||
<case2>
|
||||
X[k1][k2] = sum_j1=0^n1-1 sum_j2=0^n2-1 x[j1][j2] *
|
||||
exp(-2*pi*i*j1*k1/n1) *
|
||||
exp(-2*pi*i*j2*k2/n2), 0<=k1<n1, 0<=k2<n2
|
||||
(notes: sum_j=0^n-1 is a summation from j=0 to n-1)
|
||||
[usage]
|
||||
<case1>
|
||||
ip[0] = 0; // first time only
|
||||
cdft2d(n1, 2*n2, 1, a, ip, w);
|
||||
<case2>
|
||||
ip[0] = 0; // first time only
|
||||
cdft2d(n1, 2*n2, -1, a, ip, w);
|
||||
[parameters]
|
||||
n1 :data length (int)
|
||||
n1 >= 1, n1 = power of 2
|
||||
2*n2 :data length (int)
|
||||
n2 >= 1, n2 = power of 2
|
||||
a[0...n1-1][0...2*n2-1]
|
||||
:input/output data (double **)
|
||||
input data
|
||||
a[j1][2*j2] = Re(x[j1][j2]),
|
||||
a[j1][2*j2+1] = Im(x[j1][j2]),
|
||||
0<=j1<n1, 0<=j2<n2
|
||||
output data
|
||||
a[k1][2*k2] = Re(X[k1][k2]),
|
||||
a[k1][2*k2+1] = Im(X[k1][k2]),
|
||||
0<=k1<n1, 0<=k2<n2
|
||||
ip[0...*]
|
||||
:work area for bit reversal (int *)
|
||||
length of ip >= 2+sqrt(n)
|
||||
(n = max(n1, n2))
|
||||
ip[0],ip[1] are pointers of the cos/sin table.
|
||||
w[0...*]
|
||||
:cos/sin table (double *)
|
||||
length of w >= max(n1/2, n2/2)
|
||||
w[],ip[] are initialized if ip[0] == 0.
|
||||
[remark]
|
||||
Inverse of
|
||||
cdft2d(n1, 2*n2, -1, a, ip, w);
|
||||
is
|
||||
cdft2d(n1, 2*n2, 1, a, ip, w);
|
||||
for (j1 = 0; j1 <= n1 - 1; j1++) {
|
||||
for (j2 = 0; j2 <= 2 * n2 - 1; j2++) {
|
||||
a[j1][j2] *= 1.0 / (n1 * n2);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* -------- initializing routines -------- */
|
||||
|
||||
#pragma once
|
||||
#include <math.h>
|
||||
|
||||
class fft
|
||||
{
|
||||
public:
|
||||
static void makewt(int nw, int *ip, double *w)
|
||||
{
|
||||
int nwh, j;
|
||||
double delta, x, y;
|
||||
|
||||
ip[0] = nw;
|
||||
ip[1] = 1;
|
||||
if (nw > 2) {
|
||||
nwh = nw >> 1;
|
||||
delta = atan(1.0) / nwh;
|
||||
w[0] = 1;
|
||||
w[1] = 0;
|
||||
w[nwh] = cos(delta * nwh);
|
||||
w[nwh + 1] = w[nwh];
|
||||
for (j = 2; j <= nwh - 2; j += 2) {
|
||||
#ifdef __APPLE__
|
||||
__sincos(delta*j,&y,&x);
|
||||
#else
|
||||
sincos(delta*j,&y,&x) ;
|
||||
#endif
|
||||
//x = cos(delta * j);
|
||||
//y = sin(delta * j);
|
||||
w[j] = x;
|
||||
w[j + 1] = y;
|
||||
w[nw - j] = y;
|
||||
w[nw - j + 1] = x;
|
||||
}
|
||||
bitrv2(nw, ip + 2, w);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------- child routines -------- */
|
||||
|
||||
|
||||
static void bitrv2(int n, int *ip, double *a)
|
||||
{
|
||||
int j, j1, k, k1, l, m, m2;
|
||||
double xr, xi;
|
||||
|
||||
ip[0] = 0;
|
||||
l = n;
|
||||
m = 1;
|
||||
while ((m << 2) < l) {
|
||||
l >>= 1;
|
||||
for (j = 0; j <= m - 1; j++) {
|
||||
ip[m + j] = ip[j] + l;
|
||||
}
|
||||
m <<= 1;
|
||||
}
|
||||
if ((m << 2) > l) {
|
||||
for (k = 1; k <= m - 1; k++) {
|
||||
for (j = 0; j <= k - 1; j++) {
|
||||
j1 = (j << 1) + ip[k];
|
||||
k1 = (k << 1) + ip[j];
|
||||
xr = a[j1];
|
||||
xi = a[j1 + 1];
|
||||
a[j1] = a[k1];
|
||||
a[j1 + 1] = a[k1 + 1];
|
||||
a[k1] = xr;
|
||||
a[k1 + 1] = xi;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m2 = m << 1;
|
||||
for (k = 1; k <= m - 1; k++) {
|
||||
for (j = 0; j <= k - 1; j++) {
|
||||
j1 = (j << 1) + ip[k];
|
||||
k1 = (k << 1) + ip[j];
|
||||
xr = a[j1];
|
||||
xi = a[j1 + 1];
|
||||
a[j1] = a[k1];
|
||||
a[j1 + 1] = a[k1 + 1];
|
||||
a[k1] = xr;
|
||||
a[k1 + 1] = xi;
|
||||
j1 += m2;
|
||||
k1 += m2;
|
||||
xr = a[j1];
|
||||
xi = a[j1 + 1];
|
||||
a[j1] = a[k1];
|
||||
a[j1 + 1] = a[k1 + 1];
|
||||
a[k1] = xr;
|
||||
a[k1 + 1] = xi;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void bitrv2col(int n1, int n, int *ip, double **a)
|
||||
{
|
||||
int i, j, j1, k, k1, l, m, m2;
|
||||
double xr, xi;
|
||||
|
||||
ip[0] = 0;
|
||||
l = n;
|
||||
m = 1;
|
||||
while ((m << 2) < l) {
|
||||
l >>= 1;
|
||||
for (j = 0; j <= m - 1; j++) {
|
||||
ip[m + j] = ip[j] + l;
|
||||
}
|
||||
m <<= 1;
|
||||
}
|
||||
if ((m << 2) > l) {
|
||||
for (i = 0; i <= n1 - 1; i++) {
|
||||
for (k = 1; k <= m - 1; k++) {
|
||||
for (j = 0; j <= k - 1; j++) {
|
||||
j1 = (j << 1) + ip[k];
|
||||
k1 = (k << 1) + ip[j];
|
||||
xr = a[i][j1];
|
||||
xi = a[i][j1 + 1];
|
||||
a[i][j1] = a[i][k1];
|
||||
a[i][j1 + 1] = a[i][k1 + 1];
|
||||
a[i][k1] = xr;
|
||||
a[i][k1 + 1] = xi;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m2 = m << 1;
|
||||
for (i = 0; i <= n1 - 1; i++) {
|
||||
for (k = 1; k <= m - 1; k++) {
|
||||
for (j = 0; j <= k - 1; j++) {
|
||||
j1 = (j << 1) + ip[k];
|
||||
k1 = (k << 1) + ip[j];
|
||||
xr = a[i][j1];
|
||||
xi = a[i][j1 + 1];
|
||||
a[i][j1] = a[i][k1];
|
||||
a[i][j1 + 1] = a[i][k1 + 1];
|
||||
a[i][k1] = xr;
|
||||
a[i][k1 + 1] = xi;
|
||||
j1 += m2;
|
||||
k1 += m2;
|
||||
xr = a[i][j1];
|
||||
xi = a[i][j1 + 1];
|
||||
a[i][j1] = a[i][k1];
|
||||
a[i][j1 + 1] = a[i][k1 + 1];
|
||||
a[i][k1] = xr;
|
||||
a[i][k1 + 1] = xi;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void bitrv2row(int n, int n2, int *ip, double **a)
|
||||
{
|
||||
int i, j, j1, k, k1, l, m;
|
||||
double xr, xi;
|
||||
|
||||
ip[0] = 0;
|
||||
l = n;
|
||||
m = 1;
|
||||
while ((m << 1) < l) {
|
||||
l >>= 1;
|
||||
for (j = 0; j <= m - 1; j++) {
|
||||
ip[m + j] = ip[j] + l;
|
||||
}
|
||||
m <<= 1;
|
||||
}
|
||||
if ((m << 1) > l) {
|
||||
for (k = 1; k <= m - 1; k++) {
|
||||
for (j = 0; j <= k - 1; j++) {
|
||||
j1 = j + ip[k];
|
||||
k1 = k + ip[j];
|
||||
for (i = 0; i <= n2 - 2; i += 2) {
|
||||
xr = a[j1][i];
|
||||
xi = a[j1][i + 1];
|
||||
a[j1][i] = a[k1][i];
|
||||
a[j1][i + 1] = a[k1][i + 1];
|
||||
a[k1][i] = xr;
|
||||
a[k1][i + 1] = xi;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (k = 1; k <= m - 1; k++) {
|
||||
for (j = 0; j <= k - 1; j++) {
|
||||
j1 = j + ip[k];
|
||||
k1 = k + ip[j];
|
||||
for (i = 0; i <= n2 - 2; i += 2) {
|
||||
xr = a[j1][i];
|
||||
xi = a[j1][i + 1];
|
||||
a[j1][i] = a[k1][i];
|
||||
a[j1][i + 1] = a[k1][i + 1];
|
||||
a[k1][i] = xr;
|
||||
a[k1][i + 1] = xi;
|
||||
}
|
||||
j1 += m;
|
||||
k1 += m;
|
||||
for (i = 0; i <= n2 - 2; i += 2) {
|
||||
xr = a[j1][i];
|
||||
xi = a[j1][i + 1];
|
||||
a[j1][i] = a[k1][i];
|
||||
a[j1][i + 1] = a[k1][i + 1];
|
||||
a[k1][i] = xr;
|
||||
a[k1][i + 1] = xi;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void cftbcol(int n1, int n, double **a, double *w)
|
||||
{
|
||||
int i, j, j1, j2, j3, k, k1, ks, l, m;
|
||||
double wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
|
||||
double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
|
||||
|
||||
for (i = 0; i <= n1 - 1; i++) {
|
||||
l = 2;
|
||||
while ((l << 1) < n) {
|
||||
m = l << 2;
|
||||
for (j = 0; j <= l - 2; j += 2) {
|
||||
j1 = j + l;
|
||||
j2 = j1 + l;
|
||||
j3 = j2 + l;
|
||||
x0r = a[i][j] + a[i][j1];
|
||||
x0i = a[i][j + 1] + a[i][j1 + 1];
|
||||
x1r = a[i][j] - a[i][j1];
|
||||
x1i = a[i][j + 1] - a[i][j1 + 1];
|
||||
x2r = a[i][j2] + a[i][j3];
|
||||
x2i = a[i][j2 + 1] + a[i][j3 + 1];
|
||||
x3r = a[i][j2] - a[i][j3];
|
||||
x3i = a[i][j2 + 1] - a[i][j3 + 1];
|
||||
a[i][j] = x0r + x2r;
|
||||
a[i][j + 1] = x0i + x2i;
|
||||
a[i][j2] = x0r - x2r;
|
||||
a[i][j2 + 1] = x0i - x2i;
|
||||
a[i][j1] = x1r - x3i;
|
||||
a[i][j1 + 1] = x1i + x3r;
|
||||
a[i][j3] = x1r + x3i;
|
||||
a[i][j3 + 1] = x1i - x3r;
|
||||
}
|
||||
if (m < n) {
|
||||
wk1r = w[2];
|
||||
for (j = m; j <= l + m - 2; j += 2) {
|
||||
j1 = j + l;
|
||||
j2 = j1 + l;
|
||||
j3 = j2 + l;
|
||||
x0r = a[i][j] + a[i][j1];
|
||||
x0i = a[i][j + 1] + a[i][j1 + 1];
|
||||
x1r = a[i][j] - a[i][j1];
|
||||
x1i = a[i][j + 1] - a[i][j1 + 1];
|
||||
x2r = a[i][j2] + a[i][j3];
|
||||
x2i = a[i][j2 + 1] + a[i][j3 + 1];
|
||||
x3r = a[i][j2] - a[i][j3];
|
||||
x3i = a[i][j2 + 1] - a[i][j3 + 1];
|
||||
a[i][j] = x0r + x2r;
|
||||
a[i][j + 1] = x0i + x2i;
|
||||
a[i][j2] = x2i - x0i;
|
||||
a[i][j2 + 1] = x0r - x2r;
|
||||
x0r = x1r - x3i;
|
||||
x0i = x1i + x3r;
|
||||
a[i][j1] = wk1r * (x0r - x0i);
|
||||
a[i][j1 + 1] = wk1r * (x0r + x0i);
|
||||
x0r = x3i + x1r;
|
||||
x0i = x3r - x1i;
|
||||
a[i][j3] = wk1r * (x0i - x0r);
|
||||
a[i][j3 + 1] = wk1r * (x0i + x0r);
|
||||
}
|
||||
k1 = 1;
|
||||
ks = -1;
|
||||
for (k = (m << 1); k <= n - m; k += m) {
|
||||
k1++;
|
||||
ks = -ks;
|
||||
wk1r = w[k1 << 1];
|
||||
wk1i = w[(k1 << 1) + 1];
|
||||
wk2r = ks * w[k1];
|
||||
wk2i = w[k1 + ks];
|
||||
wk3r = wk1r - 2 * wk2i * wk1i;
|
||||
wk3i = 2 * wk2i * wk1r - wk1i;
|
||||
for (j = k; j <= l + k - 2; j += 2) {
|
||||
j1 = j + l;
|
||||
j2 = j1 + l;
|
||||
j3 = j2 + l;
|
||||
x0r = a[i][j] + a[i][j1];
|
||||
x0i = a[i][j + 1] + a[i][j1 + 1];
|
||||
x1r = a[i][j] - a[i][j1];
|
||||
x1i = a[i][j + 1] - a[i][j1 + 1];
|
||||
x2r = a[i][j2] + a[i][j3];
|
||||
x2i = a[i][j2 + 1] + a[i][j3 + 1];
|
||||
x3r = a[i][j2] - a[i][j3];
|
||||
x3i = a[i][j2 + 1] - a[i][j3 + 1];
|
||||
a[i][j] = x0r + x2r;
|
||||
a[i][j + 1] = x0i + x2i;
|
||||
x0r -= x2r;
|
||||
x0i -= x2i;
|
||||
a[i][j2] = wk2r * x0r - wk2i * x0i;
|
||||
a[i][j2 + 1] = wk2r * x0i + wk2i * x0r;
|
||||
x0r = x1r - x3i;
|
||||
x0i = x1i + x3r;
|
||||
a[i][j1] = wk1r * x0r - wk1i * x0i;
|
||||
a[i][j1 + 1] = wk1r * x0i + wk1i * x0r;
|
||||
x0r = x1r + x3i;
|
||||
x0i = x1i - x3r;
|
||||
a[i][j3] = wk3r * x0r - wk3i * x0i;
|
||||
a[i][j3 + 1] = wk3r * x0i + wk3i * x0r;
|
||||
}
|
||||
}
|
||||
}
|
||||
l = m;
|
||||
}
|
||||
if (l < n) {
|
||||
for (j = 0; j <= l - 2; j += 2) {
|
||||
j1 = j + l;
|
||||
x0r = a[i][j] - a[i][j1];
|
||||
x0i = a[i][j + 1] - a[i][j1 + 1];
|
||||
a[i][j] += a[i][j1];
|
||||
a[i][j + 1] += a[i][j1 + 1];
|
||||
a[i][j1] = x0r;
|
||||
a[i][j1 + 1] = x0i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void cftbrow(int n, int n2, double **a, double *w)
|
||||
{
|
||||
int i, j, j1, j2, j3, k, k1, ks, l, m;
|
||||
double wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
|
||||
double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
|
||||
|
||||
l = 1;
|
||||
while ((l << 1) < n) {
|
||||
m = l << 2;
|
||||
for (j = 0; j <= l - 1; j++) {
|
||||
j1 = j + l;
|
||||
j2 = j1 + l;
|
||||
j3 = j2 + l;
|
||||
for (i = 0; i <= n2 - 2; i += 2) {
|
||||
x0r = a[j][i] + a[j1][i];
|
||||
x0i = a[j][i + 1] + a[j1][i + 1];
|
||||
x1r = a[j][i] - a[j1][i];
|
||||
x1i = a[j][i + 1] - a[j1][i + 1];
|
||||
x2r = a[j2][i] + a[j3][i];
|
||||
x2i = a[j2][i + 1] + a[j3][i + 1];
|
||||
x3r = a[j2][i] - a[j3][i];
|
||||
x3i = a[j2][i + 1] - a[j3][i + 1];
|
||||
a[j][i] = x0r + x2r;
|
||||
a[j][i + 1] = x0i + x2i;
|
||||
a[j2][i] = x0r - x2r;
|
||||
a[j2][i + 1] = x0i - x2i;
|
||||
a[j1][i] = x1r - x3i;
|
||||
a[j1][i + 1] = x1i + x3r;
|
||||
a[j3][i] = x1r + x3i;
|
||||
a[j3][i + 1] = x1i - x3r;
|
||||
}
|
||||
}
|
||||
if (m < n) {
|
||||
wk1r = w[2];
|
||||
for (j = m; j <= l + m - 1; j++) {
|
||||
j1 = j + l;
|
||||
j2 = j1 + l;
|
||||
j3 = j2 + l;
|
||||
for (i = 0; i <= n2 - 2; i += 2) {
|
||||
x0r = a[j][i] + a[j1][i];
|
||||
x0i = a[j][i + 1] + a[j1][i + 1];
|
||||
x1r = a[j][i] - a[j1][i];
|
||||
x1i = a[j][i + 1] - a[j1][i + 1];
|
||||
x2r = a[j2][i] + a[j3][i];
|
||||
x2i = a[j2][i + 1] + a[j3][i + 1];
|
||||
x3r = a[j2][i] - a[j3][i];
|
||||
x3i = a[j2][i + 1] - a[j3][i + 1];
|
||||
a[j][i] = x0r + x2r;
|
||||
a[j][i + 1] = x0i + x2i;
|
||||
a[j2][i] = x2i - x0i;
|
||||
a[j2][i + 1] = x0r - x2r;
|
||||
x0r = x1r - x3i;
|
||||
x0i = x1i + x3r;
|
||||
a[j1][i] = wk1r * (x0r - x0i);
|
||||
a[j1][i + 1] = wk1r * (x0r + x0i);
|
||||
x0r = x3i + x1r;
|
||||
x0i = x3r - x1i;
|
||||
a[j3][i] = wk1r * (x0i - x0r);
|
||||
a[j3][i + 1] = wk1r * (x0i + x0r);
|
||||
}
|
||||
}
|
||||
k1 = 1;
|
||||
ks = -1;
|
||||
for (k = (m << 1); k <= n - m; k += m) {
|
||||
k1++;
|
||||
ks = -ks;
|
||||
wk1r = w[k1 << 1];
|
||||
wk1i = w[(k1 << 1) + 1];
|
||||
wk2r = ks * w[k1];
|
||||
wk2i = w[k1 + ks];
|
||||
wk3r = wk1r - 2 * wk2i * wk1i;
|
||||
wk3i = 2 * wk2i * wk1r - wk1i;
|
||||
for (j = k; j <= l + k - 1; j++) {
|
||||
j1 = j + l;
|
||||
j2 = j1 + l;
|
||||
j3 = j2 + l;
|
||||
for (i = 0; i <= n2 - 2; i += 2) {
|
||||
x0r = a[j][i] + a[j1][i];
|
||||
x0i = a[j][i + 1] + a[j1][i + 1];
|
||||
x1r = a[j][i] - a[j1][i];
|
||||
x1i = a[j][i + 1] - a[j1][i + 1];
|
||||
x2r = a[j2][i] + a[j3][i];
|
||||
x2i = a[j2][i + 1] + a[j3][i + 1];
|
||||
x3r = a[j2][i] - a[j3][i];
|
||||
x3i = a[j2][i + 1] - a[j3][i + 1];
|
||||
a[j][i] = x0r + x2r;
|
||||
a[j][i + 1] = x0i + x2i;
|
||||
x0r -= x2r;
|
||||
x0i -= x2i;
|
||||
a[j2][i] = wk2r * x0r - wk2i * x0i;
|
||||
a[j2][i + 1] = wk2r * x0i + wk2i * x0r;
|
||||
x0r = x1r - x3i;
|
||||
x0i = x1i + x3r;
|
||||
a[j1][i] = wk1r * x0r - wk1i * x0i;
|
||||
a[j1][i + 1] = wk1r * x0i + wk1i * x0r;
|
||||
x0r = x1r + x3i;
|
||||
x0i = x1i - x3r;
|
||||
a[j3][i] = wk3r * x0r - wk3i * x0i;
|
||||
a[j3][i + 1] = wk3r * x0i + wk3i * x0r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
l = m;
|
||||
}
|
||||
if (l < n) {
|
||||
for (j = 0; j <= l - 1; j++) {
|
||||
j1 = j + l;
|
||||
for (i = 0; i <= n2 - 2; i += 2) {
|
||||
x0r = a[j][i] - a[j1][i];
|
||||
x0i = a[j][i + 1] - a[j1][i + 1];
|
||||
a[j][i] += a[j1][i];
|
||||
a[j][i + 1] += a[j1][i + 1];
|
||||
a[j1][i] = x0r;
|
||||
a[j1][i + 1] = x0i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void cftfcol(int n1, int n, double **a, double *w)
|
||||
{
|
||||
int i, j, j1, j2, j3, k, k1, ks, l, m;
|
||||
double wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
|
||||
double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
|
||||
|
||||
for (i = 0; i <= n1 - 1; i++) {
|
||||
l = 2;
|
||||
while ((l << 1) < n) {
|
||||
m = l << 2;
|
||||
for (j = 0; j <= l - 2; j += 2) {
|
||||
j1 = j + l;
|
||||
j2 = j1 + l;
|
||||
j3 = j2 + l;
|
||||
x0r = a[i][j] + a[i][j1];
|
||||
x0i = a[i][j + 1] + a[i][j1 + 1];
|
||||
x1r = a[i][j] - a[i][j1];
|
||||
x1i = a[i][j + 1] - a[i][j1 + 1];
|
||||
x2r = a[i][j2] + a[i][j3];
|
||||
x2i = a[i][j2 + 1] + a[i][j3 + 1];
|
||||
x3r = a[i][j2] - a[i][j3];
|
||||
x3i = a[i][j2 + 1] - a[i][j3 + 1];
|
||||
a[i][j] = x0r + x2r;
|
||||
a[i][j + 1] = x0i + x2i;
|
||||
a[i][j2] = x0r - x2r;
|
||||
a[i][j2 + 1] = x0i - x2i;
|
||||
a[i][j1] = x1r + x3i;
|
||||
a[i][j1 + 1] = x1i - x3r;
|
||||
a[i][j3] = x1r - x3i;
|
||||
a[i][j3 + 1] = x1i + x3r;
|
||||
}
|
||||
if (m < n) {
|
||||
wk1r = w[2];
|
||||
for (j = m; j <= l + m - 2; j += 2) {
|
||||
j1 = j + l;
|
||||
j2 = j1 + l;
|
||||
j3 = j2 + l;
|
||||
x0r = a[i][j] + a[i][j1];
|
||||
x0i = a[i][j + 1] + a[i][j1 + 1];
|
||||
x1r = a[i][j] - a[i][j1];
|
||||
x1i = a[i][j + 1] - a[i][j1 + 1];
|
||||
x2r = a[i][j2] + a[i][j3];
|
||||
x2i = a[i][j2 + 1] + a[i][j3 + 1];
|
||||
x3r = a[i][j2] - a[i][j3];
|
||||
x3i = a[i][j2 + 1] - a[i][j3 + 1];
|
||||
a[i][j] = x0r + x2r;
|
||||
a[i][j + 1] = x0i + x2i;
|
||||
a[i][j2] = x0i - x2i;
|
||||
a[i][j2 + 1] = x2r - x0r;
|
||||
x0r = x1r + x3i;
|
||||
x0i = x1i - x3r;
|
||||
a[i][j1] = wk1r * (x0i + x0r);
|
||||
a[i][j1 + 1] = wk1r * (x0i - x0r);
|
||||
x0r = x3i - x1r;
|
||||
x0i = x3r + x1i;
|
||||
a[i][j3] = wk1r * (x0r + x0i);
|
||||
a[i][j3 + 1] = wk1r * (x0r - x0i);
|
||||
}
|
||||
k1 = 1;
|
||||
ks = -1;
|
||||
for (k = (m << 1); k <= n - m; k += m) {
|
||||
k1++;
|
||||
ks = -ks;
|
||||
wk1r = w[k1 << 1];
|
||||
wk1i = w[(k1 << 1) + 1];
|
||||
wk2r = ks * w[k1];
|
||||
wk2i = w[k1 + ks];
|
||||
wk3r = wk1r - 2 * wk2i * wk1i;
|
||||
wk3i = 2 * wk2i * wk1r - wk1i;
|
||||
for (j = k; j <= l + k - 2; j += 2) {
|
||||
j1 = j + l;
|
||||
j2 = j1 + l;
|
||||
j3 = j2 + l;
|
||||
x0r = a[i][j] + a[i][j1];
|
||||
x0i = a[i][j + 1] + a[i][j1 + 1];
|
||||
x1r = a[i][j] - a[i][j1];
|
||||
x1i = a[i][j + 1] - a[i][j1 + 1];
|
||||
x2r = a[i][j2] + a[i][j3];
|
||||
x2i = a[i][j2 + 1] + a[i][j3 + 1];
|
||||
x3r = a[i][j2] - a[i][j3];
|
||||
x3i = a[i][j2 + 1] - a[i][j3 + 1];
|
||||
a[i][j] = x0r + x2r;
|
||||
a[i][j + 1] = x0i + x2i;
|
||||
x0r -= x2r;
|
||||
x0i -= x2i;
|
||||
a[i][j2] = wk2r * x0r + wk2i * x0i;
|
||||
a[i][j2 + 1] = wk2r * x0i - wk2i * x0r;
|
||||
x0r = x1r + x3i;
|
||||
x0i = x1i - x3r;
|
||||
a[i][j1] = wk1r * x0r + wk1i * x0i;
|
||||
a[i][j1 + 1] = wk1r * x0i - wk1i * x0r;
|
||||
x0r = x1r - x3i;
|
||||
x0i = x1i + x3r;
|
||||
a[i][j3] = wk3r * x0r + wk3i * x0i;
|
||||
a[i][j3 + 1] = wk3r * x0i - wk3i * x0r;
|
||||
}
|
||||
}
|
||||
}
|
||||
l = m;
|
||||
}
|
||||
if (l < n) {
|
||||
for (j = 0; j <= l - 2; j += 2) {
|
||||
j1 = j + l;
|
||||
x0r = a[i][j] - a[i][j1];
|
||||
x0i = a[i][j + 1] - a[i][j1 + 1];
|
||||
a[i][j] += a[i][j1];
|
||||
a[i][j + 1] += a[i][j1 + 1];
|
||||
a[i][j1] = x0r;
|
||||
a[i][j1 + 1] = x0i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void cftfrow(int n, int n2, double **a, double *w)
|
||||
{
|
||||
int i, j, j1, j2, j3, k, k1, ks, l, m;
|
||||
double wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
|
||||
double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
|
||||
|
||||
l = 1;
|
||||
while ((l << 1) < n) {
|
||||
m = l << 2;
|
||||
for (j = 0; j <= l - 1; j++) {
|
||||
j1 = j + l;
|
||||
j2 = j1 + l;
|
||||
j3 = j2 + l;
|
||||
for (i = 0; i <= n2 - 2; i += 2) {
|
||||
x0r = a[j][i] + a[j1][i];
|
||||
x0i = a[j][i + 1] + a[j1][i + 1];
|
||||
x1r = a[j][i] - a[j1][i];
|
||||
x1i = a[j][i + 1] - a[j1][i + 1];
|
||||
x2r = a[j2][i] + a[j3][i];
|
||||
x2i = a[j2][i + 1] + a[j3][i + 1];
|
||||
x3r = a[j2][i] - a[j3][i];
|
||||
x3i = a[j2][i + 1] - a[j3][i + 1];
|
||||
a[j][i] = x0r + x2r;
|
||||
a[j][i + 1] = x0i + x2i;
|
||||
a[j2][i] = x0r - x2r;
|
||||
a[j2][i + 1] = x0i - x2i;
|
||||
a[j1][i] = x1r + x3i;
|
||||
a[j1][i + 1] = x1i - x3r;
|
||||
a[j3][i] = x1r - x3i;
|
||||
a[j3][i + 1] = x1i + x3r;
|
||||
}
|
||||
}
|
||||
if (m < n) {
|
||||
wk1r = w[2];
|
||||
for (j = m; j <= l + m - 1; j++) {
|
||||
j1 = j + l;
|
||||
j2 = j1 + l;
|
||||
j3 = j2 + l;
|
||||
for (i = 0; i <= n2 - 2; i += 2) {
|
||||
x0r = a[j][i] + a[j1][i];
|
||||
x0i = a[j][i + 1] + a[j1][i + 1];
|
||||
x1r = a[j][i] - a[j1][i];
|
||||
x1i = a[j][i + 1] - a[j1][i + 1];
|
||||
x2r = a[j2][i] + a[j3][i];
|
||||
x2i = a[j2][i + 1] + a[j3][i + 1];
|
||||
x3r = a[j2][i] - a[j3][i];
|
||||
x3i = a[j2][i + 1] - a[j3][i + 1];
|
||||
a[j][i] = x0r + x2r;
|
||||
a[j][i + 1] = x0i + x2i;
|
||||
a[j2][i] = x0i - x2i;
|
||||
a[j2][i + 1] = x2r - x0r;
|
||||
x0r = x1r + x3i;
|
||||
x0i = x1i - x3r;
|
||||
a[j1][i] = wk1r * (x0i + x0r);
|
||||
a[j1][i + 1] = wk1r * (x0i - x0r);
|
||||
x0r = x3i - x1r;
|
||||
x0i = x3r + x1i;
|
||||
a[j3][i] = wk1r * (x0r + x0i);
|
||||
a[j3][i + 1] = wk1r * (x0r - x0i);
|
||||
}
|
||||
}
|
||||
k1 = 1;
|
||||
ks = -1;
|
||||
for (k = (m << 1); k <= n - m; k += m) {
|
||||
k1++;
|
||||
ks = -ks;
|
||||
wk1r = w[k1 << 1];
|
||||
wk1i = w[(k1 << 1) + 1];
|
||||
wk2r = ks * w[k1];
|
||||
wk2i = w[k1 + ks];
|
||||
wk3r = wk1r - 2 * wk2i * wk1i;
|
||||
wk3i = 2 * wk2i * wk1r - wk1i;
|
||||
for (j = k; j <= l + k - 1; j++) {
|
||||
j1 = j + l;
|
||||
j2 = j1 + l;
|
||||
j3 = j2 + l;
|
||||
for (i = 0; i <= n2 - 2; i += 2) {
|
||||
x0r = a[j][i] + a[j1][i];
|
||||
x0i = a[j][i + 1] + a[j1][i + 1];
|
||||
x1r = a[j][i] - a[j1][i];
|
||||
x1i = a[j][i + 1] - a[j1][i + 1];
|
||||
x2r = a[j2][i] + a[j3][i];
|
||||
x2i = a[j2][i + 1] + a[j3][i + 1];
|
||||
x3r = a[j2][i] - a[j3][i];
|
||||
x3i = a[j2][i + 1] - a[j3][i + 1];
|
||||
a[j][i] = x0r + x2r;
|
||||
a[j][i + 1] = x0i + x2i;
|
||||
x0r -= x2r;
|
||||
x0i -= x2i;
|
||||
a[j2][i] = wk2r * x0r + wk2i * x0i;
|
||||
a[j2][i + 1] = wk2r * x0i - wk2i * x0r;
|
||||
x0r = x1r + x3i;
|
||||
x0i = x1i - x3r;
|
||||
a[j1][i] = wk1r * x0r + wk1i * x0i;
|
||||
a[j1][i + 1] = wk1r * x0i - wk1i * x0r;
|
||||
x0r = x1r - x3i;
|
||||
x0i = x1i + x3r;
|
||||
a[j3][i] = wk3r * x0r + wk3i * x0i;
|
||||
a[j3][i + 1] = wk3r * x0i - wk3i * x0r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
l = m;
|
||||
}
|
||||
if (l < n) {
|
||||
for (j = 0; j <= l - 1; j++) {
|
||||
j1 = j + l;
|
||||
for (i = 0; i <= n2 - 2; i += 2) {
|
||||
x0r = a[j][i] - a[j1][i];
|
||||
x0i = a[j][i + 1] - a[j1][i + 1];
|
||||
a[j][i] += a[j1][i];
|
||||
a[j][i + 1] += a[j1][i + 1];
|
||||
a[j1][i] = x0r;
|
||||
a[j1][i + 1] = x0i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static int *alloc_1d_int(int n1)
|
||||
{
|
||||
int *i;
|
||||
|
||||
i = (int *) malloc(sizeof(int) * n1);
|
||||
return i;
|
||||
}
|
||||
|
||||
static void free_1d_int(int *i) { free(i); }
|
||||
|
||||
static double *alloc_1d_double(int n1)
|
||||
{
|
||||
double *d;
|
||||
|
||||
d = (double *) malloc(sizeof(double) * n1);
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
static void free_1d_double(double *d) { free(d); }
|
||||
static double **alloc_2d_double(int n1, int n2)
|
||||
{
|
||||
double **dd, *d;
|
||||
int j;
|
||||
|
||||
dd = (double **) malloc(sizeof(double *) * n1);
|
||||
d = (double *) malloc(sizeof(double) * n1 * n2);
|
||||
|
||||
dd[0] = d;
|
||||
for (j = 1; j < n1; j++) {
|
||||
dd[j] = dd[j - 1] + n2;
|
||||
}
|
||||
return dd;
|
||||
}
|
||||
|
||||
static void free_2d_double(double **dd) { free(dd[0]); free(dd); }
|
||||
|
||||
|
||||
static void cdft2d(int n1, int n2, int isgn, double **a, int *ip, double *w)
|
||||
{
|
||||
int n;
|
||||
|
||||
n = n1 << 1;
|
||||
if (n < n2) {
|
||||
n = n2;
|
||||
}
|
||||
if (n > (ip[0] << 2)) {
|
||||
makewt(n >> 2, ip, w);
|
||||
}
|
||||
if (n2 > 4) {
|
||||
bitrv2col(n1, n2, ip + 2, a);
|
||||
}
|
||||
if (n1 > 2) {
|
||||
bitrv2row(n1, n2, ip + 2, a);
|
||||
}
|
||||
if (isgn < 0) {
|
||||
cftfcol(n1, n2, a, w);
|
||||
cftfrow(n1, n2, a, w);
|
||||
} else {
|
||||
cftbcol(n1, n2, a, w);
|
||||
cftbrow(n1, n2, a, w);
|
||||
}
|
||||
}
|
||||
};
|
|
@ -42,6 +42,7 @@
|
|||
#include "graphwidget.h"
|
||||
#include "edge.h"
|
||||
#include "node.h"
|
||||
#include "fft.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <QDebug>
|
||||
|
@ -50,86 +51,9 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
#define SWAP(a,b) tempr=(a);(a)=(b);(b)=tempr
|
||||
|
||||
void fourn(double data[],unsigned long nn[],unsigned long ndim,int isign)
|
||||
{
|
||||
int i1,i2,i3,i2rev,i3rev,ip1,ip2,ip3,ifp1,ifp2;
|
||||
int ibit,idim,k1,k2,n,nprev,nrem,ntot;
|
||||
double tempi,tempr;
|
||||
double theta,wi,wpi,wpr,wr,wtemp;
|
||||
|
||||
ntot=1;
|
||||
for (idim=1;idim<=(long)ndim;++idim)
|
||||
ntot *= nn[idim];
|
||||
nprev=1;
|
||||
for (idim=ndim;idim>=1;idim--) {
|
||||
n=nn[idim];
|
||||
nrem=ntot/(n*nprev);
|
||||
ip1=nprev << 1;
|
||||
ip2=ip1*n;
|
||||
ip3=ip2*nrem;
|
||||
i2rev=1;
|
||||
for (i2=1;i2<=ip2;i2+=ip1) {
|
||||
if (i2 < i2rev) {
|
||||
for (i1=i2;i1<=i2+ip1-2;i1+=2) {
|
||||
for (i3=i1;i3<=ip3;i3+=ip2) {
|
||||
i3rev=i2rev+i3-i2;
|
||||
SWAP(data[i3],data[i3rev]);
|
||||
SWAP(data[i3+1],data[i3rev+1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
ibit=ip2 >> 1;
|
||||
while (ibit >= ip1 && i2rev > ibit) {
|
||||
i2rev -= ibit;
|
||||
ibit >>= 1;
|
||||
}
|
||||
i2rev += ibit;
|
||||
}
|
||||
ifp1=ip1;
|
||||
while (ifp1 < ip2) {
|
||||
ifp2=ifp1 << 1;
|
||||
theta=isign*6.28318530717959/(ifp2/ip1);
|
||||
wtemp=sin(0.5*theta);
|
||||
wpr = -2.0*wtemp*wtemp;
|
||||
wpi=sin(theta);
|
||||
wr=1.0;
|
||||
wi=0.0;
|
||||
for (i3=1;i3<=ifp1;i3+=ip1) {
|
||||
for (i1=i3;i1<=i3+ip1-2;i1+=2) {
|
||||
for (i2=i1;i2<=ip3;i2+=ifp2) {
|
||||
k1=i2;
|
||||
k2=k1+ifp1;
|
||||
tempr=wr*data[k2]-wi*data[k2+1];
|
||||
tempi=wr*data[k2+1]+wi*data[k2];
|
||||
data[k2]=data[k1]-tempr;
|
||||
data[k2+1]=data[k1+1]-tempi;
|
||||
data[k1] += tempr;
|
||||
data[k1+1] += tempi;
|
||||
}
|
||||
}
|
||||
wr=(wtemp=wr)*wpr-wi*wpi+wr;
|
||||
wi=wi*wpr+wtemp*wpi+wi;
|
||||
}
|
||||
ifp1=ifp2;
|
||||
}
|
||||
nprev *= n;
|
||||
}
|
||||
}
|
||||
|
||||
#undef SWAP
|
||||
|
||||
GraphWidget::GraphWidget(QWidget *)
|
||||
: timerId(0), mIsFrozen(false)
|
||||
{
|
||||
// QGraphicsScene *scene = new QGraphicsScene(QRectF(0,0,500,500),this);
|
||||
// scene->setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||
// scene->clear() ;
|
||||
// setScene(scene);
|
||||
|
||||
// scene()->setSceneRect(0, 0, width(), height());
|
||||
|
||||
setCacheMode(CacheBackground);
|
||||
setViewportUpdateMode(BoundingRectViewportUpdate);
|
||||
setRenderHint(QPainter::Antialiasing);
|
||||
|
@ -142,18 +66,6 @@ GraphWidget::GraphWidget(QWidget *)
|
|||
|
||||
void GraphWidget::clearGraph()
|
||||
{
|
||||
// QGraphicsScene *scene = new QGraphicsScene(this);
|
||||
// scene->setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||
// setScene(scene);
|
||||
|
||||
// scene->addItem(centerNode);
|
||||
// centerNode->setPos(0, 0);
|
||||
|
||||
// if (oldscene != NULL)
|
||||
// {
|
||||
// delete oldscene;
|
||||
// }
|
||||
|
||||
scene()->clear();
|
||||
scene()->setSceneRect(0, 0, width(), height());
|
||||
|
||||
|
@ -229,18 +141,6 @@ void GraphWidget::itemMoved()
|
|||
void GraphWidget::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
switch (event->key()) {
|
||||
// case Qt::Key_Up:
|
||||
// centerNode->moveBy(0, -20);
|
||||
// break;
|
||||
// case Qt::Key_Down:
|
||||
// centerNode->moveBy(0, 20);
|
||||
// break;
|
||||
// case Qt::Key_Left:
|
||||
// centerNode->moveBy(-20, 0);
|
||||
// break;
|
||||
// case Qt::Key_Right:
|
||||
// centerNode->moveBy(20, 0);
|
||||
// break;
|
||||
case Qt::Key_Plus:
|
||||
scaleView(qreal(1.2));
|
||||
break;
|
||||
|
@ -259,45 +159,63 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
static void convolveWithGaussian(double *forceMap,unsigned int S,int /*s*/)
|
||||
static void convolveWithForce(double *forceMap,unsigned int S,int /*s*/)
|
||||
{
|
||||
static double *bf = NULL ;
|
||||
static double **bf = NULL ;
|
||||
static double **tmp = NULL ;
|
||||
static int *ip = NULL ;
|
||||
static double *w = NULL ;
|
||||
static uint32_t last_S = 0 ;
|
||||
|
||||
if(bf == NULL)
|
||||
{
|
||||
bf = new double[S*S*2] ;
|
||||
bf = fft::alloc_2d_double(S, 2*S);
|
||||
|
||||
for(unsigned int i=0;i<S;++i)
|
||||
for(unsigned int j=0;j<S;++j)
|
||||
{
|
||||
int x = (i<S/2)?i:(S-i) ;
|
||||
int y = (j<S/2)?j:(S-j) ;
|
||||
// int l=2*(x*x+y*y);
|
||||
bf[2*(i+S*j)] = log(sqrtf(0.1 + x*x+y*y)); // linear -> derivative is constant
|
||||
bf[2*(i+S*j)+1] = 0 ;
|
||||
|
||||
bf[i][j*2+0] = log(sqrtf(0.1 + x*x+y*y)); // linear -> derivative is constant
|
||||
bf[i][j*2+1] = 0 ;
|
||||
}
|
||||
|
||||
unsigned long nn[2] = {S,S};
|
||||
fourn(&bf[-1],&nn[-1],2,1) ;
|
||||
ip = fft::alloc_1d_int(2 + (int) sqrt(S + 0.5));
|
||||
w = fft::alloc_1d_double(S/2+S);
|
||||
ip[0] = 0;
|
||||
|
||||
fft::cdft2d(S, 2*S, 1, bf, ip, w);
|
||||
}
|
||||
|
||||
unsigned long nn[2] = {S,S};
|
||||
fourn(&forceMap[-1],&nn[-1],2,1) ;
|
||||
if(last_S != S)
|
||||
{
|
||||
if(tmp)
|
||||
fft::free_2d_double(tmp) ;
|
||||
|
||||
tmp = fft::alloc_2d_double(S, 2*S);
|
||||
last_S = S ;
|
||||
}
|
||||
memcpy(tmp[0],forceMap,S*S*2*sizeof(double)) ;
|
||||
|
||||
fft::cdft2d(S, 2*S, 1, tmp, ip, w);
|
||||
|
||||
for (unsigned int i=0;i<S;++i)
|
||||
for (unsigned int j=0;j<S;++j)
|
||||
{
|
||||
float a = forceMap[2*(i+S*j)]*bf[2*(i+S*j)] - forceMap[2*(i+S*j)+1]*bf[2*(i+S*j)+1] ;
|
||||
float b = forceMap[2*(i+S*j)]*bf[2*(i+S*j)+1] + forceMap[2*(i+S*j)+1]*bf[2*(i+S*j)] ;
|
||||
float a = tmp[i][2*j+0]*bf[i][2*j+0] - tmp[i][2*j+1]*bf[i][2*j+1] ;
|
||||
float b = tmp[i][2*j+0]*bf[i][2*j+1] + tmp[i][2*j+1]*bf[i][2*j+0] ;
|
||||
|
||||
forceMap[2*(i+S*j)] = a ;
|
||||
forceMap[2*(i+S*j)+1] = b ;
|
||||
tmp[i][2*j+0] = a ;
|
||||
tmp[i][2*j+1] = b ;
|
||||
}
|
||||
|
||||
fourn(&forceMap[-1],&nn[-1],2,-1) ;
|
||||
fft::cdft2d(S, 2*S,-1, tmp, ip, w);
|
||||
|
||||
for(unsigned int i=0;i<S*S*2;++i)
|
||||
forceMap[i] /= S*S;
|
||||
memcpy(forceMap,tmp[0],S*S*2*sizeof(double)) ;
|
||||
|
||||
for(uint32_t i=0;i<2*S*S;++i)
|
||||
forceMap[i] /= S*S;
|
||||
}
|
||||
|
||||
void GraphWidget::timerEvent(QTimerEvent *event)
|
||||
|
@ -322,7 +240,7 @@ void GraphWidget::timerEvent(QTimerEvent *event)
|
|||
|
||||
QRectF R(scene()->sceneRect()) ;
|
||||
|
||||
if( (hit++ & 7) == 0)
|
||||
if( (hit++ & 3) == 0)
|
||||
{
|
||||
memset(forceMap,0,2*S*S*sizeof(double)) ;
|
||||
|
||||
|
@ -348,7 +266,7 @@ void GraphWidget::timerEvent(QTimerEvent *event)
|
|||
}
|
||||
|
||||
// compute convolution with 1/omega kernel.
|
||||
convolveWithGaussian(forceMap,S,20) ;
|
||||
convolveWithForce(forceMap,S,20) ;
|
||||
}
|
||||
|
||||
foreach (Node *node, _nodes)
|
||||
|
@ -362,7 +280,7 @@ void GraphWidget::timerEvent(QTimerEvent *event)
|
|||
|
||||
bool itemsMoved = false;
|
||||
foreach (Node *node, _nodes)
|
||||
if(node->advance())
|
||||
if(node->progress())
|
||||
itemsMoved = true;
|
||||
|
||||
if (!itemsMoved) {
|
||||
|
@ -435,43 +353,6 @@ void GraphWidget::wheelEvent(QWheelEvent *event)
|
|||
scaleView(pow((double)2, -event->delta() / 240.0));
|
||||
}
|
||||
|
||||
//void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
//{
|
||||
// Q_UNUSED(rect);
|
||||
//
|
||||
// // Shadow
|
||||
// QRectF sceneRect = this->sceneRect();
|
||||
// QRectF rightShadow(sceneRect.right(), sceneRect.top() + 5, 5, sceneRect.height());
|
||||
// QRectF bottomShadow(sceneRect.left() + 5, sceneRect.bottom(), sceneRect.width(), 5);
|
||||
// if (rightShadow.intersects(rect) || rightShadow.contains(rect))
|
||||
// painter->fillRect(rightShadow, Qt::darkGray);
|
||||
// if (bottomShadow.intersects(rect) || bottomShadow.contains(rect))
|
||||
// painter->fillRect(bottomShadow, Qt::darkGray);
|
||||
//
|
||||
// // Fill
|
||||
// QLinearGradient gradient(sceneRect.topLeft(), sceneRect.bottomRight());
|
||||
// gradient.setColorAt(0, Qt::white);
|
||||
// gradient.setColorAt(1, Qt::lightGray);
|
||||
// painter->fillRect(rect.intersected(sceneRect), gradient);
|
||||
// painter->setBrush(Qt::NoBrush);
|
||||
// painter->drawRect(sceneRect);
|
||||
//
|
||||
// // Text
|
||||
// QRectF textRect(sceneRect.left() + 4, sceneRect.top() + 4,
|
||||
// sceneRect.width() - 4, sceneRect.height() - 4);
|
||||
// QString message(tr("Click and drag the nodes around, and zoom with the mouse "
|
||||
// "wheel or the '+' and '-' keys"));
|
||||
//
|
||||
// QFont font = painter->font();
|
||||
// font.setBold(true);
|
||||
// font.setPointSize(14);
|
||||
// painter->setFont(font);
|
||||
// painter->setPen(Qt::lightGray);
|
||||
// painter->drawText(textRect.translated(2, 2), message);
|
||||
// painter->setPen(Qt::black);
|
||||
// painter->drawText(textRect, message);
|
||||
//}
|
||||
|
||||
void GraphWidget::scaleView(qreal scaleFactor)
|
||||
{
|
||||
qreal factor = matrix().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
|
||||
|
|
|
@ -215,7 +215,7 @@ void Node::calculateForces(const double *map,int width,int height,int W,int H,fl
|
|||
newPos.setY(qMin(qMax(newPos.y(), sceneRect.top()) , sceneRect.bottom()));
|
||||
}
|
||||
|
||||
bool Node::advance()
|
||||
bool Node::progress()
|
||||
{
|
||||
if(_type == GraphWidget::ELASTIC_NODE_TYPE_OWN)
|
||||
return false;
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
std::string descString() const { return _desc_string ; }
|
||||
|
||||
void calculateForces(const double *data,int width,int height,int W,int H,float x,float y,float speedf);
|
||||
bool advance();
|
||||
bool progress();
|
||||
|
||||
QRectF boundingRect() const;
|
||||
QPainterPath shape() const;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>emojione/1F52E.png</file>
|
||||
<file>emojione/26f4.png</file>
|
||||
<file>emojione/1F6A0.png</file>
|
||||
<file>emojione/1F6A1.png</file>
|
||||
|
|
|
@ -452,6 +452,7 @@
|
|||
"emojione/objects.png"|":dagger:":"emojione/1F5E1.png";
|
||||
"emojione/objects.png"|":shield:":"emojione/1F6E1.png";
|
||||
"emojione/objects.png"|":moyai:":"emojione/1F5FF.png";
|
||||
"emojione/objects.png"|":crystal_ball:":"emojione/1F52E.png";
|
||||
"emojione/symbols.png"|":100:|<3":"emojione/1F4AF.png";
|
||||
"emojione/symbols.png"|":cupid:":"emojione/1F498.png";
|
||||
"emojione/symbols.png"|":heart:|<3":"emojione/2764.png";
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
virtual QScrollArea *getScrollArea() = 0;
|
||||
virtual void deleteFeedItem(QWidget *item, uint32_t type) = 0;
|
||||
virtual void openChat(const RsPeerId& peerId) = 0;
|
||||
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title) = 0;
|
||||
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &msg_versions, const RsGxsMessageId &msgId, const QString &title)=0;
|
||||
|
||||
// Workaround for QTBUG-3372
|
||||
void lockLayout(QWidget *feedItem, bool lock);
|
||||
|
|
|
@ -127,8 +127,7 @@ void GxsChannelGroupItem::fill()
|
|||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RetroShareLink link;
|
||||
link.createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mGroup.mMeta.mGroupId, groupName());
|
||||
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mGroup.mMeta.mGroupId, groupName());
|
||||
ui->nameLabel->setText(link.toHtml());
|
||||
|
||||
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));
|
||||
|
|
|
@ -35,8 +35,10 @@
|
|||
#include "util/HandleRichText.h"
|
||||
#include "util/DateTime.h"
|
||||
#include "util/stringutil.h"
|
||||
#include "gui/gxschannels/CreateGxsChannelMsg.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
|
@ -45,16 +47,41 @@
|
|||
#define COLOR_NORMAL QColor(248, 248, 248)
|
||||
#define COLOR_NEW QColor(220, 236, 253)
|
||||
|
||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate) :
|
||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
|
||||
GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsGxsChannels, autoUpdate)
|
||||
{
|
||||
setup();
|
||||
|
||||
requestGroup();
|
||||
requestMessage();
|
||||
requestComment();
|
||||
init(messageId,older_versions) ;
|
||||
}
|
||||
|
||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost& post, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
|
||||
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate)
|
||||
{
|
||||
init(post.mMeta.mMsgId,older_versions) ;
|
||||
mPost = post ;
|
||||
}
|
||||
|
||||
void GxsChannelPostItem::init(const RsGxsMessageId& messageId,const std::set<RsGxsMessageId>& older_versions)
|
||||
{
|
||||
QVector<RsGxsMessageId> v;
|
||||
//bool self = false;
|
||||
|
||||
for(std::set<RsGxsMessageId>::const_iterator it(older_versions.begin());it!=older_versions.end();++it)
|
||||
v.push_back(*it) ;
|
||||
|
||||
if(older_versions.find(messageId) == older_versions.end())
|
||||
v.push_back(messageId);
|
||||
|
||||
setMessageVersions(v) ;
|
||||
|
||||
setup();
|
||||
|
||||
mLoaded = false ;
|
||||
}
|
||||
|
||||
// This code has been suspended because it adds more complexity than usefulness.
|
||||
// It was used to load a channel post where the post item is already known.
|
||||
|
||||
#ifdef SUSPENDED
|
||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) :
|
||||
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate)
|
||||
{
|
||||
|
@ -63,11 +90,27 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
|
|||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
QVector<RsGxsMessageId> v;
|
||||
bool self = false;
|
||||
|
||||
for(std::set<RsGxsMessageId>::const_iterator it(post.mOlderVersions.begin());it!=post.mOlderVersions.end();++it)
|
||||
{
|
||||
if(*it == post.mMeta.mMsgId)
|
||||
self = true ;
|
||||
|
||||
v.push_back(*it) ;
|
||||
}
|
||||
if(!self)
|
||||
v.push_back(post.mMeta.mMsgId);
|
||||
|
||||
setMessageVersions(v) ;
|
||||
|
||||
setup();
|
||||
|
||||
setGroup(group, false);
|
||||
setPost(post);
|
||||
requestComment();
|
||||
|
||||
setPost(post,false);
|
||||
mLoaded = false ;
|
||||
}
|
||||
|
||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) :
|
||||
|
@ -80,10 +123,30 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
|
|||
|
||||
setup();
|
||||
|
||||
mLoaded = true ;
|
||||
requestGroup();
|
||||
setPost(post);
|
||||
requestComment();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void GxsChannelPostItem::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
/* This method employs a trick to trigger a deferred loading. The post and group is requested only
|
||||
* when actually displayed on the screen. */
|
||||
|
||||
if(!mLoaded)
|
||||
{
|
||||
mLoaded = true ;
|
||||
|
||||
requestGroup();
|
||||
requestMessage();
|
||||
requestComment();
|
||||
}
|
||||
|
||||
GxsFeedItem::paintEvent(e) ;
|
||||
}
|
||||
|
||||
GxsChannelPostItem::~GxsChannelPostItem()
|
||||
{
|
||||
|
@ -127,6 +190,7 @@ void GxsChannelPostItem::setup()
|
|||
connect(ui->commentButton, SIGNAL(clicked()), this, SLOT(loadComments()));
|
||||
|
||||
connect(ui->playButton, SIGNAL(clicked()), this, SLOT(play(void)));
|
||||
connect(ui->editButton, SIGNAL(clicked()), this, SLOT(edit(void)));
|
||||
connect(ui->copyLinkButton, SIGNAL(clicked()), this, SLOT(copyMessageLink()));
|
||||
|
||||
connect(ui->readButton, SIGNAL(toggled(bool)), this, SLOT(readToggled(bool)));
|
||||
|
@ -166,6 +230,13 @@ bool GxsChannelPostItem::setGroup(const RsGxsChannelGroup &group, bool doFill)
|
|||
|
||||
mGroup = group;
|
||||
|
||||
// If not publisher, hide the edit button. Without the publish key, there's no way to edit a message.
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "Group subscribe flags = " << std::hex << mGroup.mMeta.mSubscribeFlags << std::dec << std::endl ;
|
||||
#endif
|
||||
if( !IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags) )
|
||||
ui->editButton->hide() ;
|
||||
|
||||
if (doFill) {
|
||||
fill();
|
||||
}
|
||||
|
@ -301,7 +372,7 @@ void GxsChannelPostItem::loadComment(const uint32_t &token)
|
|||
if (comNb == 1) {
|
||||
sComButText = sComButText.append("(1)");
|
||||
} else if (comNb > 1) {
|
||||
sComButText = tr("Comments").append("(%1)").arg(comNb);
|
||||
sComButText = tr("Comments ").append("(%1)").arg(comNb);
|
||||
}
|
||||
ui->commentButton->setText(sComButText);
|
||||
}
|
||||
|
@ -324,6 +395,14 @@ void GxsChannelPostItem::fill()
|
|||
|
||||
QString title;
|
||||
|
||||
if(mPost.mThumbnail.mData != NULL)
|
||||
{
|
||||
QPixmap thumbnail;
|
||||
thumbnail.loadFromData(mPost.mThumbnail.mData, mPost.mThumbnail.mSize, "PNG");
|
||||
// Wiping data - as its been passed to thumbnail.
|
||||
ui->logoLabel->setPixmap(thumbnail);
|
||||
}
|
||||
|
||||
if (!mIsHome)
|
||||
{
|
||||
if (mCloseOnRead && !IS_MSG_NEW(mPost.mMeta.mMsgStatus)) {
|
||||
|
@ -331,13 +410,11 @@ void GxsChannelPostItem::fill()
|
|||
}
|
||||
|
||||
title = tr("Channel Feed") + ": ";
|
||||
RetroShareLink link;
|
||||
link.createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, groupName());
|
||||
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, groupName());
|
||||
title += link.toHtml();
|
||||
ui->titleLabel->setText(title);
|
||||
|
||||
RetroShareLink msgLink;
|
||||
msgLink.createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName());
|
||||
RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName());
|
||||
ui->subjectLabel->setText(msgLink.toHtml());
|
||||
|
||||
if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroup.mMeta.mSubscribeFlags))
|
||||
|
@ -361,9 +438,12 @@ void GxsChannelPostItem::fill()
|
|||
/* subject */
|
||||
ui->titleLabel->setText(QString::fromUtf8(mPost.mMeta.mMsgName.c_str()));
|
||||
|
||||
uint32_t autorized_lines = (int)floor((ui->logoLabel->height() - ui->titleLabel->height() - ui->buttonHLayout->sizeHint().height())/QFontMetricsF(ui->subjectLabel->font()).height());
|
||||
|
||||
// fill first 4 lines of message. (csoler) Disabled the replacement of smileys and links, because the cost is too crazy
|
||||
//ui->subjectLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 4), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
ui->subjectLabel->setText(RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 4)) ;
|
||||
ui->subjectLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
//ui->subjectLabel->setText(RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 2)) ;
|
||||
|
||||
//QString score = QString::number(post.mTopScore);
|
||||
// scoreLabel->setText(score);
|
||||
|
@ -471,14 +551,6 @@ void GxsChannelPostItem::fill()
|
|||
layout->addWidget(fi);
|
||||
}
|
||||
|
||||
if(mPost.mThumbnail.mData != NULL)
|
||||
{
|
||||
QPixmap thumbnail;
|
||||
thumbnail.loadFromData(mPost.mThumbnail.mData, mPost.mThumbnail.mSize, "PNG");
|
||||
// Wiping data - as its been passed to thumbnail.
|
||||
ui->logoLabel->setPixmap(thumbnail);
|
||||
}
|
||||
|
||||
mInFill = false;
|
||||
}
|
||||
|
||||
|
@ -690,6 +762,12 @@ void GxsChannelPostItem::download()
|
|||
updateItem();
|
||||
}
|
||||
|
||||
void GxsChannelPostItem::edit()
|
||||
{
|
||||
CreateGxsChannelMsg *msgDialog = new CreateGxsChannelMsg(mGroup.mMeta.mGroupId,mPost.mMeta.mMsgId);
|
||||
msgDialog->show();
|
||||
}
|
||||
|
||||
void GxsChannelPostItem::play()
|
||||
{
|
||||
std::list<SubFileItem *>::iterator it;
|
||||
|
|
|
@ -41,9 +41,19 @@ class GxsChannelPostItem : public GxsFeedItem
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate);
|
||||
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
|
||||
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
|
||||
// This one is used in NewFeed for incoming channel posts. Only the group and msg ids are known at this point.
|
||||
// It can be used for all apparences of channel posts. But in rder to merge comments from the previous versions of the post, the list of
|
||||
// previous posts should be supplied. It's optional. If not supplied only the comments of the new version will be displayed.
|
||||
|
||||
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
|
||||
|
||||
// This method can be called when additional information is known about the post. In this case, the widget will be initialized with some
|
||||
// minimap information from the post and completed when the use displays it, which shouldn't cost anything more.
|
||||
|
||||
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost& post, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
|
||||
|
||||
//GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
|
||||
//GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
|
||||
virtual ~GxsChannelPostItem();
|
||||
|
||||
bool setGroup(const RsGxsChannelGroup &group, bool doFill = true);
|
||||
|
@ -58,10 +68,17 @@ public:
|
|||
bool isUnread() const ;
|
||||
|
||||
protected:
|
||||
void init(const RsGxsMessageId& messageId,const std::set<RsGxsMessageId>& older_versions);
|
||||
|
||||
/* FeedItem */
|
||||
virtual void doExpand(bool open);
|
||||
virtual void expandFill(bool first);
|
||||
|
||||
// This does nothing except triggering the loading of the post data and comments. This function is mainly used to detect
|
||||
// when the post is actually made visible.
|
||||
|
||||
virtual void paintEvent(QPaintEvent *);
|
||||
|
||||
/* GxsGroupFeedItem */
|
||||
virtual QString groupName();
|
||||
virtual void loadGroup(const uint32_t &token);
|
||||
|
@ -78,6 +95,7 @@ private slots:
|
|||
void readAndClearItem();
|
||||
void download();
|
||||
void play();
|
||||
void edit();
|
||||
void loadComments();
|
||||
|
||||
void readToggled(bool checked);
|
||||
|
@ -100,6 +118,7 @@ private:
|
|||
private:
|
||||
bool mInFill;
|
||||
bool mCloseOnRead;
|
||||
bool mLoaded;
|
||||
|
||||
RsGxsChannelGroup mGroup;
|
||||
RsGxsChannelPost mPost;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>840</width>
|
||||
<height>180</height>
|
||||
<width>1052</width>
|
||||
<height>338</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gxsChannelPostItem_GLayout">
|
||||
|
@ -332,6 +332,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="editButton">
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
|
|
284
retroshare-gui/src/gui/feeds/GxsCircleItem.cpp
Normal file
284
retroshare-gui/src/gui/feeds/GxsCircleItem.cpp
Normal file
|
@ -0,0 +1,284 @@
|
|||
/*
|
||||
* Retroshare Gxs Feed Item
|
||||
*
|
||||
* Copyright 2014 RetroShare Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include "GxsCircleItem.h"
|
||||
#include "ui_GxsCircleItem.h"
|
||||
|
||||
#include "FeedHolder.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/Circles/CreateCircleDialog.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
****/
|
||||
|
||||
#define COLOR_NORMAL QColor(248, 248, 248)
|
||||
#define COLOR_NEW QColor(220, 236, 253)
|
||||
|
||||
#define CIRCLESDIALOG_GROUPUPDATE 3
|
||||
|
||||
|
||||
GxsCircleItem::GxsCircleItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsCircleId &circleId, const RsGxsId &gxsId, const uint32_t type)
|
||||
:FeedItem(NULL), mFeedHolder(feedHolder), mFeedId(feedId), mType(type), mCircleId(circleId), mGxsId(gxsId)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
|
||||
GxsCircleItem::~GxsCircleItem()
|
||||
{
|
||||
delete(ui);
|
||||
}
|
||||
|
||||
void GxsCircleItem::setup()
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui = new Ui::GxsCircleItem;
|
||||
ui->setupUi(this);
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
/* general ones */
|
||||
connect(ui->expandButton, SIGNAL(clicked()), this, SLOT(showCircleDetails()));
|
||||
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(removeItem()));
|
||||
|
||||
/* update gxs information */
|
||||
|
||||
RsIdentityDetails idDetails ;
|
||||
QString idName ;
|
||||
if(rsIdentity->getIdDetails(mGxsId, idDetails))
|
||||
idName = tr("for identity ")+QString::fromUtf8(idDetails.mNickname.c_str()) + " (ID=" + QString::fromStdString(mGxsId.toStdString()) + ")" ;
|
||||
else
|
||||
idName = tr("for identity ")+QString::fromStdString(mGxsId.toStdString()) ;
|
||||
|
||||
|
||||
/* update circle information */
|
||||
|
||||
RsGxsCircleDetails circleDetails;
|
||||
if (rsGxsCircles->getCircleDetails(mCircleId, circleDetails))
|
||||
{
|
||||
|
||||
if (mType == RS_FEED_ITEM_CIRCLE_MEMB_REQ)
|
||||
{
|
||||
ui->titleLabel->setText(tr("You received a membership request for circle:"));
|
||||
ui->nameLabel->setText(QString::fromUtf8(circleDetails.mCircleName.c_str()));
|
||||
ui->gxsIdLabel->setText(idName);
|
||||
|
||||
ui->acceptButton->setToolTip(tr("Grant membership request"));
|
||||
ui->revokeButton->setToolTip(tr("Revoke membership request"));
|
||||
connect(ui->acceptButton, SIGNAL(clicked()), this, SLOT(grantCircleMembership()));
|
||||
connect(ui->revokeButton, SIGNAL(clicked()), this, SLOT(revokeCircleMembership()));
|
||||
}
|
||||
else if (mType == RS_FEED_ITEM_CIRCLE_INVIT_REC)
|
||||
{
|
||||
ui->titleLabel->setText(tr("You received an invitation for circle:"));
|
||||
ui->nameLabel->setText(QString::fromUtf8(circleDetails.mCircleName.c_str()));
|
||||
ui->gxsIdLabel->setText(idName);
|
||||
|
||||
ui->acceptButton->setToolTip(tr("Accept invitation"));
|
||||
connect(ui->acceptButton, SIGNAL(clicked()), this, SLOT(acceptCircleSubscription()));
|
||||
ui->revokeButton->setHidden(true);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->titleLabel->setText(tr("Received event from unknown Circle:"));
|
||||
ui->nameLabel->setText(QString::fromStdString(mCircleId.toStdString()));
|
||||
ui->gxsIdLabel->setText(idName);
|
||||
}
|
||||
|
||||
/* Setup TokenQueue */
|
||||
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
|
||||
|
||||
}
|
||||
|
||||
bool GxsCircleItem::isSame(const RsGxsCircleId &circleId, const RsGxsId &gxsId, uint32_t type)
|
||||
{
|
||||
if ((mCircleId == circleId) && (mGxsId == gxsId) && (mType == type))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
void GxsCircleItem::removeItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsCircleItem::removeItem()" << std::endl;
|
||||
#endif
|
||||
|
||||
if (mFeedHolder)
|
||||
{
|
||||
mFeedHolder->lockLayout(this, true);
|
||||
hide();
|
||||
mFeedHolder->lockLayout(this, false);
|
||||
|
||||
mFeedHolder->deleteFeedItem(this, mFeedId);
|
||||
}
|
||||
}
|
||||
|
||||
void GxsCircleItem::loadRequest(const TokenQueue * queue, const TokenRequest &req)
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << "GxsCircleItem::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
if(queue == mCircleQueue)
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << "CirclesDialog::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
/* now switch on req */
|
||||
switch(req.mUserType)
|
||||
{
|
||||
case CIRCLESDIALOG_GROUPUPDATE:
|
||||
updateCircleGroup(req.mToken);
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cerr << "GxsCircleItem::loadRequest() ERROR: INVALID TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********** SPECIFIC FUNCTIONS ***********************/
|
||||
|
||||
void GxsCircleItem::showCircleDetails()
|
||||
{
|
||||
CreateCircleDialog dlg;
|
||||
|
||||
dlg.editExistingId(RsGxsGroupId(mCircleId), true, mType != RS_FEED_ITEM_CIRCLE_MEMB_REQ) ;
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void GxsCircleItem::acceptCircleSubscription()
|
||||
{
|
||||
if (rsGxsCircles->requestCircleMembership(mGxsId, mCircleId))
|
||||
removeItem();
|
||||
}
|
||||
|
||||
void GxsCircleItem::grantCircleMembership()
|
||||
{
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
std::list<RsGxsGroupId> grps ;
|
||||
grps.push_back(RsGxsGroupId(mCircleId));
|
||||
|
||||
uint32_t token;
|
||||
mCircleQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grps, CIRCLESDIALOG_GROUPUPDATE);
|
||||
|
||||
CircleUpdateOrder c ;
|
||||
c.token = token ;
|
||||
c.gxs_id = mGxsId ;
|
||||
c.action = CircleUpdateOrder::GRANT_MEMBERSHIP ;
|
||||
|
||||
mCircleUpdates[token] = c ;
|
||||
}
|
||||
|
||||
void GxsCircleItem::revokeCircleMembership()
|
||||
{
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
std::list<RsGxsGroupId> grps;
|
||||
grps.push_back(RsGxsGroupId(mCircleId));
|
||||
|
||||
uint32_t token;
|
||||
mCircleQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grps, CIRCLESDIALOG_GROUPUPDATE);
|
||||
|
||||
CircleUpdateOrder c;
|
||||
c.token = token;
|
||||
c.gxs_id = mGxsId;
|
||||
c.action = CircleUpdateOrder::REVOKE_MEMBERSHIP;
|
||||
|
||||
mCircleUpdates[token] = c;
|
||||
}
|
||||
|
||||
void GxsCircleItem::updateCircleGroup(const uint32_t& token)
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << "Loading circle info" << std::endl;
|
||||
#endif
|
||||
|
||||
std::vector<RsGxsCircleGroup> circle_grp_v ;
|
||||
rsGxsCircles->getGroupData(token, circle_grp_v);
|
||||
|
||||
if (circle_grp_v.empty())
|
||||
{
|
||||
std::cerr << "(EE) unexpected empty result from getGroupData. Cannot process circle now!" << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
if (circle_grp_v.size() != 1)
|
||||
{
|
||||
std::cerr << "(EE) very weird result from getGroupData. Should get exactly one circle" << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
RsGxsCircleGroup cg = circle_grp_v.front();
|
||||
|
||||
/* now mark all the members */
|
||||
|
||||
//std::set<RsGxsId> members = cg.mInvitedMembers;
|
||||
|
||||
std::map<uint32_t,CircleUpdateOrder>::iterator it = mCircleUpdates.find(token) ;
|
||||
|
||||
if(it == mCircleUpdates.end())
|
||||
{
|
||||
std::cerr << "(EE) Cannot find token " << token << " to perform group update!" << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
if(it->second.action == CircleUpdateOrder::GRANT_MEMBERSHIP)
|
||||
cg.mInvitedMembers.insert(it->second.gxs_id) ;
|
||||
else if(it->second.action == CircleUpdateOrder::REVOKE_MEMBERSHIP)
|
||||
cg.mInvitedMembers.erase(it->second.gxs_id) ;
|
||||
else
|
||||
{
|
||||
std::cerr << "(EE) unrecognised membership action to perform: " << it->second.action << "!" << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
uint32_t token2 ;
|
||||
rsGxsCircles->updateGroup(token2,cg) ;
|
||||
|
||||
mCircleUpdates.erase(it) ;
|
||||
}
|
||||
|
98
retroshare-gui/src/gui/feeds/GxsCircleItem.h
Normal file
98
retroshare-gui/src/gui/feeds/GxsCircleItem.h
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Retroshare Gxs Feed Item
|
||||
*
|
||||
* Copyright 2014 RetroShare Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GXSCIRCLEITEM_H
|
||||
#define _GXSCIRCLEITEM_H
|
||||
|
||||
#include <retroshare/rsgxscircles.h>
|
||||
#include "FeedItem.h"
|
||||
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
namespace Ui {
|
||||
class GxsCircleItem;
|
||||
}
|
||||
|
||||
class FeedHolder;
|
||||
|
||||
struct CircleUpdateOrder
|
||||
{
|
||||
enum { UNKNOWN_ACTION=0x00, GRANT_MEMBERSHIP=0x01, REVOKE_MEMBERSHIP=0x02 };
|
||||
|
||||
uint32_t token ;
|
||||
RsGxsId gxs_id ;
|
||||
uint32_t action ;
|
||||
};
|
||||
|
||||
|
||||
class GxsCircleItem : public FeedItem, public TokenResponse
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
/** Default Constructor */
|
||||
GxsCircleItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsCircleId &circleId, const RsGxsId &gxsId, const uint32_t type);
|
||||
virtual ~GxsCircleItem();
|
||||
|
||||
bool isSame(const RsGxsCircleId &circleId, const RsGxsId &gxsId, uint32_t type);
|
||||
|
||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
|
||||
protected:
|
||||
/* FeedItem */
|
||||
virtual void doExpand(bool /*open*/) {}
|
||||
|
||||
void updateCircleGroup(const uint32_t& token);
|
||||
|
||||
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void removeItem();
|
||||
|
||||
void showCircleDetails();
|
||||
void acceptCircleSubscription();
|
||||
void grantCircleMembership() ;
|
||||
void revokeCircleMembership();
|
||||
|
||||
private:
|
||||
void setup();
|
||||
|
||||
FeedHolder *mFeedHolder;
|
||||
uint32_t mFeedId;
|
||||
uint32_t mType;
|
||||
|
||||
RsGxsCircleId mCircleId;
|
||||
RsGxsId mGxsId;
|
||||
|
||||
TokenQueue *mCircleQueue;
|
||||
std::map<uint32_t, CircleUpdateOrder> mCircleUpdates ;
|
||||
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::GxsCircleItem *ui;
|
||||
};
|
||||
|
||||
#endif
|
298
retroshare-gui/src/gui/feeds/GxsCircleItem.ui
Normal file
298
retroshare-gui/src/gui/feeds/GxsCircleItem.ui
Normal file
|
@ -0,0 +1,298 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GxsCircleItem</class>
|
||||
<widget class="QWidget" name="GxsCircleItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>618</width>
|
||||
<height>96</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="GxsCircleItemGLayout">
|
||||
<property name="leftMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="frameGLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="topGLayout">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="logoLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../icons.qrc">:/icons/svg/circles.svg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="nameHLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<italic>true</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Circle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="text">
|
||||
<string notr="true">name</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="nameHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="toolbarHLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="gxsIdLabel">
|
||||
<property name="text">
|
||||
<string notr="true">name</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="tollbarHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>254</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="acceptButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/accepted16.png</normaloff>:/images/accepted16.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="revokeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/cancel.png</normaloff>:/images/cancel.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Details</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove Item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -127,8 +127,7 @@ void GxsForumGroupItem::fill()
|
|||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RetroShareLink link;
|
||||
link.createGxsGroupLink(RetroShareLink::TYPE_FORUM, mGroup.mMeta.mGroupId, groupName());
|
||||
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_FORUM, mGroup.mMeta.mGroupId, groupName());
|
||||
ui->nameLabel->setText(link.toHtml());
|
||||
|
||||
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));
|
||||
|
|
|
@ -271,8 +271,7 @@ void GxsForumMsgItem::fill()
|
|||
}
|
||||
|
||||
QString title = tr("Forum Feed") + ": ";
|
||||
RetroShareLink link;
|
||||
link.createGxsGroupLink(RetroShareLink::TYPE_FORUM, mMessage.mMeta.mGroupId, groupName());
|
||||
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_FORUM, mMessage.mMeta.mGroupId, groupName());
|
||||
title += link.toHtml();
|
||||
ui->titleLabel->setText(title);
|
||||
|
||||
|
@ -310,8 +309,7 @@ void GxsForumMsgItem::fill()
|
|||
// nameLabel->setText(tr("Anonymous"));
|
||||
// }
|
||||
|
||||
RetroShareLink msgLink;
|
||||
msgLink.createGxsMessageLink(RetroShareLink::TYPE_FORUM, mMessage.mMeta.mGroupId, mMessage.mMeta.mMsgId, messageName());
|
||||
RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_FORUM, mMessage.mMeta.mGroupId, mMessage.mMeta.mMsgId, messageName());
|
||||
ui->subLabel->setText(msgLink.toHtml());
|
||||
if (wasExpanded() || ui->expandFrame->isVisible()) {
|
||||
fillExpandFrame();
|
||||
|
@ -324,8 +322,7 @@ void GxsForumMsgItem::fill()
|
|||
} else {
|
||||
// ui->parentAvatar->setId(msgParent.srcId, true);
|
||||
|
||||
RetroShareLink linkParent;
|
||||
linkParent.createGxsMessageLink(RetroShareLink::TYPE_FORUM, mParentMessage.mMeta.mGroupId, mParentMessage.mMeta.mMsgId, QString::fromUtf8(mParentMessage.mMeta.mMsgName.c_str()));
|
||||
RetroShareLink linkParent = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_FORUM, mParentMessage.mMeta.mGroupId, mParentMessage.mMeta.mMsgId, QString::fromUtf8(mParentMessage.mMeta.mMsgName.c_str()));
|
||||
ui->parentSubLabel->setText(linkParent.toHtml());
|
||||
ui->parentMsgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mParentMessage.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsrtt.h>
|
||||
|
||||
/*****
|
||||
* #define DEBUG_ITEM 1
|
||||
|
@ -68,6 +69,16 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId,
|
|||
}
|
||||
|
||||
|
||||
bool PeerItem::isSame(const RsPeerId &peerId, uint32_t type)
|
||||
{
|
||||
if ((mPeerId == peerId) && (mType == type))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void PeerItem::updateItemStatic()
|
||||
{
|
||||
if (!rsPeers)
|
||||
|
@ -95,6 +106,9 @@ void PeerItem::updateItemStatic()
|
|||
case PEER_TYPE_NEW_FOF:
|
||||
title = tr("Friend of Friend");
|
||||
break;
|
||||
case PEER_TYPE_OFFSET:
|
||||
title = tr("Friend Time Offset");
|
||||
break;
|
||||
default:
|
||||
title = tr("Peer");
|
||||
break;
|
||||
|
@ -111,8 +125,14 @@ void PeerItem::updateItemStatic()
|
|||
|
||||
/* expanded Info */
|
||||
nameLabel->setText(QString::fromUtf8(details.name.c_str()));
|
||||
idLabel->setText(QString::fromStdString(details.id.toStdString()));
|
||||
idLabel->setText(QString::fromStdString(details.id.toStdString()));
|
||||
locLabel->setText(QString::fromUtf8(details.location.c_str()));
|
||||
|
||||
if (rsRtt)
|
||||
{
|
||||
double offset = rsRtt->getMeanOffset(RsPeerId(mPeerId));
|
||||
offsetLabel->setText(QString::number(offset,'f',2).append(" s"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -187,6 +207,13 @@ void PeerItem::updateItem()
|
|||
{
|
||||
sendmsgButton->setEnabled(false);
|
||||
}
|
||||
|
||||
if (rsRtt)
|
||||
{
|
||||
double offset = rsRtt->getMeanOffset(RsPeerId(mPeerId));
|
||||
offsetLabel->setText(QString::number(offset,'f',2).append(" s"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* slow Tick */
|
||||
|
|
|
@ -30,6 +30,7 @@ const uint32_t PEER_TYPE_STD = 0x0001;
|
|||
const uint32_t PEER_TYPE_CONNECT = 0x0002;
|
||||
const uint32_t PEER_TYPE_HELLO = 0x0003; /* failed Connect Attempt */
|
||||
const uint32_t PEER_TYPE_NEW_FOF = 0x0004; /* new Friend of Friend */
|
||||
const uint32_t PEER_TYPE_OFFSET = 0x0005; /* received time offset */
|
||||
|
||||
class FeedHolder;
|
||||
|
||||
|
@ -43,6 +44,8 @@ public:
|
|||
|
||||
void updateItemStatic();
|
||||
|
||||
bool isSame(const RsPeerId &peerId, uint32_t type);
|
||||
|
||||
protected:
|
||||
/* FeedItem */
|
||||
virtual void doExpand(bool open);
|
||||
|
|
|
@ -7,11 +7,20 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>476</width>
|
||||
<height>247</height>
|
||||
<height>250</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<layout class="QGridLayout" name="PeerItemGLayout">
|
||||
<property name="leftMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
|
@ -95,13 +104,13 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<layout class="QGridLayout" name="frameGLayout">
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="peerFrame">
|
||||
<layout class="QGridLayout">
|
||||
<layout class="QGridLayout" name="peerFrameGLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -128,7 +137,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QGridLayout">
|
||||
<layout class="QGridLayout" name="peerNameGLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="StyledLabel" name="peerNameLabel">
|
||||
<property name="text">
|
||||
|
@ -165,9 +174,9 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="lastHLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="lastHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -204,9 +213,9 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<layout class="QHBoxLayout" name="buttonHLayout">
|
||||
<item>
|
||||
<spacer>
|
||||
<spacer name="buttonHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -317,13 +326,13 @@
|
|||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="expandFrame">
|
||||
<layout class="QGridLayout">
|
||||
<layout class="QGridLayout" name="expandFrameGLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="expandFrameHLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="textVLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<widget class="QLabel" name="nameText">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
|
@ -336,7 +345,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<widget class="QLabel" name="idText">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
|
@ -349,7 +358,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="trustText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -368,7 +377,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<widget class="QLabel" name="locText">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
|
@ -381,7 +390,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<widget class="QLabel" name="ipText">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
|
@ -394,7 +403,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<widget class="QLabel" name="connText">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
|
@ -407,7 +416,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="typeLabel">
|
||||
<widget class="QLabel" name="statusText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -426,10 +435,30 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="offsetText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<italic>true</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Time offset:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="labelVLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="sizePolicy">
|
||||
|
@ -509,6 +538,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="offsetLabel">
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -531,17 +567,17 @@
|
|||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>StyledLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/StyledLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AvatarWidget</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/AvatarWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>StyledLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/StyledLabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
|
|
|
@ -130,9 +130,8 @@ void PostedGroupItem::fill()
|
|||
#endif
|
||||
|
||||
// No link type at this moment
|
||||
RetroShareLink link;
|
||||
link.createGxsGroupLink(RetroShareLink::TYPE_POSTED, mGroup.mMeta.mGroupId, groupName());
|
||||
ui->nameLabel->setText(link.toHtml());
|
||||
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_POSTED, mGroup.mMeta.mGroupId, groupName());
|
||||
ui->nameLabel->setText(link.toHtml());
|
||||
// ui->nameLabel->setText(groupName());
|
||||
|
||||
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
|
||||
|
||||
const uint32_t SFI_DEFAULT_PERIOD = (30 * 3600 * 24); /* 30 Days */
|
||||
//const uint32_t SFI_DEFAULT_PERIOD = (30 * 3600 * 24); /* 30 Days */
|
||||
|
||||
/** Constructor */
|
||||
SubFileItem::SubFileItem(const RsFileHash &hash, const std::string &name, const std::string &path, uint64_t size, uint32_t flags, const RsPeerId &srcId)
|
||||
|
@ -97,11 +97,12 @@ SubFileItem::SubFileItem(const RsFileHash &hash, const std::string &name, const
|
|||
|
||||
void SubFileItem::Setup()
|
||||
{
|
||||
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
|
||||
connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) );
|
||||
connect( cancelButton, SIGNAL( clicked( void ) ), this, SLOT( cancel ( void ) ) );
|
||||
connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) );
|
||||
connect( saveButton, SIGNAL( clicked( void ) ), this, SLOT( save ( void ) ) );
|
||||
connect( playButton, SIGNAL( clicked( ) ), this, SLOT( play ( ) ) );
|
||||
connect( downloadButton, SIGNAL( clicked( ) ), this, SLOT( download ( ) ) );
|
||||
connect( cancelButton, SIGNAL( clicked( ) ), this, SLOT( cancel( ) ) );
|
||||
connect( deleteButton, SIGNAL( clicked( ) ), this, SLOT( del( ) ) );
|
||||
connect( copyLinkButton, SIGNAL( clicked( ) ), this, SLOT( copyLink ( ) ) );
|
||||
connect( saveButton, SIGNAL( clicked( ) ), this, SLOT( save ( ) ) );
|
||||
|
||||
/* once off check - if remote, check if we have it
|
||||
* NB: This check might be expensive - and it'll happen often!
|
||||
|
@ -129,12 +130,21 @@ void SubFileItem::Setup()
|
|||
}
|
||||
}
|
||||
|
||||
deleteButton->setVisible(mFlag & SFI_FLAG_ALLOW_DELETE);
|
||||
downloadButton->setVisible(mMode < SFI_STATE_LOCAL);
|
||||
cancelButton->setVisible(mMode < SFI_STATE_LOCAL);
|
||||
|
||||
smaller();
|
||||
updateItemStatic();
|
||||
updateItem();
|
||||
}
|
||||
|
||||
|
||||
void SubFileItem::del()
|
||||
{
|
||||
emit wantsToBeDeleted();
|
||||
}
|
||||
|
||||
bool SubFileItem::done()
|
||||
{
|
||||
return (mMode >= SFI_STATE_LOCAL);
|
||||
|
@ -176,7 +186,7 @@ void SubFileItem::updateItemStatic()
|
|||
}
|
||||
|
||||
/* get full path for local file */
|
||||
if ((mMode == SFI_STATE_LOCAL) || (mMode == SFI_STATE_UPLOAD))
|
||||
if (((mMode == SFI_STATE_LOCAL) || (mMode == SFI_STATE_UPLOAD)))
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "SubFileItem::updateItemStatic() STATE=Local/Upload checking path";
|
||||
|
@ -190,7 +200,10 @@ void SubFileItem::updateItemStatic()
|
|||
/* look up path */
|
||||
if (!rsFiles->FileDetails(mFileHash, hintflags, fi))
|
||||
{
|
||||
mMode = SFI_STATE_ERROR;
|
||||
if(mFlag & SFI_FLAG_ASSUME_FILE_READY)
|
||||
mMode = SFI_STATE_REMOTE;
|
||||
else
|
||||
mMode = SFI_STATE_ERROR;
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "SubFileItem::updateItemStatic() STATE=>Error No Details";
|
||||
std::cerr << std::endl;
|
||||
|
@ -241,6 +254,7 @@ void SubFileItem::updateItemStatic()
|
|||
case SFI_STATE_REMOTE:
|
||||
playButton->setEnabled(false);
|
||||
downloadButton->setEnabled(true);
|
||||
downloadButton->setVisible(true);
|
||||
cancelButton->setEnabled(false);
|
||||
|
||||
progressBar->setValue(0);
|
||||
|
@ -713,8 +727,8 @@ void SubFileItem::copyLink()
|
|||
return;
|
||||
}
|
||||
|
||||
RetroShareLink link;
|
||||
if (link.createFile(QString::fromUtf8(mFileName.c_str()), mFileSize, QString::fromStdString(mFileHash.toStdString()))) {
|
||||
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(mFileName.c_str()), mFileSize, QString::fromStdString(mFileHash.toStdString()));
|
||||
if (link.valid()) {
|
||||
QList<RetroShareLink> urls;
|
||||
urls.push_back(link);
|
||||
RSLinkClipboard::copyLinks(urls);
|
||||
|
|
|
@ -40,7 +40,9 @@ const uint32_t SFI_STATE_UPLOAD = 0x0006;
|
|||
const uint32_t SFI_TYPE_CHANNEL = 0x0010;
|
||||
const uint32_t SFI_TYPE_ATTACH = 0x0020;
|
||||
|
||||
const uint32_t SFI_FLAG_CREATE = 0x1000;
|
||||
const uint32_t SFI_FLAG_CREATE = 0x1000;
|
||||
const uint32_t SFI_FLAG_ALLOW_DELETE = 0x2000;
|
||||
const uint32_t SFI_FLAG_ASSUME_FILE_READY = 0x4000;
|
||||
|
||||
|
||||
//! This create a gui widget that allows users to access files shared by user
|
||||
|
@ -86,10 +88,14 @@ private slots:
|
|||
void toggle();
|
||||
|
||||
void cancel();
|
||||
void del();
|
||||
void save();
|
||||
|
||||
void updateItem();
|
||||
|
||||
signals:
|
||||
void wantsToBeDeleted();
|
||||
|
||||
private:
|
||||
void Setup();
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue