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