Exemplo n.º 1
2
void MudGameView::onSelectProfile()
{
    Profile current(m_manager.getProfile());
    SelectProfileDlg dlg(current);
    if (dlg.DoModal() != IDOK)
        return;
    const ProfileData& profile = dlg.getProfile();
    if (!profile.create_new)
    {
        // load profile
        if (loadProfile(profile.profile) && profile.create_link)
            createLink(profile.profile);
        return;
    }
    if (!profile.copy_from_src)
    {
        if (!profile.create_empty)
        {
            // new profile from resources
            Profile src; src.group = profile.profile.group; src.name = L"player";
            if (copyProfile(true, profile.profile, src) && profile.create_link)
                createLink(profile.profile);
            return;
        }
        // new empty profile
        if (newProfile(profile.profile) && profile.create_link)
            createLink(profile.profile);
        return;
    }
    // new profile and copy from src profile
    if (copyProfile(false, profile.profile, profile.src) && profile.create_link)
        createLink(profile.profile);
}
Exemplo n.º 2
0
void ProfileLoader::loadProfiles( const std::string& avProfilesPath )
{
	std::string realAvProfilesPath = avProfilesPath;
	if( realAvProfilesPath.empty() )
	{
		// get custom profiles location from AVPROFILES environment variable
		if( std::getenv( "AVPROFILES" ) )
			realAvProfilesPath = std::getenv( "AVPROFILES" );
		// else get default profiles location
		else
			realAvProfilesPath = AVTRANSCODER_DEFAULT_AVPROFILES;
	}

	std::vector< std::string > paths;
	split( paths, realAvProfilesPath, ":" );
	for( std::vector< std::string >::iterator dirIt = paths.begin(); dirIt != paths.end(); ++dirIt )
	{
		std::vector< std::string > files;
		if( getFilesInDir( *dirIt, files ) != 0 )
			continue;

		for( std::vector< std::string >::iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt )
		{
			const std::string absPath = ( *dirIt ) + "/" + ( *fileIt );
			try
			{
				loadProfile( absPath );
			}
			catch( const std::exception& e )
			{
				LOG_WARN( e.what() )
			}
		}
	}
}
Exemplo n.º 3
0
void qSRA::getActions(QActionGroup& group)
{
	//actions
	if (!m_doLoadProfile)
	{
		m_doLoadProfile = new QAction("Load profile",this);
		m_doLoadProfile->setToolTip("Loads the 2D profile of a Surface of Revolution (from a dedicated ASCII file)");
		m_doLoadProfile->setIcon(QIcon(QString::fromUtf8(":/CC/plugin/qSRA/loadProfileIcon.png")));
		//connect signal
		connect(m_doLoadProfile, SIGNAL(triggered()), this, SLOT(loadProfile()));
	}
	group.addAction(m_doLoadProfile);

	if (!m_doCompareCloudToProfile)
	{
		m_doCompareCloudToProfile = new QAction("Cloud-SurfRev radial distance",this);
		m_doCompareCloudToProfile->setToolTip("Computes the radial distances between a cloud and a Surface of Revolution (polyline/profile, cone or cylinder)");
		m_doCompareCloudToProfile->setIcon(QIcon(QString::fromUtf8(":/CC/plugin/qSRA/distToProfileIcon.png")));
		//connect signal
		connect(m_doCompareCloudToProfile, SIGNAL(triggered()), this, SLOT(computeCloud2ProfileRadialDist()));
	}
	group.addAction(m_doCompareCloudToProfile);

	if (!m_doProjectCloudDists)
	{
		m_doProjectCloudDists = new QAction("2D distance map",this);
		m_doProjectCloudDists->setToolTip("Creates the 2D deviation map (radial distances) from a Surface or Revolution (unroll)");
		m_doProjectCloudDists->setIcon(QIcon(QString::fromUtf8(":/CC/plugin/qSRA/createMapIcon.png")));
		//connect signal
		connect(m_doProjectCloudDists, SIGNAL(triggered()), this, SLOT(projectCloudDistsInGrid()));
	}
	group.addAction(m_doProjectCloudDists);
}
Exemplo n.º 4
0
/** Load and parse the default user/system profile.
 *
 * Load default profile in the following order:
 * - ~/.presage.xml
 * - sysconfdir/presage.xml
 *
 * If no profile is found, a default profile is built and used.
 *
 * @return true if profile is found and successfully loaded, false
 * otherwise.
 *
 */
