| 1 |
/* ============================================================ |
| 2 |
* |
| 3 |
* This file is a part of digiKam project |
| 4 |
* https://www.digikam.org |
| 5 |
* |
| 6 |
* Date : 2009-03-25 |
| 7 |
* Description : Tree View for album models |
| 8 |
* |
| 9 |
* SPDX-FileCopyrightText: 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> |
| 10 |
* SPDX-FileCopyrightText: 2010-2011 by Andi Clemens <andi dot clemens at gmail dot com> |
| 11 |
* SPDX-FileCopyrightText: 2014 by Mohamed_Anwer <m_dot_anwer at gmx dot com> |
| 12 |
* SPDX-FileCopyrightText: 2014 by Michael G. Hansen <mike at mghansen dot de> |
| 13 |
* SPDX-FileCopyrightText: 2009-2026 by Gilles Caulier <caulier dot gilles at gmail dot com> |
| 14 |
* |
| 15 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 16 |
* |
| 17 |
* ============================================================ */ |
| 18 |
|
| 19 |
#include "datetreeview.h" |
| 20 |
|
| 21 |
// Local includes |
| 22 |
|
| 23 |
#include "abstractalbumtreeview_p.h" |
| 24 |
|
| 25 |
namespace Digikam |
| 26 |
{ |
| 27 |
|
| 28 |
DateTreeView::DateTreeView(QWidget* const parent, Flags flags) |
| 29 |
: AbstractCountingAlbumTreeView(parent, flags | AlwaysShowInclusiveCounts) |
| 30 |
{ |
| 31 |
if (flags & CreateDefaultModel) |
| 32 |
{ |
| 33 |
setAlbumModel(new DateAlbumModel(this)); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
void DateTreeView::setDAlbumModel(DateAlbumModel* const model) |
| 38 |
{ |
| 39 |
AbstractCountingAlbumTreeView::setAlbumModel(model); |
| 40 |
} |
| 41 |
|
| 42 |
DateAlbumModel* DateTreeView::dalbumModel() const |
| 43 |
{ |
| 44 |
return static_cast<DateAlbumModel*>(m_albumModel); |
| 45 |
} |
| 46 |
|
| 47 |
void DateTreeView::setAlbumFilterModel(AlbumFilterModel* const filterModel) |
| 48 |
{ |
| 49 |
AbstractCountingAlbumTreeView::setAlbumFilterModel(filterModel); |
| 50 |
} |
| 51 |
|
| 52 |
DAlbum* DateTreeView::currentAlbum() const |
| 53 |
{ |
| 54 |
return dynamic_cast<DAlbum*> (m_albumFilterModel->albumForIndex(currentIndex())); |
| 55 |
} |
| 56 |
|
| 57 |
DAlbum* DateTreeView::albumForIndex(const QModelIndex& index) const |
| 58 |
{ |
| 59 |
return dynamic_cast<DAlbum*> (m_albumFilterModel->albumForIndex(index)); |
| 60 |
} |
| 61 |
|
| 62 |
void DateTreeView::setCurrentAlbum(int albumId, bool selectInAlbumManager) |
| 63 |
{ |
| 64 |
DAlbum* const album = AlbumManager::instance()->findDAlbum(albumId); // cppcheck-suppress constVariablePointer |
| 65 |
setCurrentAlbums(QList<Album*>() << album, selectInAlbumManager); |
| 66 |
} |
| 67 |
|
| 68 |
} // namespace Digikam |
| 69 |
|
| 70 |
#include "moc_datetreeview.cpp" |