mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 06:59:27 -05:00
* Added CD-Image to Search ComboBox
* Added CD-Image extensions for Search Dialog and RemotDirModel * Added Type Column item to Search Dialog to show : Audio,Archive,CD-Image,Document,Picture,Program,Video * Added FileType for Program extension to RemoteDirModel git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@825 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c60cf84e95
commit
3d3f4bfec9
@ -53,8 +53,9 @@
|
|||||||
#define SR_NAME_COL 1
|
#define SR_NAME_COL 1
|
||||||
#define SR_SIZE_COL 2
|
#define SR_SIZE_COL 2
|
||||||
#define SR_ID_COL 3
|
#define SR_ID_COL 3
|
||||||
#define SR_HASH_COL 4
|
#define SR_TYPE_COL 4
|
||||||
#define SR_SEARCH_ID_COL 5
|
#define SR_HASH_COL 5
|
||||||
|
#define SR_SEARCH_ID_COL 6
|
||||||
|
|
||||||
/* indicies for search summary item columns SS_ = Search Summary */
|
/* indicies for search summary item columns SS_ = Search Summary */
|
||||||
#define SS_TEXT_COL 0
|
#define SS_TEXT_COL 0
|
||||||
@ -64,12 +65,13 @@
|
|||||||
/* static members */
|
/* static members */
|
||||||
/* These indices MUST be identical to their equivalent indices in the combobox */
|
/* These indices MUST be identical to their equivalent indices in the combobox */
|
||||||
const int SearchDialog::FILETYPE_IDX_ANY = 0;
|
const int SearchDialog::FILETYPE_IDX_ANY = 0;
|
||||||
const int SearchDialog::FILETYPE_IDX_AUDIO = 1;
|
const int SearchDialog::FILETYPE_IDX_ARCHIVE = 1;
|
||||||
const int SearchDialog::FILETYPE_IDX_VIDEO = 2;
|
const int SearchDialog::FILETYPE_IDX_AUDIO = 2;
|
||||||
const int SearchDialog::FILETYPE_IDX_PICTURE = 3;
|
const int SearchDialog::FILETYPE_IDX_CDIMAGE = 3;
|
||||||
const int SearchDialog::FILETYPE_IDX_PROGRAM = 4;
|
const int SearchDialog::FILETYPE_IDX_DOCUMENT = 4;
|
||||||
const int SearchDialog::FILETYPE_IDX_ARCHIVE = 5;
|
const int SearchDialog::FILETYPE_IDX_PICTURE = 5;
|
||||||
const int SearchDialog::FILETYPE_IDX_DOCUMENT = 6;
|
const int SearchDialog::FILETYPE_IDX_PROGRAM = 6;
|
||||||
|
const int SearchDialog::FILETYPE_IDX_VIDEO = 7;
|
||||||
QMap<int, QString> * SearchDialog::FileTypeExtensionMap = new QMap<int, QString>();
|
QMap<int, QString> * SearchDialog::FileTypeExtensionMap = new QMap<int, QString>();
|
||||||
bool SearchDialog::initialised = false;
|
bool SearchDialog::initialised = false;
|
||||||
|
|
||||||
@ -140,7 +142,7 @@ SearchDialog::SearchDialog(QWidget *parent)
|
|||||||
_smheader->resizeSection ( 1, 75 );
|
_smheader->resizeSection ( 1, 75 );
|
||||||
_smheader->resizeSection ( 2, 75 );
|
_smheader->resizeSection ( 2, 75 );
|
||||||
|
|
||||||
ui.searchResultWidget->setColumnCount(5);
|
ui.searchResultWidget->setColumnCount(6);
|
||||||
_smheader = ui.searchResultWidget->header () ;
|
_smheader = ui.searchResultWidget->header () ;
|
||||||
_smheader->setResizeMode (0, QHeaderView::Custom);
|
_smheader->setResizeMode (0, QHeaderView::Custom);
|
||||||
_smheader->setResizeMode (1, QHeaderView::Interactive);
|
_smheader->setResizeMode (1, QHeaderView::Interactive);
|
||||||
@ -148,10 +150,12 @@ SearchDialog::SearchDialog(QWidget *parent)
|
|||||||
_smheader->setResizeMode (3, QHeaderView::Interactive);
|
_smheader->setResizeMode (3, QHeaderView::Interactive);
|
||||||
|
|
||||||
_smheader->resizeSection ( 0, 20 );
|
_smheader->resizeSection ( 0, 20 );
|
||||||
_smheader->resizeSection ( 1, 270 );
|
_smheader->resizeSection ( 1, 220 );
|
||||||
_smheader->resizeSection ( 2, 75 );
|
_smheader->resizeSection ( 2, 75 );
|
||||||
_smheader->resizeSection ( 3, 75 );
|
_smheader->resizeSection ( 3, 75 );
|
||||||
_smheader->resizeSection ( 4, 240 );
|
_smheader->resizeSection ( 4, 75 );
|
||||||
|
_smheader->resizeSection ( 5, 240 );
|
||||||
|
|
||||||
|
|
||||||
// set header text aligment
|
// set header text aligment
|
||||||
QTreeWidgetItem * headerItem = ui.searchResultWidget->headerItem();
|
QTreeWidgetItem * headerItem = ui.searchResultWidget->headerItem();
|
||||||
@ -174,17 +178,19 @@ void SearchDialog::initialiseFileTypeMappings()
|
|||||||
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_ANY, "");
|
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_ANY, "");
|
||||||
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_AUDIO,
|
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_AUDIO,
|
||||||
"aac aif iff m3u mid midi mp3 mpa ogg ra ram wav wma");
|
"aac aif iff m3u mid midi mp3 mpa ogg ra ram wav wma");
|
||||||
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_VIDEO,
|
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_ARCHIVE,
|
||||||
"3gp asf asx avi mov mp4 mkv flv mpeg mpg qt rm swf vob wmv");
|
"7z bz2 gz pkg rar sea sit sitx tar zip");
|
||||||
|
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_CDIMAGE,
|
||||||
|
"iso nrg mdf");
|
||||||
|
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_DOCUMENT,
|
||||||
|
"doc odt ott rtf pdf ps txt log msg wpd wps" );
|
||||||
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_PICTURE,
|
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_PICTURE,
|
||||||
"3dm 3dmf ai bmp drw dxf eps gif ico indd jpe jpeg jpg mng pcx pcc pct pgm "
|
"3dm 3dmf ai bmp drw dxf eps gif ico indd jpe jpeg jpg mng pcx pcc pct pgm "
|
||||||
"pix png psd psp qxd qxprgb sgi svg tga tif tiff xbm xcf");
|
"pix png psd psp qxd qxprgb sgi svg tga tif tiff xbm xcf");
|
||||||
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_PROGRAM,
|
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_PROGRAM,
|
||||||
"app bat cgi com bin exe js pif py pl sh vb ws ");
|
"app bat cgi com bin exe js pif py pl sh vb ws ");
|
||||||
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_ARCHIVE,
|
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_VIDEO,
|
||||||
"7z bz2 gz pkg rar sea sit sitx tar zip");
|
"3gp asf asx avi mov mp4 mkv flv mpeg mpg qt rm swf vob wmv");
|
||||||
SearchDialog::FileTypeExtensionMap->insert(FILETYPE_IDX_DOCUMENT,
|
|
||||||
"doc odt ott rtf pdf ps txt log msg wpd wps" );
|
|
||||||
SearchDialog::initialised = true;
|
SearchDialog::initialised = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,41 +499,57 @@ void SearchDialog::resultsToTree(std::string txt, std::list<FileDetail> results)
|
|||||||
|| ext == "bmp" || ext == "ico" || ext == "svg")
|
|| ext == "bmp" || ext == "ico" || ext == "svg")
|
||||||
{
|
{
|
||||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypePicture.png"));
|
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypePicture.png"));
|
||||||
|
item->setText(SR_TYPE_COL, QString::fromUtf8("Picture"));
|
||||||
}
|
}
|
||||||
else if (ext == "avi" || ext == "mpg" || ext == "mpeg" || ext == "wmv"
|
else if (ext == "avi" || ext == "mpg" || ext == "mpeg" || ext == "wmv"
|
||||||
|| ext == "mkv" || ext == "mp4" || ext == "flv" || ext == "mov"
|
|| ext == "mkv" || ext == "mp4" || ext == "flv" || ext == "mov"
|
||||||
|| ext == "vob" || ext == "qt" || ext == "rm" || ext == "3gp")
|
|| ext == "vob" || ext == "qt" || ext == "rm" || ext == "3gp")
|
||||||
{
|
{
|
||||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeVideo.png"));
|
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeVideo.png"));
|
||||||
|
item->setText(SR_TYPE_COL, QString::fromUtf8("Video"));
|
||||||
}
|
}
|
||||||
else if (ext == "ogg" || ext == "mp3" || ext == "wav" || ext == "wma")
|
else if (ext == "ogg" || ext == "mp3" || ext == "wav" || ext == "wma")
|
||||||
{
|
{
|
||||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeAudio.png"));
|
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeAudio.png"));
|
||||||
|
item->setText(SR_TYPE_COL, QString::fromUtf8("Audio"));
|
||||||
}
|
}
|
||||||
else if (ext == "tar" || ext == "bz2" || ext == "zip" || ext == "gz"
|
else if (ext == "tar" || ext == "bz2" || ext == "zip" || ext == "gz"
|
||||||
|| ext == "rar" || ext == "rpm" || ext == "deb")
|
|| ext == "rar" || ext == "rpm" || ext == "deb")
|
||||||
{
|
{
|
||||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeArchive.png"));
|
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeArchive.png"));
|
||||||
|
item->setText(SR_TYPE_COL, QString::fromUtf8("Archive"));
|
||||||
|
}
|
||||||
|
else if (ext == "app" || ext == "bat" || ext == "cgi" || ext == "com"
|
||||||
|
|| ext == "bin" || ext == "exe" || ext == "js" || ext == "pif"
|
||||||
|
|| ext == "py" || ext == "pl" || ext == "sh" || ext == "vb" || ext == "ws")
|
||||||
|
{
|
||||||
|
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeProgram.png"));
|
||||||
|
item->setText(SR_TYPE_COL, QString::fromUtf8("Program"));
|
||||||
|
}
|
||||||
|
else if (ext == "iso" || ext == "nrg" || ext == "mdf" )
|
||||||
|
{
|
||||||
|
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeCDImage.png"));
|
||||||
|
item->setText(SR_TYPE_COL, QString::fromUtf8("CD-Image"));
|
||||||
}
|
}
|
||||||
else if (ext == "txt" || ext == "cpp" || ext == "c" || ext == "h")
|
else if (ext == "txt" || ext == "cpp" || ext == "c" || ext == "h")
|
||||||
{
|
{
|
||||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeDocument.png"));
|
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeDocument.png"));
|
||||||
|
item->setText(SR_TYPE_COL, QString::fromUtf8("Document"));
|
||||||
}
|
}
|
||||||
else if (ext == "doc" || ext == "rtf" || ext == "sxw" || ext == "xls"
|
else if (ext == "doc" || ext == "rtf" || ext == "sxw" || ext == "xls"
|
||||||
|| ext == "sxc" || ext == "odt" || ext == "ods")
|
|| ext == "sxc" || ext == "odt" || ext == "ods")
|
||||||
{
|
{
|
||||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeDocument.png"));
|
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeDocument.png"));
|
||||||
|
item->setText(SR_TYPE_COL, QString::fromUtf8("Document"));
|
||||||
}
|
}
|
||||||
else if (ext == "html" || ext == "htm" || ext == "php")
|
else if (ext == "html" || ext == "htm" || ext == "php")
|
||||||
{
|
{
|
||||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeDocument.png"));
|
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeDocument.png"));
|
||||||
|
item->setText(SR_TYPE_COL, QString::fromUtf8("Document"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeAny.png"));
|
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeAny.png"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,12 +101,14 @@ private:
|
|||||||
|
|
||||||
/** Contains the mapping of filetype combobox to filetype extensions */
|
/** Contains the mapping of filetype combobox to filetype extensions */
|
||||||
static const int FILETYPE_IDX_ANY;
|
static const int FILETYPE_IDX_ANY;
|
||||||
|
static const int FILETYPE_IDX_ARCHIVE;
|
||||||
static const int FILETYPE_IDX_AUDIO;
|
static const int FILETYPE_IDX_AUDIO;
|
||||||
static const int FILETYPE_IDX_VIDEO;
|
static const int FILETYPE_IDX_CDIMAGE;
|
||||||
|
static const int FILETYPE_IDX_DOCUMENT;
|
||||||
static const int FILETYPE_IDX_PICTURE;
|
static const int FILETYPE_IDX_PICTURE;
|
||||||
static const int FILETYPE_IDX_PROGRAM;
|
static const int FILETYPE_IDX_PROGRAM;
|
||||||
static const int FILETYPE_IDX_ARCHIVE;
|
static const int FILETYPE_IDX_VIDEO;
|
||||||
static const int FILETYPE_IDX_DOCUMENT;
|
|
||||||
|
|
||||||
static QMap<int, QString> * FileTypeExtensionMap;
|
static QMap<int, QString> * FileTypeExtensionMap;
|
||||||
static bool initialised;
|
static bool initialised;
|
||||||
|
@ -797,6 +797,14 @@ p, li { white-space: pre-wrap; }
|
|||||||
<iconset resource="images.qrc" >:/images/FileTypeAny.png</iconset>
|
<iconset resource="images.qrc" >:/images/FileTypeAny.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Archive</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="images.qrc" >:/images/FileTypeArchive.png</iconset>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Audio</string>
|
<string>Audio</string>
|
||||||
@ -807,15 +815,23 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Video</string>
|
<string>CD-Image</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="images.qrc" >:/images/FileTypeVideo.png</iconset>
|
<iconset resource="images.qrc" >:/images/FileTypeCDImage.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Images</string>
|
<string>Document</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="images.qrc" >:/images/FileTypeDocument.png</iconset>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Picture</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="images.qrc" >:/images/FileTypePicture.png</iconset>
|
<iconset resource="images.qrc" >:/images/FileTypePicture.png</iconset>
|
||||||
@ -823,7 +839,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Programs</string>
|
<string>Program</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="images.qrc" >:/images/FileTypeProgram.png</iconset>
|
<iconset resource="images.qrc" >:/images/FileTypeProgram.png</iconset>
|
||||||
@ -831,18 +847,10 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Archives</string>
|
<string>Video</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="images.qrc" >:/images/FileTypeArchive.png</iconset>
|
<iconset resource="images.qrc" >:/images/FileTypeVideo.png</iconset>
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Documents</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon" >
|
|
||||||
<iconset resource="images.qrc" >:/images/FileTypeDocument.png</iconset>
|
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
@ -1114,6 +1122,11 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string>Sources</string>
|
<string>Sources</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Type</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
<column>
|
<column>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Hash</string>
|
<string>Hash</string>
|
||||||
|
@ -289,6 +289,18 @@ RemoteDirModel::RemoteDirModel(bool mode, QObject *parent)
|
|||||||
QIcon icon(":/images/FileTypeArchive.png");
|
QIcon icon(":/images/FileTypeArchive.png");
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
else if (ext == "app" || ext == "bat" || ext == "cgi" || ext == "com"
|
||||||
|
|| ext == "bin" || ext == "exe" || ext == "js" || ext == "pif"
|
||||||
|
|| ext == "py" || ext == "pl" || ext == "sh" || ext == "vb" || ext == "ws")
|
||||||
|
{
|
||||||
|
return(QIcon(":/images/FileTypeProgram.png"));
|
||||||
|
}
|
||||||
|
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")
|
else if (ext == "txt" || ext == "cpp" || ext == "c" || ext == "h")
|
||||||
{
|
{
|
||||||
//setIcon(0, QIcon(":/images/txtfile.png"));
|
//setIcon(0, QIcon(":/images/txtfile.png"));
|
||||||
@ -419,8 +431,21 @@ RemoteDirModel::RemoteDirModel(bool mode, QObject *parent)
|
|||||||
}
|
}
|
||||||
} /* end of DisplayRole */
|
} /* end of DisplayRole */
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
|
if (role == Qt::TextAlignmentRole)
|
||||||
|
{
|
||||||
|
if(coln == 1)
|
||||||
|
{
|
||||||
|
return int( Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QVariant RemoteDirModel::headerData(int section, Qt::Orientation orientation,
|
QVariant RemoteDirModel::headerData(int section, Qt::Orientation orientation,
|
||||||
int role) const
|
int role) const
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user