bool ProfileManager::loadDefaultProfile()
{
    const int PROFILE_SEARCH_PATH_SIZE = 2;
    std::string profile_search_path[PROFILE_SEARCH_PATH_SIZE] = {
        // home dir dotfile
        get_user_home_dir() + '/' + '.' + DEFAULT_PROFILE_FILENAME,
        // installation config directory
	static_cast<std::string>(sysconfdir) + '/' + DEFAULT_PROFILE_FILENAME
    };

    bool readOk = false;

    // try looking for profilename in profile dirs
    int i = 0;
    while(!readOk && i < PROFILE_SEARCH_PATH_SIZE) {
        readOk = loadProfile(profile_search_path[i]);
        i++;
    }

    if (!readOk) {
        // handle failure to load profile
	// highest loglevel, no need to cache this
        logger << ERROR << "No profiles were found. Using default parameters." << endl;
        buildProfile();
    }

    return readOk;
}
Exemplo n.º 5
0
void Settings::checkCommandLineOptions(int argc, char *argv[])
{
	// check if --help occurs, overrides the rest
	for (int i=1; i < argc; ++i )
	{
		std::string sw = argv[i];
		if ( sw == "--help" )
		{
			createHelpInfo();
			std::cout << helpinfo.str() << std::endl;
			exit(0);
		}
	}

	// decode arguments
	int optind=1;
	while ((optind < argc)) //  && (argv[optind][0]=='-')
	{
		if ( argv[optind][0]=='-' )
		{
			std::string sw = argv[optind];

			if ( sw=="--profile" )
			{
				if ( argv[++optind] )
					loadProfile(argv[optind]);
				else
					BE_ERROR("::SETTINGS --profile expects a filename");
			}

			else
			{
				parseH.reset();
				if ( parseH.beginMatchesStrip( "--", sw ) )
				{
					sw.append(" ");
					std::string purecmd = parseH.returnUntillStrip( ' ', sw );

					if ( isCVar(purecmd) )
					{
						if ( argv[++optind] )
						{
							if ( !setCVar(purecmd, argv[optind]) )
								BE_ERROR("::SETTINGS error: could not set cvar '" << purecmd << "', value '" << argv[optind] << "'");
						}
						else
							BE_ERROR("::SETTINGS error: option '" << purecmd << "' expects an argument");
					}
					else
						BE_LOG( "warning: unknown commandline option: '" << purecmd << "'" );
				}
			}
		}
		++optind;
	}
 
	if ( optind < argc )
		BE_LOG( "warning: unknown commandline option: '" << argv[optind] << "'" );
}
Exemplo n.º 6
0
void UserProfile::SetUserID(const QString& id)
{
    if (m_UserId != id) {
        m_UserId = id;
        loadProfile(true);
        emit userIdChanged();
    }
}
Exemplo n.º 7
0
/** Constructor.
 *
 * Initialises other modules.
 *
 */
