Ejemplo n.º 1
0
ClipboardSync::ClipboardSync(QObject *parent)
    : GuestModule(parent)
{
    previous = QVariant();
	setModuleName("clipboard");
	clipboard = QApplication::clipboard();
	clipboard->clear(QClipboard::Clipboard);
    clipboard->clear(QClipboard::Selection);
    connect(clipboard, SIGNAL(changed(QClipboard::Mode)), this, SLOT(dataChanged(QClipboard::Mode)));
    qDebug() << "clipboard initialized";
}
Ejemplo n.º 2
0
void DocumentationGeneratorAction::execute()
{
    // yes, it's duplicate from the doc file widget, but it's too painful to share it
    QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/" + "kdevpythonsupport/documentation_files/";
    QDir dir(path);
    dir.mkpath(path);
    auto wizard = new DocfileWizard(path);
    wizard->setModuleName(module);
    wizard->setModal(true);
    wizard->setAttribute(Qt::WA_DeleteOnClose);
    wizard->show();
    QObject::connect(wizard, &QDialog::accepted,
        [wizard, this]() {
            if ( ! wizard->wasSavedAs().isNull() ) {
                ICore::self()->documentController()->openDocument(QUrl::fromLocalFile(wizard->wasSavedAs()));
                // force a recursive update of the context, so that all the imports are reparsed too
                // (since they potentially have changed through this action)
                ICore::self()->languageController()->backgroundParser()->addDocument(document, TopDUContext::ForceUpdateRecursive);
            }
        }
    );

    emit executed(this);
}
Ejemplo n.º 3
0
void DumpMemoryGui::getMemoryList()
{
	DWORD_PTR address = 0;
	MEMORY_BASIC_INFORMATION memBasic = {0};
	Memory memory;
	HMODULE * hMods = 0;
	WCHAR target[MAX_PATH];

	if (memoryList.empty())
	{
		memoryList.reserve(20);
	}
	else
	{
		memoryList.clear();
	}

	memory.filename[0] = 0;
	memory.peSection[0] = 0;
	memory.mappedFilename[0] = 0;

	while(VirtualQueryEx(ProcessAccessHelp::hProcess,(LPCVOID)address,&memBasic,sizeof(memBasic)))
	{
		memory.address = (DWORD_PTR)memBasic.BaseAddress;
		memory.type = memBasic.Type;
		memory.state = memBasic.State;
		memory.size = (DWORD)memBasic.RegionSize;
		memory.protect = memBasic.Protect;
		

		if (memory.type == MEM_MAPPED)
		{
			if (!getMappedFilename(&memory))
			{
				memory.mappedFilename[0] = 0;
			}
		}

		memoryList.push_back(memory);

		memory.mappedFilename[0] = 0;

		address += memBasic.RegionSize;
	}

	DWORD numHandles = ProcessAccessHelp::getModuleHandlesFromProcess(ProcessAccessHelp::hProcess, &hMods);
	if (numHandles == 0)
	{
		return;
	}

	for (DWORD i = 0; i < numHandles; i++)
	{
		if (GetModuleFileNameExW(ProcessAccessHelp::hProcess, hMods[i], target, _countof(target)))
		{
			setModuleName((DWORD_PTR)hMods[i],target);
			setAllSectionNames((DWORD_PTR)hMods[i],target);
		}
		else
		{
#ifdef DEBUG_COMMENTS
			Scylla::debugLog.log(L"getMemoryList :: GetModuleFileNameExW failed 0x%X", GetLastError());
#endif
		}
	}

	delete [] hMods;
}
Ejemplo n.º 4
0
SySettingsModule::SySettingsModule(QWidget * parent)
    : SyModule(parent)
{       
    setModuleName(sy_settings_module_name);
    setDescription("Set system-wide profile parameters.");
    
    // select profiles matching actual capabilities
    icc_profile_flags = oyICCProfileSelectionFlagsFromOptions( OY_CMM_STD, "//" OY_TYPE_STD "/icc_color", NULL, 0 );

    ui = new Ui::sySettingsWidget();
    ui->setupUi(this);
    
    SySettingsConfig * settingsConfig = new SySettingsConfig(0, sy_settings_module_name);
    
    setConfigWidget(settingsConfig);
    
    setEditable(true);
    
    loadPolicy();

    ui->removePolicyButton->setEnabled(false);

    loadEditableItems();        // Store all setting widgets into a convenient list structure.

    populateProfiles();         // Load all Oyranos-specified profiles
                               // into each combobox in the "Default Profiles" tab.

    modified = false;

    /* i18n */
    QString qs;
    int i;
    int             count = 0,
                    current = 0,
                    flags = 0;
    const char    * tooltip = NULL;
    const char   ** names = NULL;
    const char    * name = NULL,
                  * description = NULL;

    oyWidgetTitleGet( oyWIDGET_GROUP_ALL, NULL, &name,
                      NULL, NULL );
    oyWidgetDescriptionGet( oyWIDGET_GROUP_ALL, &description, 0 );
    setModuleName(QString::fromLocal8Bit(name));
    setDescription(QString::fromLocal8Bit(description));
  
    oyWidgetTitleGet( oyWIDGET_POLICY_ACTIVE, NULL, &name, &tooltip, &flags );
    qs = QString::fromLocal8Bit(name);
    ui->currentPolicyTitleLabel->setText(qs);

    oyWidgetTitleGet( oyWIDGET_POLICY, NULL, &name, &tooltip, &flags );
    qs = QString::fromLocal8Bit(name);
    ui->policySettingsBox->setTitle(qs);
    ui->kmsettingsTab->setTabText(0,qs);
    qs = QString::fromLocal8Bit( tooltip );
    ui->policyLabel->setText(qs);

    oyWidgetTitleGet( oyWIDGET_GROUP_DEFAULT_PROFILES, NULL, &name, &tooltip, &flags );
    qs = QString::fromLocal8Bit(name);
    ui->kmsettingsTab->setTabText(1,qs);
  
    oyWidgetTitleGet( oyWIDGET_GROUP_BEHAVIOUR, NULL, &name, &tooltip, &flags );
    qs = QString::fromLocal8Bit(name);
    ui->kmsettingsTab->setTabText(2,qs);

    oyWidgetTitleGet( oyWIDGET_GROUP_BEHAVIOUR_EFFECT, NULL, &name, &tooltip, &flags );
    qs = QString::fromLocal8Bit(name);
    ui->kmsettingsTab->setTabText(3,qs);

#define SET_OY_PROFILE_WIDGET( widget ) \
    oyWidgetTitleGet( oyWIDGET_##widget, NULL, &name, &tooltip, &flags ); \
    qs = QString::fromLocal8Bit(name); \
    ui->label_##widget->setText( qs ); \
    qs = QString::fromLocal8Bit( tooltip ); \
    ui->label_##widget->setToolTip( qs ); \
    ui->combo_##widget->setToolTip( qs );

#define SET_OY_BOX_WIDGET( widget ) \
    oyWidgetTitleGet( oyWIDGET_##widget, NULL, &name, &tooltip, &flags ); \
    qs = QString::fromLocal8Bit(name); \
    ui->box_##widget->setTitle( qs ); \
    qs = QString::fromLocal8Bit( tooltip ); \
    ui->box_##widget->setToolTip( qs );

#define SET_OY_COMBO_WIDGET( widget ) \
    oyWidgetTitleGet( oyWIDGET_##widget, NULL, &name, &tooltip, &flags ); \
    oyOptionChoicesGet( oyWIDGET_##widget, &count, &names, &current ); \
    qs = QString::fromLocal8Bit( tooltip ); \
    ui->combo_##widget->setToolTip( qs ); \
    ui->combo_##widget->clear(); \
    for(i = 0; i < count; ++i) \
    { \
      qs = QString::fromLocal8Bit( names[i] ); \
      ui->combo_##widget->addItem( qs ); \
    }

#define SET_OY_CHECK_WIDGET( widget ) \
    oyWidgetTitleGet( oyWIDGET_##widget, NULL, &name, &tooltip, &flags ); \
    qs = QString::fromLocal8Bit( name ); \
    ui->check_##widget->setText( qs ); \
    qs = QString::fromLocal8Bit( tooltip ); \
    ui->check_##widget->setToolTip( qs );

#define SET_OY_LABEL_WIDGET( widget ) \
    oyWidgetTitleGet( oyWIDGET_##widget, NULL, &name, &tooltip, &flags ); \
    qs = QString::fromLocal8Bit(name); \
    ui->label_##widget->setText( qs ); \
    qs = QString::fromLocal8Bit( tooltip ); \
    ui->label_##widget->setToolTip( qs );

    SET_OY_PROFILE_WIDGET( EDITING_RGB );
    SET_OY_PROFILE_WIDGET( EDITING_CMYK );
    SET_OY_PROFILE_WIDGET( EDITING_LAB );
    SET_OY_PROFILE_WIDGET( EDITING_XYZ );
    SET_OY_PROFILE_WIDGET( EDITING_GRAY );
    SET_OY_PROFILE_WIDGET( ASSUMED_RGB );
    SET_OY_PROFILE_WIDGET( ASSUMED_CMYK );
    SET_OY_PROFILE_WIDGET( ASSUMED_LAB );
    SET_OY_PROFILE_WIDGET( ASSUMED_XYZ );
    SET_OY_PROFILE_WIDGET( ASSUMED_GRAY );
    SET_OY_PROFILE_WIDGET( ASSUMED_WEB );
    SET_OY_PROFILE_WIDGET( PROFILE_PROOF );
    SET_OY_PROFILE_WIDGET( PROFILE_EFFECT );
    SET_OY_BOX_WIDGET( GROUP_BEHAVIOUR_RENDERING );
    SET_OY_BOX_WIDGET( GROUP_BEHAVIOUR_MIXED_MODE_DOCUMENTS );
    SET_OY_BOX_WIDGET( GROUP_BEHAVIOUR_MISSMATCH );
    SET_OY_BOX_WIDGET( GROUP_BEHAVIOUR_PROOF );
    SET_OY_BOX_WIDGET( GROUP_BEHAVIOUR_EFFECT );
    SET_OY_BOX_WIDGET( GROUP_BEHAVIOUR_DISPLAY );
    SET_OY_COMBO_WIDGET( ACTION_UNTAGGED_ASSIGN );
    SET_OY_LABEL_WIDGET( ACTION_UNTAGGED_ASSIGN );
    SET_OY_COMBO_WIDGET( ACTION_OPEN_MISMATCH_RGB );
    SET_OY_LABEL_WIDGET( ACTION_OPEN_MISMATCH_RGB );
    SET_OY_COMBO_WIDGET( ACTION_OPEN_MISMATCH_CMYK );
    SET_OY_LABEL_WIDGET( ACTION_OPEN_MISMATCH_CMYK );
    SET_OY_COMBO_WIDGET( MIXED_MOD_DOCUMENTS_PRINT );
    SET_OY_LABEL_WIDGET( MIXED_MOD_DOCUMENTS_PRINT );
    SET_OY_COMBO_WIDGET( MIXED_MOD_DOCUMENTS_SCREEN );
    SET_OY_LABEL_WIDGET( MIXED_MOD_DOCUMENTS_SCREEN );
    SET_OY_COMBO_WIDGET( DISPLAY_WHITE_POINT );
    SET_OY_LABEL_WIDGET( DISPLAY_WHITE_POINT );
    SET_OY_COMBO_WIDGET( DISPLAY_WHITE_POINT_DAEMON );
    SET_OY_LABEL_WIDGET( DISPLAY_WHITE_POINT_DAEMON );
    SET_OY_COMBO_WIDGET( RENDERING_INTENT );
    SET_OY_COMBO_WIDGET( RENDERING_INTENT_PROOF );
    SET_OY_LABEL_WIDGET( RENDERING_INTENT_PROOF );
    SET_OY_CHECK_WIDGET( RENDERING_BPC );
    SET_OY_CHECK_WIDGET( PROOF_SOFT );
    SET_OY_CHECK_WIDGET( PROOF_HARD );
    SET_OY_CHECK_WIDGET( RENDERING_GAMUT_WARNING );
    SET_OY_CHECK_WIDGET( EFFECT );

    // Load behavior settings and display current default policy.
    reload();

    // QT-related SIGNAL/SLOT functions, such as button presses and clicking
    // on a particular item.
    connect(ui->policySettingsList, SIGNAL(itemClicked(QListWidgetItem*)),
         this, SLOT(selectPolicy(QListWidgetItem*)));
    connect(ui->currentPolicyCombo, SIGNAL(activated(int)),
         this, SLOT(selectPolicy(int)));
    connect(ui->addNewPolicyButton, SIGNAL(clicked()), this, SLOT(addNewPolicy()));
    connect(ui->removePolicyButton, SIGNAL(clicked()), this, SLOT(removeCustomPolicy()));

   int k = 0, n = editableComboItems.size();
   // When a user clicks on any combo box, the "Apply" button will be enabled.
   for(k = 0; k < n; ++k)
    connect(editableComboItems.value(k), SIGNAL(activated(int)), this, SLOT(emitChanged()));

   n = editableCheckBoxItems.size();
   // When a user clicks on a radio box, the "Apply" button will be enabled.
   for(k = 0; k < n; ++k)
    connect(editableCheckBoxItems.value(k), SIGNAL(clicked()), this, SLOT(emitChanged()));

#ifdef HAVE_QT_DBUS
  if( QDBusConnection::sessionBus().connect( QString(), "/org/libelektra/configuration", "org.libelektra", QString(),
                                               this, SLOT( configChanged( QString ) )) )
      fprintf(stderr, "=================== connect settings to libelektra\n" );
#endif

  acceptDBusUpdate = true;
}
Ejemplo n.º 5
0
/**
 * Read/parse the Definition file.
 * @param   pFile   Pointer to fileobject.
 * @remark  throws errorcode on error (TODO: errorhandling)
 */
void kFileDef::read(kFile *pFile)
{
    char *pszTmp;
    char *psz;
    char  szBuffer[256];

    /* readloop */
    psz = readln(pFile, &szBuffer[0], sizeof(szBuffer));
    while (psz != NULL)
    {
        KBOOL   fNext = TRUE;

        /* if-switch */
        if (StringCase(psz, "LIBRARY"))
        {
            if (pszType != NULL) throw (kError(kError::DEF_MULIPLE_MODULE_STATEMENT));
            pszType = dupeString(psz);
            fLibrary = TRUE;
            if (!setModuleName())
                throw (kError(kError::DEF_BAD_LIBRARY_STATEMENT));
            fInitInstance = stristr(pszType, "INITINSTANCE") != NULL;
            fInitGlobal   = stristr(pszType, "INITGLOBAL")   != NULL || !fInitInstance;
            fTermInstance = stristr(pszType, "TERMINSTANCE") != NULL;
            fTermGlobal   = stristr(pszType, "TERMGLOBAL")   != NULL || !fTermInstance;
        }
        else if (StringCase(psz, "NAME"))
        {
            if (pszType != NULL) throw (kError(kError::DEF_MULIPLE_MODULE_STATEMENT));
            pszType = dupeString(psz);
            fProgram = TRUE;
            setModuleName();
            if (stristr(pszType, "WINDOWAPI"))
                chAppType = kFileDef::pm;
            else if (stristr(pszType, "NOTWINDOWCOMPAT"))
                chAppType = kFileDef::fullscreen;
            else if (stristr(pszType, "WINDOWCOMPAT"))
                chAppType = kFileDef::pmvio;
            else
                chAppType = kFileDef::unknown;
        }
        else if (StringCase(psz, "PHYSICAL DEVICE")) //gap is fixed to one space, this may be fixed in readln.
        {
            if (pszType != NULL) throw (kError(kError::DEF_MULIPLE_MODULE_STATEMENT));
            pszType = dupeString(psz);
            fPhysicalDevice = TRUE;
            setModuleName();
        }
        else if (StringCase(psz, "VIRTUAL DEVICE")) //gap is fixed to one space, this may be fixed in readln.
        {
            if (pszType != NULL) throw (kError(kError::DEF_MULIPLE_MODULE_STATEMENT));
            pszType = dupeString(psz);
            fVirtualDevice = TRUE;
            setModuleName();
        }
        else if (StringCase(psz, "BASE"))
            pszBase = dupeString(psz, TRUE);
        else if (StringCase(psz, "CODE"))
            pszCode = dupeString(psz, TRUE);
        else if (StringCase(psz, "DATA"))
            pszData = dupeString(psz, TRUE);
        else if (StringCase(psz, "DESCRIPTION"))
            pszDescription = dupeString(psz, TRUE);
        else if (StringCase(psz, "EXETYPE"))
            pszExeType = dupeString(psz, TRUE);
        else if (StringCase(psz, "HEAPSIZE"))
            pszHeapSize = dupeString(psz, TRUE);
        else if (StringCase(psz, "OLD"))
            pszOld = dupeString(psz, TRUE);
        else if (StringCase(psz, "PROTMODE"))
            pszProtmode = dupeString(psz, TRUE);
        else if (StringCase(psz, "STACKSIZE"))
            pszStackSize = dupeString(psz, TRUE);
        else if (StringCase(psz, "STUB"))
            pszStub = dupeString(psz, TRUE);
        else if (StringCase(psz, "SEGMENTS"))
        {
            PDEFSEGMENT *pps = &pSegments;
            while (!isKeyword(psz = readln(pFile, &szBuffer[0], sizeof(szBuffer))) && psz != NULL)
            {
                *pps = new DEFSEGMENT; memset(*pps, 0, sizeof(**pps));
                (**pps).psz = dupeString(psz);
                pps = &(**pps).pNext;
            }
            fNext = FALSE;
        }
        else if (StringCase(psz, "IMPORTS"))
        {
            PDEFIMPORT *ppi = &pImports;
            while (!isKeyword(psz = readln(pFile, &szBuffer[0], sizeof(szBuffer))) && psz != NULL)
            {
                //DOSCALL1.154 or DosQueryHeaderInfo = DOSCALL1.154
                *ppi = new DEFIMPORT; memset(*ppi, 0, sizeof(**ppi));
                (**ppi).ulOrdinal = 0xffffffffUL;

                if ((pszTmp = strchr(psz, '=')) != NULL)
                {
                   *pszTmp = '\0';
                   (**ppi).pszIntName = dupeString(trim(psz));
                   psz = pszTmp + 1;
                }
                if ((pszTmp = strchr(psz, '.')) != NULL)
                {
                    *pszTmp = '\0';
                    (**ppi).pszDll = dupeString(trim(psz));
                    psz = pszTmp + 1;
                }
                psz = trim(psz);
                if (*psz >= '0' && *psz <= '9')
                {
                    (**ppi).ulOrdinal = strtol(psz, &pszTmp, 0);
                    if (psz ==pszTmp) throw (kError(kError::DEF_BAD_IMPORT));
                }
                else
                    (**ppi).pszName = dupeString(psz);
                ppi = &(**ppi).pNext;
            }
            fNext = FALSE;
        }
        else if (StringCase(psz, "EXPORTS"))
        {
            PDEFEXPORT *ppe = &pExports;
            while (!isKeyword(psz = readln(pFile, &szBuffer[0], sizeof(szBuffer))) && psz != NULL)
            {
                /* CloseHandle = CloseHandle@4 @1234 RESIDENTNAME 2 */
                *ppe = new DEFEXPORT; memset(*ppe, 0, sizeof(**ppe));
                (**ppe).ulOrdinal = 0xffffffffUL;
                (**ppe).cParam    = 0xffffffffUL;

                /* look for '=' */
                pszTmp = strchr(psz, '=');
                if (pszTmp != NULL)
                {   /* CloseHandle = CloseHandle@4 */
                    *pszTmp ='\0';
                    (**ppe).pszName = dupeString(trim(psz));
                    psz = trim(pszTmp + 1);

                    pszTmp = strchr(psz, ' ');
                    if (pszTmp != NULL)
                        *pszTmp = '\0';
                    (**ppe).pszIntName = dupeString(trim(psz));
                    if (pszTmp != NULL)
                        psz = pszTmp + 1;
                    else
                        psz = NULL;
                }
                else
                {   /* CloseHandle (no '= CloseHandle@4')*/
                    pszTmp = strchr(psz, ' ');
                    if (pszTmp != NULL)
                        *pszTmp = '\0';
                    (**ppe).pszName = dupeString(trim(psz));
                    if (pszTmp != NULL)
                        psz = pszTmp + 1;
                    else
                        psz = NULL;
                }

                if (psz != NULL)
                {   /* @1234 RESIDENTNAME 2 */
                    pszTmp = strchr(psz, '@');
                    if (pszTmp)
                    {   /* @1234 RESIDENTNAME 2 */
                        psz = pszTmp + 1;
                        (**ppe).ulOrdinal = strtol(psz, &pszTmp, 0);
                        if (pszTmp == psz) throw (kError(kError::DEF_BAD_EXPORT));
                        psz = trim(pszTmp);

                        if (*psz != '\0')
                        {   /* RESIDENTNAME 2 */
                            if (StringCase(psz, "RESIDENTNAME"))
                            {
                                (**ppe).fResident = TRUE;
                                psz = trim(psz + sizeof("RESIDENTNAME") - 1);
                            }
                            else if (StringCase(psz, "NONAME"))
                            {
                                (**ppe).fResident = FALSE;
                                psz = trim(psz + sizeof("NONAME") - 1);
                            }
                        }
                        else
                        {
                            (**ppe).fResident = (**ppe).ulOrdinal == 0xffffffffUL;
                        }
                    }

                    if (*psz != '\0')
                    {   /* 2 */
                        (**ppe).cParam = strtol(psz, &pszTmp, 0);
                        if (pszTmp == psz) throw (kError(kError::DEF_BAD_EXPORT));
                    }
                }

                removeFnutts((**ppe).pszIntName);
                removeFnutts((**ppe).pszName);
                ppe = &(**ppe).pNext;
            }
            fNext = FALSE;
        }
        else
            throw (kError(kError::DEF_UNKOWN_VERB));

        /* next ? */
        if (fNext)
            psz = readln(pFile, &szBuffer[0], sizeof(szBuffer));
    }

    /* sanity check */
    if (pszType == NULL)
        throw (kError(kError::DEF_NO_MODULE_STATEMENT));
}