예제 #1
0
dblist::dblist(QSqlDatabase db, QWidget *parent) :
    QWidget(parent)
{
    setMinimumWidth(600);
    layout_ = new QGridLayout(this);
    tableView_ = new QTableView(this);
    nameTarea_ = new QLabel("Tarea: ");
    dateTarea_ = new QLabel("Fecha: ");
    categoryTarea_ = new QLabel("Categoria: ");
    categoryTarea_->setWordWrap(true);
    categoryTarea_->setMinimumWidth(200);
    categoryTarea_->setMaximumWidth(200);
    categoryDescrTarea_ = new QLabel("Descripcion: ");
    categoryDescrTarea_->setWordWrap(true);
    categoryDescrTarea_->setMinimumWidth(200);
    categoryDescrTarea_->setMaximumWidth(200);
    tagTitle_ = new QLabel("Lista de etiquetas");
    tagsView_ = new QListView(this);
    tagsView_->setMinimumWidth(200);
    checkTarea_ = new QCheckBox("Realizada",this);

    layout_->addWidget(tableView_,0,0,1,3);
    layout_->addWidget(nameTarea_,1,0,1,1);
    layout_->addWidget(dateTarea_,1,1,1,1);
    layout_->addWidget(checkTarea_,1,2,1,1);
    layout_->addWidget(categoryTarea_,3,2,1,1);
    layout_->addWidget(categoryDescrTarea_,4,2,1,1);
    layout_->addWidget(tagTitle_,2,0,1,1);
    layout_->addWidget(tagsView_,3,0,2,1);
    db_ = db;

    onLoad();
}
예제 #2
0
파일: testhash.cpp 프로젝트: ivandzen/HSDB
Bool testhash::Parent::load(yamm::HSDBFile * file)  {
    if (!deserializeStaticData(file)) return false;
    if (!_instances.deserialize(file)) return false;
    if (!ChildTable.deserialize(file)) return false;
    onLoad();
    return true;
}
예제 #3
0
bool LoadMapWindow::handleKeyPress(SDL_KeyboardEvent& key) {
	if(pChildWindow != NULL) {
		bool ret = pChildWindow->handleKeyPress(key);
		return ret;
	}

	if(isEnabled() && (pWindowWidget != NULL)) {
		if(key.keysym.sym == SDLK_RETURN) {
			onLoad();
			return true;
		} else if(key.keysym.sym == SDLK_DELETE) {
		    int index = mapList.getSelectedIndex();
            if(index >= 0) {
                QstBox* pQstBox = QstBox::create(   strprintf(_("Do you really want to delete '%s' ?"), mapList.getEntry(index).c_str()),
                                                    _("No"),
                                                    _("Yes"),
                                                    QSTBOX_BUTTON2);

                pQstBox->setTextColor(color);

                openWindow(pQstBox);
            }

            return true;
		} else {
			return pWindowWidget->handleKeyPress(key);
		}
	} else {
		return false;
	}
}
예제 #4
0
파일: Content.cpp 프로젝트: noriter/nit
void Content::load(bool activate)
{
	if (_disposed) NIT_THROW(EX_INVALID_STATE);

	ASSERT_THROW(_linked, EX_INVALID_STATE);

	if (_loaded) 
		return;

	if (_loading) 
		return; // TODO: Should we wait till loaded this case?

	_error = false;

	// TODO: detect if it is async (Thread::Current() == NULL?)

	{
		struct LoadingScope
		{
			Weak<Content> res;
			LoadingScope(Content* res)	: res(res)	{ res->_loading = true; }
			~LoadingScope()					{ if (res) res->_loading = false; }
		};

		LoadingScope lscope(this);

		onLoad(false);
	}

	if (_error)
		return;

	_loaded = true;
}
예제 #5
0
파일: audio.cpp 프로젝트: Alber70g/tdesktop
void VoiceMessagesLoader::onStart(AudioData *audio) {
	Loaders::iterator i = _loaders.find(audio);
	if (i != _loaders.end()) {
		delete (*i);
		_loaders.erase(i);
	}
	onLoad(audio);
}
예제 #6
0
void WebBrowser::setupConnections()
{
    connect(address_,SIGNAL(returnPressed()),this,SLOT(onLoad()));
    connect(refresh_,SIGNAL(pressed()),web_,SLOT(reload()));
    connect(forward_,SIGNAL(pressed()),web_,SLOT(forward()));
    connect(back_,SIGNAL(pressed()),web_,SLOT(back()));
    connect(home_,SIGNAL(pressed()),this,SLOT(onHome()));
    connect(web_,SIGNAL(urlChanged(QUrl)),this,SLOT(onUrlChange(QUrl)));
    connect(web_,SIGNAL(loadFinished(bool)),this,SLOT(onLoadFinished(bool)));
}
예제 #7
0
// 加载模块			   
void CModule::doLoad(unsigned short moduleId, const char* srvName, const unsigned int srvId, CConnectMgr* connectMgr, CCfg* srvMsgCommCfg)
{
	m_moduleId = moduleId;
	m_connectMgr = connectMgr;
	m_srvMsgCommCfg = srvMsgCommCfg;
	m_context.dstSrvId = getSrvId();
	m_context.dstModuleId = m_moduleId;
	
	onLoad(srvName, srvId, m_moduleId);
	onRegister(srvName, srvId, m_moduleId);  // 在此注册本模块处理的协议函数,绑定协议ID到实现函数
}
예제 #8
0
파일: DataSchema.cpp 프로젝트: noriter/nit
DataSchema* DataSchemaLookup::load(DataKey* key)
{
	if (key == NULL) return NULL;

	DataSchema* schema = get(key);

	if (schema == NULL)
		schema = onLoad(key);

	return schema;
}
예제 #9
0
파일: SDPLoader.cpp 프로젝트: LuckJC/pro-fw
void SDPLoader::onMessageReceived(const sp<AMessage> &msg) {
    switch (msg->what()) {
        case kWhatLoad:
            onLoad(msg);
            break;

        default:
            TRESPASS();
            break;
    }
}
void GeoRectangleValueType::setValue(const QVariant &value)
{
    if (value.userType() == qMetaTypeId<QGeoRectangle>())
        v = value.value<QGeoRectangle>();
    else if (value.userType() == qMetaTypeId<QGeoShape>())
        v = value.value<QGeoShape>();
    else
        v = QGeoRectangle();

    onLoad();
}
예제 #11
0
파일: Resource.cpp 프로젝트: PH3NIX/CubicVR
bool Resource::LoadFromFileXML(const std::string& filename)
{
	sourceFile = filename;
	
	TiXmlDocument doc(filename.c_str());
	bool loadOkay = doc.LoadFile();
	
	if (!loadOkay)
	{
		Logger::log(LOG_ERROR,"LoadFromFileXML[error loading]: \"%s\"\n",filename.c_str());
		return false;
	}
	
	TiXmlNode *xml_root_node = doc.FirstChild("root");
	
	if (!xml_root_node)
	{
		Logger::log(LOG_ERROR,"LoadFromFileXML[error no root]: \"%s\"\n",filename.c_str());
		return false;
	}
	
	TiXmlNode *xml_header_node = xml_root_node->FirstChild( "header" );
	TiXmlNode *xml_properties_node = xml_root_node->FirstChild( "properties" );
	
	if (!xml_header_node)
	{
		Logger::log(LOG_ERROR,"LoadFromFileXML[error no header]: \"%s\"\n",filename.c_str());
		return false;
	}
	
	if (!xml_properties_node)
	{
		Logger::log(LOG_ERROR,"LoadFromFileXML[error no properties]: \"%s\"\n",filename.c_str());
		return false;
	}
	
	
	header = new DataTree();
	header->setFromXML(&header->rootNode(),xml_header_node);
	//	header->setSerialized(hdr_serialized);
	
	if (header->rootNode().hasAnother("type")) header->rootNode().child("type").element().get(typeName);
	if (header->rootNode().hasAnother("id")) header->rootNode().child("id").element().get(idName);
	if (header->rootNode().hasAnother("bundle")) header->rootNode().child("bundle").element().get(bundleName);

	//	header->rootNode().child("version").element().get(1.0);
	
	properties = new DataTree();
	properties->setFromXML(&properties->rootNode(),xml_properties_node);
	
	loaded = onLoad();
	return true;
}
예제 #12
0
파일: coreMenu.cpp 프로젝트: zashbot/PANDAS
bool coreMenu::onInitialize()
{
	//Load menu screens
	if((mainMenu = onLoad("./img/mainMenu.png")) == NULL) //Initializes main menu and checks if loaded correctly
	{
		return false;
	}
	if((optionsMenu = onLoad("./img/instructionMenu.png")) == NULL) //Initializes instruction menu and checks if loaded correctly
	{
		return false;
	}

	//Load Buttons for menu screens
	if((optionsButtonSheet = onLoad("./img/newOptionsButton1.png")) == NULL)
	{
		return false;
	}
	if((backButtonSheet = onLoad("./img/newBackButton1.png")) == NULL)
	{
		return false;
	}
	if((exitButtonSheet = onLoad("./img/newExitButton1.png")) == NULL)
	{
		return false;
	}
	if((loadButtonSheet = onLoad("./img/newLoadButton2.png")) == NULL)
	{
		return false;
	}
	if((scoreButtonSheet = onLoad("./img/newScoreButton1.png")) == NULL)
	{
		return false;
	}
	if((startButtonSheet = onLoad("./img/newStartButton1.png")) == NULL)
	{
		return false;
	}

	//Load Music
	if((music = Mix_LoadMUS( "./sfx/menuThemeBeat.wav" )) == NULL) // Panda.wav or menuThemeBeat.wav
	{
		return false;
	}
	
	//Set the window caption
	SDL_WM_SetCaption( "BadAss Panda: Endanger THIS!", NULL );

	//If everything loaded fine
    return true;
}
예제 #13
0
void AudioPlayerLoaders::onVideoSoundAdded() {
	bool waitingAndAdded = false;
	{
		QMutexLocker lock(&_fromVideoMutex);
		if (_videoLoader && _videoLoader->playId() == _fromVideoPlayId && !_fromVideoQueue.isEmpty()) {
			_videoLoader->enqueuePackets(_fromVideoQueue);
			waitingAndAdded = _videoLoader->holdsSavedDecodedSamples();
		}
	}
	if (waitingAndAdded) {
		onLoad(_video);
	}
}
예제 #14
0
////////////////////////////////////////////////////////////////////////////////
// The main function
static OfxStatus
pluginMain(const char *action,  const void *handle, OfxPropertySetHandle inArgs,  OfxPropertySetHandle outArgs)
{
  // cast to appropriate type
  OfxImageEffectHandle effect = (OfxImageEffectHandle) handle;

  if(strcmp(action, kOfxActionDescribe) == 0) {
    return describe(effect);
  }
  else if(strcmp(action, kOfxImageEffectActionDescribeInContext) == 0) {
    return describeInContext(effect, inArgs);
  }
  else if(strcmp(action, kOfxActionLoad) == 0) {
    return onLoad();
  }
  else if(strcmp(action, kOfxActionUnload) == 0) {
    return onUnLoad();
  }
  else if(strcmp(action, kOfxActionCreateInstance) == 0) {
    return createInstance(effect);
  }
  else if(strcmp(action, kOfxActionDestroyInstance) == 0) {
    return destroyInstance(effect);
  }
  else if(strcmp(action, kOfxImageEffectActionIsIdentity) == 0) {
    return isIdentity(effect, inArgs, outArgs);
  }
  else if(strcmp(action, kOfxImageEffectActionRender) == 0) {
    return render(effect, inArgs, outArgs);
  }
  else if(strcmp(action, kOfxImageEffectActionGetRegionOfDefinition) == 0) {
    return getSpatialRoD(effect, inArgs, outArgs);
  }
  else if(strcmp(action, kOfxImageEffectActionGetRegionsOfInterest) == 0) {
    return getSpatialRoI(effect, inArgs, outArgs);
  }
  else if(strcmp(action, kOfxImageEffectActionGetClipPreferences) == 0) {
    return getClipPreferences(effect, inArgs, outArgs);
  }
  else if(strcmp(action, kOfxActionInstanceChanged) == 0) {
    return instanceChanged(effect, inArgs, outArgs);
  }
  else if(strcmp(action, kOfxImageEffectActionGetTimeDomain) == 0) {
    return getTemporalDomain(effect, inArgs, outArgs);
  }


  // other actions to take the default value
  return kOfxStatReplyDefault;
}
예제 #15
0
void BasicLoadable::load(){
	lock();
	if ( this -> mIsloaded ) {
		unlock();
		return;
	}
	this -> bIsLoading = true;

	onLoad();

	this -> bIsLoading = false;
	this -> mIsloaded = true;
	unlock();

}
예제 #16
0
void IConfig::loadFromStream(std::istream& is)
{
    loadDefault();
    std::string entry_name;
    bool read = true;
    while (read) {
        while (char c = is.get()) {
            if (!is.good()) {
                read = false;
                break;
            }

            // trim spaces at the beginning
            if (c == ' ' || c == '\n' || c == '\r') {
                continue;
            }

            // skip comment line
            if (c == '#') {
                is.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
                continue;
            }

            // next config header, finish parsing
            if (c == '[') {
                read = false;
            }

            is.unget();
            break;
        }

        if (!read) {
            break;
        }

        is >> entry_name;

        if (m_strEntryMap.count(entry_name)) {
            m_strEntryMap[entry_name]->readValueFromStream(is);
        } else {
            throw ConfigError("Unrecognized config entry: " + entry_name);
        }
    }

    onLoad();
}
예제 #17
0
void SNIFFER::close()
{
    //str=QString::number(pcnt,10)+" packets captured.";

    if (interface)
    {
        pcap_freecode(&fp);
        pcap_close(handle);
        interface=false;
        sprintf(txtstr,"%d packets captured. Capture complete.",pcnt);
        //printf("\nCapture complete.\n");
        pcnt=0;
    status->append(txtstr);
    result=txtstr;
    emit onLoad();
    }

}
ClusterColorDialog::ClusterColorDialog(const QString &title,QWidget *parent):DockWidget(title,parent),currentClusterIndex(0)
{
    setObjectName(QString::fromUtf8("Cluster Color Dialog"));
    dockWidgetContents = new QWidget(this);
    dockWidgetContents->setObjectName(QString::fromUtf8("dockWidgetContents"));

    verticalLayout = new QVBoxLayout(dockWidgetContents);
    verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));

    clusterListWidget = new QListWidget(dockWidgetContents);
    clusterListWidget->setObjectName(QString::fromUtf8("clusterListWidget"));

    verticalLayout->addWidget(clusterListWidget);

    setColorPushButton = new QPushButton(dockWidgetContents);
    setColorPushButton->setObjectName(QString::fromUtf8("setColorPushButton"));

    verticalLayout->addWidget(setColorPushButton);

    savePushButton = new QPushButton(dockWidgetContents);
    savePushButton->setObjectName(QString::fromUtf8("savePushButton"));

    verticalLayout->addWidget(savePushButton);

    loadPushButton = new QPushButton(dockWidgetContents);
    loadPushButton->setObjectName(QString::fromUtf8("loadPushButton"));

    verticalLayout->addWidget(loadPushButton);

          setColorPushButton->setText(QApplication::translate("clusterListWidget", "Set Color", 0, QApplication::UnicodeUTF8));
          savePushButton->setText(QApplication::translate("clusterListWidget", "Save ", 0, QApplication::UnicodeUTF8));
          loadPushButton->setText(QApplication::translate("clusterListWidget", "Load", 0, QApplication::UnicodeUTF8));
          setWidget(dockWidgetContents);
    QMetaObject::connectSlotsByName(this);

    connect(&ClusterColorScheme::getSingleton(),SIGNAL(clusterColorChanged()),this,SLOT(onClusterColorChanged()));

    connect(clusterListWidget,SIGNAL(currentRowChanged(int)),this,SLOT(onRowChanged(int)));

    connect(setColorPushButton,SIGNAL(clicked()),this,SLOT(onSetColorClicked()));

    connect(savePushButton,SIGNAL(clicked()),this,SLOT(onSave()));
    connect(loadPushButton,SIGNAL(clicked()),this,SLOT(onLoad()));
}
예제 #19
0
	void StageSelectScreen::Update(long gameTime)
	{
		if(drawnOnce)
		{
			if(queueLoad==1)
			{
				onLoad();
				queueLoad++;
			}
			else if(queueLoad == 2)
			{
				onGoToGame();
				queueLoad = 0;
				drawnOnce = false;
			}
		}
		stageGrid->Update(gameTime);
		Menus::button_back->Update(gameTime);
	}
