23
23
: QDialog(parent, f)
26
27
url_icon->setPixmap( Images::icon("url_big") );
27
28
url_edit->setFocus();
29
30
playlist_check->setWhatsThis(
30
31
tr("If this option is checked, the URL will be treated as a playlist: "
31
32
"it will be opened as text and will play the URLs in it.") );
34
connect(url_edit, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged()));
35
connect(playlist_check, SIGNAL(stateChanged(int)), this, SLOT(playlistChanged(int)));
34
38
InputURL::~InputURL() {
37
void InputURL::setURL(QString url) {
38
url_edit->setText(url);
39
url_edit->selectAll();
41
void InputURL::setURL(QString url, bool is_playlist) {
42
url_edit->addItem(url, is_playlist);
42
45
QString InputURL::url() {
43
return url_edit->text();
46
return url_edit->currentText();
46
49
void InputURL::setPlaylist(bool b) {
47
50
playlist_check->setChecked(b);
52
int pos = url_edit->currentIndex();
53
url_edit->setItemData(pos, b);
50
57
bool InputURL::isPlaylist() {
51
58
return playlist_check->isChecked();
61
void InputURL::indexChanged(void) {
62
int pos = url_edit->currentIndex();
63
if (url_edit->itemText(pos) == url_edit->currentText()) {
64
playlist_check->setChecked( url_edit->itemData(pos).toBool() );
68
void InputURL::playlistChanged(int state) {
70
int pos = url_edit->currentIndex();
71
if (url_edit->itemText(pos) == url_edit->currentText()) {
72
bool is_playlist = (state == Qt::Checked);
73
url_edit->setItemIcon( pos, is_playlist ? Images::icon("playlist") : QIcon() );
54
78
#include "moc_inputurl.cpp"