Ejemplo n.º 1
0
	void FolderMonitor::_update()
	{
		{
			Lock lock(m->mainMutex);

			std::swap(m->fileActions, m->activeFileActions);
		}

		for(auto& action : m->activeFileActions)
		{
			switch (action->type)
			{
			case FileActionType::Added:
				if (!onAdded.empty())
					onAdded(Path(action->newName));
				break;
			case FileActionType::Removed:
				if (!onRemoved.empty())
					onRemoved(Path(action->newName));
				break;
			case FileActionType::Modified:
				if (!onModified.empty())
					onModified(Path(action->newName));
				break;
			case FileActionType::Renamed:
				if (!onRenamed.empty())
					onRenamed(Path(action->oldName), Path(action->newName));
				break;
			}

			FileAction::destroy(action);
		}

		m->activeFileActions.clear();
	}
Ejemplo n.º 2
0
brayns::ModelDescriptorPtr Loader::importFromFile(
    const std::string& fileName, const brayns::LoaderProgress& callback,
    const brayns::PropertyMap& /*properties*/) const
{
    VolumeModel volumeModel(fileName, _scene.createModel(), callback);
    auto modelDesc = volumeModel.getModel();
    _plugin->addModel(std::move(volumeModel));

    modelDesc->onRemoved([plugin = _plugin](const auto& modelDesc_) {
        plugin->removeModel(modelDesc_.getModelID());
    });

    return modelDesc;
}
Ejemplo n.º 3
0
void SalesOrderManager::openEditor(qlonglong id)
{
    SalesOrderEditor* editor = 0;

    if (id > 0)
        editor = editorById.value(id);

    if (!editor) {
        editor = new SalesOrderEditor(id, tabWidget);
        connect(editor, SIGNAL(added(qlonglong)), SLOT(onAdded(qlonglong)));
        connect(editor, SIGNAL(removed(qlonglong)), SLOT(onRemoved(qlonglong)));
        connect(editor, SIGNAL(saved(qlonglong)), SLOT(onSaved(qlonglong)));
        int index = tabWidget->addTab(editor, editor->windowTitle());
        tabWidget->tabBar()->tabButton(index, QTabBar::RightSide)->setToolTip("Tutup");

        if (id != 0)
            editorById.insert(id, editor);
    }

    tabWidget->setCurrentWidget(editor);

    if (tabWidget->isHidden())
        tabWidget->show();
}
Ejemplo n.º 4
0
void HypotheticBattle::removeUnit(uint32_t id)
{
	std::set<uint32_t> ids;
	ids.insert(id);

	while(!ids.empty())
	{
		auto toRemoveId = *ids.begin();

		auto toRemove = getForUpdate(toRemoveId);

		if(!toRemove->ghost)
		{
			toRemove->onRemoved();

			//TODO: emulate detachFromAll() somehow

			//stack may be removed instantly (not being killed first)
			//handle clone remove also here
			if(toRemove->cloneID >= 0)
			{
				ids.insert(toRemove->cloneID);
				toRemove->cloneID = -1;
			}

			//TODO: cleanup remaining clone links if any
//			for(auto s : stacks)
//			{
//				if(s->cloneID == toRemoveId)
//					s->cloneID = -1;
//			}
		}

		ids.erase(toRemoveId);
	}
}
Ejemplo n.º 5
0
	// Remove an entity
	void EntitySystem::removeEntity(EntityInfo& e)
	{
		removeFirst<Entity>(_entities, e);
		onRemoved(e);
	}
AppletAvialabilityWidget::AppletAvialabilityWidget(QGraphicsItem *parent, Tp::AccountPtr account):
    MWidget(parent),
    m_account(account)
{
    setMaximumSize(64,64);
    setMinimumSize(64,64);

    MFeedback* feedback1 = new MFeedback("priority2_static_press", this);
    connect(this, SIGNAL(pressed()), feedback1, SLOT(play()));
    MFeedback* feedback2 = new MFeedback("priority2_static_release", this);
    connect(this, SIGNAL(released()), feedback2, SLOT(play()));
    MFeedback* feedback3 = new MFeedback("priority2_grab", this);
    connect(this, SIGNAL(longpressed()), feedback3, SLOT(play()));

    m_iconService = new MImageWidget("icon-m-common-presence-unknown", this);
    m_iconService->setAspectRatioMode(Qt::KeepAspectRatio);
    m_iconService->setMaximumSize(64,64);
    m_iconService->setMinimumSize(64,64);
    m_iconService->setPos(0,0);

    m_iconPresence = new MImageWidget("icon-m-common-presence-unknown", this);
    m_iconPresence->setAspectRatioMode(Qt::KeepAspectRatio);
    m_iconPresence->setMaximumSize(24,24);
    m_iconPresence->setPos(40, 0);
    currentIconId = presenceToIconId(m_account->currentPresence());
    requestedIconId = presenceToIconId(m_account->requestedPresence());

    if (m_account->currentPresence().type() == Tp::ConnectionPresenceTypeOffline)
        nextPresence = Tp::Presence(Tp::ConnectionPresenceTypeAvailable, "", "");
    else
        nextPresence = Tp::Presence(Tp::ConnectionPresenceTypeOffline, "", "");

    m_iconPresence->setImage(currentIconId);

    isFakePresence = false;

    m_account->setConnectsAutomatically(false);

    QString serviceName = m_account->serviceName();
    Accounts::Manager *manager = new Accounts::Manager();
    Accounts::Service *service = manager->service(serviceName);
    QString serviceIconId = service->iconName();

    m_iconService->setImage(serviceIconId);

    connect(m_account.data(),
            SIGNAL(changingPresence(bool)),
            SLOT(onChangingPresence(bool)));

    connect(m_account.data(),
            SIGNAL(currentPresenceChanged(Tp::Presence)),
            SLOT(onCurrentPresenceChanged(Tp::Presence)));

    connect(m_account.data(),
            SIGNAL(requestedPresenceChanged(Tp::Presence)),
            SLOT(onRequestedPresenceChanged(Tp::Presence)));

    connect(m_account.data(),
            SIGNAL(removed()),
            SLOT(onRemoved()));

    connect(m_account.data(),
            SIGNAL(stateChanged(bool)),
            SLOT(onStateChanged(bool)));

    presenceFaker = new QTimer(this);
    connect(presenceFaker, SIGNAL(timeout()), this, SLOT(fakerupdate()));

    grabGesture(Qt::TapAndHoldGesture);

//    pressTime = new QTimer(this);
//    pressTime->setSingleShot(true);
//    pressTime->setInterval(800);
//    connect(pressTime, SIGNAL(timeout()), this, SLOT(openPresence()));
}