ProfileManager::ProfileManager(const std::string profilename)
    : logger("ProfileManager", std::cerr)
{
    xmlProfileDoc = 0;
    if (profilename.empty()) {
        loadDefaultProfile();
    } else {
        loadProfile(profilename);
    }
}
Exemplo n.º 8
0
TEST(ProfileDao, load){
    auto connection = loadConnection();
    auto profileDao = connection->profileDao();
    mm::Profile newProfile;
    std::string testName = "Nome Teste Load";
    newProfile.setName(testName);
    profileDao->saveProfile(newProfile);

    mm::Profile loadedProfile;
    loadedProfile.setId(newProfile.id());
    bool loaded = profileDao->loadProfile(loadedProfile);
    EXPECT_TRUE(loaded);
    EXPECT_EQ(newProfile.name(), loadedProfile.name());

    bool removed = profileDao->removeProfile(newProfile);
    EXPECT_TRUE(removed);

    loaded = profileDao->loadProfile(loadedProfile);
    EXPECT_FALSE(loaded);
}
Exemplo n.º 9
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    //Init
    isSqlSetted = false;

    //status tips
    ui->actionDataBase_Info->setStatusTip(tr("Set Database Info."));
    ui->actionLogin->setStatusTip(tr("Get Login Dialog."));
    ui->actionExit->setStatusTip(tr("Exit the Window."));
    ui->actionLogout->setStatusTip(tr("Logout the account."));

    //signals and slots
    connect(ui->actionDataBase_Info, SIGNAL(triggered()), this, SLOT(getDBInfo()));
    connect(ui->actionLogin, SIGNAL(triggered()), this, SLOT(login()));
    connect(ui->actionLogout, SIGNAL(triggered()), this, SLOT(reset()));

    connect(ui->infoWidget, SIGNAL(loadProfile()), this, SLOT(loadProfile()));
    connect(ui->infoWidget, SIGNAL(loadScore()), this, SLOT(loadScore()));
    connect(ui->infoWidget, SIGNAL(loadCurriculumSchedule()), this, SLOT(loadCurriculumSchedule()));
    connect(ui->infoWidget, SIGNAL(loadElective()), this, SLOT(loadElective()));
    connect(ui->infoWidget, SIGNAL(loadPlan()), this, SLOT(loadPlan()));
    connect(ui->infoWidget, SIGNAL(loadRecord()), this, SLOT(loadRecord()));
    connect(ui->infoWidget, SIGNAL(chgPwd()), this, SLOT(changePwd()));

