summaryrefslogtreecommitdiffstats
path: root/qt4/qhandbrakewizard.cpp
diff options
context:
space:
mode:
authorclee <[email protected]>2007-03-29 09:31:13 +0000
committerclee <[email protected]>2007-03-29 09:31:13 +0000
commitceb981ea2c7406fac18dee17382976428a12b374 (patch)
treed8f421576aff6d75e0e4e82e2a3833437af2233b /qt4/qhandbrakewizard.cpp
parent42b83d67aac7b196b636f8d3b77be5017676fa3b (diff)
Importing the first (very much not-yet-ready-for-primetime) version of the Qt4 GUI for HandBrake into trunk.
Note: This is NOT fit for release yet. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@462 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'qt4/qhandbrakewizard.cpp')
-rw-r--r--qt4/qhandbrakewizard.cpp81
1 files changed, 81 insertions, 0 deletions
diff --git a/qt4/qhandbrakewizard.cpp b/qt4/qhandbrakewizard.cpp
new file mode 100644
index 000000000..c6de00c95
--- /dev/null
+++ b/qt4/qhandbrakewizard.cpp
@@ -0,0 +1,81 @@
+#include <QtGui>
+#include <QtDBus>
+
+#include "qhandbrakewizard.h"
+#include "qhandbrake.h"
+#include "faderwidget.h"
+#include "scanwidget.h"
+#include "encodewidget.h"
+
+
+#define HAL_SERVICE "org.freedesktop.Hal"
+#define HAL_PATH_MANAGER "/org/freedesktop/Hal/Manager"
+#define HAL_PATH_DEVICE "/org/freedesktop/Hal/Device"
+#define HAL_OBJECT_MANAGER "org.freedesktop.Hal.Manager"
+#define HAL_OBJECT_DEVICE "org.freedesktop.Hal.Device"
+
+
+Magic::Magic(QWidget *w, QHandBrakeWizard *q, QObject *p)
+ : QObject(p)
+{
+ m = w;
+ qm = q;
+}
+
+bool Magic::eventFilter(QObject *o, QEvent *e)
+{
+ if( e->type() == QEvent::Show ) {
+ qm->fadeInWidget( m );
+ return false;
+ }
+ return QObject::eventFilter(o, e);
+}
+
+void QHandBrakeWizard::fadeInWidget(QWidget *w)
+{
+ if( faderWidget ) { faderWidget->close(); }
+ faderWidget = new FaderWidget( w );
+ faderWidget->start();
+}
+
+QHandBrakeWizard::QHandBrakeWizard(QStackedWidget *parent)
+ : QStackedWidget(parent)
+{
+ qhb = new QHandBrake(this);
+
+ scanWidget = new ScanWidget;
+ encodeWidget = new EncodeWidget;
+
+ scanWidget->setObjectName("scanWidget");
+ encodeWidget->setObjectName("encodeWidget");
+
+ scanWidget->installEventFilter(new Magic(scanWidget, this, this));
+ encodeWidget->installEventFilter(new Magic(encodeWidget, this, this));
+
+ addWidget(scanWidget);
+
+ connect(scanWidget, SIGNAL(scanDVD(const QString)), qhb, SLOT(startScan(const QString)));
+ connect(scanWidget, SIGNAL(scanningDone()), SLOT(activateEncodePage()));
+ connect(qhb, SIGNAL(scanProgress(int, int)), scanWidget, SLOT(setProgress(int, int)));
+ connect(encodeWidget, SIGNAL(convert()), qhb, SLOT(encode()));
+
+ if( QDBusConnection::systemBus().isConnected() )
+ {
+ QDBusConnection::systemBus().connect( HAL_SERVICE, HAL_PATH_MANAGER, HAL_OBJECT_MANAGER, "DeviceAdded", scanWidget, SLOT( updateVolumeList( QString ) ) );
+ QDBusConnection::systemBus().connect( HAL_SERVICE, HAL_PATH_MANAGER, HAL_OBJECT_MANAGER, "DeviceRemoved", scanWidget, SLOT( updateVolumeList( QString ) ) );
+ }
+}
+
+void QHandBrakeWizard::activateScanPage()
+{
+ setCurrentWidget(scanWidget);
+}
+
+void QHandBrakeWizard::activateEncodePage()
+{
+ addWidget(encodeWidget);
+
+ encodeWidget->setModel( qhb->titleListModel() );
+
+ setCurrentWidget(encodeWidget);
+}