File indexing completed on 2024-05-19 04:29:19

0001 /*
0002  * SPDX-FileCopyrightText: 2005-2006 Peter Simonsson <psn@linux.se>
0003  * SPDX-License-Identifier: LGPL-2.0-or-later
0004  */
0005 
0006 #ifndef KIS_TEMPLATES_PANE_H
0007 #define KIS_TEMPLATES_PANE_H
0008 
0009 #include "KisDetailsPane.h"
0010 
0011 class KisTemplate;
0012 class KisTemplateGroup;
0013 
0014 class KisTemplatesPanePrivate;
0015 
0016 /**
0017  * This widget is the right-side part of the template opening widget.
0018  * This widget shows a list of templates and can show their details or open it.
0019  */
0020 class KisTemplatesPane : public KisDetailsPane
0021 {
0022 
0023     Q_OBJECT
0024 public:
0025     /**
0026      * Constructor.
0027      * @param parent the parent widget
0028      * @param header string used as header text in the listview
0029      * @param group the group of templates this widget will show.
0030      * @param defaultTemplate pointer to the default template. Used to select a
0031      * template when none has been selected before.
0032     */
0033     KisTemplatesPane(QWidget* parent, const QString& header,
0034                     KisTemplateGroup* group, KisTemplate* defaultTemplate);
0035     ~KisTemplatesPane() override;
0036 
0037     /// Returns true if a template in this group was the last one selected
0038     bool isSelected();
0039 
0040 Q_SIGNALS:
0041     /// Emitted when the always use checkbox is selected
0042     void alwaysUseChanged(KisTemplatesPane* sender, const QString& alwaysUse);
0043 
0044 protected Q_SLOTS:
0045     void selectionChanged(const QModelIndex& index) override;
0046 
0047     void openFile() override;
0048     void openFile(const QModelIndex& index) override;
0049     void alwaysUseClicked();
0050     void changeAlwaysUseTemplate(KisTemplatesPane* sender, const QString& alwaysUse);
0051 
0052 private:
0053     KisTemplatesPanePrivate * const d;
0054 };
0055 
0056 #endif