1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
/*
Q Light Controller Plus
functioneditor.h
Copyright (c) Massimo Callegari
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef FUNCTIONEDITOR_H
#define FUNCTIONEDITOR_H
#include <QQmlContext>
#include <QQuickView>
#include <QQuickItem>
#include <QObject>
#include "function.h"
class Doc;
class FunctionEditor : public QObject
{
Q_OBJECT
Q_PROPERTY(QString functionName READ functionName WRITE setFunctionName NOTIFY functionNameChanged)
Q_PROPERTY(int previousID READ previousID WRITE setPreviousID NOTIFY previousIDChanged)
Q_PROPERTY(bool previewEnabled READ previewEnabled WRITE setPreviewEnabled NOTIFY previewEnabledChanged)
Q_PROPERTY(int tempoType READ tempoType WRITE setTempoType NOTIFY tempoTypeChanged)
Q_PROPERTY(int fadeInSpeed READ fadeInSpeed WRITE setFadeInSpeed NOTIFY fadeInSpeedChanged)
Q_PROPERTY(int holdSpeed READ holdSpeed WRITE setHoldSpeed NOTIFY holdSpeedChanged)
Q_PROPERTY(int fadeOutSpeed READ fadeOutSpeed WRITE setFadeOutSpeed NOTIFY fadeOutSpeedChanged)
Q_PROPERTY(int duration READ duration NOTIFY durationChanged)
Q_PROPERTY(int runOrder READ runOrder WRITE setRunOrder NOTIFY runOrderChanged)
Q_PROPERTY(int direction READ direction WRITE setDirection NOTIFY directionChanged)
public:
FunctionEditor(QQuickView *view, Doc *doc, QObject *parent = 0);
virtual ~FunctionEditor();
/** Set the ID of the Function being edit */
virtual void setFunctionID(quint32 ID);
/** Return the ID of the Function being edited */
virtual quint32 functionID() const;
/** Return the type of the Function being edited */
virtual Function::Type functionType() const;
/** Get/Set the preview status of the Function being edited */
virtual bool previewEnabled() const;
virtual void setPreviewEnabled(bool enable);
/** Get/Set the name of the Function being edited */
virtual QString functionName() const;
virtual void setFunctionName(QString functionName);
/** Get the ID of the view that was open before this editor.
* This is to handle Collection -> Function and back */
int previousID() const;
void setPreviousID(int previousID);
/** Generic method to delete items of an editor.
* $list might be a list of indices, IDs or something else */
virtual void deleteItems(QVariantList list);
signals:
void functionNameChanged(QString functionName);
void previousIDChanged(int previousID);
void previewEnabledChanged(bool enabled);
protected:
/** Reference of the QML view */
QQuickView *m_view;
/** Reference of the project workspace */
Doc *m_doc;
/** ID of the Function being edited */
quint32 m_functionID;
/** ID of the item of the previous view */
int m_previousID;
/** Reference of the Function being edited */
Function *m_function;
/** Type of the Function being edited */
Function::Type m_functionType;
/** Flag that holds if the editor should preview its function */
bool m_previewEnabled;
/************************************************************************
* Speed
************************************************************************/
public:
/** Get/Set the tempo type of the Function being edited */
virtual int tempoType() const;
virtual void setTempoType(int tempoType);
/** Get/Set the Function fade in speed */
virtual int fadeInSpeed() const;
virtual void setFadeInSpeed(int fadeInSpeed);
/** Get/Set the Function hold speed */
virtual int holdSpeed() const;
virtual void setHoldSpeed(int holdSpeed);
/** Get/Set the Function fade out speed */
virtual int fadeOutSpeed() const;
virtual void setFadeOutSpeed(int fadeOutSpeed);
/** Get the Function duration */
virtual int duration() const;
signals:
void tempoTypeChanged(int tempoType);
void fadeInSpeedChanged(int fadeInSpeed);
void holdSpeedChanged(int holdSpeed);
void fadeOutSpeedChanged(int fadeOutSpeed);
void durationChanged(int duration);
/************************************************************************
* Run order and direction
************************************************************************/
public:
/** Get/Set the Function run order */
virtual int runOrder() const;
virtual void setRunOrder(int runOrder);
/** Get/Set the Function run direction */
virtual int direction() const;
virtual void setDirection(int direction);
signals:
void runOrderChanged(int runOrder);
void directionChanged(int direction);
};
#endif // SCENEEDITOR_H
|