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:
thunder2 2011-07-06 23:46:16 +00:00
parent a0e6bf7b2a
commit c62f642706
8 changed files with 318 additions and 369 deletions

View File

@ -324,8 +324,7 @@ void CreateChannelMsg::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; 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;
@ -347,9 +346,6 @@ void CreateChannelMsg::addAttachment(const std::string &path)
FileInfo fInfo; FileInfo fInfo;
rsChannels->channelExtraFileHash(path, mChannelId, fInfo); rsChannels->channelExtraFileHash(path, mChannelId, fInfo);
// file is not innitial // file is not innitial
SubFileItem *file = new SubFileItem(fInfo.hash, fInfo.fname, fInfo.path, fInfo.size, SubFileItem *file = new SubFileItem(fInfo.hash, fInfo.fname, fInfo.path, fInfo.size,
flags, mChannelId); // destroyed when fileFrame (this subfileitem) is destroyed flags, mChannelId); // destroyed when fileFrame (this subfileitem) is destroyed
@ -364,11 +360,8 @@ void CreateChannelMsg::addAttachment(const std::string &path)
} }
return; return;
} }
bool CreateChannelMsg::setThumbNail(const std::string& path, int frame){ bool CreateChannelMsg::setThumbNail(const std::string& path, int frame){
#ifdef CHANNELS_FRAME_CATCHER #ifdef CHANNELS_FRAME_CATCHER

View File

@ -163,6 +163,7 @@ void ChanMsgItem::updateItemStatic()
} }
msgLabel->setText(QString::fromStdWString(cmi.msg)); msgLabel->setText(QString::fromStdWString(cmi.msg));
msgLabel->setVisible(!cmi.msg.empty());
QDateTime qtime; QDateTime qtime;
qtime.setTime_t(cmi.ts); qtime.setTime_t(cmi.ts);
@ -175,7 +176,6 @@ void ChanMsgItem::updateItemStatic()
filelabel->setText(QString::fromStdString(out.str()) + " " + misc::friendlyUnit(cmi.size)); filelabel->setText(QString::fromStdString(out.str()) + " " + misc::friendlyUnit(cmi.size));
} }
if (mFileItems.empty() == false) { if (mFileItems.empty() == false) {
std::list<SubFileItem *>::iterator it; std::list<SubFileItem *>::iterator it;
for(it = mFileItems.begin(); it != mFileItems.end(); it++) for(it = mFileItems.begin(); it != mFileItems.end(); it++)

View File

@ -10,9 +10,6 @@
<height>208</height> <height>208</height>
</rect> </rect>
</property> </property>
<property name="windowTitle">
<string notr="true"/>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QToolButton, QPushButton, QComboBox { <string notr="true">QToolButton, QPushButton, QComboBox {
border-image: url(:/images/btn_26.png) 4; border-image: url(:/images/btn_26.png) 4;
@ -487,19 +484,6 @@ border-radius: 10px;}</string>
</layout> </layout>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
<resources> <resources>

View File

@ -77,6 +77,7 @@ SubFileItem::SubFileItem(const std::string &hash, const std::string &name, const
mMode = flags & SFI_MASK_STATE; mMode = flags & SFI_MASK_STATE;
mType = flags & SFI_MASK_TYPE; mType = flags & SFI_MASK_TYPE;
mFlag = flags & SFI_MASK_FLAG;
/**** Enable **** /**** Enable ****
*****/ *****/
@ -255,7 +256,7 @@ void SubFileItem::updateItemStatic()
case SFI_STATE_LOCAL: case SFI_STATE_LOCAL:
playButton->setEnabled(true); playButton->setEnabled(true);
downloadButton->setEnabled(false); downloadButton->setEnabled(false);
cancelButton->setEnabled(true); cancelButton->setEnabled(false);
progressBar->setValue(mFileSize / mDivisor); progressBar->setValue(mFileSize / mDivisor);
filename = "[" + tr("LOCAL") + "] " + filename + " (" + misc::friendlyUnit(mFileSize) + ")"; filename = "[" + tr("LOCAL") + "] " + filename + " (" + misc::friendlyUnit(mFileSize) + ")";
@ -281,12 +282,15 @@ void SubFileItem::updateItemStatic()
if (mMode == SFI_STATE_LOCAL) if (mMode == SFI_STATE_LOCAL)
{ {
saveButton->setEnabled(true); saveButton->setEnabled(true);
cancelButton->setEnabled(true); // channel files which are extra files are removed
} }
else else
{ {
saveButton->setEnabled(false); 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; break;
case SFI_TYPE_ATTACH: case SFI_TYPE_ATTACH:
@ -294,17 +298,15 @@ void SubFileItem::updateItemStatic()
playButton->hide(); playButton->hide();
downloadButton->hide(); downloadButton->hide();
cancelButton->setEnabled(true); cancelButton->setEnabled(true);
cancelButton->setToolTip("Remove Attachment"); cancelButton->setToolTip(tr("Remove Attachment"));
} }
break; break;
default: default:
break; break;
} }
fileLabel->setText(filename); fileLabel->setText(filename);
fileLabel->setToolTip(filename); fileLabel->setToolTip(filename);
} }
void SubFileItem::updateItem() void SubFileItem::updateItem()
@ -539,7 +541,7 @@ void SubFileItem::cancel()
mMode = SFI_STATE_ERROR; mMode = SFI_STATE_ERROR;
/* Only occurs - if it is downloading */ /* 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(); hide();
rsFiles->ExtraFileRemove(FileHash(), RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_EXTRA); rsFiles->ExtraFileRemove(FileHash(), RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_EXTRA);

View File

@ -26,7 +26,8 @@
#include <stdint.h> #include <stdint.h>
const uint32_t SFI_MASK_STATE = 0x000f; const uint32_t SFI_MASK_STATE = 0x000f;
const uint32_t SFI_MASK_TYPE = 0x00f0; 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_ERROR = 0x0001;
const uint32_t SFI_STATE_EXTRA = 0x0002; 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_CHANNEL = 0x0010;
const uint32_t SFI_TYPE_ATTACH = 0x0020; 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 //! This create a gui widget that allows users to access files shared by user
/*! /*!
@ -88,7 +91,6 @@ private:
void Setup(); void Setup();
std::string mPath; std::string mPath;
std::string mFileHash; std::string mFileHash;
std::string mFileName; std::string mFileName;
@ -97,6 +99,7 @@ private:
uint32_t mMode; uint32_t mMode;
uint32_t mType; uint32_t mType;
uint32_t mFlag;
uint64_t mDivisor; uint64_t mDivisor;
/* for display purposes */ /* for display purposes */
@ -107,7 +110,4 @@ signals:
}; };
#endif #endif

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>464</width> <width>464</width>
<height>122</height> <height>71</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -16,9 +16,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="windowTitle">
<string/>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QWidget#SubFileItem{border: none;}</string> <string notr="true">QWidget#SubFileItem{border: none;}</string>
</property> </property>
@ -37,12 +34,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>122</height>
</size>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QFrame#frame{border: 2px solid #238; <string notr="true">QFrame#frame{border: 2px solid #238;
background: white; background: white;
@ -221,27 +212,7 @@ border: 1px solid black;
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item>
</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">
<widget class="QPushButton" name="saveButton"> <widget class="QPushButton" name="saveButton">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -269,19 +240,6 @@ border: 1px solid black;
</item> </item>
</layout> </layout>
</item> </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> </layout>
</widget> </widget>
</item> </item>

File diff suppressed because it is too large Load Diff