Ejemplo n.º 1
0
void Radio_Init()
{
        transmit_lock = 0;

        // disable radio during config
        RADIO_CE_LOW();

        // set CE and CSN
        RADIO_DDR |= _BV(RADIO_CE);
        RADIO_DDR |= _BV(RADIO_CSN);

        // Enable radio interrupt.
		// INT0 This interrupt is triggered when data are received and when a transmission completes.
        DDRE &= ~_BV(PORTD0);
        EICRB |= _BV(ISC01);
        EICRB &= ~_BV(ISC00);
        EIMSK |= _BV(INT0);

        // Configure the radio registers that are not application-dependent.
        _config();

        // Wait for the radio to power up.
        _delay_ms(2);

        // enable radio as a receiver
        RADIO_CE_HIGH();
}
Ejemplo n.º 2
0
void RecentDocuments::match(Plasma::RunnerContext &context)
{
    if (m_recentdocuments.isEmpty()) {
        return;
    }

    const QString term = context.query();
    if (term.length() < 3) {
        return;
    }

    foreach (const QString &document, m_recentdocuments) {
        if (!context.isValid()) {
            return;
        }

        if (document.contains(term, Qt::CaseInsensitive)) {
            KConfig _config( document, KConfig::SimpleConfig );
            KConfigGroup config(&_config, "Desktop Entry" );
            QString niceName =  config.readEntry( "Name" );
            Plasma::QueryMatch match(this);
            match.setType(Plasma::QueryMatch::PossibleMatch);
            match.setRelevance(1.0);
            match.setIcon(QIcon::fromTheme(config.readEntry("Icon")));
            match.setData(document); // TODO: Read URL[$e], or can we just pass the path to the .desktop file?
            match.setText(niceName);
            match.setSubtext(i18n("Recent Document"));
            context.addMatch(match);
        }
    }
}
Ejemplo n.º 3
0
void ConfigDialog::save()
{
  KConfig _config( "korganizerrc", KConfig::NoGlobals );
  KConfigGroup config( &_config, "Calendar/Datenums Plugin" );
  config.writeEntry( "ShowDayNumbers", mDayNumGroup->checkedId() );
  config.sync();
}
Ejemplo n.º 4
0
Datenums::Datenums()
    : mDisplayedInfo(DayOfYear | DaysRemaining)
{
    KConfig _config(QStringLiteral("korganizerrc"), KConfig::NoGlobals);
    KConfigGroup config(&_config, "Calendar/Datenums Plugin");
    mDisplayedInfo = (DayNumbers)config.readEntry(
                         "ShowDayNumbers", int(DayOfYear | DaysRemaining));
}
Ejemplo n.º 5
0
void radio_modulation(RADIO_MODULATION mod)
{
    if (mod == RADIO_MODULATION_OOK)
    {
        _config(config_OOK, CONFIG_OOK_COUNT);
        radio_data.modu = mod;
    }
    else if (mod == RADIO_MODULATION_FSK)
    {
        _config(config_FSK, CONFIG_FSK_COUNT);
        radio_data.modu = mod;
    }
    else //TODO: make this ASSERT()
    {
        TRACE_FAIL("Unknown modulation\n");
    }
}
Ejemplo n.º 6
0
void ConfigDialog::load()
{
  KConfig _config( "korganizerrc", KConfig::NoGlobals );
  KConfigGroup config( &_config, "Calendar/Datenums Plugin" );
  int datenum = config.readEntry(
    "ShowDayNumbers", int( Datenums::DayOfYear | Datenums::DaysRemaining ) );
  QAbstractButton *btn = mDayNumGroup->button( datenum );
  if ( !btn ) {
    btn = mDayNumGroup->button( int( Datenums::DayOfYear | Datenums::DaysRemaining ) );
  }
  btn->setChecked( true );
}
Ejemplo n.º 7
0
void AddresseeWidget::restoreSettings()
{
  KConfig _config( "kabcrc" );
  KConfigGroup config(&_config, "General" );

  mPrefix->setNameParts( config.readEntry( "Prefixes" , QStringList() ) );
  mInclusion->setNameParts( config.readEntry( "Inclusions" , QStringList() ) );
  mSuffix->setNameParts( config.readEntry( "Suffixes" , QStringList() ) );

  KConfig _cfg( "kaddressbookrc" );
  KConfigGroup cfg(&_cfg, "General" );
  mFormattedNameCombo->setCurrentIndex( cfg.readEntry( "FormattedNameType", 1 ) );
}
//! returns configuration of calibrated photometric stereo.
CPS::CpsConfig loadConfiguration(
    const std::string strFile
)
{
    CPS::CpsConfig cpsConfig;
    try
    {
        std::cout << "Load configuration from " << strFile << std::endl;
        std::auto_ptr<CalibratedPhotometricStereoType> _config(CalibratedPhotometricStereo(strFile));
        CalibratedPhotometricStereoType config( *_config );

        // loads directory name for outputs.
        cpsConfig.strDirOutput( config.DirectoryOutput() );
        // loads name of reflection model.
        cpsConfig.strReflection( config.ReflectanceModel() );

        // loads all observation information.
        ObservationType observationAll = config.Observation();
        // loads directory name for inputs.
        cpsConfig.strDirObservation( observationAll.DirectoryObservation() );
        // loads name of image mask.
        if( observationAll.ObservationMask() )
        {
            cpsConfig.strImageMask( cpsConfig.obsAll().strDirObservation() + observationAll.ObservationMask().get() );
        }
        // loads each observation information.
        ObservationType::ObservationSingle_sequence observationSingleSequence = observationAll.ObservationSingle();
        for(int n = 0; n < observationSingleSequence.size(); ++n)
        {
            // loads name of image, light source direction, and light source intensity.
            cpsConfig.addObservation(
                CPS::ObservationSingle(
                    cpsConfig.obsAll().strDirObservation() + observationSingleSequence[n].Image(),
                    observationSingleSequence[n].LightDirection(),
                    observationSingleSequence[n].LightIntensity()
                )
            );
        }
        // loads the number of color channels.
        cpsConfig.color( config.Observation().Color() );

        return cpsConfig;
    }
    catch (const xml_schema::exception& e)
    {
        std::cerr << e << std::endl;
    }

}
Ejemplo n.º 9
0
void AddresseeWidget::saveSettings()
{
  KConfig _config( "kabcrc" );
  KConfigGroup config(&_config, "General" );

  config.writeEntry( "Prefixes", mPrefix->nameParts() );
  config.writeEntry( "Inclusions", mInclusion->nameParts() );
  config.writeEntry( "Suffixes", mSuffix->nameParts() );

  KConfig _cfg( "kaddressbookrc" );
  KConfigGroup cfg(&_cfg, "General" );
  cfg.writeEntry( "FormattedNameType", mFormattedNameCombo->currentIndex() );

  QDBusMessage message = 
      QDBusMessage::createSignal( "/KABC", "org.kde.kabc.AddressBookConfig", 
                                  "changed" );
  QDBusConnection::sessionBus().send( message );
}
Ejemplo n.º 10
0
void KDMGeneralWidget::loadColorSchemes( KBackedComboBox *combo )
{
	// XXX: Global + local schemes
	QStringList list = KGlobal::dirs()->
		findAllResources( "data", "kdisplay/color-schemes/*.kcsrc", KStandardDirs::NoDuplicates );
	for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
	{
		KConfig _config( *it, KConfig::SimpleConfig );
		KConfigGroup config(&_config, "Color Scheme" );

		QString str;
		if (!(str = config.readEntry( "Name" )).isEmpty() ||
			!(str = config.readEntry( "name" )).isEmpty())
		{
			QString str2 = (*it).mid( (*it).lastIndexOf( '/' ) + 1 ); // strip off path
			str2.resize( str2.length() - 6 ); // strip off ".kcsrc
				combo->insertItem( str2, str );
		}
	}
}
Ejemplo n.º 11
0
NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type,
                                bool readOnly, QWidget *parent )
  : KDialog( parent), mAddressee( addr )
{
  setCaption( i18n( "Edit Contact Name" ) );
  setButtons( Help | Ok | Cancel );
  setDefaultButton( Ok );

  QWidget *page = new QWidget(this);
  setMainWidget( page );
  QGridLayout *layout = new QGridLayout( page );
  layout->setMargin( 0 );
  layout->setSpacing( spacingHint() );
  layout->addItem( new QSpacerItem( 100, 0 ), 0, 2 );
  QLabel *label;

  label = new QLabel( i18n( "Honorific prefixes:" ), page );
  layout->addWidget( label, 0, 0 );
  mPrefixCombo = new KComboBox( page );
  mPrefixCombo->setDuplicatesEnabled( false );
  mPrefixCombo->setEditable( true );
  mPrefixCombo->setEnabled( !readOnly );
  label->setBuddy( mPrefixCombo );
  layout->addWidget( mPrefixCombo, 0, 1, 1, 2 );

  mPrefixCombo->setWhatsThis( i18n( "The predefined honorific prefixes can be extended in the settings dialog." ) );

  label = new QLabel( i18n( "Given name:" ), page );
  layout->addWidget( label, 1, 0 );
  mGivenNameEdit = new KLineEdit( page );
  mGivenNameEdit->setReadOnly( readOnly );
  label->setBuddy( mGivenNameEdit );
  layout->addWidget( mGivenNameEdit, 1, 1, 1, 2 );

  label = new QLabel( i18n( "Additional names:" ), page );
  layout->addWidget( label, 2, 0 );
  mAdditionalNameEdit = new KLineEdit( page );
  mAdditionalNameEdit->setReadOnly( readOnly );
  label->setBuddy( mAdditionalNameEdit );
  layout->addWidget( mAdditionalNameEdit, 2, 1, 1, 2 );

  label = new QLabel( i18n( "Family names:" ), page );
  layout->addWidget( label, 3, 0 );
  mFamilyNameEdit = new KLineEdit( page );
  mFamilyNameEdit->setReadOnly( readOnly );
  label->setBuddy( mFamilyNameEdit );
  layout->addWidget( mFamilyNameEdit, 3, 1, 1, 2 );

  label = new QLabel( i18n( "Honorific suffixes:" ), page );
  layout->addWidget( label, 4, 0 );
  mSuffixCombo = new KComboBox( page );
  mSuffixCombo->setDuplicatesEnabled( false );
  mSuffixCombo->setEditable( true );
  mSuffixCombo->setEnabled( !readOnly );
  label->setBuddy( mSuffixCombo );
  layout->addWidget( mSuffixCombo, 4, 1, 1, 2 );

  mSuffixCombo->setWhatsThis( i18n( "The predefined honorific suffixes can be extended in the settings dialog." ) );

  label = new QLabel( i18n( "Formatted name:" ), page );
  layout->addWidget( label, 5, 0 );

  mFormattedNameCombo = new KComboBox( page );
  mFormattedNameCombo->setEnabled( !readOnly );
  layout->addWidget( mFormattedNameCombo, 5, 1 );
  connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( typeChanged( int ) ) );

  mFormattedNameEdit = new KLineEdit( page );
  mFormattedNameEdit->setEnabled( type == CustomName && !readOnly );
  layout->addWidget( mFormattedNameEdit, 5, 2 );

  mParseBox = new QCheckBox( i18n( "Parse name automatically" ), page );
  mParseBox->setEnabled( !readOnly );
  connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( parseBoxChanged(bool) ) );
  connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( modified() ) );
  layout->addWidget( mParseBox, 6, 0, 1, 2 );

  // Fill in the values
  mFamilyNameEdit->setText( addr.familyName() );
  mGivenNameEdit->setText( addr.givenName() );
  mAdditionalNameEdit->setText( addr.additionalName() );
  mFormattedNameEdit->setText( addr.formattedName() );

  // Prefix and suffix combos
  KConfig _config( "kabcrc" );
  KConfigGroup config(&_config, "General" );

  QStringList sTitle;
  sTitle += "";
  sTitle += i18n( "Dr." );
  sTitle += i18n( "Miss" );
  sTitle += i18n( "Mr." );
  sTitle += i18n( "Mrs." );
  sTitle += i18n( "Ms." );
  sTitle += i18n( "Prof." );
  sTitle += config.readEntry( "Prefixes" , QStringList() );
  sTitle.sort();

  QStringList sSuffix;
  sSuffix += "";
  sSuffix += i18n( "I" );
  sSuffix += i18n( "II" );
  sSuffix += i18n( "III" );
  sSuffix += i18n( "Jr." );
  sSuffix += i18n( "Sr." );
  sSuffix += config.readEntry( "Suffixes" , QStringList() );
  sSuffix.sort();

  mPrefixCombo->addItems( sTitle );
  mSuffixCombo->addItems( sSuffix );

  mPrefixCombo->setItemText( mPrefixCombo->currentIndex(), addr.prefix() );
  mSuffixCombo->setItemText( mSuffixCombo->currentIndex(), addr.suffix() );

  mAddresseeConfig.setAddressee( addr );
  mParseBox->setChecked( mAddresseeConfig.automaticNameParsing() );

  KAcceleratorManager::manage( this );

  connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( modified() ) );
  connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( modified() ) );
  connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( modified() ) );
  connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( modified() ) );
  connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( modified() ) );
  connect( mFormattedNameCombo, SIGNAL( activated( int ) ),
           this, SLOT( modified() ) );
  connect( mFormattedNameCombo, SIGNAL( activated( int ) ),
           this, SLOT( formattedNameTypeChanged() ) );
  connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( modified() ) );
  connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( formattedNameChanged( const QString& ) ) );
  connect(this,SIGNAL(helpClicked()),this,SLOT(slotHelp()));
  initTypeCombo();
  mFormattedNameCombo->setCurrentIndex( type );
  mPrefixCombo->lineEdit()->setFocus();
  mChanged = false;
}
Ejemplo n.º 12
0
bool CMenu::_Home(void)
{
	SetupInput();
	_showHome();

	string prevTheme = m_cfg.getString("GENERAL", "theme", "default");
	while(!m_exit)
	{
		/* battery gets refreshed in here... */
		_mainLoopCommon();
		/* and it always changes so... */
		m_btnMgr.setText(m_homeLblBattery, wfmt(PLAYER_BATTERY_LABEL, min((float)wd[0]->battery_level, 100.f), 
			min((float)wd[1]->battery_level, 100.f), min((float)wd[2]->battery_level, 100.f), min((float)wd[3]->battery_level, 100.f)));
		if(BTN_A_PRESSED)
		{
			if(m_btnMgr.selected(m_homeBtnSettings))
			{
				_hideHome();
				_config(1);
				if(prevTheme != m_cfg.getString("GENERAL", "theme") || m_reload == true)
				{
					m_exit = true;
					m_reload = true;
					break;
				}
				_showHome();
			}
			else if(m_btnMgr.selected(m_homeBtnReloadCache))
			{
				//m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
				UpdateCache(m_current_view);
				LoadView();
				break;
			}
			else if(m_btnMgr.selected(m_homeBtnUpdate) && !m_locked)
			{
				CoverFlow.stopCoverLoader(true);
				_hideHome();
				_system();
				remove(m_ver.c_str());
				if(m_exit)
					_launchHomebrew(m_dol.c_str(), m_homebrewArgs);
				else
				{
					_showHome();
					CoverFlow.startCoverLoader();
				}
			}
			else if(m_btnMgr.selected(m_homeBtnInstall))
			{
				_hideHome();
				_wbfsOp(WO_ADD_GAME);
				_showHome();
			}
			else if(m_btnMgr.selected(m_homeBtnAbout))
			{
				_hideHome();
				_about();
				_showHome();
			}
			else if(m_btnMgr.selected(m_homeBtnExitTo))
			{
				_hideHome();
				if(m_locked)
					exitHandler(WIIFLOW_DEF);
				else 
					_ExitTo();
				_showHome();
			}
			else if(m_btnMgr.selected(m_homeBtnExplorer))
			{
				_hideHome();
				_Explorer();
				_showHome();
			}
			else if(m_btnMgr.selected(m_homeBtnFTP))
			{
				_hideHome();
				_FTP();
				_showHome();
			}
		}
		else if(BTN_HOME_PRESSED)
		{
			exitHandler(WIIFLOW_DEF);
			break;
		}
		else if(BTN_B_PRESSED)
			break;
	}

	_hideHome();
	return m_exit;
}
Ejemplo n.º 13
0
KCMInit::KCMInit( KCmdLineArgs* args )
{
  QDBusConnection::sessionBus().registerObject("/kcminit", this,
      QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportScriptableSignals);
  QString arg;
  if (args->count() == 1) {
    arg = args->arg(0);
  }

  if (args->isSet("list"))
  {
    list = KServiceTypeTrader::self()->query( "KCModuleInit" );

    for(KService::List::Iterator it = list.begin();
        it != list.end();
        ++it)
    {
      KService::Ptr service = (*it);
      if (service->library().isEmpty())
        continue; // Skip
      printf("%s\n", QFile::encodeName(service->desktopEntryName()).data());
    }
    return;
  }

  if (!arg.isEmpty()) {

    QString module = arg;
    if (!module.endsWith(".desktop"))
       module += ".desktop";

    KService::Ptr serv = KService::serviceByStorageId( module );
    if ( !serv || serv->library().isEmpty() ) {
      kError(1208) << i18n("Module %1 not found", module) << endl;
      return;
    } else
      list.append(serv);

  } else {

    // locate the desktop files
    list = KServiceTypeTrader::self()->query( "KCModuleInit" );

  }
  // This key has no GUI apparently
  KConfig _config( "kcmdisplayrc" );
  KConfigGroup config(&_config, "X11");
#ifdef Q_WS_X11
  bool multihead = !config.readEntry( "disableMultihead", false) &&
                    (ScreenCount(QX11Info::display()) > 1);
#else
  bool multihead = false;
#endif
  // Pass env. var to kdeinit.
  QString name = "KDE_MULTIHEAD";
  QString value = multihead ? "true" : "false";
  KToolInvocation::klauncher()->setLaunchEnv(name, value);
  setenv( name.toLatin1().constData(), value.toLatin1().constData(), 1 ); // apply effect also to itself

  if( startup )
  {
     runModules( 0 );
     XEvent e;
     e.xclient.type = ClientMessage;
     e.xclient.message_type = XInternAtom( QX11Info::display(), "_KDE_SPLASH_PROGRESS", False );
     e.xclient.display = QX11Info::display();
     e.xclient.window = QX11Info::appRootWindow();
     e.xclient.format = 8;
     strcpy( e.xclient.data.b, "kcminit" );
     XSendEvent( QX11Info::display(), QX11Info::appRootWindow(), False, SubstructureNotifyMask, &e );
     sendReady();
     QTimer::singleShot( 300 * 1000, qApp, SLOT(quit())); // just in case
     qApp->exec(); // wait for runPhase1() and runPhase2()
  }
  else
     runModules( -1 ); // all phases
}
Ejemplo n.º 14
0
int main()
{
    try
    {
        Array<CIMName> all;
        Array<String> values;
        String value;

        String currentFile;
        String plannedFile;
        const char* tmpDir = getenv ("PEGASUS_TMP");
        if (tmpDir == NULL)
        {
            currentFile = ".";
            plannedFile = ".";
        }
        else
        {
            currentFile = tmpDir;
            plannedFile = tmpDir;
        }
        currentFile.append("/cimserver_current.conf");
        plannedFile.append("/cimserver_planned.conf");

        ConfigFileHandler _config (currentFile, plannedFile, true);

        _config.loadAllConfigProperties();

        _config.getAllCurrentPropertyNames(all);

        for (Uint32 i = 0; i < all.size(); i++)
        {
            _config.getCurrentValue(all[i], value);
            _config.getPlannedValue(all[i], value);
        }

        all.clear();

        _config.getAllPlannedProperties(all, values);

        for (Uint32 i = 0; i < all.size(); i++)
        {
            _config.getPlannedValue(all[i], value);
        }

        all.clear();
        values.clear();

        _config.getAllCurrentProperties(all, values);

        for (Uint32 i = 0; i < all.size(); i++)
        {
            _config.getCurrentValue(all[i], value);
        }

    }
    catch (Exception& e)
    {
        cerr << "Exception: " << e.getMessage() << endl;
        exit(1);
    }

    cout << "+++++ passed all tests" << endl;

    return 0;
}
Picoftheday::Picoftheday()
{
  KConfig _config( "korganizerrc" );
  KConfigGroup config( &_config, "Picture of the Day Plugin" );
  mThumbSize = config.readEntry( "InitialThumbnailSize", QSize( 120, 60 ) );
}
ThisDayInHistory::ThisDayInHistory()
{
  KConfig _config( "korganizerrc" );
  KConfigGroup config( &_config, "This Day in History Plugin" );
}