author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 14 May 2010 15:49:35 +0300 | |
changeset 27 | e4592d119491 |
parent 25 | 84d9eb65b26f |
child 47 | 5b14749788d7 |
permissions | -rw-r--r-- |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: This widget displays the body of the viewer |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#include "univiewerbodywidget.h" |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include <QFile> |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <QFileInfo> |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include <QPixmap> |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
23 |
#include <QSignalMapper> |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include <HbTextItem> |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
#include <HbPushButton> |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include <HbMenu> |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include <HbMainWindow> |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
|
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
30 |
#include <xqaiwrequest.h> |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
31 |
#include <xqrequestinfo.h> |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
32 |
#include <xqappmgr.h> |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
|
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
34 |
#include "univiewertextitem.h" |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
35 |
#include "univiewerpixmapwidget.h" |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
36 |
#include "msgmediautil.h" |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
// LOCAL CONSTANTS |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
38 |
const QString AUDIO_ICON("qtg_mono_audio"); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
39 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
40 |
// Localization |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
41 |
#define LOC_TITLE hbTrId("txt_messaging_title_messaging") |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
42 |
#define LOC_OPEN hbTrId("txt_common_menu_open") |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
43 |
#define LOC_SAVE hbTrId("txt_common_menu_save") |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
//--------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
//UniViewerBodyWidget::UniViewerBodyWidget |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
// @see header file |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
//--------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
UniViewerBodyWidget::UniViewerBodyWidget(QGraphicsItem *parent) : |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
50 |
HbWidget(parent), mHasText(false), mHasPixmap(false), mTextItem(0), mSlideCounter(0), |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
51 |
mPixmapItem(0), mAudioItem(0) |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
{ |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
53 |
this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
54 |
// Signal mapper for opening media files |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
55 |
mSignalMapper = new QSignalMapper(this); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
56 |
connect(mSignalMapper, SIGNAL(mapped(const QString &)), this, SLOT(openMedia(const QString &))); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
//--------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
//UniViewerBodyWidget::~UniViewerBodyWidget |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
// @see header file |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
//--------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
UniViewerBodyWidget::~UniViewerBodyWidget() |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
{ |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
//--------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
68 |
//UniViewerBodyWidget::setImage |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
// @see header file |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
70 |
//--------------------------------------------------------------- |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
71 |
void UniViewerBodyWidget::setPixmap(QString pixmapFile) |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
72 |
{ |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
73 |
setHasPixmap(true); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
74 |
//create image item instance |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
75 |
if (!mPixmapItem) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
76 |
mPixmapItem = new UniViewerPixmapWidget(this); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
77 |
HbStyle::setItemName(mPixmapItem, "pixmap"); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
78 |
connect(mPixmapItem, SIGNAL(shortTap(QString)), this, SLOT(openMedia(QString))); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
|
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
81 |
mPixmapItem->hide(); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
82 |
mPixmapItem->setPixmap(pixmapFile); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
83 |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
84 |
this->repolish(); |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
85 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
86 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
87 |
//--------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
88 |
//UniViewerBodyWidget::setAudio |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
89 |
// @see header file |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
90 |
//--------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
91 |
void UniViewerBodyWidget::setAudio(QString audiofile) |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
92 |
{ |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
93 |
if (!mAudioItem) { |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
94 |
mAudioItem = new HbPushButton(this); |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
95 |
HbStyle::setItemName(mAudioItem, "audioItem"); |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
96 |
} |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
97 |
mAudioItem->hide(); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
98 |
QFileInfo fileInfo(audiofile); |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
99 |
mAudioItem->setIcon(HbIcon(AUDIO_ICON)); |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
100 |
mAudioItem->setText(fileInfo.baseName()); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
101 |
MsgMediaUtil mediaUtil; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
102 |
mAudioItem->setAdditionalText(mediaUtil.mediaDuration(audiofile)); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
mAudioItem->setTextAlignment(Qt::AlignLeft); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
104 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
105 |
// Connect to signal mapper with file name |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
106 |
mSignalMapper->setMapping(mAudioItem, audiofile); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
107 |
connect(mAudioItem, SIGNAL(clicked()), mSignalMapper, SLOT(map())); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
108 |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
109 |
this->repolish(); |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
110 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
111 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
112 |
//--------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
113 |
//UniViewerBodyWidget::setVideo |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
114 |
// @see header file |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
//--------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
116 |
void UniViewerBodyWidget::setVideo(QString videofile) |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
117 |
{ |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
118 |
Q_UNUSED(videofile) |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
119 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
120 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
121 |
//--------------------------------------------------------------- |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
122 |
//UniViewerBodyWidget::setTextContent |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
123 |
// @see header file |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
124 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
125 |
void UniViewerBodyWidget::setTextContent(QString text) |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
126 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
127 |
setHasText(true); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
128 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
129 |
if (!mTextItem) { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
130 |
mTextItem = new UniViewerTextItem(this); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
131 |
HbStyle::setItemName(mTextItem, "textItem"); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
132 |
connect(mTextItem, SIGNAL(sendMessage(const QString&)), this, |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
133 |
SIGNAL(sendMessage(const QString&))); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
134 |
} |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
135 |
mTextItem->hide(); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
136 |
text.replace(QChar::ParagraphSeparator, QChar::LineSeparator); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
137 |
text.replace('\r', QChar::LineSeparator); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
138 |
mTextItem->setText(text); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
139 |
this->repolish(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
140 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
141 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
142 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
143 |
//UniViewerBodyWidget::setTextContent |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
144 |
// @see header file |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
145 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
146 |
void UniViewerBodyWidget::setSlideCounter(QString &slideCounter) |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
147 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
148 |
if (!mSlideCounter) { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
149 |
mSlideCounter = new HbTextItem(this); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
150 |
HbStyle::setItemName(mSlideCounter, "slideCounter"); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
151 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
152 |
|
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
153 |
mSlideCounter->hide(); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
154 |
mSlideCounter->setText(slideCounter); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
155 |
this->repolish(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
156 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
157 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
158 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
159 |
// UniViewerBodyWidget::setHasText |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
160 |
// @see header file |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
161 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
162 |
void UniViewerBodyWidget::setHasText(bool text) |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
163 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
164 |
mHasText = text; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
165 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
166 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
167 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
168 |
// UniViewerBodyWidget::hasText |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
169 |
// @see header file |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
170 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
171 |
bool UniViewerBodyWidget::hasText() |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
172 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
173 |
return mHasText; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
174 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
175 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
176 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
177 |
// UniViewerBodyWidget::setHasPixmap |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
178 |
// @see header file |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
179 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
180 |
void UniViewerBodyWidget::setHasPixmap(bool pixmap) |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
181 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
182 |
mHasPixmap = pixmap; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
183 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
184 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
185 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
186 |
// UniViewerBodyWidget::hasPixmap |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
187 |
// @see header file |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
188 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
189 |
bool UniViewerBodyWidget::hasPixmap() |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
190 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
191 |
return mHasPixmap; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
192 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
193 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
194 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
195 |
// UniViewerBodyWidget::setSlideContents |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
196 |
// @see header file |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
197 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
198 |
void UniViewerBodyWidget::setSlideContents(UniMessageInfoList objList, QString slideString) |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
199 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
200 |
if (!slideString.isEmpty()) { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
201 |
setSlideCounter(slideString); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
202 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
203 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
204 |
int count = objList.count(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
205 |
for (int a = 0; a < count; ++a) { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
206 |
UniMessageInfo* info = objList.at(a); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
207 |
QString type = info->mimetype(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
208 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
209 |
if (type.contains("text")) { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
210 |
QFile file(info->path()); |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
211 |
if (file.open(QIODevice::ReadOnly)) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
212 |
QString textContent(file.readAll()); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
213 |
setTextContent(textContent); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
214 |
} |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
215 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
216 |
else if (type.contains("video")) { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
217 |
setVideo(info->path()); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
218 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
219 |
else if (type.contains("audio")) { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
220 |
setAudio(info->path()); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
221 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
222 |
else if (type.contains("image")) { |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
223 |
setPixmap(info->path()); |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
224 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
225 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
226 |
delete info; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
227 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
228 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
229 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
230 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
231 |
//UniViewerBodyWidget :: clearContent |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
232 |
// @see header file |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
233 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
234 |
void UniViewerBodyWidget::clearContent() |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
235 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
236 |
// delete the temp items(pixmap) & clear permanent items(text) |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
237 |
if (mPixmapItem) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
238 |
mPixmapItem->setParent(NULL); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
239 |
delete mPixmapItem; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
240 |
mPixmapItem = NULL; |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
241 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
242 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
243 |
if (mAudioItem) { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
244 |
mAudioItem->setParent(NULL); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
245 |
delete mAudioItem; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
246 |
mAudioItem = NULL; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
247 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
248 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
249 |
if (mTextItem) { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
250 |
mTextItem->setParent(NULL); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
251 |
delete mTextItem; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
252 |
mTextItem = NULL; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
253 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
254 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
255 |
setHasText(false); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
256 |
setHasPixmap(false); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
257 |
repolish(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
258 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
259 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
260 |
//--------------------------------------------------------------- |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
261 |
//UniViewerBodyWidget::sizeHint |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
262 |
// @see header file |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
263 |
//--------------------------------------------------------------- |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
264 |
QSizeF UniViewerBodyWidget::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
265 |
{ |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
266 |
QSizeF szHint = HbWidget::sizeHint(which, constraint); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
267 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
268 |
HbMainWindow *mainWindow = this->mainWindow(); |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
269 |
if (!mainWindow) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
270 |
return szHint; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
271 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
272 |
|
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
273 |
qreal screenWidth = 0.0; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
274 |
qreal screenHeight = 0.0; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
275 |
qreal leftMargin = 0.0; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
276 |
qreal rightMargin = 0.0; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
277 |
qreal chromeHeight = 0.0; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
278 |
qreal toolbarHeight = 0.0; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
279 |
qreal iconSize = 0.0; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
280 |
qreal spacing = 0.0; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
281 |
qreal unitSize = HbDeviceProfile::profile(mPixmapItem).unitValue(); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
282 |
style()->parameter("hb-param-screen-width", screenWidth); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
283 |
style()->parameter("hb-param-screen-height", screenHeight); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
284 |
style()->parameter("hb-param-margin-gene-left", leftMargin); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
285 |
style()->parameter("hb-param-margin-gene-right", rightMargin); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
286 |
style()->parameter("hb-param-widget-chrome-height", chromeHeight); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
287 |
style()->parameter("hb-param-widget-toolbar-height", toolbarHeight); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
288 |
style()->parameter("hb-param-graphic-size-primary-large", iconSize); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
289 |
style()->parameter("hb-param-margin-gene-middle-vertical", spacing); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
290 |
|
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
291 |
qreal maxWidth = 0.0; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
292 |
qreal maxHeight = 0.0; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
293 |
|
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
294 |
// Calculate max height & max width. |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
295 |
if (mainWindow->orientation() == Qt::Horizontal) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
296 |
qreal temp; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
297 |
temp = screenWidth; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
298 |
screenWidth = screenHeight; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
299 |
screenHeight = temp; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
300 |
|
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
301 |
if (mPixmapItem && mHasText) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
302 |
maxWidth = (screenWidth / 2) - leftMargin - unitSize; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
303 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
304 |
else { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
305 |
maxWidth = screenWidth - leftMargin - rightMargin; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
306 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
307 |
maxHeight = screenHeight - chromeHeight - toolbarHeight; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
308 |
|
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
309 |
if (mAudioItem) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
310 |
mAudioItem->setStretched(true); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
311 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
312 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
313 |
else if (mainWindow->orientation() == Qt::Vertical) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
314 |
maxWidth = screenWidth - leftMargin - rightMargin; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
315 |
maxHeight = screenHeight - chromeHeight - toolbarHeight; |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
316 |
|
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
317 |
if (mAudioItem) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
318 |
mAudioItem->setStretched(false); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
319 |
} |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
320 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
321 |
|
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
322 |
// Slide Counter |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
323 |
QSizeF slideCounterSize(0, 0); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
324 |
if (mSlideCounter) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
325 |
slideCounterSize = mSlideCounter->effectiveSizeHint(which, constraint); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
326 |
mSlideCounter->show(); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
327 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
328 |
// Audio Item |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
329 |
QSizeF audioSize(0, 0); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
330 |
if (mAudioItem) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
331 |
audioSize = mAudioItem->effectiveSizeHint(which, constraint); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
332 |
mAudioItem->show(); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
333 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
334 |
|
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
335 |
// Text Item |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
336 |
QSizeF textSize(0, 0); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
337 |
if (mTextItem) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
338 |
textSize = mTextItem->effectiveSizeHint(which, constraint); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
339 |
mTextItem->show(); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
340 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
341 |
|
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
342 |
// Pixmap Item |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
343 |
QSizeF pixmapSize(0, 0); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
344 |
if (mPixmapItem) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
345 |
qreal imageWidth = mPixmapItem->icon().defaultSize().width(); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
346 |
qreal imageHeight = mPixmapItem->icon().defaultSize().height(); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
347 |
|
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
348 |
qreal widthToSet = 0.0; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
349 |
qreal heightToSet = 0.0; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
350 |
|
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
351 |
if (imageWidth < iconSize) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
352 |
widthToSet = iconSize; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
353 |
heightToSet = iconSize; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
354 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
355 |
else if (imageWidth <= maxWidth) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
356 |
// resize not needed |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
357 |
widthToSet = imageWidth; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
358 |
heightToSet = qMin(imageHeight, maxHeight); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
359 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
360 |
else { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
361 |
// resize needed, keep aspect-ratio and resize |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
362 |
widthToSet = maxWidth; |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
363 |
heightToSet = maxWidth * (imageHeight / imageWidth); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
364 |
heightToSet = qMin(heightToSet, maxHeight); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
365 |
|
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
366 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
367 |
if (heightToSet == maxHeight) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
368 |
widthToSet = heightToSet * (imageWidth / imageHeight); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
369 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
370 |
|
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
371 |
pixmapSize.setHeight(heightToSet); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
372 |
pixmapSize.setWidth(widthToSet); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
373 |
mPixmapItem->setPreferredSize(pixmapSize); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
374 |
mPixmapItem->show(); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
375 |
} |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
376 |
|
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
377 |
// Calculate the size hint to be returned. |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
378 |
szHint.setHeight(0); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
379 |
|
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
380 |
if (!slideCounterSize.isNull()) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
381 |
szHint.rheight() += (slideCounterSize.height() + spacing); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
382 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
383 |
if (!audioSize.isNull()) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
384 |
szHint.rheight() += (audioSize.height() + spacing); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
385 |
} |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
386 |
|
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
387 |
if (mainWindow->orientation() == Qt::Horizontal) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
388 |
qreal remainingHeight = qMax(pixmapSize.height(), textSize.height()); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
389 |
if (remainingHeight > 0.0) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
390 |
szHint.rheight() += (remainingHeight + spacing); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
391 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
392 |
} |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
393 |
else if (mainWindow->orientation() == Qt::Vertical) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
394 |
if (!pixmapSize.isNull()) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
395 |
szHint.rheight() += (pixmapSize.height() + spacing); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
396 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
397 |
if (!textSize.isNull()) { |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
398 |
szHint.rheight() += (textSize.height() + spacing); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
399 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
400 |
} |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
401 |
szHint.rheight() = qMax(maxHeight, szHint.height()); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
402 |
|
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
403 |
return szHint; |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
404 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
405 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
406 |
//--------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
407 |
//UniViewerBodyWidget::longPressed |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
408 |
// @see header file |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
409 |
//--------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
410 |
void UniViewerBodyWidget::longPressed(QPointF position) |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
411 |
{ |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
412 |
|
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
413 |
HbMenu* menu = new HbMenu; |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
414 |
menu->setAttribute(Qt::WA_DeleteOnClose); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
415 |
menu->addAction(LOC_OPEN, this, SLOT(openMedia())); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
416 |
menu->addAction(LOC_SAVE, this, SLOT(saveMedia())); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
417 |
menu->setPreferredPos(position); |
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
418 |
menu->show(); |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
419 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
420 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
421 |
//--------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
422 |
//UniViewerBodyWidget::openMedia |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
423 |
// @see header file |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
424 |
//--------------------------------------------------------------- |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
425 |
void UniViewerBodyWidget::openMedia() |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
426 |
{ |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
427 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
428 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
429 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
430 |
//UniViewerBodyWidget::openMedia |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
431 |
// @see header file |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
432 |
//--------------------------------------------------------------- |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
433 |
void UniViewerBodyWidget::openMedia(const QString& fileName) |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
434 |
{ |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
435 |
XQSharableFile sf; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
436 |
XQAiwRequest* request = 0; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
437 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
438 |
if (!sf.open(fileName)) { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
439 |
return; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
440 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
441 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
442 |
// Get handlers |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
443 |
XQApplicationManager appManager; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
444 |
QList<XQAiwInterfaceDescriptor> fileHandlers = appManager.list(sf); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
445 |
if (fileHandlers.count() > 0) { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
446 |
XQAiwInterfaceDescriptor d = fileHandlers.first(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
447 |
request = appManager.create(sf, d); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
448 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
449 |
if (!request) { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
450 |
sf.close(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
451 |
return; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
452 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
453 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
454 |
else { |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
455 |
sf.close(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
456 |
return; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
457 |
} |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
458 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
459 |
// Result handlers |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
460 |
connect(request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&))); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
461 |
connect(request, SIGNAL(requestError(const QVariant&)), this, |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
462 |
SLOT(handleError(const QVariant&))); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
463 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
464 |
request->setEmbedded(true); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
465 |
request->setSynchronous(true); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
466 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
467 |
// Fill args |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
468 |
QList<QVariant> args; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
469 |
args << qVariantFromValue(sf); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
470 |
request->setArguments(args); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
471 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
472 |
// Fill headers |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
473 |
QString key("WindowTitle"); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
474 |
QVariant value(QString(LOC_TITLE)); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
475 |
XQRequestInfo info; |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
476 |
info.setInfo(key, value); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
477 |
request->setInfo(info); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
478 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
479 |
request->send(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
480 |
|
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
481 |
// Cleanup |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
482 |
sf.close(); |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
483 |
delete request; |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
484 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
485 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
486 |
//--------------------------------------------------------------- |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
487 |
//UniViewerBodyWidget::saveMedia |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
488 |
// @see header file |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
489 |
//--------------------------------------------------------------- |
27
e4592d119491
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
490 |
void UniViewerBodyWidget::saveMedia() |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
491 |
{ |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
492 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
493 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
494 |
//--------------------------------------------------------------- |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
495 |
// UniViewerBodyWidget :: handleOk |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
496 |
// @see header file |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
497 |
//--------------------------------------------------------------- |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
498 |
void UniViewerBodyWidget::handleOk(const QVariant& result) |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
499 |
{ |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
500 |
Q_UNUSED(result) |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
501 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
502 |
|
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
503 |
//--------------------------------------------------------------- |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
504 |
// UniViewerBodyWidget :: handleError |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
505 |
// @see header file |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
506 |
//--------------------------------------------------------------- |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
507 |
void UniViewerBodyWidget::handleError(int errorCode, const QString& errorMessage) |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
508 |
{ |
25
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
509 |
Q_UNUSED(errorMessage) |
84d9eb65b26f
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
510 |
Q_UNUSED(errorCode) |
23
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
511 |
} |
238255e8b033
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
512 |
// EOF |