예제 #20
0
bool JsAgent::invoke(NPIdentifier name, const NPVariant* args, unsigned argCount, NPVariant* result) {
	//	NPUTF8* strName = NPN_UTF8FromIdentifier(name);
	Debug::println("JsAgent::invoke: %s", debugName(name));

	if(name == methods.onLoad) {
		return onLoad(args, argCount);
	}
	else if(name == methods.onUnload) {
		return onUnload();
	}
	else if(name == methods.toString) {
		std::string str("[DotWeb Plugin]");
		Variant var;
		var.set(str);
		*result = var.take();
		return true;
	}

	return false;
}
예제 #21
0
파일: Slots.cpp 프로젝트: flowexpert/charon
void VirtualSlot::load(const ParameterFile &pf, const PluginManagerInterface *man)
{
	// disconnect from other slots
	Slot::disconnect();

	if (!pf.isSet(Slot::_parent->getName() + "." + Slot::_name))
		// nothing to do
		return;

	// get all targets from parameter file
	std::vector<std::string> targetList = pf.getList<std::string> (
			Slot::_parent->getName() + "." + Slot::_name);

	// only multislots can be connected to more than one source!
	if (!(Slot::_multiSlot || (targetList.size() < 2))) {
		Slot::raise("multiple targets but not a multi-slot");
	}

	if (!targetList.size())
		// nothing to do
		return;

	std::vector<std::string>::const_iterator tStrIter;

	// and add corresponding slots to _targets
	for (tStrIter = targetList.begin(); tStrIter != targetList.end(); tStrIter++) {
		ParameteredObject* targObj = man->getInstance(tStrIter->substr(0,
				tStrIter->find(".")));

		Slot * targetSlot = targObj->getSlot(
					tStrIter->substr(tStrIter->find(".") + 1));
		Slot::connect(*targetSlot);
	}

	//if(pf.isSet(_parent->getName() + "." + _name+".displayName"))
		//_displayName=pf.get<std::string>(_parent->getName() + "." + _name+".displayName");
	//if(pf.isSet(_parent->getName() + "." + _name+".typeSlot"))
		//_type=pf.get<std::string>(_parent->getName() + "." + _name+".typeSlot");
	onLoad(pf,man);

}
예제 #22
0
파일: Resource.cpp 프로젝트: PH3NIX/CubicVR
bool Resource::LoadFromFile(const std::string& filename)
{
	char *serialized,*hdr_serialized;
	long dataSize,headerSize;
	
	sourceFile = filename;
	
	ifstream fin(filename.c_str(), ios::binary);
	
	fin.read((char *)&headerSize, sizeof(long));
	fin.read((char *)&dataSize, sizeof(long));
	
	hdr_serialized = new char[headerSize];
	fin.read(hdr_serialized,headerSize);
	
	serialized = new char[dataSize];
	fin.read(serialized,dataSize);
	
	fin.close();
	
	if (properties) delete properties;
	if (header) delete header;
	
	header = new DataTree();
	header->setSerialized(hdr_serialized);
	
	header->rootNode().child("type").element().get(typeName);
	header->rootNode().child("id").element().get(idName);
	header->rootNode().child("bundle").element().get(bundleName);
	//		header->rootNode().child("version").element().get(1.0);
	
	properties = new DataTree();
	properties->setSerialized(serialized);
	
	delete serialized;
	delete hdr_serialized;
	
	loaded = onLoad();

	return true;
}
예제 #23
0
파일: invert.cpp 프로젝트: mick50/openfx
////////////////////////////////////////////////////////////////////////////////
// The main entry point function
static OfxStatus
pluginMain(const char *action,  const void *handle, OfxPropertySetHandle inArgs,  OfxPropertySetHandle outArgs)
{
  try {
  // cast to appropriate type
  OfxImageEffectHandle effect = (OfxImageEffectHandle) handle;

  if(strcmp(action, kOfxActionLoad) == 0) {
    return onLoad();
  }
  else if(strcmp(action, kOfxActionDescribe) == 0) {
    return describe(effect);
  }
  else if(strcmp(action, kOfxImageEffectActionDescribeInContext) == 0) {
    return describeInContext(effect, inArgs);
  }
  else if(strcmp(action, kOfxImageEffectActionRender) == 0) {
    return render(effect, inArgs, outArgs);
  }    
  } catch (std::bad_alloc) {
    // catch memory
    //std::cout << "OFX Plugin Memory error." << std::endl;
    return kOfxStatErrMemory;
  } catch ( const std::exception& e ) {
    // standard exceptions
    //std::cout << "OFX Plugin error: " << e.what() << std::endl;
    return kOfxStatErrUnknown;
  } catch (int err) {
    // ho hum, gone wrong somehow
    return err;
  } catch ( ... ) {
    // everything else
    //std::cout << "OFX Plugin error" << std::endl;
    return kOfxStatErrUnknown;
  }
    
  // other actions to take the default value
  return kOfxStatReplyDefault;
}
예제 #24
0
////////////////////////////////////////////////////////////////////////////////
// The main entry point function
static OfxStatus
pluginMain(const char *action,  const void *handle, OfxPropertySetHandle inArgs,  OfxPropertySetHandle outArgs)
{
  // cast to appropriate type
  OfxImageEffectHandle effect = (OfxImageEffectHandle) handle;

  if(strcmp(action, kOfxActionLoad) == 0) {
    return onLoad();
  }
  else if(strcmp(action, kOfxActionDescribe) == 0) {
    return describe(effect);
  }
  else if(strcmp(action, kOfxImageEffectActionDescribeInContext) == 0) {
    return describeInContext(effect, inArgs);
  }
  else if(strcmp(action, kOfxImageEffectActionRender) == 0) {
    return render(effect, inArgs, outArgs);
  }    
    
  // other actions to take the default value
  return kOfxStatReplyDefault;
}
예제 #25
0
void ChessWidget::keyReleaseEvent(QKeyEvent * e)
{
  if ( !e )
    return;

  switch ( e->key() )
  {
  case Qt::Key_F2:
    onSave();
    break;

  case Qt::Key_F3:
    onLoad();
    break;

  case Qt::Key_PageUp:
    onNext();
    break;

  case Qt::Key_PageDown:
    onPrev();
    break;

  case Qt::Key_C:
    if ( e->modifiers() & Qt::ControlModifier )
    {
      onPutFEN();
    }
    break;

  case Qt::Key_V:
    if ( e->modifiers() & Qt::ControlModifier )
    {
      onGetFEN();
    }
    break;
  }
}
예제 #26
0
////////////////////////////////////////////////////////////
// Memory Access Event Handling
////////////////////////////////////////////////////////////
void EventHandlers::onMemEv(const SglMemEv &ev)
{
    switch (ev.type)
    {
    case MemTypeEnum::SGLPRIM_MEM_LOAD:
        ++(std::get<PerThreadStats::Type::Read>(stats.curr_counts));
        onLoad(ev);
        break;

    case MemTypeEnum::SGLPRIM_MEM_STORE:
        ++(std::get<PerThreadStats::Type::Write>(stats.curr_counts));
        onStore(ev);
        break;

    default:
        break;
    }

    if (st_comp_ev.thread_local_store_cnt > (primitives_per_st_comp_ev - 1) ||
        st_comp_ev.thread_local_load_cnt > (primitives_per_st_comp_ev - 1))
    {
        st_comp_ev.flush();
    }
}
예제 #27
0
// internal call, for use in avoiding lookup
bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPtr pNotification)
{	
	std::string cmd = payload["sigtype"];
	LLNotificationSet::iterator foundItem = mItems.find(pNotification);
	bool wasFound = (foundItem != mItems.end());
	bool passesFilter = mFilter(pNotification);
	
	// first, we offer the result of the filter test to the simple
	// signals for pass/fail. One of these is guaranteed to be called.
	// If either signal returns true, the change processing is NOT performed
	// (so don't return true unless you know what you're doing!)
	bool abortProcessing = false;
	if (passesFilter)
	{
		abortProcessing = mPassedFilter(payload);
	}
	else
	{
		abortProcessing = mFailedFilter(payload);
	}
	
	if (abortProcessing)
	{
		return true;
	}
	
	if (cmd == "load")
	{
		// should be no reason we'd ever get a load if we already have it
		// if passes filter send a load message, else do nothing
		assert(!wasFound);
		if (passesFilter)
		{
			// not in our list, add it and say so
			mItems.insert(pNotification);
			abortProcessing = mChanged(payload);
			onLoad(pNotification);
		}
	}
	else if (cmd == "change")
	{
		// if it passes filter now and was found, we just send a change message
		// if it passes filter now and wasn't found, we have to add it
		// if it doesn't pass filter and wasn't found, we do nothing
		// if it doesn't pass filter and was found, we need to delete it
		if (passesFilter)
		{
			if (wasFound)
			{
				// it already existed, so this is a change
				// since it changed in place, all we have to do is resend the signal
				abortProcessing = mChanged(payload);
				onChange(pNotification);
			}
			else
			{
				// not in our list, add it and say so
				mItems.insert(pNotification);
				// our payload is const, so make a copy before changing it
				LLSD newpayload = payload;
				newpayload["sigtype"] = "add";
				abortProcessing = mChanged(newpayload);
				onChange(pNotification);
			}
		}
		else
		{
			if (wasFound)
			{
				// it already existed, so this is a delete
				mItems.erase(pNotification);
				// our payload is const, so make a copy before changing it
				LLSD newpayload = payload;
				newpayload["sigtype"] = "delete";
				abortProcessing = mChanged(newpayload);
				onChange(pNotification);
			}
			// didn't pass, not on our list, do nothing
		}
	}
	else if (cmd == "add")
	{
		// should be no reason we'd ever get an add if we already have it
		// if passes filter send an add message, else do nothing
		assert(!wasFound);
		if (passesFilter)
		{
			// not in our list, add it and say so
			mItems.insert(pNotification);
			abortProcessing = mChanged(payload);
			onAdd(pNotification);
		}
	}
	else if (cmd == "delete")
	{
		// if we have it in our list, pass on the delete, then delete it, else do nothing
		if (wasFound)
		{
			abortProcessing = mChanged(payload);
			mItems.erase(pNotification);
			onDelete(pNotification);
		}
	}
	return abortProcessing;
}
예제 #28
0
파일: EditorBase.cpp 프로젝트: bercik/gear
	void EditorBase::load(CL_GraphicContext &p_gc)
	{
		onLoad(p_gc);
	}
