void ProfileManager::setProfiles(const QList<Profile*>& profiles)
{
	QList<Profile*> currentProfiles = this->profiles;

	QList<Profile*>::const_iterator it;

	for (it = currentProfiles.begin() ; it != currentProfiles.end() ; it++) {
		Profile* profile = *it;

		if (!profiles.contains(profile)) {
			if (getCurrentProfile() == profile) {
				setCurrentProfile(NULL);
			}

			removeProfile(profile);
			delete profile;
		}
	}

	for (it = profiles.begin() ; it != profiles.end() ; it++) {
		Profile* profile = *it;

		if (!currentProfiles.contains(profile)) {
			addProfile(profile);
		}
	}
}
SettingsDialog::SettingsDialog(QList<serverprofile> profiles,QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SettingsDialog)
{
    ui->setupUi(this);
    this->profiles = profiles;
    for(int i=0;i<profiles.length();i++)
    {
        ui->comboBoxProfiles->addItem(profiles.at(i).profilename);
    }
    ui->comboBoxProfiles->setEditable(false);
    ui->btnConnect->hide();
    ui->spinBoxPort->setMaximum(65536);
    ui->spinBoxPort->setMinimum(1);
    connect(ui->leHostname,SIGNAL(editingFinished()),this,SLOT(valueChanged()));
    connect(ui->lePassword,SIGNAL(editingFinished()),this,SLOT(valueChanged()));
    connect(ui->cbDefaultServer,SIGNAL(toggled(bool)),this,SLOT(valueChanged()));
    connect(ui->spinBoxPort,SIGNAL(editingFinished()),this,SLOT(valueChanged()));
    connect(ui->btnCancel,SIGNAL(clicked()),this,SIGNAL(cancelRequested()));
    connect(ui->btnOk,SIGNAL(clicked()),this,SLOT(okClicked()));
    connect(ui->btnAddProfile,SIGNAL(clicked()),this,SLOT(addProfile()));
    connect(ui->btnDeleteProfile,SIGNAL(clicked()),this,SLOT(deleteProfile()));
    connect(ui->comboBoxProfiles,SIGNAL(currentIndexChanged(QString)),this,SLOT(selectedProfileChange(QString)));
    selectedProfileChange(ui->comboBoxProfiles->currentText());
    kineticscroller = new QsKineticScroller(this);
    kineticscroller->enableKineticScrollFor(ui->scrollArea);
    ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
}
 void CProfileRepoServerClb::OnRequest(Ipc::MsgID id, UInt8 const* pPayload, UInt32 payloadSize, UInt8* const pResponseBuffer, UInt32& bufferSize, Ipc::DirectionID)
 {
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );
    const RepoRequest * req = reinterpret_cast<const RepoRequest*>(pPayload);
    switch (req->type)
    {
    case REQ_ADD_PROFILE_API:
       addProfileAPI(req,payloadSize,pResponseBuffer,bufferSize);
       break;
    case REQ_REMOVE_PROFILE_API:
       removeProfileAPI(req,payloadSize,pResponseBuffer,bufferSize);
       break;
    case REQ_ADD_PROFILE:
       addProfile(req,payloadSize,pResponseBuffer,bufferSize);
       break;
    case REQ_REMOVE_PROFILE:
       removeProfile(req,payloadSize,pResponseBuffer,bufferSize);
       break;
    case REQ_ADD_PROFILE_IMPLEMENTATION:
       addProfileImplementation(req,payloadSize,pResponseBuffer,bufferSize);
       break;
    case REQ_REMOVE_PROFILE_IMPLEMENTATION_PL:
       removeProfileImplementationPl(req,payloadSize,pResponseBuffer,bufferSize);
       break;
    case REQ_FIND_PROFILES:
       findProfiles(req,payloadSize,pResponseBuffer,bufferSize);
       break;
    case REQ_GET_MANIFEST:
       getManifest(req,payloadSize,pResponseBuffer,bufferSize);
       break;
    case REQ_GET_PROFILE_LIST:
       getProfilesList(req,payloadSize,pResponseBuffer,bufferSize);
       break;
    }
 }
Example #4
0
void Profiles::loadProfiles() {
  char **vals;
  Redis *redis = ntop->getRedis();
  int rc;

  rc = (redis ? redis->hashKeys(CONST_PROFILES_PREFS, &vals) : -1);
  if(rc > 0) {
    rc = min_val(rc, MAX_NUM_PROFILES);

    for(int i = 0; i < rc; i++) {
      if(vals[i] != NULL) {
	char contents[2048];

	if(redis->hashGet((char*)CONST_PROFILES_PREFS, vals[i], contents, sizeof(contents)) != -1) {
	  Profile *c = addProfile(vals[i], contents);
	  if(c) profiles[numProfiles++] = c;
	}

	free(vals[i]);
      }
    }

    free(vals);
  }
}
Example #5
0
void InputMap::loadProfiles(const QDir& dir)
{
    if (dir.exists() == false || dir.isReadable() == false)
        return;

    /* Go thru all found file entries and attempt to load an input
       profile from each of them. */
    QStringListIterator it(dir.entryList());
    while (it.hasNext() == true)
    {
        QLCInputProfile* prof;
        QString path;

        path = dir.absoluteFilePath(it.next());
        prof = QLCInputProfile::loader(path);
        if (prof != NULL)
        {
            /* Check for duplicates */
            if (profile(prof->name()) == NULL)
                addProfile(prof);
            else
                delete prof;
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unable to find an input profile from" << path;
        }
    }
}
Example #6
0
static void	executeAdd(int tokenCount, char **tokens)
{
	if (tokenCount < 2)
	{
		printText("Add what?");
		return;
	}

	if (strcmp(tokens[1], "profile") == 0)
	{
		if (tokenCount != 10 && tokenCount != 9)
		{
			SYNTAX_ERROR;
			return;
		}

		oK(addProfile(strtol(tokens[2], NULL, 0),
				strtol(tokens[3], NULL, 0),
				strtol(tokens[4], NULL, 0),
				strtol(tokens[5], NULL, 0),
				strtol(tokens[6], NULL, 0),
				tokens[7], tokens[8], tokens[9]));
		return; 
	}
	
	SYNTAX_ERROR;
}
    /**
     * @brief BasicCppProjectGenerator::doGenerate
     */
    void BasicCppProjectGenerator::doGenerate()
    {
        for (auto &&scope : m_ProjectTranslator.projectDatabase()->scopes())
            generateFiles(scope, m_RootOutputDirectory);

        addProfile();
    }
