Exemplo n.º 1
0
void ModelSelector::onOK(wxCommandEvent& ev)
{
    // Remember the selected model then exit from the recursive main loop
    _lastModel = getSelectedValue(_columns.vfspath);
    _lastSkin = getSelectedValue(_columns.skin);

	_panedPosition.saveToPath(RKEY_SPLIT_POS);

	EndModal(wxOK); // break main loop
	Hide();
}
Exemplo n.º 2
0
void ModelSelector::showInfoForSelectedModel()
{
    // Prepare to populate the info table
    _infoTable->Clear();

    // Get the model name, if this is blank we are looking at a directory,
    // so leave the table empty
    std::string mName = getSelectedValue(_columns.vfspath);
    if (mName.empty())
        return;

    // Get the skin if set
    std::string skinName = getSelectedValue(_columns.skin);

    // Pass the model and skin to the preview widget
    _modelPreview->setModel(mName);
    _modelPreview->setSkin(skinName);

    // Check that the model is actually valid by querying the IModelPtr
    // returned from the preview widget.
    scene::INodePtr mdl = _modelPreview->getModelNode();
    if (!mdl) {
        return; // no valid model
    }

    model::ModelNodePtr modelNode = Node_getModel(mdl);

    if (!modelNode)
    {
        return;
    }

    // Update the text in the info table
    const model::IModel& model = modelNode->getIModel();
    _infoTable->Append(_("Model name"), mName);
    _infoTable->Append(_("Skin name"), skinName);
    _infoTable->Append(_("Total vertices"), string::to_string(model.getVertexCount()));
    _infoTable->Append(_("Total polys"), string::to_string(model.getPolyCount()));
    _infoTable->Append(_("Material surfaces"), string::to_string(model.getSurfaceCount()));

    // Add the list of active materials
    _materialsList->clear();

    const model::StringList& matList(model.getActiveMaterials());

    std::for_each(
        matList.begin(), matList.end(),
        boost::bind(&MaterialsList::addMaterial, _materialsList, _1)
    );
}
Exemplo n.º 3
0
bool LH_SpeedFanData::getData(float& value, QString& text, QString& units, int& count, int index)
{
#ifdef Q_WS_WIN
    bool resultVal = false;

    HANDLE filemap = OpenFileMappingA(FILE_MAP_READ, FALSE, "SFSharedMemory_ALM");
    if(filemap != NULL)
    {
        SFMemory* sfmemory = (SFMemory*)MapViewOfFile(filemap, FILE_MAP_READ, 0, 0, sizeof(SFMemory));
        if (sfmemory)
        {
            if(sfmemory->MemSize!=0)
            {
                if (ui_->count(mon_item) == 0)
                    loadSensorList(sfmemory);
                getSelectedValue(sfmemory, value, text, units, count, index);
                resultVal = true;
            }
            UnmapViewOfFile(sfmemory);
        }
        CloseHandle(filemap);
    }
    ui_->setReadonly(mon_type | mon_item, !resultVal);
    return resultVal;
#else
    Q_UNUSED(value);
    Q_UNUSED(text);
    Q_UNUSED(units);
    Q_UNUSED(count);
    Q_UNUSED(index);
    return false;
#endif
}
void ModeSelector::begin()
{
    pinMode(MODE_SELECTOR_PIN_D1, INPUT_PULLUP);
    pinMode(MODE_SELECTOR_PIN_D2, INPUT_PULLUP);
    pinMode(MODE_SELECTOR_PIN_D4, INPUT_PULLUP);
    pinMode(MODE_SELECTOR_PIN_D8, INPUT_PULLUP);
    delay(100);
    _selectedValue = getSelectedValue();
}
Exemplo n.º 5
0
LLUUID LLFlatListView::getSelectedUUID() const
{
	const LLSD& value = getSelectedValue();
	if (value.isDefined() && value.isUUID())
	{
		return value.asUUID();
	}
	else 
	{
		return LLUUID::null;
	}
}
//virtual
S32 LLAvatarList::notifyParent(const LLSD& info)
{
	if (info.has("sort") && &NAME_COMPARATOR == mItemComparator)
	{
		sort();
		return 1;
	}
// [SL:KB] - Patch: UI-AvatarListDndShare | Checked: 2011-06-19 (Catznip-2.6.0c) | Added: Catznip-2.6.0c
	else if ( (info.has("select")) && (info["select"].isUUID()) )
	{
		const LLSD& sdValue = getSelectedValue();
		const LLUUID idItem = info["select"].asUUID();
		if ( (!sdValue.isDefined()) || ((sdValue.isUUID()) && (sdValue.asUUID() != idItem)) )
		{
			resetSelection();
			selectItemByUUID(info["select"].asUUID());
		}
	}
// [/SL:KB]
	return LLFlatListViewEx::notifyParent(info);
}
Exemplo n.º 7
0
bool LH_AfterburnerData::getData(float& value, QString& text, QString& units, QString& format, float& min, float& max, int index)
{
#ifdef Q_WS_WIN
    bool resultVal = false;

    HANDLE filemap = OpenFileMappingA(FILE_MAP_READ, FALSE, "MAHMSharedMemory");
    if(filemap != NULL)
    {
        MAHM_SHARED_MEMORY_HEADER* MAHMHeader = (MAHM_SHARED_MEMORY_HEADER*)MapViewOfFile(filemap, FILE_MAP_READ, 0, 0, 0);

        if (MAHMHeader)
        {
            if (MAHMHeader->dwSignature == 0xDEAD)
            {
                qDebug() << "LH_Afterburner: Shared memory has been terminated; try again later.";
            }
            else
            {
                if (ui_->count(mon_type) == 0) loadTypesList(MAHMHeader);
                getSelectedValue(MAHMHeader, value, text, units, format, min, max, index);
                resultVal = true;
            }
            UnmapViewOfFile(MAHMHeader);
        }
        CloseHandle(filemap);
    }
    ui_->setReadonly(mon_type | mon_item, !resultVal);
    return resultVal;
#else
    Q_UNUSED(value);
    Q_UNUSED(text);
    Q_UNUSED(units);
    Q_UNUSED(format);
    Q_UNUSED(min);
    Q_UNUSED(max);
    Q_UNUSED(index);
    return false;
#endif
}
Exemplo n.º 8
0
bool LH_HWiNFOData::getData(float& value, QString& text, QString& units)
{
#ifdef Q_WS_WIN
    const char* mapname  = HWiNFO_SENSORS_MAP_FILE_NAME;
    float resultVal = true;

    // Create file mapping
    HANDLE filemap = OpenFileMappingA(FILE_MAP_READ, FALSE, mapname);
    // Get pointer
    if(filemap != NULL)
    {
        _HWiNFO_SENSORS_SHARED_MEM* hwinfoMemory = (_HWiNFO_SENSORS_SHARED_MEM*)MapViewOfFile(filemap, FILE_MAP_READ, 0, 0, sizeof(_HWiNFO_SENSORS_SHARED_MEM));
        if (hwinfoMemory)
        {
            if(hwinfoMemory->header.dwVersion!=3)
            {
                qWarning() << "LH_Monitoring: HWiNFO version is incompatible.";
                return false;
            }

            if (ui_->count(mon_type) == 0)
                loadTypesList(hwinfoMemory);

            if(ui_->value(mon_type)!=-1)
            {
                if (ui_->value(mon_type) != listedType_)
                {
                    listedType_ = ui_->value(mon_type);
                    listedGroup_ = -1;
                    loadGroupsList(hwinfoMemory);
                }
                if(ui_->value(mon_group)!=-1)
                {
                    int max = -1;
                    HWiNFO_SENSORS_READING_LIST *list = getList(hwinfoMemory->Sensors[sensor_indexes_.value(ui_->value(mon_group))], max);

                    if (ui_->value(mon_group) != listedGroup_)
                    {
                        listedGroup_ = ui_->value(mon_group);
                        loadItemsList(list, max);
                    }

                    getSelectedValue(list, value, text, units);
                } else
                    resultVal = false;
            } else
                resultVal = false;
            UnmapViewOfFile(hwinfoMemory);
        } else
            resultVal = false;
        CloseHandle(filemap);
    } else
        resultVal = false;
    return resultVal;
#else
    Q_UNUSED(value);
    Q_UNUSED(text);
    Q_UNUSED(units);
    return false;
#endif
}