File indexing completed on 2024-04-28 15:39:41

0001 /* SPDX-FileCopyrightText: 2014 Jesper K. Pedersen <blackie@kde.org>
0002 
0003    SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef REMOTECONTROL_ACTION_H
0007 #define REMOTECONTROL_ACTION_H
0008 
0009 #include "DiscoveryModel.h"
0010 #include "RemoteCommand.h"
0011 #include "Types.h"
0012 #include <QString>
0013 
0014 namespace RemoteControl
0015 {
0016 
0017 class Action
0018 {
0019 public:
0020     Action(const SearchInfo &searchInfo);
0021     void run();
0022     virtual void save() {};
0023 
0024 protected:
0025     virtual void execute() = 0;
0026     void setCurrentPage(Page page);
0027     void sendCommand(const RemoteCommand &command);
0028     void clearCategoryModel();
0029     SearchInfo m_searchInfo;
0030 };
0031 
0032 class ShowOverviewAction : public Action
0033 {
0034 public:
0035     ShowOverviewAction(const SearchInfo &searchInfo);
0036 
0037 protected:
0038     void execute() override;
0039 };
0040 
0041 class ShowCategoryValueAction : public Action
0042 {
0043 public:
0044     ShowCategoryValueAction(const SearchInfo &searchInfo, CategoryViewType type);
0045 
0046 protected:
0047     void execute() override;
0048     void save() override;
0049 
0050 private:
0051     CategoryViewType m_type;
0052     int m_index = 0;
0053 };
0054 
0055 class ShowThumbnailsAction : public Action
0056 {
0057 public:
0058     ShowThumbnailsAction(const SearchInfo &searchInfo);
0059 
0060 protected:
0061     void execute() override;
0062     void save() override;
0063 
0064 private:
0065     int m_index = 0;
0066 };
0067 
0068 class ShowImagesAction : public Action
0069 {
0070 public:
0071     ShowImagesAction(int imageId, const SearchInfo &searchInfo);
0072 
0073 protected:
0074     void execute() override;
0075 
0076 private:
0077     const int m_imageId;
0078 };
0079 
0080 class DiscoverAction : public Action
0081 {
0082 public:
0083     DiscoverAction(const SearchInfo &searchInfo, DiscoveryModel *model);
0084     void setCurrentSelection(const QList<int> &selection, const QList<int> &allImages);
0085 
0086 protected:
0087     void execute() override;
0088     QList<int> m_currentSelection;
0089     QList<int> m_allImages;
0090     DiscoveryModel *m_model;
0091 };
0092 
0093 } // namespace RemoteControl
0094 
0095 #endif // REMOTECONTROL_ACTION_H