File indexing completed on 2024-04-21 16:17:10

0001 /*
0002  *   Copyright 2013 Marco Martin <mart@kde.org>
0003  *
0004  *   This program is free software; you can redistribute it and/or modify
0005  *   it under the terms of the GNU Library General Public License as
0006  *   published by the Free Software Foundation; either version 2, or
0007  *   (at your option) any later version.
0008  *
0009  *   This program is distributed in the hope that it will be useful,
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *   GNU General Public License for more details
0013  *
0014  *   You should have received a copy of the GNU Library General Public
0015  *   License along with this program; if not, write to the
0016  *   Free Software Foundation, Inc.,
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0018  */
0019 
0020 #ifndef CONFIGVIEW_H
0021 #define CONFIGVIEW_H
0022 
0023 #include <QQuickView>
0024 
0025 //
0026 //  W A R N I N G
0027 //  -------------
0028 //
0029 // This file is not part of the public Plasma API.  It exists purely as an
0030 // implementation detail.  This header file may change from version to
0031 // version without notice, or even be removed.
0032 //
0033 // We mean it.
0034 //
0035 
0036 namespace Plasma {
0037 class Applet;
0038 }
0039 
0040 namespace PlasmaQuick {
0041 
0042 class ConfigViewPrivate;
0043 
0044 class ConfigModel;
0045 
0046 class ConfigView : public QQuickView
0047 {
0048     Q_OBJECT
0049     Q_PROPERTY(PlasmaQuick::ConfigModel *configModel READ configModel CONSTANT)
0050     Q_PROPERTY(QString appletGlobalShortcut READ appletGlobalShortcut WRITE setAppletGlobalShortcut NOTIFY appletGlobalShortcutChanged)
0051 
0052 public:
0053     /**
0054      * @param applet the applet of this ConfigView
0055      * @param parent the QWindow in which this ConfigView is parented to
0056      **/
0057     ConfigView(Plasma::Applet *applet, QWindow *parent = 0);
0058     ~ConfigView() override;
0059 
0060     virtual void init();
0061 
0062     Plasma::Applet *applet();
0063 
0064     QString appletGlobalShortcut() const;
0065     void setAppletGlobalShortcut(const QString &shortcut);
0066 
0067     /**
0068      * @return the ConfigModel of the ConfigView
0069      **/
0070     PlasmaQuick::ConfigModel *configModel() const;
0071 
0072 Q_SIGNALS:
0073     void appletGlobalShortcutChanged();
0074 
0075 protected:
0076     void hideEvent(QHideEvent *ev) override;
0077     void resizeEvent(QResizeEvent *re) override;
0078 
0079 private:
0080     ConfigViewPrivate *const d;
0081 
0082     Q_PRIVATE_SLOT(d, void updateMinimumWidth())
0083     Q_PRIVATE_SLOT(d, void updateMinimumHeight())
0084     Q_PRIVATE_SLOT(d, void updateMaximumWidth())
0085     Q_PRIVATE_SLOT(d, void updateMaximumHeight())
0086 };
0087 
0088 }
0089 
0090 #endif // multiple inclusion guard