summaryrefslogtreecommitdiff
path: root/net-p2p
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2017-11-25 07:32:43 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2017-11-25 07:32:43 +0300
commit134a54bcfabbfb5ca5538b97d0b3c2d58d2d2a52 (patch)
tree949b94e6a9d652e0aa6a1349f0f91318f005d705 /net-p2p
parent57be175e5a964704ca3de5acb89e4314e300ae01 (diff)
retroshare: bgcolors patch (buggy)
Diffstat (limited to 'net-p2p')
-rw-r--r--net-p2p/retroshare/files/keyring_bgcolors_v4.patch221
-rw-r--r--net-p2p/retroshare/retroshare-scm.ebuild1
2 files changed, 222 insertions, 0 deletions
diff --git a/net-p2p/retroshare/files/keyring_bgcolors_v4.patch b/net-p2p/retroshare/files/keyring_bgcolors_v4.patch
new file mode 100644
index 0000000..350a342
--- /dev/null
+++ b/net-p2p/retroshare/files/keyring_bgcolors_v4.patch
@@ -0,0 +1,221 @@
+diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp
+index bc5ea3e06..0e4632201 100644
+--- a/retroshare-gui/src/gui/NetworkDialog.cpp
++++ b/retroshare-gui/src/gui/NetworkDialog.cpp
+@@ -58,18 +58,22 @@
+ #define IMAGE_MESSAGE ":/images/mail_new.png"
+
+ /* Images for Status icons */
+-#define IMAGE_AUTHED ":/images/accepted16.png"
++
++//following defined in model
++/*#define IMAGE_AUTHED ":/images/accepted16.png"
+ #define IMAGE_DENIED ":/images/denied16.png"
+-#define IMAGE_TRUSTED ":/images/rs-2.png"
++#define IMAGE_TRUSTED ":/images/rs-2.png" */
+
+ // Defines for key list columns
+-#define COLUMN_CHECK 0
++
++//following defined in model
++/*#define COLUMN_CHECK 0
+ #define COLUMN_PEERNAME 1
+ #define COLUMN_I_AUTH_PEER 2
+ #define COLUMN_PEER_AUTH_ME 3
+ #define COLUMN_PEERID 4
+ #define COLUMN_LAST_USED 5
+-#define COLUMN_COUNT 6
++#define COLUMN_COUNT 6 */
+
+ //RsPeerId getNeighRsCertId(QTreeWidgetItem *i);
+
+@@ -83,6 +87,7 @@ static const unsigned int ROLE_SORT = Qt::UserRole + 1 ;
+ NetworkDialog::NetworkDialog(QWidget *parent)
+ {
+ /* Invoke the Qt Designer generated object setup routine */
++ Q_UNUSED(parent);
+ ui.setupUi(this);
+
+ connect( ui.filterLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterItems(QString)));
+@@ -91,7 +96,10 @@ NetworkDialog::NetworkDialog(QWidget *parent)
+
+ //list data model
+ float f = QFontMetricsF(font()).height()/14.0 ;
+- PGPIdItemModel = new pgpid_item_model(neighs, f, this);
++
++ bg_colors colors = bg_colors(mBackgroundColorSelf, mBackgroundColorOwnSign, mBackgroundColorAcceptConnection, mBackgroundColorHasSignedMe, mBackgroundColorHasSignedMe);
++
++ PGPIdItemModel = new pgpid_item_model(neighs, f, colors, this);
+ PGPIdItemProxy = new pgpid_item_proxy(this);
+ connect(ui.onlyTrustedKeys, SIGNAL(toggled(bool)), PGPIdItemProxy, SLOT(use_only_trusted_keys(bool)));
+ PGPIdItemProxy->setSourceModel(PGPIdItemModel);
+@@ -105,11 +113,10 @@ NetworkDialog::NetworkDialog(QWidget *parent)
+ ui.connectTreeWidget->setUpdatesEnabled(true);
+ ui.connectTreeWidget->setSortingEnabled(true);
+ ui.connectTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
++ ui.connectTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
+ connect(ui.connectTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connectTreeWidgetCostumPopupMenu( QPoint ) ) );
+ connect(ui.connectTreeWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(peerdetails()));
+
+-
+-
+ /* Set header resize modes and initial section sizes */
+ /* QHeaderView * _header = ui.connectTreeWidget->header () ;
+ QHeaderView_setSectionResizeModeColumn(_header, COLUMN_CHECK, QHeaderView::Custom);
+@@ -122,7 +129,7 @@ NetworkDialog::NetworkDialog(QWidget *parent)
+
+ ui.onlyTrustedKeys->setMinimumWidth(20*f);
+
+-
++backgroundColorDenied();
+
+ /* QMenu *menu = new QMenu();
+ menu->addAction(ui.actionTabsright);
+@@ -159,7 +166,9 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ )
+
+ QModelIndexList l = ui.connectTreeWidget->selectionModel()->selection().indexes();
+ if(l.empty())
++ {
+ return;
++ }
+
+ QMenu *contextMnu = new QMenu;
+
+diff --git a/retroshare-gui/src/gui/NetworkDialog.h b/retroshare-gui/src/gui/NetworkDialog.h
+index 5c73c0a51..0dcdb18b8 100644
+--- a/retroshare-gui/src/gui/NetworkDialog.h
++++ b/retroshare-gui/src/gui/NetworkDialog.h
+@@ -33,6 +33,7 @@ class QTreeWidgetItem;
+
+ class RSTreeWidgetItemCompareRole ;
+
++
+ class NetworkDialog : public RsAutoUpdatePage
+ {
+ Q_OBJECT
+diff --git a/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp
+index 40c29fa4c..1e87bf454 100644
+--- a/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp
++++ b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp
+@@ -2,16 +2,14 @@
+ #include <time.h>
+ #include <retroshare/rspeers.h>
+ #include <QIcon>
++#include <QBrush>
+
+-#define IMAGE_AUTHED ":/images/accepted16.png"
+-#define IMAGE_DENIED ":/images/denied16.png"
+-#define IMAGE_TRUSTED ":/images/rs-2.png"
+
+ /*TODO:
+ * using list here for internal data storage is not best option
+ */
+-pgpid_item_model::pgpid_item_model(std::list<RsPgpId> &neighs_, float &_font_height, QObject *parent)
+- : QAbstractTableModel(parent), neighs(neighs_), font_height(_font_height)
++pgpid_item_model::pgpid_item_model(std::list<RsPgpId> &neighs_, float &_font_height, bg_colors &__bg_colors, QObject *parent)
++ : QAbstractTableModel(parent), neighs(neighs_), font_height(_font_height), _bg_colors(__bg_colors)
+ {
+ }
+
+@@ -151,6 +149,7 @@ QVariant pgpid_item_model::data(const QModelIndex &index, int role) const
+ }
+
+ }
++ //we using editrole only where it is useful, for other data we use display, so no "else if" here
+ if(role == Qt::DisplayRole || role == Qt::EditRole)
+ {
+ switch(index.column())
+@@ -261,23 +260,29 @@ QVariant pgpid_item_model::data(const QModelIndex &index, int role) const
+ }
+ else if(role == Qt::BackgroundRole)
+ {
+- switch(index.column())
+- {
+- default:
++ if (detail.accept_connection)
+ {
+- //TODO: add access to bckground colors from networkdialog
+- if (detail.accept_connection)
++ if (detail.ownsign)
+ {
+- if (detail.ownsign)
+- ;
++ return QBrush(_bg_colors.mBackgroundColorOwnSign);
++ }
++ else
++ {
++ return QBrush(_bg_colors.mBackgroundColorAcceptConnection);
+ }
+ }
+- break;
+-
++ else
++ {
++ if (detail.hasSignedMe)
++ {
++ return QBrush(_bg_colors.mBackgroundColorHasSignedMe);
++ }
++ else
++ {
++ return QBrush(_bg_colors.mBackgroundColorDenied);
++ }
+ }
+ }
+-
+-
+ return QVariant();
+ }
+
+diff --git a/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.h b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.h
+index 8dc31d276..75b681ac1 100644
+--- a/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.h
++++ b/retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.h
+@@ -3,6 +3,12 @@
+
+ #include <QAbstractItemModel>
+ #include <retroshare/rspeers.h>
++#include <QColor>
++
++#define IMAGE_AUTHED ":/images/accepted16.png"
++#define IMAGE_DENIED ":/images/denied16.png"
++#define IMAGE_TRUSTED ":/images/rs-2.png"
++
+
+ #define COLUMN_CHECK 0
+ #define COLUMN_PEERNAME 1
+@@ -12,13 +18,26 @@
+ #define COLUMN_LAST_USED 5
+ #define COLUMN_COUNT 6
+
++struct bg_colors {
++ bg_colors (QColor _mBackgroundColorSelf, QColor _mBackgroundColorOwnSign, QColor _mBackgroundColorAcceptConnection,
++ QColor _mBackgroundColorHasSignedMe, QColor _mBackgroundColorDenied) :
++ mBackgroundColorSelf(_mBackgroundColorSelf), mBackgroundColorOwnSign(_mBackgroundColorOwnSign), mBackgroundColorAcceptConnection(_mBackgroundColorAcceptConnection),
++ mBackgroundColorHasSignedMe(_mBackgroundColorHasSignedMe), mBackgroundColorDenied(_mBackgroundColorDenied)
++ {}
++ QColor &mBackgroundColorSelf;
++ QColor &mBackgroundColorOwnSign;
++ QColor &mBackgroundColorAcceptConnection;
++ QColor &mBackgroundColorHasSignedMe;
++ QColor &mBackgroundColorDenied;
++};
++
+
+ class pgpid_item_model : public QAbstractTableModel
+ {
+ Q_OBJECT
+
+ public:
+- explicit pgpid_item_model(std::list<RsPgpId> &neighs, float &font_height, QObject *parent = nullptr);
++ explicit pgpid_item_model(std::list<RsPgpId> &neighs, float &font_height, bg_colors &__bg_colors, QObject *parent = nullptr);
+
+ // Header:
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+@@ -35,6 +54,7 @@ public slots:
+ private:
+ std::list<RsPgpId> &neighs;
+ float &font_height;
++ bg_colors _bg_colors;
+ };
+
+ #endif // KEY_ITEM_MODEL_H
diff --git a/net-p2p/retroshare/retroshare-scm.ebuild b/net-p2p/retroshare/retroshare-scm.ebuild
index ac96b7b..80bfeb4 100644
--- a/net-p2p/retroshare/retroshare-scm.ebuild
+++ b/net-p2p/retroshare/retroshare-scm.ebuild
@@ -83,6 +83,7 @@ PATCHES=(
"${FILESDIR}/hidden_service.patch"
"${FILESDIR}/cflags.patch"
"${FILESDIR}/disable_key_array_redraw.patch"
+ "${FILESDIR}/keyring_bgcolors_v4.patch"
)