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:
thunder2 2010-12-09 20:49:41 +00:00
parent 5617b3cdda
commit e0a2883eaf
4 changed files with 21 additions and 19 deletions

View file

@ -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"));