Commit bc01f895 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf
Browse files

[Qt] Implement a kind of rememberance in Open Network Dialog.

The code is suboptimal since it does save more often than when accept() is called. This will be fixed in the future.
parent d28937e8
......@@ -44,6 +44,7 @@
#include <QDirModel>
#include <QScrollArea>
#include <QUrl>
#include <QStringListModel>
#define I_DEVICE_TOOLTIP N_("Select the device or the VIDEO_TS directory")
......@@ -447,10 +448,29 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
ui.protocolCombo->addItem("RTMP", QVariant("rtmp"));
updateProtocol( ui.protocolCombo->currentIndex() );
if( config_GetInt( p_intf, "qt-recentplay" ) )
{
mrlList = new QStringListModel(
getSettings()->value( "Open/netMRL" ).toStringList() );
QCompleter *completer = new QCompleter( mrlList, this );
ui.addressText->setCompleter( completer );
CONNECT( ui.addressText, editingFinished(), this, updateCompleter() );
}
else
mrlList = NULL;
}
NetOpenPanel::~NetOpenPanel()
{}
{
if( !mrlList ) return;
QStringList tempL = mrlList->stringList();
while( tempL.size() > 8 ) tempL.removeFirst();
getSettings()->setValue( "Open/netMRL", tempL );
}
void NetOpenPanel::clear()
{}
......@@ -557,14 +577,20 @@ void NetOpenPanel::updateMRL() {
}
}
// Encode the boring stuffs
if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
mrl += " :access-filter=timeshift";
}
emit mrlUpdated( mrl );
}
void NetOpenPanel::updateCompleter()
{
assert( mrlList );
QStringList tempL = mrlList->stringList();
tempL.append( ui.addressText->text() );
mrlList->setStringList( tempL );
}
/**************************************************************************
* Open Capture device ( DVB, PVR, V4L, and similar ) *
**************************************************************************/
......
......@@ -81,6 +81,7 @@ static const char *psz_devModule[] = { "v4l", "v4l2", "pvr", "dvb", "bda",
class QWidget;
class QLineEdit;
class QString;
class QStringListModel;
class OpenPanel: public QWidget
{
......@@ -143,10 +144,12 @@ public:
virtual void clear() ;
private:
Ui::OpenNetwork ui;
QStringListModel *mrlList;
public slots:
virtual void updateMRL();
private slots:
void updateProtocol( int );
void updateCompleter();
};
class DiscOpenPanel: public OpenPanel
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment