mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-30 09:56:14 -05:00
Added a new CreateChannelMsg Dialog as replacement for GeneralMessage for Channels.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2070 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
15fc60903d
commit
a44d28d7de
@ -188,6 +188,7 @@ HEADERS += rshare.h \
|
||||
gui/profile/ProfileWidget.h \
|
||||
gui/profile/StatusMessage.h \
|
||||
gui/chat/PopupChatDialog.h \
|
||||
gui/channels/CreateChannelMsg.h \
|
||||
gui/connect/ConnectDialog.h \
|
||||
gui/connect/ConfCertDialog.h \
|
||||
gui/msgs/ChanMsgDialog.h \
|
||||
@ -270,6 +271,7 @@ FORMS += gui/StartDialog.ui \
|
||||
gui/profile/ProfileEdit.ui \
|
||||
gui/profile/ProfileWidget.ui \
|
||||
gui/profile/StatusMessage.ui \
|
||||
gui/channels/CreateChannelMsg.ui \
|
||||
gui/chat/PopupChatDialog.ui \
|
||||
gui/connect/ConnectDialog.ui \
|
||||
gui/connect/ConfCertDialog.ui \
|
||||
@ -363,6 +365,7 @@ SOURCES += main.cpp \
|
||||
gui/profile/ProfileEdit.cpp \
|
||||
gui/profile/ProfileWidget.cpp \
|
||||
gui/profile/StatusMessage.cpp \
|
||||
gui/channels/CreateChannelMsg.cpp \
|
||||
gui/chat/PopupChatDialog.cpp \
|
||||
gui/connect/ConnectDialog.cpp \
|
||||
gui/connect/ConfCertDialog.cpp \
|
||||
|
@ -33,8 +33,8 @@
|
||||
#include "gui/forums/CreateForum.h"
|
||||
|
||||
#include "gui/ChanGroupDelegate.h"
|
||||
|
||||
#include "GeneralMsgDialog.h"
|
||||
#include "gui/channels/CreateChannelMsg.h"
|
||||
|
||||
/****
|
||||
* #define CHAN_DEBUG
|
||||
@ -48,7 +48,7 @@ ChannelFeed::ChannelFeed(QWidget *parent)
|
||||
setupUi(this);
|
||||
|
||||
connect(actionCreate_Channel, SIGNAL(triggered()), this, SLOT(createChannel()));
|
||||
connect(postButton, SIGNAL(clicked()), this, SLOT(sendMsg()));
|
||||
connect(postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
|
||||
connect(subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeChannel ( void ) ) );
|
||||
connect(unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
|
||||
|
||||
@ -205,26 +205,6 @@ void ChannelFeed::channelSelection()
|
||||
updateChannelMsgs();
|
||||
}
|
||||
|
||||
void ChannelFeed::sendMsg()
|
||||
{
|
||||
#ifdef CHAN_DEBUG
|
||||
std::cerr << "ChannelFeed::sendMsg()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if (mChannelId != "")
|
||||
{
|
||||
openMsg(FEEDHOLDER_MSG_CHANNEL, mChannelId, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef CHAN_DEBUG
|
||||
std::cerr << "ChannelFeed::sendMsg() no Channel Selected!";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************************/
|
||||
@ -241,7 +221,6 @@ void ChannelFeed::openChat(std::string peerId)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void ChannelFeed::openMsg(uint32_t type, std::string grpId, std::string inReplyTo)
|
||||
{
|
||||
#ifdef CHAN_DEBUG
|
||||
@ -257,6 +236,20 @@ void ChannelFeed::openMsg(uint32_t type, std::string grpId, std::string inReplyT
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void ChannelFeed::createMsg()
|
||||
{
|
||||
if (mChannelId == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CreateChannelMsg *msgDialog = new CreateChannelMsg(mChannelId);
|
||||
|
||||
msgDialog->show();
|
||||
return;
|
||||
}
|
||||
|
||||
void ChannelFeed::selectChannel( std::string cId)
|
||||
{
|
||||
mChannelId = cId;
|
||||
|
@ -64,13 +64,16 @@ private slots:
|
||||
void checkUpdate();
|
||||
|
||||
void createChannel();
|
||||
void sendMsg();
|
||||
//void sendMsg();
|
||||
|
||||
void channelSelection();
|
||||
|
||||
void subscribeChannel();
|
||||
void unsubscribeChannel();
|
||||
|
||||
void createMsg();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
void updateChannelList();
|
||||
|
@ -310,15 +310,15 @@ p, li { white-space: pre-wrap; }
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="postButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>26</width>
|
||||
<height>26</height>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
|
465
retroshare-gui/src/gui/channels/CreateChannelMsg.cpp
Normal file
465
retroshare-gui/src/gui/channels/CreateChannelMsg.cpp
Normal file
@ -0,0 +1,465 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2008 Robert Fernie
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
#include <QtGui>
|
||||
|
||||
#include "CreateChannelMsg.h"
|
||||
|
||||
#include "gui/feeds/SubFileItem.h"
|
||||
|
||||
#include "rsiface/rstypes.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsforums.h"
|
||||
#include "rsiface/rschannels.h"
|
||||
#include "rsiface/rsmsgs.h"
|
||||
#include "rsiface/rsfiles.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
/** Constructor */
|
||||
CreateChannelMsg::CreateChannelMsg(std::string cId)
|
||||
: QDialog (NULL), mChannelId(cId) ,mCheckAttachment(true)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(sendMsg()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(cancelMsg()));
|
||||
|
||||
connect(addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
|
||||
connect(addfilepushButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
|
||||
|
||||
setAcceptDrops(true);
|
||||
|
||||
newChannelMsg();
|
||||
}
|
||||
|
||||
/* Dropping */
|
||||
|
||||
void CreateChannelMsg::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
/* print out mimeType */
|
||||
std::cerr << "CreateChannelMsg::dragEnterEvent() Formats";
|
||||
std::cerr << std::endl;
|
||||
QStringList formats = event->mimeData()->formats();
|
||||
QStringList::iterator it;
|
||||
for(it = formats.begin(); it != formats.end(); it++)
|
||||
{
|
||||
std::cerr << "Format: " << (*it).toStdString();
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
if (event->mimeData()->hasFormat("text/plain"))
|
||||
{
|
||||
std::cerr << "CreateChannelMsg::dragEnterEvent() Accepting PlainText";
|
||||
std::cerr << std::endl;
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
else if (event->mimeData()->hasUrls())
|
||||
{
|
||||
std::cerr << "CreateChannelMsg::dragEnterEvent() Accepting Urls";
|
||||
std::cerr << std::endl;
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
else if (event->mimeData()->hasFormat("application/x-rsfilelist"))
|
||||
{
|
||||
std::cerr << "CreateChannelMsg::dragEnterEvent() accepting Application/x-qabs...";
|
||||
std::cerr << std::endl;
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "CreateChannelMsg::dragEnterEvent() No PlainText/Urls";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void CreateChannelMsg::dropEvent(QDropEvent *event)
|
||||
{
|
||||
if (!(Qt::CopyAction & event->possibleActions()))
|
||||
{
|
||||
std::cerr << "CreateChannelMsg::dropEvent() Rejecting uncopyable DropAction";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* can't do it */
|
||||
return;
|
||||
}
|
||||
|
||||
std::cerr << "CreateChannelMsg::dropEvent() Formats";
|
||||
std::cerr << std::endl;
|
||||
QStringList formats = event->mimeData()->formats();
|
||||
QStringList::iterator it;
|
||||
for(it = formats.begin(); it != formats.end(); it++)
|
||||
{
|
||||
std::cerr << "Format: " << (*it).toStdString();
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
if (event->mimeData()->hasText())
|
||||
{
|
||||
std::cerr << "CreateChannelMsg::dropEvent() Plain Text:";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << event->mimeData()->text().toStdString();
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
if (event->mimeData()->hasUrls())
|
||||
{
|
||||
std::cerr << "CreateChannelMsg::dropEvent() Urls:";
|
||||
std::cerr << std::endl;
|
||||
|
||||
QList<QUrl> urls = event->mimeData()->urls();
|
||||
QList<QUrl>::iterator uit;
|
||||
for(uit = urls.begin(); uit != urls.end(); uit++)
|
||||
{
|
||||
std::string localpath = uit->toLocalFile().toStdString();
|
||||
std::cerr << "Whole URL: " << uit->toString().toStdString();
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "or As Local File: " << localpath;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (localpath.size() > 0)
|
||||
{
|
||||
|
||||
addAttachment(localpath);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (event->mimeData()->hasFormat("application/x-rsfilelist"))
|
||||
{
|
||||
std::cerr << "CreateChannelMsg::dropEvent() Application/x-rsfilelist";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
QByteArray data = event->mimeData()->data("application/x-rsfilelist");
|
||||
std::cerr << "Data Len:" << data.length();
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Data is:" << data.data();
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::string newattachments(data.data());
|
||||
parseRsFileListAttachments(newattachments);
|
||||
}
|
||||
|
||||
|
||||
event->setDropAction(Qt::CopyAction);
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void CreateChannelMsg::parseRsFileListAttachments(std::string attachList)
|
||||
{
|
||||
/* split into lines */
|
||||
QString input = QString::fromStdString(attachList);
|
||||
|
||||
QStringList attachItems = input.split("\n");
|
||||
QStringList::iterator it;
|
||||
QStringList::iterator it2;
|
||||
|
||||
for(it = attachItems.begin(); it != attachItems.end(); it++)
|
||||
{
|
||||
std::cerr << "CreateChannelMsg::parseRsFileListAttachments() Entry: ";
|
||||
|
||||
QStringList parts = (*it).split("/");
|
||||
|
||||
bool ok = false;
|
||||
quint64 qsize = 0;
|
||||
|
||||
std::string fname;
|
||||
std::string hash;
|
||||
uint64_t size = 0;
|
||||
std::string source;
|
||||
|
||||
int i = 0;
|
||||
for(it2 = parts.begin(); it2 != parts.end(); it2++, i++)
|
||||
{
|
||||
std::cerr << "\"" << it2->toStdString() << "\" ";
|
||||
switch(i)
|
||||
{
|
||||
case 0:
|
||||
fname = it2->toStdString();
|
||||
break;
|
||||
case 1:
|
||||
hash = it2->toStdString();
|
||||
break;
|
||||
case 2:
|
||||
qsize = it2->toULongLong(&ok, 10);
|
||||
size = qsize;
|
||||
break;
|
||||
case 3:
|
||||
source = it2->toStdString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::cerr << "\tfname: " << fname << std::endl;
|
||||
std::cerr << "\thash: " << hash << std::endl;
|
||||
std::cerr << "\tsize: " << size << std::endl;
|
||||
std::cerr << "\tsource: " << source << std::endl;
|
||||
|
||||
/* basic error checking */
|
||||
if ((ok) && (hash.size() == 40))
|
||||
{
|
||||
std::cerr << "Item Ok" << std::endl;
|
||||
if (source == "Local")
|
||||
{
|
||||
addAttachment(hash, fname, size, true, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
// TEMP NOT ALLOWED UNTIL FT WORKING.
|
||||
addAttachment(hash, fname, size, false, source);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error Decode: Hash size: " << hash.size() << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CreateChannelMsg::addAttachment(std::string hash, std::string fname, uint64_t size, bool local, std::string srcId)
|
||||
{
|
||||
/* add a SubFileItem to the attachment section */
|
||||
std::cerr << "CreateChannelMsg::addAttachment()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* add widget in for new destination */
|
||||
|
||||
uint32_t flags = SFI_TYPE_ATTACH;
|
||||
if (local)
|
||||
{
|
||||
flags |= SFI_STATE_LOCAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= SFI_STATE_REMOTE;
|
||||
// TMP REMOVED REMOTE ADD FOR DEMONSTRATOR
|
||||
return;
|
||||
}
|
||||
|
||||
SubFileItem *file = new SubFileItem(hash, fname, size, flags, srcId);
|
||||
|
||||
mAttachments.push_back(file);
|
||||
QLayout *layout = fileFrame->layout();
|
||||
layout->addWidget(file);
|
||||
|
||||
if (mCheckAttachment)
|
||||
{
|
||||
checkAttachmentReady();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void CreateChannelMsg::addExtraFile()
|
||||
{
|
||||
/* add a SubFileItem to the attachment section */
|
||||
std::cerr << "CreateChannelMsg::addExtraFile() opening file dialog";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// select a file
|
||||
QString qfile = QFileDialog::getOpenFileName(this, tr("Add Extra File"), "", "", 0,
|
||||
QFileDialog::DontResolveSymlinks);
|
||||
std::string filePath = qfile.toStdString();
|
||||
if (filePath != "")
|
||||
{
|
||||
addAttachment(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CreateChannelMsg::addAttachment(std::string path)
|
||||
{
|
||||
/* add a SubFileItem to the attachment section */
|
||||
std::cerr << "CreateChannelMsg::addAttachment()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* add to ExtraList here,
|
||||
* use default TIMEOUT of 30 days (time to fetch it).
|
||||
*/
|
||||
//uint32_t period = 30 * 24 * 60 * 60;
|
||||
//uint32_t flags = 0;
|
||||
//rsFiles->ExtraFileHash(localpath, period, flags);
|
||||
|
||||
/* add widget in for new destination */
|
||||
SubFileItem *file = new SubFileItem(path);
|
||||
|
||||
mAttachments.push_back(file);
|
||||
QLayout *layout = fileFrame->layout();
|
||||
layout->addWidget(file);
|
||||
|
||||
if (mCheckAttachment)
|
||||
{
|
||||
checkAttachmentReady();
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void CreateChannelMsg::checkAttachmentReady()
|
||||
{
|
||||
std::list<SubFileItem *>::iterator fit;
|
||||
|
||||
mCheckAttachment = false;
|
||||
|
||||
for(fit = mAttachments.begin(); fit != mAttachments.end(); fit++)
|
||||
{
|
||||
if (!(*fit)->isHidden())
|
||||
{
|
||||
if (!(*fit)->ready())
|
||||
{
|
||||
/*
|
||||
*/
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
break;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fit == mAttachments.end())
|
||||
{
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
}
|
||||
|
||||
/* repeat... */
|
||||
int msec_rate = 1000;
|
||||
QTimer::singleShot( msec_rate, this, SLOT(checkAttachmentReady(void)));
|
||||
}
|
||||
|
||||
|
||||
void CreateChannelMsg::cancelMsg()
|
||||
{
|
||||
std::cerr << "CreateChannelMsg::cancelMsg()";
|
||||
std::cerr << std::endl;
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
void CreateChannelMsg::newChannelMsg()
|
||||
{
|
||||
|
||||
if (!rsChannels)
|
||||
return;
|
||||
|
||||
ChannelInfo ci;
|
||||
if (!rsChannels->getChannelInfo(mChannelId, ci))
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
channelName->setText(QString::fromStdWString(ci.channelName));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CreateChannelMsg::sendMsg()
|
||||
{
|
||||
std::cerr << "CreateChannelMsg::sendMsg()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* construct message bits */
|
||||
std::wstring subject = subjectEdit->text().toStdWString();
|
||||
std::wstring msg = msgEdit->toPlainText().toStdWString();
|
||||
|
||||
std::list<FileInfo> files;
|
||||
|
||||
std::list<SubFileItem *>::iterator fit;
|
||||
|
||||
for(fit = mAttachments.begin(); fit != mAttachments.end(); fit++)
|
||||
{
|
||||
if (!(*fit)->isHidden())
|
||||
{
|
||||
FileInfo fi;
|
||||
fi.hash = (*fit)->FileHash();
|
||||
fi.fname = (*fit)->FileName();
|
||||
fi.size = (*fit)->FileSize();
|
||||
|
||||
files.push_back(fi);
|
||||
|
||||
/* commence downloads - if we don't have the file */
|
||||
if (!(*fit)->done())
|
||||
{
|
||||
if ((*fit)->ready())
|
||||
{
|
||||
(*fit)->download();
|
||||
}
|
||||
// Skips unhashed files.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sendMessage(subject, msg, files);
|
||||
|
||||
}
|
||||
|
||||
void CreateChannelMsg::sendMessage(std::wstring subject, std::wstring msg, std::list<FileInfo> &files)
|
||||
{
|
||||
QString name = subjectEdit->text();
|
||||
|
||||
if(name.isEmpty())
|
||||
{ /* error message */
|
||||
int ret = QMessageBox::warning(this, tr("RetroShare"),
|
||||
tr("Please add a Subject"),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
|
||||
return; //Don't add a empty Subject!!
|
||||
}
|
||||
else
|
||||
|
||||
/* rsChannels */
|
||||
if (rsChannels)
|
||||
{
|
||||
ChannelMsgInfo msgInfo;
|
||||
|
||||
msgInfo.channelId = mChannelId;
|
||||
msgInfo.msgId = "";
|
||||
|
||||
msgInfo.subject = subject;
|
||||
msgInfo.msg = msg;
|
||||
msgInfo.files = files;
|
||||
|
||||
rsChannels->ChannelMessageSend(msgInfo);
|
||||
}
|
||||
|
||||
close();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
73
retroshare-gui/src/gui/channels/CreateChannelMsg.h
Normal file
73
retroshare-gui/src/gui/channels/CreateChannelMsg.h
Normal file
@ -0,0 +1,73 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2008 Robert Fernie
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef _CREATECHANNELMSG_H
|
||||
#define _CREATECHANNELMSG_H
|
||||
|
||||
#include "ui_CreateChannelMsg.h"
|
||||
#include <stdint.h>
|
||||
|
||||
class SubFileItem;
|
||||
class FileInfo;
|
||||
|
||||
class CreateChannelMsg : public QDialog, private Ui::CreateChannelMsg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
CreateChannelMsg(std::string cId);
|
||||
/** Default Destructor */
|
||||
|
||||
void addAttachment(std::string path);
|
||||
void addAttachment(std::string hash, std::string fname, uint64_t size,
|
||||
bool local, std::string srcId);
|
||||
|
||||
void newChannelMsg();
|
||||
|
||||
protected:
|
||||
virtual void dragEnterEvent(QDragEnterEvent *event);
|
||||
virtual void dropEvent(QDropEvent *event);
|
||||
|
||||
private slots:
|
||||
void addExtraFile();
|
||||
void checkAttachmentReady();
|
||||
|
||||
void cancelMsg();
|
||||
void sendMsg();
|
||||
|
||||
private:
|
||||
|
||||
void parseRsFileListAttachments(std::string attachList);
|
||||
|
||||
void sendMessage(std::wstring subject, std::wstring msg, std::list<FileInfo> &files);
|
||||
|
||||
std::string mChannelId;
|
||||
|
||||
std::list<SubFileItem *> mAttachments;
|
||||
|
||||
bool mCheckAttachment;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
431
retroshare-gui/src/gui/channels/CreateChannelMsg.ui
Normal file
431
retroshare-gui/src/gui/channels/CreateChannelMsg.ui
Normal file
@ -0,0 +1,431 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CreateChannelMsg</class>
|
||||
<widget class="QDialog" name="CreateChannelMsg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>505</width>
|
||||
<height>464</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>New Channel Post</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame{background-image: url(:/images/connect/connectFriendBanner.png);}
|
||||
</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/channels.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:26pt; color:#ffffff;">New Channel Post</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>Channel Post</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Channel Post to:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="channelName">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">You can set your Thumbnail Image for your Channel Post.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">You can use Drap and Drop to Attach Files.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Set your Subject and Description for your Channel Post.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">You can View your Attached Files on Attachments Tab.</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="addfilepushButton">
|
||||
<property name="text">
|
||||
<string>Add File to Attach</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Add Channel Thumbnail</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>156</width>
|
||||
<height>107</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/thumb-default-video.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>12</width>
|
||||
<height>98</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Message</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Subject :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="subjectEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QTextEdit" name="msgEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/attachment.png</normaloff>:/images/attachment.png</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Attachments</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/attachment.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Attachments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>334</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addFileButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>34</width>
|
||||
<height>34</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>460</width>
|
||||
<height>282</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="fileFrame">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Drag and Drop Files from Search Results</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#fileFrame{border: 2px solid black;
|
||||
background: white;}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>438</width>
|
||||
<height>137</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user