Changeset 121 for smplayer/vendor/current/src/inputurl.cpp
- Timestamp:
- Mar 15, 2012, 5:14:10 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/vendor/current/src/inputurl.cpp
r118 r121 1 1 /* smplayer, GUI front-end for mplayer. 2 Copyright (C) 2006-201 1 Ricardo Villalba <rvm@escomposlinux.org>2 Copyright (C) 2006-2012 Ricardo Villalba <rvm@users.sourceforge.net> 3 3 4 4 This program is free software; you can redistribute it and/or modify … … 19 19 #include "inputurl.h" 20 20 #include "images.h" 21 #include "mylineedit.h" 21 22 22 23 InputURL::InputURL( QWidget* parent, Qt::WindowFlags f ) … … 25 26 setupUi(this); 26 27 27 url_icon->setPixmap( Images::icon("url_big") ); 28 setMinimumSize( QSize(500,140) ); 29 setMaximumSize( QSize(600,170) ); 30 //layout()->setSizeConstraint(QLayout::SetFixedSize); 31 32 url_icon->setPixmap( Images::icon("url_big", 48) ); 28 33 url_edit->setFocus(); 29 34 30 playlist_check->setWhatsThis( 31 tr("If this option is checked, the URL will be treated as a playlist: " 32 "it will be opened as text and will play the URLs in it.") ); 33 34 connect(url_edit, SIGNAL(editTextChanged(const QString &)), this, SLOT(textChanged(const QString &))); 35 connect(url_edit, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged(int))); 36 connect(playlist_check, SIGNAL(stateChanged(int)), this, SLOT(playlistChanged(int))); 35 MyLineEdit * edit = new MyLineEdit(this); 36 url_edit->setLineEdit(edit); 37 37 } 38 38 … … 40 40 } 41 41 42 void InputURL::setURL(QString url , bool is_playlist) {43 url_edit->addItem(url , is_playlist);42 void InputURL::setURL(QString url) { 43 url_edit->addItem(url); 44 44 } 45 45 … … 48 48 } 49 49 50 void InputURL::setPlaylist(bool b) {51 playlist_check->setChecked(b);52 /*53 int pos = url_edit->currentIndex();54 url_edit->setItemData(pos, b);55 */56 }57 58 bool InputURL::isPlaylist() {59 return playlist_check->isChecked();60 }61 62 void InputURL::indexChanged(int) {63 qDebug("InputURL::indexChanged");64 int pos = url_edit->currentIndex();65 if (url_edit->itemText(pos) == url_edit->currentText()) {66 playlist_check->setChecked( url_edit->itemData(pos).toBool() );67 }68 }69 70 void InputURL::textChanged(const QString & new_text) {71 qDebug("InputURL::textChanged");72 QString s = new_text.trimmed();73 /*74 if (s != new_text) {75 url_edit->setEditText(s);76 return;77 }78 */79 QRegExp rx("\\.ram$|\\.asx$|\\.m3u$|\\.pls$", Qt::CaseInsensitive);80 setPlaylist( (rx.indexIn(s) != -1) );81 }82 83 void InputURL::playlistChanged(int state) {84 /*85 int pos = url_edit->currentIndex();86 if (url_edit->itemText(pos) == url_edit->currentText()) {87 bool is_playlist = (state == Qt::Checked);88 url_edit->setItemIcon( pos, is_playlist ? Images::icon("playlist") : QIcon() );89 }90 */91 }92 93 50 #include "moc_inputurl.cpp"
Note:
See TracChangeset
for help on using the changeset viewer.