[vlc-commits] commit: Qt: NetOpenPanel: add drop-down list (Francois Cartegnie )
git at videolan.org
git at videolan.org
Wed Sep 29 21:41:16 CEST 2010
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Sep 29 17:47:02 2010 +0200| [2a100fcd186304e600d6d896325855836fa899e6] | committer: Francois Cartegnie
Qt: NetOpenPanel: add drop-down list
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2a100fcd186304e600d6d896325855836fa899e6
---
modules/gui/qt4/components/open_panels.cpp | 21 +++++++++++----------
modules/gui/qt4/components/open_panels.hpp | 2 +-
modules/gui/qt4/ui/open_net.ui | 24 ++++++++++++------------
3 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp
index 59fe5c0..ae75fc6 100644
--- a/modules/gui/qt4/components/open_panels.cpp
+++ b/modules/gui/qt4/components/open_panels.cpp
@@ -539,21 +539,22 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
ui.setupUi( this );
/* CONNECTs */
- CONNECT( ui.urlText, textChanged( const QString& ), this, updateMRL());
+ CONNECT( ui.urlComboBox->lineEdit(), textChanged( const QString& ), this, updateMRL());
+ CONNECT( ui.urlComboBox, currentIndexChanged( const QString& ), this, updateMRL());
if( var_InheritBool( p_intf, "qt-recentplay" ) )
{
mrlList = new QStringListModel(
getSettings()->value( "Open/netMRL" ).toStringList() );
- QCompleter *completer = new QCompleter( mrlList, this );
- ui.urlText->setCompleter( completer );
-
- CONNECT( ui.urlText, editingFinished(), this, updateCompleter() );
+ ui.urlComboBox->setModel( mrlList );
+ ui.urlComboBox->clearEditText();
+ CONNECT( ui.urlComboBox->lineEdit(), editingFinished(), this, updateModel() );
}
else
mrlList = NULL;
- ui.urlText->setValidator( new UrlValidator( this ) );
+ ui.urlComboBox->setValidator( new UrlValidator( this ) );
+ ui.urlComboBox->setFocus();
}
NetOpenPanel::~NetOpenPanel()
@@ -601,7 +602,7 @@ void NetOpenPanel::updateMRL()
{ "udp", "udp" },
};
- QString url = ui.urlText->text();
+ QString url = ui.urlComboBox->lineEdit()->text();
if( !url.contains( "://") )
return; /* nothing to do this far */
@@ -618,12 +619,12 @@ void NetOpenPanel::updateMRL()
emit mrlUpdated( qsl, "" );
}
-void NetOpenPanel::updateCompleter()
+void NetOpenPanel::updateModel()
{
assert( mrlList );
QStringList tempL = mrlList->stringList();
- if( !tempL.contains( ui.urlText->text() ) )
- tempL.append( ui.urlText->text() );
+ if( !tempL.contains( ui.urlComboBox->lineEdit()->text() ) )
+ tempL.append( ui.urlComboBox->lineEdit()->text() );
mrlList->setStringList( tempL );
}
diff --git a/modules/gui/qt4/components/open_panels.hpp b/modules/gui/qt4/components/open_panels.hpp
index bcd09e2..bef2c8c 100644
--- a/modules/gui/qt4/components/open_panels.hpp
+++ b/modules/gui/qt4/components/open_panels.hpp
@@ -146,7 +146,7 @@ private:
public slots:
virtual void updateMRL();
private slots:
- void updateCompleter();
+ void updateModel();
};
class UrlValidator : public QValidator
diff --git a/modules/gui/qt4/ui/open_net.ui b/modules/gui/qt4/ui/open_net.ui
index 34b6d22..91e5319 100644
--- a/modules/gui/qt4/ui/open_net.ui
+++ b/modules/gui/qt4/ui/open_net.ui
@@ -32,16 +32,6 @@
<property name="text">
<string>Please enter a network URL:</string>
</property>
- <property name="buddy">
- <cstring>urlText</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLineEdit" name="urlText">
- <property name="toolTip">
- <string>Enter the URL of the network stream here.</string>
- </property>
</widget>
</item>
<item row="2" column="0">
@@ -52,7 +42,7 @@
p, li { white-space: pre-wrap; }
p { margin: 0; -qt-block-indent: 0; text-indent: 0;}
body { font-family: 'sans'; font-size: 8pt; font-weight: 400; }
-p > span { color: #838383; }
+p > span { color: #838383; }
</style></head><body>
<p><span>http://www.example.com/stream.avi</span></p>
<p><span>rtp://@:1234</span></p>
@@ -68,6 +58,16 @@ p > span { color: #838383; }
</property>
</widget>
</item>
+ <item row="1" column="0">
+ <widget class="QComboBox" name="urlComboBox">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="insertPolicy">
+ <enum>QComboBox::NoInsert</enum>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -90,7 +90,7 @@ p > span { color: #838383; }
</layout>
</widget>
<tabstops>
- <tabstop>urlText</tabstop>
+ <tabstop>urlComboBox</tabstop>
</tabstops>
<resources/>
<connections/>
More information about the vlc-commits
mailing list