diff options
author | Sebastian Krzyszkowiak <dos@dosowisko.net> | 2011-06-09 19:29:06 +0200 |
---|---|---|
committer | Sebastian Krzyszkowiak <dos@dosowisko.net> | 2011-06-09 19:29:06 +0200 |
commit | 24851bdfd8c1944ed48ce6290c1fb9443db15935 (patch) | |
tree | 02aee4ac21674418271cc1372b4b039e0f22d57b | |
parent | edbc9c22cf223d6072bad7a65495b5eb16cb005e (diff) | |
download | kamerka-origin/canvaslayer.zip kamerka-origin/canvaslayer.tar.gz kamerka-origin/canvaslayer.tar.bz2 |
implement dummy config dialogorigin/canvaslayer
-rw-r--r-- | src/kamerka.qml | 13 | ||||
-rw-r--r-- | src/mainwindow.cpp | 40 | ||||
-rw-r--r-- | src/mainwindow.h | 8 |
3 files changed, 48 insertions, 13 deletions
diff --git a/src/kamerka.qml b/src/kamerka.qml index fb573c9..58dc042 100644 --- a/src/kamerka.qml +++ b/src/kamerka.qml @@ -92,7 +92,8 @@ height: parent.height-50; color: "black"; smooth: true; - /*Image { + /* + Image { effect: Blur { blurRadius: 8 } @@ -100,7 +101,8 @@ anchors.fill: parent; source: fileName; smooth: true; - }*/ + } + */ Image { id: preview; anchors.fill: parent; @@ -147,7 +149,6 @@ } function showCanvasBackground() { canvasVisible=true; - testTimer.running=true; } function hideCanvasBackground() { canvasVisible=false; @@ -298,12 +299,6 @@ } - Timer { //REMOVE ME - id: testTimer; - interval: 5000; running: false; repeat: false; - onTriggered: hideCanvasBackground(); - } - Timer { id: timer; interval: 1000; running: false; repeat: true; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index db1a55c..0bb40d3 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -20,6 +20,8 @@ #include <KLocalizedString> #include <KStandardDirs> #include <KMessageBox> +#include <KConfigDialog> +#include <KConfigSkeleton> #include <KUrl> #include <KGlobalSettings> #include <KDebug> @@ -80,16 +82,39 @@ void MainWindow::showDirectory() { QApplication::quit(); } +void MainWindow::closeCanvasLayer() { + QMetaObject::invokeMethod(ui->rootObject(), "hideCanvasBackground"); + conf->hide(); +} + +int MainWindow::opacityUpdate(QGraphicsProxyWidget *widget) { + widget->setOpacity(widget->opacity()+0.05); + if (widget->opacity()>=1) return 0; + return 1; +} + +void MainWindow::opacityUpdateConf() { + if (opacityUpdate(conf)) { + QTimer::singleShot(5, this, SLOT(opacityUpdateConf())); + } +} + + // slot for UI button - show canvas layer with configuration void MainWindow::showConfiguration() { QMetaObject::invokeMethod(ui->rootObject(), "showCanvasBackground"); - //sleep(5); - //QMetaObject::invokeMethod(ui->rootObject(), "hideCanvasBackground"); + conf->setOpacity(0); + conf->show(); + QTimer::singleShot(500, this, SLOT(opacityUpdateConf())); + //QTimer *timer = new QTimer(this); + //connect(timer, SIGNAL(timeout()), this, SLOT(opacityUpdateConf())); + //timer->start(5); } // resize video widget together with window void MainWindow::resizeEvent(QResizeEvent *e) { videoViewer->resize(this->size()); + conf->setGeometry(QRectF(QPointF(50,50), QPointF(this->size().rwidth()-50,this->size().rheight()-50))); QMainWindow::resizeEvent(e); } @@ -170,4 +195,15 @@ MainWindow::MainWindow() { connect(ui->rootObject(), SIGNAL(timerCounter(int)), this, SLOT(timerCounter(int))); connect(ui->rootObject(), SIGNAL(showDirectory()), this, SLOT(showDirectory())); connect(ui->rootObject(), SIGNAL(showConfiguration()), this, SLOT(showConfiguration())); + + // setup configuration page + KConfigSkeleton *confskel = new KConfigSkeleton(); + KConfigDialog *confdial = new KConfigDialog(0, i18n("Settings"), confskel); + confdial->addPage(new QLabel(i18n("Not implemented yet.")), i18n("Video"), "camera-web", i18n("Webcam video settings") ); + confdial->addPage(new QLabel(i18n("Not implemented yet too.")), i18n("Storage"), "drive-harddisk", i18n("Photo storage settings") ); + confdial->addPage(new QLabel(i18n("Guess what? Not implemented yet.")), i18n("Behaviour"), "audio-headset", i18n("Behaviour settings") ); + confdial->showButton(KDialog::Help, false); + conf = ui->scene()->addWidget(confdial); + conf->hide(); + connect(confdial, SIGNAL(hidden()), this, SLOT(closeCanvasLayer())); } diff --git a/src/mainwindow.h b/src/mainwindow.h index b390ec7..bf1a2d7 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -19,7 +19,7 @@ #include <QtGui> #include <QtDeclarative> #include <QtScript/QScriptEngine> -#include "KMainWindow" +#include <KMainWindow> #include "videowidget.h" @@ -37,7 +37,8 @@ class MainWindow : public KMainWindow { public: MainWindow(); videowidget *videoViewer; - QDeclarativeView* ui; + QDeclarativeView *ui; + QGraphicsProxyWidget *conf; private: void resizeEvent(QResizeEvent *e); public slots: @@ -46,5 +47,8 @@ public slots: void showDirectory(); void showConfiguration(); void QMLStatus(QDeclarativeView::Status); + int opacityUpdate(QGraphicsProxyWidget*); + void opacityUpdateConf(); + void closeCanvasLayer(); }; |