Merge branch 'master' into android

This commit is contained in:
Gio 2016-10-26 13:43:24 +02:00
commit ea42d822c2
257 changed files with 11438 additions and 22401 deletions

View file

@ -25,16 +25,16 @@
#include <QMenu>
#include <algorithm>
#include "gui/Circles/CreateCircleDialog.h"
#include "gui/gxs/GxsIdDetails.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsidentity.h>
#include "gui/common/AvatarDefs.h"
#include "gui/Circles/CreateCircleDialog.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/Identity/IdDialog.h"
#include "gui/Identity/IdEditDialog.h"
#include <algorithm>
//#define DEBUG_CREATE_CIRCLE_DIALOG 1
#define CREATECIRCLEDIALOG_CIRCLEINFO 2
@ -258,8 +258,9 @@ void CreateCircleDialog::addMember()
QString keyId = item->text(RSCIRCLEID_COL_KEYID);
QString idtype = item->text(RSCIRCLEID_COL_IDTYPE);
QString nickname = item->text(RSCIRCLEID_COL_NICKNAME);
QIcon icon = item->icon(RSCIRCLEID_COL_NICKNAME);
addMember(keyId, idtype, nickname);
addMember(keyId, idtype, nickname, icon);
}
void CreateCircleDialog::addMember(const RsGxsIdGroup &idGroup)
@ -267,15 +268,27 @@ void CreateCircleDialog::addMember(const RsGxsIdGroup &idGroup)
QString keyId = QString::fromStdString(idGroup.mMeta.mGroupId.toStdString());
QString nickname = QString::fromUtf8(idGroup.mMeta.mGroupName.c_str());
QString idtype = tr("Anon Id");
QPixmap pixmap ;
if(idGroup.mImage.mSize == 0 || !pixmap.loadFromData(idGroup.mImage.mData, idGroup.mImage.mSize, "PNG"))
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(idGroup.mMeta.mGroupId)));
if (idGroup.mPgpKnown){
RsPeerDetails details;
rsPeers->getGPGDetails(idGroup.mPgpId, details);
idtype = QString::fromUtf8(details.name.c_str());
}//if (idGroup.mPgpKnown)
addMember(keyId, idtype, nickname);
addMember(keyId, idtype, nickname, QIcon(pixmap));
}
void CreateCircleDialog::addMember(const QString& keyId, const QString& idtype, const QString& nickname )
{
QIcon icon;
addMember(keyId, idtype, nickname, icon);
}
void CreateCircleDialog::addMember(const QString& keyId, const QString& idtype, const QString& nickname, const QIcon& icon)
{
QTreeWidget *tree = ui.treeWidget_membership;
@ -293,9 +306,9 @@ void CreateCircleDialog::addMember(const QString& keyId, const QString& idtype,
QTreeWidgetItem *member = new QTreeWidgetItem();
member->setText(RSCIRCLEID_COL_NICKNAME, nickname);
member->setIcon(RSCIRCLEID_COL_NICKNAME, icon);
member->setText(RSCIRCLEID_COL_KEYID, keyId);
member->setText(RSCIRCLEID_COL_IDTYPE, idtype);
//member->setIcon(RSCIRCLEID_COL_NICKNAME, pixmap);
tree->addTopLevelItem(member);
@ -317,14 +330,19 @@ void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails)
QString nickname = QString::fromUtf8(gxs_details.mNickname.c_str());
QString idtype = tr("Anon Id");
addMember(keyId, idtype, nickname);
QPixmap pixmap ;
if(gxs_details.mAvatar.mSize == 0 || !pixmap.loadFromData(gxs_details.mAvatar.mData, gxs_details.mAvatar.mSize, "PNG"))
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(gxs_details.mId));
addMember(keyId, idtype, nickname, QIcon(pixmap));
}//if(!gxs_id.isNull() && rsIdentity->getIdDetails(gxs_id,gxs_details))
}//for (itUnknownPeers it = cirDetails.mUnknownPeers.begin()
typedef std::set<RsPgpId>::const_iterator itAllowedPeers;
for (itAllowedPeers it = cirDetails.mAllowedNodes.begin() ; it != cirDetails.mAllowedNodes.end() ; ++it )
{
{
RsPgpId gpg_id = *it;
RsPeerDetails details ;
if(!gpg_id.isNull() && rsPeers->getGPGDetails(gpg_id,details)) {
@ -333,7 +351,10 @@ void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails)
QString nickname = QString::fromUtf8(details.name.c_str());
QString idtype = tr("PGP Identity");
addMember(keyId, idtype, nickname);
QPixmap avatar;
AvatarDefs::getAvatarFromGpgId(gpg_id, avatar);
addMember(keyId, idtype, nickname, QIcon(avatar));
}//if(!gpg_id.isNull() && rsPeers->getGPGDetails(gpg_id,details))
}//for (itAllowedPeers it = cirDetails.mAllowedPeers.begin()
@ -756,7 +777,7 @@ void CreateCircleDialog::loadIdentities(uint32_t token)
bool acceptAllPGP = ui.radioButton_ListAllPGP->isChecked();
//bool acceptKnownPGP = ui.radioButton_ListKnownPGP->isChecked();
RsGxsIdGroup data;
RsGxsIdGroup idGroup;
std::vector<RsGxsIdGroup> datavector;
std::vector<RsGxsIdGroup>::iterator vit;
if (!rsIdentity->getGroupData(token, datavector)) {
@ -765,67 +786,68 @@ void CreateCircleDialog::loadIdentities(uint32_t token)
return;
}
for(vit = datavector.begin(); vit != datavector.end(); ++vit)
{
data = (*vit);
for(vit = datavector.begin(); vit != datavector.end(); ++vit)
{
idGroup = (*vit);
/* do filtering */
bool ok = false;
if (acceptAnonymous)
ok = true;
else if (acceptAllPGP)
ok = data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID ;
else if (data.mPgpKnown)
ok = data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID ;
/* do filtering */
bool ok = false;
if (acceptAnonymous)
ok = true;
else if (acceptAllPGP)
ok = idGroup.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID ;
else if (idGroup.mPgpKnown)
ok = idGroup.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID ;
if (!ok) {
if (!ok) {
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
std::cerr << "CreateCircleDialog::insertIdentities() Skipping ID: " << data.mMeta.mGroupId;
std::cerr << std::endl;
std::cerr << "CreateCircleDialog::insertIdentities() Skipping ID: " << data.mMeta.mGroupId;
std::cerr << std::endl;
#endif
continue;
}
continue;
}
QString keyId = QString::fromStdString(data.mMeta.mGroupId.toStdString());
QString nickname = QString::fromUtf8(data.mMeta.mGroupName.c_str());
QString idtype = tr("Anon Id");
QPixmap pixmap ;
QString keyId = QString::fromStdString(idGroup.mMeta.mGroupId.toStdString());
QString nickname = QString::fromUtf8(idGroup.mMeta.mGroupName.c_str());
QString idtype = tr("Anon Id");
if(data.mImage.mSize == 0 || !pixmap.loadFromData(data.mImage.mData, data.mImage.mSize, "PNG"))
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(data.mMeta.mGroupId))) ;
QPixmap pixmap ;
if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
{
if (data.mPgpKnown) {
RsPeerDetails details;
rsPeers->getGPGDetails(data.mPgpId, details);
idtype = QString::fromUtf8(details.name.c_str());
}
else
idtype = tr("PGP Linked Id");
}
if(idGroup.mImage.mSize == 0 || !pixmap.loadFromData(idGroup.mImage.mData, idGroup.mImage.mSize, "PNG"))
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(idGroup.mMeta.mGroupId))) ;
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(RSCIRCLEID_COL_NICKNAME, nickname);
item->setIcon(RSCIRCLEID_COL_NICKNAME, QIcon(pixmap));
item->setText(RSCIRCLEID_COL_KEYID, keyId);
item->setText(RSCIRCLEID_COL_IDTYPE, idtype);
tree->addTopLevelItem(item);
if (idGroup.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
{
if (idGroup.mPgpKnown) {
RsPeerDetails details;
rsPeers->getGPGDetails(idGroup.mPgpId, details);
idtype = QString::fromUtf8(details.name.c_str());
}
else
idtype = tr("PGP Linked Id");
// External Circle.
if (mIsExistingCircle)
{
// check if its in the circle.
}
// We use an explicit cast
//
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(RSCIRCLEID_COL_NICKNAME, nickname);
item->setIcon(RSCIRCLEID_COL_NICKNAME, QIcon(pixmap));
item->setText(RSCIRCLEID_COL_KEYID, keyId);
item->setText(RSCIRCLEID_COL_IDTYPE, idtype);
tree->addTopLevelItem(item);
if ( mCircleGroup.mInvitedMembers.find(RsGxsId(data.mMeta.mGroupId)) != mCircleGroup.mInvitedMembers.end()) /* found it */
addMember(keyId, idtype, nickname);
}
}
// External Circle.
if (mIsExistingCircle)
{
// check if its in the circle.
// We use an explicit cast
//
if ( mCircleGroup.mInvitedMembers.find(RsGxsId(idGroup.mMeta.mGroupId)) != mCircleGroup.mInvitedMembers.end()) /* found it */
addMember(keyId, idtype, nickname, QIcon(pixmap));
}
}
}
void CreateCircleDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)

View file

@ -41,6 +41,7 @@ public:
void editNewId(bool isExternal);
void editExistingId(const RsGxsGroupId &circleId, const bool &clearList = true, bool readonly=true);
void addMember(const QString &keyId, const QString &idtype, const QString &nickname, const QIcon &icon);
void addMember(const QString &keyId, const QString &idtype, const QString &nickname);
void addMember(const RsGxsIdGroup &idGroup);
void addCircle(const RsGxsCircleDetails &cirDetails);

View file

@ -738,8 +738,8 @@ void SearchDialog::showAdvSearchDialog(bool show)
if (advSearchDialog == 0 && show)
{
advSearchDialog = new AdvancedSearchDialog();
connect(advSearchDialog, SIGNAL(search(Expression*)),
this, SLOT(advancedSearch(Expression*)));
connect(advSearchDialog, SIGNAL(search(RsRegularExpression::Expression*)),
this, SLOT(advancedSearch(RsRegularExpression::Expression*)));
}
if (show) {
advSearchDialog->show();
@ -774,7 +774,7 @@ void SearchDialog::initSearchResult(const QString& txt, qulonglong searchId, int
ui.searchSummaryWidget->setCurrentItem(item2);
}
void SearchDialog::advancedSearch(Expression* expression)
void SearchDialog::advancedSearch(RsRegularExpression::Expression* expression)
{
advSearchDialog->hide();
@ -782,7 +782,7 @@ void SearchDialog::advancedSearch(Expression* expression)
std::list<DirDetails> results;
// send a turtle search request
LinearizedExpression e ;
RsRegularExpression::LinearizedExpression e ;
expression->linearize(e) ;
TurtleRequestId req_id = rsTurtle->turtleSearch(e) ;
@ -843,8 +843,8 @@ void SearchDialog::searchKeywords(const QString& keywords)
if (n < 1)
return;
NameExpression exprs(ContainsAllStrings,words,true) ;
LinearizedExpression lin_exp ;
RsRegularExpression::NameExpression exprs(RsRegularExpression::ContainsAllStrings,words,true) ;
RsRegularExpression::LinearizedExpression lin_exp ;
exprs.linearize(lin_exp) ;
TurtleRequestId req_id ;
@ -1042,9 +1042,10 @@ void SearchDialog::insertDirectory(const QString &txt, qulonglong searchId, cons
}
/* go through all children directories/files for a recursive call */
for (std::list<DirStub>::const_iterator it(dir.children.begin()); it != dir.children.end(); ++it) {
for (uint32_t i=0;i<dir.children.size();++i)
{
DirDetails details;
rsFiles->RequestDirDetails(it->ref, details, FileSearchFlags(0u));
rsFiles->RequestDirDetails(dir.children[i].ref, details, FileSearchFlags(0u));
insertDirectory(txt, searchId, details, child);
}
}

View file

@ -27,9 +27,10 @@
#include "mainpage.h"
class AdvancedSearchDialog;
class Expression;
class RSTreeWidgetItemCompareRole;
namespace RsRegularExpression { class Expression; }
#define FRIEND_SEARCH 1
#define ANONYMOUS_SEARCH 2
class SearchDialog : public MainPage
@ -99,7 +100,7 @@ private slots:
void showAdvSearchDialog(bool=true);
/** perform the advanced search */
void advancedSearch(Expression*);
void advancedSearch(RsRegularExpression::Expression*);
void selectSearchResults(int index = -1);
void hideOrShowSearchResult(QTreeWidgetItem* resultItem, QString currentSearchId = QString(), int fileTypeIndex = -1);

View file

@ -349,9 +349,6 @@ TransfersDialog::TransfersDialog(QWidget *parent)
// ui.tunnelInfoWidget->setFocusPolicy(Qt::NoFocus);
/** Setup the actions for the context menu */
toggleShowCacheTransfersAct = new QAction(tr( "Show file list transfers" ), this );
toggleShowCacheTransfersAct->setCheckable(true) ;
connect(toggleShowCacheTransfersAct,SIGNAL(triggered()),this,SLOT(toggleShowCacheTransfers())) ;
// Actions. Only need to be defined once.
pauseAct = new QAction(QIcon(IMAGE_PAUSE), tr("Pause"), this);
@ -519,12 +516,6 @@ UserNotify *TransfersDialog::getUserNotify(QObject *parent)
return new TransferUserNotify(parent);
}
void TransfersDialog::toggleShowCacheTransfers()
{
_show_cache_transfers = !_show_cache_transfers ;
insertTransfers() ;
}
void TransfersDialog::processSettings(bool bLoad)
{
m_bProcessSettings = true;
@ -537,9 +528,6 @@ void TransfersDialog::processSettings(bool bLoad)
if (bLoad) {
// load settings
// state of checks
_show_cache_transfers = Settings->value("showCacheTransfers", false).toBool();
// state of the lists
DLHeader->restoreState(Settings->value("downloadList").toByteArray());
ULHeader->restoreState(Settings->value("uploadList").toByteArray());
@ -565,9 +553,6 @@ void TransfersDialog::processSettings(bool bLoad)
} else {
// save settings
// state of checks
Settings->setValue("showCacheTransfers", _show_cache_transfers);
// state of the lists
Settings->setValue("downloadList", DLHeader->saveState());
Settings->setValue("uploadList", ULHeader->saveState());
@ -801,9 +786,6 @@ void TransfersDialog::downloadListCustomPopupMenu( QPoint /*point*/ )
contextMnu.addSeparator() ;//-----------------------------------------------
contextMnu.addAction( toggleShowCacheTransfersAct ) ;
toggleShowCacheTransfersAct->setChecked(_show_cache_transfers) ;
collCreateAct->setEnabled(true) ;
collModifAct->setEnabled(single && add_CollActions) ;
collViewAct->setEnabled(single && add_CollActions) ;
@ -1269,13 +1251,6 @@ void TransfersDialog::insertTransfers()
continue;
}
if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !_show_cache_transfers) {
// if file transfer is a cache file index file, don't show it
DLListModel->removeRow(row);
rowCount = DLListModel->rowCount();
continue;
}
hashs.erase(hashIt);
if (addItem(row, fileInfo) < 0) {
@ -1295,11 +1270,6 @@ void TransfersDialog::insertTransfers()
continue;
}
if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !_show_cache_transfers) {
//if file transfer is a cache file index file, don't show it
continue;
}
addItem(-1, fileInfo);
}
@ -1322,9 +1292,6 @@ void TransfersDialog::insertTransfers()
if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_UPLOAD, info))
continue;
if((info.transfer_info_flags & RS_FILE_REQ_CACHE) && _show_cache_transfers)
continue ;
std::list<TransferInfo>::iterator pit;
for(pit = info.peers.begin(); pit != info.peers.end(); ++pit)
{

View file

@ -199,7 +199,6 @@ private:
QAction *chunkProgressiveAct;
QAction *chunkStreamingAct;
QAction *detailsFileAct;
QAction *toggleShowCacheTransfersAct;
QAction *renameFileAct;
QAction *specifyDestinationDirectoryAct;
QAction *expandAllAct;
@ -249,7 +248,6 @@ private:
/** Qt Designer generated object */
Ui::TransfersDialog ui;
bool _show_cache_transfers ;
public slots:
// these two functions add entries to the transfers dialog, and return the row id of the entry modified/added
//
@ -259,7 +257,6 @@ public slots:
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);
void showFileDetails() ;
void toggleShowCacheTransfers() ;
double getProgress(int row, QStandardItemModel *model);
double getSpeed(int row, QStandardItemModel *model);

View file

