mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Optimized layout of the SubFileItem.
Show the cancel button only when downloading or when used in CreateChannelMsg. Hide empty message text. Fixed german language. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4402 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a0e6bf7b2a
commit
c62f642706
@ -324,8 +324,7 @@ void CreateChannelMsg::addAttachment(const std::string &path)
|
||||
setThumbNail(path, 2000);
|
||||
|
||||
/* add widget in for new destination */
|
||||
uint32_t flags = SFI_TYPE_CHANNEL | SFI_STATE_EXTRA;
|
||||
|
||||
uint32_t flags = SFI_TYPE_CHANNEL | SFI_STATE_EXTRA | SFI_FLAG_CREATE;
|
||||
|
||||
// check attachment if hash exists already
|
||||
std::list<SubFileItem* >::iterator it;
|
||||
@ -347,9 +346,6 @@ void CreateChannelMsg::addAttachment(const std::string &path)
|
||||
FileInfo fInfo;
|
||||
rsChannels->channelExtraFileHash(path, mChannelId, fInfo);
|
||||
|
||||
|
||||
|
||||
|
||||
// file is not innitial
|
||||
SubFileItem *file = new SubFileItem(fInfo.hash, fInfo.fname, fInfo.path, fInfo.size,
|
||||
flags, mChannelId); // destroyed when fileFrame (this subfileitem) is destroyed
|
||||
@ -364,11 +360,8 @@ void CreateChannelMsg::addAttachment(const std::string &path)
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool CreateChannelMsg::setThumbNail(const std::string& path, int frame){
|
||||
|
||||
#ifdef CHANNELS_FRAME_CATCHER
|
||||
|
@ -163,6 +163,7 @@ void ChanMsgItem::updateItemStatic()
|
||||
}
|
||||
|
||||
msgLabel->setText(QString::fromStdWString(cmi.msg));
|
||||
msgLabel->setVisible(!cmi.msg.empty());
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(cmi.ts);
|
||||
@ -174,7 +175,6 @@ void ChanMsgItem::updateItemStatic()
|
||||
out << "(" << cmi.count << " Files)";
|
||||
filelabel->setText(QString::fromStdString(out.str()) + " " + misc::friendlyUnit(cmi.size));
|
||||
}
|
||||
|
||||
|
||||
if (mFileItems.empty() == false) {
|
||||
std::list<SubFileItem *>::iterator it;
|
||||
|
@ -10,9 +10,6 @@
|
||||
<height>208</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton, QPushButton, QComboBox {
|
||||
border-image: url(:/images/btn_26.png) 4;
|
||||
@ -487,19 +484,6 @@ border-radius: 10px;}</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
|
@ -77,6 +77,7 @@ SubFileItem::SubFileItem(const std::string &hash, const std::string &name, const
|
||||
|
||||
mMode = flags & SFI_MASK_STATE;
|
||||
mType = flags & SFI_MASK_TYPE;
|
||||
mFlag = flags & SFI_MASK_FLAG;
|
||||
|
||||
/**** Enable ****
|
||||
*****/
|
||||
@ -208,12 +209,12 @@ void SubFileItem::updateItemStatic()
|
||||
{
|
||||
case SFI_STATE_ERROR:
|
||||
progressBar->setRange(0, 100);
|
||||
progressBar->setFormat(tr("ERROR"));
|
||||
progressBar->setFormat(tr("ERROR"));
|
||||
|
||||
playButton->setEnabled(false);
|
||||
downloadButton->setEnabled(false);
|
||||
cancelButton->setEnabled(false);
|
||||
|
||||
|
||||
progressBar->setValue(0);
|
||||
filename = "[" + tr("ERROR") + "] " + filename;
|
||||
|
||||
@ -227,7 +228,7 @@ void SubFileItem::updateItemStatic()
|
||||
|
||||
playButton->setEnabled(false);
|
||||
downloadButton->setEnabled(false);
|
||||
cancelButton->setEnabled(false);
|
||||
cancelButton->setEnabled(false);
|
||||
|
||||
progressBar->setValue(0);
|
||||
filename = "[" + tr("EXTRA") + "] " + filename;
|
||||
@ -255,7 +256,7 @@ void SubFileItem::updateItemStatic()
|
||||
case SFI_STATE_LOCAL:
|
||||
playButton->setEnabled(true);
|
||||
downloadButton->setEnabled(false);
|
||||
cancelButton->setEnabled(true);
|
||||
cancelButton->setEnabled(false);
|
||||
|
||||
progressBar->setValue(mFileSize / mDivisor);
|
||||
filename = "[" + tr("LOCAL") + "] " + filename + " (" + misc::friendlyUnit(mFileSize) + ")";
|
||||
@ -281,12 +282,15 @@ void SubFileItem::updateItemStatic()
|
||||
if (mMode == SFI_STATE_LOCAL)
|
||||
{
|
||||
saveButton->setEnabled(true);
|
||||
cancelButton->setEnabled(true); // channel files which are extra files are removed
|
||||
}
|
||||
else
|
||||
{
|
||||
saveButton->setEnabled(false);
|
||||
}
|
||||
if (mFlag & SFI_FLAG_CREATE) {
|
||||
cancelButton->setEnabled(true); // channel files which are extra files are removed
|
||||
cancelButton->setToolTip(tr("Remove Attachment"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SFI_TYPE_ATTACH:
|
||||
@ -294,17 +298,15 @@ void SubFileItem::updateItemStatic()
|
||||
playButton->hide();
|
||||
downloadButton->hide();
|
||||
cancelButton->setEnabled(true);
|
||||
cancelButton->setToolTip("Remove Attachment");
|
||||
cancelButton->setToolTip(tr("Remove Attachment"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
fileLabel->setText(filename);
|
||||
fileLabel->setToolTip(filename);
|
||||
|
||||
}
|
||||
|
||||
void SubFileItem::updateItem()
|
||||
@ -539,7 +541,7 @@ void SubFileItem::cancel()
|
||||
mMode = SFI_STATE_ERROR;
|
||||
|
||||
/* Only occurs - if it is downloading */
|
||||
if ((mType == SFI_TYPE_ATTACH) || (mType == SFI_TYPE_CHANNEL))
|
||||
if (((mType == SFI_TYPE_ATTACH) || (mType == SFI_TYPE_CHANNEL)) && (mFlag & SFI_FLAG_CREATE))
|
||||
{
|
||||
hide();
|
||||
rsFiles->ExtraFileRemove(FileHash(), RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_EXTRA);
|
||||
|
@ -26,7 +26,8 @@
|
||||
#include <stdint.h>
|
||||
const uint32_t SFI_MASK_STATE = 0x000f;
|
||||
const uint32_t SFI_MASK_TYPE = 0x00f0;
|
||||
const uint32_t SFI_MASK_FT = 0x0f00;
|
||||
//const uint32_t SFI_MASK_FT = 0x0f00;
|
||||
const uint32_t SFI_MASK_FLAG = 0xf000;
|
||||
|
||||
const uint32_t SFI_STATE_ERROR = 0x0001;
|
||||
const uint32_t SFI_STATE_EXTRA = 0x0002;
|
||||
@ -38,6 +39,8 @@ const uint32_t SFI_STATE_UPLOAD = 0x0006;
|
||||
const uint32_t SFI_TYPE_CHANNEL = 0x0010;
|
||||
const uint32_t SFI_TYPE_ATTACH = 0x0020;
|
||||
|
||||
const uint32_t SFI_FLAG_CREATE = 0x1000;
|
||||
|
||||
|
||||
//! This create a gui widget that allows users to access files shared by user
|
||||
/*!
|
||||
@ -88,7 +91,6 @@ private:
|
||||
|
||||
void Setup();
|
||||
|
||||
|
||||
std::string mPath;
|
||||
std::string mFileHash;
|
||||
std::string mFileName;
|
||||
@ -97,17 +99,15 @@ private:
|
||||
|
||||
uint32_t mMode;
|
||||
uint32_t mType;
|
||||
uint32_t mFlag;
|
||||
uint64_t mDivisor;
|
||||
|
||||
/* for display purposes */
|
||||
float amountDone;
|
||||
|
||||
signals:
|
||||
void fileFinished(SubFileItem * subFileItem);
|
||||
void fileFinished(SubFileItem * subFileItem);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>464</width>
|
||||
<height>122</height>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -16,9 +16,6 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QWidget#SubFileItem{border: none;}</string>
|
||||
</property>
|
||||
@ -37,12 +34,6 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>122</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame{border: 2px solid #238;
|
||||
background: white;
|
||||
@ -221,27 +212,7 @@ border: 1px solid black;
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>418</width>
|
||||
<height>17</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item>
|
||||
<widget class="QPushButton" name="saveButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@ -269,19 +240,6 @@ border: 1px solid black;
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user