[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/kopete/config/avdevice
From:       Frank Schaefer <fschaefer.oss () googlemail ! com>
Date:       2010-02-20 18:06:59
Message-ID: 1266689219.673528.14544.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1093371 by fschaefer:

Video-device-settings: restore control values when dialog is canceled


 M  +7 -3      avdeviceconfig.cpp  
 M  +12 -1     avdeviceconfig.h  


--- trunk/KDE/kdenetwork/kopete/kopete/config/avdevice/avdeviceconfig.cpp \
#1093370:1093371 @@ -52,7 +52,7 @@
 // "Video" TAB ============================================================
 	mPrfsVideoDevice = new Ui_AVDeviceConfig_VideoDevice();
 	mPrfsVideoDevice->setupUi(this);
-
+	
 	// set a default image for the webcam widget, in case the user does not have a \
video device  mPrfsVideoDevice->mVideoImageLabel->setScaledContents(false);
 	mPrfsVideoDevice->mVideoImageLabel->setPixmap(KIcon("camera-web").pixmap(128,128));
@@ -84,6 +84,8 @@
 
 AVDeviceConfig::~AVDeviceConfig()
 {
+	for (unsigned int k=0; k<ctrl_values_bak.size(); k++)
+		mVideoDevicePool->setControlValue(ctrl_values_bak.at(k).id, \
ctrl_values_bak.at(k).value);  mVideoDevicePool->close();
 	clearControlGUIElements();
 }
@@ -113,18 +115,21 @@
 	{
 		mVideoDevicePool->getControlValue(numericCtrls.at(k).id, &cval);
 		addSliderControlElement(numericCtrls.at(k).id, numericCtrls.at(k).name, \
numericCtrls.at(k).value_min, numericCtrls.at(k).value_max, \
numericCtrls.at(k).value_step, cval); \
+		ctrl_values_bak.push_back(VideoControlValue(numericCtrls.at(k).id, cval));  }
 	// Boolean Controls: => Checkbox
 	for (k=0; k<booleanCtrls.size(); k++)
 	{
 		mVideoDevicePool->getControlValue(booleanCtrls.at(k).id, &cval);
 		addCheckBoxControlElement(booleanCtrls.at(k).id, booleanCtrls.at(k).name, cval);
+		ctrl_values_bak.push_back(VideoControlValue(booleanCtrls.at(k).id, cval));
 	}
 	// Menu Controls: => Combobox
 	for (k=0; k<menuCtrls.size(); k++)
 	{
 		mVideoDevicePool->getControlValue(menuCtrls.at(k).id, &cval);
 		addPopupMenuControlElement(menuCtrls.at(k).id, menuCtrls.at(k).name, \
menuCtrls.at(k).options, cval); \
+		ctrl_values_bak.push_back(VideoControlValue(booleanCtrls.at(k).id, cval));  }
 	// Action Controls: => Button
 	for (k=0; k<actionCtrls.size(); k++)
@@ -210,9 +215,8 @@
  */
 void AVDeviceConfig::save()
 {
-    /// @todo implement me
-	kDebug() << "kopete:config (avdevice): save() called. ";
 	mVideoDevicePool->saveCurrentDeviceConfig();
+	ctrl_values_bak.clear();
 }
 
 
--- trunk/KDE/kdenetwork/kopete/kopete/config/avdevice/avdeviceconfig.h \
#1093370:1093371 @@ -47,7 +47,6 @@
 Q_OBJECT
 public:
 	AVDeviceConfig(QWidget *parent, const QVariantList &args);
-
 	~AVDeviceConfig();
 	virtual void save();
 	virtual void load();
@@ -62,7 +61,17 @@
 	void changeVideoControlValue(unsigned int id, int value = 0);
 	void deviceRegistered( const QString & );
 	void deviceUnregistered( const QString & );
+
 private:
+	class VideoControlValue
+	{
+	public:
+		VideoControlValue() : id(0), value(0) {};
+		VideoControlValue(quint32 id, qint32 value) : id(id), value(value) {};
+		quint32 id;
+		qint32 value;
+	};
+
 //	QTabWidget* mAVDeviceTabCtl;
 	Ui_AVDeviceConfig_VideoDevice  *mPrfsVideoDevice;
 //	AVDeviceConfig_AudioDevice  *mPrfsAudioDevice;
@@ -72,6 +81,8 @@
 	QTimer qtimer;
 	QString capturingDevice_udi;
 	QList<QWidget*> ctrlWidgets;
+	QList<VideoControlValue> ctrl_values_bak;
+
 	void setupControls();
 	void clearControlGUIElements();
 	void addSliderControlElement(int cid, QString title, int min, int max, int step, \
int value);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic