BOOL CSettingsProgsDiff::OnInitDialog()
{
    ISettingsPropPage::OnInitDialog();

    m_sDiffPath = m_regDiffPath;
    m_iExtDiff = IsExternal(m_sDiffPath);

    m_sDiffPropsPath = m_regDiffPropsPath;
    m_iExtDiffProps = IsExternal(m_sDiffPropsPath);

    SHAutoComplete(::GetDlgItem(m_hWnd, IDC_EXTDIFF), SHACF_FILESYSTEM | SHACF_FILESYS_ONLY);

    m_bConvertBase = m_regConvertBase;

    m_sDiffViewerPath = m_regDiffViewerPath;
    m_iDiffViewer = IsExternal(m_sDiffViewerPath);

    SHAutoComplete(::GetDlgItem(m_hWnd, IDC_DIFFVIEWER), SHACF_FILESYSTEM | SHACF_FILESYS_ONLY);

    m_tooltips.AddTool(IDC_EXTDIFF, IDS_SETTINGS_EXTDIFF_TT);
    m_tooltips.AddTool(IDC_DONTCONVERT, IDS_SETTINGS_CONVERTBASE_TT);
    m_tooltips.AddTool(IDC_DIFFVIEWER, IDS_SETTINGS_DIFFVIEWER_TT);

    UpdateData(FALSE);
    return TRUE;
}
BOOL CSettingsProgsDiff::OnInitDialog()
{
	ISettingsPropPage::OnInitDialog();
	EnableToolTips();
	AdjustControlSize(IDC_EXTDIFF_OFF);
	AdjustControlSize(IDC_EXTDIFF_ON);
	AdjustControlSize(IDC_DIFFVIEWER_OFF);
	AdjustControlSize(IDC_DIFFVIEWER_ON);

	m_sDiffPath = m_regDiffPath;
	m_iExtDiff = IsExternal(m_sDiffPath);

	SHAutoComplete(::GetDlgItem(m_hWnd, IDC_EXTDIFF), SHACF_FILESYSTEM | SHACF_FILESYS_ONLY);

	m_sDiffViewerPath = m_regDiffViewerPath;
	m_iDiffViewer = IsExternal(m_sDiffViewerPath);

	SHAutoComplete(::GetDlgItem(m_hWnd, IDC_DIFFVIEWER), SHACF_FILESYSTEM | SHACF_FILESYS_ONLY);

	m_tooltips.AddTool(IDC_EXTDIFF, IDS_SETTINGS_EXTDIFF_TT);
	m_tooltips.AddTool(IDC_DIFFVIEWER, IDS_SETTINGS_DIFFVIEWER_TT);

	UpdateData(FALSE);
	return TRUE;
}
Beispiel #3
0
///\brief Returns true if the address is globally accessible (i.e. exposed to the real world!)
bool TorcNetwork::IsGlobal(const QHostAddress &Address)
{
    // internal/loopback and link local
    if (!IsExternal(Address))
        return false;

    // private
    if (Address.protocol() == QAbstractSocket::IPv4Protocol)
        if (Address.isInSubnet(gIPv4PrivateA) || Address.isInSubnet(gIPv4PrivateB) || Address.isInSubnet(gIPv4PrivateC))
            return false;

    return true;
}
BOOL CSettingsProgsMerge::OnInitDialog()
{
	ISettingsPropPage::OnInitDialog();

	EnableToolTips();

	m_sMergePath = m_regMergePath;
	m_iExtMerge = IsExternal(m_sMergePath);

	SHAutoComplete(::GetDlgItem(m_hWnd, IDC_EXTMERGE), SHACF_FILESYSTEM | SHACF_FILESYS_ONLY);

	m_tooltips.Create(this);
	m_tooltips.AddTool(IDC_EXTMERGE, IDS_SETTINGS_EXTMERGE_TT);

	UpdateData(FALSE);
	return TRUE;
}
BOOL CSettingsProgsAlternativeEditor::OnInitDialog()
{
	ISettingsPropPage::OnInitDialog();

	AdjustControlSize(IDC_ALTERNATIVEEDITOR_OFF);
	AdjustControlSize(IDC_ALTERNATIVEEDITOR_ON);

	EnableToolTips();

	m_sAlternativeEditorPath = m_regAlternativeEditorPath;
	m_iAlternativeEditor = IsExternal(m_sAlternativeEditorPath);

	SHAutoComplete(::GetDlgItem(m_hWnd, IDC_ALTERNATIVEEDITOR), SHACF_FILESYSTEM | SHACF_FILESYS_ONLY);

	m_tooltips.AddTool(IDC_ALTERNATIVEEDITOR, IDS_SETTINGS_ALTERNATIVEEDITOR_TT);

	UpdateData(FALSE);
	return TRUE;
}
Beispiel #6
0
const char* CDnaUrl::GetTypeName() const
{
	if (IsClub())
	{
		return "club";
	}
	else if (IsArticle())
	{
		return "article";
	}
	else if (IsExternal())
	{
		return "external";
	}
	else if (IsEmpty())
	{
		return "empty";
	}

	return "unknown";
}
Beispiel #7
0
CString CDeviceClass::GetReference (CItemCtx &Ctx, int iVariant, DWORD dwFlags)

//	GetReference
//
//	Returns reference string

	{
	CString sReference;
	
	//	For a device we always add power and other properties.
	//	(If iVariant != -1 then it means that we're looking for reference on a
	//	missile or someting).
	
	if (iVariant == -1)
		{
		CInstalledDevice *pDevice = Ctx.GetDevice();

		//	Start with power requirements

		AppendReferenceString(&sReference, GetReferencePower(Ctx));

		//	Non-standard slots

		if (GetSlotsRequired() != 1)
			AppendReferenceString(&sReference, strPatternSubst(CONSTLIT("%d Slots"), GetSlotsRequired()));

		//	External devices

		if (IsExternal() || (pDevice && pDevice->IsExternal()))
			AppendReferenceString(&sReference, CONSTLIT("External"));
		}

	//	Combine with our subclass

	AppendReferenceString(&sReference, OnGetReference(Ctx, iVariant, dwFlags));
	return sReference;
	}
Beispiel #8
0
/**
 *  Cast an ecmascript value to a PHP runtime value
 *
 *  @note   The value cannot be const, as retrieving properties
 *          from arrays and objects cannot be done on const values
 *
 *  @param  input   the value to cast
 *  @return Php::Value
 */
Php::Value value(v8::Handle<v8::Value> input)
{
    // if we received an invalid input we simply return an empty PHP value
    if (input.IsEmpty())            return nullptr;

    // as is typical in javascript, a value can be of many types
    // check the type of value that we have received so we can cast
    if (input->IsBoolean())         return input->BooleanValue();
    if (input->IsBooleanObject())   return input->BooleanValue();
    if (input->IsInt32())           return input->Int32Value();
    if (input->IsNumber())          return input->NumberValue();
    if (input->IsNumberObject())    return input->NumberValue();
    if (input->IsNull())            return nullptr;
    if (input->IsUndefined())       return nullptr;

    // special treatment for string-like types
    // TODO: javascript dates might possibly be cast to a DateTime object
    if (input->IsString() || input->IsStringObject() || input->IsRegExp())
    {
        // create the utf8 value (the only way to retrieve the content)
        v8::String::Utf8Value   utf8(input->ToString());

        // and create the value to return
        return {*utf8, utf8.length()};
    }

    // it could be callable too
    if (input->IsFunction())
    {
        // create the function as a pointer that can be captured
        auto function = std::make_shared<Stack<v8::Function>>(input.As<v8::Function>());

        // the result to return
        Php::Function result([function](Php::Parameters &params) {
            // create a "scope", so variables get destructed, retrieve the context and "enter" it
            v8::HandleScope                     scope(Isolate::get());
            v8::Local<v8::Context>              context((*function)->CreationContext());
            v8::Context::Scope                  contextScope(context);

            // catch any errors that occur while either compiling or running the script
            v8::TryCatch                        catcher;

            // create a new array with parameters
            std::vector<v8::Local<v8::Value>>   array;
            array.reserve(params.size());

            // iterate over all the given parameters and add them to the arrau
            for (auto &param: params) array.push_back(value(param));

            // now we can actually call the function
            v8::Local<v8::Value> result((*function)->Call(context->Global(), array.size(), array.data()));

            // did we catch an exception?
            if (catcher.HasCaught())
            {
                // retrieve the message describing the problem
                v8::Local<v8::Message>  message(catcher.Message());
                v8::Local<v8::String>   description(message->Get());

                // convert the description to utf so we can dump it
                v8::String::Utf8Value   string(description);

                // pass this exception on to PHP userspace
                throw Php::Exception(std::string(*string, string.length()));
            }

            // convert the result to a PHP value and return it
            return value(result);
        });

        // now return the result
        return result;
    }

    // or perhaps an object
    if (input->IsObject())
    {
        // retrieve the object and the first internal field
        auto object = input.As<v8::Object>();

        // does the object have internal fields?
        if (object->InternalFieldCount())
        {
            // retrieve the field
            auto field  = object->GetInternalField(0);

            // does it have an internal field and is it external? we are converting back
            // an original PHP object, just retrieve the original thing that came from PHP
            if (!field.IsEmpty() && field->IsExternal())
            {
                // the PHP value is stored in the first internal field,
                // retrieve it and create the handle around it
                Handle handle(field);

                // dereference and return it
                return *handle;
            }
        }

        // create a new js object and convert it to userspace
        return Php::Object("JS\\Object", new JSObject(object));
    }

    // we sadly don't support this type of value
    return nullptr;
}