Example #8
0
int profileManager(int choice){
	int fileFlag,option;
	FILE *pProfiles;
	fileFlag=checkFileExists("profiles.txt");
	switch(choice){
		case 1:
			if(fileFlag){
				pProfiles=fopen("profiles.txt","r");
				printProfiles(pProfiles);
				option = getChoice();
				if(tolower(option) == 'n'){	
					addProfile();
				}else if(tolower(option) == 'q'){
					fclose(pProfiles);
					return 0;
				}else if(tolower(option) == 'd'){
					
				}else{

				}

				fclose(pProfiles);
				return option-'0';
			}else{
				return makeProfileFile();

			}
		case 2:
			if(fileFlag){
				
			}else{

			}
	}
}
Example #9
0
void ConfigDialog::on_addProfilePushButton_clicked()
{
	QString profile = ui->profilesComboBox->currentText();
	if (profile.isEmpty()) {
		QMessageBox msgBox(QMessageBox::Warning, tr("Cannot add profile"),
			tr("Empty profile name."),
			QMessageBox::Ok, this
		);
		msgBox.exec();
		return;
	}
	if (getProfiles(m_strIniPath).contains(profile)) {
		QString msg(tr("Profile \""));
		msg += profile + tr("\" already exists.");
		QMessageBox msgBox(QMessageBox::Warning, tr("Cannot add profile"), msg, QMessageBox::Ok, this);
		msgBox.exec();
		return;
	}
	addProfile(m_strIniPath, profile);
	ui->profilesComboBox->addItem(profile);
	for (int i = 0; i < ui->profilesComboBox->count(); ++i) {
		if (ui->profilesComboBox->itemText(i) == profile) {
			ui->profilesComboBox->setCurrentIndex(i);
			break;
		}
	}
	ui->removeProfilePushButton->setDisabled(false);
}
Example #10
0
//--------------------------------------------------------------------------
void MeshLodTests::testMeshLodGenerator()
{
    UnitTestSuite::getSingletonPtr()->startTestMethod(__FUNCTION__);

    LodConfig config;
    setTestLodConfig(config);

    MeshLodGenerator& gen = MeshLodGenerator::getSingleton();
    gen.generateLodLevels(config);
    addProfile(config);
    config.advanced.useBackgroundQueue = false;
    config.advanced.useCompression = false;
    config.advanced.useVertexNormals = false;
    gen.generateLodLevels(config);

    LodConfig config2(config);
    config2.advanced.useBackgroundQueue = true;
    config2.mesh->removeLodLevels();
    gen.generateLodLevels(config);
    blockedWaitForLodGeneration(config.mesh);
    CPPUNIT_ASSERT(config.levels.size() == config2.levels.size());
    for (size_t i = 0; i < config.levels.size(); i++) 
    {
        CPPUNIT_ASSERT(config.levels[i].outSkipped == config2.levels[i].outSkipped);
        CPPUNIT_ASSERT(config.levels[i].outUniqueVertexCount == config2.levels[i].outUniqueVertexCount);
    }
}
void InspectorProfilerAgent::stop(ErrorString*)
{
    if (!m_recordingCPUProfile)
        return;
    m_recordingCPUProfile = false;
    String title = getCurrentUserInitiatedProfileName();
    RefPtr<ScriptProfile> profile = stopProfiling(title);
    if (profile)
        addProfile(profile, 0, 0, String());
    toggleRecordButton(false);
}
Example #12
0
//--------------------------------------------------------------------------
void MeshLodTests::testLodConfigSerializer()
{
    UnitTestSuite::getSingletonPtr()->startTestMethod(__FUNCTION__);

    LodConfig config, config2;
    setTestLodConfig(config);
    addProfile(config);
    LodConfigSerializer serializer;
    serializer.exportLodConfig(config, "testLodConfigSerializer.lodconfig");
    serializer.importLodConfig(&config2, "testLodConfigSerializer.lodconfig");
    CPPUNIT_ASSERT(config.mesh->getHandle() == config2.mesh->getHandle());
    CPPUNIT_ASSERT(config.strategy == config2.strategy);
    CPPUNIT_ASSERT(config.advanced.outsideWalkAngle == config.advanced.outsideWalkAngle);
    CPPUNIT_ASSERT(config.advanced.outsideWeight == config.advanced.outsideWeight);
    CPPUNIT_ASSERT(config.advanced.useBackgroundQueue == config.advanced.useBackgroundQueue);
    CPPUNIT_ASSERT(config.advanced.useCompression == config.advanced.useCompression);
    CPPUNIT_ASSERT(config.advanced.useVertexNormals == config.advanced.useVertexNormals);

    {
        // Compare profiles
        LodProfile& p1 = config.advanced.profile;
        LodProfile& p2 = config2.advanced.profile;
        bool isProfileSameSize = (p1.size() == p2.size());
        CPPUNIT_ASSERT(isProfileSameSize);
        if (isProfileSameSize) 
        {
            for (size_t i = 0; i < p1.size(); i++) 
            {
                CPPUNIT_ASSERT(p1[i].src == p2[i].src);
                CPPUNIT_ASSERT(p1[i].dst == p2[i].dst);
                CPPUNIT_ASSERT(isEqual(p1[i].cost, p2[i].cost));
            }
        }
    }

    {
        // Compare Lod Levels
        LodConfig::LodLevelList& l1 = config.levels;
        LodConfig::LodLevelList& l2 = config2.levels;
        bool isLevelsSameSize = (l1.size() == l2.size());
        CPPUNIT_ASSERT(isLevelsSameSize);
        if (isLevelsSameSize) 
        {
            for (size_t i = 0; i < l1.size(); i++) 
            {
                CPPUNIT_ASSERT(l1[i].distance == l2[i].distance);
                CPPUNIT_ASSERT(l1[i].manualMeshName == l2[i].manualMeshName);
                CPPUNIT_ASSERT(l1[i].reductionMethod == l2[i].reductionMethod);
                CPPUNIT_ASSERT(isEqual(l1[i].reductionValue, l2[i].reductionValue));
            }
        }
    }
}
ZAddProfile::ZAddProfile()
    :MyBaseDlg()
{
	id = "";
	pas = "";
	edit = false;
	num = 0;
    prot = 0;

	setMainWidgetTitle(LNG_ADDPROFILE);
	
	ZFormContainer *form = new ZFormContainer(this, 0, ZSkinService::clsZFormContainer);
	setContentWidget(form);
	
	zcbProtocol = new ZComboBox(form);
	zcbProtocol->setTitle( LNG_PROTOCOL );
	QPixmap pm;
	pm.load(ProgDir+ "/status/icq/online.png");
	zcbProtocol->insertItem(pm, "ICQ", 0);
	#ifdef _XMPP
	pm.load(ProgDir+ "/status/jabber/online.png");
	zcbProtocol->insertItem(pm, "JABBER", 1);
	#endif
		
	form->addChild(zcbProtocol);
	
	zleID = new ZLineEdit("", form);
	zleID->setTitle( LNG_LOGIN );
	form->addChild ( zleID );
	
	zlePas = new ZLineEdit("", form);
	zlePas->setTitle( LNG_PASSWORD );
	setInputMethod(zlePas, ZKB_INPUT_MULTITAP, ZKbInputField::FIELD_TYPE_PASSWORD);
	zlePas->setEchoMode(ZLineEdit::Password);
	form->addChild ( zlePas );

	connect ( zcbProtocol, SIGNAL ( activated(int) ), this, SLOT ( changeProtocol(int) ) );
	changeProtocol(0);

	QValueList<QUuid> flist2;
	flist2.append( ZKB_INPUT_MULTITAP );
	flist2.append( ZKB_INPUT_SYMBOL );
	setInputMethods((QWidget*)zlePas, (const QUuid&)ZKB_INPUT_MULTITAP, flist2);
	
	ZSoftKey *softKey  = new ZSoftKey("CST_2", this, this);
	softKey->setText ( ZSoftKey::LEFT, LNG_ADD, ( ZSoftKey::TEXT_PRIORITY ) 0 );
	softKey->setText ( ZSoftKey::RIGHT, LNG_CANCEL, ( ZSoftKey::TEXT_PRIORITY ) 0 );
	softKey->setClickedSlot ( ZSoftKey::RIGHT, this, SLOT ( reject() ) );
	softKey->setClickedSlot ( ZSoftKey::LEFT, this, SLOT ( addProfile() ) );
	setSoftKey(softKey);
}
Example #14
0
void InspectorProfilerAgent::stopUserInitiatedProfiling()
{
    m_recordingUserInitiatedProfile = false;
    String title = getCurrentUserInitiatedProfileName();
#if USE(JSC)
    JSC::ExecState* scriptState = toJSDOMWindow(m_inspectorController->inspectedPage()->mainFrame(), debuggerWorld())->globalExec();
#else
    // Use null script state to avoid filtering by context security token.
    // All functions from all iframes should be visible from Inspector UI.
    ScriptState* scriptState = 0;
#endif
    RefPtr<ScriptProfile> profile = ScriptProfiler::stop(scriptState, title);
    if (profile)
        addProfile(profile, 0, String());
    toggleRecordButton(false);
}
PassRefPtr<TypeBuilder::Profiler::ProfileHeader> InspectorProfilerAgent::stop(ErrorString* errorString)
{
    if (!m_recordingCPUProfile)
        return 0;
    m_recordingCPUProfile = false;
    String title = getCurrentUserInitiatedProfileName();
    RefPtr<ScriptProfile> profile = stopProfiling(title);
    RefPtr<TypeBuilder::Profiler::ProfileHeader> profileHeader;
    if (profile) {
        addProfile(profile, 0, String());
        profileHeader = createProfileHeader(*profile);
    } else if (errorString)
        *errorString = "Profile wasn't found";
    toggleRecordButton(false);
    m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false);
    return profileHeader;
}
Example #16
0
void QbsManager::addProfileFromKit(const ProjectExplorer::Kit *k)
{
    QStringList usedProfileNames = profileNames();
    const QString name = ProjectExplorer::Project::makeUnique(
                QString::fromLatin1("qtc_") + k->fileSystemFriendlyName(), usedProfileNames);
    setProfileForKit(name, k);

    // set up properties:
    QVariantMap data = m_defaultPropertyProvider->properties(k, QVariantMap());
    QList<PropertyProvider *> providerList = ExtensionSystem::PluginManager::getObjects<PropertyProvider>();
    foreach (PropertyProvider *provider, providerList) {
        if (provider->canHandle(k))
            data = provider->properties(k, data);
    }

    addProfile(name, data);
}
Example #17
0
void QbsManager::addProfileFromKit(const ProjectExplorer::Kit *k)
{
    const QString name = QString::fromLatin1("qtc_%1_%2").arg(k->fileSystemFriendlyName().left(8),
            QString::number(k->id().uniqueIdentifier(), 16));
    qbs::Profile(name, settings()).removeProfile();
    setProfileForKit(name, k);
    addQtProfileFromKit(name, k);

    // set up properties:
    QVariantMap data = m_defaultPropertyProvider->properties(k, QVariantMap());
    QList<PropertyProvider *> providerList = ExtensionSystem::PluginManager::getObjects<PropertyProvider>();
    foreach (PropertyProvider *provider, providerList) {
        if (provider->canHandle(k))
            data = provider->properties(k, data);
    }

    addProfile(name, data);
}
/*!
 * Adds the profile in the config file.
 */