@ -54,7 +54,7 @@
#define IMAGE_NETWORK2 ":/icons/png/netgraph.png"
#define IMAGE_PEERS ":/icons/png/keyring.png"
#define IMAGE_IDENTITY ":/images/identity/identities_32.png"
#define IMAGE_CIRCLES ":/icons/png/circles.png"
//#define IMAGE_CIRCLES ":/icons/png/circles.png"
/******
* #define FRIENDS_DEBUG 1

View file

@ -107,13 +107,13 @@ void GenCertDialog::grabMouse()
if(ui.entropy_bar->value() < 20)
{
ui.genButton->setEnabled(false) ;
ui.genButton->setIcon(QIcon(":/images/delete.png")) ;
//ui.genButton->setIcon(QIcon(":/images/delete.png")) ;
ui.genButton->setToolTip(tr("Currently disabled. Please move your mouse around until you reach at least 20%")) ;
}
else
{
ui.genButton->setEnabled(true) ;
ui.genButton->setIcon(QIcon(":/images/resume.png")) ;
//ui.genButton->setIcon(QIcon(":/images/resume.png")) ;
ui.genButton->setToolTip(tr("Click to create your node and/or profile")) ;
}
@ -133,7 +133,7 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
ui.headerFrame->setHeaderImage(QPixmap(":/images/contact_new128.png"));
ui.headerFrame->setHeaderImage(QPixmap(":/icons/svg/profile.svg"));
ui.headerFrame->setHeaderText(tr("Create a new profile"));
connect(ui.new_gpg_key_checkbox, SIGNAL(clicked()), this, SLOT(newGPGKeyGenUiSetup()));

File diff suppressed because it is too large Load diff

View file

@ -756,7 +756,10 @@ void MainWindow::updateFriends()
void MainWindow::postModDirectories(bool update_local)
{
RSettingsWin::postModDirectories(update_local);
ShareManager::postModDirectories(update_local);
// Why would we need that?? The effect is to reset the flags while we're changing them, so it's really not
// a good idea.
//ShareManager::postModDirectories(update_local);
QCoreApplication::flush();
}

View file

@ -42,6 +42,7 @@ public:
const QString idtype() const { return _idtype; }
const QString nickname() const { return _nickname; }
const QString gxsId() const { return _gxsId; }
const QImage avatar() const { return _avatar; }
signals:
void addButtonClicked();

View file

@ -557,7 +557,7 @@ void PeopleDialog::addToCircleInt()
std::map<RsPgpId,IdentityWidget *>::iterator itIdFound;
if((itIdFound=_pgp_identity_widgets.find(pgp_id)) != _pgp_identity_widgets.end()) {
IdentityWidget *idWidget = itIdFound->second;
dlg.addMember(idWidget->keyId(), idWidget->idtype(), idWidget->nickname());
dlg.addMember(idWidget->keyId(), idWidget->idtype(), idWidget->nickname(), QIcon(QPixmap::fromImage(idWidget->avatar())) );
}//if((itFound=_pgp_identity_widgets.find(pgp_id)) != _pgp_identity_widgets.end())
dlg.editExistingId(circle->groupInfo().mGroupId, false,false);
@ -769,7 +769,7 @@ void PeopleDialog::fl_flowLayoutItemDroppedInt(QList<FlowLayoutItem *>flListItem
IdentityWidget* idDest = qobject_cast<IdentityWidget*>(dest);
if (idDest) {
if (idDest->havePGPDetail()){
dlg.addMember(idDest->keyId(), idDest->idtype(), idDest->nickname());
dlg.addMember(idDest->keyId(), idDest->idtype(), idDest->nickname(), QIcon(QPixmap::fromImage(idDest->avatar())) );
}//if (idDest->havePGPDetail())
}//if (idDest)
@ -790,7 +790,7 @@ void PeopleDialog::fl_flowLayoutItemDroppedInt(QList<FlowLayoutItem *>flListItem
} else {//if (cirDropped)
IdentityWidget* idDropped = qobject_cast<IdentityWidget*>(flCurs);
if (idDropped){
dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname());
dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname(), QIcon(QPixmap::fromImage(idDropped->avatar())) );
}//if (idDropped)
}//else (cirDropped)
@ -980,7 +980,7 @@ void PeopleDialog::pf_dropEventOccursInt(QDropEvent *event)
IdentityWidget* idDropped = qobject_cast<IdentityWidget*>(flCurs);
if (idDropped){
if (idDropped->havePGPDetail()){
dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname());
dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname(), QIcon(QPixmap::fromImage(idDropped->avatar())) );
atLeastOne = true;
}//if (idDropped->havePGPDetail())
}//if (idDropped)
@ -1015,7 +1015,7 @@ void PeopleDialog::pf_dropEventOccursInt(QDropEvent *event)
IdentityWidget* idDropped = qobject_cast<IdentityWidget*>(flCurs);
if (idDropped){
if (idDropped->havePGPDetail()){
dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname());
dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname(), QIcon(QPixmap::fromImage(idDropped->avatar())) );
atLeastOne = true;
}//if (idDropped->havePGPDetail())

View file

@ -13,8 +13,17 @@
<property name="windowTitle">
<string>Submit Post</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<layout class="QGridLayout" name="PostedCreatePostDialogGLayout">
<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>
<property name="spacing">
@ -31,14 +40,14 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="frame">
<widget class="QFrame" name="mainFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="mainFrameGLayout">
<item row="0" column="0" colspan="3">
<widget class="StyledLabel" name="info_label">
<property name="palette">
@ -120,7 +129,7 @@
</widget>
</item>
<item row="1" column="0" colspan="3">
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="titleGLayout">
<item row="0" column="1">
<widget class="QLineEdit" name="titleEdit"/>
</item>
@ -144,9 +153,9 @@
</layout>
</item>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="signedHLayout">
<item>
<spacer name="spacer_2">
<spacer name="signedHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -162,7 +171,7 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="signedLabel">
<property name="text">
<string>Signed by: </string>
</property>
@ -183,12 +192,12 @@
</widget>
</item>
<item>
<widget class="QTextEdit" name="notesTextEdit"/>
<widget class="MimeTextEdit" name="notesTextEdit"/>
</item>
</layout>
</item>
<item row="4" column="0">
<spacer name="horizontalSpacer">
<spacer name="buttonHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -235,6 +244,11 @@
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>MimeTextEdit</class>
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
<customwidget>
<class>GxsIdChooser</class>
<extends>QComboBox</extends>
@ -246,9 +260,7 @@
<header>gui/common/StyledLabel.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>

View file

@ -38,6 +38,7 @@
#include <set>
#include <algorithm>
#include <time.h>
/*****
* #define RDM_DEBUG
@ -63,6 +64,11 @@ Qt::DropActions RetroshareDirModel::supportedDragActions() const
}
#endif
static bool isNewerThanEpoque(uint32_t age)
{
return age < time(NULL) - 1000 ; // this should be conservative enough
}
void FlatStyle_RDM::update()
{
if(_needs_update)
@ -80,6 +86,11 @@ void RetroshareDirModel::treeStyle()
peerIcon = QIcon(":/images/user/identity16.png");
}
void TreeStyle_RDM::updateRef(const QModelIndex& indx) const
{
rsFiles->requestDirUpdate(indx.internalPointer()) ;
}
bool TreeStyle_RDM::hasChildren(const QModelIndex &parent) const
{
@ -99,10 +110,9 @@ bool TreeStyle_RDM::hasChildren(const QModelIndex &parent) const
void *ref = parent.internalPointer();
const DirDetails *details = requestDirDetails(ref, RemoteMode);
if (!details)
{
DirDetails details ;
if (!requestDirDetails(ref, RemoteMode,details))
{
/* error */
#ifdef RDM_DEBUG
std::cerr << "lookup failed -> false";
@ -111,7 +121,7 @@ bool TreeStyle_RDM::hasChildren(const QModelIndex &parent) const
return false;
}
if (details->type == DIR_TYPE_FILE)
if (details.type == DIR_TYPE_FILE)
{
#ifdef RDM_DEBUG
std::cerr << "lookup FILE -> false";
@ -124,7 +134,7 @@ bool TreeStyle_RDM::hasChildren(const QModelIndex &parent) const
std::cerr << "lookup PER/DIR #" << details->count;
std::cerr << std::endl;
#endif
return (details->count > 0); /* do we have children? */
return (details.count > 0); /* do we have children? */
}
bool FlatStyle_RDM::hasChildren(const QModelIndex &parent) const
{
@ -155,9 +165,9 @@ int TreeStyle_RDM::rowCount(const QModelIndex &parent) const
void *ref = (parent.isValid())? parent.internalPointer() : NULL ;
const DirDetails *details = requestDirDetails(ref, RemoteMode);
DirDetails details ;
if (!details)
if (! requestDirDetails(ref, RemoteMode,details))
{
#ifdef RDM_DEBUG
std::cerr << "lookup failed -> 0";
@ -165,7 +175,7 @@ int TreeStyle_RDM::rowCount(const QModelIndex &parent) const
#endif
return 0;
}
if (details->type == DIR_TYPE_FILE)
if (details.type == DIR_TYPE_FILE)
{
#ifdef RDM_DEBUG
std::cerr << "lookup FILE: 0";
@ -179,7 +189,7 @@ int TreeStyle_RDM::rowCount(const QModelIndex &parent) const
std::cerr << "lookup PER/DIR #" << details->count;
std::cerr << std::endl;
#endif
return details->count;
return details.count;
}
int FlatStyle_RDM::rowCount(const QModelIndex &parent) const
@ -190,6 +200,7 @@ int FlatStyle_RDM::rowCount(const QModelIndex &parent) const
std::cerr << "RetroshareDirModel::rowCount(): " << parent.internalPointer();
std::cerr << ": ";
#endif
RS_STACK_MUTEX(_ref_mutex) ;
return _ref_entries.size() ;
}
@ -236,7 +247,7 @@ QString RetroshareDirModel::getAgeIndicatorString(const DirDetails &details) con
QString ret("");
QString nind = tr("NEW");
// QString oind = tr("OLD");
uint32_t age = details.age;
uint32_t age = details.min_age;
switch (ageIndicator) {
case IND_LAST_DAY:
@ -266,7 +277,7 @@ QVariant RetroshareDirModel::decorationRole(const DirDetails& details,int coln)
return QVariant() ;
if (details.type == DIR_TYPE_PERSON)
{
{
if(details.min_age > ageIndicator)
return QIcon(":/images/folder_grey.png");
else if (ageIndicator == IND_LAST_DAY )
@ -294,7 +305,10 @@ QVariant RetroshareDirModel::decorationRole(const DirDetails& details,int coln)
else if (details.type == DIR_TYPE_FILE) /* File */
{
// extensions predefined
return FilesDefs::getIconFromFilename(QString::fromUtf8(details.name.c_str()));
if(details.hash.isNull())
return QIcon(":/images/reset.png") ; // file is being hashed
else
return FilesDefs::getIconFromFilename(QString::fromUtf8(details.name.c_str()));
}
else
return QVariant();
@ -313,14 +327,16 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
if (details.type == DIR_TYPE_PERSON) /* Person */
{
switch(coln)
switch(coln)
{
case 0:
return (RemoteMode)?(QString::fromUtf8(rsPeers->getPeerName(details.id).c_str())):tr("My files");
case 1:
return QString() ;
case 2:
return misc::userFriendlyDuration(details.min_age);
case 2: if(!isNewerThanEpoque(details.min_age))
return QString();
else
return misc::userFriendlyDuration(details.min_age);
default:
return QString() ;
}
@ -334,7 +350,7 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
case 1:
return misc::friendlyUnit(details.count);
case 2:
return misc::userFriendlyDuration(details.age);
return misc::userFriendlyDuration(details.min_age);
case 3:
return getFlagsString(details.flags);
// case 4:
@ -381,16 +397,16 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
QString FlatStyle_RDM::computeDirectoryPath(const DirDetails& details) const
{
QString dir ;
const DirDetails *det = requestDirDetails(details.parent,RemoteMode);
DirDetails det ;
if(!det)
return QString();
if(!requestDirDetails(details.parent,RemoteMode,det))
return QString();
#ifdef SHOW_TOTAL_PATH
do
{
#endif
dir = QString::fromUtf8(det->name.c_str())+"/"+dir ;
dir = QString::fromUtf8(det.name.c_str())+"/"+dir ;
#ifdef SHOW_TOTAL_PATH
if(!requestDirDetails(det.parent,det,flags))
@ -409,7 +425,7 @@ QVariant FlatStyle_RDM::displayRole(const DirDetails& details,int coln) const
{
case 0: return QString::fromUtf8(details.name.c_str());
case 1: return misc::friendlyUnit(details.count);
case 2: return misc::userFriendlyDuration(details.age);
case 2: return misc::userFriendlyDuration(details.min_age);
case 3: return QString::fromUtf8(rsPeers->getPeerName(details.id).c_str());
case 4: return computeDirectoryPath(details);
default:
@ -449,7 +465,7 @@ QVariant TreeStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails&
case 1:
return (qulonglong) details.count;
case 2:
return details.age;
return details.min_age;
case 3:
return getFlagsString(details.flags);
case 4:
@ -481,7 +497,7 @@ QVariant TreeStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails&
}
return QVariant();
}
QVariant FlatStyle_RDM::sortRole(const QModelIndex& index,const DirDetails& details,int coln) const
QVariant FlatStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails& details,int coln) const
{
/*
* Person: name, id, 0, 0;
@ -495,9 +511,14 @@ QVariant FlatStyle_RDM::sortRole(const QModelIndex& index,const DirDetails& deta
{
case 0: return QString::fromUtf8(details.name.c_str());
case 1: return (qulonglong) details.count;
case 2: return details.age;
case 2: return details.min_age;
case 3: return QString::fromUtf8(rsPeers->getPeerName(details.id).c_str());
case 4: return _ref_entries[index.row()].second ;
case 4: {
RS_STACK_MUTEX(_ref_mutex) ;
return computeDirectoryPath(details);
}
}
}
return QVariant();
@ -521,28 +542,30 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
void *ref = index.internalPointer();
int coln = index.column();
const DirDetails *details = requestDirDetails(ref, RemoteMode);
DirDetails details ;
if (!details)
return QVariant();
if (!requestDirDetails(ref, RemoteMode,details))
return QVariant();
if (role == RetroshareDirModel::FileNameRole) /* end of FileNameRole */
return QString::fromUtf8(details->name.c_str());
return QString::fromUtf8(details.name.c_str());
if (role == Qt::TextColorRole)
{
if(details->min_age > ageIndicator)
if(details.type == DIR_TYPE_FILE && details.hash.isNull())
return QVariant(QColor(Qt::green)) ;
else if(details.min_age > ageIndicator)
return QVariant(QColor(Qt::gray)) ;
else if(RemoteMode)
{
FileInfo info;
QVariant local_file_color = QVariant(QColor(Qt::red));
if(rsFiles->alreadyHaveFile(details->hash, info))
if(rsFiles->alreadyHaveFile(details.hash, info))
return local_file_color;
std::list<RsFileHash> downloads;
rsFiles->FileDownloads(downloads);
if(std::find(downloads.begin(), downloads.end(), details->hash) != downloads.end())
if(std::find(downloads.begin(), downloads.end(), details.hash) != downloads.end())
return local_file_color;
else
return QVariant();
@ -553,9 +576,13 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
if(role == Qt::DecorationRole)
return decorationRole(*details,coln) ;
return decorationRole(details,coln) ;
/*****************
if(role == Qt::ToolTipRole)
if(!isNewerThanEpoque(details.min_age))
return tr("This node hasn't sent any directory information yet.") ;
/*****************
Qt::EditRole
Qt::ToolTipRole
Qt::StatusTipRole
@ -578,10 +605,10 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
} /* end of TextAlignmentRole */
if (role == Qt::DisplayRole)
return displayRole(*details,coln) ;
return displayRole(details,coln) ;
if (role == SortRole)
return sortRole(index,*details,coln) ;
return sortRole(index,details,coln) ;
return QVariant();
}
@ -700,6 +727,9 @@ QModelIndex TreeStyle_RDM::index(int row, int column, const QModelIndex & parent
std::cerr << ": row:" << row << " col:" << column << " ";
#endif
// This function is used extensively. There's no way we can use requestDirDetails() in it, which would
// cause far too much overhead. So we use a dedicated function that only grabs the required information.
if(row < 0)
return QModelIndex() ;
@ -712,40 +742,15 @@ QModelIndex TreeStyle_RDM::index(int row, int column, const QModelIndex & parent
}
********/
const DirDetailsVector *details = requestDirDetails(ref, RemoteMode);
if (!details)
{
#ifdef RDM_DEBUG
std::cerr << "lookup failed -> invalid";
std::cerr << std::endl;
#endif
void *result ;
if(rsFiles->findChildPointer(ref, row, result, ((RemoteMode) ? RS_FILE_HINTS_REMOTE : RS_FILE_HINTS_LOCAL)))
return createIndex(row, column, result) ;
else
return QModelIndex();
}
/* now iterate through the details to
* get the reference number
*/
if (row >= (int) details->childrenVector.size())
{
#ifdef RDM_DEBUG
std::cerr << "wrong number of children -> invalid";
std::cerr << std::endl;
#endif
return QModelIndex();
}
#ifdef RDM_DEBUG
std::cerr << "success index(" << row << "," << column << "," << details->childrenVector[row].ref << ")";
std::cerr << std::endl;
#endif
/* we can just grab the reference now */
return createIndex(row, column, details->childrenVector[row].ref);
}
QModelIndex FlatStyle_RDM::index(int row, int column, const QModelIndex & parent) const
{
Q_UNUSED(parent);
@ -757,11 +762,16 @@ QModelIndex FlatStyle_RDM::index(int row, int column, const QModelIndex & parent
if(row < 0)
return QModelIndex() ;
if(row < (int) _ref_entries.size())
{
void *ref = _ref_entries[row].first ;
RS_STACK_MUTEX(_ref_mutex) ;
return createIndex(row, column, ref);
if(row < (int) _ref_entries.size())
{
void *ref = _ref_entries[row];
#ifdef RDM_DEBUG
std::cerr << "Creating index 2 row=" << row << ", column=" << column << ", ref=" << (void*)ref << std::endl;
#endif
return createIndex(row, column, ref);
}
else
return QModelIndex();
@ -786,10 +796,10 @@ QModelIndex TreeStyle_RDM::parent( const QModelIndex & index ) const
}
void *ref = index.internalPointer();
const DirDetails *details = requestDirDetails(ref, RemoteMode);
DirDetails details ;
if (!details)
{
if (! requestDirDetails(ref, RemoteMode,details))
{
#ifdef RDM_DEBUG
std::cerr << "Failed Lookup -> invalid";
std::cerr << std::endl;
@ -797,7 +807,7 @@ QModelIndex TreeStyle_RDM::parent( const QModelIndex & index ) const
return QModelIndex();
}
if (!(details->parent))
if (!(details.parent))
{
#ifdef RDM_DEBUG
std::cerr << "success. parent is Root/NULL --> invalid";
@ -810,8 +820,9 @@ QModelIndex TreeStyle_RDM::parent( const QModelIndex & index ) const
std::cerr << "success index(" << details->prow << ",0," << details->parent << ")";
std::cerr << std::endl;
std::cerr << "Creating index 3 row=" << details.prow << ", column=" << 0 << ", ref=" << (void*)details.parent << std::endl;
#endif
return createIndex(details->prow, 0, details->parent);
return createIndex(details.prow, 0, details.parent);
}
QModelIndex FlatStyle_RDM::parent( const QModelIndex & index ) const
{
@ -836,14 +847,15 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const
void *ref = index.internalPointer();
const DirDetails *details = requestDirDetails(ref, RemoteMode);
DirDetails details ;
if (!details)
return Qt::ItemIsSelectable; // Error.
if (! requestDirDetails(ref, RemoteMode,details))
return Qt::ItemIsSelectable; // Error.
switch(details->type)
switch(details.type)
{
case DIR_TYPE_PERSON: return Qt::ItemIsEnabled;
// we grey out a person that has never been updated. It's easy to spot these, since the min age of the directory is approx equal to time(NULL), which exceeds 40 years.
case DIR_TYPE_PERSON:return isNewerThanEpoque(details.min_age)? (Qt::ItemIsEnabled):(Qt::NoItemFlags) ;
case DIR_TYPE_DIR: return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
case DIR_TYPE_FILE: return Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled;
}
@ -862,6 +874,7 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const
/* Callback from */
void RetroshareDirModel::preMods()
{
emit layoutAboutToBeChanged();
#if QT_VERSION < 0x050000
reset();
#else
@ -877,7 +890,7 @@ void RetroshareDirModel::preMods()
/* Callback from */
void RetroshareDirModel::postMods()
{
emit layoutAboutToBeChanged();
// emit layoutAboutToBeChanged();
#if QT_VERSION >= 0x040600
beginResetModel();
#endif
@ -890,7 +903,7 @@ void RetroshareDirModel::postMods()
// changePersistentIndexList(piList, empty);
/* Clear caches */
mCache.clear();
//mCache.clear();
#ifdef RDM_DEBUG
std::cerr << "RetroshareDirModel::postMods()" << std::endl;
@ -902,32 +915,36 @@ void RetroshareDirModel::postMods()
emit layoutChanged();
}
const DirDetailsVector *RetroshareDirModel::requestDirDetails(void *ref, bool remote) const
bool RetroshareDirModel::requestDirDetails(void *ref, bool remote,DirDetails& d) const
{
const QMap<void*, DirDetailsVector>::const_iterator it = mCache.constFind(ref);
if (it != mCache.constEnd()) {
/* Details found in cache */
return &it.value();
}
FileSearchFlags flags = (remote) ? RS_FILE_HINTS_REMOTE : RS_FILE_HINTS_LOCAL;
/* Get details from the lib */
DirDetailsVector details;
FileSearchFlags flags = (remote) ? RS_FILE_HINTS_REMOTE : RS_FILE_HINTS_LOCAL;
if (rsFiles->RequestDirDetails(ref, details, flags)) {
/* Convert std::list to std::vector for fast access with index */
std::list<DirStub>::const_iterator childIt;
for (childIt = details.children.begin(); childIt != details.children.end(); ++childIt) {
details.childrenVector.push_back(*childIt);
}
/* Add to cache, must cast to none const */
const QMap<void*, DirDetailsVector>::iterator it1 = ((QMap<void*, DirDetailsVector>*) &mCache)->insert(ref, details);
return &it1.value();
}
/* No details found */
return NULL;
return rsFiles->RequestDirDetails(ref, d, flags) ;
}
// const QMap<void*, DirDetailsVector>::const_iterator it = mCache.constFind(ref);
// if (it != mCache.constEnd()) {
// /* Details found in cache */
// return &it.value();
// }
//
//#warning this is terrible! A vector in a std::map will keep being copied and create a lot of CPU overload. Use a pointer instead.
// /* Get details from the lib */
//
// if (rsFiles->RequestDirDetails(ref, details, flags)) {
// /* Convert std::list to std::vector for fast access with index */
// std::list<DirStub>::const_iterator childIt;
// for (childIt = details.children.begin(); childIt != details.children.end(); ++childIt) {
// details.childrenVector.push_back(*childIt);
// }
//
// /* Add to cache, must cast to none const */
// const QMap<void*, DirDetailsVector>::iterator it1 = ((QMap<void*, DirDetailsVector>*) &mCache)->insert(ref, details);
// return &it1.value();
// }
//
// /* No details found */
// return NULL;
//}
void RetroshareDirModel::createCollectionFile(QWidget *parent, const QModelIndexList &list)
{
@ -1010,15 +1027,16 @@ void RetroshareDirModel::downloadDirectory(const DirDetails & dirDetails, int pr
if (!dwlDir.mkpath(cleanPath)) return;
for (it = dirDetails.children.begin(); it != dirDetails.children.end(); ++it)
for(uint32_t i=0;i<dirDetails.children.size();++i)
{
if (!it->ref) continue;
if (!dirDetails.children[i].ref) continue;
const DirDetails *subDirDetails = requestDirDetails(it->ref, true);
DirDetails subDirDetails ;
if (!subDirDetails) continue;
if(!requestDirDetails(dirDetails.children[i].ref, true,subDirDetails))
continue;
downloadDirectory(*subDirDetails, prefixLen);
downloadDirectory(subDirDetails, prefixLen);
}
}
}
@ -1035,12 +1053,12 @@ void RetroshareDirModel::getDirDetailsFromSelect (const QModelIndexList &list, s
{
void *ref = it -> internalPointer();
const DirDetails *details = requestDirDetails(ref, RemoteMode);
DirDetails details ;
if (!details)
if(!requestDirDetails(ref, RemoteMode,details))
continue;
dirVec.push_back(*details);
dirVec.push_back(details);
}
}
}
@ -1072,12 +1090,12 @@ void RetroshareDirModel::getFileInfoFromIndexList(const QModelIndexList& list, s
{
void *ref = it -> internalPointer();
const DirDetails *details = requestDirDetails(ref, RemoteMode);
DirDetails details;
if (!details)
if (!requestDirDetails(ref, RemoteMode,details))
continue;
if(details->type == DIR_TYPE_PERSON)
if(details.type == DIR_TYPE_PERSON)
continue ;
#ifdef RDM_DEBUG
@ -1090,10 +1108,10 @@ void RetroshareDirModel::getFileInfoFromIndexList(const QModelIndexList& list, s
// Note: for directories, the returned hash, is the peer id, so if we collect
// dirs, we need to be a bit more conservative for the
if(already_in.find(details->hash.toStdString()+details->name) == already_in.end())
if(already_in.find(details.hash.toStdString()+details.name) == already_in.end())
{
file_details.push_back(*details) ;
already_in.insert(details->hash.toStdString()+details->name) ;
file_details.push_back(details) ;
already_in.insert(details.hash.toStdString()+details.name) ;
}
}
#ifdef RDM_DEBUG
@ -1128,10 +1146,10 @@ void RetroshareDirModel::openSelected(const QModelIndexList &qmil)
{
if ((*it).type & DIR_TYPE_PERSON) continue;
std::string path, name;
rsFiles->ConvertSharedFilePath((*it).path, path);
//std::string path, name;
//rsFiles->ConvertSharedFilePath((*it).path, path);
QDir dir(QString::fromUtf8(path.c_str()));
QDir dir(QString::fromUtf8((*it).path.c_str()));
QString dest;
if ((*it).type & DIR_TYPE_FILE) {
dest = dir.absoluteFilePath(QString::fromUtf8(it->name.c_str()));
@ -1149,11 +1167,29 @@ void RetroshareDirModel::openSelected(const QModelIndexList &qmil)
#endif
}
void RetroshareDirModel::getFilePath(const QModelIndex& index, std::string& fullpath)
{
void *ref = index.sibling(index.row(),1).internalPointer();
DirDetails details ;
if (!requestDirDetails(ref, false,details) )
{
#ifdef RDM_DEBUG
std::cerr << "getFilePaths() Bad Request" << std::endl;
#endif
return;
}
fullpath = details.path + "/" + details.name;
}
void RetroshareDirModel::getFilePaths(const QModelIndexList &list, std::list<std::string> &fullpaths)
{
#ifdef RDM_DEBUG
std::cerr << "RetroshareDirModel::getFilePaths()" << std::endl;
#endif
#warning make sure we atually output something here
if (RemoteMode)
{
#ifdef RDM_DEBUG
@ -1162,48 +1198,18 @@ void RetroshareDirModel::getFilePaths(const QModelIndexList &list, std::list<std
return;
}
/* translate */
QModelIndexList::const_iterator it;
for(it = list.begin(); it != list.end(); ++it)
for(QModelIndexList::const_iterator it = list.begin(); it != list.end(); ++it)
{
void *ref = it -> internalPointer();
std::string path ;
const DirDetails *details = requestDirDetails(ref, false);
if (!details)
{
getFilePath(*it,path) ;
#ifdef RDM_DEBUG
std::cerr << "getFilePaths() Bad Request" << std::endl;
std::cerr << "Constructed FilePath: " << path << std::endl;
#endif
continue;
}
if (details->type != DIR_TYPE_FILE)
{
#ifdef RDM_DEBUG
std::cerr << "getFilePaths() Not File" << std::endl;
#endif
continue; /* not file! */
}
#ifdef RDM_DEBUG
std::cerr << "::::::::::::File Details:::: " << std::endl;
std::cerr << "Name: " << details->name << std::endl;
std::cerr << "Hash: " << details->hash << std::endl;
std::cerr << "Size: " << details->count << std::endl;
std::cerr << "Path: " << details->path << std::endl;
#endif
std::string filepath = details->path + "/";
filepath += details->name;
#ifdef RDM_DEBUG
std::cerr << "Constructed FilePath: " << filepath << std::endl;
#endif
if (fullpaths.end() == std::find(fullpaths.begin(), fullpaths.end(), filepath))
{
fullpaths.push_back(filepath);
}
}
#warning TERRIBLE COST here. Use a std::set!
if (fullpaths.end() == std::find(fullpaths.begin(), fullpaths.end(), path))
fullpaths.push_back(path);
}
#ifdef RDM_DEBUG
std::cerr << "::::::::::::Done getFilePaths" << std::endl;
#endif
@ -1222,12 +1228,9 @@ QMimeData * RetroshareDirModel::mimeData ( const QModelIndexList & indexes ) con
{
void *ref = it -> internalPointer();
const DirDetails *details = requestDirDetails(ref, RemoteMode);
if (!details)
{
continue;
}
DirDetails details ;
if (!requestDirDetails(ref, RemoteMode,details))
continue;
#ifdef RDM_DEBUG
std::cerr << "::::::::::::FileDrag:::: " << std::endl;
@ -1237,7 +1240,7 @@ QMimeData * RetroshareDirModel::mimeData ( const QModelIndexList & indexes ) con
std::cerr << "Path: " << details->path << std::endl;
#endif
if (details->type != DIR_TYPE_FILE)
if (details.type != DIR_TYPE_FILE)
{
#ifdef RDM_DEBUG
std::cerr << "RetroshareDirModel::mimeData() Not File" << std::endl;
@ -1245,7 +1248,7 @@ QMimeData * RetroshareDirModel::mimeData ( const QModelIndexList & indexes ) con
continue; /* not file! */
}
if (drags.end() != (dit = drags.find(details->hash)))
if (drags.end() != (dit = drags.find(details.hash)))
{
#ifdef RDM_DEBUG
std::cerr << "RetroshareDirModel::mimeData() Duplicate" << std::endl;
@ -1253,9 +1256,9 @@ QMimeData * RetroshareDirModel::mimeData ( const QModelIndexList & indexes ) con
continue; /* duplicate */
}
drags[details->hash] = details->count;
drags[details.hash] = details.count;
QString line = QString("%1/%2/%3/").arg(QString::fromUtf8(details->name.c_str()), QString::fromStdString(details->hash.toStdString()), QString::number(details->count));
QString line = QString("%1/%2/%3/").arg(QString::fromUtf8(details.name.c_str()), QString::fromStdString(details.hash.toStdString()), QString::number(details.count));
if (RemoteMode)
{
@ -1313,17 +1316,18 @@ TreeStyle_RDM::~TreeStyle_RDM()
}
void FlatStyle_RDM::postMods()
{
if(visible())
if(visible())
{
_ref_entries.clear() ;
_ref_stack.clear() ;
emit layoutAboutToBeChanged();
_ref_stack.push_back(NULL) ; // init the stack with the topmost parent directory
std::cerr << "FlatStyle_RDM::postMods(): cleared ref entries" << std::endl;
_needs_update = false ;
updateRefs() ;
}
{
RS_STACK_MUTEX(_ref_mutex) ;
_ref_stack.clear() ;
_ref_stack.push_back(NULL) ; // init the stack with the topmost parent directory
_needs_update = false ;
}
QTimer::singleShot(100,this,SLOT(updateRefs())) ;
}
else
_needs_update = true ;
}
@ -1336,46 +1340,56 @@ void FlatStyle_RDM::updateRefs()
return ;
}
RetroshareDirModel::preMods() ;
RetroshareDirModel::preMods() ;
static const uint32_t MAX_REFS_PER_SECOND = 2000 ;
static const uint32_t MAX_REFS_PER_SECOND = 2000 ;
uint32_t nb_treated_refs = 0 ;
while(!_ref_stack.empty())
{
void *ref = _ref_stack.back() ;
{
RS_STACK_MUTEX(_ref_mutex) ;
_ref_entries.clear() ;
std::cerr << "FlatStyle_RDM::postMods(): cleared ref entries" << std::endl;
while(!_ref_stack.empty())
{
void *ref = _ref_stack.back() ;
#ifdef RDM_DEBUG
std::cerr << "FlatStyle_RDM::postMods(): poped ref " << ref << std::endl;
std::cerr << "FlatStyle_RDM::postMods(): poped ref " << ref << std::endl;
#endif
_ref_stack.pop_back() ;
const DirDetails *details = requestDirDetails(ref, RemoteMode) ;
_ref_stack.pop_back() ;
if (details)
{
if(details->type == DIR_TYPE_FILE) // only push files, not directories nor persons.
_ref_entries.push_back(std::pair<void*,QString>(ref,computeDirectoryPath(*details)));
DirDetails details ;
if (requestDirDetails(ref, RemoteMode,details))
{
if(details.type == DIR_TYPE_FILE) // only push files, not directories nor persons.
_ref_entries.push_back(ref) ;
#ifdef RDM_DEBUG
std::cerr << "FlatStyle_RDM::postMods(): adding ref " << ref << std::endl;
std::cerr << "FlatStyle_RDM::postMods(): adding ref " << ref << std::endl;
#endif
for(std::list<DirStub>::const_iterator it = details->children.begin(); it != details->children.end(); ++it)
_ref_stack.push_back(it->ref) ;
}
if(++nb_treated_refs > MAX_REFS_PER_SECOND) // we've done enough, let's give back hand to
{ // the user and setup a timer to finish the job later.
_needs_update = true ;
for(uint32_t i=0;i<details.children.size();++i)
_ref_stack.push_back(details.children[i].ref) ;
}
if(++nb_treated_refs > MAX_REFS_PER_SECOND) // we've done enough, let's give back hand to
{ // the user and setup a timer to finish the job later.
_needs_update = true ;
if(visible())
QTimer::singleShot(2000,this,SLOT(updateRefs())) ;
else
std::cerr << "Not visible: suspending update"<< std::endl;
break ;
}
}
std::cerr << "reference tab contains " << _ref_entries.size() << " files" << std::endl;
if(visible())
QTimer::singleShot(2000,this,SLOT(updateRefs())) ;
else
std::cerr << "Not visible: suspending update"<< std::endl;
break ;
}
}
std::cerr << "reference tab contains " << _ref_entries.size() << " files" << std::endl;
if(_ref_stack.empty())
_needs_update = false ;
if(_ref_stack.empty())
_needs_update = false ;
}
RetroshareDirModel::postMods() ;
RetroshareDirModel::postMods() ;
}

View file

@ -72,11 +72,14 @@ class RetroshareDirModel : public QAbstractItemModel
void getFileInfoFromIndexList(const QModelIndexList& list, std::list<DirDetails>& files_info) ;
void openSelected(const QModelIndexList &list);
void getFilePaths(const QModelIndexList &list, std::list<std::string> &fullpaths);
void changeAgeIndicator(uint32_t indicator) { ageIndicator = indicator; }
void getFilePath(const QModelIndex& index, std::string& fullpath);
void changeAgeIndicator(uint32_t indicator) { ageIndicator = indicator; }
const DirDetailsVector *requestDirDetails(void *ref, bool remote) const;
bool requestDirDetails(void *ref, bool remote,DirDetails& d) const;
virtual void update() {}
virtual void updateRef(const QModelIndex&) const =0;
public:
virtual QMimeData * mimeData ( const QModelIndexList & indexes ) const;
virtual QStringList mimeTypes () const;
@ -166,7 +169,9 @@ class TreeStyle_RDM: public RetroshareDirModel
virtual ~TreeStyle_RDM() ;
protected:
/* These are all overloaded Virtual Functions */
virtual void updateRef(const QModelIndex&) const ;
/* These are all overloaded Virtual Functions */
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
@ -189,7 +194,7 @@ class FlatStyle_RDM: public RetroshareDirModel
public:
FlatStyle_RDM(bool mode)
: RetroshareDirModel(mode)
: RetroshareDirModel(mode), _ref_mutex("Flat file list")
{
_needs_update = true ;
}
@ -202,7 +207,8 @@ class FlatStyle_RDM: public RetroshareDirModel
void updateRefs() ;
protected:
virtual void postMods();
virtual void updateRef(const QModelIndex&) const {}
virtual void postMods();
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
@ -217,7 +223,8 @@ class FlatStyle_RDM: public RetroshareDirModel
QString computeDirectoryPath(const DirDetails& details) const ;
std::vector<std::pair<void *,QString> > _ref_entries ;// used to store the refs to display
mutable RsMutex _ref_mutex ;
std::vector<void *> _ref_entries ;// used to store the refs to display
std::vector<void *> _ref_stack ; // used to store the refs to update
bool _needs_update ;
};

View file

@ -790,9 +790,10 @@ QString RetroShareLink::toString() const
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
url.setQuery(urlQuery);
return url.toString(QUrl::EncodeSpaces | QUrl::EncodeUnicode);
#else
return url.toString().replace(" ","%20");//Seems to be already done with Qt4 but to be sure.
#endif
return url.toString();
}
QString RetroShareLink::niceName() const

View file

@ -148,7 +148,7 @@ void ShareManager::load()
GroupFlagsWidget *widget = new GroupFlagsWidget(NULL,(*it).shareflags);
listWidget->setRowHeight(row, 32);
listWidget->setRowHeight(row, 32 * QFontMetricsF(font()).height()/14.0);
listWidget->setCellWidget(row, COLUMN_SHARE_FLAGS, widget);
listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem()) ;
@ -157,7 +157,7 @@ void ShareManager::load()
//connect(widget,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateFlags())) ;
}
listWidget->setColumnWidth(COLUMN_SHARE_FLAGS,132) ;
listWidget->setColumnWidth(COLUMN_SHARE_FLAGS,132 * QFontMetricsF(font()).height()/14.0) ;
//ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));
@ -282,6 +282,7 @@ void ShareManager::editShareDirectory()
ShareDialog sharedlg (it->filename, this);
sharedlg.setWindowTitle(tr("Edit Shared Folder"));
sharedlg.exec();
load();
break;
}
}
@ -318,6 +319,7 @@ void ShareManager::showShareDialog()
{
ShareDialog sharedlg ("", this);
sharedlg.exec();
load();
}
void ShareManager::shareddirListCurrentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn)
@ -387,4 +389,6 @@ void ShareManager::dropEvent(QDropEvent *event)
event->setDropAction(Qt::CopyAction);
event->accept();
load();
}

View file

@ -19,6 +19,8 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <set>
#include <QString>
#include <QTreeView>
#include <QClipboard>
@ -83,6 +85,8 @@
//
#define DONT_USE_SEARCH_IN_TREE_VIEW 1
//#define DEBUG_SHARED_FILES_DIALOG 1
const QString Image_AddNewAssotiationForFile = ":/images/kcmsystem24.png";
class SFDSortFilterProxyModel : public QSortFilterProxyModel
@ -134,20 +138,23 @@ SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareD
flat_model = _flat_model ;
tree_proxyModel = new SFDSortFilterProxyModel(tree_model, this);
tree_proxyModel->setDynamicSortFilter(true);
tree_proxyModel->setSourceModel(tree_model);
tree_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
tree_proxyModel->setSortRole(RetroshareDirModel::SortRole);
tree_proxyModel->sort(COLUMN_NAME);
flat_proxyModel = new SFDSortFilterProxyModel(flat_model, this);
flat_proxyModel->setDynamicSortFilter(true);
flat_proxyModel->setSourceModel(flat_model);
flat_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
flat_proxyModel->setSortRole(RetroshareDirModel::SortRole);
flat_proxyModel->sort(COLUMN_NAME);
flat_proxyModel = new SFDSortFilterProxyModel(flat_model, this);
flat_proxyModel->setSourceModel(flat_model);
flat_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
flat_proxyModel->setSortRole(RetroshareDirModel::SortRole);
flat_proxyModel->sort(COLUMN_NAME);
connect(ui.filterClearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
// Mr.Alice: I removed this because it causes a crash for some obscur reason. Apparently when the model is changed, the proxy model cannot
// deal with the change by itself. Should I call something specific? I've no idea. Removing this does not seem to cause any harm either.
//tree_proxyModel->setDynamicSortFilter(true);
//flat_proxyModel->setDynamicSortFilter(true);
connect(ui.filterClearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
connect(ui.filterStartButton, SIGNAL(clicked()), this, SLOT(startFilter()));
connect(ui.filterPatternLineEdit, SIGNAL(returnPressed()), this, SLOT(startFilter()));
connect(ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterRegExpChanged()));
@ -156,10 +163,10 @@ SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareD
QHeaderView * header = ui.dirTreeView->header () ;
header->resizeSection ( COLUMN_NAME, 490 );
header->resizeSection ( COLUMN_SIZE, 70 );
header->resizeSection ( COLUMN_AGE, 100 );
header->resizeSection ( COLUMN_FRIEND, 100 );
header->resizeSection ( COLUMN_DIR, 100 );
header->resizeSection ( COLUMN_SIZE, 70 );
header->resizeSection ( COLUMN_AGE, 100 );
header->resizeSection ( COLUMN_FRIEND,100);
header->resizeSection ( COLUMN_DIR, 100 );
header->setStretchLastSection(false);
@ -224,6 +231,7 @@ RemoteSharedFilesDialog::RemoteSharedFilesDialog(QWidget *parent)
ui.checkButton->hide() ;
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(downloadRemoteSelected()));
connect(ui.dirTreeView, SIGNAL( expanded(const QModelIndex & ) ), this, SLOT( expanded(const QModelIndex & ) ) );
// load settings
processSettings(true);
@ -248,9 +256,15 @@ void SharedFilesDialog::showEvent(QShowEvent *)
{
if(model!=NULL)
{
model->setVisible(true) ;
std::set<std::string> expanded_indexes,selected_indexes ;
saveExpandedPathsAndSelection(expanded_indexes,selected_indexes);
model->setVisible(true) ;
model->update() ;
}
restoreExpandedPathsAndSelection(expanded_indexes,selected_indexes);
}
}
RemoteSharedFilesDialog::~RemoteSharedFilesDialog()
{
@ -327,8 +341,8 @@ void RemoteSharedFilesDialog::processSettings(bool bLoad)
void SharedFilesDialog::changeCurrentViewModel(int viewTypeIndex)
{
//disconnect( ui.dirTreeView, SIGNAL( collapsed(const QModelIndex & ) ), NULL, NULL );
//disconnect( ui.dirTreeView, SIGNAL( expanded(const QModelIndex & ) ), NULL, NULL );
// disconnect( ui.dirTreeView, SIGNAL( collapsed(const QModelIndex & ) ), NULL, NULL );
// disconnect( ui.dirTreeView, SIGNAL( expanded(const QModelIndex & ) ), NULL, NULL );
if(model!=NULL)
model->setVisible(false) ;
@ -336,33 +350,40 @@ void SharedFilesDialog::changeCurrentViewModel(int viewTypeIndex)
if(viewTypeIndex==VIEW_TYPE_TREE)
{
model = tree_model ;
proxyModel = tree_proxyModel ;
proxyModel = tree_proxyModel ;
}
else
{
model = flat_model ;
proxyModel = flat_proxyModel ;
}
proxyModel = flat_proxyModel ;
}
showProperColumns() ;
if(isVisible())
std::set<std::string> expanded_indexes,selected_indexes ;
saveExpandedPathsAndSelection(expanded_indexes,selected_indexes);
if(isVisible())
{
model->setVisible(true) ;
model->setVisible(true) ;
model->update() ;
}
//connect( ui.dirTreeView, SIGNAL( collapsed(const QModelIndex & ) ), model, SLOT( collapsed(const QModelIndex & ) ) );
//connect( ui.dirTreeView, SIGNAL( expanded(const QModelIndex & ) ), model, SLOT( expanded(const QModelIndex & ) ) );
// connect( ui.dirTreeView, SIGNAL( collapsed(const QModelIndex & ) ), this, SLOT( collapsed(const QModelIndex & ) ) );
ui.dirTreeView->setModel(proxyModel);
ui.dirTreeView->update();
QHeaderView * header = ui.dirTreeView->header () ;
restoreExpandedPathsAndSelection(expanded_indexes,selected_indexes);
QHeaderView * header = ui.dirTreeView->header () ;
QHeaderView_setSectionResizeModeColumn(header, COLUMN_NAME, QHeaderView::Interactive);
ui.dirTreeView->header()->headerDataChanged(Qt::Horizontal, COLUMN_NAME, COLUMN_DIR) ;
// recursRestoreExpandedItems(ui.dirTreeView->rootIndex(),expanded_indexes);
FilterItems();
}
@ -501,6 +522,15 @@ QModelIndexList SharedFilesDialog::getSelected()
return proxyList ;
}
void RemoteSharedFilesDialog::expanded(const QModelIndex& indx)
{
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "Expanding at " << indx.row() << " and " << indx.column() << " ref=" << indx.internalPointer() << ", pointer at 1: " << proxyModel->mapToSource(indx).internalPointer() << std::endl;
#endif
model->updateRef(proxyModel->mapToSource(indx)) ;
}
void RemoteSharedFilesDialog::downloadRemoteSelected()
{
/* call back to the model (which does all the interfacing? */
@ -544,9 +574,9 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
if (details.type == DIR_TYPE_DIR)
{
for (std::list<DirStub>::const_iterator cit = details.children.begin();cit != details.children.end(); ++cit)
for(uint32_t j=0;j<details.children.size();++j)
{
const DirStub& dirStub = *cit;
const DirStub& dirStub = details.children[j];
DirDetails details;
FileSearchFlags flags = remote?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ;
@ -823,20 +853,118 @@ void SharedFilesDialog::preModDirectories(bool local)
flat_model->preMods();
}
void SharedFilesDialog::saveExpandedPathsAndSelection(std::set<std::string>& expanded_indexes, std::set<std::string>& selected_indexes)
{
if(ui.dirTreeView->model() == NULL)
return ;
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "Saving expanded items. " << std::endl;
#endif
for(int row = 0; row < ui.dirTreeView->model()->rowCount(); ++row)
{
std::string path = ui.dirTreeView->model()->index(row,0).data(Qt::DisplayRole).toString().toStdString();
recursSaveExpandedItems(ui.dirTreeView->model()->index(row,0),path,expanded_indexes,selected_indexes);
}
}
void SharedFilesDialog::restoreExpandedPathsAndSelection(const std::set<std::string>& expanded_indexes, const std::set<std::string>& selected_indexes)
{
if(ui.dirTreeView->model() == NULL)
return ;
// we need to disable this, because the signal will trigger unnecessary update at the friend.
ui.dirTreeView->blockSignals(true) ;
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "Restoring expanded items. " << std::endl;
#endif
for(int row = 0; row < ui.dirTreeView->model()->rowCount(); ++row)
{
std::string path = ui.dirTreeView->model()->index(row,0).data(Qt::DisplayRole).toString().toStdString();
recursRestoreExpandedItems(ui.dirTreeView->model()->index(row,0),path,expanded_indexes,selected_indexes);
}
QItemSelection selection ;
ui.dirTreeView->blockSignals(false) ;
}
void SharedFilesDialog::recursSaveExpandedItems(const QModelIndex& index,const std::string& path,std::set<std::string>& exp,std::set<std::string>& sel)
{
std::string local_path = path+"/"+index.data(Qt::DisplayRole).toString().toStdString();
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "at index " << index.row() << ". data[1]=" << local_path << std::endl;
#endif
if(ui.dirTreeView->selectionModel()->selection().contains(index))
sel.insert(local_path) ;
if(ui.dirTreeView->isExpanded(index))
{
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "Index " << local_path << " is expanded." << std::endl;
#endif
if(index.isValid())
exp.insert(local_path) ;
for(int row=0;row<ui.dirTreeView->model()->rowCount(index);++row)
recursSaveExpandedItems(index.child(row,0),local_path,exp,sel) ;
}
#ifdef DEBUG_SHARED_FILES_DIALOG
else
std::cerr << "Index is not expanded." << std::endl;
#endif
}
void SharedFilesDialog::recursRestoreExpandedItems(const QModelIndex& index, const std::string &path, const std::set<std::string>& exp, const std::set<std::string> &sel)
{
std::string local_path = path+"/"+index.data(Qt::DisplayRole).toString().toStdString();
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "at index " << index.row() << ". data[1]=" << local_path << std::endl;
#endif
if(sel.find(local_path) != sel.end())
ui.dirTreeView->selectionModel()->select(index, QItemSelectionModel::Select | QItemSelectionModel::Rows);
if(exp.find(local_path) != exp.end())
{
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "re expanding index " << local_path << std::endl;
#endif
ui.dirTreeView->setExpanded(index,true) ;
for(int row=0;row<ui.dirTreeView->model()->rowCount(index);++row)
recursRestoreExpandedItems(index.child(row,0),local_path,exp,sel) ;
}
}
void SharedFilesDialog::postModDirectories(bool local)
{
if (isRemote() == local) {
return;
}
if (isRemote() == local) {
return;
}
std::set<std::string> expanded_indexes,selected_indexes;
/* Notify both models, only one is visible */
saveExpandedPathsAndSelection(expanded_indexes,selected_indexes) ;
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "Saving expanded items. " << expanded_indexes.size() << " items found" << std::endl;
#endif
/* Notify both models, only one is visible */
tree_model->postMods();
flat_model->postMods();
ui.dirTreeView->update() ;
if (ui.filterPatternLineEdit->text().isEmpty() == false)
restoreExpandedPathsAndSelection(expanded_indexes,selected_indexes) ;
if (ui.filterPatternLineEdit->text().isEmpty() == false)
FilterItems();
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "****** updated directories! ******" << std::endl;
#endif
QCoreApplication::flush();
}

View file

@ -22,6 +22,7 @@
#ifndef _SHAREDFILESDIALOG_H
#define _SHAREDFILESDIALOG_H
#include <set>
#include "RsAutoUpdatePage.h"
#include "ui_SharedFilesDialog.h"
@ -51,7 +52,6 @@ protected slots:
virtual void spawnCustomPopupMenu(QPoint point) = 0;
private slots:
/* For handling the model updates */
void preModDirectories(bool local) ;
void postModDirectories(bool local) ;
@ -94,6 +94,11 @@ protected:
Ui::SharedFilesDialog ui;
virtual void processSettings(bool bLoad) = 0;
void recursRestoreExpandedItems(const QModelIndex& index,const std::string& path,const std::set<std::string>& exp,const std::set<std::string>& sel);
void recursSaveExpandedItems(const QModelIndex& index, const std::string &path, std::set<std::string> &exp, std::set<std::string>& sel);
void saveExpandedPathsAndSelection(std::set<std::string>& paths, std::set<std::string>& selected_indexes) ;
void restoreExpandedPathsAndSelection(const std::set<std::string>& paths, const std::set<std::string>& selected_indexes) ;
protected:
//now context menu are created again every time theu are called ( in some
//slots.. Maybe it's not good...
@ -191,6 +196,7 @@ class RemoteSharedFilesDialog : public SharedFilesDialog
private slots:
void downloadRemoteSelected();
void expanded(const QModelIndex& indx);
};
#endif

View file

@ -119,9 +119,9 @@ void AdvancedSearchDialog::prepareSearch()
}
Expression * AdvancedSearchDialog::getRsExpr()
RsRegularExpression::Expression * AdvancedSearchDialog::getRsExpr()
{
Expression * wholeExpression;
RsRegularExpression::Expression * wholeExpression;
// process the special case: first expression
wholeExpression = expressions->at(0)->getRsExpression();
@ -131,7 +131,7 @@ Expression * AdvancedSearchDialog::getRsExpr()
for (int i = 1; i < expressions->size(); ++i) {
// extract the expression information and compound it with the
// first expression
wholeExpression = new CompoundExpression(expressions->at(i)->getOperator(),
wholeExpression = new RsRegularExpression::CompoundExpression(expressions->at(i)->getOperator(),
wholeExpression,
expressions->at(i)->getRsExpression());
}

View file

@ -36,10 +36,10 @@ class AdvancedSearchDialog : public QDialog, public Ui::AdvancedSearchDialog
public:
AdvancedSearchDialog(QWidget * parent = 0 );
Expression * getRsExpr();
RsRegularExpression::Expression * getRsExpr();
QString getSearchAsString();
signals:
void search(Expression*);
void search(RsRegularExpression::Expression*);
private slots:
void deleteExpression(ExpressionWidget*);

View file

@ -130,7 +130,7 @@ void ExpressionWidget::deleteExpression()
emit signalDelete(this);
}
LogicalOperator ExpressionWidget::getOperator()
RsRegularExpression::LogicalOperator ExpressionWidget::getOperator()
{
return exprOpElem->getLogicalOperator();
}
@ -145,9 +145,9 @@ static int checkedConversion(uint64_t s)
return (int)s ;
}
Expression* ExpressionWidget::getRsExpression()
RsRegularExpression::Expression* ExpressionWidget::getRsExpression()
{
Expression * expr = NULL;
RsRegularExpression::Expression * expr = NULL;
std::list<std::string> wordList;
uint64_t lowVal = 0;
@ -174,54 +174,54 @@ Expression* ExpressionWidget::getRsExpression()
switch (searchType)
{
case NameSearch:
expr = new NameExpression(exprCondElem->getStringOperator(),
expr = new RsRegularExpression::NameExpression(exprCondElem->getStringOperator(),
wordList,
exprParamElem->ignoreCase());
break;
case PathSearch:
expr = new PathExpression(exprCondElem->getStringOperator(),
expr = new RsRegularExpression::PathExpression(exprCondElem->getStringOperator(),
wordList,
exprParamElem->ignoreCase());
break;
case ExtSearch:
expr = new ExtExpression(exprCondElem->getStringOperator(),
expr = new RsRegularExpression::ExtExpression(exprCondElem->getStringOperator(),
wordList,
exprParamElem->ignoreCase());
break;
case HashSearch:
expr = new HashExpression(exprCondElem->getStringOperator(),
expr = new RsRegularExpression::HashExpression(exprCondElem->getStringOperator(),
wordList);
break;
case DateSearch:
if (inRangedConfig) {
expr = new DateExpression(exprCondElem->getRelOperator(), checkedConversion(lowVal), checkedConversion(highVal));
expr = new RsRegularExpression::DateExpression(exprCondElem->getRelOperator(), checkedConversion(lowVal), checkedConversion(highVal));
} else {
expr = new DateExpression(exprCondElem->getRelOperator(), checkedConversion(exprParamElem->getIntValue()));
expr = new RsRegularExpression::DateExpression(exprCondElem->getRelOperator(), checkedConversion(exprParamElem->getIntValue()));
}
break;
case PopSearch:
if (inRangedConfig) {
expr = new DateExpression(exprCondElem->getRelOperator(), checkedConversion(lowVal), checkedConversion(highVal));
expr = new RsRegularExpression::DateExpression(exprCondElem->getRelOperator(), checkedConversion(lowVal), checkedConversion(highVal));
} else {
expr = new DateExpression(exprCondElem->getRelOperator(), checkedConversion(exprParamElem->getIntValue()));
expr = new RsRegularExpression::DateExpression(exprCondElem->getRelOperator(), checkedConversion(exprParamElem->getIntValue()));
}
break;
case SizeSearch:
if (inRangedConfig)
{
if(lowVal >= (uint64_t)(1024*1024*1024) || highVal >= (uint64_t)(1024*1024*1024))
expr = new SizeExpressionMB(exprCondElem->getRelOperator(), (int)(lowVal / (1024*1024)), (int)(highVal / (1024*1024)));
expr = new RsRegularExpression::SizeExpressionMB(exprCondElem->getRelOperator(), (int)(lowVal / (1024*1024)), (int)(highVal / (1024*1024)));
else
expr = new SizeExpression(exprCondElem->getRelOperator(), lowVal, highVal);
expr = new RsRegularExpression::SizeExpression(exprCondElem->getRelOperator(), lowVal, highVal);
}
else
{
uint64_t s = exprParamElem->getIntValue() ;
if(s >= (uint64_t)(1024*1024*1024))
expr = new SizeExpressionMB(exprCondElem->getRelOperator(), (int)(s/(1024*1024))) ;
expr = new RsRegularExpression::SizeExpressionMB(exprCondElem->getRelOperator(), (int)(s/(1024*1024))) ;
else
expr = new SizeExpression(exprCondElem->getRelOperator(), (int)s) ;
expr = new RsRegularExpression::SizeExpression(exprCondElem->getRelOperator(), (int)s) ;
}
break;
};

View file

@ -45,11 +45,11 @@ public:
/** delivers the expression represented by this widget
the operator to join this expression with any previous
expressions is provided by the getOperator method */
Expression* getRsExpression();
RsRegularExpression::Expression* getRsExpression();
/** supplies the operator to be used when joining this expression
to the whole query */
LogicalOperator getOperator();
RsRegularExpression::LogicalOperator getOperator();
QString toString();

View file

@ -62,9 +62,9 @@ QStringList GuiExprElement::relOptionsList;
QMap<int, ExprSearchType> GuiExprElement::TermsIndexMap;
QMap<int, LogicalOperator> GuiExprElement::logicalOpIndexMap;
QMap<int, StringOperator> GuiExprElement::strConditionIndexMap;
QMap<int, RelOperator> GuiExprElement::relConditionIndexMap;
QMap<int, RsRegularExpression::LogicalOperator> GuiExprElement::logicalOpIndexMap;
QMap<int, RsRegularExpression::StringOperator> GuiExprElement::strConditionIndexMap;
QMap<int, RsRegularExpression::RelOperator> GuiExprElement::relConditionIndexMap;
QMap<int, QString> GuiExprElement::logicalOpStrMap;
QMap<int, QString> GuiExprElement::termsStrMap;
@ -141,9 +141,9 @@ void GuiExprElement::initialiseOptionsLists()
GuiExprElement::relOptionsList.append(RANGE);
// now the maps
GuiExprElement::logicalOpIndexMap[GuiExprElement::AND_INDEX] = AndOp;
GuiExprElement::logicalOpIndexMap[GuiExprElement::OR_INDEX] = OrOp;
GuiExprElement::logicalOpIndexMap[GuiExprElement::XOR_INDEX] = XorOp;
GuiExprElement::logicalOpIndexMap[GuiExprElement::AND_INDEX] = RsRegularExpression::AndOp;
GuiExprElement::logicalOpIndexMap[GuiExprElement::OR_INDEX] = RsRegularExpression::OrOp;
GuiExprElement::logicalOpIndexMap[GuiExprElement::XOR_INDEX] = RsRegularExpression::XorOp;
GuiExprElement::TermsIndexMap[GuiExprElement::NAME_INDEX] = NameSearch;
GuiExprElement::TermsIndexMap[GuiExprElement::PATH_INDEX] = PathSearch;
@ -153,9 +153,9 @@ void GuiExprElement::initialiseOptionsLists()
GuiExprElement::TermsIndexMap[GuiExprElement::SIZE_INDEX] = SizeSearch;
GuiExprElement::TermsIndexMap[GuiExprElement::POP_INDEX] = PopSearch;
GuiExprElement::strConditionIndexMap[GuiExprElement::CONTAINS_INDEX] = ContainsAnyStrings;
GuiExprElement::strConditionIndexMap[GuiExprElement::CONTALL_INDEX] = ContainsAllStrings;
GuiExprElement::strConditionIndexMap[GuiExprElement::IS_INDEX] = EqualsString;
GuiExprElement::strConditionIndexMap[GuiExprElement::CONTAINS_INDEX] = RsRegularExpression::ContainsAnyStrings;
GuiExprElement::strConditionIndexMap[GuiExprElement::CONTALL_INDEX] = RsRegularExpression::ContainsAllStrings;
GuiExprElement::strConditionIndexMap[GuiExprElement::IS_INDEX] = RsRegularExpression::EqualsString;
/* W A R N I N G !!!!
the cb elements correspond to their inverse rel op counterparts in rsexpr.h due to the nature of
@ -166,12 +166,12 @@ void GuiExprElement::initialiseOptionsLists()
files where the condition is greater than the file size i.e. files whose size is less than or equal to the condition
Therefore we invert the mapping of rel conditions here to match the behaviour of the impl.
*/
GuiExprElement::relConditionIndexMap[GuiExprElement::LT_INDEX] = GreaterEquals;
GuiExprElement::relConditionIndexMap[GuiExprElement::LTE_INDEX] = Greater;
GuiExprElement::relConditionIndexMap[GuiExprElement::EQUAL_INDEX] = Equals;
GuiExprElement::relConditionIndexMap[GuiExprElement::GTE_INDEX] = Smaller;
GuiExprElement::relConditionIndexMap[GuiExprElement::GT_INDEX] = SmallerEquals;
GuiExprElement::relConditionIndexMap[GuiExprElement::RANGE_INDEX] = InRange;
GuiExprElement::relConditionIndexMap[GuiExprElement::LT_INDEX] = RsRegularExpression::GreaterEquals;
GuiExprElement::relConditionIndexMap[GuiExprElement::LTE_INDEX] = RsRegularExpression::Greater;
GuiExprElement::relConditionIndexMap[GuiExprElement::EQUAL_INDEX] = RsRegularExpression::Equals;
GuiExprElement::relConditionIndexMap[GuiExprElement::GTE_INDEX] = RsRegularExpression::Smaller;
GuiExprElement::relConditionIndexMap[GuiExprElement::GT_INDEX] = RsRegularExpression::SmallerEquals;
GuiExprElement::relConditionIndexMap[GuiExprElement::RANGE_INDEX] = RsRegularExpression::InRange;
// the string to index map
GuiExprElement::termsStrMap[GuiExprElement::NAME_INDEX] = NAME;
@ -260,7 +260,7 @@ QString ExprOpElement::toString()
}
LogicalOperator ExprOpElement::getLogicalOperator()
RsRegularExpression::LogicalOperator ExprOpElement::getLogicalOperator()
{
return GuiExprElement::logicalOpIndexMap[cb->currentIndex()];
}
@ -313,12 +313,12 @@ QString ExprConditionElement::toString()
return GuiExprElement::relConditionStrMap[cb->currentIndex()];
}
RelOperator ExprConditionElement::getRelOperator()
RsRegularExpression::RelOperator ExprConditionElement::getRelOperator()
{
return GuiExprElement::relConditionIndexMap[cb->currentIndex()];
}
StringOperator ExprConditionElement::getStringOperator()
RsRegularExpression::StringOperator ExprConditionElement::getStringOperator()
{
return GuiExprElement::strConditionIndexMap[cb->currentIndex()];
}

View file

@ -114,9 +114,9 @@ protected:
static QStringList relOptionsList;
// provides a mapping of condition operators to RSExpr reloperators
static QMap<int, LogicalOperator> logicalOpIndexMap;
static QMap<int, StringOperator> strConditionIndexMap;
static QMap<int, RelOperator> relConditionIndexMap;
static QMap<int, RsRegularExpression::LogicalOperator> logicalOpIndexMap;
static QMap<int, RsRegularExpression::StringOperator> strConditionIndexMap;
static QMap<int, RsRegularExpression::RelOperator> relConditionIndexMap;
// provides a mapping of indexes to translatable strings
static QMap<int, QString> logicalOpStrMap;
@ -134,7 +134,7 @@ class ExprOpElement : public GuiExprElement
public:
ExprOpElement(QWidget * parent = 0);
LogicalOperator getLogicalOperator();
RsRegularExpression::LogicalOperator getLogicalOperator();
QString toString();
private:
QComboBox * cb;
@ -148,8 +148,8 @@ class ExprTermsElement : public GuiExprElement
public:
ExprTermsElement(QWidget * parent = 0);
int getTermsIndex();
RelOperator getRelOperator();
StringOperator getStringOperator();
RsRegularExpression::RelOperator getRelOperator();
RsRegularExpression::StringOperator getStringOperator();
void set(int i) {cb->setCurrentIndex(i);}
QString toString();
@ -167,8 +167,8 @@ class ExprConditionElement : public GuiExprElement
public:
ExprConditionElement(ExprSearchType, QWidget * parent = 0);
RelOperator getRelOperator();
StringOperator getStringOperator();
RsRegularExpression::RelOperator getRelOperator();
RsRegularExpression::StringOperator getStringOperator();
void adjustForSearchType(ExprSearchType);
void set(int i) {cb->setCurrentIndex(i);}
QString toString();

View file

@ -21,18 +21,19 @@
****************************************************************/
#include <QApplication>
#include <QMenu>
#include <QKeyEvent>
#include <QScrollBar>
#include <QBuffer>
#include <QColorDialog>
#include <QFontDialog>
#include <QKeyEvent>
#include <QMenu>
#include <QMessageBox>
#include <QTextStream>
#include <QTextCodec>
#include <QTimer>
#include <QTextDocumentFragment>
#include <QToolTip>
#include <QScrollBar>
#include <QStringListModel>
#include <QTextCodec>
#include <QTextDocumentFragment>
#include <QTextStream>
#include <QTimer>
#include <QToolTip>
#include "ChatWidget.h"
#include "ui_ChatWidget.h"
@ -157,6 +158,8 @@ ChatWidget::ChatWidget(QWidget *parent) :
connect(ui->actionQuote, SIGNAL(triggered()), this, SLOT(quote()));
connect(ui->actionDropPlacemark, SIGNAL(triggered()), this, SLOT(dropPlacemark()));
connect(ui->actionSave_image, SIGNAL(triggered()), this, SLOT(saveImage()));
connect(ui->actionShow_Hidden_Images, SIGNAL(triggered()), ui->textBrowser, SLOT(showImages()));
ui->actionShow_Hidden_Images->setIcon(ui->textBrowser->getBlockedImage());
connect(ui->hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
@ -196,9 +199,7 @@ ChatWidget::ChatWidget(QWidget *parent) :
ui->actionSendAsPlainText->setChecked(Settings->getChatSendAsPlainTextByDef());
ui->textBrowser->setImageBlockWidget(ui->imageBlockWidget);
ui->textBrowser->resetImagesStatus(Settings->getChatLoadEmbeddedImages());//Need to be called after setImageBlockWidget
ui->imageBlockWidget->setAutoHide(true);
ui->textBrowser->resetImagesStatus(Settings->getChatLoadEmbeddedImages());
ui->textBrowser->installEventFilter(this);
ui->textBrowser->viewport()->installEventFilter(this);
ui->chatTextEdit->installEventFilter(this);
@ -581,6 +582,12 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
if (!anchors.isEmpty()){
toolTipText = anchors.at(0);
}
if (toolTipText.isEmpty() && !ui->textBrowser->getShowImages()){
QString imageStr;
if (ui->textBrowser->checkImage(helpEvent->pos(), imageStr)) {
toolTipText = imageStr;
}
}
}
if (!toolTipText.isEmpty()){
QToolTip::showText(helpEvent->globalPos(), toolTipText);
@ -1016,9 +1023,11 @@ void ChatWidget::contextMenuTextBrowser(QPoint point)
contextMnu->addAction(ui->actionQuote);
contextMnu->addAction(ui->actionDropPlacemark);
QTextCursor cursor = ui->textBrowser->cursorForPosition(point);
if(ImageUtil::checkImage(cursor))
if(ui->textBrowser->checkImage(point))
{
if (! ui->textBrowser->getShowImages())
contextMnu->addAction(ui->actionShow_Hidden_Images);
ui->actionSave_image->setData(point);
contextMnu->addAction(ui->actionSave_image);
}

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>667</width>
<height>323</height>
<height>334</height>
</rect>
</property>
<layout class="QGridLayout">
@ -206,16 +206,6 @@ border-image: url(:/images/closepressed.png)
</layout>
</widget>
</item>
<item>
<widget class="RSImageBlockWidget" name="imageBlockWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QSplitter" name="chatVSplitter">
<property name="orientation">
@ -989,6 +979,11 @@ border-image: url(:/images/closepressed.png)
<string>Don't replace tag with Emote Icon.</string>
</property>
</action>
<action name="actionShow_Hidden_Images">
<property name="text">
<string>Show Hidden Images</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
@ -1017,17 +1012,10 @@ border-image: url(:/images/closepressed.png)
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
<customwidget>
<class>RSImageBlockWidget</class>
<extends>QWidget</extends>
<header>gui/common/RSImageBlockWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../emojione.qrc"/>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -167,7 +167,7 @@ void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
PopupChatDialog::closeEvent(e) ;
}
QString PopupDistantChatDialog::getPeerName(const ChatId &id) const
QString PopupDistantChatDialog::getPeerName(const ChatId &/*id*/) const
{
DistantChatPeerInfo tinfo;

View file

@ -52,7 +52,9 @@ ElidedLabel::ElidedLabel(const QString &text, QWidget *parent)
, mElided(false)
, mOnlyPlainText(false)
, mContent(text)
, mTextColor(QColor())
{
setStyleSheet("background-color: rgba(0,0,0,0%)");
mRectElision = QRect();
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
}
@ -62,7 +64,9 @@ ElidedLabel::ElidedLabel(QWidget *parent)
, mElided(false)
, mOnlyPlainText(false)
, mContent("")
, mTextColor(QColor())
{
setStyleSheet("background-color: rgba(0,0,0,0%)");
mRectElision = QRect();
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
}
@ -94,7 +98,7 @@ void ElidedLabel::paintEvent(QPaintEvent *event)
QFontMetrics fontMetrics = painter.fontMetrics();
QRect cr = contentsRect();
cr.adjust(margin(), margin(), -margin(), -margin());
bool didElide = false;
QChar ellipsisChar(0x2026);//= "…"
int lineSpacing = fontMetrics.lineSpacing();
@ -225,3 +229,11 @@ void ElidedLabel::mousePressEvent(QMouseEvent *ev)
}
QLabel::mousePressEvent(ev);
}
void ElidedLabel::setTextColor(const QColor &color)
{
QPalette tmpPalette = palette();
tmpPalette.setColor(foregroundRole(), color);
setPalette(tmpPalette);
mTextColor = color;
}

View file

@ -53,6 +53,7 @@ class ElidedLabel : public QLabel
Q_PROPERTY(QString text READ text WRITE setText)
Q_PROPERTY(bool isElided READ isElided)
Q_PROPERTY(bool isOnlyPlainText READ isOnlyPlainText WRITE setOnlyPlainText)
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
public:
ElidedLabel(const QString &text, QWidget *parent = 0);
@ -62,6 +63,9 @@ public:
bool isElided() const { return mElided; }
bool isOnlyPlainText() const { return mOnlyPlainText; }
QColor textColor() const { return mTextColor; }
void setTextColor(const QColor &color);
public slots:
void setText(const QString &text);
void setOnlyPlainText(const bool &value);
@ -79,6 +83,7 @@ private:
bool mOnlyPlainText;
QString mContent;
QRect mRectElision;
QColor mTextColor;
};
#endif // ELIDEDLABEL_H

View file

@ -510,6 +510,7 @@ static void getNameWidget(QTreeWidget *treeWidget, QTreeWidgetItem *item, Elided
if (!widget) {
widget = new QWidget;
widget->setAttribute(Qt::WA_TranslucentBackground);
nameLabel = new ElidedLabel(widget);
textLabel = new ElidedLabel(widget);

View file

@ -35,8 +35,8 @@ GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
{
_layout = new QHBoxLayout(this) ;
setMinimumSize(128,32) ;
setMaximumSize(128,32) ;
setMinimumSize(128 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0) ;
setMaximumSize(128 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0) ;
setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
_icons[INDEX_GROUP_BROWSABLE] = new QIcon(FLAGS_GROUP_BROWSABLE_ICON) ;
@ -58,7 +58,7 @@ GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
_buttons[i] = new QPushButton(this) ;
_buttons[i]->setCheckable(true) ;
_buttons[i]->setChecked(flags & _flags[i]) ;
_buttons[i]->setIconSize(QSize(32,32));
_buttons[i]->setIconSize(QSize(32 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0));
update_button_state(_buttons[i]->isChecked(),i) ;
_layout->addWidget(_buttons[i]) ;
}

View file

@ -18,20 +18,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QMenu>
#include <QToolButton>
#include <QLabel>
#include <QMovie>
#include "retroshare/rsgxsflags.h"
#include "GroupTreeWidget.h"
#include "ui_GroupTreeWidget.h"
#include "RSItemDelegate.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QMenu>
#include <QMovie>
#include <QToolButton>
#include "retroshare/rsgxsflags.h"
#include "PopularityDefs.h"
#include "gui/settings/rsharesettings.h"
#include "RSItemDelegate.h"
#include "RSTreeWidgetItem.h"
#include "gui/common/ElidedLabel.h"
#include "gui/settings/rsharesettings.h"
#include "util/QtVersion.h"
#include <stdint.h>
@ -55,6 +57,9 @@
#define FILTER_NAME_INDEX 0
#define FILTER_DESC_INDEX 1
Q_DECLARE_METATYPE(ElidedLabel*)
Q_DECLARE_METATYPE(QLabel*)
GroupTreeWidget::GroupTreeWidget(QWidget *parent) :
QWidget(parent), ui(new Ui::GroupTreeWidget)
{
@ -116,6 +121,38 @@ GroupTreeWidget::~GroupTreeWidget()
delete ui;
}
static void getNameWidget(QTreeWidget *treeWidget, QTreeWidgetItem *item, ElidedLabel *&nameLabel, QLabel *&waitLabel)
{
QWidget *widget = treeWidget->itemWidget(item, COLUMN_NAME);
if (!widget) {
widget = new QWidget;
widget->setAttribute(Qt::WA_TranslucentBackground);
nameLabel = new ElidedLabel(widget);
waitLabel = new QLabel(widget);
QMovie *movie = new QMovie(":/images/loader/circleball-16.gif");
waitLabel->setMovie(movie);
waitLabel->setHidden(true);
widget->setProperty("nameLabel", qVariantFromValue(nameLabel));
widget->setProperty("waitLabel", qVariantFromValue(waitLabel));
QHBoxLayout *layout = new QHBoxLayout;
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(nameLabel);
layout->addWidget(waitLabel);
widget->setLayout(layout);
treeWidget->setItemWidget(item, COLUMN_NAME, widget);
} else {
nameLabel = widget->property("nameLabel").value<ElidedLabel*>();
waitLabel = widget->property("waitLabel").value<QLabel*>();
}
}
void GroupTreeWidget::changeEvent(QEvent *e)
{
QWidget::changeEvent(e);
@ -229,7 +266,7 @@ void GroupTreeWidget::initDisplayMenu(QToolButton *toolButton)
actionSortByLastPost = displayMenu->addAction(QIcon(), tr("Sort by Last Post"), this, SLOT(sort()));
actionSortByLastPost->setCheckable(true);
actionSortByLastPost->setActionGroup(actionGroup);
actionSortByPosts = displayMenu->addAction(QIcon(), tr("Sort by Posts"), this, SLOT(sort()));
actionSortByPosts->setCheckable(true);
actionSortByPosts->setActionGroup(actionGroup);
@ -255,6 +292,11 @@ void GroupTreeWidget::updateColors()
}
item->setForeground(COLUMN_NAME, brush);
ElidedLabel *nameLabel = NULL;
QLabel *waitLabel = NULL;
getNameWidget(ui->treeWidget, item, nameLabel, waitLabel);
nameLabel->setTextColor(brush.color());
}
}
@ -293,21 +335,27 @@ QTreeWidgetItem *GroupTreeWidget::addCategoryItem(const QString &name, const QIc
{
QFont font;
QTreeWidgetItem *item = new QTreeWidgetItem();
ui->treeWidget->addTopLevelItem(item);
ElidedLabel *nameLabel = NULL;
QLabel *waitLabel = NULL;
getNameWidget(ui->treeWidget, item, nameLabel, waitLabel);
nameLabel->setText(name);
item->setData(COLUMN_DATA, ROLE_NAME, name);
font = item->font(COLUMN_NAME);
font.setBold(true);
item->setText(COLUMN_NAME, name);
item->setData(COLUMN_DATA, ROLE_NAME, name);
item->setFont(COLUMN_NAME, font);
nameLabel->setFont(font);
item->setIcon(COLUMN_NAME, icon);
int S = QFontMetricsF(font).height();
int S = QFontMetricsF(font).height();
item->setSizeHint(COLUMN_NAME, QSize(S*1.1, S*1.1));
item->setSizeHint(COLUMN_NAME, QSize(S*1.1, S*1.1));
item->setForeground(COLUMN_NAME, QBrush(textColorCategory()));
nameLabel->setTextColor(textColorCategory());
item->setData(COLUMN_DATA, ROLE_COLOR, GROUPTREEWIDGET_COLOR_CATEGORY);
ui->treeWidget->addTopLevelItem(item);
item->setExpanded(expand);
return item;
@ -334,114 +382,119 @@ QString GroupTreeWidget::itemIdAt(QPoint &point)
void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<GroupItemInfo> &itemList)
{
if (categoryItem == NULL) {
return;
}
if (categoryItem == NULL) {
return;
}
QString filterText = ui->filterLineEdit->text();
QString filterText = ui->filterLineEdit->text();
/* Iterate all items */
QList<GroupItemInfo>::const_iterator it;
for (it = itemList.begin(); it != itemList.end(); ++it) {
const GroupItemInfo &itemInfo = *it;
/* Iterate all items */
QList<GroupItemInfo>::const_iterator it;
for (it = itemList.begin(); it != itemList.end(); ++it) {
const GroupItemInfo &itemInfo = *it;
QTreeWidgetItem *item = NULL;
QTreeWidgetItem *item = NULL;
/* Search exisiting item */
int childCount = categoryItem->childCount();
for (int child = 0; child < childCount; ++child) {
QTreeWidgetItem *childItem = categoryItem->child(child);
if (childItem->data(COLUMN_DATA, ROLE_ID).toString() == itemInfo.id) {
/* Found child */
item = childItem;
break;
}
}
/* Search exisiting item */
int childCount = categoryItem->childCount();
for (int child = 0; child < childCount; ++child) {
QTreeWidgetItem *childItem = categoryItem->child(child);
if (childItem->data(COLUMN_DATA, ROLE_ID).toString() == itemInfo.id) {
/* Found child */
item = childItem;
break;
}
}
if (item == NULL) {
item = new RSTreeWidgetItem(compareRole);
item->setData(COLUMN_DATA, ROLE_ID, itemInfo.id);
categoryItem->addChild(item);
}
if (item == NULL) {
item = new RSTreeWidgetItem(compareRole);
item->setData(COLUMN_DATA, ROLE_ID, itemInfo.id);
categoryItem->addChild(item);
}
item->setText(COLUMN_NAME, itemInfo.name);
item->setData(COLUMN_DATA, ROLE_NAME, itemInfo.name);
item->setData(COLUMN_DATA, ROLE_DESCRIPTION, itemInfo.description);
ElidedLabel *nameLabel = NULL;
QLabel *waitLabel = NULL;
getNameWidget(ui->treeWidget, item, nameLabel, waitLabel);
/* Set last post */
qlonglong lastPost = itemInfo.lastpost.toTime_t();
item->setData(COLUMN_DATA, ROLE_LASTPOST, -lastPost); // negative for correct sorting
nameLabel->setText(itemInfo.name);
item->setData(COLUMN_DATA, ROLE_NAME, itemInfo.name);
item->setData(COLUMN_DATA, ROLE_DESCRIPTION, itemInfo.description);
/* Set visible posts */
item->setData(COLUMN_DATA, ROLE_POSTS, -itemInfo.max_visible_posts);// negative for correct sorting
/* Set last post */
qlonglong lastPost = itemInfo.lastpost.toTime_t();
item->setData(COLUMN_DATA, ROLE_LASTPOST, -lastPost); // negative for correct sorting
/* Set icon */
if (ui->treeWidget->itemWidget(item, COLUMN_NAME)) {
/* Item is waiting, save icon in role */
item->setData(COLUMN_DATA, ROLE_SAVED_ICON, itemInfo.icon);
} else {
item->setIcon(COLUMN_NAME, itemInfo.icon);
}
/* Set visible posts */
item->setData(COLUMN_DATA, ROLE_POSTS, -itemInfo.max_visible_posts);// negative for correct sorting
/* Set popularity */
QString tooltip = PopularityDefs::tooltip(itemInfo.popularity);
/* Set icon */
if (waitLabel->isVisible()) {
/* Item is waiting, save icon in role */
item->setData(COLUMN_DATA, ROLE_SAVED_ICON, itemInfo.icon);
} else {
item->setIcon(COLUMN_NAME, itemInfo.icon);
}
item->setIcon(COLUMN_POPULARITY, PopularityDefs::icon(itemInfo.popularity));
item->setData(COLUMN_DATA, ROLE_POPULARITY, -itemInfo.popularity); // negative for correct sorting
/* Set popularity */
QString tooltip = PopularityDefs::tooltip(itemInfo.popularity);
/* Set tooltip */
if (itemInfo.adminKey)
tooltip += "\n" + tr("You are admin (modify names and description using Edit menu)");
else if (itemInfo.publishKey)
tooltip += "\n" + tr("You have been granted as publisher (you can post here!)");
item->setIcon(COLUMN_POPULARITY, PopularityDefs::icon(itemInfo.popularity));
item->setData(COLUMN_DATA, ROLE_POPULARITY, -itemInfo.popularity); // negative for correct sorting
if(!IS_GROUP_SUBSCRIBED(itemInfo.subscribeFlags))
{
tooltip += "\n" + QString::number(itemInfo.max_visible_posts) + " messages available" ;
tooltip += "\n" + tr("Subscribe to download and read messages") ;
}
/* Set tooltip */
if (itemInfo.adminKey)
tooltip += "\n" + tr("You are admin (modify names and description using Edit menu)");
else if (itemInfo.publishKey)
tooltip += "\n" + tr("You have been granted as publisher (you can post here!)");
item->setToolTip(COLUMN_NAME, tooltip);
item->setToolTip(COLUMN_POPULARITY, tooltip);
if(!IS_GROUP_SUBSCRIBED(itemInfo.subscribeFlags))
{
tooltip += "\n" + QString::number(itemInfo.max_visible_posts) + " messages available" ;
tooltip += "\n" + tr("Subscribe to download and read messages") ;
}
item->setData(COLUMN_DATA, ROLE_SUBSCRIBE_FLAGS, itemInfo.subscribeFlags);
item->setToolTip(COLUMN_NAME, tooltip);
item->setToolTip(COLUMN_POPULARITY, tooltip);
/* Set color */
QBrush brush;
if (itemInfo.publishKey) {
brush = QBrush(textColorPrivateKey());
item->setData(COLUMN_DATA, ROLE_COLOR, GROUPTREEWIDGET_COLOR_PRIVATEKEY);
} else {
brush = ui->treeWidget->palette().color(QPalette::Text);
item->setData(COLUMN_DATA, ROLE_COLOR, GROUPTREEWIDGET_COLOR_STANDARD);
}
item->setForeground(COLUMN_NAME, brush);
item->setData(COLUMN_DATA, ROLE_SUBSCRIBE_FLAGS, itemInfo.subscribeFlags);
/* Calculate score */
calculateScore(item, filterText);
}
/* Set color */
QBrush brush;
if (itemInfo.publishKey) {
brush = QBrush(textColorPrivateKey());
item->setData(COLUMN_DATA, ROLE_COLOR, GROUPTREEWIDGET_COLOR_PRIVATEKEY);
} else {
brush = ui->treeWidget->palette().color(QPalette::Text);
item->setData(COLUMN_DATA, ROLE_COLOR, GROUPTREEWIDGET_COLOR_STANDARD);
}
item->setForeground(COLUMN_NAME, brush);
nameLabel->setTextColor(brush.color());
/* Remove all items not in list */
int child = 0;
int childCount = categoryItem->childCount();
while (child < childCount) {
QString id = categoryItem->child(child)->data(COLUMN_DATA, ROLE_ID).toString();
/* Calculate score */
calculateScore(item, filterText);
}
for (it = itemList.begin(); it != itemList.end(); ++it) {
if (it->id == id) {
break;
}
}
/* Remove all items not in list */
int child = 0;
int childCount = categoryItem->childCount();
while (child < childCount) {
QString id = categoryItem->child(child)->data(COLUMN_DATA, ROLE_ID).toString();
if (it == itemList.end()) {
delete(categoryItem->takeChild(child));
childCount = categoryItem->childCount();
} else {
++child;
}
}
for (it = itemList.begin(); it != itemList.end(); ++it) {
if (it->id == id) {
break;
}
}
resort(categoryItem);
if (it == itemList.end()) {
delete(categoryItem->takeChild(child));
childCount = categoryItem->childCount();
} else {
++child;
}
}
resort(categoryItem);
}
void GroupTreeWidget::setUnreadCount(QTreeWidgetItem *item, int unreadCount)
@ -449,19 +502,22 @@ void GroupTreeWidget::setUnreadCount(QTreeWidgetItem *item, int unreadCount)
if (item == NULL) {
return;
}
ElidedLabel *nameLabel = NULL;
QLabel *waitLabel = NULL;
getNameWidget(ui->treeWidget, item, nameLabel, waitLabel);
QString name = item->data(COLUMN_DATA, ROLE_NAME).toString();
QFont font = item->font(COLUMN_NAME);
QFont font = nameLabel->font();
if (unreadCount) {
name += QString(" (%1)").arg(unreadCount);
name = QString("(%1) ").arg(unreadCount) + name;
font.setBold(true);
} else {
font.setBold(false);
}
item->setText(COLUMN_NAME, name);
item->setFont(COLUMN_NAME, font);
nameLabel->setText(name);
nameLabel->setFont(font);
}
QTreeWidgetItem *GroupTreeWidget::getItemFromId(const QString &id)
@ -507,9 +563,11 @@ bool GroupTreeWidget::setWaiting(const QString &id, bool wait)
return false;
}
QWidget *w = ui->treeWidget->itemWidget(item, COLUMN_NAME);
ElidedLabel *nameLabel = NULL;
QLabel *waitLabel = NULL;
getNameWidget(ui->treeWidget, item, nameLabel, waitLabel);
if (wait) {
if (w) {
if (waitLabel->isVisible()) {
/* Allready waiting */
} else {
/* Save icon in role */
@ -519,21 +577,19 @@ bool GroupTreeWidget::setWaiting(const QString &id, bool wait)
/* Create empty icon of the same size */
QPixmap pixmap(ui->treeWidget->iconSize());
pixmap.fill(Qt::transparent);
item->setIcon(COLUMN_NAME, QIcon(pixmap));
QLabel *label = new QLabel(this);
QMovie *movie = new QMovie(":/images/loader/circleball-16.gif");
label->setMovie(movie);
ui->treeWidget->setItemWidget(item, COLUMN_NAME, label);
movie->start();
/* Show waitLabel and hide nameLabel */
nameLabel->setHidden(true);
waitLabel->setVisible(true);
waitLabel->movie()->start();
}
} else {
if (w) {
ui->treeWidget->setItemWidget(item, COLUMN_NAME, NULL);
delete(w);
if (waitLabel->isVisible()) {
/* Show nameLabel and hide waitLabel */
waitLabel->movie()->stop();
waitLabel->setHidden(true);
nameLabel->setVisible(true);
/* Set icon saved in role */
item->setIcon(COLUMN_NAME, item->data(COLUMN_DATA, ROLE_SAVED_ICON).value<QIcon>());

View file

@ -393,10 +393,12 @@ void RSGraphWidget::paintData()
paintLine(points, getColor(i));
}
if(_maxValue > 0.0f)
{
if(_flags & RSGRAPH_FLAGS_LOG_SCALE_Y)
_y_scale = _rec.height()*0.8 / log(_maxValue) ;
else
_y_scale = _rec.height()*0.8/_maxValue ;
}
}
/** Returns a list of points on the bandwidth graph based on the supplied set

View file

@ -1,8 +1,9 @@
#include <iostream>
#include <QDir>
#include <QDesktopServices>
#include <QDir>
#include <QPainter>
#include <QTextDocumentFragment>
#include "RSTextBrowser.h"
#include "RSImageBlockWidget.h"
@ -19,7 +20,7 @@ RSTextBrowser::RSTextBrowser(QWidget *parent) :
mImageBlockWidget = NULL;
mLinkClickActive = true;
highliter = new RsSyntaxHighlighter(this);
highlighter = new RsSyntaxHighlighter(this);
connect(this, SIGNAL(anchorClicked(QUrl)), this, SLOT(linkClicked(QUrl)));
}
@ -73,6 +74,23 @@ void RSTextBrowser::paintEvent(QPaintEvent *event)
painter.drawText(QRect(QPoint(), vieportWidget->size()), Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextWordWrap, mPlaceholderText);
}
#ifdef RSTEXTBROWSER_CHECKIMAGE_DEBUG
QPainter painter(viewport());
QPen pen = painter.pen();
pen.setWidth(2);
pen.setColor(QColor(qRgba(255,0,0,128)));
painter.setPen(pen);
painter.drawRect(mCursorRectStart);
pen.setColor(QColor(qRgba(0,255,0,128)));
painter.setPen(pen);
painter.drawRect(mCursorRectLeft);
pen.setColor(QColor(qRgba(0,0,255,128)));
painter.setPen(pen);
painter.drawRect(mCursorRectRight);
pen.setColor(QColor(qRgba(0,0,0,128)));
painter.setPen(pen);
painter.drawRect(mCursorRectEnd);
#endif
}
QVariant RSTextBrowser::loadResource(int type, const QUrl &name)
@ -103,6 +121,11 @@ QVariant RSTextBrowser::loadResource(int type, const QUrl &name)
if (mImageBlockWidget)
mImageBlockWidget->show();
return getBlockedImage();
}
QPixmap RSTextBrowser::getBlockedImage()
{
return QPixmap(":/images/imageblocked_24.png");
}
@ -159,3 +182,61 @@ void RSTextBrowser::activateLinkClick(bool active)
{
mLinkClickActive = active;
}
/**
* @brief RSTextBrowser::checkImage
* @param pos where to check if image is shown in viewport coordinate
* @param imageStr return html source of cursor
* @return True if an image is under cursor
*/
bool RSTextBrowser::checkImage(QPoint pos, QString &imageStr)
{
//Get text cursor under pos. But if pos is under text browser end line this return last cursor.
QTextCursor cursor = cursorForPosition(pos);
//First get rect of cursor (could be at left or right of image)
QRect cursorRectStart = cursorRect(cursor);
//Second get text
cursor.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor, 1);//To get character just before
QRect cursorRectLeft = cursorRect(cursor);
cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, 2);
QRect cursorRectRight = cursorRect(cursor);
imageStr = cursor.selection().toHtml();
#ifdef RSTEXTBROWSER_CHECKIMAGE_DEBUG
mCursorRectStart = cursorRectStart;
mCursorRectLeft = cursorRectLeft;
mCursorRectRight = cursorRectRight;
std::cerr << "cursorRect LTRB :" << cursorRectStart.left() << ";" << cursorRectStart.top() << ";" << cursorRectStart.right() << ";" << cursorRectStart.bottom() << std::endl;
std::cerr << "cursorRectLeft :" << cursorRectLeft.left() << ";" << cursorRectLeft.top() << ";" << cursorRectLeft.right() << ";" << cursorRectLeft.bottom() << std::endl;
std::cerr << "cursorRectRight :" << cursorRectRight.left() << ";" << cursorRectRight.top() << ";" << cursorRectRight.right() << ";" << cursorRectRight.bottom() << std::endl;
std::cerr << "pos XY :" << pos.x() << ";" << pos.y() << std::endl;
#endif
QRect cursorRectEnd = cursorRectStart;
//Finally set left with right of precedent character.
if (cursorRectEnd.top() < cursorRectLeft.bottom())
{
cursorRectEnd.setLeft(cursorRectLeft.right());
} else {
//Image on new line
cursorRectEnd.setLeft(0);
}
//And set Right with left of next character.
if (cursorRectEnd.bottom() > cursorRectRight.top())
{
cursorRectEnd.setRight(cursorRectRight.left());
} else {
//New line after Image.
}
#ifdef RSTEXTBROWSER_CHECKIMAGE_DEBUG
mCursorRectEnd = cursorRectEnd;
std::cerr << "final cursorRect:" << cursorRectEnd.left() << ";" << cursorRectEnd.top() << ";" << cursorRectEnd.right() << ";" << cursorRectEnd.bottom() << std::endl;
viewport()->update();
#endif
//If pos is on text rect
if (cursorRectEnd.contains(pos))
{
return imageStr.indexOf("base64,") != -1;
}
return false;
}

View file

@ -4,6 +4,8 @@
#include <QTextBrowser>
#include "util/RsSyntaxHighlighter.h"
//#define RSTEXTBROWSER_CHECKIMAGE_DEBUG 1
class RSImageBlockWidget;
class RSTextBrowser : public QTextBrowser
@ -18,16 +20,20 @@ public:
void setPlaceholderText(const QString &text);
void setImageBlockWidget(RSImageBlockWidget *widget);
void resetImagesStatus(bool load);
QPixmap getBlockedImage();
bool checkImage(QPoint pos, QString &imageStr);
bool checkImage(QPoint pos) {QString imageStr; return checkImage(pos, imageStr); }
void activateLinkClick(bool active);
virtual QVariant loadResource(int type, const QUrl &name);
QColor textColorQuote() const { return highliter->textColorQuote();}
QColor textColorQuote() const { return highlighter->textColorQuote();}
bool getShowImages() const { return mShowImages; }
public slots:
void showImages();
void setTextColorQuote(QColor textColorQuote) { highliter->setTextColorQuote(textColorQuote);}
void setTextColorQuote(QColor textColorQuote) { highlighter->setTextColorQuote(textColorQuote);}
private slots:
void linkClicked(const QUrl &url);
@ -41,7 +47,13 @@ private:
bool mShowImages;
RSImageBlockWidget *mImageBlockWidget;
bool mLinkClickActive;
RsSyntaxHighlighter *highliter;
RsSyntaxHighlighter *highlighter;
#ifdef RSTEXTBROWSER_CHECKIMAGE_DEBUG
QRect mCursorRectStart;
QRect mCursorRectLeft;
QRect mCursorRectRight;
QRect mCursorRectEnd;
#endif
};
#endif // RSTEXTBROWSER_H

View file

@ -157,15 +157,15 @@ void RsCollectionFile::recursAddElements(QDomDocument& doc,const DirDetails& det
d.setAttribute(QString("name"),QString::fromUtf8(details.name.c_str())) ;
for (std::list<DirStub>::const_iterator it = details.children.begin(); it != details.children.end(); ++it)
for(uint32_t i=0;i<details.children.size();++i)
{
if (!it->ref)
if (!details.children[i].ref)
continue;
DirDetails subDirDetails;
FileSearchFlags flags = RS_FILE_HINTS_LOCAL;
if (!rsFiles->RequestDirDetails(it->ref, subDirDetails, flags))
if (!rsFiles->RequestDirDetails(details.children[i].ref, subDirDetails, flags))
continue;
recursAddElements(doc,subDirDetails,d) ;

View file

@ -25,19 +25,24 @@
/** Constructor */
StyledElidedLabel::StyledElidedLabel(QWidget *parent)
: ElidedLabel(parent)
: ElidedLabel(parent), _lastFactor(-1)
{
}
StyledElidedLabel::StyledElidedLabel(const QString &text, QWidget *parent)
: ElidedLabel(text, parent)
: ElidedLabel(text, parent), _lastFactor(-1)
{
}
void StyledElidedLabel::setFontSizeFactor(int factor)
{
QFont f = font();
qreal fontSize = factor * f.pointSizeF() / 100;
f.setPointSizeF(fontSize);
setFont(f);
int newFactor = factor;
if (factor > 0) {
if (_lastFactor > 0) newFactor = 100 + factor - _lastFactor;
_lastFactor = factor;
QFont f = font();
qreal fontSize = newFactor * f.pointSizeF() / 100;
f.setPointSizeF(fontSize);
setFont(f);
}
}

View file

@ -34,6 +34,9 @@ public:
StyledElidedLabel(const QString &text, QWidget *parent = NULL);
void setFontSizeFactor(int factor);
private:
int _lastFactor;
};
#endif

View file

@ -418,19 +418,21 @@ void GxsCommentTreeWidget::service_loadThread(const uint32_t &token)
std::cerr << "GxsCommentTreeWidget::service_loadThread() Got Comment: " << comment.mMeta.mMsgId;
std::cerr << std::endl;
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(NULL);
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(NULL) ;
QString text;
{
QDateTime qtime;
qtime.setTime_t(comment.mMeta.mPublishTs);
QDateTime qtime ;
qtime.setTime_t(comment.mMeta.mPublishTs) ;
text = qtime.toString("yyyy-MM-dd hh:mm:ss");
item->setText(PCITEM_COLUMN_DATE, text);
text = qtime.toString("yyyy-MM-dd hh:mm:ss") ;
item->setText(PCITEM_COLUMN_DATE, text) ;
item->setToolTip(PCITEM_COLUMN_DATE, text) ;
}
text = QString::fromUtf8(comment.mComment.c_str());
item->setText(PCITEM_COLUMN_COMMENT, text);
item->setToolTip(PCITEM_COLUMN_COMMENT, text);
RsGxsId authorId = comment.mMeta.mAuthorId;
item->setId(authorId, PCITEM_COLUMN_AUTHOR, false);

View file

@ -13,9 +13,9 @@
<property name="windowTitle">
<string>Make Comment</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="GxsCreateCommentDialogVLayout">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="titleLabel">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
@ -26,11 +26,11 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="mainVLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="signedHLayout">
<item>
<spacer name="horizontalSpacer">
<spacer name="signedHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -43,7 +43,7 @@ p, li { white-space: pre-wrap; }
</spacer>
</item>
<item>
<widget class="QLabel" name="subjectLabel">
<widget class="QLabel" name="signedLabel">
<property name="text">
<string>Signed by</string>
</property>
@ -55,7 +55,7 @@ p, li { white-space: pre-wrap; }
</layout>
</item>
<item>
<widget class="QTextEdit" name="commentTextEdit"/>
<widget class="MimeTextEdit" name="commentTextEdit"/>
</item>
</layout>
</item>
@ -72,6 +72,11 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
<customwidgets>
<customwidget>
<class>MimeTextEdit</class>
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
<customwidget>
<class>GxsIdChooser</class>
<extends>QComboBox</extends>

View file

@ -195,7 +195,7 @@ bool GxsIdChooser::isInConstraintSet(const RsGxsId& id) const
return mConstraintIdsSet.find(id) != mConstraintIdsSet.end() ;
}
void GxsIdChooser::setEntryEnabled(int indx,bool enabled)
void GxsIdChooser::setEntryEnabled(int indx,bool /*enabled*/)
{
removeItem(indx) ;

View file

@ -59,7 +59,7 @@ void GxsMessageFramePostWidget::groupIdChanged()
fillComplete();
}
QString GxsMessageFramePostWidget::groupName(bool withUnreadCount)
QString GxsMessageFramePostWidget::groupName(bool /*withUnreadCount*/)
{
QString name = groupId().isNull () ? tr("No name") : mGroupName;

View file

@ -20,8 +20,17 @@
<iconset resource="../images.qrc">
<normaloff>:/images/logo/logo_16.png</normaloff>:/images/logo/logo_16.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<property name="margin">
<layout class="QGridLayout" name="CreateGxsChannelMsgGLayout">
<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>
<property name="spacing">
@ -31,14 +40,14 @@
<widget class="HeaderFrame" name="headerFrame"/>
</item>
<item row="1" column="0">
<widget class="QFrame" name="frame_2">
<widget class="QFrame" name="mainFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<layout class="QGridLayout" name="mainFrameGLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="mouseTracking">
@ -53,15 +62,15 @@
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<widget class="QWidget" name="channelPostTab">
<attribute name="title">
<string>Channel Post</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_7">
<layout class="QGridLayout" name="channelPostTabGLayout">
<item row="0" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="channelNameHLayout">
<item>
<widget class="QLabel" name="label_8">
<widget class="QLabel" name="channelNameLabel">
<property name="font">
<font>
<weight>75</weight>
@ -86,9 +95,9 @@
</layout>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_5">
<layout class="QGridLayout" name="channelAttachGLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="channelAttachLabel">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
@ -157,15 +166,15 @@ p, li { white-space: pre-wrap; }
</spacer>
</item>
<item row="2" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="messageGBox">
<property name="title">
<string>Message</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="messageGBoxVLayout">
<item>
<layout class="QHBoxLayout">
<layout class="QHBoxLayout" name="subjectHLayout">
<item>
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="subjectLabel">
<property name="font">
<font>
<weight>75</weight>
@ -183,14 +192,14 @@ p, li { white-space: pre-wrap; }
</layout>
</item>
<item>
<widget class="QTextEdit" name="msgEdit"/>
<widget class="MimeTextEdit" name="msgEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<widget class="QWidget" name="attachmentsTab">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/attachment.png</normaloff>:/images/attachment.png</iconset>
@ -198,9 +207,9 @@ p, li { white-space: pre-wrap; }
<attribute name="title">
<string>Attachments</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<layout class="QGridLayout" name="attachmentsTabGLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="attachmentsPixLabel">
<property name="text">
<string/>
</property>
@ -210,7 +219,7 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="attachmentsLabel">
<property name="maximumSize">
<size>
<width>16777215</width>
@ -229,7 +238,7 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item row="0" column="2">
<spacer>
<spacer name="attachmentsHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -281,7 +290,7 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item row="1" column="0" colspan="5">
<widget class="QScrollArea" name="scrollArea">
<widget class="QScrollArea" name="attachmentsScrollArea">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
@ -293,7 +302,7 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<width>523</width>
<height>24</height>
</rect>
</property>
@ -303,11 +312,20 @@ p, li { white-space: pre-wrap; }
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="scrollAreaWidgetContentsVLayout">
<property name="spacing">
<number>3</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
@ -324,7 +342,7 @@ p, li { white-space: pre-wrap; }
<property name="toolTip">
<string>Drag and Drop Files from Search Results</string>
</property>
<layout class="QGridLayout" name="gridLayout_3"/>
<layout class="QGridLayout" name="fileFrameGLayout"/>
</widget>
</item>
</layout>
@ -336,7 +354,7 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="buttonHLayout">
<item>
<widget class="QCheckBox" name="generateCheckBox">
<property name="text">
@ -378,10 +396,14 @@ p, li { white-space: pre-wrap; }
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>MimeTextEdit</class>
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -517,8 +517,7 @@ void GxsForumThreadWidget::contextMenuTextBrowser(QPoint point)
contextMnu->addSeparator();
QTextCursor cursor = ui->postText->cursorForPosition(point);
if(ImageUtil::checkImage(cursor))
if(ui->postText->checkImage(point))
{
ui->actionSave_image->setData(point);
contextMnu->addAction(ui->actionSave_image);

View file

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>icons/svg/profile.svg</file>
<file>icons/svg/download.svg</file>
<file>icons/svg/folders.svg</file>
<file>icons/svg/folders1.svg</file>

View file

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg4155"
version="1.1"
inkscape:version="0.91 r13725"
xml:space="preserve"
width="80"
height="80"
viewBox="0 0 80 80"
sodipodi:docname="profile.svg"><metadata
id="metadata4161"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs4159" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="706"
id="namedview4157"
showgrid="false"
inkscape:zoom="7.2390057"
inkscape:cx="21.406376"
inkscape:cy="40.981104"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="g4163" /><g
id="g4163"
inkscape:groupmode="layer"
inkscape:label="ink_ext_XXXXXX"
transform="matrix(1.25,0,0,-1.25,0,80)"><path
inkscape:connector-curvature="0"
id="path4167"
style="fill:#039bd5;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="M 64,32 C 64,14.327 49.673,0 32,0 14.327,0 0,14.327 0,32 0,49.673 14.327,64 32,64 49.673,64 64,49.673 64,32" /><g
transform="matrix(0.11606694,0,0,-0.11606694,7.5674886,58.025781)"
id="g3"><g
id="g5"><path
style="fill:#ffffff"
inkscape:connector-curvature="0"
d="m 382.93,100.232 -94.965,0 0,-0.833 c 0,-13.808 -11.193,-25 -25,-25 l -17.775,0 c -0.524,-13.343 -11.504,-24 -24.975,-24 l -17.5,0 c -13.471,0 -24.449,10.657 -24.975,24 l -17.775,0 c -13.807,0 -25,11.192 -25,25 l 0,0.833 -94.965,0 c -22.056,0 -40,17.944 -40,40 L 0,332.53 c 0,22.057 17.944,40 40,40 l 342.93,0 c 22.055,0 40,-17.943 40,-40 l 0,-192.298 c 0,-22.056 -17.946,-40 -40,-40 z M 211.465,74.714 c 8.422,0 15.25,6.827 15.25,15.25 0,8.423 -6.828,15.25 -15.25,15.25 -8.422,0 -15.25,-6.827 -15.25,-15.25 0,-8.423 6.828,-15.25 15.25,-15.25 z M 392.93,332.529 c 0,5.515 -4.486,10 -10,10 l -342.93,0 c -5.514,0 -10,-4.485 -10,-10 l 0,-192.297 c 0,-5.514 4.486,-10 10,-10 l 95.518,0 0,0.065 c 0,13.808 11.193,25 25,25 l 101.895,0 c 13.807,0 25,-11.192 25,-25 l 0,-0.065 95.518,0 c 5.515,0 10,4.486 10,10 l -10e-4,192.297 0,0 z"
id="path7" /><path
style="fill:#ffffff"
inkscape:connector-curvature="0"
d="m 353.165,184.131 -138.066,0 c -5.522,0 -10,4.477 -10,10 0,5.523 4.478,10 10,10 l 138.066,0 c 5.521,0 10,-4.477 10,-10 0,-5.523 -4.477,-10 -10,-10 z"
id="path9" /><path
style="fill:#ffffff"
inkscape:connector-curvature="0"
d="m 353.165,234.132 -138.066,0 c -5.522,0 -10,4.477 -10,10 0,5.522 4.478,10 10,10 l 138.066,0 c 5.521,0 10,-4.478 10,-10 0,-5.524 -4.477,-10 -10,-10 z"
id="path11" /><path
style="fill:#ffffff"
inkscape:connector-curvature="0"
d="m 353.165,284.132 -138.066,0 c -5.522,0 -10,4.477 -10,10 0,5.522 4.478,10 10,10 l 138.066,0 c 5.521,0 10,-4.478 10,-10 0,-5.524 -4.477,-10 -10,-10 z"
id="path13" /><path
style="fill:#ffffff"
inkscape:connector-curvature="0"
d="m 154.844,264.318 -17.537,-8.074 -8.424,-7.104 -13.059,12.988 6.01,40.172 c 0.021,0.146 -0.016,0.297 -0.104,0.418 l -6.716,9.189 c -0.106,0.146 -0.276,0.232 -0.458,0.232 -0.182,0 -0.352,-0.086 -0.459,-0.232 l -6.715,-9.189 c -0.088,-0.121 -0.125,-0.271 -0.104,-0.418 l 6.01,-40.174 -13.057,-12.986 -8.424,7.104 -17.538,8.074 c -2.595,1.063 -5.655,3.222 -6.441,5.496 0,0 -19.063,45.383 -8.724,45.383 l 110.903,0 c 10.339,0 -8.723,-45.383 -8.723,-45.383 -1.128,-2.701 -3.845,-4.43 -6.44,-5.496 z"
id="path15" /><path
style="fill:#ffffff"
inkscape:connector-curvature="0"
d="m 114.557,248.884 c 17.937,0 31.32,-16.711 31.625,-44.734 0.195,-19.447 -9.066,-31.084 -31.625,-31.084 -22.559,0 -31.822,11.637 -31.625,31.084 0.304,28.023 13.689,44.734 31.625,44.734 z"
id="path17" /></g></g></g></svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -639,3 +639,22 @@ IdEditDialog QLabel#info_label
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
}
GenCertDialog QPushButton#genButton {
border-image: url(:/images/btn_blue.png) 4;
border-width: 4;
padding: 0px 6px;
font-size: 16px;
font: bold;
color: white;
}
GenCertDialog QPushButton#genButton:hover {
border-image: url(:/images/btn_blue_hover.png) 4;
}
GenCertDialog QPushButton#genButton:disabled {
border-image: url(:/images/btn_27.png) 4;
font-size: 16px;
font: bold;
color: black;
}

