mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
* Added new columns for icons
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@823 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f30178f92b
commit
8d3bda4f76
@ -48,11 +48,13 @@
|
||||
#define UI_PREF_ADVANCED_SEARCH "UIOptions/AdvancedSearch"
|
||||
|
||||
/* indicies for search results item columns SR_ = Search Result */
|
||||
#define SR_NAME_COL 0
|
||||
#define SR_SIZE_COL 1
|
||||
#define SR_ID_COL 2
|
||||
#define SR_HASH_COL 3
|
||||
#define SR_SEARCH_ID_COL 4
|
||||
/* indicies for search results item columns SR_ = Search Result */
|
||||
#define SR_ICON_COL 0
|
||||
#define SR_NAME_COL 1
|
||||
#define SR_SIZE_COL 2
|
||||
#define SR_ID_COL 3
|
||||
#define SR_HASH_COL 4
|
||||
#define SR_SEARCH_ID_COL 5
|
||||
|
||||
/* indicies for search summary item columns SS_ = Search Summary */
|
||||
#define SS_TEXT_COL 0
|
||||
@ -138,23 +140,26 @@ SearchDialog::SearchDialog(QWidget *parent)
|
||||
_smheader->resizeSection ( 1, 75 );
|
||||
_smheader->resizeSection ( 2, 75 );
|
||||
|
||||
ui.searchResultWidget->setColumnCount(4);
|
||||
ui.searchResultWidget->setColumnCount(5);
|
||||
_smheader = ui.searchResultWidget->header () ;
|
||||
_smheader->setResizeMode (0, QHeaderView::Interactive);
|
||||
_smheader->setResizeMode (0, QHeaderView::Custom);
|
||||
_smheader->setResizeMode (1, QHeaderView::Interactive);
|
||||
_smheader->setResizeMode (2, QHeaderView::Interactive);
|
||||
_smheader->setResizeMode (3, QHeaderView::Interactive);
|
||||
|
||||
_smheader->resizeSection ( 0, 270 );
|
||||
_smheader->resizeSection ( 1, 75 );
|
||||
_smheader->resizeSection ( 0, 20 );
|
||||
_smheader->resizeSection ( 1, 270 );
|
||||
_smheader->resizeSection ( 2, 75 );
|
||||
_smheader->resizeSection ( 3, 240 );
|
||||
_smheader->resizeSection ( 3, 75 );
|
||||
_smheader->resizeSection ( 4, 240 );
|
||||
|
||||
// set header text aligment
|
||||
QTreeWidgetItem * headerItem = ui.searchResultWidget->headerItem();
|
||||
headerItem->setTextAlignment(1, Qt::AlignRight | Qt::AlignRight);
|
||||
headerItem->setTextAlignment(2, Qt::AlignRight | Qt::AlignRight);
|
||||
|
||||
headerItem->setTextAlignment(2, Qt::AlignRight | Qt::AlignRight);
|
||||
headerItem->setTextAlignment(3, Qt::AlignRight | Qt::AlignRight);
|
||||
|
||||
ui.searchResultWidget->sortItems(SR_NAME_COL, Qt::AscendingOrder);
|
||||
|
||||
|
||||
|
||||
/* Hide platform specific features */
|
||||
@ -482,6 +487,51 @@ void SearchDialog::resultsToTree(std::string txt, std::list<FileDetail> results)
|
||||
item->setText(SR_NAME_COL, QString::fromStdString(it->name));
|
||||
item->setText(SR_HASH_COL, QString::fromStdString(it->hash));
|
||||
item->setText(SR_SEARCH_ID_COL, QString::fromStdString(out.str()));
|
||||
|
||||
QString ext = QFileInfo(QString::fromStdString(it->name)).suffix();
|
||||
if (ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "gif"
|
||||
|| ext == "bmp" || ext == "ico" || ext == "svg")
|
||||
{
|
||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypePicture.png"));
|
||||
}
|
||||
else if (ext == "avi" || ext == "mpg" || ext == "mpeg" || ext == "wmv"
|
||||
|| ext == "mkv" || ext == "mp4" || ext == "flv" || ext == "mov"
|
||||
|| ext == "vob" || ext == "qt" || ext == "rm" || ext == "3gp")
|
||||
{
|
||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeVideo.png"));
|
||||
}
|
||||
else if (ext == "ogg" || ext == "mp3" || ext == "wav" || ext == "wma")
|
||||
{
|
||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeAudio.png"));
|
||||
}
|
||||
else if (ext == "tar" || ext == "bz2" || ext == "zip" || ext == "gz"
|
||||
|| ext == "rar" || ext == "rpm" || ext == "deb")
|
||||
{
|
||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeArchive.png"));
|
||||
}
|
||||
else if (ext == "txt" || ext == "cpp" || ext == "c" || ext == "h")
|
||||
{
|
||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeDocument.png"));
|
||||
}
|
||||
else if (ext == "doc" || ext == "rtf" || ext == "sxw" || ext == "xls"
|
||||
|| ext == "sxc" || ext == "odt" || ext == "ods")
|
||||
{
|
||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeDocument.png"));
|
||||
|
||||
}
|
||||
else if (ext == "html" || ext == "htm" || ext == "php")
|
||||
{
|
||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeDocument.png"));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeAny.png"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* to facilitate downlaods we need to save the file size too
|
||||
*/
|
||||
@ -497,15 +547,15 @@ void SearchDialog::resultsToTree(std::string txt, std::list<FileDetail> results)
|
||||
if (it->id == "Local")
|
||||
{
|
||||
item->setText(SR_ID_COL, QString::fromStdString(it->id));
|
||||
item->setBackground(2, QBrush(Qt::red)); /* colour green? */
|
||||
item->setBackground(3, QBrush(Qt::red)); /* colour green? */
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setText(SR_ID_COL, QString::fromStdString( rsPeers->getPeerName(it->id)));
|
||||
if(rsPeers->isOnline(it->id))
|
||||
item->setBackground(2, QBrush(Qt::green));
|
||||
item->setBackground(3, QBrush(Qt::green));
|
||||
else
|
||||
item->setBackground(2, QBrush(Qt::lightGray));
|
||||
item->setBackground(3, QBrush(Qt::lightGray));
|
||||
}
|
||||
|
||||
ui.searchResultWidget->addTopLevelItem(item);
|
||||
|
@ -522,7 +522,16 @@
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -530,7 +539,16 @@
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -538,7 +556,16 @@
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -568,8 +595,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/advsearch_24x24.png</normaloff>:/images/advsearch_24x24.png</iconset>
|
||||
<iconset resource="images.qrc" >:/images/advsearch_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
@ -587,7 +613,7 @@
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
@ -621,7 +647,16 @@
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -642,7 +677,16 @@
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -650,7 +694,16 @@
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -671,7 +724,7 @@
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
@ -716,7 +769,7 @@
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>32</height>
|
||||
@ -741,8 +794,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Any</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/FileTypeAny.png</normaloff>:/images/FileTypeAny.png</iconset>
|
||||
<iconset resource="images.qrc" >:/images/FileTypeAny.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@ -750,8 +802,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Audio</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/FileTypeAudio.png</normaloff>:/images/FileTypeAudio.png</iconset>
|
||||
<iconset resource="images.qrc" >:/images/FileTypeAudio.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@ -759,8 +810,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Video</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/FileTypeVideo.png</normaloff>:/images/FileTypeVideo.png</iconset>
|
||||
<iconset resource="images.qrc" >:/images/FileTypeVideo.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@ -768,8 +818,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Images</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/FileTypePicture.png</normaloff>:/images/FileTypePicture.png</iconset>
|
||||
<iconset resource="images.qrc" >:/images/FileTypePicture.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@ -777,8 +826,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Programs</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/FileTypeProgram.png</normaloff>:/images/FileTypeProgram.png</iconset>
|
||||
<iconset resource="images.qrc" >:/images/FileTypeProgram.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@ -786,8 +834,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Archives</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/FileTypeArchive.png</normaloff>:/images/FileTypeArchive.png</iconset>
|
||||
<iconset resource="images.qrc" >:/images/FileTypeArchive.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@ -795,8 +842,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Documents</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/FileTypeDocument.png</normaloff>:/images/FileTypeDocument.png</iconset>
|
||||
<iconset resource="images.qrc" >:/images/FileTypeDocument.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
@ -806,7 +852,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>20</height>
|
||||
@ -835,8 +881,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/find.png</normaloff>:/images/find.png</iconset>
|
||||
<iconset resource="images.qrc" >:/images/find.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
@ -872,7 +917,16 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -880,7 +934,16 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -898,7 +961,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
@ -935,7 +998,16 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -965,8 +1037,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/down_24x24.png</normaloff>:/images/down_24x24.png</iconset>
|
||||
<iconset resource="images.qrc" >:/images/down_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
@ -981,7 +1052,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
@ -1023,6 +1094,11 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="sortingEnabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Filename</string>
|
||||
|
Loading…
Reference in New Issue
Block a user