hide reset button when search field is empty

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2309 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-02-14 02:31:37 +00:00
parent 2f43e4152c
commit 850e756fe3
4 changed files with 410 additions and 157 deletions

View File

@ -119,6 +119,7 @@ SearchDialog::SearchDialog(QWidget *parent)
connect( ui.pushButtonDownload, SIGNAL( released ( void ) ), this, SLOT( download( void ) ) );
connect( ui.cloaseallsearchresultsButton, SIGNAL(clicked()), this, SLOT(searchRemoveAll()));
connect( ui.resetButton, SIGNAL(clicked()), this, SLOT(clearKeyword()));
connect( ui.lineEdit, SIGNAL( textChanged(const QString &)), this, SLOT(togglereset()));
//connect( ui.searchSummaryWidget, SIGNAL( itemSelectionChanged ( void ) ), this, SLOT( selectSearchResults( void ) ) );
@ -173,7 +174,7 @@ SearchDialog::SearchDialog(QWidget *parent)
ui.searchResultWidget->sortItems(SR_NAME_COL, Qt::AscendingOrder);
ui.resetButton->hide();
/* Hide platform specific features */
#ifdef Q_WS_WIN
@ -1114,3 +1115,18 @@ void SearchDialog::sendLinkTo( )
nMsgDialog->show();
}
void SearchDialog::togglereset()
{
QString text = ui.lineEdit->text();
if (text.isEmpty())
{
ui.resetButton->hide();
}
else
{
ui.resetButton->show();
}
}

View File

