[vlmc-devel] commit: EffectInstanceWidget: Improving GUI and cleaning code. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Sun Aug 22 22:54:19 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sun Aug 22 01:11:37 2010 +0200| [dc5db88aed9ed89aca35a0bf9ae548787439d013] | committer: Hugo Beauzée-Luyssen
EffectInstanceWidget: Improving GUI and cleaning code.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=dc5db88aed9ed89aca35a0bf9ae548787439d013
---
src/CMakeLists.txt | 1 +
src/Gui/effectsengine/EffectInstanceWidget.cpp | 41 +++++--
src/Gui/effectsengine/EffectInstanceWidget.h | 8 +-
src/Gui/effectsengine/ui/EffectInstanceWidget.ui | 137 ++++++++++++++++++++++
4 files changed, 177 insertions(+), 10 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6ca9bde..26b49b6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -284,6 +284,7 @@ ELSE(NOT WITH_GUI)
SET(VLMC_UIS
Gui/effectsengine/ui/EffectsList.ui
+ Gui/effectsengine/ui/EffectInstanceWidget.ui
Gui/export/RendererSettings.ui
Gui/export/ShareOnYoutube.ui
Gui/import/ui/ImportController.ui
diff --git a/src/Gui/effectsengine/EffectInstanceWidget.cpp b/src/Gui/effectsengine/EffectInstanceWidget.cpp
index 1843c90..0e7f052 100644
--- a/src/Gui/effectsengine/EffectInstanceWidget.cpp
+++ b/src/Gui/effectsengine/EffectInstanceWidget.cpp
@@ -30,17 +30,18 @@
#include "EffectSettingValue.h"
#include <QFormLayout>
+#include <QGroupBox>
#include <QLabel>
+#include <QVBoxLayout>
EffectInstanceWidget::EffectInstanceWidget( EffectInstance *effect, QWidget *parent ) :
- QDialog( parent )
+ QDialog( parent ),
+ m_ui( new Ui::EffectSettingWidget )
{
- QFormLayout *layout = new QFormLayout( this );
-
- layout->setFieldGrowthPolicy( QFormLayout::AllNonFixedFieldsGrow );
- layout->addRow( tr( "Name" ), new QLabel( effect->effect()->name(), this ) );
- layout->addRow( tr( "Description" ), new QLabel( effect->effect()->description(), this ) );
- layout->addRow( tr( "Type" ), new QLabel( nameFromType( effect->effect()->type() ), this ) );
+ m_ui->setupUi( this );
+ m_ui->nameValueLabel->setText( effect->effect()->name() );
+ m_ui->descValueLabel->setText( effect->effect()->description() );
+ m_ui->typeValueLabel->setText( nameFromType( effect->effect()->type() ) );
EffectInstance::ParamList::iterator it = effect->params().begin();
EffectInstance::ParamList::iterator ite = effect->params().end();
@@ -50,10 +51,12 @@ EffectInstanceWidget::EffectInstanceWidget( EffectInstance *effect, QWidget *par
ISettingsCategoryWidget *widget = widgetFactory( s );
QLabel *label = new QLabel( tr( s->name() ), this );
widget->widget()->setToolTip( s->description() );
- layout->addRow( label , widget->widget() );
- m_settings.push_back( s );
+ m_ui->settingsLayout->addRow( label , widget->widget() );
+ m_settings.push_back( widget );
++it;
}
+ connect( m_ui->buttons, SIGNAL( clicked( QAbstractButton* ) ),
+ this, SLOT( buttonsClicked( QAbstractButton* ) ) );
}
QString
@@ -89,3 +92,23 @@ EffectInstanceWidget::widgetFactory( EffectSettingValue *s )
return NULL;
}
}
+
+void
+EffectInstanceWidget::save()
+{
+ foreach ( ISettingsCategoryWidget* val, m_settings )
+ val->save();
+}
+
+void
+EffectInstanceWidget::buttonsClicked( QAbstractButton *button )
+{
+ switch ( m_ui->buttons->standardButton( button ) )
+ {
+ case QDialogButtonBox::Ok:
+ case QDialogButtonBox::Apply:
+ save();
+ default:
+ break ;
+ }
+}
diff --git a/src/Gui/effectsengine/EffectInstanceWidget.h b/src/Gui/effectsengine/EffectInstanceWidget.h
index abb1c6b..a5c41ca 100644
--- a/src/Gui/effectsengine/EffectInstanceWidget.h
+++ b/src/Gui/effectsengine/EffectInstanceWidget.h
@@ -29,6 +29,7 @@ class EffectInstance;
class EffectSettingValue;
#include "Effect.h"
+#include "ui_EffectInstanceWidget.h"
class ISettingsCategoryWidget;
@@ -42,9 +43,14 @@ class EffectInstanceWidget : public QDialog
private:
static QString nameFromType( Effect::Type type );
ISettingsCategoryWidget *widgetFactory( EffectSettingValue *s );
+ void save();
private:
EffectInstance *m_effect;
- QList<EffectSettingValue*> m_settings;
+ QList<ISettingsCategoryWidget*> m_settings;
+ Ui::EffectSettingWidget *m_ui;
+
+ private slots:
+ void buttonsClicked( QAbstractButton* button );
};
#endif // EFFECTINSTANCEWIDGET_H
diff --git a/src/Gui/effectsengine/ui/EffectInstanceWidget.ui b/src/Gui/effectsengine/ui/EffectInstanceWidget.ui
new file mode 100644
index 0000000..c3ceec8
--- /dev/null
+++ b/src/Gui/effectsengine/ui/EffectInstanceWidget.ui
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>EffectSettingWidget</class>
+ <widget class="QDialog" name="EffectSettingWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Overview</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="nameLabel">
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="nameValueLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="descLabel">
+ <property name="text">
+ <string>Description</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="descValueLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="typeLabel">
+ <property name="text">
+ <string>Type</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="typeValueLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>386</width>
+ <height>159</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QFormLayout" name="settingsLayout"/>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttons">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttons</sender>
+ <signal>accepted()</signal>
+ <receiver>EffectSettingWidget</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttons</sender>
+ <signal>rejected()</signal>
+ <receiver>EffectSettingWidget</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
More information about the Vlmc-devel
mailing list