1 /*****************************************************************************
2 * pluginbox.cpp: the pluginbox class
3 *****************************************************************************
4 * Copyright (C) 2001 VideoLAN
7 * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002
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.
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.
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"
26 #include <qgroupbox.h>
30 #include <klistview.h>
31 #include <kbuttonbox.h>
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 )
39 this->p_intf = p_intf;
40 QVBox *item_vbox = new QVBox( this );
41 item_vbox->setSpacing(spacing);
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 *)));
58 KPluginsBox::~KPluginsBox()
63 QListView* KPluginsBox::getListView()
68 void KPluginsBox::selectClicked()
70 if (listView->selectedItem()) {
71 line->setText(listView->selectedItem()->text(0));
72 emit selectionChanged(listView->selectedItem()->text(0));
76 void KPluginsBox::selectionChanged( QListViewItem *item )
78 selectButton->setEnabled(true);