File indexing completed on 2024-05-05 17:33:58

0001 /*
0002  *   SPDX-FileCopyrightText: 2012 Matthias Fuchs <mat69@gmx.net>
0003  *
0004  *   SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef STRIP_SELECTOR_H
0008 #define STRIP_SELECTOR_H
0009 
0010 #include <QObject>
0011 
0012 #include "comicinfo.h"
0013 #include "engine/types.h"
0014 
0015 class ComicData;
0016 
0017 /**
0018  * Enables users to visually select a strip they want to navigate to.
0019  * Subclasses implement different Selectors for the different comic
0020  * types.
0021  * @note use the StripSelectorFactory to retrieve an appropriate
0022  * StripSelector
0023  */
0024 class StripSelector : public QObject
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     ~StripSelector() override;
0030 
0031     /**
0032      * Select a strip depending on the subclass
0033      * @param currentStrip the currently active strip
0034      * @note StripSelector takes care to delete itself
0035      */
0036     virtual void select(const ComicData &currentStrip) = 0;
0037 
0038 Q_SIGNALS:
0039     /**
0040      * @param strip the selected strip, can be empty
0041      *
0042      */
0043     void stripChosen(const QString &strip);
0044 
0045 protected:
0046     explicit StripSelector(QObject *parent = nullptr);
0047 };
0048 
0049 /**
0050  * Class to retrieve the correct StripSelector depending on the
0051  * specified IdentifierType
0052  */
0053 class StripSelectorFactory
0054 {
0055 public:
0056     static StripSelector *create(IdentifierType type);
0057 };
0058 
0059 #endif