@ -85,6 +85,9 @@ private slots:
void clearKeyword();
void sendLinkTo();
void togglereset();
private:

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>659</width>
<height>336</height>
<width>651</width>
<height>340</height>
</rect>
</property>
<property name="sizePolicy">
@ -500,7 +500,87 @@
<enum>Qt::NoContextMenu</enum>
</property>
<property name="styleSheet">
<string notr="true">QToolButton, QPushButton, QComboBox {
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="bottomMargin">
<number>4</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>32</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QFrame#frame{
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #FEFEFE, stop:1 #E8E8E8);
border: 1px solid #CCCCCC;}</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/filefind.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>Arial</family>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="FileTypeComboBox">
<property name="styleSheet">
<string notr="true">QToolButton, QPushButton, QComboBox {
border-image: url(:/images/btn_26.png) 4;
border-width: 4;
padding: 0px 6px;
@ -540,41 +620,7 @@ QToolButton:pressed, QPushButton:pressed{
border-image: url(:/images/btn_26_pressed.png) 4;
}
</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>32</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QFrame#frame{
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #FEFEFE, stop:1 #E8E8E8);
border: 1px solid #CCCCCC;}</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item row="0" column="2">
<widget class="QComboBox" name="FileTypeComboBox">
</property>
<item>
<property name="text">
<string>Any</string>
@ -675,44 +721,107 @@ border: 1px solid #CCCCCC;}</string>
</spacer>
</item>
<item row="0" column="4">
<layout class="QGridLayout" name="gridLayout">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLineEdit" name="lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>3</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>23</height>
</size>
</property>
<item>
<widget class="QFrame" name="frame_2">
<property name="maximumSize">
<size>
<width>1677777</width>
<height>16777215</height>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
<property name="styleSheet">
<string notr="true">border: 1px solid #8B8B8B;
background: white;</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLineEdit" name="lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>3</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>11</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1677777</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Enter a Keyword here&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true">border: 1px solid #8B8B8B;
</property>
<property name="styleSheet">
<string notr="true">QLineEdit#lineEdit{background: transparent;
border: none;}
</string>
</property>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="resetButton">
<property name="minimumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="toolTip">
<string>Reset</string>
</property>
<property name="styleSheet">
<string notr="true">QPushButton
{
border-image: url(:/images/closenormal.png)
}
QPushButton:hover
{
border-image: url(:/images/closehover.png)
}
QPushButton:pressed {
border-image: url(:/images/closepressed.png)
}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<item>
<widget class="QPushButton" name="pushButtonsearch">
<property name="toolTip">
<string>Start Search</string>
@ -745,16 +854,6 @@ border-image: url(:/images/btn3.png) 4;
</layout>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="resetButton">
<property name="toolTip">
<string>Reset</string>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item row="0" column="6">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -770,50 +869,58 @@ border-image: url(:/images/btn3.png) 4;
</property>
</spacer>
</item>
<item row="0" column="7">
<item row="0" column="6">
<widget class="QPushButton" name="toggleAdvancedSearchBtn">
<property name="toolTip">
<string>Advanced Search</string>
</property>
<property name="styleSheet">
<string notr="true">QToolButton, QPushButton, QComboBox {
border-image: url(:/images/btn_26.png) 4;
border-width: 4;
padding: 0px 6px;
font-size: 12px;
}
*{
color: black;
}
QComboBox QAbstractItemView {
background-color:white;
}
QComboBox::down-arrow {
image: url(:/images/combobox_arrow.png);
}
QComboBox:drop-down
{
subcontrol-origin: padding;
subcontrol-position: top right;
border-left-style: none;
border-top-right-radius: 1px;
border-bottom-right-radius: 1px;
}
QToolButton:hover, QPushButton:hover, QComboBox:hover {
border-image: url(:/images/btn_26_hover.png) 4;
}
QToolButton:disabled, QPushButton:disabled, QComboBox::disabled {
color:gray;
}
QToolButton:pressed, QPushButton:pressed{
border-image: url(:/images/btn_26_pressed.png) 4;
}
</string>
</property>
<property name="text">
<string>Advanced</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/filefind.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>Arial</family>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -936,6 +1043,9 @@ border-image: url(:/images/btn3.png) 4;
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<property name="topMargin">
<number>4</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
@ -946,6 +1056,48 @@ border-image: url(:/images/btn3.png) 4;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;Close all Search Resullts&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true">QToolButton, QPushButton, QComboBox {
border-image: url(:/images/btn_26.png) 4;
border-width: 4;
padding: 0px 6px;
font-size: 12px;
}
*{
color: black;
}
QComboBox QAbstractItemView {
background-color:white;
}
QComboBox::down-arrow {
image: url(:/images/combobox_arrow.png);
}
QComboBox:drop-down
{
subcontrol-origin: padding;
subcontrol-position: top right;
border-left-style: none;
border-top-right-radius: 1px;
border-bottom-right-radius: 1px;
}
QToolButton:hover, QPushButton:hover, QComboBox:hover {
border-image: url(:/images/btn_26_hover.png) 4;
}
QToolButton:disabled, QPushButton:disabled, QComboBox::disabled {
color:gray;
}
QToolButton:pressed, QPushButton:pressed{
border-image: url(:/images/btn_26_pressed.png) 4;
}
</string>
</property>
<property name="text">
<string>Close All Search Results</string>
@ -985,6 +1137,48 @@ p, li { white-space: pre-wrap; }
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;Download Selected&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true">QToolButton, QPushButton, QComboBox {
border-image: url(:/images/btn_26.png) 4;
border-width: 4;
padding: 0px 6px;
font-size: 12px;
}
*{
color: black;
}
QComboBox QAbstractItemView {
background-color:white;
}
QComboBox::down-arrow {
image: url(:/images/combobox_arrow.png);
}
QComboBox:drop-down
{
subcontrol-origin: padding;
subcontrol-position: top right;
border-left-style: none;
border-top-right-radius: 1px;
border-bottom-right-radius: 1px;
}
QToolButton:hover, QPushButton:hover, QComboBox:hover {
border-image: url(:/images/btn_26_hover.png) 4;
}
QToolButton:disabled, QPushButton:disabled, QComboBox::disabled {
color:gray;
}
QToolButton:pressed, QPushButton:pressed{
border-image: url(:/images/btn_26_pressed.png) 4;
}
</string>
</property>
<property name="text">
<string>Download</string>

View File

@ -502,70 +502,110 @@
<property name="contextMenuPolicy">
<enum>Qt::PreventContextMenu</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="minimumSize">
<size>
<width>40</width>
<height>20</height>
<width>0</width>
<height>32</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>32</height>
</size>
</property>
<property name="spacing">
<number>6</number>
<property name="styleSheet">
<string notr="true">QFrame#frame{
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #FEFEFE, stop:1 #E8E8E8);
border: 1px solid #CCCCCC;}</string>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/down.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/down.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Downloads:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>483</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item row="1" column="0">
<widget class="QTreeView" name="downloadList">
<property name="font">
<font>
@ -624,7 +664,7 @@ p, li { white-space: pre-wrap; }
</font>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
@ -687,8 +727,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
<width>596</width>
<height>102</height>
</rect>
</property>
</widget>