Commit cf00393b authored by Matthieu Gallien's avatar Matthieu Gallien 🎵 Committed by Nate Graham
Browse files

factor code to open all kind of views

parent 36837db1
......@@ -225,26 +225,7 @@ void ViewManager::openView(int viewIndex)
d->mTargetView = viewData.mViewType;
if (d->mCurrentView != d->mTargetView) {
switch (viewData.mViewPresentationType)
{
case ViewPresentationType::GridView:
Q_EMIT openGridView(d->mTargetView, viewData.mFilterType, 1, viewData.mMainTitle, {}, viewData.mMainImage, viewData.mDataType,
viewData.mFallbackItemIcon, {}, {}, viewData.mViewCanBeRated, viewData.mShowSecondaryTextOnDelegates);
break;
case ViewPresentationType::ListView:
Q_EMIT openListView(d->mTargetView, viewData.mFilterType, 1, viewData.mMainTitle, {},
0, viewData.mMainImage, viewData.mDataType, viewData.mSortRole,
viewData.mSortOrder, viewData.mAlbumCardinality, viewData.mAlbumViewStyle, viewData.mRadioSpecificStyle);
break;
case ViewPresentationType::FileBrowserView:
Q_EMIT switchFilesBrowserView(d->mTargetView, 1, viewData.mMainTitle, viewData.mMainImage);
break;
case ContextView:
Q_EMIT switchContextView(d->mTargetView, 1, viewData.mMainTitle, viewData.mMainImage);
break;
case UnknownViewPresentation:
break;
}
openViewFromData(viewData);
}
}
......@@ -506,6 +487,30 @@ void ViewManager::radiosBrowserViewIsLoaded()
d->mCurrentView = ViewsType::RadiosBrowser;
}
void ViewManager::openViewFromData(const ViewParameters &viewData)
{
switch (viewData.mViewPresentationType)
{
case ViewPresentationType::GridView:
Q_EMIT openGridView(d->mTargetView, viewData.mFilterType, 1, viewData.mMainTitle, {}, viewData.mMainImage, viewData.mDataType,
viewData.mFallbackItemIcon, {}, {}, viewData.mViewCanBeRated, viewData.mShowSecondaryTextOnDelegates);
break;
case ViewPresentationType::ListView:
Q_EMIT openListView(d->mTargetView, viewData.mFilterType, 1, viewData.mMainTitle, {},
0, viewData.mMainImage, viewData.mDataType, viewData.mSortRole,
viewData.mSortOrder, viewData.mAlbumCardinality, viewData.mAlbumViewStyle, viewData.mRadioSpecificStyle);
break;
case ViewPresentationType::FileBrowserView:
Q_EMIT switchFilesBrowserView(d->mTargetView, 1, viewData.mMainTitle, viewData.mMainImage);
break;
case ContextView:
Q_EMIT switchContextView(d->mTargetView, 1, viewData.mMainTitle, viewData.mMainImage);
break;
case UnknownViewPresentation:
break;
}
}
void ViewManager::goBack()
{
Q_EMIT popOneView();
......
......@@ -28,6 +28,7 @@
#include <memory>
class ViewManagerPrivate;
class ViewParameters;
class ELISALIB_EXPORT ViewManager : public QObject
{
......@@ -182,6 +183,8 @@ private:
void radiosBrowserViewIsLoaded();
void openViewFromData(const ViewParameters &viewData);
private:
std::unique_ptr<ViewManagerPrivate> d;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment