improved the presentation of the decoded information
[zxing.git] / symbian / ZXingBarcodeReader / src / DecodingOperations.cpp
index 56bfe41..47b8743 100644 (file)
@@ -1,4 +1,4 @@
-#include "CameraWrapperExampleAppView.h"\r
+#include "ZXingBarcodeReaderAppView.h"\r
 #include <e32std.h>\r
 \r
 #include <zxing/qrcode/QRCodeReader.h>\r
@@ -8,30 +8,32 @@
 #include <zxing/BinaryBitmap.h>\r
 #include <CameraImage.h>\r
 #include <string>\r
+#include <aknmessagequerydialog.h>\r
+#include "ZXingBarcodeReader_0xEF24C10A.rsg"\r
 \r
 using namespace zxing;\r
 using namespace zxing::qrcode;\r
 \r
-void CCameraWrapperExampleAppView::StartTimer()\r
+void CZXingBarcodeReaderAppView::StartTimer()\r
        {\r
        const TInt tickInterval=2000000;\r
        iPeriodic=CPeriodic::NewL(0); // neutral priority\r
 \r
        //CleanupStack::PushL(iPeriodic);\r
 \r
-       iPeriodic->Start(tickInterval,tickInterval,TCallBack(&CCameraWrapperExampleAppView::Tick, this));\r
+       iPeriodic->Start(tickInterval,tickInterval,TCallBack(&CZXingBarcodeReaderAppView::Tick, this));\r
 \r
 //     CleanupStack::PopAndDestroy(iPeriodic);\r
        }\r
 \r
-TInt CCameraWrapperExampleAppView::Tick(TAny* aObject)\r
+TInt CZXingBarcodeReaderAppView::Tick(TAny* aObject)\r
        {\r
        // cast, and call non-static function\r
-       ((CCameraWrapperExampleAppView*)aObject)->decodeBackbufferImage();\r
+       ((CZXingBarcodeReaderAppView*)aObject)->decodeBackbufferImage();\r
        return 1;\r
        }\r
 \r
-void CCameraWrapperExampleAppView::decodeBackbufferImage()\r
+void CZXingBarcodeReaderAppView::decodeBackbufferImage()\r
        {\r
        QRCodeReader decoder;\r
 \r
@@ -64,41 +66,34 @@ void CCameraWrapperExampleAppView::decodeBackbufferImage()
                }\r
        catch(zxing::Exception& e)\r
                {\r
-                       string string = "Error...retrying...";\r
+                       /*string string = "Error...retrying...";\r
                        HBufC8 *pHeap8 = HBufC8::NewMaxLC(string.size());\r
                        pHeap8->Des().Copy((const TUint8 *)string.c_str());\r
                        \r
                        HBufC *pHeap16 = HBufC::NewMaxLC(pHeap8->Length());\r
                        pHeap16->Des().Copy(*pHeap8);\r
                        \r
-                       ShowResultL(*pHeap16);\r
+                       ShowResultL(*pHeap16);*/\r
                }\r
        }\r
 \r
-void CCameraWrapperExampleAppView::ShowResultL(TDesC16& message)\r
+void CZXingBarcodeReaderAppView::ShowResultL(TDesC16& message)\r
        {\r
-       if (!iNote)\r
-               {\r
-       // Create the note once\r
-       iNote = CAknInfoPopupNoteController::NewL();\r
-               }\r
-       // Hide the note. The last note may be visible when creating the second\r
-       iNote->HideInfoPopupNote();\r
-\r
-       // Set the time delay period before the popup is shown (in milliseconds)\r
-       iNote->SetTimeDelayBeforeShow(100);\r
-\r
-       // Set the time period of how long the popup is in the view (in milliseconds)\r
-       iNote->SetTimePopupInView(2*1000);\r
-\r
-       // Note text\r
-       iNote->SetTextL(message);\r
+        StopTimer();\r
+           \r
+       CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog ();\r
        \r
-       TRect rect(Rect());\r
+       dlg->PrepareLC(R_TEXT_QUERY_DIALOG );\r
+          \r
+       //HBufC* title = NULL;  \r
+       //title = iEikonEnv->AllocReadResourceLC ( TEXT_DIALOG_TITLE );\r
+       dlg->QueryHeading ()->SetTextL (_L("Information") );\r
+               \r
+       dlg->SetMessageTextL ( message );\r
        \r
-       // Note position\r
-       iNote->SetPositionAndAlignment(TPoint(rect.Width()/5,rect.Height()/7),EHLeftVTop);\r
-\r
-       // Show note\r
-       iNote->ShowInfoPopupNote();\r
+       dlg->RunLD();\r
+       \r
+       CleanupStack::PopAndDestroy();\r
+       \r
+       StartTimer();\r
        }\r