11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 * Version : %version: 5 % |
16 * Version : %version: 8 % |
17 */ |
17 */ |
18 #include "mywindow.h" |
18 #include "mywindow.h" |
19 #include <hbmenu.h> |
19 #include <HbMenu> |
20 #include <hbaction.h> |
20 #include <HbAction> |
21 #include <hbmainwindow.h> |
21 #include <HbMainWindow> |
22 #include <hbslider.h> |
22 #include <HbSlider> |
23 #include <QTimer> |
23 #include <QTimer> |
24 #include <QtGui> |
24 #include <QtGui> |
25 #include <QDebug> |
25 #include <QDebug> |
26 #include <QPushButton> |
26 #include <QPushButton> |
27 #include <QApplication> |
27 #include <QApplication> |
28 #include <QGraphicsLinearLayout> |
28 #include <QGraphicsLinearLayout> |
29 #include <QCoreApplication> |
29 #include <QCoreApplication> |
30 #include <hbgridview.h> |
30 #include <HbGridView> |
31 #include <hbinstance.h> |
31 #include <HbInstance> |
32 #include <HbInputDialog> |
32 #include <HbInputDialog> |
33 #include <QFileSystemWatcher> |
33 #include <QFileSystemWatcher> |
34 #include <hgwidgets/hgcacheproxymodel.h> |
34 #include <hgwidgets/hgcacheproxymodel.h> |
|
35 #include <hgwidgets/hgmediawall.h> |
|
36 #include <hgwidgets/hggrid.h> |
35 |
37 |
36 #include "mydataprovider.h" |
38 #include "mydataprovider.h" |
37 #include "hglogger.h" |
39 #include "hglogger.h" |
38 |
40 |
39 const int KGridViewCommand = 1; |
41 const int KGridViewCommand = 1; |
40 const int KListViewCommand = 2; |
42 const int KListViewCommand = 2; |
|
43 const int KMediaWallViewCommand = 3; |
|
44 const int KHgGridViewCommand = 4; |
41 |
45 |
42 const int KSort1Command = 1101; |
46 const int KSort1Command = 1101; |
43 const int KSort2Command = 1102; |
47 const int KSort2Command = 1102; |
44 const int KSort3Command = 1103; |
48 const int KSort3Command = 1103; |
45 const int KSortCaseSensitiveCommand = 1104; |
49 const int KSortCaseSensitiveCommand = 1104; |
67 const int KRemoveLastCommand = 2205; |
71 const int KRemoveLastCommand = 2205; |
68 const int KRemoveEnd10Command = 2206; |
72 const int KRemoveEnd10Command = 2206; |
69 const int KRemoveCustomCommand = 2207; |
73 const int KRemoveCustomCommand = 2207; |
70 const int KShowImagesCommand = 2300; |
74 const int KShowImagesCommand = 2300; |
71 const int KShowAudioCommand = 2301; |
75 const int KShowAudioCommand = 2301; |
|
76 const int KHbIconModeCommand = 2400; |
|
77 const int KQIconModeCommand = 2401; |
|
78 const int KQImageModeCommand = 2402; |
|
79 const int KQPixmapModeCommand = 2403; |
72 |
80 |
73 const int KResetCommand = 10000; |
81 const int KResetCommand = 10000; |
74 |
82 |
75 MyWindow::MyWindow() |
83 MyWindow::MyWindow() |
76 : HbMainWindow(), |
84 : HbMainWindow(), |
120 } |
128 } |
121 |
129 |
122 void MyWindow::addChangeViewMenu(HbMenu* parent) |
130 void MyWindow::addChangeViewMenu(HbMenu* parent) |
123 { |
131 { |
124 HbMenu *viewSubMenu = parent->addMenu("Change view"); |
132 HbMenu *viewSubMenu = parent->addMenu("Change view"); |
125 HbAction* action = viewSubMenu->addAction("GridView"); |
133 HbAction* action = viewSubMenu->addAction("Orbit Grid View"); |
126 action->setData(QVariant(KGridViewCommand)); |
134 action->setData(QVariant(KGridViewCommand)); |
127 action = viewSubMenu->addAction("ListView"); |
135 action = viewSubMenu->addAction("Orbit List View"); |
128 action->setData(QVariant(KListViewCommand)); |
136 action->setData(QVariant(KListViewCommand)); |
|
137 action = viewSubMenu->addAction("Hg MediaWall"); |
|
138 action->setData(QVariant(KMediaWallViewCommand)); |
|
139 action = viewSubMenu->addAction("Hg Grid"); |
|
140 action->setData(QVariant(KHgGridViewCommand)); |
|
141 |
|
142 |
129 } |
143 } |
130 |
144 |
131 void MyWindow::addCacheProxyModelMenu(HbMenu* parent) |
145 void MyWindow::addCacheProxyModelMenu(HbMenu* parent) |
132 { |
146 { |
133 |
147 |
209 action = dpSubMenu->addAction("Show Images"); |
223 action = dpSubMenu->addAction("Show Images"); |
210 action->setData(QVariant(KShowImagesCommand)); |
224 action->setData(QVariant(KShowImagesCommand)); |
211 action = dpSubMenu->addAction("Show Audio"); |
225 action = dpSubMenu->addAction("Show Audio"); |
212 action->setData(QVariant(KShowAudioCommand)); |
226 action->setData(QVariant(KShowAudioCommand)); |
213 |
227 |
|
228 action = dpSubMenu->addAction("HbIcon Mode"); |
|
229 action->setData(QVariant(KHbIconModeCommand)); |
|
230 action = dpSubMenu->addAction("QIcon Mode"); |
|
231 action->setData(QVariant(KQIconModeCommand)); |
|
232 action = dpSubMenu->addAction("QImage Mode"); |
|
233 action->setData(QVariant(KQImageModeCommand)); |
|
234 action = dpSubMenu->addAction("QPixmap Mode"); |
|
235 action->setData(QVariant(KQPixmapModeCommand)); |
|
236 |
214 } |
237 } |
215 |
238 |
216 |
239 |
217 |
240 |
218 void MyWindow::processAction( HbAction* action ) |
241 void MyWindow::processAction( HbAction* action ) |
244 view->setModel(mModel); |
267 view->setModel(mModel); |
245 mMainView->setWidget( view ); |
268 mMainView->setWidget( view ); |
246 mView = view; |
269 mView = view; |
247 break; |
270 break; |
248 } |
271 } |
|
272 case KMediaWallViewCommand : { |
|
273 HgMediawall * view = new HgMediawall(); |
|
274 view->setModel(mModel); |
|
275 mMainView->setWidget( view ); |
|
276 mView = view; |
|
277 break; |
|
278 } |
|
279 case KHgGridViewCommand : { |
|
280 HgGrid * view = new HgGrid(Qt::Vertical); |
|
281 view->setModel(mModel); |
|
282 mMainView->setWidget( view ); |
|
283 mView = view; |
|
284 break; |
|
285 } |
249 case KSort1Command : { |
286 case KSort1Command : { |
250 mModel->setSortRole(Qt::UserRole+2); |
287 mModel->setSortRole(Qt::UserRole+2); |
251 mModel->sort(0); |
288 mModel->sort(0); |
252 break; |
289 break; |
253 } |
290 } |
370 mMyDataProvider->testInsertItem(mMyDataProvider->rowCount(QModelIndex())-10, data); |
407 mMyDataProvider->testInsertItem(mMyDataProvider->rowCount(QModelIndex())-10, data); |
371 delete data; |
408 delete data; |
372 break; |
409 break; |
373 } |
410 } |
374 case KInsertCustomCommand : { |
411 case KInsertCustomCommand : { |
375 int val = HbInputDialog::getInteger( QString("Insert at position:")); |
412 //TODO fix me |
376 QList< QPair< QVariant, int > >* data = new QList< QPair< QVariant, int > >(); |
413 // int val = HbInputDialog::getInteger( QString("Insert at position:")); |
377 data->append( QPair< QVariant, int >(QString("NEW ITEM!!!!"), Qt::DisplayRole) ); |
414 // QList< QPair< QVariant, int > >* data = new QList< QPair< QVariant, int > >(); |
378 mMyDataProvider->testInsertItem(val, data); |
415 // data->append( QPair< QVariant, int >(QString("NEW ITEM!!!!"), Qt::DisplayRole) ); |
|
416 // mMyDataProvider->testInsertItem(val, data); |
379 break; |
417 break; |
380 } |
418 } |
381 case KRemove0Command : { |
419 case KRemove0Command : { |
382 mMyDataProvider->testRemoveItem(0); |
420 mMyDataProvider->testRemoveItem(0); |
383 break; |
421 break; |
405 case KRemoveEnd10Command : { |
443 case KRemoveEnd10Command : { |
406 mMyDataProvider->testRemoveItem(mMyDataProvider->rowCount(QModelIndex()) - 10); |
444 mMyDataProvider->testRemoveItem(mMyDataProvider->rowCount(QModelIndex()) - 10); |
407 break; |
445 break; |
408 } |
446 } |
409 case KRemoveCustomCommand : { |
447 case KRemoveCustomCommand : { |
410 int val = HbInputDialog::getInteger( QString("Remove from position:")); |
448 //TODO fix me |
411 mMyDataProvider->testRemoveItem(val); |
449 // int val = HbInputDialog::getInteger( QString("Remove from position:")); |
|
450 // mMyDataProvider->testRemoveItem(val); |
412 break; |
451 break; |
413 } |
452 } |
414 case KShowImagesCommand : { |
453 case KShowImagesCommand : { |
415 mMyDataProvider->changeIconSize(ThumbnailManager::ThumbnailMedium); |
454 mMyDataProvider->changeIconSize(ThumbnailManager::ThumbnailMedium); |
416 mMyDataProvider->changeMode(0); |
455 mMyDataProvider->changeMode(0); |
417 break; |
456 break; |
418 } |
457 } |
419 case KShowAudioCommand : { |
458 case KShowAudioCommand : { |
420 mMyDataProvider->changeIconSize(ThumbnailManager::ThumbnailSmall); |
459 mMyDataProvider->changeIconSize(ThumbnailManager::ThumbnailSmall); |
421 mMyDataProvider->changeMode(1); |
460 mMyDataProvider->changeMode(1); |
|
461 break; |
|
462 } |
|
463 |
|
464 case KHbIconModeCommand : { |
|
465 mMyDataProvider->setIconMode(HgDataProviderModel::HgDataProviderIconHbIcon); |
|
466 break; |
|
467 } |
|
468 case KQIconModeCommand : { |
|
469 mMyDataProvider->setIconMode(HgDataProviderModel::HgDataProviderIconQIcon); |
|
470 break; |
|
471 } |
|
472 case KQImageModeCommand : { |
|
473 mMyDataProvider->setIconMode(HgDataProviderModel::HgDataProviderIconQImage); |
|
474 break; |
|
475 } |
|
476 case KQPixmapModeCommand : { |
|
477 mMyDataProvider->setIconMode(HgDataProviderModel::HgDataProviderIconQPixmap); |
422 break; |
478 break; |
423 } |
479 } |
424 case KResetCommand : { |
480 case KResetCommand : { |
425 mMyDataProvider->resetModel(); |
481 mMyDataProvider->resetModel(); |
426 break; |
482 break; |