mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-24 14:23:36 -05:00
This commit gives the edit account feature in the wire.
This commit is contained in:
parent
3185829219
commit
ae855098cf
21
retroshare-gui/src/gui/TheWire/CustomFrame.cpp
Normal file
21
retroshare-gui/src/gui/TheWire/CustomFrame.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include "CustomFrame.h"
|
||||
#include <QPainter>
|
||||
|
||||
// Constructor
|
||||
CustomFrame::CustomFrame(QWidget *parent) : QFrame(parent)
|
||||
{
|
||||
// Any initializations for this frame.
|
||||
}
|
||||
|
||||
// Overriding the inbuilt paint function
|
||||
void CustomFrame::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QFrame::paintEvent(event);
|
||||
QPainter painter(this);
|
||||
painter.drawPixmap(rect(), backgroundImage);
|
||||
}
|
||||
|
||||
// Function to set the member variable 'backgroundImage'
|
||||
void CustomFrame::setPixmap(QPixmap pixmap){
|
||||
backgroundImage = pixmap;
|
||||
}
|
24
retroshare-gui/src/gui/TheWire/CustomFrame.h
Normal file
24
retroshare-gui/src/gui/TheWire/CustomFrame.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef CUSTOMFRAMEH_H
|
||||
#define CUSTOMFRAMEH_H
|
||||
|
||||
#include <QFrame>
|
||||
#include <QPixmap>
|
||||
|
||||
// This class is made to implement the background image in a Qframe or any widget
|
||||
|
||||
class CustomFrame : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CustomFrame(QWidget *parent = nullptr);
|
||||
void setPixmap(QPixmap pixmap);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
QPixmap backgroundImage;
|
||||
};
|
||||
|
||||
#endif //CUSTOMFRAMEH_H
|
@ -767,7 +767,6 @@
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
|
@ -24,11 +24,14 @@
|
||||
#include <QBuffer>
|
||||
|
||||
#include "PulseViewGroup.h"
|
||||
#include "CustomFrame.h"
|
||||
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
Q_DECLARE_METATYPE(RsWireGroup)
|
||||
|
||||
/** Constructor */
|
||||
|
||||
PulseViewGroup::PulseViewGroup(PulseViewHolder *holder, RsWireGroupSPtr group)
|
||||
@ -50,8 +53,32 @@ void PulseViewGroup::setup()
|
||||
label_tagline->setText(QString::fromStdString(mGroup->mTagline));
|
||||
label_location->setText(QString::fromStdString(mGroup->mLocation));
|
||||
|
||||
// need to draw mGroup->mMasthead, as background to headshot.
|
||||
// TODO frame_headerBackground->setBackground()
|
||||
|
||||
if (mGroup->mMasthead.mData)
|
||||
{
|
||||
QPixmap pixmap;
|
||||
if (GxsIdDetails::loadPixmapFromData(
|
||||
mGroup->mMasthead.mData,
|
||||
mGroup->mMasthead.mSize,
|
||||
pixmap, GxsIdDetails::ORIGINAL))
|
||||
{
|
||||
QSize frameSize = frame_masthead->size();
|
||||
|
||||
// Scale the pixmap based on the frame size
|
||||
pixmap = pixmap.scaled(frameSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
frame_masthead->setPixmap(pixmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default pixmap
|
||||
QPixmap pixmap = FilesDefs::getPixmapFromQtResourcePath(":/icons/png/posted.png");
|
||||
QSize frameSize = frame_masthead->size();
|
||||
|
||||
// Scale the pixmap based on the frame size
|
||||
pixmap = pixmap.scaled(frameSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
frame_masthead->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
if (mGroup->mHeadshot.mData)
|
||||
{
|
||||
@ -61,14 +88,14 @@ void PulseViewGroup::setup()
|
||||
mGroup->mHeadshot.mSize,
|
||||
pixmap,GxsIdDetails::ORIGINAL))
|
||||
{
|
||||
pixmap = pixmap.scaled(50,50);
|
||||
pixmap = pixmap.scaled(100,100);
|
||||
label_headshot->setPixmap(pixmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// default.
|
||||
QPixmap pixmap = FilesDefs::getPixmapFromQtResourcePath(":/icons/png/posted.png").scaled(50,50);
|
||||
QPixmap pixmap = FilesDefs::getPixmapFromQtResourcePath(":/icons/png/posted.png").scaled(100,100);
|
||||
label_headshot->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>745</width>
|
||||
<width>746</width>
|
||||
<height>483</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -48,19 +48,37 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="plainFrame_VL">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_headerBackground">
|
||||
<layout class="QHBoxLayout" name="frame_headerBackground_HL">
|
||||
<widget class="CustomFrame" name="frame_masthead">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>700</width>
|
||||
<height>135</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="frame_headerBackground_LHSpacer">
|
||||
<spacer name="widget_actions_RHSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>283</width>
|
||||
<height>20</height>
|
||||
<width>277</width>
|
||||
<height>17</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@ -79,19 +97,22 @@
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>headshot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="frame_headerBackground_RHSpacer">
|
||||
<spacer name="widget_actions_LHSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>23</width>
|
||||
<width>281</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -509,7 +530,6 @@
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
@ -538,10 +558,25 @@
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>widget_header</zorder>
|
||||
<zorder>widget_publish</zorder>
|
||||
<zorder>line_1</zorder>
|
||||
<zorder>widget_replies</zorder>
|
||||
<zorder>line_2</zorder>
|
||||
<zorder>widget_actions</zorder>
|
||||
<zorder>frame_masthead</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CustomFrame</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>D:\new\RetroShare\retroshare-gui\src\gui\TheWire\CustomFrame.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -434,8 +434,8 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="TheWire_images.qrc"/>
|
||||
<include location="../icons.qrc"/>
|
||||
<include location="TheWire_images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -152,7 +152,7 @@ bool WireGroupDialog::service_updateGroup(const RsGroupMetaData &editedMeta)
|
||||
std::cerr << "WireGroupDialog::service_updateGroup() submitting changes";
|
||||
std::cerr << std::endl;
|
||||
|
||||
bool success = rsWire->updateGroup(grp);
|
||||
bool success = rsWire->editWire(grp);
|
||||
// TODO updateGroup should refresh groupId or Data
|
||||
return success;
|
||||
}
|
||||
|
@ -65,8 +65,7 @@ WireGroupItem::WireGroupItem(WireGroupHolder *holder, const RsWireGroup &grp)
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
setup();
|
||||
|
||||
// disabled, still not yet functional Edit/Update
|
||||
editButton->setEnabled(false);
|
||||
editButton->setEnabled(true);
|
||||
}
|
||||
|
||||
RsGxsGroupId &WireGroupItem::groupId()
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>276</width>
|
||||
<height>114</height>
|
||||
<width>292</width>
|
||||
<height>115</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
Loading…
Reference in New Issue
Block a user