Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fixed gallery icon bug

  • Loading branch information...
commit 6150c4962fd9edaada03d8c632bb869ca071a15e 1 parent 2ed62e4
authored July 31, 2012
3  CameraParameters.cpp
@@ -154,4 +154,7 @@ void CameraParameters::setBackCurtain(bool enabled){
154 154
 void CameraParameters::openLastPicture(){
155 155
     QDesktopServices::openUrl(QUrl("file://"+this->lastPicture));
156 156
 }
  157
+void CameraParameters::setLastPicture(QString lastPic){
  158
+    this->lastPicture = lastPic;
  159
+}
157 160
 
1  CameraParameters.h
@@ -111,6 +111,7 @@ public slots:
111 111
     void setBackCurtain(bool);
112 112
 
113 113
     void openLastPicture();
  114
+    void setLastPicture(QString);
114 115
 
115 116
 signals:
116 117
     // A signal signifying that the camera parameters have changed.
16  CameraThread.cpp
@@ -8,6 +8,8 @@
8 8
 
9 9
 #include <vector>
10 10
 #include <iostream>
  11
+#include <QQueue>
  12
+#include <qmath.h>
11 13
 
12 14
 #include "OverlayWidget.h"
13 15
 #include "CameraParameters.h"
@@ -44,7 +46,6 @@ void CameraThread::run() {
44 46
         return;
45 47
     }
46 48
 
47  
-
48 49
     // Action (Flash)
49 50
     FCam::Flash::FireAction fire(&flash);
50 51
 
@@ -73,7 +74,7 @@ void CameraThread::run() {
73 74
     FCam::Shot photo;
74 75
     photo.image = FCam::Image(sensor.maxImageSize(), FCam::RAW, FCam::Image::AutoAllocate);
75 76
     
76  
-
  77
+    QQueue<QString> pictureNames;
77 78
 //    LEDBlinker blinker;
78 79
 //    LEDBlinker::BlinkAction blink(&blinker);
79 80
 
@@ -124,7 +125,10 @@ void CameraThread::run() {
124 125
 		// Drain the queue
125 126
 		FCam::Frame f;
126 127
 		do {
127  
-		    f = sensor.getFrame();
  128
+            f = sensor.getFrame();
  129
+            // filewriter doesn't emit a signal when it finishes saving a file so we use a hackish way;
  130
+            //qDebug()<< "before dequeure" <<  pictureNames;
  131
+            if (!pictureNames.isEmpty() && pictureNames.length()*2 > writer.savesPending()) emit pictureSaved(QString(pictureNames.dequeue()));
128 132
 
129 133
 		    if (f.shot().id == photo.id) {
130 134
 			// Our photo came back, asynchronously save it to disk
@@ -138,13 +142,15 @@ void CameraThread::run() {
138 142
 			    printf("Got a full-res frame\n");
139 143
 			}
140 144
 
  145
+
141 146
             char fname[256];
142 147
             // Save it as a JPEG
143 148
             snprintf(fname, 255, "%s/MyDocs/DCIM/photo_%s.jpg", getenv("HOME"),
144 149
                  f.exposureStartTime().toString().c_str());
145 150
             writer.saveJPEG(f, fname, 90);
146  
-            parameters->lastPicture = fname;
147  
-            emit pictureSaved(QString(fname));
  151
+            // filewriter doesn't emit a signal when it finishes saving a file so we use a hackish way;
  152
+            pictureNames.enqueue(QString(fname));
  153
+            //qDebug()<< "after enqueue" <<  pictureNames;
148 154
 
149 155
 			// Save it as a DNG
150 156
             snprintf(fname, 255, "%s/MyDocs/DCIM/photo_%s.dng", getenv("HOME"),
2  Makefile
... ...
@@ -1,2 +1,2 @@
1  
-clean:
  1
+-e clean:
2 2
 	echo clean
2  generate-obs-source
... ...
@@ -1,6 +1,6 @@
1 1
 #!/bin/sh
2 2
 
3  
-SDK_DIR=`echo ~/QtSDK`
  3
+SDK_DIR=`echo /opt/QtSDK`
4 4
 MADDE_DIR="${SDK_DIR}/Madde"
5 5
 MAD="${MADDE_DIR}/bin/mad"
6 6
 TARGET="harmattan_10.2011.34-1_rt1.2"
5  qtc_packaging/debian_harmattan/changelog
... ...
@@ -1,3 +1,8 @@
  1
+rawcam (0.0.5) unstable; urgency=low
  2
+  * <Add change description here>
  3
+
  4
+ -- Michael Demetriou <qwazix@unknown>  Tue, 31 Jul 2012 17:18:49 +0300
  5
+
1 6
 rawcam (0.0.4) unstable; urgency=low
2 7
   * Full manual controls: Auto, Shutter priority, ISO priority, Manual
3 8
   * Fixed the flashing under electric lighting bug
8  rawcam.cpp
@@ -82,7 +82,7 @@ int main(int argc, char **argv) {
82 82
 
83 83
     // gallery button
84 84
     QPushButton* gallery = new QPushButton("", window);
85  
-    gallery->move(780, 55);
  85
+    gallery->move(780, 60);
86 86
     gallery->setObjectName("gallery");
87 87
     gallery->hide();
88 88
 
@@ -92,10 +92,6 @@ int main(int argc, char **argv) {
92 92
     shutter->move(750,200);
93 93
     shutter->setObjectName("shutter");
94 94
     QObject::connect(shutter, SIGNAL(released()), cameraThread, SLOT(snapshot()));
95  
-    QObject::connect(cameraThread, SIGNAL(pictureSaved(QString)), gallery, SLOT(show()));
96  
-
97  
-
98  
-
99 95
 
100 96
 //    t->setStyleSheet("min-height: 100px;"
101 97
 //                          "border-style: outset;"
@@ -128,6 +124,8 @@ int main(int argc, char **argv) {
128 124
 
129 125
     CameraParameters* params = cameraThread->parameters;
130 126
 
  127
+    QObject::connect(cameraThread, SIGNAL(pictureSaved(QString)), gallery, SLOT(show()));
  128
+    QObject::connect(cameraThread, SIGNAL(pictureSaved(QString)), params, SLOT(setLastPicture(QString)));
131 129
     QObject::connect(gallery,SIGNAL(clicked()), params, SLOT(openLastPicture()));
132 130
 
133 131
     // flash control

0 notes on commit 6150c49

Please sign in to comment.
Something went wrong with that request. Please try again.