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: |
|
15 * The source file for tone fetcher view. |
|
16 * |
|
17 */ |
|
18 #include "tonefetcherview.h" |
|
19 #include "tonefetcherwidget.h" |
|
20 #include <hbaction.h> |
|
21 #include <hbtoolbar.h> |
|
22 #include "tonefetcher.h" |
|
23 #include <qcoreapplication.h> |
|
24 |
|
25 ToneFetcherView::ToneFetcherView(ToneFetcher *service) : mServiceProvider(service) |
|
26 { |
|
27 setTitle(hbTrId("Tone Selection"));//need change according to ps file |
|
28 initToolBar(); |
|
29 initMainWidget(); |
|
30 QMetaObject::connectSlotsByName(this); |
|
31 |
|
32 } |
|
33 |
|
34 ToneFetcherView::~ToneFetcherView() |
|
35 { |
|
36 removeToolBarAction(); |
|
37 } |
|
38 |
|
39 void ToneFetcherView::initMainWidget() |
|
40 { |
|
41 mWidget = new ToneFetcherWidget(this, this); |
|
42 Q_ASSERT(mWidget); |
|
43 setWidget(mWidget); |
|
44 //mWidget->setCurrentToolBarType( ToneServiceWidget::GeneralTone ); |
|
45 connect(mWidget, SIGNAL(triggerToolBar(bool)), this, SLOT(enableToolBar(bool))); |
|
46 } |
|
47 |
|
48 void ToneFetcherView::quit() |
|
49 { |
|
50 connect(mServiceProvider, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); |
|
51 mServiceProvider->complete(); |
|
52 } |
|
53 |
|
54 void ToneFetcherView::initToolBar() |
|
55 { |
|
56 mToolBarLeftAction = new HbAction(this); |
|
57 mToolBarLeftAction->setObjectName("leftAction"); |
|
58 mToolBarLeftAction->setText(hbTrId("Play/Pause"));//need change according to ps file |
|
59 toolBar()->addAction(mToolBarLeftAction); |
|
60 mToolBarLeftAction->setEnabled(false); |
|
61 |
|
62 mToolBarRightAction = new HbAction(this); |
|
63 mToolBarRightAction->setObjectName("rightAction"); |
|
64 mToolBarRightAction->setText(hbTrId("Select"));//need change according to ps file |
|
65 mToolBarRightAction->setEnabled(false); |
|
66 toolBar()->addAction(mToolBarRightAction); |
|
67 |
|
68 toolBar()->setOrientation(Qt::Horizontal); |
|
69 toolBar()->setEnabled(false); |
|
70 |
|
71 } |
|
72 |
|
73 void ToneFetcherView::on_leftAction_triggered() |
|
74 { |
|
75 mWidget->playOrPause(); |
|
76 |
|
77 } |
|
78 |
|
79 void ToneFetcherView::on_rightAction_triggered() |
|
80 { |
|
81 emit itemSelected(mWidget->getCurrentItemPath()); |
|
82 quit(); |
|
83 /*QDir dir("c:\\data\\Sounds\\Simple\\"); |
|
84 dir.remove("def.aac"); |
|
85 dir.remove("abc.aac"); */ |
|
86 } |
|
87 |
|
88 void ToneFetcherView::enableToolBar(bool enable) |
|
89 { |
|
90 mToolBarRightAction->setEnabled(enable); |
|
91 mToolBarLeftAction->setEnabled(enable); |
|
92 toolBar()->setEnabled(enable); |
|
93 } |
|
94 |
|
95 void ToneFetcherView::removeToolBarAction() |
|
96 { |
|
97 toolBar()->removeAction(mToolBarRightAction); |
|
98 toolBar()->removeAction(mToolBarLeftAction); |
|
99 } |
|
100 //End of File |
|