add: some plugin support.
This commit is contained in:
@@ -35,7 +35,7 @@ public:
|
||||
explicit PluginNode(struct olive_node_methods methods):Node()
|
||||
{
|
||||
this->methods=methods;
|
||||
}PLUGIN_H
|
||||
}
|
||||
void setMethods(struct olive_node_methods methods)
|
||||
{
|
||||
this->methods=methods;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <cstdio>
|
||||
#include <QMessageBox>
|
||||
#include <qmessagebox.h>
|
||||
#include <qobject.h>
|
||||
#include <string.h>
|
||||
#include <QString>
|
||||
namespace olive{
|
||||
@@ -59,6 +60,48 @@ OfxStatus OliveInstance::vmessage(const char* type,
|
||||
return kOfxStatOK;
|
||||
}
|
||||
}
|
||||
OfxStatus OliveInstance::setPersistentMessage(const char* type,
|
||||
const char* id,
|
||||
const char* format,
|
||||
va_list args){
|
||||
char *buffer=new char[1024];
|
||||
|
||||
memset(buffer, 0, 1024*sizeof(char));
|
||||
int ret=vsprintf(buffer, format, args);
|
||||
if(ret<0){
|
||||
return kOfxStatFailed;
|
||||
}
|
||||
QString message(buffer);
|
||||
|
||||
delete [] buffer;
|
||||
|
||||
// If This is a error message
|
||||
if(strncmp(type, kOfxMessageError, strlen(kOfxMessageError))==0){
|
||||
persistentErrors_.append({ErrorType::Error, message});
|
||||
QMessageBox::critical(nullptr, "", message);
|
||||
// TODO: tell the shell to show the error
|
||||
}
|
||||
// A warning
|
||||
else if(strncmp(type, kOfxMessageWarning, strlen(kOfxMessageError))==0){
|
||||
persistentErrors_.append({ErrorType::Warning, message});
|
||||
QMessageBox::warning(nullptr, "", message);
|
||||
// TODO: tell the shell to show the warning
|
||||
|
||||
}
|
||||
// A simple information
|
||||
else if(strncmp(type, kOfxMessageMessage, strlen(kOfxMessageError))==0){
|
||||
persistentErrors_.append({ErrorType::Message, message});
|
||||
QMessageBox::information(nullptr, "", message);
|
||||
}
|
||||
else{
|
||||
return kOfxStatFailed;
|
||||
}
|
||||
return kOfxStatOK;
|
||||
}
|
||||
OfxStatus OliveInstance::clearPersistentMessage(){
|
||||
persistentErrors_.clear();
|
||||
// TODO: tell the shell to remove message.
|
||||
return kOfxStatOK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,24 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ofxCore.h"
|
||||
#include "ofxImageEffect.h"
|
||||
#include <QString>
|
||||
#include "ofxhImageEffect.h"
|
||||
#include <map>
|
||||
#include <qcontainerfwd.h>
|
||||
#include <qlist.h>
|
||||
namespace olive {
|
||||
namespace plugin{
|
||||
enum class ErrorType{
|
||||
Error,
|
||||
Warning,
|
||||
Message
|
||||
};
|
||||
struct PersistentErrors{
|
||||
ErrorType type;
|
||||
QString message;
|
||||
};
|
||||
class OliveInstance : public OFX::Host::ImageEffect::Instance {
|
||||
public:
|
||||
OliveInstance(
|
||||
@@ -51,7 +65,8 @@ public:
|
||||
va_list args) override;
|
||||
|
||||
OfxStatus clearPersistentMessage() override;
|
||||
|
||||
private:
|
||||
QList<PersistentErrors> persistentErrors_;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user