|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QtGui> |
|
19 #include <hbapplication.h> |
|
20 #include <hbmainwindow.h> |
|
21 #include <hbstyle.h> |
|
22 #include <hbstyleloader.h> |
|
23 |
|
24 #include <glxstatemanager.h> |
|
25 #include <glximageviewermanager.h> |
|
26 |
|
27 |
|
28 int main(int argc, char *argv[]) |
|
29 { |
|
30 // Initialization |
|
31 HbApplication app(argc, argv); |
|
32 QStringList args = QApplication::arguments(); |
|
33 |
|
34 #ifdef _DEBUG |
|
35 foreach (QString arg, args) |
|
36 { |
|
37 qDebug() << "GlxImageViewer: cmdline arg=" << qPrintable(arg); |
|
38 } |
|
39 #endif |
|
40 |
|
41 CGlxImageViewerManager* imageViewerInstance = CGlxImageViewerManager::InstanceL(); |
|
42 |
|
43 QString arg = args[1]; |
|
44 arg.replace(QString("/"), QString("\\")); |
|
45 |
|
46 TPtrC16 str(reinterpret_cast<const TUint16*>(arg.utf16())); |
|
47 HBufC* uri = str.Alloc(); |
|
48 |
|
49 bool isPrivatepath = arg.contains("\\private\\", Qt::CaseInsensitive); ; |
|
50 |
|
51 RFile fileHandle; |
|
52 RFs fs; |
|
53 |
|
54 |
|
55 if(!isPrivatepath){ |
|
56 imageViewerInstance->SetImageUriL(*uri); |
|
57 } |
|
58 else{ |
|
59 fs.Connect(); |
|
60 TInt err = fileHandle.Open( fs, *uri, EFileShareReadersOnly ); |
|
61 if ( err ) |
|
62 { |
|
63 User::LeaveIfError( fileHandle.Open( fs, *uri, EFileShareAny ) ); |
|
64 } |
|
65 imageViewerInstance->SetImageFileHandleL(fileHandle); |
|
66 } |
|
67 |
|
68 GlxStateManager mStateMgr; |
|
69 mStateMgr.launchFromExternal(); |
|
70 |
|
71 // Enter event loop |
|
72 int ret = app.exec(); |
|
73 |
|
74 fileHandle.Close(); |
|
75 fs.Close(); |
|
76 |
|
77 imageViewerInstance->Close(); |
|
78 return ret; |
|
79 } |