Skip to content

Commit

Permalink
fixed gallery icon bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Demetriou authored and Michael Demetriou committed Jul 31, 2012
1 parent 2ed62e4 commit 6150c49
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CameraParameters.cpp
Expand Up @@ -154,4 +154,7 @@ void CameraParameters::setBackCurtain(bool enabled){
void CameraParameters::openLastPicture(){
QDesktopServices::openUrl(QUrl("file://"+this->lastPicture));
}
void CameraParameters::setLastPicture(QString lastPic){
this->lastPicture = lastPic;
}

1 change: 1 addition & 0 deletions CameraParameters.h
Expand Up @@ -111,6 +111,7 @@ public slots:
void setBackCurtain(bool);

void openLastPicture();
void setLastPicture(QString);

signals:
// A signal signifying that the camera parameters have changed.
Expand Down
16 changes: 11 additions & 5 deletions CameraThread.cpp
Expand Up @@ -8,6 +8,8 @@

#include <vector>
#include <iostream>
#include <QQueue>
#include <qmath.h>

#include "OverlayWidget.h"
#include "CameraParameters.h"
Expand Down Expand Up @@ -44,7 +46,6 @@ void CameraThread::run() {
return;
}


// Action (Flash)
FCam::Flash::FireAction fire(&flash);

Expand Down Expand Up @@ -73,7 +74,7 @@ void CameraThread::run() {
FCam::Shot photo;
photo.image = FCam::Image(sensor.maxImageSize(), FCam::RAW, FCam::Image::AutoAllocate);


QQueue<QString> pictureNames;
// LEDBlinker blinker;
// LEDBlinker::BlinkAction blink(&blinker);

Expand Down Expand Up @@ -124,7 +125,10 @@ void CameraThread::run() {
// Drain the queue
FCam::Frame f;
do {
f = sensor.getFrame();
f = sensor.getFrame();
// filewriter doesn't emit a signal when it finishes saving a file so we use a hackish way;
//qDebug()<< "before dequeure" << pictureNames;
if (!pictureNames.isEmpty() && pictureNames.length()*2 > writer.savesPending()) emit pictureSaved(QString(pictureNames.dequeue()));

if (f.shot().id == photo.id) {
// Our photo came back, asynchronously save it to disk
Expand All @@ -138,13 +142,15 @@ void CameraThread::run() {
printf("Got a full-res frame\n");
}


char fname[256];
// Save it as a JPEG
snprintf(fname, 255, "%s/MyDocs/DCIM/photo_%s.jpg", getenv("HOME"),
f.exposureStartTime().toString().c_str());
writer.saveJPEG(f, fname, 90);
parameters->lastPicture = fname;
emit pictureSaved(QString(fname));
// filewriter doesn't emit a signal when it finishes saving a file so we use a hackish way;
pictureNames.enqueue(QString(fname));
//qDebug()<< "after enqueue" << pictureNames;

// Save it as a DNG
snprintf(fname, 255, "%s/MyDocs/DCIM/photo_%s.dng", getenv("HOME"),
Expand Down
2 changes: 1 addition & 1 deletion Makefile
@@ -1,2 +1,2 @@
clean:
-e clean:
echo clean
2 changes: 1 addition & 1 deletion generate-obs-source
@@ -1,6 +1,6 @@
#!/bin/sh

SDK_DIR=`echo ~/QtSDK`
SDK_DIR=`echo /opt/QtSDK`
MADDE_DIR="${SDK_DIR}/Madde"
MAD="${MADDE_DIR}/bin/mad"
TARGET="harmattan_10.2011.34-1_rt1.2"
Expand Down
5 changes: 5 additions & 0 deletions qtc_packaging/debian_harmattan/changelog
@@ -1,3 +1,8 @@
rawcam (0.0.5) unstable; urgency=low
* <Add change description here>

-- Michael Demetriou <qwazix@unknown> Tue, 31 Jul 2012 17:18:49 +0300

rawcam (0.0.4) unstable; urgency=low
* Full manual controls: Auto, Shutter priority, ISO priority, Manual
* Fixed the flashing under electric lighting bug
Expand Down
8 changes: 3 additions & 5 deletions rawcam.cpp
Expand Up @@ -82,7 +82,7 @@ int main(int argc, char **argv) {

// gallery button
QPushButton* gallery = new QPushButton("", window);
gallery->move(780, 55);
gallery->move(780, 60);
gallery->setObjectName("gallery");
gallery->hide();

Expand All @@ -92,10 +92,6 @@ int main(int argc, char **argv) {
shutter->move(750,200);
shutter->setObjectName("shutter");
QObject::connect(shutter, SIGNAL(released()), cameraThread, SLOT(snapshot()));
QObject::connect(cameraThread, SIGNAL(pictureSaved(QString)), gallery, SLOT(show()));




// t->setStyleSheet("min-height: 100px;"
// "border-style: outset;"
Expand Down Expand Up @@ -128,6 +124,8 @@ int main(int argc, char **argv) {

CameraParameters* params = cameraThread->parameters;

QObject::connect(cameraThread, SIGNAL(pictureSaved(QString)), gallery, SLOT(show()));
QObject::connect(cameraThread, SIGNAL(pictureSaved(QString)), params, SLOT(setLastPicture(QString)));
QObject::connect(gallery,SIGNAL(clicked()), params, SLOT(openLastPicture()));

// flash control
Expand Down

0 comments on commit 6150c49

Please sign in to comment.