mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Set minimum size for RemoteDirModel items and fixed Text Alignment role for File Size column, cleaned some code style.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3115 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
1d4a02141f
commit
2b02e35a9e
@ -229,7 +229,7 @@ QString RemoteDirModel::getAgeIndicatorString(const DirDetails &details) const
|
||||
rsFiles->FileDetails(details.hash, 0, finfo);
|
||||
|
||||
return QString::fromStdString(finfo.path) ;
|
||||
}
|
||||
} /* end of FileNameRole */
|
||||
|
||||
if (role == Qt::TextColorRole)
|
||||
{
|
||||
@ -240,7 +240,7 @@ QString RemoteDirModel::getAgeIndicatorString(const DirDetails &details) const
|
||||
return Qt::gray ;
|
||||
else
|
||||
return Qt::black ;
|
||||
}
|
||||
} /* end of TextColorRole */
|
||||
|
||||
|
||||
if (role == Qt::DecorationRole)
|
||||
@ -248,7 +248,6 @@ QString RemoteDirModel::getAgeIndicatorString(const DirDetails &details) const
|
||||
FileInfo finfo;
|
||||
rsFiles->FileDetails(details.hash, 0, finfo);
|
||||
|
||||
|
||||
if (details.type == DIR_TYPE_PERSON)
|
||||
{
|
||||
switch(coln)
|
||||
@ -308,7 +307,6 @@ QString RemoteDirModel::getAgeIndicatorString(const DirDetails &details) const
|
||||
else if (details.type == DIR_TYPE_FILE) /* File */
|
||||
{
|
||||
// extensions predefined
|
||||
//QString name;
|
||||
switch(coln)
|
||||
{
|
||||
case 0:
|
||||
@ -316,7 +314,6 @@ QString RemoteDirModel::getAgeIndicatorString(const DirDetails &details) const
|
||||
if (ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "gif"
|
||||
|| ext == "bmp" || ext == "ico" || ext == "svg")
|
||||
{
|
||||
//setIcon(0, QIcon(":/images/FileTypePicture.png"));
|
||||
QIcon icon(":/images/FileTypePicture.png");
|
||||
return icon;
|
||||
}
|
||||
@ -324,20 +321,17 @@ QString RemoteDirModel::getAgeIndicatorString(const DirDetails &details) const
|
||||
|| ext == "mkv" || ext == "mp4" || ext == "flv" || ext == "mov"
|
||||
|| ext == "vob" || ext == "qt" || ext == "rm" || ext == "3gp")
|
||||
{
|
||||
//setIcon(0, QIcon(":/images/videofile.png"));
|
||||
QIcon icon(":/images/FileTypeVideo.png");
|
||||
return icon;
|
||||
}
|
||||
else if (ext == "ogg" || ext == "mp3" || ext == "wav" || ext == "wma" || ext == "xpm")
|
||||
{
|
||||
//setIcon(0, QIcon(":/images/soundfile.png"));
|
||||
QIcon icon(":/images/FileTypeAudio.png");
|
||||
return icon;
|
||||
}
|
||||
else if (ext == "tar" || ext == "bz2" || ext == "zip" || ext == "gz" || ext == "7z"
|
||||
|| ext == "rar" || ext == "rpm" || ext == "deb")
|
||||
{
|
||||
//setIcon(0, QIcon(":/images/compressedfile.png"));
|
||||
QIcon icon(":/images/FileTypeArchive.png");
|
||||
return icon;
|
||||
}
|
||||
@ -349,32 +343,27 @@ QString RemoteDirModel::getAgeIndicatorString(const DirDetails &details) const
|
||||
}
|
||||
else if (ext == "iso" || ext == "nrg" || ext == "mdf" )
|
||||
{
|
||||
//setIcon(0, QIcon(":/images/txtfile.png"));
|
||||
QIcon icon(":/images/FileTypeCDImage.png");
|
||||
return icon;
|
||||
}
|
||||
else if (ext == "txt" || ext == "cpp" || ext == "c" || ext == "h")
|
||||
{
|
||||
//setIcon(0, QIcon(":/images/txtfile.png"));
|
||||
QIcon icon(":/images/FileTypeDocument.png");
|
||||
return icon;
|
||||
}
|
||||
else if (ext == "doc" || ext == "rtf" || ext == "sxw" || ext == "xls"
|
||||
|| ext == "sxc" || ext == "odt" || ext == "ods")
|
||||
{
|
||||
//setIcon(0, QIcon(":/images/docfile.png"));
|
||||
QIcon icon(":/images/FileTypeDocument.png");
|
||||
return icon;
|
||||
}
|
||||
else if (ext == "html" || ext == "htm" || ext == "php")
|
||||
{
|
||||
//setIcon(0, QIcon(":/images/netfile.png"));
|
||||
QIcon icon(":/images/FileTypeDocument.png");
|
||||
return icon;
|
||||
}
|
||||
else
|
||||
{
|
||||
//setIcon(0, QIcon(":/images/file.png"));
|
||||
QIcon icon(":/images/FileTypeAny.png");
|
||||
return icon;
|
||||
}
|
||||
@ -385,9 +374,9 @@ QString RemoteDirModel::getAgeIndicatorString(const DirDetails &details) const
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
} /* end of DecorationRole */
|
||||
|
||||
/*************
|
||||
/*****************
|
||||
Qt::EditRole
|
||||
Qt::ToolTipRole
|
||||
Qt::StatusTipRole
|
||||
@ -395,6 +384,19 @@ QString RemoteDirModel::getAgeIndicatorString(const DirDetails &details) const
|
||||
Qt::SizeHintRole
|
||||
****************/
|
||||
|
||||
if (role == Qt::SizeHintRole)
|
||||
{
|
||||
return QSize(18, 18);
|
||||
} /* end of SizeHintRole */
|
||||
|
||||
if (role == Qt::TextAlignmentRole)
|
||||
{
|
||||
if(coln == 1)
|
||||
{
|
||||
return int( Qt::AlignRight | Qt::AlignVCenter);
|
||||
}
|
||||
} /* end of TextAlignmentRole */
|
||||
|
||||
if (role == Qt::DisplayRole)
|
||||
{
|
||||
|
||||
@ -477,27 +479,11 @@ QString RemoteDirModel::getAgeIndicatorString(const DirDetails &details) const
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
//return QString::fromUtf8("Folder");
|
||||
return misc::userFriendlyDuration(details.min_age);
|
||||
break;
|
||||
case 3:
|
||||
return getFlagsString(details.flags);
|
||||
break;
|
||||
// case 4:
|
||||
// {
|
||||
// if (ageIndicator == IND_DEFAULT)
|
||||
// return QString("");
|
||||
// QModelIndex pidx = parent(index);
|
||||
// QModelIndex pidxs = pidx.sibling(pidx.row(), 4);
|
||||
// if (pidxs.isValid() && pidxs.data() != tr(""))
|
||||
// return pidxs.data();
|
||||
// else {
|
||||
// QString ind("");
|
||||
// getAgeIndicatorRec(details, ind);
|
||||
// return ind;
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
default:
|
||||
return QString(tr("DIR"));
|
||||
break;
|
||||
@ -506,16 +492,7 @@ QString RemoteDirModel::getAgeIndicatorString(const DirDetails &details) const
|
||||
} /* end of DisplayRole */
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::TextAlignmentRole)
|
||||
{
|
||||
if(coln == 1)
|
||||
{
|
||||
return int( Qt::AlignRight | Qt::AlignVCenter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void RemoteDirModel::getAgeIndicatorRec(DirDetails &details, QString &ret) const {
|
||||
|
Loading…
Reference in New Issue
Block a user