예제 #29
0
 JsonParseResult load(JsonReader* reader) { return onLoad(reader); }
예제 #30
0
파일: basic.cpp 프로젝트: chajaeik/openfx
////////////////////////////////////////////////////////////////////////////////
// The main function
static OfxStatus
pluginMain(const char *action,  const void *handle, OfxPropertySetHandle inArgs,  OfxPropertySetHandle outArgs)
{
  try {
  // cast to appropriate type
  OfxImageEffectHandle effect = (OfxImageEffectHandle) handle;

  if(strcmp(action, kOfxActionDescribe) == 0) {
    return describe(effect);
  }
  else if(strcmp(action, kOfxImageEffectActionDescribeInContext) == 0) {
    return describeInContext(effect, inArgs);
  }
  else if(strcmp(action, kOfxActionLoad) == 0) {
    return onLoad();
  }
  else if(strcmp(action, kOfxActionUnload) == 0) {
    return onUnLoad();
  }
  else if(strcmp(action, kOfxActionCreateInstance) == 0) {
    return createInstance(effect);
  } 
  else if(strcmp(action, kOfxActionDestroyInstance) == 0) {
    return destroyInstance(effect);
  } 
  else if(strcmp(action, kOfxImageEffectActionIsIdentity) == 0) {
    return isIdentity(effect, inArgs, outArgs);
  }    
  else if(strcmp(action, kOfxImageEffectActionRender) == 0) {
    return render(effect, inArgs, outArgs);
  }    
  else if(strcmp(action, kOfxImageEffectActionGetRegionOfDefinition) == 0) {
    return getSpatialRoD(effect, inArgs, outArgs);
  }  
  else if(strcmp(action, kOfxImageEffectActionGetRegionsOfInterest) == 0) {
    return getSpatialRoI(effect, inArgs, outArgs);
  }  
  else if(strcmp(action, kOfxImageEffectActionGetClipPreferences) == 0) {
    return getClipPreferences(effect, inArgs, outArgs);
  }  
  else if(strcmp(action, kOfxActionInstanceChanged) == 0) {
    return instanceChanged(effect, inArgs, outArgs);
  }  
  else if(strcmp(action, kOfxImageEffectActionGetTimeDomain) == 0) {
    return getTemporalDomain(effect, inArgs, outArgs);
  }  
  } catch (std::bad_alloc) {
    // catch memory
    //std::cout << "OFX Plugin Memory error." << std::endl;
    return kOfxStatErrMemory;
  } catch ( const std::exception& e ) {
    // standard exceptions
    //std::cout << "OFX Plugin error: " << e.what() << std::endl;
    return kOfxStatErrUnknown;
  } catch (int err) {
    // ho hum, gone wrong somehow
    return err;
  } catch ( ... ) {
    // everything else
    //std::cout << "OFX Plugin error" << std::endl;
    return kOfxStatErrUnknown;
  }

  // other actions to take the default value
  return kOfxStatReplyDefault;
}