mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #3 from defnax/v0.6-Circles
Improved layout better look & feel for Circles View
This commit is contained in:
commit
08d9dcbe22
@ -22,9 +22,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "gui/Circles/CreateCircleDialog.h"
|
#include "gui/Circles/CreateCircleDialog.h"
|
||||||
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsidentity.h>
|
#include <retroshare/rsidentity.h>
|
||||||
@ -50,10 +52,6 @@ CreateCircleDialog::CreateCircleDialog()
|
|||||||
/* Setup Queue */
|
/* Setup Queue */
|
||||||
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
|
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
|
||||||
mIdQueue = new TokenQueue(rsIdentity->getTokenService(), this);
|
mIdQueue = new TokenQueue(rsIdentity->getTokenService(), this);
|
||||||
|
|
||||||
//QString text = pId.empty() ? tr("Start New Thread") : tr("Post Forum Message");
|
|
||||||
//setWindowTitle(text);
|
|
||||||
//Settings->loadWidgetInformation(this);
|
|
||||||
|
|
||||||
ui.headerFrame->setHeaderImage(QPixmap(":/images/circles/circles_64.png"));
|
ui.headerFrame->setHeaderImage(QPixmap(":/images/circles/circles_64.png"));
|
||||||
|
|
||||||
@ -67,6 +65,9 @@ CreateCircleDialog::CreateCircleDialog()
|
|||||||
connect(ui.treeWidget_membership, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedMember(QTreeWidgetItem*, QTreeWidgetItem*)));
|
connect(ui.treeWidget_membership, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedMember(QTreeWidgetItem*, QTreeWidgetItem*)));
|
||||||
connect(ui.treeWidget_IdList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedId(QTreeWidgetItem*, QTreeWidgetItem*)));
|
connect(ui.treeWidget_IdList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedId(QTreeWidgetItem*, QTreeWidgetItem*)));
|
||||||
|
|
||||||
|
connect(ui.treeWidget_IdList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(IdListCustomPopupMenu(QPoint)));
|
||||||
|
connect(ui.treeWidget_membership, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(MembershipListCustomPopupMenu(QPoint)));
|
||||||
|
|
||||||
connect(ui.IdFilter, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
connect(ui.IdFilter, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
||||||
|
|
||||||
//connect(ui.toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId()));
|
//connect(ui.toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId()));
|
||||||
@ -122,12 +123,13 @@ void CreateCircleDialog::editNewId(bool isExternal)
|
|||||||
if (isExternal)
|
if (isExternal)
|
||||||
{
|
{
|
||||||
setupForExternalCircle();
|
setupForExternalCircle();
|
||||||
ui.headerFrame->setHeaderText(tr("Create New External Circle"));
|
ui.headerFrame->setHeaderText(tr("Create New Circle"));
|
||||||
|
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setupForPersonalCircle();
|
setupForPersonalCircle();
|
||||||
ui.headerFrame->setHeaderText(tr("Create New Personal Circle"));
|
ui.headerFrame->setHeaderText(tr("Create New Circle"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* enable stuff that might be locked */
|
/* enable stuff that might be locked */
|
||||||
@ -139,14 +141,14 @@ void CreateCircleDialog::setupForPersonalCircle()
|
|||||||
|
|
||||||
/* hide distribution line */
|
/* hide distribution line */
|
||||||
|
|
||||||
ui.groupBox_title->setTitle(tr("Personal Circle Details"));
|
ui.groupBox_title->setTitle(tr("Circle Details"));
|
||||||
ui.frame_PgpTypes->hide();
|
ui.frame_PgpTypes->hide();
|
||||||
ui.frame_Distribution->hide();
|
ui.frame_Distribution->hide();
|
||||||
ui.idChooserLabel->hide();
|
ui.idChooserLabel->hide();
|
||||||
ui.idChooser->hide();
|
ui.idChooser->hide();
|
||||||
//ui.toolButton_NewId->hide();
|
//ui.toolButton_NewId->hide();
|
||||||
|
|
||||||
getPgpIdentities();
|
//getPgpIdentities();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateCircleDialog::setupForExternalCircle()
|
void CreateCircleDialog::setupForExternalCircle()
|
||||||
@ -154,7 +156,8 @@ void CreateCircleDialog::setupForExternalCircle()
|
|||||||
mIsExternalCircle = true;
|
mIsExternalCircle = true;
|
||||||
|
|
||||||
/* show distribution line */
|
/* show distribution line */
|
||||||
ui.groupBox_title->setTitle(tr("External Circle Details"));
|
ui.groupBox_title->setTitle(tr("Circle Details"));
|
||||||
|
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Update"));
|
||||||
ui.frame_PgpTypes->show();
|
ui.frame_PgpTypes->show();
|
||||||
ui.frame_Distribution->show();
|
ui.frame_Distribution->show();
|
||||||
ui.idChooserLabel->show();
|
ui.idChooserLabel->show();
|
||||||
@ -220,6 +223,7 @@ void CreateCircleDialog::addMember(const QString& keyId, const QString& idtype,
|
|||||||
member->setText(RSCIRCLEID_COL_NICKNAME, nickname);
|
member->setText(RSCIRCLEID_COL_NICKNAME, nickname);
|
||||||
member->setText(RSCIRCLEID_COL_KEYID, keyId);
|
member->setText(RSCIRCLEID_COL_KEYID, keyId);
|
||||||
member->setText(RSCIRCLEID_COL_IDTYPE, idtype);
|
member->setText(RSCIRCLEID_COL_IDTYPE, idtype);
|
||||||
|
//member->setIcon(RSCIRCLEID_COL_NICKNAME, pixmap);
|
||||||
|
|
||||||
tree->addTopLevelItem(member);
|
tree->addTopLevelItem(member);
|
||||||
}
|
}
|
||||||
@ -522,7 +526,7 @@ void CreateCircleDialog::loadCircle(uint32_t token)
|
|||||||
updateCircleGUI();
|
updateCircleGUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateCircleDialog::getPgpIdentities()
|
/*void CreateCircleDialog::getPgpIdentities()
|
||||||
{
|
{
|
||||||
std::cerr << "CreateCircleDialog::getPgpIdentities()";
|
std::cerr << "CreateCircleDialog::getPgpIdentities()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -556,7 +560,7 @@ void CreateCircleDialog::getPgpIdentities()
|
|||||||
}
|
}
|
||||||
|
|
||||||
filterIds();
|
filterIds();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
void CreateCircleDialog::requestGxsIdentities()
|
void CreateCircleDialog::requestGxsIdentities()
|
||||||
@ -616,6 +620,11 @@ void CreateCircleDialog::loadIdentities(uint32_t token)
|
|||||||
QString keyId = QString::fromStdString(data.mMeta.mGroupId.toStdString());
|
QString keyId = QString::fromStdString(data.mMeta.mGroupId.toStdString());
|
||||||
QString nickname = QString::fromUtf8(data.mMeta.mGroupName.c_str());
|
QString nickname = QString::fromUtf8(data.mMeta.mGroupName.c_str());
|
||||||
QString idtype = tr("Anon Id");
|
QString idtype = tr("Anon Id");
|
||||||
|
|
||||||
|
QPixmap pixmap ;
|
||||||
|
|
||||||
|
if(data.mImage.mSize == 0 || !pixmap.loadFromData(data.mImage.mData, data.mImage.mSize, "PNG"))
|
||||||
|
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(data.mMeta.mGroupId))) ;
|
||||||
|
|
||||||
if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID) {
|
if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID) {
|
||||||
if (data.mPgpKnown) {
|
if (data.mPgpKnown) {
|
||||||
@ -629,6 +638,7 @@ void CreateCircleDialog::loadIdentities(uint32_t token)
|
|||||||
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
item->setText(RSCIRCLEID_COL_NICKNAME, nickname);
|
item->setText(RSCIRCLEID_COL_NICKNAME, nickname);
|
||||||
|
item->setIcon(RSCIRCLEID_COL_NICKNAME, QIcon(pixmap));
|
||||||
item->setText(RSCIRCLEID_COL_KEYID, keyId);
|
item->setText(RSCIRCLEID_COL_KEYID, keyId);
|
||||||
item->setText(RSCIRCLEID_COL_IDTYPE, idtype);
|
item->setText(RSCIRCLEID_COL_IDTYPE, idtype);
|
||||||
tree->addTopLevelItem(item);
|
tree->addTopLevelItem(item);
|
||||||
@ -693,10 +703,39 @@ void CreateCircleDialog::filterIds()
|
|||||||
ui.treeWidget_IdList->filterItems(filterColumn, text);
|
ui.treeWidget_IdList->filterItems(filterColumn, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateCircleDialog::createNewGxsId()
|
void CreateCircleDialog::createNewGxsId()
|
||||||
{
|
{
|
||||||
IdEditDialog dlg(this);
|
IdEditDialog dlg(this);
|
||||||
dlg.setupNewId(false);
|
dlg.setupNewId(false);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
//ui.idChooser->setDefaultId(dlg.getLastIdName());
|
//ui.idChooser->setDefaultId(dlg.getLastIdName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreateCircleDialog::IdListCustomPopupMenu( QPoint )
|
||||||
|
{
|
||||||
|
QMenu contextMnu( this );
|
||||||
|
|
||||||
|
QTreeWidgetItem *item = ui.treeWidget_IdList->currentItem();
|
||||||
|
if (item) {
|
||||||
|
|
||||||
|
contextMnu.addAction(QIcon(":/images/edit_add24.png"), tr("Add Member"), this, SLOT(addMember()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
contextMnu.exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateCircleDialog::MembershipListCustomPopupMenu( QPoint )
|
||||||
|
{
|
||||||
|
QMenu contextMnu( this );
|
||||||
|
|
||||||
|
QTreeWidgetItem *item = ui.treeWidget_membership->currentItem();
|
||||||
|
if (item) {
|
||||||
|
|
||||||
|
contextMnu.addAction(QIcon(":/images/delete.png"), tr("Remove Member"), this, SLOT(removeMember()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
contextMnu.exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
|
|
||||||
void editNewId(bool isExternal);
|
void editNewId(bool isExternal);
|
||||||
void editExistingId(const RsGxsGroupId &circleId, const bool &clearList = true);
|
void editExistingId(const RsGxsGroupId &circleId, const bool &clearList = true);
|
||||||
void addMember(const QString &keyId, const QString &idtype, const QString &nickname );
|
void addMember(const QString &keyId, const QString &idtype, const QString &nickname);
|
||||||
void addMember(const RsGxsIdGroup &idGroup);
|
void addMember(const RsGxsIdGroup &idGroup);
|
||||||
void addCircle(const RsGxsCircleDetails &cirDetails);
|
void addCircle(const RsGxsCircleDetails &cirDetails);
|
||||||
|
|
||||||
@ -57,6 +57,10 @@ private slots:
|
|||||||
void createCircle();
|
void createCircle();
|
||||||
void filterChanged(const QString &text);
|
void filterChanged(const QString &text);
|
||||||
void createNewGxsId();
|
void createNewGxsId();
|
||||||
|
|
||||||
|
/** Create the context popup menu and it's submenus */
|
||||||
|
void IdListCustomPopupMenu( QPoint point );
|
||||||
|
void MembershipListCustomPopupMenu( QPoint point);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -73,7 +77,7 @@ private:
|
|||||||
|
|
||||||
void requestCircle(const RsGxsGroupId &groupId);
|
void requestCircle(const RsGxsGroupId &groupId);
|
||||||
void requestGxsIdentities();
|
void requestGxsIdentities();
|
||||||
void getPgpIdentities();
|
//void getPgpIdentities();
|
||||||
|
|
||||||
void filterIds();
|
void filterIds();
|
||||||
|
|
||||||
|
@ -49,6 +49,9 @@
|
|||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeWidget" name="treeWidget_membership">
|
<widget class="QTreeWidget" name="treeWidget_membership">
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
<property name="sortingEnabled">
|
<property name="sortingEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -128,7 +131,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_4">
|
<widget class="QGroupBox" name="groupBox_4">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Known Identities</string>
|
<string>Known People</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
@ -186,6 +189,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="RSTreeWidget" name="treeWidget_IdList">
|
<widget class="RSTreeWidget" name="treeWidget_IdList">
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
<property name="sortingEnabled">
|
<property name="sortingEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -240,7 +246,11 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="circleName"/>
|
<widget class="QLineEdit" name="circleName">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Circle name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="idChooserLabel">
|
<widget class="QLabel" name="idChooserLabel">
|
||||||
|
@ -68,7 +68,8 @@
|
|||||||
|
|
||||||
#define RSID_COL_NICKNAME 0
|
#define RSID_COL_NICKNAME 0
|
||||||
#define RSID_COL_KEYID 1
|
#define RSID_COL_KEYID 1
|
||||||
#define RSID_COL_IDTYPE 2
|
#define RSID_COL_LASTUSED 2
|
||||||
|
#define RSID_COL_IDTYPE 3
|
||||||
|
|
||||||
#define RSIDREP_COL_NAME 0
|
#define RSIDREP_COL_NAME 0
|
||||||
#define RSIDREP_COL_OPINION 1
|
#define RSIDREP_COL_OPINION 1
|
||||||
@ -164,9 +165,9 @@ IdDialog::IdDialog(QWidget *parent) :
|
|||||||
|
|
||||||
connect(ui->messageButton, SIGNAL(clicked()), this, SLOT(sendMsg()));
|
connect(ui->messageButton, SIGNAL(clicked()), this, SLOT(sendMsg()));
|
||||||
|
|
||||||
#ifdef UNFINISHED_CODE
|
|
||||||
ui->avlabel->setPixmap(QPixmap(":/images/user/friends64.png"));
|
ui->avlabel->setPixmap(QPixmap(":/images/user/friends64.png"));
|
||||||
#endif
|
|
||||||
ui->headerTextLabel->setText(tr("People"));
|
ui->headerTextLabel->setText(tr("People"));
|
||||||
|
|
||||||
/* Initialize splitter */
|
/* Initialize splitter */
|
||||||
@ -192,12 +193,20 @@ IdDialog::IdDialog(QWidget *parent) :
|
|||||||
ui->filterLineEdit->addFilter(QIcon(), headerText, RSID_COL_NICKNAME, QString("%1 %2").arg(tr("Search"), headerText));
|
ui->filterLineEdit->addFilter(QIcon(), headerText, RSID_COL_NICKNAME, QString("%1 %2").arg(tr("Search"), headerText));
|
||||||
headerText = headerItem->text(RSID_COL_KEYID);
|
headerText = headerItem->text(RSID_COL_KEYID);
|
||||||
ui->filterLineEdit->addFilter(QIcon(), headerItem->text(RSID_COL_KEYID), RSID_COL_KEYID, QString("%1 %2").arg(tr("Search"), headerText));
|
ui->filterLineEdit->addFilter(QIcon(), headerItem->text(RSID_COL_KEYID), RSID_COL_KEYID, QString("%1 %2").arg(tr("Search"), headerText));
|
||||||
|
|
||||||
|
/* Set initial section sizes */
|
||||||
|
QHeaderView * circlesheader = ui->treeWidget_membership->header () ;
|
||||||
|
circlesheader->resizeSection (CIRCLEGROUP_CIRCLE_COL_GROUPNAME, 280);
|
||||||
|
|
||||||
/* Setup tree */
|
/* Setup tree */
|
||||||
ui->idTreeWidget->sortByColumn(RSID_COL_NICKNAME, Qt::AscendingOrder);
|
ui->idTreeWidget->sortByColumn(RSID_COL_NICKNAME, Qt::AscendingOrder);
|
||||||
|
|
||||||
ui->idTreeWidget->enableColumnCustomize(true);
|
ui->idTreeWidget->enableColumnCustomize(true);
|
||||||
ui->idTreeWidget->setColumnCustomizable(RSID_COL_NICKNAME, false);
|
ui->idTreeWidget->setColumnCustomizable(RSID_COL_NICKNAME, false);
|
||||||
|
|
||||||
|
ui->idTreeWidget->setColumnHidden(RSID_COL_IDTYPE, true);
|
||||||
|
ui->idTreeWidget->setColumnHidden(RSID_COL_LASTUSED, true);
|
||||||
|
|
||||||
|
|
||||||
/* Set initial column width */
|
/* Set initial column width */
|
||||||
int fontWidth = QFontMetricsF(ui->idTreeWidget->font()).width("W");
|
int fontWidth = QFontMetricsF(ui->idTreeWidget->font()).width("W");
|
||||||
@ -213,9 +222,6 @@ IdDialog::IdDialog(QWidget *parent) :
|
|||||||
// Hiding RepList until that part is finished.
|
// Hiding RepList until that part is finished.
|
||||||
//ui->treeWidget_RepList->setVisible(false);
|
//ui->treeWidget_RepList->setVisible(false);
|
||||||
ui->toolButton_Reputation->setVisible(false);
|
ui->toolButton_Reputation->setVisible(false);
|
||||||
#ifdef UNFINISHED_CODE
|
|
||||||
ui->todoPushButton->hide() ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString hlp_str = tr(
|
QString hlp_str = tr(
|
||||||
" <h1><img width=\"32\" src=\":/icons/help_64.png\"> Identities</h1> \
|
" <h1><img width=\"32\" src=\":/icons/help_64.png\"> Identities</h1> \
|
||||||
@ -242,6 +248,8 @@ IdDialog::IdDialog(QWidget *parent) :
|
|||||||
connect(ui->pushButton_extCircle, SIGNAL(clicked()), this, SLOT(createExternalCircle()));
|
connect(ui->pushButton_extCircle, SIGNAL(clicked()), this, SLOT(createExternalCircle()));
|
||||||
connect(ui->pushButton_editCircle, SIGNAL(clicked()), this, SLOT(editExistingCircle()));
|
connect(ui->pushButton_editCircle, SIGNAL(clicked()), this, SLOT(editExistingCircle()));
|
||||||
connect(ui->treeWidget_membership, SIGNAL(itemSelectionChanged()), this, SLOT(circle_selected()));
|
connect(ui->treeWidget_membership, SIGNAL(itemSelectionChanged()), this, SLOT(circle_selected()));
|
||||||
|
connect(ui->treeWidget_membership, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CircleListCustomPopupMenu(QPoint)));
|
||||||
|
|
||||||
|
|
||||||
/* Setup TokenQueue */
|
/* Setup TokenQueue */
|
||||||
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
|
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
|
||||||
@ -292,20 +300,20 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
|
|||||||
mStateHelper->setActive(CIRCLESDIALOG_GROUPMETA, true);
|
mStateHelper->setActive(CIRCLESDIALOG_GROUPMETA, true);
|
||||||
|
|
||||||
/* add the top level item */
|
/* add the top level item */
|
||||||
QTreeWidgetItem *personalCirclesItem = new QTreeWidgetItem();
|
//QTreeWidgetItem *personalCirclesItem = new QTreeWidgetItem();
|
||||||
personalCirclesItem->setText(0, tr("Personal Circles"));
|
//personalCirclesItem->setText(0, tr("Personal Circles"));
|
||||||
ui->treeWidget_membership->addTopLevelItem(personalCirclesItem);
|
//ui->treeWidget_membership->addTopLevelItem(personalCirclesItem);
|
||||||
|
|
||||||
QTreeWidgetItem *externalAdminCirclesItem = new QTreeWidgetItem();
|
QTreeWidgetItem *externalAdminCirclesItem = new QTreeWidgetItem();
|
||||||
externalAdminCirclesItem->setText(0, tr("External Circles (Admin)"));
|
externalAdminCirclesItem->setText(0, tr("Circles (Admin)"));
|
||||||
ui->treeWidget_membership->addTopLevelItem(externalAdminCirclesItem);
|
ui->treeWidget_membership->addTopLevelItem(externalAdminCirclesItem);
|
||||||
|
|
||||||
QTreeWidgetItem *externalSubCirclesItem = new QTreeWidgetItem();
|
QTreeWidgetItem *externalSubCirclesItem = new QTreeWidgetItem();
|
||||||
externalSubCirclesItem->setText(0, tr("External Circles (Subscribed)"));
|
externalSubCirclesItem->setText(0, tr("Circles (Subscribed)"));
|
||||||
ui->treeWidget_membership->addTopLevelItem(externalSubCirclesItem);
|
ui->treeWidget_membership->addTopLevelItem(externalSubCirclesItem);
|
||||||
|
|
||||||
QTreeWidgetItem *externalOtherCirclesItem = new QTreeWidgetItem();
|
QTreeWidgetItem *externalOtherCirclesItem = new QTreeWidgetItem();
|
||||||
externalOtherCirclesItem->setText(0, tr("External Circles (Other)"));
|
externalOtherCirclesItem->setText(0, tr("Circles (Other)"));
|
||||||
ui->treeWidget_membership->addTopLevelItem(externalOtherCirclesItem);
|
ui->treeWidget_membership->addTopLevelItem(externalOtherCirclesItem);
|
||||||
|
|
||||||
for(vit = groupInfo.begin(); vit != groupInfo.end(); ++vit)
|
for(vit = groupInfo.begin(); vit != groupInfo.end(); ++vit)
|
||||||
@ -321,7 +329,7 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
|
|||||||
|
|
||||||
if (vit->mCircleType == GXS_CIRCLE_TYPE_LOCAL)
|
if (vit->mCircleType == GXS_CIRCLE_TYPE_LOCAL)
|
||||||
{
|
{
|
||||||
personalCirclesItem->addChild(groupItem);
|
//personalCirclesItem->addChild(groupItem);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -364,6 +372,20 @@ void IdDialog::editExistingCircle()
|
|||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IdDialog::CircleListCustomPopupMenu( QPoint )
|
||||||
|
{
|
||||||
|
QMenu contextMnu( this );
|
||||||
|
|
||||||
|
QTreeWidgetItem *item = ui->treeWidget_membership->currentItem();
|
||||||
|
if (item) {
|
||||||
|
|
||||||
|
contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Circle"), this, SLOT(editExistingCircle()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
contextMnu.exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
|
||||||
static void set_item_background(QTreeWidgetItem *item, uint32_t type)
|
static void set_item_background(QTreeWidgetItem *item, uint32_t type)
|
||||||
{
|
{
|
||||||
QBrush brush;
|
QBrush brush;
|
||||||
@ -494,6 +516,24 @@ void IdDialog::todo()
|
|||||||
"</ul>");
|
"</ul>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString getHumanReadableDuration(uint32_t seconds)
|
||||||
|
{
|
||||||
|
if(seconds < 60)
|
||||||
|
return QString(QObject::tr("%1 seconds ago")).arg(seconds) ;
|
||||||
|
else if(seconds < 120)
|
||||||
|
return QString(QObject::tr("%1 minute ago")).arg(seconds/60) ;
|
||||||
|
else if(seconds < 3600)
|
||||||
|
return QString(QObject::tr("%1 minutes ago")).arg(seconds/60) ;
|
||||||
|
else if(seconds < 7200)
|
||||||
|
return QString(QObject::tr("%1 hour ago")).arg(seconds/3600) ;
|
||||||
|
else if(seconds < 24*3600)
|
||||||
|
return QString(QObject::tr("%1 hours ago")).arg(seconds/3600) ;
|
||||||
|
else if(seconds < 2*24*3600)
|
||||||
|
return QString(QObject::tr("%1 day ago")).arg(seconds/86400) ;
|
||||||
|
else
|
||||||
|
return QString(QObject::tr("%1 days ago")).arg(seconds/86400) ;
|
||||||
|
}
|
||||||
|
|
||||||
void IdDialog::processSettings(bool load)
|
void IdDialog::processSettings(bool load)
|
||||||
{
|
{
|
||||||
Settings->beginGroup("IdDialog");
|
Settings->beginGroup("IdDialog");
|
||||||
@ -617,8 +657,13 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
|||||||
|
|
||||||
item->setText(RSID_COL_NICKNAME, QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
|
item->setText(RSID_COL_NICKNAME, QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
|
||||||
item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId.toStdString()));
|
item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId.toStdString()));
|
||||||
|
|
||||||
|
time_t now = time(NULL) ;
|
||||||
|
item->setText(RSID_COL_LASTUSED, getHumanReadableDuration(now - data.mLastUsageTS)) ;
|
||||||
|
|
||||||
item->setData(RSID_COL_KEYID, Qt::UserRole,QVariant(item_flags)) ;
|
item->setData(RSID_COL_KEYID, Qt::UserRole,QVariant(item_flags)) ;
|
||||||
|
|
||||||
|
item->setData(RSID_COL_LASTUSED, Qt::UserRole, QString::number(now - data.mLastUsageTS));
|
||||||
|
|
||||||
if(isOwnId)
|
if(isOwnId)
|
||||||
{
|
{
|
||||||
@ -770,24 +815,6 @@ void IdDialog::requestIdDetails()
|
|||||||
mIdQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, IDDIALOG_IDDETAILS);
|
mIdQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, IDDIALOG_IDDETAILS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString getHumanReadableDuration(uint32_t seconds)
|
|
||||||
{
|
|
||||||
if(seconds < 60)
|
|
||||||
return QString(QObject::tr("%1 seconds ago")).arg(seconds) ;
|
|
||||||
else if(seconds < 120)
|
|
||||||
return QString(QObject::tr("%1 minute ago")).arg(seconds/60) ;
|
|
||||||
else if(seconds < 3600)
|
|
||||||
return QString(QObject::tr("%1 minutes ago")).arg(seconds/60) ;
|
|
||||||
else if(seconds < 7200)
|
|
||||||
return QString(QObject::tr("%1 hour ago")).arg(seconds/3600) ;
|
|
||||||
else if(seconds < 24*3600)
|
|
||||||
return QString(QObject::tr("%1 hours ago")).arg(seconds/3600) ;
|
|
||||||
else if(seconds < 2*24*3600)
|
|
||||||
return QString(QObject::tr("%1 day ago")).arg(seconds/86400) ;
|
|
||||||
else
|
|
||||||
return QString(QObject::tr("%1 days ago")).arg(seconds/86400) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IdDialog::insertIdDetails(uint32_t token)
|
void IdDialog::insertIdDetails(uint32_t token)
|
||||||
{
|
{
|
||||||
mStateHelper->setLoading(IDDIALOG_IDDETAILS, false);
|
mStateHelper->setLoading(IDDIALOG_IDDETAILS, false);
|
||||||
@ -843,9 +870,9 @@ void IdDialog::insertIdDetails(uint32_t token)
|
|||||||
#ifdef ID_DEBUG
|
#ifdef ID_DEBUG
|
||||||
std::cerr << "Setting header frame image : " << pix.width() << " x " << pix.height() << std::endl;
|
std::cerr << "Setting header frame image : " << pix.width() << " x " << pix.height() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
#ifdef UNFINISHED_CODE
|
|
||||||
ui->avlabel->setPixmap(pixmap);
|
ui->avlabel->setPixmap(pixmap);
|
||||||
#endif
|
|
||||||
ui->avatarLabel->setPixmap(pixmap);
|
ui->avatarLabel->setPixmap(pixmap);
|
||||||
|
|
||||||
if (data.mPgpKnown)
|
if (data.mPgpKnown)
|
||||||
|
@ -78,6 +78,7 @@ private slots:
|
|||||||
|
|
||||||
/** Create the context popup menu and it's submenus */
|
/** Create the context popup menu and it's submenus */
|
||||||
void IdListCustomPopupMenu( QPoint point );
|
void IdListCustomPopupMenu( QPoint point );
|
||||||
|
void CircleListCustomPopupMenu( QPoint point);
|
||||||
|
|
||||||
void circle_selected();
|
void circle_selected();
|
||||||
private:
|
private:
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user