mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-02 18:44:53 -05:00
add attachment count to channel creation window and fixed item removal (was previously only hidden!)
This commit is contained in:
parent
0f3e054778
commit
25c836d443
@ -559,9 +559,10 @@ void SubFileItem::cancel()
|
|||||||
/* Only occurs - if it is downloading */
|
/* Only occurs - if it is downloading */
|
||||||
if (((mType == SFI_TYPE_ATTACH) || (mType == SFI_TYPE_CHANNEL)) && (mFlag & SFI_FLAG_CREATE))
|
if (((mType == SFI_TYPE_ATTACH) || (mType == SFI_TYPE_CHANNEL)) && (mFlag & SFI_FLAG_CREATE))
|
||||||
{
|
{
|
||||||
hide();
|
|
||||||
rsFiles->ExtraFileRemove(FileHash());//, RS_FILE_REQ_ANONYMOUS_ROUTING | RS_FILE_REQ_EXTRA);
|
rsFiles->ExtraFileRemove(FileHash());//, RS_FILE_REQ_ANONYMOUS_ROUTING | RS_FILE_REQ_EXTRA);
|
||||||
mPath = "";
|
mPath = "";
|
||||||
|
del();
|
||||||
|
return; // do not update!
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,8 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
|
|||||||
connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelMsg()));
|
connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelMsg()));
|
||||||
|
|
||||||
connect(addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
|
connect(addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
|
||||||
connect(addfilepushButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
|
connect(removeAllFilesButton, SIGNAL(clicked() ), this , SLOT(clearAllAttachments()));
|
||||||
|
//connect(addfilepushButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
|
||||||
connect(subjectEdit,SIGNAL(textChanged(const QString&)),this,SLOT(updatePreviewText(const QString&)));
|
connect(subjectEdit,SIGNAL(textChanged(const QString&)),this,SLOT(updatePreviewText(const QString&)));
|
||||||
|
|
||||||
connect(addThumbnailButton, SIGNAL(clicked() ), this , SLOT(addThumbnail()));
|
connect(addThumbnailButton, SIGNAL(clicked() ), this , SLOT(addThumbnail()));
|
||||||
@ -81,7 +82,7 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
|
|||||||
channelpostButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/comment.png"));
|
channelpostButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/comment.png"));
|
||||||
attachmentsButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/attachements.png"));
|
attachmentsButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/attachements.png"));
|
||||||
addThumbnailButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/add-image.png"));
|
addThumbnailButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/add-image.png"));
|
||||||
addfilepushButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/add-file.png"));
|
//addfilepushButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/add-file.png"));
|
||||||
|
|
||||||
aspectRatio_CB->setItemIcon(0,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-auto.svg"));
|
aspectRatio_CB->setItemIcon(0,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-auto.svg"));
|
||||||
aspectRatio_CB->setItemIcon(1,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-1-1.svg"));
|
aspectRatio_CB->setItemIcon(1,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-1-1.svg"));
|
||||||
@ -431,6 +432,16 @@ void CreateGxsChannelMsg::addAttachment(const RsFileHash &hash, const std::strin
|
|||||||
|
|
||||||
if (mCheckAttachment)
|
if (mCheckAttachment)
|
||||||
checkAttachmentReady();
|
checkAttachmentReady();
|
||||||
|
|
||||||
|
updateAttachmentCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateGxsChannelMsg::updateAttachmentCount()
|
||||||
|
{
|
||||||
|
if(mAttachments.size() > 0)
|
||||||
|
attachmentsButton->setText(tr("Attachments (%1)").arg(mAttachments.size()));
|
||||||
|
else
|
||||||
|
attachmentsButton->setText(tr("Attachments"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateGxsChannelMsg::deleteAttachment()
|
void CreateGxsChannelMsg::deleteAttachment()
|
||||||
@ -449,6 +460,21 @@ void CreateGxsChannelMsg::deleteAttachment()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
++it;
|
++it;
|
||||||
|
|
||||||
|
updateAttachmentCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateGxsChannelMsg::clearAllAttachments()
|
||||||
|
{
|
||||||
|
QLayoutItem* item;
|
||||||
|
while ( ( item = fileFrame->layout()->takeAt( 0 ) ) != NULL )
|
||||||
|
{
|
||||||
|
delete item->widget();
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
|
||||||
|
mAttachments.clear();
|
||||||
|
attachmentsButton->setText(tr("Attachments"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateGxsChannelMsg::addExtraFile()
|
void CreateGxsChannelMsg::addExtraFile()
|
||||||
@ -489,7 +515,7 @@ void CreateGxsChannelMsg::addAttachment(const std::string &path)
|
|||||||
setThumbNail(path, 2000);
|
setThumbNail(path, 2000);
|
||||||
|
|
||||||
/* add widget in for new destination */
|
/* add widget in for new destination */
|
||||||
uint32_t flags = SFI_TYPE_CHANNEL | SFI_STATE_EXTRA | SFI_FLAG_CREATE;
|
uint32_t flags = SFI_TYPE_CHANNEL | SFI_STATE_EXTRA | SFI_FLAG_CREATE;
|
||||||
|
|
||||||
// check attachment if hash exists already
|
// check attachment if hash exists already
|
||||||
std::list<SubFileItem* >::iterator it;
|
std::list<SubFileItem* >::iterator it;
|
||||||
@ -516,16 +542,18 @@ void CreateGxsChannelMsg::addAttachment(const std::string &path)
|
|||||||
//SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, mChannelId);
|
//SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, mChannelId);
|
||||||
SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, RsPeerId());
|
SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, RsPeerId());
|
||||||
|
|
||||||
mAttachments.push_back(file);
|
connect(file,SIGNAL(wantsToBeDeleted()),this,SLOT(deleteAttachment())) ;
|
||||||
|
|
||||||
|
mAttachments.push_back(file);
|
||||||
QLayout *layout = fileFrame->layout();
|
QLayout *layout = fileFrame->layout();
|
||||||
layout->addWidget(file);
|
layout->addWidget(file);
|
||||||
|
|
||||||
if (mCheckAttachment)
|
if (mCheckAttachment)
|
||||||
{
|
|
||||||
checkAttachmentReady();
|
checkAttachmentReady();
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
updateAttachmentCount();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreateGxsChannelMsg::setThumbNail(const std::string& path, int frame){
|
bool CreateGxsChannelMsg::setThumbNail(const std::string& path, int frame){
|
||||||
@ -610,7 +638,9 @@ void CreateGxsChannelMsg::checkAttachmentReady()
|
|||||||
cancelButton->setEnabled(true);
|
cancelButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* repeat... */
|
updateAttachmentCount();
|
||||||
|
|
||||||
|
/* repeat... */
|
||||||
int msec_rate = 1000;
|
int msec_rate = 1000;
|
||||||
QTimer::singleShot( msec_rate, this, SLOT(checkAttachmentReady(void)));
|
QTimer::singleShot( msec_rate, this, SLOT(checkAttachmentReady(void)));
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@ private slots:
|
|||||||
void checkAttachmentReady();
|
void checkAttachmentReady();
|
||||||
void deleteAttachment();
|
void deleteAttachment();
|
||||||
void updatePreviewText(const QString &);
|
void updatePreviewText(const QString &);
|
||||||
|
void clearAllAttachments();
|
||||||
|
|
||||||
void cancelMsg();
|
void cancelMsg();
|
||||||
void sendMsg();
|
void sendMsg();
|
||||||
@ -76,6 +77,7 @@ private:
|
|||||||
void loadChannelInfo();
|
void loadChannelInfo();
|
||||||
void loadOriginalChannelPostInfo();
|
void loadOriginalChannelPostInfo();
|
||||||
void saveChannelInfo(const RsGroupMetaData &group);
|
void saveChannelInfo(const RsGroupMetaData &group);
|
||||||
|
void updateAttachmentCount();
|
||||||
|
|
||||||
void parseRsFileListAttachments(const std::string &attachList);
|
void parseRsFileListAttachments(const std::string &attachList);
|
||||||
void sendMessage(const std::string &subject, const std::string &msg, const std::list<RsGxsFile> &files);
|
void sendMessage(const std::string &subject, const std::string &msg, const std::list<RsGxsFile> &files);
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="stackedWidgetPage1">
|
<widget class="QWidget" name="stackedWidgetPage1">
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
@ -186,7 +186,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="aspectRatio_CB">
|
<widget class="QComboBox" name="aspectRatio_CB">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Choose aspect ratio policy.</p><p>In 'Auto' mode, the most suitable </p><p>aspect ratio is chosen for you.</p></body></html></string>
|
<string><html><head/><body><p>Choose aspect ratio policy. In 'Auto' mode, the most suitable aspect ratio is chosen for you.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
@ -261,52 +261,99 @@ p, li { white-space: pre-wrap; }
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="stackedWidgetPage2">
|
<widget class="QWidget" name="stackedWidgetPage2">
|
||||||
<layout class="QGridLayout" name="attachmentsTabGLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="leftMargin">
|
<item>
|
||||||
<number>0</number>
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
</property>
|
<item>
|
||||||
<property name="topMargin">
|
<widget class="QPushButton" name="addFileButton">
|
||||||
<number>6</number>
|
<property name="sizePolicy">
|
||||||
</property>
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<property name="rightMargin">
|
<horstretch>0</horstretch>
|
||||||
<number>0</number>
|
<verstretch>0</verstretch>
|
||||||
</property>
|
</sizepolicy>
|
||||||
<property name="bottomMargin">
|
</property>
|
||||||
<number>0</number>
|
<property name="minimumSize">
|
||||||
</property>
|
<size>
|
||||||
<item row="0" column="0">
|
<width>34</width>
|
||||||
<widget class="QPushButton" name="addFileButton">
|
<height>34</height>
|
||||||
<property name="sizePolicy">
|
</size>
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
</property>
|
||||||
<horstretch>0</horstretch>
|
<property name="toolTip">
|
||||||
<verstretch>0</verstretch>
|
<string><html><head/><body><p>Add File</p></body></html></string>
|
||||||
</sizepolicy>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="minimumSize">
|
<string/>
|
||||||
<size>
|
</property>
|
||||||
<width>34</width>
|
<property name="icon">
|
||||||
<height>34</height>
|
<iconset resource="../icons.qrc">
|
||||||
</size>
|
<normaloff>:/icons/png/add-file.png</normaloff>:/icons/png/add-file.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="iconSize">
|
||||||
<string><html><head/><body><p>Add File</p></body></html></string>
|
<size>
|
||||||
</property>
|
<width>24</width>
|
||||||
<property name="text">
|
<height>24</height>
|
||||||
<string/>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
</widget>
|
||||||
<iconset resource="../icons.qrc">
|
</item>
|
||||||
<normaloff>:/icons/png/add-file.png</normaloff>:/icons/png/add-file.png</iconset>
|
<item>
|
||||||
</property>
|
<widget class="QPushButton" name="removeAllFilesButton">
|
||||||
<property name="iconSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<width>24</width>
|
<horstretch>0</horstretch>
|
||||||
<height>24</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>34</width>
|
||||||
|
<height>34</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Add File</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../icons.qrc">
|
||||||
|
<normaloff>:/icons/png/cancel.png</normaloff>:/icons/png/cancel.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="thumbNailCb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Allow channels to get frame for message thumbnail from movie media attachments or not</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto Thumbnail</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="attachmentsHSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>334</width>
|
||||||
|
<height>26</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="5">
|
<item>
|
||||||
<widget class="QScrollArea" name="attachmentsScrollArea">
|
<widget class="QScrollArea" name="attachmentsScrollArea">
|
||||||
<property name="verticalScrollBarPolicy">
|
<property name="verticalScrollBarPolicy">
|
||||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||||
@ -319,7 +366,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>84</width>
|
<width>827</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -366,29 +413,6 @@ p, li { white-space: pre-wrap; }
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
|
||||||
<spacer name="attachmentsHSpacer">
|
|
||||||
<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 row="0" column="1">
|
|
||||||
<widget class="QCheckBox" name="thumbNailCb">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Allow channels to get frame for message thumbnail from movie media attachments or not</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Auto Thumbnail</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user