//    dbInfo.hostName = "localhost";
//    dbInfo.DBName = "Handin";
//    dbInfo.userName = "******";
//    dbInfo.password = "******";

    //login();

}
Exemplo n.º 10
0
BOOL    sessSetup(HAB hab)
{
    ULONG   ret ;

    initialSetup = TRUE ;

    loadProfile(hab) ;

    ret = WinDlgBox(HWND_DESKTOP, HWND_DESKTOP,
                procSess, NULLHANDLE, IDD_SESS, NULL) ;

    if (ret == DID_OK) {
        saveProfile(hab) ;
    }
    return (ret == DID_OK) ? TRUE : FALSE ;
}
Exemplo n.º 11
0
void TagParser::createTag(string tags){
#if (_DEBUG)
    cout<<"[createTag] tag_type = "<<mTagType<<", tag="<<tags<<endl;
#endif
    if(mTagType == TAG_TAG){
        if(tags.find(DELIM_COMMA) != string::npos){
            Utility::StrParser2Vector(tags,DELIM_COMMA,mTagVector);
            cout<<"mTagVector size = "<<mTagVector.size()<<endl;
        }
        else{
            mTag = tags;
        }
    }
    else if(mTagType == TAG_TAG_PROFILE){
        loadProfile(tags);
    }
}
Exemplo n.º 12
0
void MainForm::reloadProfiles()
{
	QString profileName = lineName->text();
	QStringList profiles = getProfileList();
	int index;
	
	listProfiles->clear();
	listProfiles->addItems(profiles);
	
	index = profiles.indexOf(profileName);
	if(index != -1)
	{
		listProfiles->setCurrentRow(index);
		loadProfile();
	}
	else
		newProfile();
}
Exemplo n.º 13
0
void Profile::loadDefaultProfile() {

  QString defaultName = "default.json";

  // Check if default profile exists on disk
  QFile file(defaultName);

  if(file.exists()) {
    loadProfile(defaultName, false);
    return;
  }

  // Default profile does not exist, we need to create one
  profileName = "Default lead free";

//  dataPoints.append(DataPoint(0,25));      // Starting temp
//  dataPoints.append(DataPoint(90,150));    // Pre Heat
//  dataPoints.append(DataPoint(180,217));   // End of soak
//  dataPoints.append(DataPoint(225,245));   // Peak temp
//  dataPoints.append(DataPoint(270,217));   // End of reflow zone
//  dataPoints.append(DataPoint(337.5,25));  // End of profile

  dataPoints.append(DataPoint(0,25));      // Starting temp
  dataPoints.append(DataPoint(90,150));    // Pre Heat
  dataPoints.append(DataPoint(112.5,200)); // End of soak
  dataPoints.append(DataPoint(121.4,217)); // Ramp to 217


  dataPoints.append(DataPoint(159.4,255)); // Ramp to 255
  dataPoints.append(DataPoint(166.6,260)); // Peak
  dataPoints.append(DataPoint(178.6,260)); // End of peak
  dataPoints.append(DataPoint(185.8,255)); // Ramp down to 255


  dataPoints.append(DataPoint(205,217));   // End of reflow zone
  dataPoints.append(DataPoint(234.1,150)); // End of profile
  dataPoints.append(DataPoint(290,25));    // Cool down

  // Save the new default profiel
  saveProfile(defaultName);
}
Exemplo n.º 14
0
rpnoc::Profile::Profile( QWidget *parent) 
	: QDialog( parent )
{
	buttonLoadProfile = new QPushButton( "Load" );
	buttonNewProfile = new QPushButton( "New" );
	buttonDeleteProfile = new QPushButton( "Delete" );
	buttonCancel = new QPushButton( "Cancel" );
	buttonSwitchUser = new QPushButton( "Change User" );

	model = new QStringListModel( this );

	listView = new QListView;
	listView->setModel( model );
	listView->setEditTriggers( QAbstractItemView::NoEditTriggers );

	connect( buttonLoadProfile, SIGNAL( clicked() ), this, SLOT( loadProfile() ) );
	connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( slotCancel() ) );
	connect( buttonNewProfile, SIGNAL( clicked() ), this, SLOT( newProfile() ) );
	connect( buttonSwitchUser, SIGNAL( clicked() ), this, SLOT( changeUser() ) );
	connect( buttonDeleteProfile, SIGNAL( clicked() ), this, SLOT( deleteProfile() ) );

	QVBoxLayout* buttonLayoutOne = new QVBoxLayout;
	buttonLayoutOne->addWidget( buttonLoadProfile );
	buttonLayoutOne->addWidget( buttonNewProfile );
	buttonLayoutOne->addWidget( buttonDeleteProfile );
	buttonLayoutOne->addStretch();
	buttonLayoutOne->addWidget( buttonSwitchUser );
	buttonLayoutOne->addStretch();
	buttonLayoutOne->addWidget( buttonCancel );

	QVBoxLayout* listLayout = new QVBoxLayout;
	listLayout->addWidget( listView );

	QHBoxLayout* mainLayout = new QHBoxLayout;
	mainLayout->addLayout( buttonLayoutOne );
	mainLayout->addLayout( listLayout );

	setLayout( mainLayout );
	setWindowTitle( "Profiles" );
}
Exemplo n.º 15
0
void Program::run() {

    loadProfile();
}
void KarbonCalligraphyOptionWidget::createConnections()
{
    connect(m_comboBox, SIGNAL(currentIndexChanged(QString)),
            SLOT(loadProfile(QString)));


    // propagate changes
    connect(m_usePath, SIGNAL(toggled(bool)),
            SIGNAL(usePathChanged(bool)));

    connect(m_usePressure, SIGNAL(toggled(bool)),
            SIGNAL(usePressureChanged(bool)));

    connect(m_useAngle, SIGNAL(toggled(bool)),
            SIGNAL(useAngleChanged(bool)));

    connect(m_widthBox, SIGNAL(valueChanged(double)),
            SIGNAL(widthChanged(double)));

    connect(m_thinningBox, SIGNAL(valueChanged(double)),
            SIGNAL(thinningChanged(double)));

    connect(m_angleBox, SIGNAL(valueChanged(int)),
            SIGNAL(angleChanged(int)));

    connect(m_fixationBox, SIGNAL(valueChanged(double)),
            SIGNAL(fixationChanged(double)));

    connect(m_capsBox, SIGNAL(valueChanged(double)),
            SIGNAL(capsChanged(double)));

    connect(m_massBox, SIGNAL(valueChanged(double)),
            SIGNAL(massChanged(double)));

    connect(m_dragBox, SIGNAL(valueChanged(double)),
            SIGNAL(dragChanged(double)));


    // update profile
    connect(m_usePath, SIGNAL(toggled(bool)),
            SLOT(updateCurrentProfile()));

    connect(m_usePressure, SIGNAL(toggled(bool)),
            SLOT(updateCurrentProfile()));

    connect(m_useAngle, SIGNAL(toggled(bool)),
            SLOT(updateCurrentProfile()));

    connect(m_widthBox, SIGNAL(valueChanged(double)),
            SLOT(updateCurrentProfile()));

    connect(m_thinningBox, SIGNAL(valueChanged(double)),
            SLOT(updateCurrentProfile()));

    connect(m_angleBox, SIGNAL(valueChanged(int)),
            SLOT(updateCurrentProfile()));

    connect(m_fixationBox, SIGNAL(valueChanged(double)),
            SLOT(updateCurrentProfile()));

    connect(m_capsBox, SIGNAL(valueChanged(double)),
            SLOT(updateCurrentProfile()));

    connect(m_massBox, SIGNAL(valueChanged(double)),
            SLOT(updateCurrentProfile()));

    connect(m_dragBox, SIGNAL(valueChanged(double)),
            SLOT(updateCurrentProfile()));


    connect(m_saveButton, SIGNAL(clicked()), SLOT(saveProfileAs()));
    connect(m_removeButton, SIGNAL(clicked()), SLOT(removeProfile()));

    // visualization
    connect(m_useAngle, SIGNAL(toggled(bool)), SLOT(toggleUseAngle(bool)));
}
Exemplo n.º 17
0
void ProfileScene::drawWithoutDeleteOldProfile() {
    loadProfile(false);
}
Exemplo n.º 18
0
void ProfileScene::newProfileSelected() {
    isProfileSelected = true;
    loadProfile(true);
}
Exemplo n.º 19
0
void DistanceFilter::setString(string key, string value)
{
    if(key == "profile")
        loadProfile(value);
}
Exemplo n.º 20
0
/* returns TRUE if a user profile was loaded; otherwise, FALSE.*/
BOOL
OwnerProfile::load () {
    
    dprintf ( D_FULLDEBUG, "In OwnerProfile::load()\n" );

    HANDLE          have_access         = INVALID_HANDLE_VALUE;
    DWORD           last_error          = 0,
                    length              = 0,
                    i                   = 0;
    priv_state      priv                = PRIV_UNKNOWN;
    BOOL            backup_created      = FALSE,
                    profile_loaded      = FALSE,
                    profile_exists      = FALSE,
                    profile_destroyed   = FALSE,
                    ok                  = FALSE;

    __try {

        /* short-cut if we've already loaded the profile */
        if ( loaded () ) {
            ok = TRUE;
            __leave;
        }

        /* we must do the following as Condor */
        priv = set_condor_priv ();
        
        /* get the user's local profile directory (if this user 
        has a roaming profile, this is when it's cached locally) */
        profile_directory_ = directory ();

        /* if we have have a profile directory, let's make sure that 
        we also have permissions to it.  Sometimes, if the startd were
        to crash, heaven forbid, we may have access to the profile 
        directory, but it may still be locked by the previous login 
        session that was not cleaned up properly (the only resource
        I know of that the system does not clean up immediately on 
        process termination are user login handles and their 
        resources). */
        if ( profile_directory_ ) {

            dprintf ( 
                D_FULLDEBUG, 
                "OwnerProfile::load: %s's profile directory: '%s'. "
                "(last-error = %u)\n",
                user_name_,
                profile_directory_, 
                GetLastError () );
            
            dprintf ( 
                D_FULLDEBUG, 
                "OwnerProfile::load: A profile directory is listed "
                "but may not exist.\n" );

            have_access = CreateFile ( 
                profile_directory_, 
                GENERIC_WRITE, 
                0,                          /* magic # for NOT shared */
                NULL, 
                OPEN_EXISTING, 
                FILE_FLAG_BACKUP_SEMANTICS, /* only take a peek */
                NULL );

            if ( INVALID_HANDLE_VALUE == have_access ) {

                last_error = GetLastError ();

                dprintf ( 
                    D_FULLDEBUG, 
                    "OwnerProfile::load: Failed to access '%s'. "
                    "(last-error = %u)\n",
                    profile_directory_,
                    last_error );

                if (   ERROR_ACCESS_DENIED     == last_error 
                    || ERROR_SHARING_VIOLATION == last_error ) {

                    /**************************************************
                    NOTE: For future implementations which allow for
                    any user to load their profile, what follows
                    bellow is known as a BAD IDEA. We'd prefer to keep
                    all the data, or FAIL! :)
                    **************************************************/

                    /* so we don't have access, lets just blow it away
                    and create a new one (see bellow) */
                    profile_destroyed = destroy ();

                    dprintf ( 
                        D_FULLDEBUG, 
                        "OwnerProfile::load: Destruction of %s's "
                        "profile %s. (last-error = %u)\n",
                        user_name_,
                        profile_destroyed ? "succeeded" : "failed", 
                        profile_destroyed ? 0 : GetLastError () );

                    if ( !profile_destroyed ) {
                        __leave;
                    }

                }

            }

            /* if we're here, then we can access the profile */
            profile_exists = TRUE;

        }

        /* explicitly create the profile */
        if ( !profile_exists ) {

            dprintf ( 
                D_FULLDEBUG, 
                "OwnerProfile::load: Profile directory does not "
                "exist, so we're going to create one.\n" );

            /* we now create the profile, so we can backup it 
            up directly */
            profile_exists = create ();

            dprintf ( 
                D_FULLDEBUG, 
                "OwnerProfile::load: Creation of profile for %s %s. "
                "(last-error = %u)\n",
                user_name_,
                profile_exists ? "succeeded" : "failed", 
                profile_exists ? 0 : GetLastError () );

            /* if the profile still does not exist, then bail */
            if ( !profile_exists ) {
                __leave;
            }

        } 

#if 0
        /* now we transfer the user's profile directory to the cache 
        so that we can revert back to it once the user is done doing 
        their thang. */
        backup_created = backup ();

        dprintf ( 
            D_FULLDEBUG, 
            "OwnerProfile::load: Creating a backup of %s's "
            "profile %s.\n",
            user_name_,
            backup_created ? "succeeded" : "failed" );

        /* if we were unable to create the backup, we should bail out
        before we allow the user to make changes to the template 
        profile */
        if ( !backup_created ) {
            __leave;
        }
#endif

        /* finally, load the user's profile */
        profile_loaded = loadProfile ();

        if ( !profile_loaded ) {            
            __leave;
        }
        
        /* make sure to change state with regards to being loaded */
        profile_loaded_ = TRUE;

        /* everything went as expected */        
        ok = TRUE;

    }
    __finally {

        /* free the attributes, if required */
        if ( !ok && profile_directory_ ) {
            delete [] profile_directory_;
            profile_directory_ = NULL;
        }
        
        /* if we loaded the profile, but failed for some other reason,
        then we should make sure to unload the profile */            
        if ( !ok && profile_loaded ) {
            unloadProfile ();            
        }

        /* return to previous privilege level */
        set_priv ( priv );

    }

    return ok;
    
}
Exemplo n.º 21
0
/* returns TRUE if a user profile was created; otherwise, FALSE.
NOTE: We do not call load() here as we call create() from there,
which would be a rather silly loop to be caught it. */
BOOL
OwnerProfile::create () {

    dprintf ( D_FULLDEBUG, "In OwnerProfile::create()\n" );

    priv_state  priv                = PRIV_UNKNOWN;
    int         length              = 0;
    BOOL        profile_loaded      = FALSE,
                profile_unloaded    = FALSE,
                profile_deleted     = FALSE,
                ok                  = FALSE;    

    __try {

        /* Do the following as condor, since we can't do it as the 
        user, as we are creating the profile for the first time, and 
        we need administrative rights to do this (which, presumably,
        the "owner" of this profile does not have) */
        priv = set_condor_priv ();

        /* Creating a profile is quite straight forward: simply try to 
        load it. Windows will realize that there isn't one stashed away
        for the user, so it will creat one for us.  We can then simply
        unload it, since we will be making a copy of the unmodified
        version of it up at a later point, so that jobs will always
        run with a clean profile, also thereby eliminating any possible
        cross job security issues (i.e. writting missleading data to 
        well known registry entries, etc.) */

        /* load the user's profile for the first time-- this will 
        effectively create it "for free", using the local "default"
        account as a template (for various versions of "default", 
        each Windows flavour has it's own naming scheme). */
        profile_loaded = loadProfile ();

        if ( !profile_loaded ) {            
            __leave;
        }

        /* now simply unload the profile */
        profile_unloaded = unloadProfile ();
      
        if ( !profile_unloaded ) {            
            __leave;
        }

        /* retrieve the profile's directory */
        profile_directory_ = directory ();

        if ( !profile_directory_ ) {            
            __leave;
        }

        /* if we're here, then the profile it ready to be used */
        ok = TRUE;

    }
    __finally {

        if ( !ok && ( profile_loaded && !profile_unloaded ) ) {
            unloadProfile ();
        }

        if ( !ok && profile_directory_ ) {
            delete [] profile_directory_;
            profile_directory_ = NULL;
        }

        /* return to previous privilege level */
        set_priv ( priv );

    }

    return ok;

}
Exemplo n.º 22
0
        // Force the addition of already existent batteries
        foreach (const Device &device, Device::listFromType(DeviceInterface::Battery, QString())) {
            onDeviceAdded(device.udi());
        }
    }

    connect(m_backend, SIGNAL(acAdapterStateChanged(PowerDevil::BackendInterface::AcAdapterState)),
            this, SLOT(onAcAdapterStateChanged(PowerDevil::BackendInterface::AcAdapterState)));
    connect(m_backend, SIGNAL(batteryRemainingTimeChanged(qulonglong)),
            this, SLOT(onBatteryRemainingTimeChanged(qulonglong)));
    connect(KIdleTime::instance(), SIGNAL(timeoutReached(int,int)),
            this, SLOT(onKIdleTimeoutReached(int,int)));
    connect(KIdleTime::instance(), SIGNAL(resumingFromIdle()),
            this, SLOT(onResumingFromIdle()));
    connect(m_activityConsumer, SIGNAL(currentActivityChanged(QString)),
            this, SLOT(loadProfile()));

    // Set up the policy agent
    PowerDevil::PolicyAgent::instance()->init();

    // Initialize the action pool, which will also load the needed startup actions.
    PowerDevil::ActionPool::instance()->init(this);

    // Set up the critical battery timer
    m_criticalBatteryTimer->setSingleShot(true);
    m_criticalBatteryTimer->setInterval(30000);
    connect(m_criticalBatteryTimer, SIGNAL(timeout()), this, SLOT(onCriticalBatteryTimerExpired()));

    // In 30 seconds (so we are sure the user sees eventual notifications), check the battery state
    QTimer::singleShot(30000, this, SLOT(checkBatteryStatus()));