void XmppConfigDialog::add()
{
	//Checking if we can add this account.
	if (ui.profileNameEdit->text() == "" || ui.jidEdit->text() == "" || ui.passwordEdit->text() == "")
	{
		QMessageBox::critical(this, tr("Profiles"), QString("You *must* supply a profile name, a JID and a password."), QMessageBox::Ok);
		return;
	}
	
	for (int i = 0; i < profiles.count(); i++)
	{
		if (profiles[i].name() == ui.profileNameEdit->text())
		{
			QMessageBox::critical(this, tr("Profiles"), QString("A profile with the name \"%1\" already exists.").arg(ui.profileNameEdit->text()), QMessageBox::Ok);
			return;
		}
	}

	QString pName = ui.profileNameEdit->text();
	Jid pJid = Jid(ui.jidEdit->text());
	QString pPass = ui.passwordEdit->text();
	QString pServer = ui.personnalServerEdit->text();
	QString pPort = ui.portEdit->text();

	Profile p(pName);
	p.setData(pJid, pPass, pServer, pPort);

	if (ui.registerBox->isChecked())
	{
		// Register new account.
		xmpp = new Xmpp();
		task = new Task();
		xmppReg = new XmppReg(task, xmpp);
		connect(xmpp, SIGNAL(readyRead()), SLOT(read()));
		connect(xmppReg, SIGNAL(finished()), SLOT(regFinished()));
		connect(xmppReg, SIGNAL(error()), SLOT(registerError()));
		xmppReg->registerAccount(p);
	}
	else
	{
		// FIXME:This should be in another Method (also run after registering)
		addProfile(p);
	}
}
Example #19
0
PassRefPtr<TypeBuilder::Profiler::ProfileHeader> InspectorProfilerAgent::stop(ErrorString* errorString)
{
    if (!m_recordingCPUProfile) {
        if (errorString)
            *errorString = "No recording profiles found";
        return 0;
    }
    m_recordingCPUProfile = false;
    if (m_overlay)
        m_overlay->finishedRecordingProfile();
    String title = getCurrentUserInitiatedProfileName();
    RefPtr<ScriptProfile> profile = ScriptProfiler::stop(title);
    RefPtr<TypeBuilder::Profiler::ProfileHeader> profileHeader;
    if (profile) {
        addProfile(profile, 0, String());
        profileHeader = createProfileHeader(*profile);
    } else if (errorString)
        *errorString = "Profile wasn't found";
    m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false);
    return profileHeader;
}
Example #20
0
void InspectorProfilerAgent::stopUserInitiatedProfiling(bool ignoreProfile)
{
    if (!m_recordingUserInitiatedProfile)
        return;
    m_recordingUserInitiatedProfile = false;
    String title = getCurrentUserInitiatedProfileName();
#if USE(JSC)
    JSC::ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec();
#else
    // Use null script state to avoid filtering by context security token.
    // All functions from all iframes should be visible from Inspector UI.
    ScriptState* scriptState = 0;
#endif
    RefPtr<ScriptProfile> profile = ScriptProfiler::stop(scriptState, title);
    if (profile) {
        if (!ignoreProfile)
            addProfile(profile, 0, String());
        else
            addProfileFinishedMessageToConsole(profile, 0, String());
    }
    toggleRecordButton(false);
    m_inspectorState->setBoolean(ProfilerAgentState::userInitiatedProfiling, false);
}
Example #21
0
void InputMap::loadProfiles(const QString& profilePath)
{
	/* Find *.qxi from profilePath, sort by name, get regular files */
	QDir dir(profilePath, QString("*%1").arg(KExtInputProfile),
		 QDir::Name, QDir::Files);
	if (dir.exists() == false || dir.isReadable() == false)
	{
		qWarning() << "Unable to load input profiles from"
			   << profilePath;
		return;
	}

	/* Go thru all found file entries and attempt to load an input
	   profile from each of them. */
	QStringListIterator it(dir.entryList());
	while (it.hasNext() == true)
	{
		QLCInputProfile* prof;
		QString path;

		path = dir.absoluteFilePath(it.next());
		prof = QLCInputProfile::loader(path);
		if (prof != NULL)
		{
			/* Check for duplicates */
			if (profile(prof->name()) == NULL)
				addProfile(prof);
			else
				delete prof;
		}
		else
		{
			qWarning() << "Unable to find an input profile from"
				   << path;
		}
	}
}
Example #22
0
void LoadTestSettings::loadSegmentsElement(TiXmlElement *pElement)
{
	for (TiXmlElement *pItem = pElement->FirstChildElement(); pItem; pItem = pItem->NextSiblingElement())
	{
		if (pItem->ValueStr() == "seg")
		{
			std::string content;
			if (pItem->GetText())
				content = pItem->GetText();
			
			std::string threadsAttr = pItem->Attribute("threads");
			
			if (!content.empty() && !threadsAttr.empty())
			{
				int threads = atoi(threadsAttr.c_str());
				int duration = atoi(content.c_str());
				
				LoadTestProfileSeg newSeg(threads, duration);
				
				addProfile(newSeg);
			}
		}
	}	
}
void ProfileManager::eventLoopStarted()
{
	QSettings settings;

	for (int i = 0 ; true ; i++) {
		if (!settings.contains(QString("profile%1/name").arg(i))) {
			break;
		}

		Profile* profile = new Profile(settings.value(QString("profile%1/name").arg(i)).toString());

		GameInfo::VersionMode ver;

		QString verStr = settings.value(QString("profile%1/version").arg(i)).toString();

		if (verStr == "gta3")
			ver = GameInfo::GTAIII;
		else if (verStr == "gtavc")
			ver = GameInfo::GTAVC;
		else
			ver = GameInfo::GTASA;

		GameInfo info(ver, File(settings.value(QString("profile%1/root").arg(i)).toString().toLocal8Bit().constData()));
		profile->setGameInfo(info);

		for (int j = 0 ; true ; j++) {
			if (!settings.contains(QString("profile%1/resource%2").arg(i).arg(j))) {
				break;
			}

			QString resource = settings.value(QString("profile%1/resource%2").arg(i).arg(j)).toString();
			profile->addResource(File(resource.toLocal8Bit().constData()));
		}

		for (int j = 0 ; true ; j++) {
			if (!settings.contains(QString("profile%1/search_resource%2").arg(i).arg(j))) {
				break;
			}

			QString resource = settings.value(QString("profile%1/search_resource%2").arg(i).arg(j)).toString();
			profile->addSearchResource(File(resource.toLocal8Bit().constData()));
		}

		for (int j = 0 ; true ; j++) {
			if (!settings.contains(QString("profile%1/dat_file%2").arg(i).arg(j))) {
				break;
			}

			QString datFile = settings.value(QString("profile%1/dat_file%2").arg(i).arg(j)).toString();
			profile->addDATFile(File(datFile.toLocal8Bit().constData()));
		}

		addProfile(profile);
	}

	int currentProfileIdx = settings.value("main/current_profile", -1).toInt();

	if (currentProfileIdx != -1) {
		setCurrentProfile(getProfile(currentProfileIdx));
	} else {
		setCurrentProfile(NULL);
	}

	emit profilesLoaded();
}
void QbsManager::addProfileFromKit(const ProjectExplorer::Kit *k)
{
    QStringList usedProfileNames = profileNames();
    const QString name = ProjectExplorer::Project::makeUnique(
                QString::fromLatin1("qtc_") + k->fileSystemFriendlyName(), usedProfileNames);
    setProfileForKit(name, k);

    QVariantMap data;
    QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(k);
    if (qt) {
        data.insert(QLatin1String(QTCORE_BINPATH), qt->binPath().toUserOutput());
        QStringList builds;
        if (qt->hasDebugBuild())
            builds << QLatin1String("debug");
        if (qt->hasReleaseBuild())
            builds << QLatin1String("release");
        data.insert(QLatin1String(QTCORE_BUILDVARIANT), builds);
        data.insert(QLatin1String(QTCORE_DOCPATH), qt->docsPath().toUserOutput());
        data.insert(QLatin1String(QTCORE_INCPATH), qt->headerPath().toUserOutput());
        data.insert(QLatin1String(QTCORE_LIBPATH), qt->libraryPath().toUserOutput());
        Utils::FileName mkspecPath = qt->mkspecsPath();
        mkspecPath.appendPath(qt->mkspec().toString());
        data.insert(QLatin1String(QTCORE_MKSPEC), mkspecPath.toUserOutput());
        data.insert(QLatin1String(QTCORE_NAMESPACE), qt->qtNamespace());
        data.insert(QLatin1String(QTCORE_LIBINFIX), qt->qtLibInfix());
        data.insert(QLatin1String(QTCORE_VERSION), qt->qtVersionString());
        if (qt->isFrameworkBuild())
            data.insert(QLatin1String(QTCORE_FRAMEWORKBUILD), true);
    }

    if (ProjectExplorer::SysRootKitInformation::hasSysRoot(k))
        data.insert(QLatin1String(QBS_SYSROOT), ProjectExplorer::SysRootKitInformation::sysRoot(k).toUserOutput());

    ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
    if (tc) {
        // FIXME/CLARIFY: How to pass the sysroot?
        ProjectExplorer::Abi targetAbi = tc->targetAbi();
        QString architecture = ProjectExplorer::Abi::toString(targetAbi.architecture());
        if (targetAbi.wordWidth() == 64)
            architecture.append(QLatin1String("_64"));
        data.insert(QLatin1String(QBS_ARCHITECTURE), architecture);

        if (targetAbi.endianness() == ProjectExplorer::Abi::BigEndian)
            data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("big"));
        else
            data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("little"));

        if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
            data.insert(QLatin1String(QBS_TARGETOS), QLatin1String("windows"));
            data.insert(QLatin1String(QBS_TOOLCHAIN),
                               targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor
                                   ? QStringList() << QLatin1String("mingw") << QLatin1String("gcc")
                                   : QStringList() << QLatin1String("msvc"));
        } else if (targetAbi.os() == ProjectExplorer::Abi::MacOS) {
            data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("osx")
                        << QLatin1String("darwin") << QLatin1String("unix"));
            if (tc->type() != QLatin1String("clang")) {
                data.insert(QLatin1String(QBS_TOOLCHAIN), QLatin1String("gcc"));
            } else {
                data.insert(QLatin1String(QBS_TOOLCHAIN),
                            QStringList() << QLatin1String("clang")
                            << QLatin1String("llvm")
                            << QLatin1String("gcc"));
            }
        } else if (targetAbi.os() == ProjectExplorer::Abi::LinuxOS) {
            data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("linux")
                        << QLatin1String("unix"));
            if (tc->type() != QLatin1String("clang")) {
                data.insert(QLatin1String(QBS_TOOLCHAIN), QLatin1String("gcc"));
            } else {
                data.insert(QLatin1String(QBS_TOOLCHAIN),
                            QStringList() << QLatin1String("clang")
                            << QLatin1String("llvm")
                            << QLatin1String("gcc"));
            }
        }
        Utils::FileName cxx = tc->compilerCommand();
        data.insert(QLatin1String(CPP_TOOLCHAINPATH), cxx.toFileInfo().absolutePath());
        data.insert(QLatin1String(CPP_COMPILERNAME), cxx.toFileInfo().fileName());
    }
    addProfile(name, data);
}
void InspectorProfilerAgent::addProfile(PassRefPtr<ScriptProfile> prpProfile, PassRefPtr<ScriptCallStack> callStack)
{
    const ScriptCallFrame& lastCaller = callStack->at(0);
    addProfile(prpProfile, lastCaller.lineNumber(), lastCaller.sourceURL());
}
Example #26
0
PrinterSettings::PrinterSettings(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::PrinterSettings),
    mPrinter(0),
    mUnit(UnitMillimeter)
{
    setAttribute(Qt::WA_DeleteOnClose);

    ui->setupUi(this);

    ui->leftMarginSpin->installEventFilter(this);
    ui->rightMarginSpin->installEventFilter(this);
    ui->topMarginSpin->installEventFilter(this);
    ui->bottomMarginSpin->installEventFilter(this);
    ui->internalMarginSpin->installEventFilter(this);
    ui->duplexTypeComboBox->addItem(tr("Printer has duplexer"), DuplexAuto);
    ui->duplexTypeComboBox->addItem(tr("Manual with reverse (suitable for most printers)"), DuplexManualReverse);
    ui->duplexTypeComboBox->addItem(tr("Manual without reverse"), DuplexManual);


    QPalette pal(palette());
    pal.setColor(QPalette::Background, QColor(105, 101, 98));
    ui->marginsPereview->setPalette(pal);
    ui->marginsPereview->setAutoFillBackground(true);

    int n = qMax(ui->addProfileButton->minimumSizeHint().width(), ui->addProfileButton->minimumSizeHint().height());
    ui->addProfileButton->setMinimumSize(n, n);
    ui->delProfileButton->setMinimumSize(n, n);

    connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(btnClicked(QAbstractButton*)));
    connect(ui->borderCbx, SIGNAL(toggled(bool)), this, SLOT(updatePreview()));

    connect(ui->profilesList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
            this, SLOT(selectProfile(QListWidgetItem*,QListWidgetItem*)));

    connect(ui->profilesList->itemDelegate(), SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)),
            this, SLOT(profileRenamed(QWidget*,QAbstractItemDelegate::EndEditHint)));

    connect(ui->addProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
    connect(ui->delProfileButton, SIGNAL(clicked()), this, SLOT(delProfile()));

    connect(ui->leftMarginSpin, SIGNAL(editingFinished()),
            this, SLOT(updateProfile()));

    connect(ui->rightMarginSpin, SIGNAL(editingFinished()),
            this, SLOT(updateProfile()));

    connect(ui->topMarginSpin, SIGNAL(editingFinished()),
            this, SLOT(updateProfile()));

    connect(ui->bottomMarginSpin, SIGNAL(editingFinished()),
            this, SLOT(updateProfile()));

    connect(ui->internalMarginSpin, SIGNAL(editingFinished()),
            this, SLOT(updateProfile()));

    connect(ui->duplexTypeComboBox, SIGNAL(activated(int)),
            this, SLOT(updateProfile()));

    connect(ui->reverseOrderCbx, SIGNAL(clicked()),
            this, SLOT(updateProfile()));

    connect(ui->borderCbx, SIGNAL(clicked()),
            this, SLOT(updateProfile()));

    connect(ui->resetButton, SIGNAL(clicked()),
            this, SLOT(resetToDefault()));

    restoreGeometry(settings->value(Settings::PrinterSettingsDialog_Geometry).toByteArray());
}
void XmppConfigDialog::regFinished()
{
	addProfile(xmppReg->profile());
	QMessageBox::information(this, "Registration", "Successfully registered to the server.");
}
Example #28
0
void HlpFlightPlannerApp::initApp()
{
#if defined(Q_WS_MAC)
  QString pluginPath = "/Users/denis/apps/qgis.app/Contents/MacOS/lib/qgis";
#elif defined(Q_WS_WIN)
  QString pluginPath = "c:\\hfp\\qgis\plugins";
  QString prefixPath = "c:\\hfp\\qgis";
#else
  QString pluginPath = "/usr/local/lib/qgis/plugins/";
  QString prefixPath = "/usr/local";
#endif

  QgsApplication::setPluginPath( pluginPath );
  QgsApplication::setPrefixPath( prefixPath, true);
  QgsApplication::initQgis();

  QSettings settings;
  settings.setValue( "/qgis/digitizing/marker_only_for_selected", true );

  // Central widget
  QWidget *centralWidget = this->centralWidget();
  QGridLayout *centralLayout = new QGridLayout( centralWidget );
  centralWidget->setLayout( centralLayout );
  centralLayout->setContentsMargins( 0, 0, 0, 0 );

  // Map canvas
  mMapCanvas = new QgsMapCanvas( centralWidget, "theMapCanvas" );
  mMapCanvas->setCanvasColor( QColor( 255, 255, 255 ) );
  mMapCanvas->setWheelAction( QgsMapCanvas::WheelZoomToMouseCursor, 2 );
  centralLayout->addWidget( mMapCanvas, 0, 0, 2, 1 );
  connect( mMapCanvas, SIGNAL( mapToolSet( QgsMapTool *, QgsMapTool * ) ),
           this, SLOT( mapToolChanged( QgsMapTool *, QgsMapTool * ) ) );

  // Message bar
  mInfoBar = new QgsMessageBar( centralWidget );
  mInfoBar->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
  centralLayout->addWidget( mInfoBar, 0, 0, 1, 1 );

  // Map manager
  mMapManager = new HlpMapManager( this );
  connect( ui->mActionMapManager, SIGNAL(toggled(bool)), mMapManager, SLOT( setVisible( bool )) );
  connect( mMapManager->toggleViewAction(), SIGNAL(toggled(bool)), ui->mActionMapManager, SLOT( setChecked( bool ) ) );
  addDockWidget( Qt::LeftDockWidgetArea, mMapManager );

  // create map layer registry if doesn't exist
  QgsMapLayerRegistry::instance();

  // CRS
  mMapCanvas->setCrsTransformEnabled( true );
  mMapCanvas->setDestinationCrs( HlpProject::instance()->epsg() );
  mMapCanvas->refresh();

  QgsMapToPixel test = mMapCanvas->mapSettings().mapToPixel();

  // add the layers
  QMap<QString, QgsMapLayer*> layerList = HlpProject::instance()->createLayers();
  if ( layerList.isEmpty() )
  {
    // TODO: what?
    return;
  }
  mFlightlineLayer = dynamic_cast<QgsVectorLayer*>( layerList.value("flightline") );
  mProfileLayer = dynamic_cast<QgsVectorLayer*>( layerList.value("profile") );
  mWaypointLayer = dynamic_cast<QgsVectorLayer*>( layerList.value("waypoint") );
  mFlightlineLayer->startEditing();
  mProfileLayer->startEditing();
  mWaypointLayer->startEditing();

  // layers registries
  connect( HlpMapRegistry::instance(), SIGNAL(layersChanged(bool)), this, SLOT(setLayerSet(bool)) );

  // Map tools
  mPanTool = new QgsMapToolPan( mMapCanvas );
  connect( ui->mActionPan, SIGNAL(triggered()), this, SLOT(panMode()));
  mPanTool->setAction(ui->mActionPan);
  mAddProfileTool = new HlpAddProfile( mMapCanvas, mProfileLayer );
  connect( ui->mActionAddProfile, SIGNAL( triggered() ), this, SLOT( addProfile() ) );
  mAddProfileTool->setAction(ui->mActionAddProfile);

  // Other actions
  connect( ui->mActionZoomIn, SIGNAL(triggered()), this, SLOT(zoomIn()) );
  connect( ui->mActionZoomOut, SIGNAL(triggered()), this, SLOT(zoomOut()) );

}
Example #29
0
// Main window constructor
BairesWindow::BairesWindow()
{
    ui.setupUi(this);

    if (!QSqlDatabase::drivers().contains("QSQLITE"))
        QMessageBox::critical(this, "Unable to load database", "This demo needs the SQLITE driver");

    // Initialize the database
    db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName(":memory:");

    if (!db.open())
        return;

    QStringList tables = db.tables();
    if (tables.contains("profiles", Qt::CaseInsensitive))
        return;

    QSqlQuery q;
	// Create profiles table
    if (!q.exec(QLatin1String("create table profiles(id integer primary key, "
                              "linkedin_profile text, "
                              "name text, "
                              "last_name text, "
                              "title text, "
                              "geographic_area text, "
                              "recommendations_count integer, "
                              "connections_count integer, "
                              "current_role text, "
                              "industry text, "
                              "country text "
                              ")"))) {
        return;
    }

	// Prepare insert query
    if (!q.prepare(QLatin1String("insert into profiles("
                                 "linkedin_profile, "
                                 "name, "
                                 "last_name, "
                                 "title, "
                                 "geographic_area, "
                                 "recommendations_count, "
                                 "connections_count, "
                                 "current_role, "
                                 "industry, "
                                 "country"
                                 ")"
                                 "values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"))) {
        return;
    }   

	// Begin to read data from text file
    QFile inputFile(":/PeopleToRate.txt");
    if (inputFile.open(QIODevice::ReadOnly))
    {
        QTextStream in(&inputFile);
        
        while (!in.atEnd())
        {
            QString line = in.readLine();
            QVector<QString> sequence;
            parseLineFields(line, sequence);
        
            // 0 PublicProfileURL
            // 1 Name
            // 2 LastName
            // 3 Title            
            // 4 GeographicArea            
            // 5 NumberOfRecommendations
            // 6 NumberOfConnections
            // 7 CurrentRole and Industry            
            // 8 Industry            
            // 9 Country            

			// Add register to database
            addProfile(q,
                        sequence.at(0),
                        sequence.at(1),
                        sequence.at(2),
                        sequence.at(3),
                        sequence.at(4),
                        sequence.at(5).toInt(),
                        sequence.at(6).toInt(),
                        sequence.at(7),
                        sequence.at(8),
                        sequence.at(9));
        }        
    }    

	// Query main industries
    QSqlQuery query(db);	
    query.exec("select distinct industry, count(industry) from profiles group by industry order by count(industry) desc");

	// Populate combobox
    while (query.next()) {
        QString name = query.value(0).toString();
        industryList << name;
    }

    ui.filterByCombo->addItems(industryList);

	// Ugly part, just hidding test components used for development of queries
    ui.executeQueryButton->setVisible(false);
    ui.groupBox_2->setVisible(false);
    ui.customersTable->setVisible(false);
}
OptionsDialog::OptionsDialog(Juicer* juicer) : QDialog(juicer) {
    setupUi(this);
    this->juicer = juicer;
#ifndef Q_WS_WIN
    handlerGroupBox->setHidden(true);
#endif
    IconWidget* l = new IconWidget(":/options/core.png", tr("Core"), tr("Core Settings"), QBoxLayout::TopToBottom, listWidget);
    QListWidgetItem* item = new QListWidgetItem(listWidget);
    item->setSizeHint(l->size());
    listWidget->setItemWidget(item, l);

    l = new IconWidget(":/options/limits.png", tr("Limits"), tr("Limitations"), QBoxLayout::TopToBottom, listWidget);
    item = new QListWidgetItem(listWidget);
    item->setSizeHint(l->size());
    listWidget->setItemWidget(item, l);

    l = new IconWidget(":/options/appearance.png", tr("Appearance"), tr("Appearance of the GUI"), QBoxLayout::TopToBottom, listWidget);
    item = new QListWidgetItem(listWidget);
    item->setSizeHint(l->size());
    listWidget->setItemWidget(item, l);

    l = new IconWidget(":/options/behaviour.png", tr("Behaviour"), tr("Behaviour of the GUI"), QBoxLayout::TopToBottom, listWidget);
    item = new QListWidgetItem(listWidget);
    item->setSizeHint(l->size());
    listWidget->setItemWidget(item, l);

    l = new IconWidget(":/options/search.png", tr("Search"), tr("Search Settings"), QBoxLayout::TopToBottom, listWidget);
    item = new QListWidgetItem(listWidget);
    item->setSizeHint(l->size());
    listWidget->setItemWidget(item, l);

    l = new IconWidget(":/options/launching.png", tr("Launching"), tr("Opening of Files"), QBoxLayout::TopToBottom, listWidget);
    item = new QListWidgetItem(listWidget);
    item->setSizeHint(l->size());
    listWidget->setItemWidget(item, l);

    l = new IconWidget(":/options/ftp.png", tr("FTP"), tr("FTP Settings"), QBoxLayout::TopToBottom, listWidget);
    item = new QListWidgetItem(listWidget);
    item->setSizeHint(l->size());
    listWidget->setItemWidget(item, l);

    l = new IconWidget(":/options/reset.png", tr("Reset"), tr("Configuration Reset"), QBoxLayout::TopToBottom, listWidget);
    item = new QListWidgetItem(listWidget);
    item->setSizeHint(l->size());
    listWidget->setItemWidget(item, l);

    languageComboBox->addItem(QIcon(":/options/de.png"), "deutsch", "de");
    languageComboBox->addItem(QIcon(":/options/gb.png"), "english", "en");

    launchCombo->addItem(DEFAULT_LAUNCHER);
    if(DEFAULT_LAUNCHER == KDE_LAUNCHER)
        launchCombo->addItem(GNOME_LAUNCHER);

    specificRadioToggled(false);

    connect(incomingButton, SIGNAL(clicked()), this, SLOT(selectIncomingDir()));
    connect(tempButton, SIGNAL(clicked()), this, SLOT(selectTempDir()));
    connect(launcherButton, SIGNAL(clicked()), this, SLOT(selectLauncher()));
    connect(incomingSpecificButton, SIGNAL(clicked()), this, SLOT(selectIncomingDirSpecific()));
    connect(tempSpecificButton, SIGNAL(clicked()), this, SLOT(selectTempDirSpecific()));
    connect(specificRadio, SIGNAL(toggled(bool)), this, SLOT(specificRadioToggled(bool)));
    connect(listWidget, SIGNAL(currentRowChanged(int)), stackedWidget , SLOT(setCurrentIndex(int)));
    connect(jumpFtpButton, SIGNAL(clicked()), this , SLOT(jumpToFtpSlot()));
    connect(fontComboBox, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(setFontSizes(const QFont&)));
    connect(this, SIGNAL(accepted()), this, SLOT(acceptedSlot()));
    connect(resetPushButton, SIGNAL(clicked()), this, SLOT(reset()));

    connect(profilesList, SIGNAL(itemSelectionChanged()), this, SLOT(profileSelectionChanged()));
    connect(addProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
    connect(changeProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
    connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));

    profileChangeActive = true;
    profileChanged = false;
    listWidget->setCurrentRow(0);

    connect(downSpin, SIGNAL(valueChanged(int)), this, SLOT(limitsChanged()));
    connect(upSpin, SIGNAL(valueChanged(int)), this, SLOT(limitsChanged()));
    connect(slotSpin, SIGNAL(valueChanged(int)), this, SLOT(limitsChanged()));
    connect(sourcesSpin, SIGNAL(valueChanged(int)), this, SLOT(limitsChanged()));
    connect(connectionsSpin, SIGNAL(valueChanged(int)), this, SLOT(limitsChanged()));
    connect(newSpin, SIGNAL(valueChanged(int)), this, SLOT(limitsChanged()));

}