mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
Commited changes from Imanuel
Added flac and m4a to the audio extensions. Optimized "toUpper" on searching for the extension. Convert the extension to lower case to find mixed cases too - mP3, AVi, ... git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3903 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
5617b3cdda
commit
e0a2883eaf
@ -192,7 +192,7 @@ void SearchDialog::initialiseFileTypeMappings()
|
||||
/* edit these strings to change the range of extensions recognised by the search */
|
||||
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_ANY, "");
|
||||
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_AUDIO,
|
||||
"aac aif iff m3u mid midi mp3 mpa ogg ra ram wav wma");
|
||||
"aac aif flac iff m3u m4a mid midi mp3 mpa ogg ra ram wav wma");
|
||||
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_ARCHIVE,
|
||||
"7z bz2 gz pkg rar sea sit sitx tar zip");
|
||||
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_CDIMAGE,
|
||||
@ -624,11 +624,11 @@ void SearchDialog::updateFiles(qulonglong search_id,FileDetail file)
|
||||
|
||||
if (extIndex >= 0)
|
||||
{
|
||||
QString qExt = qName.mid(extIndex+1);
|
||||
QString qExt = qName.mid(extIndex+1).toUpper();
|
||||
|
||||
if (qExt != "" )
|
||||
for (int i = 0; i < extList.size(); ++i)
|
||||
if (qExt.toUpper() == extList.at(i).toUpper())
|
||||
if (qExt == extList.at(i).toUpper())
|
||||
insertFile(txt,search_id,file);
|
||||
}
|
||||
}
|
||||
@ -1088,10 +1088,11 @@ void SearchDialog::selectSearchResults(int index)
|
||||
ui.searchResultWidget->update();
|
||||
}
|
||||
|
||||
void SearchDialog::setIconAndType(QTreeWidgetItem *item, QString &ext)
|
||||
void SearchDialog::setIconAndType(QTreeWidgetItem *item, QString ext)
|
||||
{
|
||||
ext = ext.toLower();
|
||||
if (ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "gif" || ext == "bmp" || ext == "ico"
|
||||
|| ext == "svg" || ext == "tif" || ext == "tiff" || ext == "JPG")
|
||||
|| ext == "svg" || ext == "tif" || ext == "tiff")
|
||||
{
|
||||
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypePicture.png"));
|
||||
item->setText(SR_TYPE_COL, QString::fromUtf8("Picture"));
|
||||
@ -1103,7 +1104,7 @@ void SearchDialog::setIconAndType(QTreeWidgetItem *item, QString &ext)
|
||||
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypeVideo.png"));
|
||||
item->setText(SR_TYPE_COL, QString::fromUtf8("Video"));
|
||||
}
|
||||
else if (ext == "ogg" || ext == "mp3" || ext == "MP3" || ext == "mp1" || ext == "mp2" || ext == "wav" || ext == "wma")
|
||||
else if (ext == "flac" || ext == "ogg" || ext == "mp3" || ext == "m4a" || ext == "mp1" || ext == "mp2" || ext == "wav" || ext == "wma")
|
||||
{
|
||||
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypeAudio.png"));
|
||||
item->setText(SR_TYPE_COL, QString::fromUtf8("Audio"));
|
||||
|
@ -96,7 +96,7 @@ private:
|
||||
void insertFile(const std::string& txt,qulonglong searchId, const FileDetail& file, int searchType = ANONYMOUS_SEARCH) ;
|
||||
void insertDirectory(const std::string &txt, qulonglong searchId, const DirDetails &dir, QTreeWidgetItem *item);
|
||||
void insertDirectory(const std::string &txt, qulonglong searchId, const DirDetails &dir);
|
||||
void setIconAndType(QTreeWidgetItem *item, QString &ext);
|
||||
void setIconAndType(QTreeWidgetItem *item, QString ext);
|
||||
void downloadDirectory(const QTreeWidgetItem *item, const QString &base);
|
||||
void getSourceFriendsForHash(const std::string& hash,std::list<std::string>& srcIds);
|
||||
|
||||
|
@ -531,15 +531,16 @@ int TransfersDialog::addItem(const QString&, const QString& name, const QString&
|
||||
return row ;
|
||||
}
|
||||
|
||||
QIcon TransfersDialog::getIconFromExtension(const QString& ext)
|
||||
QIcon TransfersDialog::getIconFromExtension(QString ext)
|
||||
{
|
||||
if (ext == "jpg" || ext == "jpeg" || ext == "tif" || ext == "tiff" || ext == "JPG"|| ext == "png" || ext == "gif" || ext == "bmp" || ext == "ico" || ext == "svg")
|
||||
ext = ext.toLower();
|
||||
if (ext == "jpg" || ext == "jpeg" || ext == "tif" || ext == "tiff" || ext == "png" || ext == "gif" || ext == "bmp" || ext == "ico" || ext == "svg")
|
||||
return QIcon(QString::fromUtf8(":/images/FileTypePicture.png")) ;
|
||||
else if (ext == "avi" ||ext == "AVI" || ext == "mpg" || ext == "mpeg" || ext == "wmv" || ext == "divx" || ext == "ts"
|
||||
else if (ext == "avi" || ext == "mpg" || ext == "mpeg" || ext == "wmv" || ext == "divx" || ext == "ts"
|
||||
|| ext == "mkv" || ext == "mp4" || ext == "flv" || ext == "mov" || ext == "asf" || ext == "xvid"
|
||||
|| ext == "vob" || ext == "qt" || ext == "rm" || ext == "3gp" || ext == "mpeg" || ext == "ogm")
|
||||
|| ext == "vob" || ext == "qt" || ext == "rm" || ext == "3gp" || ext == "ogm")
|
||||
return QIcon(QString::fromUtf8(":/images/FileTypeVideo.png")) ;
|
||||
else if (ext == "ogg" || ext == "mp3" || ext == "MP3" || ext == "mp1" || ext == "mp2" || ext == "wav" || ext == "wma")
|
||||
else if (ext == "ogg" || ext == "mp3" || ext == "mp1" || ext == "mp2" || ext == "wav" || ext == "wma" || ext == "m4a" || ext == "flac")
|
||||
return QIcon(QString::fromUtf8(":/images/FileTypeAudio.png")) ;
|
||||
else if (ext == "tar" || ext == "bz2" || ext == "zip" || ext == "gz" || ext == "7z" || ext == "msi"
|
||||
|| ext == "rar" || ext == "rpm" || ext == "ace" || ext == "jar" || ext == "tgz" || ext == "lha"
|
||||
|
@ -106,7 +106,7 @@ signals:
|
||||
|
||||
private:
|
||||
QString getPeerName(const std::string& peer_id) const ;
|
||||
static QIcon getIconFromExtension(const QString&) ;
|
||||
static QIcon getIconFromExtension(QString) ;
|
||||
|
||||
QStandardItemModel *DLListModel;
|
||||
QStandardItemModel *ULListModel;
|
||||
|
Loading…
Reference in New Issue
Block a user