mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-23 22:01:05 -05:00
use Extra Widget for Group creation
This commit is contained in:
parent
f4457b1331
commit
bcd8f4b0de
@ -19,6 +19,8 @@
|
||||
*******************************************************************************/
|
||||
#include <QBuffer>
|
||||
|
||||
#include "WireGroupExtra.h"
|
||||
|
||||
#include "WireGroupDialog.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
|
||||
@ -27,7 +29,7 @@
|
||||
const uint32_t WireCreateEnabledFlags = (
|
||||
GXS_GROUP_FLAGS_NAME |
|
||||
GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
// GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
// GXS_GROUP_FLAGS_PUBLISHSIGN |
|
||||
// GXS_GROUP_FLAGS_SHAREKEYS | // disabled because the UI doesn't handle it yet.
|
||||
@ -85,6 +87,9 @@ void WireGroupDialog::initUi()
|
||||
|
||||
setUiText(UITYPE_ADD_ADMINS_CHECKBOX, tr("Add Wire Admins"));
|
||||
setUiText(UITYPE_CONTACTS_DOCK, tr("Select Wire Admins"));
|
||||
|
||||
mExtra = new WireGroupExtra(this);
|
||||
injectExtraWidget(mExtra);
|
||||
}
|
||||
|
||||
QPixmap WireGroupDialog::serviceImage()
|
||||
@ -95,11 +100,6 @@ QPixmap WireGroupDialog::serviceImage()
|
||||
void WireGroupDialog::prepareWireGroup(RsWireGroup &group, const RsGroupMetaData &meta)
|
||||
{
|
||||
group.mMeta = meta;
|
||||
|
||||
// To Add.
|
||||
group.mTagline = "a Tagline";
|
||||
group.mLocation = "here";
|
||||
|
||||
QPixmap pixmap = getLogo();
|
||||
|
||||
if (!pixmap.isNull()) {
|
||||
@ -110,12 +110,26 @@ void WireGroupDialog::prepareWireGroup(RsWireGroup &group, const RsGroupMetaData
|
||||
pixmap.save(&buffer, "PNG"); // writes image into ba in PNG format
|
||||
|
||||
group.mHeadshot.copy((uint8_t *) ba.data(), ba.size());
|
||||
group.mMasthead.copy((uint8_t *) ba.data(), ba.size());
|
||||
} else {
|
||||
group.mHeadshot.clear();
|
||||
group.mMasthead.clear();
|
||||
}
|
||||
|
||||
// from Extra Widget.
|
||||
group.mTagline = mExtra->getTagline();
|
||||
group.mLocation = mExtra->getLocation();
|
||||
pixmap = mExtra->getMasthead();
|
||||
|
||||
if (!pixmap.isNull()) {
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
pixmap.save(&buffer, "JPG");
|
||||
|
||||
group.mMasthead.copy((uint8_t *) ba.data(), ba.size());
|
||||
} else {
|
||||
group.mMasthead.clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool WireGroupDialog::service_createGroup(RsGroupMetaData &meta)
|
||||
|
@ -22,8 +22,11 @@
|
||||
#define _WIRE_GROUP_DIALOG_H
|
||||
|
||||
#include "gui/gxs/GxsGroupDialog.h"
|
||||
|
||||
#include <retroshare/rswire.h>
|
||||
|
||||
class WireGroupExtra;
|
||||
|
||||
class WireGroupDialog : public GxsGroupDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -42,6 +45,8 @@ protected:
|
||||
|
||||
private:
|
||||
void prepareWireGroup(RsWireGroup &group, const RsGroupMetaData &meta);
|
||||
|
||||
WireGroupExtra *mExtra;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
83
retroshare-gui/src/gui/TheWire/WireGroupExtra.cpp
Normal file
83
retroshare-gui/src/gui/TheWire/WireGroupExtra.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
/*******************************************************************************
|
||||
* retroshare-gui/src/gui/TheWire/WireGroupExtra.cpp *
|
||||
* *
|
||||
* Copyright (C) 2020 by Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include "WireGroupExtra.h"
|
||||
#include "util/misc.h"
|
||||
|
||||
WireGroupExtra::WireGroupExtra(QWidget *parent) :
|
||||
QWidget(NULL)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
setUp();
|
||||
}
|
||||
|
||||
WireGroupExtra::~WireGroupExtra()
|
||||
{
|
||||
}
|
||||
|
||||
void WireGroupExtra::setUp()
|
||||
{
|
||||
connect(ui.pushButton_masthead, SIGNAL(clicked() ), this , SLOT(addMasthead()));
|
||||
}
|
||||
|
||||
|
||||
void WireGroupExtra::addMasthead()
|
||||
{
|
||||
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load Masthead"), 400, 100);
|
||||
|
||||
if (img.isNull())
|
||||
return;
|
||||
|
||||
setMasthead(img);
|
||||
}
|
||||
|
||||
|
||||
void WireGroupExtra::setTagline(const std::string &str)
|
||||
{
|
||||
ui.lineEdit_Tagline->setText(QString::fromStdString(str));
|
||||
}
|
||||
|
||||
void WireGroupExtra::setLocation(const std::string &str)
|
||||
{
|
||||
ui.lineEdit_Location->setText(QString::fromStdString(str));
|
||||
}
|
||||
|
||||
void WireGroupExtra::setMasthead(const QPixmap &pixmap)
|
||||
{
|
||||
mMasthead = pixmap;
|
||||
ui.label_masthead->setPixmap(mMasthead);
|
||||
}
|
||||
|
||||
std::string WireGroupExtra::getTagline()
|
||||
{
|
||||
return ui.lineEdit_Tagline->text().toStdString();
|
||||
}
|
||||
|
||||
std::string WireGroupExtra::getLocation()
|
||||
{
|
||||
return ui.lineEdit_Location->text().toStdString();
|
||||
}
|
||||
|
||||
QPixmap WireGroupExtra::getMasthead()
|
||||
{
|
||||
return mMasthead;
|
||||
}
|
||||
|
||||
|
54
retroshare-gui/src/gui/TheWire/WireGroupExtra.h
Normal file
54
retroshare-gui/src/gui/TheWire/WireGroupExtra.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*******************************************************************************
|
||||
* retroshare-gui/src/gui/TheWire/WireGroupExtra.h *
|
||||
* *
|
||||
* Copyright (C) 2020 by Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef WIRE_GROUP_EXTRA_H
|
||||
#define WIRE_GROUP_EXTRA_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_WireGroupExtra.h"
|
||||
|
||||
class WireGroupExtra : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WireGroupExtra(QWidget *parent = 0);
|
||||
virtual ~WireGroupExtra();
|
||||
|
||||
void setMasthead(const QPixmap &pixmap);
|
||||
QPixmap getMasthead();
|
||||
|
||||
void setTagline(const std::string &str);
|
||||
void setLocation(const std::string &str);
|
||||
|
||||
std::string getTagline();
|
||||
std::string getLocation();
|
||||
|
||||
private slots:
|
||||
void addMasthead();
|
||||
|
||||
private:
|
||||
void setUp();
|
||||
private:
|
||||
QPixmap mMasthead;
|
||||
Ui::WireGroupExtra ui;
|
||||
};
|
||||
|
||||
#endif // WIRE_GROUP_EXTRA_H
|
68
retroshare-gui/src/gui/TheWire/WireGroupExtra.ui
Normal file
68
retroshare-gui/src/gui/TheWire/WireGroupExtra.ui
Normal file
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WireGroupExtra</class>
|
||||
<widget class="QWidget" name="WireGroupExtra">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>516</width>
|
||||
<height>199</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Masthead</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="2">
|
||||
<widget class="QLabel" name="label_masthead">
|
||||
<property name="text">
|
||||
<string>MastHead background Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButton_masthead">
|
||||
<property name="text">
|
||||
<string>Select Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="captionLabel">
|
||||
<property name="text">
|
||||
<string>Tagline:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Tagline"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Location:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Location"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1226,6 +1226,7 @@ gxsthewire {
|
||||
gui/TheWire/WireDialog.h \
|
||||
gui/TheWire/WireGroupItem.h \
|
||||
gui/TheWire/WireGroupDialog.h \
|
||||
gui/TheWire/WireGroupExtra.h \
|
||||
gui/TheWire/PulseAddDialog.h \
|
||||
gui/TheWire/PulseViewItem.h \
|
||||
gui/TheWire/PulseTopLevel.h \
|
||||
@ -1237,6 +1238,7 @@ gxsthewire {
|
||||
FORMS += gui/TheWire/PulseItem.ui \
|
||||
gui/TheWire/PulseDetails.ui \
|
||||
gui/TheWire/WireGroupItem.ui \
|
||||
gui/TheWire/WireGroupExtra.ui \
|
||||
gui/TheWire/WireDialog.ui \
|
||||
gui/TheWire/PulseAddDialog.ui \
|
||||
gui/TheWire/PulseTopLevel.ui \
|
||||
@ -1250,6 +1252,7 @@ gxsthewire {
|
||||
gui/TheWire/WireDialog.cpp \
|
||||
gui/TheWire/WireGroupItem.cpp \
|
||||
gui/TheWire/WireGroupDialog.cpp \
|
||||
gui/TheWire/WireGroupExtra.cpp \
|
||||
gui/TheWire/PulseAddDialog.cpp \
|
||||
gui/TheWire/PulseViewItem.cpp \
|
||||
gui/TheWire/PulseTopLevel.cpp \
|
||||
|
Loading…
Reference in New Issue
Block a user