continue;
}
data = new PrefsItemData();
- data->name = QString( qfu( config_CategoryNameGet(
+ data->name = QString( qfu( config_CategoryNameGet(
p_item->i_value)) );
psz_help = config_CategoryHelpGet( p_item->i_value );
if( psz_help )
QLabel *label = new QLabel( head );
global_layout->addWidget( label );
- QFont myFont = QApplication::font(0);
+ QFont myFont = QApplication::font( static_cast<QWidget*>(0) );
myFont.setPointSize( myFont.pointSize() + 3 ); myFont.setBold( true );
label->setFont( myFont );
QGridLayout *layout = new QGridLayout();
int i_line = 0, i_boxline = 0;
+ bool has_hotkey = false;
if( p_item ) do
{
box = new QGroupBox( qfu(p_item->psz_text) );
boxlayout = new QGridLayout();
}
+ /* Only one hotkey control */
+ if( has_hotkey && p_item->i_type & CONFIG_ITEM && p_item->psz_name &&
+ strstr( p_item->psz_name, "key-" ) )
+ continue;
+ if( p_item->i_type & CONFIG_ITEM && p_item->psz_name &&
+ strstr( p_item->psz_name, "key-" ) )
+ has_hotkey = true;
ConfigControl *control;
if( ! box )
if( !control )
continue;
+ if( has_hotkey )
+ {
+ /* A hotkey widget takes 2 lines */
+ if( box ) i_boxline ++;
+ else i_line++;
+ }
+
if( box ) i_boxline++;
else i_line++;
controls.append( control );
case CONFIG_ITEM_DIRECTORY:
fprintf( stderr, "Todo (CONFIG_ITEM_DIRECTORY)\n" );
break;
+ case CONFIG_ITEM_KEY:
+ p_control = new KeySelectorControl( p_this, p_item, parent, l, line );
+ break;
case CONFIG_ITEM_BOOL:
p_control = new BoolConfigControl( p_this, p_item, parent, l, line );
break;
}
case 2:
{
- VFloatConfigControl *vfcc =
+ VFloatConfigControl *vfcc =
qobject_cast<VFloatConfigControl *>(this);
config_PutFloat( p_intf, vfcc->getName(), vfcc->getValue() );
break;
qobject_cast<VStringConfigControl *>(this);
config_PutPsz( p_intf, vscc->getName(), qta( vscc->getValue() ) );
}
+ case 4:
+ {
+ KeySelectorControl *ksc = qobject_cast<KeySelectorControl *>(this);
+ ksc->doApply();
+ }
}
}
spin->setMaximum( (double)p_item->f_max );
spin->setMinimum( (double)p_item->f_min );
}
+
+
+/**********************************************************************
+ * Key selector widget
+ **********************************************************************/
+KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
+ module_config_t *_p_item,
+ QWidget *_parent, QGridLayout *l,
+ int &line ) :
+ ConfigControl( _p_this, _p_item, _parent )
+
+{
+ label = new QLabel( qtr("Select an action to change the associated hotkey") );
+ table = new QTreeWidget( 0 );
+ finish();
+
+ if( !l )
+ {
+ QVBoxLayout *layout = new QVBoxLayout();
+ layout->addWidget( label, 0 ); layout->addWidget( table, 1 );
+ widget->setLayout( layout );
+ }
+ else
+ {
+ l->addWidget( label, line, 0, 1, 2 );
+ l->addWidget( table, line+1, 0, 1,2 );
+ }
+}
+
+void KeySelectorControl::finish()
+{
+ if( label )
+ label->setToolTip( qfu(p_item->psz_longtext) );
+
+ /* Fill the table */
+ table->setColumnCount( 2 );
+ table->setAlternatingRowColors( true );
+
+ module_t *p_main = config_FindModule( p_this, "main" );
+ assert( p_main );
+ module_config_t *p_item = p_main->p_config;
+
+ if( p_item ) do
+ {
+ if( p_item->i_type & CONFIG_ITEM && p_item->psz_name &&
+ strstr( p_item->psz_name , "key-" ) )
+ {
+ QTreeWidgetItem *treeItem = new QTreeWidgetItem();
+ treeItem->setText( 0, qfu( p_item->psz_text ) );
+ treeItem->setText( 1, p_item->psz_value );
+ treeItem->setData( 0, Qt::UserRole, QVariant( p_item->psz_name ) );
+ table->addTopLevelItem( treeItem );
+ }
+ } while( p_item->i_type != CONFIG_HINT_END && p_item++ );
+}
+
+void KeySelectorControl::doApply()
+{
+
+}
#define _INFOPANELS_H_
#include <vlc/vlc.h>
#include <QWidget>
+#include <QTreeWidget>
#include <QLineEdit>
#include <QSpinBox>
#include <QDoubleSpinBox>
};
#endif
+/**********************************************************************
+ * Key selector widget
+ **********************************************************************/
+class KeySelectorControl : public ConfigControl
+{
+ Q_OBJECT;
+public:
+ KeySelectorControl( vlc_object_t *, module_config_t *, QWidget *,
+ QGridLayout*, int& );
+ virtual int getType() { return 4; }
+ virtual ~KeySelectorControl() {};
+ virtual void hide() { table->hide(); label->hide(); }
+ virtual void show() { table->show(); label->show(); }
+ void doApply();
+private:
+ void finish();
+ QLabel *label;
+ QTreeWidget *table;
+};
+
#endif