diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/addurldialog.cpp | 47 | ||||
| -rw-r--r-- | src/addurldialog.h | 27 | ||||
| -rw-r--r-- | src/addurldialog.ui | 76 |
3 files changed, 150 insertions, 0 deletions
diff --git a/src/addurldialog.cpp b/src/addurldialog.cpp new file mode 100644 index 000000000..f59dad7ac --- /dev/null +++ b/src/addurldialog.cpp @@ -0,0 +1,47 @@ +#include "addurldialog.h" + +#include "playlistmodel.h" + +AddUrlDialog::AddUrlDialog( QWidget * parent, Qt::WindowFlags f) : QDialog(parent,f) +{ + setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); +} + +AddUrlDialog::~AddUrlDialog() +{} + + + +QPointer<AddUrlDialog> AddUrlDialog::instance = 0; + +void AddUrlDialog::popup(QWidget* parent,PlayListModel* model ) +{ + if(!instance) + { + instance = new AddUrlDialog(parent); + instance->setModel(model); + } + + instance->show(); + instance->raise(); +} + +void AddUrlDialog::accept( ) +{ + if(!urlComboBox->currentText().isEmpty()) + { + QString s = urlComboBox->currentText(); + if(!s.startsWith("http://")) + s.prepend("http://"); + + m_model->addFile(s); + } + + QDialog::accept(); +} + +void AddUrlDialog::setModel( PlayListModel *m ) +{ + m_model = m; +} diff --git a/src/addurldialog.h b/src/addurldialog.h new file mode 100644 index 000000000..943e3869f --- /dev/null +++ b/src/addurldialog.h @@ -0,0 +1,27 @@ +#ifndef ADDURLDIALOG_H +#define ADDURLDIALOG_H + +#include "ui_addurldialog.h" +#include <QDialog> +#include <QPointer> + + +class PlayListModel; + +class AddUrlDialog : public QDialog , private Ui::AddUrlDialog +{ + Q_OBJECT +public: + static void popup(QWidget* parent ,PlayListModel*); +protected: + AddUrlDialog( QWidget * parent = 0, Qt::WindowFlags f = 0 ); + ~AddUrlDialog(); +protected slots: + virtual void accept(); +private: + void setModel(PlayListModel*); + static QPointer<AddUrlDialog> instance; + PlayListModel* m_model; + +}; +#endif //ADDURLDIALOG_H diff --git a/src/addurldialog.ui b/src/addurldialog.ui new file mode 100644 index 000000000..46031b849 --- /dev/null +++ b/src/addurldialog.ui @@ -0,0 +1,76 @@ +<ui version="4.0" > + <class>AddUrlDialog</class> + <widget class="QDialog" name="AddUrlDialog" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>394</width> + <height>80</height> + </rect> + </property> + <property name="windowTitle" > + <string>Enter URL to add</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QComboBox" name="urlComboBox" > + <property name="editable" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons" > + <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>AddUrlDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel" > + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel" > + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>AddUrlDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel" > + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel" > + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> |
