]> git.sesse.net Git - vlc/blob - plugins/kde/kde_pluginsbox.cpp
* ALL: the first libvlc commit.
[vlc] / plugins / kde / kde_pluginsbox.cpp
1 #include "kde_pluginsbox.h"
2 #include "kde_preferences.h"
3
4 #include <qgroupbox.h>
5 #include <qhbox.h>
6 #include <qlabel.h>
7 #include <qvbox.h>
8 #include <klistview.h>
9 #include <kbuttonbox.h>
10
11 KPluginsBox::KPluginsBox(intf_thread_t *p_intf,
12                          QString text, QString value, QWidget *parent,
13                          int spacing, KPreferences *pref) :
14     QGroupBox( 1, Vertical, text, parent )
15 {
16     owner = pref;
17     this->p_intf = p_intf;
18     QVBox *item_vbox = new QVBox( this );
19     item_vbox->setSpacing(spacing);
20     
21     listView = new KListView(item_vbox);
22     listView->setAllColumnsShowFocus(true);
23     listView->addColumn(_("Name"));
24     listView->addColumn(_("Description"));
25     KButtonBox *item_bbox = new KButtonBox(item_vbox);
26     configure = item_bbox->addButton( _("Configure") );
27     configure->setEnabled(false);
28     selectButton = item_bbox->addButton( _("Select") );
29     QHBox *item_hbox = new QHBox(item_vbox);
30     item_hbox->setSpacing(spacing);
31     new QLabel( _("Selected:"), item_hbox );
32     line = new KLineEdit( value, item_hbox );
33     connect(selectButton, SIGNAL(clicked()), this, SLOT(selectClicked()));
34     connect(configure, SIGNAL(clicked()), this, SLOT(configureClicked()));
35     connect(listView, SIGNAL(selectionChanged( QListViewItem *)),
36             this, SLOT( selectionChanged( QListViewItem *)));
37 }
38
39 KPluginsBox::~KPluginsBox()
40 {
41     ;
42 }
43
44 QListView* KPluginsBox::getListView()
45 {
46     return listView;
47 }
48
49 void KPluginsBox::selectClicked()
50 {
51     if (listView->selectedItem()) {
52         line->setText(listView->selectedItem()->text(0));
53         emit selectionChanged(listView->selectedItem()->text(0));
54     }
55 }
56
57 void KPluginsBox::configureClicked()
58 {
59     if (listView->selectedItem()) {
60         new KPreferences(p_intf, listView->selectedItem()->text(0), this);
61     }
62 }
63 void KPluginsBox::selectionChanged( QListViewItem *item )
64 {
65     selectButton->setEnabled(true);
66     /* look for module 'psz_name' */
67     configure->setEnabled(owner->isConfigureable(item->text(0)));
68 }