Exemplo n.º 23
0
MainForm::MainForm()
{
	setupUi(this);
	
	connect(checkKeymap, SIGNAL(stateChanged(int)), this, SLOT(updateByCheckbox(int)));
	connect(checkXConf, SIGNAL(stateChanged(int)), this, SLOT(updateByCheckbox(int)));
	connect(checkScreen, SIGNAL(stateChanged(int)), this, SLOT(updateByCheckbox(int)));
	connect(checkXinit, SIGNAL(stateChanged(int)), this, SLOT(updateByCheckbox(int)));
	connect(checkSync, SIGNAL(stateChanged(int)), this, SLOT(updateByCheckbox(int)));
	
	connect(radioRunType1, SIGNAL(clicked()), this, SLOT(switchedRunType()));
	connect(radioRunType2, SIGNAL(clicked()), this, SLOT(switchedRunType()));
	
	connect(comboGpuType, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(handleGpuChange(const QString&)));
	
	connect(toolXConf, SIGNAL(clicked()), this, SLOT(xconfPressed()));
	connect(pushLoad, SIGNAL(clicked()), this, SLOT(loadProfile()));
	connect(pushNew, SIGNAL(clicked()), this, SLOT(newProfile()));
	connect(pushSave, SIGNAL(clicked()), this, SLOT(saveProfile()));
	connect(pushDelete, SIGNAL(clicked()), this, SLOT(deleteProfile()));
	
	connect(listProfiles, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(loadProfile(QListWidgetItem*)));
	connect(pushAbout, SIGNAL(clicked()), this, SLOT(showAbout()));
	
	QStringList list;
	list << "GeForce, GeForce2, Quadro, Quadro2 Pro";
	list << "GeForce4 MX, GeForce4 4xx Go, Quadro4 380,550,580 XGL, Quadro4 NVS";
	list << "GeForce3, Quadro DCC, GeForce4 Ti, GeForce4 4200 Go, Quadro4 700,750,780,900,980 XGL";
	list << "GeForce FX, GeForce 6xxx, GeForce 7xxx, Quadro FX";
	list << "GeForce 8xxx, G8xGL";
	
	g_mapGPUCaps[list[0]] = QList<int>() << -1 << 0 << 3 << 4;
	g_mapGPUCaps[list[1]] = QList<int>() << -1 << 0 << 1 << 2 << 4;
	g_mapGPUCaps[list[2]] = QList<int>() << -1 << 0 << 1 << 2 << 4 << 5 << 6;
	g_mapGPUCaps[list[3]] = QList<int>() << -1 << 0 << 1 << 2 << 4 << 5 << 6 << 7 << 8;
	g_mapGPUCaps[list[4]] = QList<int>() << -1 << 0 << 1 << 4 << 7 << 9 << 10 << 11 << 12 << 13;
	
	comboGpuType->addItems(list);
	
	g_mapAATypes["<default>"] = -1;
	g_mapAATypes["Disabled"] = 0;
	g_mapAATypes["2x Bilinear Multisampling"] = 1;
	g_mapAATypes["2x Quincunx Multisampling"] = 2;
	g_mapAATypes["1.5 x 1.5 Supersampling"] = 3;
	g_mapAATypes["2 x 2 Supersampling / 4x Bilinear Multisampling"] = 4;
	g_mapAATypes["4x Gaussian Multisampling"] = 5;
	g_mapAATypes["2x Bilinear Multisampling by 4x Supersampling"] = 6;
	g_mapAATypes["4x Bilinear Multisampling by 4x Supersampling"] = 7;
	g_mapAATypes["4x Bilinear Multisampling by 2x Supersampling"] = 8;
	g_mapAATypes["8x Bilinear Multisampling"] = 9;
	g_mapAATypes["8x"] = 10;
	g_mapAATypes["16x"] = 11;
	g_mapAATypes["16xQ"] = 12;
	g_mapAATypes["8x Bilinear Multisampling by 4x Supersampling"] = 13;
	
	handleGpuChange(list[0]);
	list.clear();
	
	list << "<default>" << "Disabled" << "Enabled";
	
	comboVblank->addItems(list);
	comboDoom3->addItems(list);
	
	listProfiles->addItems(getProfileList());
	radioRunType1->setChecked(true);
	updateByCheckbox(0);
}
Exemplo n.º 24
0
Profile::Profile(const QString &name)
{
  loadProfile(name);
}