[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kmplayer/0.12] src: Fix the url links in the config dialog
From:       Koos Vriezen <koos.vriezen () gmail ! com>
Date:       2016-09-24 11:26:37
Message-ID: E1bnl6L-0005Bk-P0 () code ! kde ! org
[Download RAW message or body]

Git commit abc471e2ea7799ce9464c85033bba8f14fc6adb2 by Koos Vriezen.
Committed on 24/09/2016 at 11:22.
Pushed by vriezen into branch '0.12'.

Fix the url links in the config dialog

The changed signal didn't work, the combobox wasn't propertly attached
to the kurlrequester and the current url wasn't visible when not empty.

M  +16   -2    src/kmplayerconfig.cpp
M  +4    -4    src/pref.cpp

http://commits.kde.org/kmplayer/abc471e2ea7799ce9464c85033bba8f14fc6adb2

diff --git a/src/kmplayerconfig.cpp b/src/kmplayerconfig.cpp
index b99e73d..ff5a5aa 100644
--- a/src/kmplayerconfig.cpp
+++ b/src/kmplayerconfig.cpp
@@ -449,13 +449,27 @@ void Settings::show (const char * pagename) {
         colors[i].newcolor = colors[i].color;
     for (int i = 0; i < int (FontSetting::last_target); i++)
         fonts[i].newfont = fonts[i].font;
+
+    QString current = m_player->source()->url().prettyUrl();
+    if (!current.isEmpty() && !urllist.contains(current))
+        urllist.push_front(current);
     configdialog->m_SourcePageURL->urllist->clear ();
     configdialog->m_SourcePageURL->urllist->insertItems (0, urllist);
-    configdialog->m_SourcePageURL->urllist->setCurrentItem (m_player->source ()->url \
().prettyUrl ()); +    if (!current.isEmpty())
+        configdialog->m_SourcePageURL->urllist->setCurrentText(current);
+    else
+        configdialog->m_SourcePageURL->urllist->setCurrentIndex(-1);
+    current = m_player->source()->subUrl().prettyUrl();
+    if (!current.isEmpty() && !sub_urllist.contains(current))
+        sub_urllist.push_front(current);
     configdialog->m_SourcePageURL->sub_urllist->clear ();
     configdialog->m_SourcePageURL->sub_urllist->insertItems (0, sub_urllist);
-    configdialog->m_SourcePageURL->sub_urllist->setCurrentItem (m_player->source \
()->subUrl ().prettyUrl ()); +    if (!current.isEmpty())
+        configdialog->m_SourcePageURL->sub_urllist->setCurrentText(current);
+    else
+        configdialog->m_SourcePageURL->sub_urllist->setCurrentIndex(-1);
     configdialog->m_SourcePageURL->changed = false;
+
     configdialog->m_SourcePageURL->prefBitRate->setText (QString::number \
                (prefbitrate));
     configdialog->m_SourcePageURL->maxBitRate->setText (QString::number \
(maxbitrate));  
diff --git a/src/pref.cpp b/src/pref.cpp
index c28dbe8..5c872a6 100644
--- a/src/pref.cpp
+++ b/src/pref.cpp
@@ -368,7 +368,7 @@ KDE_NO_CDTOR_EXPORT PrefSourcePageURL::PrefSourcePageURL (QWidget \
*parent)  urllist = new KComboBox (true);
     urllist->setMaxCount (20);
     urllist->setDuplicatesEnabled (false); // not that it helps much :(
-    url = new KUrlRequester(urllist);
+    url = new KUrlRequester(urllist, NULL);
     url->setWhatsThis(i18n ("Location of the playable item"));
     //url->setShowLocalProtocol (true);
     url->setSizePolicy (QSizePolicy (QSizePolicy::Expanding, \
QSizePolicy::Preferred)); @@ -376,7 +376,7 @@ KDE_NO_CDTOR_EXPORT \
PrefSourcePageURL::PrefSourcePageURL (QWidget *parent)  sub_urllist = new \
KComboBox(true);  sub_urllist->setMaxCount (20);
     sub_urllist->setDuplicatesEnabled (false); // not that it helps much :(
-    sub_url = new KUrlRequester(sub_urllist);
+    sub_url = new KUrlRequester(sub_urllist, NULL);
     sub_url->setWhatsThis(i18n ("Optional location of a file containing the \
                subtitles of the URL above"));
     sub_url->setSizePolicy (QSizePolicy (QSizePolicy::Expanding, \
QSizePolicy::Preferred));  backend = new QListWidget;
@@ -427,9 +427,9 @@ KDE_NO_CDTOR_EXPORT PrefSourcePageURL::PrefSourcePageURL (QWidget \
                *parent)
     vbox->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, \
QSizePolicy::Expanding));  setLayout(vbox);
 
-    connect (urllist, SIGNAL(currentTextChanged (const QString &)),
+    connect (url, SIGNAL(textChanged(const QString&)),
              this, SLOT (slotTextChanged (const QString &)));
-    connect (sub_urllist, SIGNAL(currentTextChanged (const QString &)),
+    connect (sub_url, SIGNAL(textChanged(const QString&)),
              this, SLOT (slotTextChanged (const QString &)));
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic