]> git.sesse.net Git - vlc/blob - modules/gui/kde/pluginsbox.cpp
93b24d8191f46fbaedf1ef33fbf6e06c398a78be
[vlc] / modules / gui / kde / pluginsbox.cpp
1 /*****************************************************************************
2  * pluginbox.cpp: the pluginbox class
3  *****************************************************************************
4  * Copyright (C) 2001 VideoLAN
5  * $Id: pluginsbox.cpp,v 1.3 2003/03/29 14:30:55 sigmunau Exp $
6  *
7  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  * 
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23 #include "pluginsbox.h"
24 #include "preferences.h"
25
26 #include <qgroupbox.h>
27 #include <qhbox.h>
28 #include <qlabel.h>
29 #include <qvbox.h>
30 #include <klistview.h>
31 #include <kbuttonbox.h>
32
33 KPluginsBox::KPluginsBox(intf_thread_t *p_intf,
34                          QString text, QString value, QWidget *parent,
35                          int spacing, KPreferences *pref) :
36     QGroupBox( 1, Vertical, text, parent )
37 {
38     owner = pref;
39     this->p_intf = p_intf;
40     QVBox *item_vbox = new QVBox( this );
41     item_vbox->setSpacing(spacing);
42     
43     listView = new KListView(item_vbox);
44     listView->setAllColumnsShowFocus(true);
45     listView->addColumn(_("Name"));
46     listView->addColumn(_("Description"));
47     KButtonBox *item_bbox = new KButtonBox(item_vbox);
48     selectButton = item_bbox->addButton( _("Select") );
49     QHBox *item_hbox = new QHBox(item_vbox);
50     item_hbox->setSpacing(spacing);
51     new QLabel( _("Selected:"), item_hbox );
52     line = new KLineEdit( value, item_hbox );
53     connect(selectButton, SIGNAL(clicked()), this, SLOT(selectClicked()));
54     connect(listView, SIGNAL(selectionChanged( QListViewItem *)),
55             this, SLOT( selectionChanged( QListViewItem *)));
56 }
57
58 KPluginsBox::~KPluginsBox()
59 {
60     ;
61 }
62
63 QListView* KPluginsBox::getListView()
64 {
65     return listView;
66 }
67
68 void KPluginsBox::selectClicked()
69 {
70     if (listView->selectedItem()) {
71         line->setText(listView->selectedItem()->text(0));
72         emit selectionChanged(listView->selectedItem()->text(0));
73     }
74 }
75
76 void KPluginsBox::selectionChanged( QListViewItem *item )
77 {
78     selectButton->setEnabled(true);
79 }