View file

@ -36,18 +36,9 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) );
connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) );
connect(ui.editShareButton, SIGNAL(clicked()), this, SLOT(editDirectories()));
connect(ui.cleanHashCachePB, SIGNAL(clicked()), this, SLOT(clearHashCache()));
connect(ui.rememberHashesCB, SIGNAL(clicked(bool)), this, SLOT(clickedRememberHashes(bool)));
connect(ui.rememberHashesCB, SIGNAL(clicked(bool)), this, SLOT(toggleRememberHashes()));
connect(ui.autoCheckDirectories_CB, SIGNAL(clicked(bool)), this, SLOT(toggleAutoCheckDirectories(bool)));
}
void DirectoriesPage::clearHashCache()
{
if(QMessageBox::question(this, tr("Cache cleaning confirmation"), tr("This will forget any former hash of non shared files. Do you confirm ?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes)
rsFiles->clearHashCache() ;
}
void DirectoriesPage::toggleAutoCheckDirectories(bool b)
{
ui.autoCheckDirectoriesDelay_SB->setEnabled(b);
@ -58,28 +49,9 @@ void DirectoriesPage::editDirectories()
ShareManager::showYourself() ;
}
void DirectoriesPage::clickedRememberHashes(bool b)
{
if (!b) {
if (QMessageBox::question(this,tr("Cache cleaning confirmation"), tr("This will forget any former hash of non shared files. Do you confirm ?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) {
ui.rememberHashesCB->setChecked(true);
}
}
}
void DirectoriesPage::toggleRememberHashes()
{
bool b = ui.rememberHashesCB->isChecked();
ui.rememberHashesSB->setEnabled(b);
ui.cleanHashCachePB->setEnabled(b);
}
/** Saves the changes on this page */
bool DirectoriesPage::save(QString &/*errmsg*/)
{
rsFiles->setRememberHashFilesDuration(ui.rememberHashesSB->value());
rsFiles->setWatchPeriod(ui.autoCheckDirectoriesDelay_SB->value());
std::string dir = ui.incomingDir->text().toUtf8().constData();
if (!dir.empty())
{
@ -92,18 +64,8 @@ bool DirectoriesPage::save(QString &/*errmsg*/)
rsFiles->setPartialsDirectory(dir);
}
if (ui.rememberHashesCB->isChecked()) {
rsFiles->setRememberHashFiles(true);
} else {
rsFiles->setRememberHashFiles(false);
rsFiles->clearHashCache() ;
}
if (ui.autoCheckDirectories_CB->isChecked()) {
rsFiles->setWatchPeriod(ui.autoCheckDirectoriesDelay_SB->value());
} else {
rsFiles->setWatchPeriod(-ui.autoCheckDirectoriesDelay_SB->value());
}
rsFiles->setWatchEnabled(ui.autoCheckDirectories_CB->isChecked()) ;
rsFiles->setWatchPeriod(ui.autoCheckDirectoriesDelay_SB->value());
rsFiles->shareDownloadDirectory(ui.shareDownloadDirectoryCB->isChecked());
@ -115,14 +77,9 @@ void DirectoriesPage::load()
{
ui.shareDownloadDirectoryCB->setChecked(rsFiles->getShareDownloadDirectory());
ui.rememberHashesSB->setValue(rsFiles->rememberHashFilesDuration());
ui.rememberHashesCB->setChecked(rsFiles->rememberHashFiles());
toggleRememberHashes();
int u = rsFiles->watchPeriod() ;
ui.autoCheckDirectoriesDelay_SB->setValue(abs(u)) ;
ui.autoCheckDirectories_CB->setChecked(u>0) ;
ui.autoCheckDirectoriesDelay_SB->setEnabled(u>0) ;
ui.autoCheckDirectoriesDelay_SB->setValue(u) ;
ui.autoCheckDirectories_CB->setChecked(rsFiles->watchEnabled()) ; ;
ui.incomingDir->setText(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()));
ui.partialsDir->setText(QString::fromUtf8(rsFiles->getPartialsDirectory().c_str()));

View file

@ -45,9 +45,6 @@ private slots:
void editDirectories() ;
void setIncomingDirectory();
void setPartialsDirectory();
void clearHashCache();
void clickedRememberHashes(bool);
void toggleRememberHashes();
void toggleAutoCheckDirectories(bool);
private:

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>485</width>
<width>895</width>
<height>549</height>
</rect>
</property>
@ -144,50 +144,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="rememberHashesCB">
<property name="toolTip">
<string>Remember file hashes even if not shared.
This might be useful if you're sharing an
external HD, to avoid re-hashing files when
you plug it in.</string>
</property>
<property name="text">
<string>Remember hashed files for </string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="rememberHashesSB">
<property name="suffix">
<string> days</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>365</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cleanHashCachePB">
<property name="toolTip">
<string>Forget any hashed file that is not anymore shared.</string>
</property>
<property name="text">
<string>Clean Hash Cache</string>
</property>
</widget>
</item>
</layout>
<layout class="QHBoxLayout" name="horizontalLayout"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
@ -240,9 +197,6 @@ you plug it in.</string>
<tabstops>
<tabstop>shareDownloadDirectoryCB</tabstop>
<tabstop>editShareButton</tabstop>
<tabstop>rememberHashesCB</tabstop>
<tabstop>rememberHashesSB</tabstop>
<tabstop>cleanHashCachePB</tabstop>
<tabstop>autoCheckDirectories_CB</tabstop>
<tabstop>autoCheckDirectoriesDelay_SB</tabstop>
<tabstop>incomingDir</tabstop>

View file

@ -486,7 +486,7 @@ void ServerPage::addPeerToIPTable(QTableWidget *table,int row,const BanListPeer&
void ServerPage::toggleGroupIps(bool b) { rsBanList->enableAutoRange(b) ; }
void ServerPage::setGroupIpLimit(int n) { rsBanList->setAutoRangeLimit(n) ; }
void ServerPage::ipFilterContextMenu(const QPoint& point)
void ServerPage::ipFilterContextMenu(const QPoint& /*point*/)
{
QMenu contextMenu(this) ;
int row = ui.filteredIpsTable->currentRow();
@ -604,7 +604,7 @@ void ServerPage::ipWhiteListContextMenu(const QPoint& /* point */)
if(item == NULL)
return ;
bool status = item->data(Qt::UserRole).toBool();
//bool status = item->data(Qt::UserRole).toBool();
contextMenu.addAction(tr("Remove"),this,SLOT(removeWhiteListedIp()));

View file

@ -36,7 +36,6 @@ TransferPage::TransferPage(QWidget * parent, Qt::WindowFlags flags)
ui.setupUi(this);
ui._queueSize_SB->setValue(rsFiles->getQueueSize()) ;
ui._minPrioritized_SB->setValue(rsFiles->getMinPrioritizedTransfers()) ;
switch(rsFiles->defaultChunkStrategy())
{
@ -48,7 +47,6 @@ TransferPage::TransferPage(QWidget * parent, Qt::WindowFlags flags)
ui._diskSpaceLimit_SB->setValue(rsFiles->freeDiskSpaceLimit()) ;
QObject::connect(ui._queueSize_SB,SIGNAL(valueChanged(int)),this,SLOT(updateQueueSize(int))) ;
QObject::connect(ui._minPrioritized_SB,SIGNAL(valueChanged(int)),this,SLOT(updateMinPrioritized(int))) ;
QObject::connect(ui._defaultStrategy_CB,SIGNAL(activated(int)),this,SLOT(updateDefaultStrategy(int))) ;
QObject::connect(ui._diskSpaceLimit_SB,SIGNAL(valueChanged(int)),this,SLOT(updateDiskSizeLimit(int))) ;
QObject::connect(ui._max_tr_up_per_sec_SB, SIGNAL( valueChanged( int ) ), this, SLOT( updateMaxTRUpRate(int) ) );
@ -80,15 +78,7 @@ void TransferPage::updateDiskSizeLimit(int s)
rsFiles->setFreeDiskSpaceLimit(s) ;
}
void TransferPage::updateMinPrioritized(int s)
{
rsFiles->setMinPrioritizedTransfers(s) ;
}
void TransferPage::updateQueueSize(int s)
{
if(ui._minPrioritized_SB->value() > s)
{
ui._minPrioritized_SB->setValue(s) ;
}
rsFiles->setQueueSize(s) ;
}

View file

@ -46,7 +46,6 @@ class TransferPage: public ConfigPage
public slots:
void updateQueueSize(int) ;
void updateMinPrioritized(int) ;
void updateDefaultStrategy(int) ;
void updateDiskSizeLimit(int) ;
void updateMaxTRUpRate(int);

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>604</width>
<height>340</height>
<width>700</width>
<height>356</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -28,13 +28,6 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Slots reserved for non-cache transfers:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
@ -76,19 +69,6 @@
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="_minPrioritized_SB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;You can use this to force RetroShare to download your files rather &lt;br/&gt;than cache files for as many slots as requested. Setting that number &lt;br/&gt;to be equal to the queue size above will always prioritize your files&lt;br/&gt;over cache. &lt;br/&gt;&lt;br/&gt;It is however recommended to leave at least a few slots for cache files. For now, cache files are only used to transfer friend file lists.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="value">
<number>3</number>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="_defaultStrategy_CB">
<property name="enabled">
@ -168,12 +148,12 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt; font-weight:600;&quot;&gt;RetroShare&lt;/span&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt;&quot;&gt; is capable of transferring data and search requests between peers that are not necessarily friends. This traffic however only transits through a connected list of friends and is anonymous.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt;&quot;&gt;You can separately setup share flags for each shared directory in the shared files dialog to be:&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-family:'Sans'; font-size:8pt;&quot; style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Browsable by friends&lt;/span&gt;: files are seen by your friends.&lt;/li&gt;
&lt;li style=&quot; font-family:'Sans'; font-size:8pt;&quot; style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Anonymously shared&lt;/span&gt;: files are anonymously reachable through distant F2F tunnels.&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; font-weight:600;&quot;&gt;RetroShare&lt;/span&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; is capable of transferring data and search requests between peers that are not necessarily friends. This traffic however only transits through a connected list of friends and is anonymous.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;You can separately setup share flags for each shared directory in the shared files dialog to be:&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-size:8pt;&quot; style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Browsable by friends&lt;/span&gt;: files are seen by your friends.&lt;/li&gt;
&lt;li style=&quot; font-size:8pt;&quot; style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Anonymously shared&lt;/span&gt;: files are anonymously reachable through distant F2F tunnels.&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>

View file

@ -789,7 +789,10 @@ bool RshareSettings::getRetroShareProtocol()
}
}
#elif defined(Q_OS_LINUX)
QFile desktop("/usr/share/applications/RetroShare06.desktop");
QFile desktop("/usr/share/applications/retroshare06.desktop");
if (!desktop.exists()) {
desktop.setFileName("/usr/share/applications/RetroShare06.desktop");
}
if (desktop.exists()) {
desktop.open(QIODevice::ReadOnly | QIODevice::Text);
QTextStream in(&desktop);
@ -799,7 +802,7 @@ bool RshareSettings::getRetroShareProtocol()
}
desktop.close();
if (lines.contains("Exec=" + getAppPathForProtocol()))
if (lines.contains("MimeType=x-scheme-handler/retroshare"))
if (lines.contains("MimeType=x-scheme-handler/retroshare;"))
return true;
}
#else